Skip to content

0014 — ABC dictionaries: two parsers over the raw files

Status: done Opened: 2026-09-10 · Area: language module (dictionary layer) Reopen trigger: the maintainer schedules it — after the Phase 7 predecessor import lands (it does not depend on it), or when a further ABC licence is negotiated.

The predecessor served the ABC Chinese–English and English–Chinese dictionaries (providerdefinition provider abc: 204k zh→en, 31k en→zh rows in the predecessor’s parsed format). Phase 7 (plan R5) excludes them from the import: the maintainer holds the raw source files for both, and the two formats differ, so the right port is two DictionaryParser implementations (packages/db/src/lang-dictionary/, CEDICT is the pattern) over the raw files — the transcrobes parser is a reference, not code to run.

The raw files, as grounded 2026-09-17. Chinese–English: 203 090 entries in Wenlin’s tag-per-line format, one char each; 135 699 carry the traditional form as a bracketed mask (喵星球[-∼-] in shape: the mask is one character per headword character, a dash meaning “same as simplified”); pinyin on .py with homograph superscripts (¹ā, ²ā) and Wenlin’s asterisk (of the near-homophones, the most frequent); ABC grades A–F on 42 595; numbered senses (1df, 2df) with ps, psx notes, en domain labels, mw measure words and ex/hz/tr example triples; 1 915 simplified headwords carry more than one entry (3 990 entries, 和 has seven). Corrected by the parser survey (2026-09-17, measured on the file rather than by grep): 131 entries define through psx notes alone (function words such as 啊); 4 671 are see/seealso-only cross references and 6 236 carry no df and no psx at all; in (5 616 entries) is a serial cross reference (“occurs in that compound”), not a sub-entry; 20 346 pinyin end in the asterisk and 31 211 carry a homograph superscript; 3 365 headwords are written in Wenlin’s variant notation (a slash after a character introduces its variant at that position; @@ and @{…} are further spellings of the same idea; the mask carries aligned groups). English–Chinese: 62 397 entries on .hw, with IPA, infl on 25 458 (23 111 of them back-pointers such as pl. of (abacus) [serial] on the inflected form’s own block, only 3 541 listing forms), df as pinyin plus bracketed hanzi, and 11 684 sub/subof pairs, which are serial cross references between blocks that are each headwords in their own right; 24 647 blocks carry no senses (19 188 inflection back-pointers, 3 241 subof back-pointers, 252 see-only, 1 966 empty).

  1. Entitlement. ADR-0056 says nobody is affiliated to personal-0, and the access predicate required live affiliation before it looked at the offering, so the disposition below was unreachable as written. Amended (ADR-0059 decision 5, amendment 2026-09-17): a licence that names an offering is satisfied by CURRENT MEMBERSHIP of that offering alone; an org-wide licence keeps the affiliation test.
  2. One entry, and which lines become it. Headword = the simplified text of char up to the bracket; the traditional form expanded from the mask goes into surfaceForms when it differs (CEDICT’s precedent). One entry per headword: homographs fold into an ordered array in source order, each keeping its own pinyin, grade and senses. Pinyin drops the homograph superscript and keeps the asterisk as a boolean. Senses are the df lines, or the psx notes when an entry has no df, numbered as the source numbers them. A see-only entry has no senses and is refused and counted, never stored. in is a serial cross reference (see the evidence) and is dropped like hh. English side: headword = .hw; infl inflections go into surfaceForms; sub entries are ordinary multi-word headwords; case is preserved.
  3. Content: typed and selective. Per homograph: serial, pinyin, the frequent-homophone flag, traditional form, grade, part of speech, domain label, the numbered senses (each with its own part of speech, note and domain where given), measure words, and the examples as pinyin/hanzi/translation triples. English side likewise, with IPA, inflections, and the hanzi split out of the bracketed pinyin in each sense. Dropped: rem, freq (SUBTLEX is the frequency source), ref, hh, see/seealso (they point by ABC serial, which nothing on a device can resolve), cons, ab, da, note, h. The content has its own top-level key so the renderer routes on shape.
  4. Presentation. A dedicated adapter, kind: "dict", unsure: false, routed on the new key. Readings are the homographs’ pinyin in source order; senses are one per numbered sense across the homographs, each with its own part of speech or the entry’s, the psx note appended in brackets. Measure words, examples, grade and domain stay in the content for a later presentation ruling.
  5. Mechanism. The existing dict:import gains --provider cedict | abc-ce | abc-ec and --scope org-licensed --organization <slug or id> --offering <id>. Provider keys abc-ce and abc-ec (Wenlin’s own naming, one per parser). Rows: language zh with L1 en, titled “ABC Chinese–English Comprehensive Dictionary”; language en with L1 zh, titled “ABC English–Chinese Dictionary”. The row is ensured by scope, provider, organization, offering and the two languages, select-then-insert; no new index, no migration. Publication is unchanged: the ingest publishes every headword onto the shared resolution index; the licence gates the content.
  6. Fixtures. The licensed text never enters git (the data directory’s README is explicit; zh_en_abc_dict.test.txt is real licensed content and is not a fixture). Synthetic fixtures in the tag format exercise every rule above. Verification over the real files is the maintainer’s --dry-run, which prints counts and refusals by category without a database.
  7. Recording and slicing. The Chinese–English row imports now. The English–Chinese row waits for a learner who can reach it (amended 2026-09-18): dictionaries are listed by the studied language, so an en row is invisible to a learner of Chinese, and a licence held personally serves nobody else — the parser, the provider key and the runbook’s command stay ready for that learner. Two slices: S1 the two parsers, the content type and the adapter with tests; S2 the access amendment with its test, the CLI’s provider and licence flags, the phase-7 runbook’s step 5 and the ADR amendment.
  8. English–Chinese back-pointing blocks fold into their base entry (ruled after S1’s survey). A senseless block whose infl or subof names a base serial adds its .hw to that base entry’s surfaceForms in a second pass after aggregation, counted as folded, never as refused; see-only and empty blocks stay refused. That is the “ran under run” case surfaceForms was written for, and most inflected spellings are reachable only through those blocks.
  9. Chinese–English variant notation is expanded, not refused (257 of a 300 sample had no plain entry for their primary form, common words among them). The headword is the first alternative at every group; every other alternative, substituted at its own group with the rest primary, is a surface form (one substitution per group, no cartesian product); the traditional form is expanded from the mask against the primary headword, first alternative in the mask’s own groups. A spelling the expander cannot read stays refused under the “variant notation” category, counted.

Prerequisite the maintainer owns: the personal offering must exist before the narrowed row can point at it. It is minted by personal-offering:ensure (which the recreate script’s --with-real-user run calls), or by the first write into the personal space (saving a text to Your library, or uploading a personal dictionary), not by signing in.

Scope org-licensed, organization personal-0, narrowed to the maintainer’s personal Offering (the licence is personal). Further licences become further dictionary rows. No dependency on the predecessor import; the maintainer’s cards and facts reference lexemes, not dictionaries.

2026-09-17: promoted to in progress under the rulings above, after the entitlement conflict with ADR-0056 was found and resolved by amending ADR-0059 decision 5. Rulings 8 and 9 were added the same day from the first parser survey of the real files.

2026-09-18: done. The Chinese–English dictionary is imported as an org-licensed row under personal-0, narrowed to the maintainer’s personal offering: 195 272 headwords, 6 239 refused by ruling 2. The first run lost one entry to a dropped connection that the ingest counted as a refused line; the ingest now retries a dropped connection once and otherwise ends the run loudly, and the documented re-run filled the gap. The English–Chinese row is deferred under ruling 7 as amended.