pub struct Lexer<'a> { /* private fields */ }Implementations§
Source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
Sourcepub fn new(input: &str, interner: &'a mut Interner) -> Lexer<'a>
pub fn new(input: &str, interner: &'a mut Interner) -> Lexer<'a>
Creates a new lexer for the given input text.
The lexer will tokenize natural language text according to the lexicon database, performing morphological analysis and ambiguity resolution.
§Arguments
input- The natural language text to tokenizeinterner- String interner for efficient symbol handling
§Example
use logicaffeine_language::lexer::Lexer;
use logicaffeine_base::Interner;
let mut interner = Interner::new();
let mut lexer = Lexer::new("Every cat sleeps.", &mut interner);
let tokens = lexer.tokenize();
assert_eq!(tokens.len(), 5); // Quantifier, Noun, Verb, Period, EOISourcepub fn tokenize(&mut self) -> Vec<Token>
pub fn tokenize(&mut self) -> Vec<Token>
Tokenizes the input text and returns a vector of Tokens.
Each token includes its type, the interned lexeme, and the source span for error reporting. Words are classified according to the lexicon database with priority-based ambiguity resolution.
§Returns
A vector of tokens representing the input. The final token is
typically TokenType::Eof.
pub fn is_collective_verb(lemma: &str) -> bool
pub fn is_mixed_verb(lemma: &str) -> bool
pub fn is_distributive_verb(lemma: &str) -> bool
pub fn is_intensional_predicate(lemma: &str) -> bool
pub fn is_opaque_verb(lemma: &str) -> bool
pub fn is_ditransitive_verb(lemma: &str) -> bool
pub fn is_subject_control_verb(lemma: &str) -> bool
pub fn is_raising_verb(lemma: &str) -> bool
pub fn is_object_control_verb(lemma: &str) -> bool
pub fn is_weather_verb(lemma: &str) -> bool
Auto Trait Implementations§
impl<'a> Freeze for Lexer<'a>
impl<'a> RefUnwindSafe for Lexer<'a>
impl<'a> Send for Lexer<'a>
impl<'a> Sync for Lexer<'a>
impl<'a> Unpin for Lexer<'a>
impl<'a> UnsafeUnpin for Lexer<'a>
impl<'a> !UnwindSafe for Lexer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.