Plain English in. Structured triples out.

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.

Get started See examples
nl3.parse(…)
"user jack contacts user jill"
Subject
user
jack
Predicate
message
contacts → message
Object
user
jill

Three ideas, that's it

You teach nl3 your domain once, then throw natural phrasings at it.

1

Grammar

Declare valid relations as "Subject Predicate Object". Words are singularized, so a rule covers every number form.

2

Vocabulary

Map word stems to predicates so synonyms and tenses - msg, messaged, contacted - all collapse onto one.

3

Parse

Call parse() and get a validated Triple - with reversed phrasings flipped back into shape.

Built for Rust

Idiomatic API, faithful behavior, light footprint.

Typed results

Result<Triple, ParseError> instead of throws - empty input and invalid triples are distinct, matchable errors.

Builder API

Fluent Nl3::builder() with ergonomic IntoIterator inputs for grammar and vocabulary.

Pluggable tagger

A lightweight default tagger ships in-box; implement the Tagger trait to plug in your own - even rust-bert.

Synonyms & tenses

Classic Porter stemming means sent, sends, and mailed fold to one predicate.

Auto-flipping

Reversed phrasings are detected against the grammar and flipped into the correctly oriented triple.

Show me the code

From one rule to a full domain.

main.rs

Install

Add it to your Cargo.toml.

[dependencies]
nl3-rs = "0.1"

The crate is imported as use nl3::Nl3;