PragmaticsParsing

Trait PragmaticsParsing 

Source
pub trait PragmaticsParsing<'a, 'ctx, 'int> {
    // Required methods
    fn parse_focus(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn parse_measure(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn parse_presupposition(
        &mut self,
        subject: &NounPhrase<'a>,
        presup_kind: PresupKind,
    ) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn parse_predicate_for_subject(
        &mut self,
        subject: &NounPhrase<'a>,
    ) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn parse_scopal_adverb(
        &mut self,
        subject: &NounPhrase<'a>,
    ) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn parse_superlative(
        &mut self,
        subject: &NounPhrase<'a>,
    ) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn parse_comparative(
        &mut self,
        subject: &NounPhrase<'a>,
        copula_time: Time,
        difference: Option<&'a Term<'a>>,
    ) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn check_number(&self) -> bool;
    fn parse_measure_phrase(&mut self) -> Result<&'a Term<'a>, ParseError>;
}
Expand description

Trait for parsing pragmatic and focus-sensitive constructions.

Provides methods for parsing linguistic phenomena that go beyond pure syntax/semantics, including focus particles, presupposition triggers, measure phrases, degree expressions (comparatives/superlatives), and scopal adverbs.

Focus is represented using alternative semantics, where the focused element evokes a set of alternatives. Presuppositions project through various operators and represent background entailments.

Required Methods§

Source

fn parse_focus(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a focus particle construction: “only John runs”, “even Mary left”.

Focus particles like “only”, “even”, and “also” introduce alternative semantics. The focused element is contrasted with a contextually determined set of alternatives.

Returns a LogicExpr::Focus with the focus kind, focused element, and the scope predicate.

Source

fn parse_measure(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a measure construction: “much water is cold”, “little food arrived”.

Measure expressions quantify over amounts using “much”, “little”, etc. The result is an existentially quantified formula binding the measured entity with a measure predicate.

Source

fn parse_presupposition( &mut self, subject: &NounPhrase<'a>, presup_kind: PresupKind, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a presupposition-triggering verb: “stopped running”, “regrets leaving”.

Presupposition triggers introduce background entailments that project through negation and other operators:

  • “stop P” presupposes: previously P; asserts: now ¬P
  • “start P” presupposes: previously ¬P; asserts: now P
  • “regret P” presupposes: P happened; asserts: subject regrets it
  • “continue P” presupposes: was P; asserts: still P

Returns a LogicExpr::Presupposition separating assertion from presupposition.

Source

fn parse_predicate_for_subject( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a simple predicate for a given subject noun phrase.

Handles verb phrases with optional objects and focus-marked objects like “eats only rice”. Used as a helper for focus and other pragmatic constructions.

Source

fn parse_scopal_adverb( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a scopal adverb construction: “always runs”, “never sleeps”.

Scopal adverbs like “always”, “never”, “usually”, “sometimes” quantify over times, events, or situations. They create a LogicExpr::Scopal operator that scopes over the verb predicate.

Source

fn parse_superlative( &mut self, subject: &NounPhrase<'a>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a superlative construction: “is the tallest student”.

Superlatives identify the unique maximal individual along a gradable dimension within a comparison class. Returns a LogicExpr::Superlative with the adjective, subject, and domain restrictor.

Source

fn parse_comparative( &mut self, subject: &NounPhrase<'a>, copula_time: Time, difference: Option<&'a Term<'a>>, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a comparative construction: “is taller than Mary”, “is greater than 0”.

Comparatives establish an ordering relation along a gradable dimension. Supports both NP comparisons (“taller than Mary”) and numeric comparisons (“greater than 0”). The optional difference parameter handles differential comparatives like “3 inches taller”.

Returns a LogicExpr::Comparative with adjective, subject, and object.

Source

fn check_number(&self) -> bool

Checks if the current token is a numeric literal.

Used to distinguish numeric comparisons (“greater than 0”) from entity comparisons (“taller than John”).

Source

fn parse_measure_phrase(&mut self) -> Result<&'a Term<'a>, ParseError>

Parses a measure phrase: “5 meters”, “100 kilograms”.

Measure phrases combine a numeric value with an optional unit. The unit is looked up in the lexicon to determine its dimension (length, mass, time, etc.).

Returns a Term::Value with the parsed number, unit, and dimension.

Implementors§

Source§

impl<'a, 'ctx, 'int> PragmaticsParsing<'a, 'ctx, 'int> for Parser<'a, 'ctx, 'int>