A Java library in the spirit of evo-inflector, plus a native TypeScript port with the same pipeline, lexicon and compound table: predictable runtime behaviour, no dependencies, no network calls, no model downloads. A 147,338-entry auditable lexicon, three productive rules, and a diagnostic API that says why a form was chosen.
The 1.4.0 artifacts are built from this release. Coordinates: io.github.slayyyyer.morphex:english-inflector-core:1.4.0.
Rules-only runtime mode: EnglishInflector.builder().withoutBundledLexicon().build() disables loading the packaged lexicon and uses three productive rules plus your overrides. The lexical resources still ship inside the JAR, so the CC BY-SA 3.0 data attribution and distribution terms still apply.
TypeScript / JavaScript: the native port lives in morphex-ts/ and shares this lexicon and compound table. Install it with npm install morphex. See TypeScript / JavaScript below.
New in 1.4.0: Java and npm now share the same version. No public API or behavior change; the 1.3.0 evidence below still applies.
New in 1.3.0: independent AGID unseen-lemma evidence, ASCII shape fast paths, and a flattened ordered rule dispatch that brings compacted lookup to 79.4 ns/op. The public API and rule precedence are unchanged. The 1.2.0 compound/casing work remains the foundation; the linear selector is still not shipped.
EnglishInflector inflector = EnglishInflector.standard();
inflector.pluralize("child"); // "children"
inflector.pluralize("CHILD"); // "CHILDREN"
inflector.pluralize("UFO"); // "UFOs"
inflector.pluralize("mother-in-law"); // "mothers-in-law"
inflector.pluralize("cat", 1); // "cat" (source instance kept)
inflector.pluralize("cat", 3); // "cats"
Inflection r = inflector.analyze("die");
r.plural(); // "dice"
r.alternatives(); // ["dies"]
r.ambiguous(); // true
r.source(); // LEXICON — "lex:die"
A native port in morphex-ts/: same precedence, same 147,338-entry lexicon, same bounded compound table, zero runtime dependencies. Node 18+ and browsers.
Install: npm install morphex@1.4.0
import { EnglishInflector } from 'morphex';
const inflector = EnglishInflector.standard();
inflector.pluralize('CHILD'); // 'CHILDREN'
inflector.pluralize('UFO'); // 'UFOs'
inflector.pluralize('mother-in-law'); // 'mothers-in-law'
inflector.pluralize('cat', 1); // 'cat'
const result = inflector.analyze('die');
result.plural; // 'dice'
result.alternatives; // ['dies']
result.ambiguous; // true
result.stage; // 'LEXICON'
result.source; // 'lex:die'
From a checkout: cd morphex-ts && npm install && npm run build. Full API and conformance notes are in morphex-ts/README.md.
Rules-only vs bundled lexicon. The rules-only entry point (morphex/rules, or withoutBundledLexicon()) ships no data at all and loses irregular forms by design. The default package ships a delta artifact containing only entries the three rules do not reproduce; morphex/full is opt-in for complete analyze() metadata. Sizes below are measured by the build scripts on this machine, not estimates.
| Artifact | Raw | Gzip |
|---|---|---|
morphex/rules (no data) | 0 B | 0 B |
Delta lexicon for pluralize() (124,883 entries) | 1,962,900 B | 562,893 B |
Full lexicon for analyze() (147,338 entries) | 3,707,556 B | 785,131 B |
| Membership sidecar (340,726 hashes, base64) | 1,817,208 B | 1,333,152 B |
| This page's demo bundle (full lexicon, minified ESM) | 3,735,118 B | 794,141 B |
The demo above loads the full 147,338-entry lexicon; the 1.3 MB membership sidecar is omitted in the browser, so uppercase-initialism inference for unknown acronyms is disabled here. Node builds can load the sidecar with createBundledFullLexicon().
evo-inflector is a compact, well-loved library; this project grew out of wanting a few more edge cases covered. Two design choices explain the differences: lookup normalization is kept separate from output case restoration, and lexical exceptions are whole-word edits rather than suffix rules, so carp can’t affect scarp and louse can’t affect blouse. That trades a larger data file for fewer surprises. evo-inflector’s smaller, simpler approach may suit you better if you don’t need the extra coverage.
| Input | evo-inflector 2.0 | morphex |
|---|---|---|
German | Germen | Germans |
blouse | blice | blouses |
scarp | scarp | scarps |
UFO | UFOes | UFOs |
mother-in-law | mother-in-laws | mothers-in-law |
CHILD | CHILDren | CHILDREN |
Full head-to-head with qualifications → · stock 2.0 output is reproduced in docs/upstream-probe.md
JMH 1.37 on JDK 21, 2 forks, GC profiler.
Packed lexicon retains ~18.2 MiB. External UD English EWT selected-output check: 98.76% overall (evo2 98.12%), 98.88% on the 2,148 full-vocabulary-seen lemmas, 96.69% on 363 compact-artifact hits, and 91.67% on only 36 genuinely unseen lemmas; alternative coverage 98.99%. A larger independent AGID 2016.01.19 stress test has 261 genuinely unseen lemmas: the lexicon and rules-only tie at 95.40% (249/261), evo2 95.02%. AGID is automatically generated and not a corpus; its 93.84% lexicon overall reflects 1,722 MASS/invariant identity returns against generated plurals, not a natural-text regression. Comparisons →
First match wins. Nothing is guessed.
+es after sibilants, consonant-y → ies, default +s, plus bounded backoffs.analyze.
Against evo-inflector 2.0: accuracy, latency, behaviour differences and migration notes.
JMH methodology, raw numbers, allocation, startup and retained footprint.
Precedence, packed lexicon layout, casing, compounds, countability, tradeoffs.
P1/P2 definitions, corrected OOF learning, external validation, and the rejected runtime model.