ClauseParsing

Trait ClauseParsing 

Source
pub trait ClauseParsing<'a, 'ctx, 'int> {
Show 16 methods // Required methods fn parse_sentence(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>; fn parse_conditional(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>; fn parse_either_or(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>; fn parse_disjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>; fn parse_conjunction(&mut self) -> Result<&'a LogicExpr<'a>, ParseError>; fn parse_relative_clause( &mut self, gap_var: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>; fn parse_gapped_clause( &mut self, borrowed_verb: Symbol, ) -> Result<&'a LogicExpr<'a>, ParseError>; fn parse_counterfactual_antecedent( &mut self, ) -> Result<&'a LogicExpr<'a>, ParseError>; fn parse_counterfactual_consequent( &mut self, ) -> Result<&'a LogicExpr<'a>, ParseError>; fn check_wh_word(&self) -> bool; fn is_counterfactual_context(&self) -> bool; fn is_complete_clause(&self, expr: &LogicExpr<'a>) -> bool; fn extract_verb_from_expr(&self, expr: &LogicExpr<'a>) -> Option<Symbol>; fn try_parse_ellipsis( &mut self, ) -> Option<Result<&'a LogicExpr<'a>, ParseError>>; fn check_ellipsis_auxiliary(&self) -> bool; fn check_ellipsis_terminator(&self) -> bool;
}
Expand description

Trait for parsing clause-level structures.

Defines methods for parsing sentences, conditionals, conjunctions, and other clause-level constructs.

Required Methods§

Source

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

Parses a complete sentence, handling imperatives, ellipsis, and questions.

Source

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

Parses “if P then Q” conditionals with DRS scope handling.

Source

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

Parses “either P or Q” exclusive disjunctions.

Source

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

Parses “P or Q” disjunctions.

Source

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

Parses “P and Q” conjunctions with scope coordination.

Source

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

Parses “who/that/which” relative clauses attaching to noun phrases.

Source

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

Parses a clause with a gap filled by borrowed verb (for VP coordination).

Source

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

Parses “if P were/had” counterfactual antecedent (subjunctive).

Source

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

Parses “Q would” counterfactual consequent.

Source

fn check_wh_word(&self) -> bool

Checks if current token is a wh-word (who, what, which, etc.).

Source

fn is_counterfactual_context(&self) -> bool

Returns true if parsing a counterfactual context.

Source

fn is_complete_clause(&self, expr: &LogicExpr<'a>) -> bool

Returns true if expression is a complete clause.

Source

fn extract_verb_from_expr(&self, expr: &LogicExpr<'a>) -> Option<Symbol>

Extracts the main verb from an expression.

Source

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

Attempts to parse VP ellipsis (“Mary did too”).

Source

fn check_ellipsis_auxiliary(&self) -> bool

Checks for ellipsis auxiliary (did, does, can, etc.).

Source

fn check_ellipsis_terminator(&self) -> bool

Checks for ellipsis terminator (too, also, as well).

Implementors§

Source§

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