nltk-porter
A faithful Rust port of NLTK's Porter stemmer (nltk.stem.porter.PorterStemmer),
dependency-free and verified against NLTK.
NLTK ships its own Porter implementation with three selectable modes; this port
reproduces all three exactly (unlike rust-stemmers, which wraps Snowball's Porter).
use ;
let p = new;
assert_eq!;
assert_eq!;
assert_eq!;
Modes
Mode::Nltk(default) — NLTK contributors' extensions.Mode::Martin— only the extensions on Martin Porter's website.Mode::Original— faithful to the 1980 paper (Porter deprecates this).
Verification
Differential-tested against Python nltk's PorterStemmer: 68,000+ words (the NLTK
words corpus plus tricky cases and random fuzz tokens) in each of the three modes,
zero mismatches. Words are processed by Unicode scalar value, matching Python's str.
Ported from NLTK (Apache-2.0).