wordgraph-score
The groupant beside wordgraph/src/score.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 |
| Composition | partial | Composition |
| Cost | partial | 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 |
Model text
Descriptant
A parse's plausibility under the word graph (tree_score) and the k-best reranking check (rerank) with λ chosen on
the other fold of a dev treebank. Epoch 2026-11-06: first version; with the 50 k graph, EWT dev LAS 0.8047 → 0.8073.
Approximant
tree_score(T) = Σ over T's non-swap events with both ends in the graph of role_score (core: nsubj, nsubj:pass, obj, iobj, agent) or judged value (others). rerank: per sentence the k best (parser score p_i, graph score g_i, correct words c_i); pick(λ) = argmax p_i + λ g_i, first on ties; folds by sentence parity; λ* for fold f = the grid value with the most correct words on fold 1−f, kept only if better than λ = 0 there.
Invariant
λ = 0 reproduces the parser's top-1; no λ is chosen on the fold it is reported on; deterministic (parallel map collected in order, first-max ties); the test set is never read by this code path unless given.
Cost
One k-best parse per sentence plus O(k · events · (log N + bound)) graph lookups; EWT dev (2 001 sentences, k = 8) in 3.5 s with 4 threads (2026-11-06).
Composition
Uses extract for a tree's events, graph for the values, en::annotate for the k best; called by the CLI rerank.
Tests
Run on EWT dev twice with identical output (2026-11-06); no unit test of its own.
Behavior complement
Does not train the parser, change its k-best search, flag single attachments, or use the test set; LAS counts every word, punctuation included, with the full relation.
Reverse reconstruction
From the report: per fold LAS (top-1, reranked, oracle), λ and the number of changed sentences; not the trees.
Provenance
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/wordgraph/src/score.rs.groupant/