wordgraph-tamp-cluster
The groupant beside wordgraph/tamp/src/cluster.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
Template nodes: statements with one shingle set are one set; MinHash LSH (192 hashes, 64 bands × 3 rows) proposes
pairs; exact Jaccard verifies (edge at J ≥ τ, two different papers, and the order test both ways); star clustering
in order of statement document frequency; ≥ min_papers papers make a cluster. Also the threshold-study pairs,
the Jaccard histogram and the largest single-linkage component.
Approximant
P(candidate | J) = 1 − (1 − J³)⁶⁴; edges E = {(a,b) | J ≥ τ, order holds}; df(s) = |papers(s ∪ N(s))|; star: for s by (df↓, deg↓, paper, unit): C = {s} ∪ (N(s) \ assigned) if |papers(C)| ≥ m.
Invariant
Every member is within τ of its centre (no chaining); members are disjoint; sorted keys decide everything; outputs do not depend on the thread count (par_map keeps order).
Cost
O(U·K·|sh|) signatures + O(U·B log(U·B)) bucket sort + Σ bucket² candidates (1.55 M) + verification; ≈ 30 s of the 60 s build (2026-11-06).
Composition
Called by build::cluster_with; uses norm.
Tests
near_repeats_across_papers_form_one_node_and_shuffles_and_chains_do_not (shuffles and an unrelated statement stay
out — red side), a_star_does_not_chain. Real controls in build::controls.
Behavior complement
Does not merge paraphrases below τ, does not cluster statements with < 5 content lemmas, skips buckets above 4,000 (counted), does not use frames or meaning.
Reverse reconstruction
A node lists its member sets and units; the centre and each member's Jaccard to it are kept; the candidate pairs are not kept.
Provenance
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/wordgraph/tamp/src/cluster.rs.groupant/