0015 — Refresh per-lexeme frequency from the public corpora
Status: done — 2026-09-13
Opened: 2026-09-10 · Area: language module (lexeme catalog, ordering policy)
Reopen trigger: the first curated or minted word set whose members have no frequency_wcpm
matters to a learner’s ordering (e.g. a new list, or English coverage — the predecessor’s frq
covers 53k English words against 99k Chinese).
Evidence
Section titled “Evidence”Phase 7 (plan R6) carries the predecessor’s metadata.frq words-per-million onto
lang_lexeme.frequency_wcpm for 152,200 words. Words minted afterwards get null and score zero in
the ordering policy, exactly as unranked words do. The values derive from the public SUBTLEX-CH and
SUBTLEX-US corpora.
Disposition
Section titled “Disposition”Done (2026-09-13): packages/db/scripts/refresh-lexeme-frequency.ts, script frequency:refresh, run
once per language — bun run --cwd packages/db frequency:refresh --language zh --file <corpus> [--overwrite] [--dry-run]. It reads the PUBLISHED corpora rather than the predecessor’s copy of them,
fills frequency_wcpm for matching lexemes, and never replaces a stored figure unless --overwrite
says so. It publishes and mints nothing: a corpus word the catalog does not hold is simply unmatched.
The two source files, downloaded as published (not committed — they are not repository data):
- SUBTLEX-CH
SUBTLEX_CH_131210_CE.utf8, from https://www.ugent.be/pp/experimentele-psychologie/en/research/documents/subtlexch/subtlexch131210.zip — 99 121 rows, words-per-million inW.million. Cai, Q., & Brysbaert, M. (2010). SUBTLEX-CH: Chinese word and character frequencies based on film subtitles. PLoS ONE, 5(6), e10729. - SUBTLEX-US
SUBTLEXus74286wordstextversion.txt, from https://www.ugent.be/pp/experimentele-psychologie/en/research/documents/subtlexus/subtlexus2.zip — 74 286 rows, words-per-million inSUBTLWF. Brysbaert, M., & New, B. (2009). Moving beyond Kučera and Francis: A critical evaluation of current word frequency norms. Behavior Research Methods, 41, 977-990.
The rules the job applies, each of them a decision about what a figure means:
- The format is read from the header, never from a flag (
Word+W.million→ SUBTLEX-CH,Word+SUBTLWF→ SUBTLEX-US), and columns are read by NAME. A corpus paired with the wrong--languageis refused, exit 2, nothing written — each file is about exactly one language. - Duplicate graphs: the FIRST row wins. 388 SUBTLEX-CH rows name a graph an earlier row already
named (377 of them a
#-pinyin proper-name row after the word’s own); the file is sorted byW.milliondescending, so the first row is also the larger figure. Same rule as the Phase-7 carry’s “firstfrqrow”. - Chinese matches
graphexactly; English matcheslower(graph)— SUBTLEX-US case is the dominant SURFACE case (What,No,I), not lexical, and the catalog deliberately does not fold case. Where the catalog holds bothChinaandchina, both receive the corpus figure forchina.