Dictionary occurrence index
mova-dictindex is the open-corpus evidence index for dictionary workers. It indexes
existing parses; it runs no parser, teacher, embedding model or dictionary admission.
Data belongs outside Git under dictindex. Code uses the repository's
Elamur Cosmic License; derived index data uses CC BY-SA 4.0 with source terms retained.
Build this standalone crate with the shared target directory configured by the operator:
cargo build --release --manifest-path tools/dictindex/Cargo.toml --offline --locked
export MOVA_DICTINDEX="$MOVA_DATA/dictindex/index"
dictindex discover "$MOVA_DATA" "$MOVA_DATA/dictindex/sources.json" > "$MOVA_DATA/dictindex/inventory.json"
dictindex build "$MOVA_DATA/dictindex/sources.json" --source enwiki-all-v5 --max-documents 256
dictindex build "$MOVA_DATA/dictindex/sources.json" # continue all configured sources
dictindex sources > "$MOVA_DICTINDEX/sources.json"
dictindex checkpoint
--index DIR overrides MOVA_DICTINDEX; otherwise the default is
dictindex. Each invocation's document budget counts newly imported
documents across its selected sources. In CoNLL-U input, each selected block is a
document unit; in treestore input, each article is one. Part cursors include rejected
sentence blocks and advance only with the successfully published batch. New immutable
parts append; changing an indexed part, source configuration, pair table or model
fails and requires a separately named source version and index epoch. A CoNLL-U
refresh hashes and streams the file even when resuming; split immutable parts are
better for sustained incremental imports. Never rewrite an existing source version
to conceal a changed parse.
The conservative discovery inventory includes native English/French Wikipedia,
school sentences verified against taught lesson fields, and our parsed grammar
manuals. It records missing parses and pending source classifications. Original tales
without an existing parse are not silently annotated. Standard Fish parallel snapshots
are teacher silver: their prospective source configurations appear only in the
inventory report, pending an explicit open-access classification. Private/closed and
e-print paths, analytics-only stores, assessment names and unknown/NC/research-only
licences are refused. School test/exam text is excluded; only exact text found in
explain, fact or exercise fields enters. No held-out benchmark is used.
An explicit configuration has documents_per_batch (1–4096, default 256) and
sources, each with name, language, kind (treestore or conllu), path,
evidence, and credit (source, licence, citation, domain). The source name
equals its default credit's source id. A source declares actual provenance and rights;
the software cannot independently establish them from a file name or licence class.
Use model for a treestore whose model is elsewhere. A mixed CoNLL-U source can
declare prefixes, a map of sentence-id prefixes to separate credits. Longest prefix
wins; all unmatched blocks are excluded. school_root enables exact lesson checks.
For an explicitly approved open parallel snapshot, pairs names its exact
train.pairs.tsv, counterpart names the other side's training parses, and
pair_licences maps each permitted corpus name to a complete credit. Only listed,
attributed rows with both parsed sides enter. Do not grant one licence to a mixed
parallel collection. The eight-column pair table is the existing Mova training
snapshot format: pair id, page, English id, French id, English text, French text,
source, attribution. Unknown-author/unknown-attribution rows are excluded. The
counterpart feature is sentence co-occurrence, not word alignment or an established
translation. The current pair adapter supports English/French.
Queries and statistical candidates
dictindex find en bank --pos NOUN --limit 10
dictindex find en bank --frame 'nmod:river'
dictindex frames fr glace
dictindex propose en bank
dictindex find en bank --cluster financial --limit 5
dictindex review "$MOVA_DATA/dictindex/clusters-for-review.md"
dictindex measure "$MOVA_DATA/dictindex/measure.json"
Queries emit JSON. Every example includes source credit and licence, document,
original sentence id, exact sentence text, token position, and a stable SHA-256
posting id over (source, document, sentence-id, token-position). The frame retains
the head relation/head lemma, up to four lexically sorted distinct non-punctuation
dependents, source domain, and up to 32 distinct sentence-aligned counterpart lemmas.
Original sentence ids are preserved; missing ids get deterministic hashes. Lemmas
are Unicode-lowercased; UPOS filters use the original uppercase tags. Results are
distinct sentences in deterministic block/document order, with a maximum limit of 1000.
frames reports head/relation frames, dependent collocates, source-domain strata and
parallel counterpart candidates. Counts are token occurrences; each feature counts
at most once per occurrence. PMI is
log2(joint * language-token-count / (lemma-count * feature-marginal)), including
all indexed UPOS in both language totals and feature marginals. Missing/zero counts
produce no positive-PMI proposal. Reporting keeps the 128 most frequent features,
with lexical ties. Proposals keep at most twelve features with support at least two
and positive PMI, ranked by PMI * ln(1 + support), with lexical ties. These are
overlapping, explained selectors for review, not an automatic partition into senses.
Rare senses outside the reported feature window can be missed. Domains are declared
source metadata; Wikipedia article topics are not inferred. Parser errors remain
visible. A Nautilus names/confirms groups and may merge/split selectors using members.
Labels
dictindex label EVENT.json appends a versioned event; dictindex labels LANG LEMMA
exports its history. No history row can be updated or deleted through the store.
The first version is 1, subsequent versions advance by one; identical replay is a
no-op. A later version is the current selector. Labels contain:
{
"language": "en", "lemma": "bank", "cluster": "financial", "version": 1,
"label": "financial institution", "gloss": "A reviewed original gloss.",
"homonym": "bank-finance", "note": "Confirmed after reviewing the witnesses.",
"rule": {"feature": "dep:compound:investment", "domain": null, "members": []},
"provenance": {"who": "reviewer", "model": "configured-terminal-model",
"date": "YYYY-MM-DD", "evidence": "review/proposal digest"}
}
Feature, domain and explicit member restrictions intersect; missing restrictions
are unrestricted. A rule without additional restrictions selects the whole lemma,
so lemma-wide notes and homonym marks need no artificial member list. A name, gloss,
note or homonym mark and complete provenance are required.
Members are stable posting hashes. Homonym marks, notes, labels and original glosses
are metadata, independently revisable through a new version. Statistical ids become
queryable with --cluster only after a label event is written. Labels never admit a
dictionary row, change a frozen dictionary manifest or authorize teacher work.
Nautilus handoff
Set dictindex in the frequency-queue configuration to the index directory. It
reads indexed per-language frequencies, obtains candidates through the same library
path as dictindex find, and writes the existing records TSV plus cumulative exact
evidence. Where supported, it selects a positive-PMI frame/collocate group with two
usable examples of one observed UPOS and shows the rule, counts and PMI to the
teacher as review context. The existing reply supplies the original sense label;
the statistics never become an admitted definition by themselves. Existing partitioning, closed/admitted exclusions, dictionary preservation
and native backlog checks remain in force. Earlier asked rows remain available to
the admission reader. Index use is optional; omitted configurations keep the existing
source reader. This change does not restart workers or private terminals.
Set the same dictindex root in Nautilus's main configuration. Only decisions that
pass its existing SHA-bound complete review, exact corpus-witness, model/animal
provenance, source-copy and compatibility gates write labels back. Each label selects
the actual accepted indexed members and carries the accepted sense/proposal digest.
This conservative write does not assert that every statistical group has been
named, or decide homonymy automatically. Admission rows/decisions are saved before
the secondary label write; replay repairs a crash between stores. Uncertain/native
picks remain held. Tests use owned fixtures and fake provenance, with no model calls.
Storage and limits
SQLite holds the transactional directory, small credit dictionary, integer feature
dictionary, counts and cursors. A separate labels.sqlite holds the append-only
label journal, so corpus backfill cannot monopolize annotation writes. Posting documents,
sentence ordinals and token positions use unsigned varint deltas; frame dictionaries
are local to a lemma/POS record. Records in a batch share one compressed block per
FNV-1a lemma shard (64 shards). A directory row selects the record slot, avoiding a
separate compression header for every rare lemma. Feature summaries use integer-id
varints. The public pack::zs zstd-7 codec compresses the prepared bytes. Explicit
SHA-256 block digests protect the fast codec's payloads. Sentence text is compressed
once per document unit; no CoNLL-U tree is duplicated in the index.
One advisory import lock covers corpus mutations; SQLite serializes label versions independently. Payloads are synced before the directory and cursor commit together; readers use one SQLite snapshot per query. A failed transaction may leave unreachable blob bytes. Automatic blob garbage collection/compaction is not implemented; a fresh epoch is the current rebuild path. This is not a signed publication catalog or an independent licence audit. Query latency depends on visited blocks, selector rarity, cache and hardware; the target is below 50 ms for frequent-lemma example retrieval, not a universal bound for rare selectors or whole-corpus statistics.
Measurements report actual indexed prefixes, decoded CoNLL-U bytes, stored bytes, timings and repeated-result hashes. They exclude process startup and distinguish cache scope. Full-dump coverage and full-build time must not be inferred from a bounded probe. The twenty-lemma review records absent coverage explicitly.
cargo test --manifest-path tools/dictindex/Cargo.toml --offline --locked
cargo test --manifest-path tools/nautilus/Cargo.toml --offline --locked --lib index_bridge
This page in Markdown https://md.mova.elamur.ai/free/en/docs/tools/dictindex/