Elamur Groupants⌕
☰

wikt-extract-wikitext

The groupant beside tools/wikt-extract/src/wikitext.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.

Facts

Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.

Components

componentlabelwhere
approximantpartialapproximant
astpartialsyntax.json
costsymbolic source derivedinvariant-and-cost
descriptantpresentdescriptant
invariantpartialinvariant-and-cost
testsexecuted bounded checkstests

Obernants

The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.

idtypelabelwhere
wikt-extract-wikitext-behavior_complementbehavior_complementpartial source derived modelbehavior_complement
wikt-extract-wikitext-reverse_reconstructionreverse_reconstructionpartial source derived modelreverse_reconstruction
wikt-extract-wikitext-gap_accountinggap_accountingpartial source derived modelgap_accounting
wikt-extract-wikitext-parameter_splitparameter_splitpartial source derived modelparameter_split

Model text

descriptant

wikt-extract-wikitext

Epoch 2026-11-04

Written with the code (tools/wikt-extract, first version). Wikitext of one definition, example or list line → plain text plus side records (labels, form-of lemma, nyms, examples, gaps, dropped). Template calls are found with brace nesting, split at top-level pipes (not inside nested templates or links) into positional and named parameters; each known name has a handler printing what the template prints (links → alt or term, w → display or article, taxlink → name, gloss/qualifier → bracketed text, form-of → «Kind lemma», place → «A kind in holonyms», ux → example recorded); category, sense-id and maintenance templates print nothing and are counted as dropped; any other name prints nothing and is counted as a gap. Links [[a|b]] → b, external [url text] → text, bold/italic quotes, comments, references and HTML tags removed, entities decoded, whitespace collapsed.

The forward model below is source-derived; the tests in tests.md exercise the actual functions on small synthetic pages, and the full English pass (docs/data.md, «Wiktionary») is the corpus-scale observation. Executable percentage approximants are not supported: the outputs are categorical text records with no useful error metric.

approximant

Forward relation

Wikitext of one definition, example or list line → plain text plus side records (labels, form-of lemma, nyms, examples, gaps, dropped). Template calls are found with brace nesting, split at top-level pipes (not inside nested templates or links) into positional and named parameters; each known name has a handler printing what the template prints (links → alt or term, w → display or article, taxlink → name, gloss/qualifier → bracketed text, form-of → «Kind lemma», place → «A kind in holonyms», ux → example recorded); category, sense-id and maintenance templates print nothing and are counted as dropped; any other name prints nothing and is counted as a gap. Links [[a|b]] → b, external [url text] → text, bold/italic quotes, comments, references and HTML tags removed, entities decoded, whitespace collapsed.

Domain

Well-formed UTF-8 wikitext/XML of the English Wiktionary dump export format (2026-09-01 run); bounded resources.

models

Typed source models

Partial source-derived relations at this manifest snapshot; one call under the stated domain; no universal semantic proof.

behavior_complement

Never executes Lua modules or expands templates from the dump's Template namespace: unknown templates contribute no text (only a gap count), categories are not reproduced, inline modifiers other than the first term segment are dropped, nested templates inside dropped templates are not visited, unclosed {{ or [[ are left as literal text.

Domain: Well-formed UTF-8 wikitext/XML of the English Wiktionary dump export format (2026-09-01 run); bounded resources.

reverse_reconstruction

Many wikitexts render to the same text (any template with no handler, any drop-listed template, bold vs plain, [[a|b]] vs b); from a rendered text and its side records one can recover the set of compatible lines only up to these erasures: labels and nyms are recoverable as values, not as template names or positions.

Domain: Well-formed UTF-8 wikitext/XML of the English Wiktionary dump export format (2026-09-01 run); bounded resources. Preimages are sets, not unique inverses: the rendering is not injective.

gap_accounting

Every template call reached by render with no handler increments out.gaps[name] exactly once; drop-listed and R:/RQ:/quote-/cite-/rf* names increment out.dropped instead. A template nested in a parameter that a handler renders is visited; one inside an unrendered parameter is not.

parameter_split

split_params returns n+1 slices for n top-level pipes; a pipe inside {{…}} or [[…]] does not split; parse_call treats k=v as named only when k has no [[, {{ or <.

tests

Native evidence — 2026-11-04

Package/bin: wikt-extract. Selected tests (cargo test --release -p wikt-extract), all passing:

Negative control: unknown_templates_are_counted_as_gaps: a name with no handler is counted in gaps and a category template in dropped, not in gaps; removing the gap branch's counter turns it red.

Scope: actual functions on synthetic in-memory inputs; the corpus-scale pass is an observation, not a proof. Lua module semantics, full template coverage and the correctness of every printed sense are not established.

invariant-and-cost

Invariant and cost

Invariant

render is pure and deterministic (BTreeMap counts); output has no tab or newline; a template either prints text, is dropped (counted) or is a gap (counted), never silently removed.

Cost

O(n) passes over a line of n bytes per nesting level (close_braces rescans nested bodies; parameters rendered recursively): worst case O(n·d) for depth d; tidy is O(n) with a few replace passes. Memory O(n).

This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/tools/wikt-extract/src/wikitext.rs.groupant/