Expand description
WordNet-style morphological processing (morphy).
Faithful to the classic morphy algorithm: check exceptions, apply suffix
rules, and verify candidates via a caller-provided lemma existence
predicate. The crate is intentionally decoupled from any particular loader;
it only depends on Pos and the callback you supply.
§How it works
- Emit the surface form if it exists.
- Check exceptions (
*.excfiles). - Apply POS-specific suffix rules.
- Deduplicate while preserving provenance (
Surface,Exception,Rule).
§Example
use wordnet_db::{LoadMode, WordNet};
use wordnet_morphy::Morphy;
use wordnet_types::Pos;
let dict = "/path/to/wordnet";
let wn = WordNet::load_with_mode(dict, LoadMode::Mmap)?;
let morph = Morphy::load(dict)?;
let exists = |pos, lemma: &str| wn.lemma_exists(pos, lemma);
let cands = morph.lemmas_for(Pos::Verb, "running", exists);
for cand in cands {
println!("{:?}: {}", cand.source, cand.lemma);
}For a runnable demo, see cargo run -p wordnet-morphy --example lookup -- <dict> [--demo|<word>].
Structs§
- Lemma
Candidate - A lemma candidate paired with its POS and provenance.
- Morphy
- Minimal morphy implementation parameterised by caller-provided existence checks.
Enums§
- Candidate
Source - Where a candidate lemma originated.