wordgraph-tamp-synonym
The groupant beside wordgraph/tamp/src/synonym.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
Synonym classes for matching: WordNet first-sense synonyms (same part of speech, both in the corpus vocabulary)
confirmed by the word graph — cosine of typed neighbour profiles (direction, relation, neighbour word; PMI) ≥
min_cos — and British/American spelling variants without the graph; union-find, smallest id represents.
Approximant
classes(V, G, θ) = UF{(w,v) | v ∈ syn₁(w) ∩ V, pos(v)=pos(w), cos(prof_G(w), prof_G(v)) ≥ θ} ∪ {(w,v) | v ∈ spell(w) ∩ V}.
Invariant
The map changes only ids in a class of ≥ 2; a representative is the class minimum; pairs are found once (unordered key); without a graph no WordNet pair is used.
Cost
|V| WordNet lookups; per proposed pair two profile reads (≤ 2·k per relation group). 628 pairs on 1,763 papers.
Composition
Called by build::synonyms; reads world::wordnet, wordgraph::Graph.
Tests
spelling_variants_go_both_ways, spelling_classes_take_the_smallest_id_and_wordnet_needs_the_graph (no graph:
no WordNet pair — the red side). Hand check 2026-11-06: 13 of 16 sampled pairs synonymous in context.
Behavior complement
No other senses than the first, no multiword synonyms, no hypernyms, no antonym detection beyond the graph check.
Reverse reconstruction
The pairs list (synonyms.json) records each fold with its cosine and source; the original id of a folded lemma is
recoverable from the statement's words, not from its sequence.
Provenance
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/wordgraph/tamp/src/synonym.rs.groupant/