feat(dict): every roadmap word is a card, tagged with its unit

The reworked app's learner model hangs off cards: recall evidence, the
phase-review checklist, the practice set, and the gate's "words he has
met". So every word a unit introduces has to be studiable — and 16 of the
371 were not. Eleven existed only as sentence chunks or dictionary rows
outside the review deck, and five (봐 읽어 갔어 봤어 먹었어) nowhere at all.

The build now marks exactly one reviewable lemma per roadmap word with the
unit that introduces it. Where the deck has the word, its row is chosen
deterministically (deck order, then source, then part of speech) — the
artifact tagged whichever card came last, which put the evidence for 이, 눈
and 저 on the wrong meaning. The sixteen get a `curriculum` lemma of their
own, glossed from the curated verb they conjugate (자 is "sleep", the 반말
of 자다 — not the dictionary's "ruler"), else from the sentence that uses
them, else the dictionary.

Lemmas also carry their topic, which the vocabulary filters need.
dict:assert gains the guarantee: 371/371 roadmap words as one card each.
Migration 7 adds the two columns; the rows arrive with the dictionary
reload a changed build now triggers on its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-09-16 20:03:09 +02:00
parent f8183d786f
commit 48987b96ae
17 changed files with 205 additions and 44 deletions

View File

@@ -65,6 +65,24 @@ describe("loading a band", () => {
});
});
describe("curriculum words", () => {
it("arrive as studiable cards, each tagged with the unit that introduces it", async () => {
serve(shipped);
const { ensureBands } = await loader();
await ensureBands(db, 1);
const { deck } = await import("@app/domain/cards.js");
const entries = await deck(db);
const eat = entries.find((e) => e.headword === "먹어");
expect(eat).toMatchObject({ source: "curriculum", unitId: "2.3", glossEn: "eat" });
expect(eat!.lemmaId).toBe(lemmaId("먹어", "form"));
const tagged = entries.filter((e) => e.unitId?.startsWith("1."));
const phase1 = (await import("@app/domain/gate.js")).UNITS.filter((u) => u.phase === 1).flatMap((u) => u.words ?? []);
expect(tagged.map((e) => e.headword).sort()).toEqual([...new Set(phase1)].sort());
});
});
describe("a rebuilt dictionary", () => {
it("reloads, and every card and custom word still names its word", async () => {
serve(shipped);