Mova0.6 pre-release

forms — exact word forms from lemmas and UD features

forms turns (lemma, UPOS, UD features) into the exact English or French word form, and a form back into its analyses. It is the way back for a generator that speaks lemmas plus feature tags (one word, one token) and needs real English: be AUX Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin → were.

It reads inflection tables (one paradigm per lemma, JSON lines) and checks them against Mova's parsed English Wikipedia (a treestore directory).

How it works

Tables (src/table.rs). Every forms-*.jsonl under a directory, recursively, one record per line: {"lang","lemma","pos","forms":[{"form","features"}],"irregular","pattern","notes"}. Features are UD bundles; an empty bundle means an unresolved analysis. A second record for the same (lang, lemma, pos) is refused.

Generate (src/generator.rs). The table of (lemma, UPOS) is looked up by exact spelling, then by the only entry differing in case; AUX falls back to VERB and PRON to DET (and back). Each cell is scored against the query (src/feats.rs):

fitmeaning
exactthe same keys and values
subsetevery cell feature is in the query; the query carries more (Voice=Pass, ExtPos, Case=Gen on «its»)
compatibleno shared key with different values, some cell keys missing in the query; tied cells give several forms
citationthe query shares no key with any cell (no features): the first form
unresolvedthe table has only unresolved cells

The best cells win, in table order, so the table's first form is the preferred one and the others are variants (headscarves, headscarfs; a, an). A query Number=Ptan (plurale tantum) also matches Number=Plur. When every cell conflicts, the answer is empty: the table knows the lemma but has no such cell (beautiful ADJ Degree=Cmp → nothing; the comparison is periphrastic).

Rules (src/rules.rs), English only, and only for a (lemma, UPOS) with no table, after the grammar's chapters 06 (spelling), 11 (nouns), 13 (verbs) and 15 (comparison):

rulewhatexample
s, s-es, s-ies-s; -es after ⟨s x z ch sh⟩; consonant + y → -iescats, boxes, cities
s-ch-k-s after ⟨ch⟩ pronounced /k/ (from CMUdict)stomachs, epochs
s-zzesthe closed set quiz, whiz, fezquizzes
s-oes, s-oes-var, s-os, s-os-varnouns in -o take -s except the closed -oes set (and its compounds); verbs: go, do and compounds, echo, veto, torpedo, embargopotatoes, superheroes, photos, volcanoes/volcanos, zeros/zeroes; echoes, solos
s-ves, s-ves-varthe closed -f/-fe → -ves set as the last element of a wordknives, bookshelves; scarves/scarfs
zero-pluralsheep, deer, aircraft, offspring, means, …; species, series also in compoundsspecies, subspecies
ed, ed-e, ed-ied; ing, ing-e-drop, ing-ie-ed and -ing with e-drop and -ie → -ybaked, carried, making, lying
ed-ck, ing-ck⟨k⟩ after vowel + c in a longer stempanicked, trafficking (arc → arced, spec → specced)
*-doubleone-syllable consonant–vowel–consonant stems doublestopped, bigger
*-double-stressa longer CVC stem whose final syllable has primary stress in CMUdict doublespreferred, controlled (visit → visited)
*-double-secondarysecondary stress only, or primary only in another pronunciation: both, doubled firstkidnapped/kidnaped, combatted/combated
*-lunstressed final ⟨l⟩ (and fuel, dial, equal): American single, then British doubletraveled/travelled
er-*, est-*-er/-est with the same spelling conditionshappier, larger, bigger

The stress facts come from data/en-spelling.tsv, compiled in; forms spelling-data CMUDICT OUT remakes it from the CMU Pronouncing Dictionary (cmudict.dict; licence in Licence of the forms data). Explicit exceptions: Abbr=Yes, a lemma ending in «.» or a plural of consonant letters only (m, ft) stay as they are; a degree form of a lemma that already is one (more, most, less, latter) stays; a plural proper noun whose lemma ends in s or x (Beatles, Sox) stays; a plurale tantum lemma in s stays. A proper noun in consonant + y keeps -ies (Industries): names that keep ⟨y⟩ (the Kennedys) are few among PROPN in the corpus. Every rule answer is labelled rule:<name>; the first answer is the preferred one and the others are variants; table and rule answers never mix in one result. Other UPOS (ADP, CCONJ, NUM, …) are invariable: rule:base.

Analyse is the converse: every table cell with this form (case-insensitive); when none, the suffix rules whose candidate lemma has no table under that POS.

Attestation. Given table-forms.tsv from forms attest (with_counts, --counts), each table answer carries its corpus count; Some(0) is an unattested form, still usable but flagged.

Run

export CARGO_TARGET_DIR=...   # the shared target directory
cargo build --release -p forms --offline
export MOVA_FORMS=$TABLES     # a directory holding en/forms-*.jsonl, fr/forms-*.jsonl
forms gen be AUX 'Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin'   # were  table:exact:VERB
forms gen --lang fr parler VERB 'Mood=Ind|Number=Plur|Person=1|Tense=Pres|VerbForm=Fin'
forms gen --counts $OUT/attest/table-forms.tsv run VERB VerbForm=Ger
forms analyse cities

# attestation over the first 60 shards in page-view order (about 25 min, 3 threads, under 6 GB)
systemd-run --user --wait -p MemoryMax=6G -p CPUQuota=300% -p Nice=15 \
  forms attest $TABLES $MOVA_DATA/graph/passes/wiki-all-v5/trees $OUT/attest --shards 60
# accuracy on held-apart shards (default 60..66) with the shuffled-features control
systemd-run --user --wait -p MemoryMax=6G -p CPUQuota=300% -p Nice=15 \
  forms measure $TABLES $MOVA_DATA/graph/passes/wiki-all-v5/trees $OUT/measure --skip 60 --shards 6
# the same counts again after a rule or table change, with or without the tables
forms measure-counts $TABLES $OUT/measure $OUT/measure-again --rules-only

Progress lines go to stderr (the journal under systemd-run). Library use: Generator::load(dir)?.generate(lemma, upos, feats) returns Vec<Gen> (form, origin, attested); forms(...) returns the strings; generate_in / forms_in take a language.

Outputs

forms attest writes into OUT_DIR:

filecontent
counts.tsvevery (lower-cased FORM, LEMMA, UPOS, FEATS) and its count, PUNCT left out
table-forms.tsvevery table cell: form_count (this form with this lemma and POS, any features), cell_count (tokens whose features choose this cell and whose form is it), attested / unattested (French: no-corpus)
missing-forms.tsvcorpus forms of a tabled lemma that its table lacks, with the features Mova gave them
untabled-lemmas.tsv(lemma, UPOS) with count ≥ 20 and no table under that POS; the POS it has a table under, if any
coverage.tsvper UPOS: tokens per fit, rule and none; the share the tables generate (exact + subset); in-sample first-answer accuracy
suspects.tsvsuspected table errors, count ≥ 20: unattested-cell (Mova's features choose a cell whose form the corpus never shows, and the corpus has another form: runing / running) and no-cell (features the table has no cell for: technology has no plural)
summary.mdthe totals and the coverage table

forms attest-counts TABLES_DIR COUNTS_TSV OUT_DIR writes the same reports from an earlier counts.tsv (after a table fix) without decoding the store.

forms measure writes accuracy.tsv (per UPOS and source: table, rule, none), by-label.tsv (per answer label), control.tsv, disagreements.tsv (the most frequent wrong first answers) and summary.md, and keeps its counts (counts.tsv, shuffled-counts.tsv, head.txt): forms measure-counts TABLES_DIR MEASURE_DIR OUT_DIR repeats the measure from them in seconds (byte-identical to the decoding run). --rules-only (on either) answers every lemma by the rules, tables ignored, which measures the spelling rules on the whole corpus; irregular lemmas count as errors in both runs of a comparison.

forms table-check TABLES_DIR MEASURE_DIR OUT_DIR writes table-check.tsv: every table cell of a regular slot whose form none of the rule spellings gives, with the corpus tokens of the table's and the rules' forms (rule-form when the corpus writes the rule form more often, table-form, unattested). It finds table typos (wheted, glader) and lemmas that are themselves inflected forms.

forms claims CLAIMS_DIR TABLES_DIR MEASURE_DIR OUT_DIR reads the grammar claims (<chapter>.jsonl), keeps the English morphology and orthography ones and writes claims-verdicts.tsv (cluster, verdict, where in the code, and the checks of the word pairs the examples name: corpus-attested, given by a rule, in a table), claims-contradicted.tsv (an inflection claim whose named form the corpus never writes although the lemma has 50 or more inflected tokens) and claims-counterexamples.tsv.

forms articles STORE OUT_DIR [--skip K] [--shards N] checks the indefinite-article rule of en (en::morph::article, by the next word's sound) and the letter rule against the articles the writers wrote (the FORMs are the original text): articles.tsv (written article, next word, both rules' articles, the control's, count), differ.tsv (the next words on which the rules differ, with how often the writer followed each) and summary.md. The control applies the sound rule to the next word of the article 997 cases earlier, which keeps the article distribution and cuts its tie to the word.

forms review CLAIMS_DIR RULES_TSV OUT_TSV --date D --signed S gives every English grammar claim of the chosen areas (default morphology, orthography, lexicon, phonology, semantics) one review row source item_id cluster verdict where measurement reason date signed: a claim listed in --carry (an earlier claims verdict file) keeps its verdict in the review vocabulary (applied already measured-rejected later inadequate out-of-scope knowledge not-taken); every other takes the first rule of RULES_TSV that holds (cluster verdict chapters areas section statement where reason; patterns of lower-case substrings, | alternatives, & all, ! absent; the section is matched without the chapter title); --overrides replaces single rows. The verdict derive-check decides an affix claim against en::derive's rules: every named affix there → already (or applied when listed in --added-affixes), some missing → later, none named → knowledge.

A first answer counts as right when it equals the corpus FORM lower-cased. «Inflected» tokens are those whose form differs from the lemma. The negative control gives each token the FEATS of an earlier token of the same UPOS (a seeded draw from a ring of the last 4096), keeping the feature distribution but cutting its tie to the form.

Limits

This page in Markdown https://md.mova.elamur.ai/free/en/docs/tools/forms/