Accuracy · latency · behaviour

Comparisons

How this library differs from org.atteo:evo-inflector:2.0 (stock outputs reproduced and measured in this repository). evo-inflector is the compact, rule-based starting point this project builds on — smaller and simpler, and the better fit when you don't need the extra coverage below. Full detail in docs/comparison.md.

P1 frozen lexicon 100% +3.53 pp · evo2 96.474
P2 family holdout 97.365% +0.89 pp · evo2 96.474
External EWT overall 98.76% +0.64 pp · evo2 98.12
Repeated lookup 81.4 ns/op 1.36× faster · evo2 110.9
Compacted regular 79.4 ns/op 1.33× slower · evo2 59.8

All recorded comparisons

Dimension evo-inflector 2.0 This library
P1 frozen-lexicon accuracy (36,241 records) 96.474% (1,278 errors) 100.000% (0 errors)
P1 paired gain (95% CI) — +3.5264 pp [+3.3318, +3.7132], 1,278 fixes, 0 regressions
P2 family-holdout accuracy (36,241) 96.474% (1,278 errors) 97.365% (955 errors; +0.8913 pp; +4 vs historical v1)
External UD EWT selected overall / full-vocab seen (2,148) / artifact hit (363) 98.12% / 98.23% / 94.21% 98.76% / 98.88% / 96.69%; 98.99% alternative coverage
Repeated lookup (fixed workload) 110.9 ns/op 81.4 ns/op (0.73×)
Compacted regular-word lookup (flattened dispatch) 59.8 ns/op 79.4 ns/op (1.33× slower)
Concurrent throughput, 4 threads 20.91M ops/s 4.82M ops/s (4.34× lower)
Runtime dependencies none none

Accuracy, side by side

Same protocol, same records, same run. P1 is the frozen-lexicon dictionary-coverage protocol; P2 hides each lemma's word family; external EWT is a separate corpus with no retraining.

accuracy % · higher is better
evo-inflector 2.0 morphex
P1 frozen lexicon +3.53 pp · 36,241 records
96.474
100.000
P2 family holdout +0.89 pp · 36,241 records
96.474
97.365
External EWT overall +0.64 pp · 2,184 lemmas
98.12
98.76
EWT full-vocabulary seen +0.65 pp · 2,148 lemmas
98.23
98.88
EWT compact-artifact hits +2.48 pp · 363 lemmas
94.21
96.69
Axis starts at 94%, not zero: bar length shows distance above 94% so the close results stay distinguishable. Printed values are the recorded scores. P1 is dictionary coverage, not generalization; only 36 EWT lemmas are genuinely unseen.

Latency

Arithmetic mean latency in ns/op, lower is better. Repeated lookup uses the release workload; compacted is the flattened-dispatch rerun with its own same-run evo2 reference.

ns/op · lower is better
evo2 morphex
Repeated lookup release baseline · 1.36× faster
110.9
81.4
Compacted regular targeted rerun · 1.33× slower
59.8
79.4
Bars share a 0–120 ns axis. The two rows come from different runs and are not a same-session A/B.

Concurrency

Four threads sharing one immutable instance, throughput over the mixed workload in the same run.

M ops/s · higher is better
evo-inflector 2.0 reference
20.91 M
morphex thread-safe, but more allocation and probing per call
4.82 M
4.34× lower throughput in this run. The instance is immutable and thread-safe; the gap is a measured concurrency limitation, not a safety issue.
Node.js · V8 · measured separately

The TypeScript port

The same pipeline also ships as a native TypeScript package in morphex-ts/. Its numbers below are Node micro-benchmarks on an Intel Core i5-12500H with Node.js 24.20.0, not JVM measurements; they are deliberately kept out of the JMH tables above and are not comparable with them. Only recorded values appear.

Node workload Delta engine Full engine Rules-only
Repeated lexical word (child) 111–119 ns 269–280 ns 130–139 ns
Repeated rule word (cat) 112–118 ns 174–188 ns 104–116 ns
Repeated compound (mother-in-law) 258–289 ns 434–457 ns 358–378 ns
Distinct fixture lemmas (4,000 words) 354–432 ns 1,006–1,057 ns 327–355 ns
analyze() repeated (die) 258–278 ns 421–441 ns 221–228 ns

The delta engine answers pluralize() from 1,962,900 B raw / 562,893 B gzip; the full engine is 3,707,556 B raw / 785,131 B gzip; the rules-only entry point ships no data. The delta engine builds a 1 MiB open-addressed hash index over its 124,883 keys, taking its rule-word path from 673–678 ns (four binary searches) through 286–293 ns (one merged binary search) to 112–118 ns. Provider construction measures 50–51 ms end to end (32–33 ms parsing, 17–19 ms building the index), down from 77–81 ms before the construction changes. Method and spread: morphex-ts/BENCHMARKS.md.

Where the differences come from

  1. Lookup and casing in one step. Stock 2.0 reaches its exception table lower-cased but re-cases the result as a suffix edit: German → Germen, CHILD → CHILDren. This library separates lookup normalization from output case restoration.
  2. Lexical exceptions that behave like suffix rules. carp (invariant) covers scarp; louse → lice reaches blouse → blice. This library stores lexical knowledge as whole-word edits and keeps only three productive rules.
  3. Compounds. Stock 2.0 inflects a different constituent (mother-in-laws, attorney generals). This library uses a bounded reviewed table and leaves unmatched input unchanged rather than guessing.

Outputs that differ

Input 2.0 Here
German Germen Germans
blouse blice blouses
scarp scarp scarps
UFO UFOes UFOs
mother-in-law mother-in-laws mothers-in-law
passer-by passer-bies passers-by
CHILD / CITY CHILDren / CITIes CHILDREN / CITIES
drive-by drive-bies drive-bys
attorney general attorney generals attorneys general

Intentional policy differences

Input Here Reason
information unchanged mass-noun policy (MASS)
person people (accepts persons) preferred form modelled
die dice (accepts dies) ambiguous sense flagged
user_id, 3.14 unchanged (FALLBACK) out of scope, reported
well-known unchanged unmatched compounds not guessed
Qualifications: P1 is dictionary coverage, not generalization. External EWT overall accuracy is 98.76% vs 98.12%; 98.88% on full-vocabulary-seen lemmas and 96.69% on compact-artifact hits, but only 36 EWT lemmas are genuinely unseen. The larger AGID 2016.01.19 stress test has 261 unseen lemmas, where the lexicon and rules-only tie at 95.40% (249/261); AGID is automatically generated, and its 93.84% lexicon overall is dominated by MASS/invariant identity returns, not natural-text accuracy. Current P2 has 4 more errors than the historical v1 measurement (955 vs 951).

Migrate

// before
String plural = org.atteo.evo.inflector.English.plural(word);

// after — build once, share (construction loads the lexicon)
private static final EnglishInflector INFLECTOR = EnglishInflector.standard();
String plural = INFLECTOR.pluralize(word);

No org.atteo.evo.inflector shim ships on purpose (it would duplicate the API on the benchmark classpath). Caller overrides take precedence over everything: builder().override("information", "informations").

Which should you use? Stay with evo-inflector 2.0 if you want the smallest thing that works — no data file, static API, well understood. Choose this library if the rows above matter to you and you can carry the 7.55 MB TSV (1.18 MB gzip, ~18.2 MiB retained) — or use the rules-only runtime mode, which does not load the data but does not remove it from the JAR or its CC BY-SA obligations. It loses irregular forms.

Python baseline: inflect 7.6.0

The most widely used Python pluralization engine, scored on the historical v1 P1 protocol (36,239 primary / 50,938 overall, default modern mode). These baseline numbers are retained as historical evidence and are not current v2 measurements. Full write-up in docs/python-baseline.md.

System P1 primary Errors
This library (historical v1 run) 100.000% 0 (36,239 records)
evo-inflector 2.0 (historical v1 run) 96.473% 1,278
PyPI inflect 94.169% 2,113
Repaired rules only 95.168% 1,751

inflect agrees on the headline irregulars (German, blouse, person → people, die → dice) and shares the passer-by → passer-bies weakness. Its misses concentrate in initialism casing (UFO → UFOS, 0/1,110 on the initialism slice), classical -us forms, and mass nouns pluralized — the same structural overall-accuracy story (67.08% vs 68.83% evo2).