LogicVerbParsing

Trait LogicVerbParsing 

Source
pub trait LogicVerbParsing<'a, 'ctx, 'int> {
    // Required methods
    fn parse_predicate_with_subject(
        &mut self,
        subject_symbol: Symbol,
    ) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn parse_predicate_with_subject_as_var(
        &mut self,
        subject_symbol: Symbol,
    ) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn try_parse_plural_subject(
        &mut self,
        first_subject: &NounPhrase<'a>,
    ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>;
    fn parse_control_structure(
        &mut self,
        subject: &NounPhrase<'a>,
        verb: Symbol,
        verb_time: Time,
    ) -> Result<&'a LogicExpr<'a>, ParseError>;
    fn is_control_verb(&self, verb: Symbol) -> bool;
    fn build_group_predicate(
        &mut self,
        subjects: &[Symbol],
        verb: Symbol,
        verb_time: Time,
    ) -> &'a LogicExpr<'a>;
    fn build_group_transitive(
        &mut self,
        subjects: &[Symbol],
        objects: &[Symbol],
        verb: Symbol,
        verb_time: Time,
    ) -> &'a LogicExpr<'a>;
}
Expand description

Trait for parsing verb phrases in declarative (logic) mode.

Provides methods for parsing predicates with subjects, control verbs, and plural/group constructions with Neo-Davidsonian event semantics.

Required Methods§

Source

fn parse_predicate_with_subject( &mut self, subject_symbol: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a verb phrase given the subject as a constant symbol.

Source

fn parse_predicate_with_subject_as_var( &mut self, subject_symbol: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses a verb phrase with subject as a bound variable.

Source

fn try_parse_plural_subject( &mut self, first_subject: &NounPhrase<'a>, ) -> Result<Option<&'a LogicExpr<'a>>, ParseError>

Attempts to parse a plural subject (“John and Mary verb”). Returns Ok(Some(expr)) on success, Ok(None) if not plural, Err on semantic error.

Source

fn parse_control_structure( &mut self, subject: &NounPhrase<'a>, verb: Symbol, verb_time: Time, ) -> Result<&'a LogicExpr<'a>, ParseError>

Parses control verb structures: “wants to VP”, “persuaded X to VP”.

Source

fn is_control_verb(&self, verb: Symbol) -> bool

Checks if a verb is a control verb (want, try, persuade, etc.).

Source

fn build_group_predicate( &mut self, subjects: &[Symbol], verb: Symbol, verb_time: Time, ) -> &'a LogicExpr<'a>

Builds a predicate for intransitive verbs with multiple subjects.

Source

fn build_group_transitive( &mut self, subjects: &[Symbol], objects: &[Symbol], verb: Symbol, verb_time: Time, ) -> &'a LogicExpr<'a>

Builds a transitive predicate with group subject and group object.

Implementors§

Source§

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