nl3 parses short Subject · Predicate · Object phrases into validated triples. Describe your domain with a grammar and a vocabulary - nl3 handles the synonyms, tenses, and reversed phrasings.
You teach nl3 your domain once, then throw natural phrasings at it.
Declare valid relations as "Subject Predicate Object".
Words are singularized, so a rule covers every number form.
Map word stems to predicates so synonyms and tenses -
msg, messaged,
contacted - all collapse onto one.
Call parse() and get a validated
Triple - with reversed phrasings flipped back into shape.
Idiomatic API, faithful behavior, light footprint.
Result<Triple, ParseError> instead of
throws - empty input and invalid triples are distinct, matchable errors.
Fluent Nl3::builder() with ergonomic
IntoIterator inputs for grammar and vocabulary.
A lightweight default tagger ships in-box; implement the
Tagger trait to plug in your own - even
rust-bert.
Classic Porter stemming means sent,
sends, and mailed
fold to one predicate.
Reversed phrasings are detected against the grammar and flipped into the correctly oriented triple.
From one rule to a full domain.
Add it to your Cargo.toml.
[dependencies]
nl3-rs = "0.1"
The crate is imported as use nl3::Nl3;