Mova0.6 pre-release

entities — entity tokens for Gali

Gali's vocabulary has 96 000 entity tokens shared by all languages: Wikidata items (QIDs). This tool makes the list of those QIDs and finds their mentions in the corpora Gali reads (wikixl2, wikivocab79, smalllang), as character spans. No language model is called; every step is a fixed rule.

How it works

  1. prepare reads the Wikidata sitelinks of the corpora's wikis (sitelinks.tsv.zst of the Wikidata store, see wikidata-store) and each wiki's 12-month page views (<wiki>.wikipedia-12m.tsv.zst of pageviews). A views row of a redirect carries its target's page id, so redirect views add to the target and every redirect title the views saw joins the title → QID map (titles.bin, FNV-1a 64 keys of site \0 title). Per wiki, each QID's share of the wiki's article views is kept when it is at least --floor (default 1e-7).
  2. mentions (wikixl2, wikivocab79) and smalllang read every article in exactly the text Gali encodes and make spans:
    • link: the article's Wikipedia links, the target resolved through sitelinks and redirects;
    • propagation («one article, one sense»): a linked surface form that names one QID in the article is that QID at its later unlinked occurrences (word boundaries; in scripts without spaces no boundary is needed); the article's own title (when it has no «(…)» disambiguator) is its QID anywhere in the article. A surface that names two QIDs in the article is not propagated; a surface needs a letter and 3 characters (2 in CJK, Thai and the like);
    • paradigm: the other case forms of those surfaces from Mova's paradigms (gali-inner/paradigms): every word of a name with a paradigm goes into the same case and number (Франція → Франції, Францією). smalllang keeps no links in its text, so wikimd plain-all-raw-links (peta) runs the same Markdown writer again with the links kept; a row is used only when its paragraphs equal the record's.
  3. list scores a QID by the sum over the wikis of its view shares (each wiki votes with its own shares), made robust to traffic that is not reading: no share above its wiki's 10th largest share (a one-title spike in a tiny wiki), and every share capped at 10× the item's median share over the reliable wikis (≥ 10 M article views in the 12 months, 85 of 282) when it has a share in at least 3 of them, else at 10× its median over all its wikis when it is in at least 10. A share 10× off the median is the distributions rule's mark of a bug: Basshunter is rank 1–2 in a dozen small wikis and rank 70 000–90 000 in dewiki, frwiki, ruwiki. --plain keeps only the all-wiki median cap; compare writes the two top-100s and the items whose rank moves more than 10×. Candidates go in score order; Wikimedia-internal items (disambiguation pages, categories, templates, list articles …) and items with fewer than --min mentions in the corpora are left out; the first --n make the list.
  4. coref-wiki parses English articles of wikixl2 in popularity order with Mova's parser (en.bin) and resolves coreference with the sieve of coref. A chain whose mention heads fall inside spans of one QID is that entity; its other mentions get the QID (coref). A chain without an anchor that starts with the/this/that + noun is bound to the nearest preceding entity (5 sentences back at most) whose Wikidata classes (P31 and their P279, the last word of the English label) hold that noun: «this country» → France. First- and second-person pronouns, DET/NUM mentions, and it/they with rival antecedents are not bound.
  5. finalize writes the delivered spans of the listed QIDs with a confidence: link 1, propagation and paradigm the held-out precision of the language, coref the GUM precision of the mention's kind; counts, the distribution of mentions per article and sha256.

Offsets are Unicode scalar values (chars), half-open [start, end), within the paragraph — Python str indices, Rust chars(), not bytes. Paragraph ids: wikixl2 / wikivocab79 <site>:<KEY>:<line> (Gali's <KEY>:<line> of text.split("\n") with the site in front); smalllang <record id>:<k> (the k-th paragraph of text.split("\n\n")).

Measurements

Run

cargo build --release -p entities
entities sites WIKIXL2 WIKIVOCAB79 SMALLLANG_WIKI > sites.txt
entities prepare sites.txt $MOVA_DATA/views $MOVA_WIKIDATA prep
entities mentions wikixl2 WIKIXL2 prep PARADIGMS m-wikixl2            # [--no-lower] [--fold 1] [--sites a,b]
entities mentions wikivocab79 WIKIVOCAB79 prep PARADIGMS m-wikivocab79
wikimd plain-all-raw-links <code> sl-links/<file>.jsonl 6             # per smalllang wiki (peta/tools/wikimd)
entities smalllang SMALLLANG_WIKI sl-links sl-codes.txt prep PARADIGMS m-smalllang
entities probe prep m-*/counts.tsv                                    # score and mention distributions
entities list prep $MOVA_WIKIDATA OUT m-*/counts.tsv --n 96000 --min 30
entities coref-gum GUM.conllu prep $MOVA_WIKIDATA [--trees SLM.conllu] [--control]
entities coref-wiki prep WIKIXL2 PARADIGMS en.bin $MOVA_WIKIDATA coref-en --n 300
entities finalize RUN OUT --coref-conf coref-conf.tsv

sl-codes.txt: file code per smalllang wiki file (the code inside its record ids: gsw als, yue zh_yue).

Limits

This page in Markdown https://md.mova.elamur.ai/free/en/docs/tools/entities/