Elamur Groupants⌕
☰

mova-parse-dispatch

The groupant beside tools/mova-parse/src/lib.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 derivedCost
DescriptantpresentDescriptant
InvariantpartialInvariant
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.

relationtypelabelwhere
Behavior complementbehavior complementpartial source derived modelBehavior complement
Reverse reconstructionreverse reconstructionpartial source derived modelReverse reconstruction
Matrix compositionmatrix compositionpartial source derived modelMatrix composition

Model text

Descriptant

The two-level dispatcher: sentences of a line; level 1 (langseg::Segmenter with the Latin table) gives language spans; the pieces of the sentence's language are parsed together by its model, each longer switched piece by its own model with its root on the matrix root (dep, CSAttach=root), short switched pieces inside the matrix parse marked CSParse=matrix; a language without a model gets unannotated tokens with Parse=None. The CoNLL-U writer adds # lang, # dialect, # style, # parse, # spans. sentence_as / parse_as parse as one language the reader chose: one piece, level 1 not asked (the parse service's language selector). The style tagger is Send + Sync, so a dispatcher is shared between threads.

Approximant

parse(text) = concat_lines concat_sentences sentence(s); sentence(s) = compose(matrix(annotate_lang(tokens of pieces with l = lang or short)), {annotate_l(tokens of piece) | l ≠ lang, long}); lang = argmax_l letters(l).

Invariant

Every token comes from exactly one piece; pieces cover the sentence (first starts at 0, last ends at its length, neighbours touch); no token of a language without a model gets a head; each annotated unit has its own tree, and only a switched unit's root is re-attached; a French piece of min_span words or more never reaches the English model.

Cost

Per sentence: level-1 O(n·K) plus each model's annotation on its unit (matrix once, each switched unit once).

Behavior complement

It does not parse the attachment between a switched span and its matrix; it does not merge tokenizers; it does not decide Hebrew-script varieties (no Hebrew-script model loaded) nor parse them; it does not fill the style without a detector.

Reverse reconstruction

The # spans line and # text recover the pieces; Lang=/CSParse/CSAttach recover the routing of each token; a # parse = none sentence recovers only its tokens.

Matrix composition

Removing switched spans from the matrix unit keeps the matrix clause contiguous for its parser; the cost is a lost argument (the quote) in the matrix tree, which the placeholder dep edge marks.

Tests

sentences_and_pieces, no_model_is_reported_not_parsed, a_forced_language_skips_level_one (with level 1 itself as the control); a two-run identity check on 60 Global Voices lines (2026-11-06).

Provenance

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