wordgraph-tamp-norm
The groupant beside wordgraph/tamp/src/norm.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
Statements normalized to lemma ids (the en dictionary numbers the word graph uses; OOV_TAG | fnv otherwise),
content UPOS only, numbers one id, light verbs out; order-sensitive shingles (ordered pairs at distance one or two);
Jaccard; seeded shuffles; the order test (order_holds: own score − best of 8 shuffles ≥ 0.2).
Approximant
sequence(s) = [map(id(l)) | k ∈ covered(s), upos_k ∈ CONTENT, l ∉ LIGHT]; shingles(q) = sort∪{h(q_i,q_{i+1}), h(q_i,q_{i+2})}; J(A,B) = |A∩B|/|A∪B| by merge; shuffled(q, seed) = Fisher–Yates with splitmix.
Invariant
Pure functions; shingles sorted and unique; J ∈ [0,1], J(A,A)=1; a reversed sequence shares no shingle; a shuffle is a permutation fixed by its seed.
Cost
O(n log n) per sequence; J O(|A|+|B|); order test 8 shuffles × the scored measure.
Composition
Used by corpus, cluster, anchor, build, synonym (lemma ids).
Tests
shingles_are_ordered_and_jaccard_is_bounded (reversal shares nothing: the red side), shuffle_is_seeded_and_a_permutation,
numbers_are_one_id_and_light_words_go.
Behavior complement
No stemming beyond the parser's lemma, no word senses, no multiword expressions, no weighting of shingles.
Reverse reconstruction
From a shingle set one recovers neither the words (hashes) nor their order beyond pair evidence; from a sequence, the content lemmas in order but not function words or numbers' values.
Provenance
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/wordgraph/tamp/src/norm.rs.groupant/