langseg-variety
The groupant beside tools/langseg/src/variety.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
| component | label | where |
|---|---|---|
| Approximant | partial | Approximant |
| Ast | partial | syntax.json |
| Cost | symbolic source derived | Cost |
| Descriptant | present | Descriptant |
| Invariant | partial | Invariant |
| Tests | executed bounded checks | Tests |
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.
| relation | type | label | where |
|---|---|---|---|
| Behavior complement | behavior complement | partial source derived model | Behavior complement |
| Reverse reconstruction | reverse reconstruction | partial source derived model | Reverse reconstruction |
| Vote abstention | vote abstention | partial source derived model | Vote abstention |
Model text
Descriptant
The dialect modifier of a label (language, dialect, style): marker word forms and phrases with votes per national
variety (English US/GB/CA, French FR/CA/BE/CH), summed over a sentence or a document; a decision needs a marker and a
lead of one vote. Also the StyleTagger interface for the separate style field.
Approximant
votes(L, words) = Σ_{m ∈ markers(L) found} v_m; decide = argmax_d votes_d if some marker fired and
votes_(1) − votes_(2) ≥ 1, with confidence lead/(lead+1); otherwise unknown.
Invariant
Votes are additive (Votes::add of two sentences equals the votes of their concatenation for single-word markers);
an unknown language has no dialects; markers are matched on lower-cased, apostrophe-normalised words; ties keep the
earlier dialect in the table order only when a lead ≥ 1 exists, otherwise abstain.
Cost
O(W · S) prefix checks for English stems, O(W · P) window matches for French phrases.
Behavior complement
No pronunciation, grammar or typography cues; no learned weights; no style detection; regional varieties outside the table (Australia, Ireland, India, Africa) are not labelled (British spelling reads GB or GB/CA-tied unknown).
Reverse reconstruction
A label recovers only a set of marker multisets whose vote vector has that argmax and lead; the marker list in the
output recovers which markers fired, not how often (the Votes map keeps counts).
Vote abstention
-our/-re alone ties GB and CA, so the answer is unknown until -ise or -ize or a word marker breaks the tie;
measured on Europarl English (2026-11-06): GB in 188 of 2 996 sentences, US in none.
Tests
markers_decide_or_abstain (GB, US, CA, CH, CA phrase, abstentions, the laboratory false-prefix control).
Provenance
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/tools/langseg/src/variety.rs.groupant/