Languages (v0.3.0): words, lemmas, coverage, levels, alignment #3
Reference in New Issue
Block a user
Delete Branch "feature/languages"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Day 3 core (v0.3.0): the pure half of "loved books in the original". The day page is
docs/03_languages.mdin the app repo.New crate
liber-lang(no outside data, no files, no clock; in the purity scan):tokens: words, numbers (Roman numerals too) and punctuation by UAX #29, with the reader's UTF-16 offsets; sentence starts;sentences.Lemmatizertrait;Table(form → lemma TSV, capped: hostile input),Rulesper language (hand-written suffix rules and irregular lists),Headwordsto choose among rule candidates,Chain= table → rules.Profile: lemma counts per chapter;coverage,later("comes up N more times"),warmup(5 most frequent unknown lemmas);lemma_atfor a tapped word; names and numbers never count.level: 500…8,000 known lemmas; unlock at 95% coverage, 90% for a book read in one's own language;percentrounds down.concept_id:w-<lang>-<16 base32 of sha256(folded lemma)>(Ludus rule).align: Gale–Church over 1:1/1:0/0:1/2:1/1:2/2:2 with anchors (numbers, name stems), banded so a book-length run stays small;sentence_pairs;score(P/R/F1 over links).liber-library:
Op::Word(known / learning / unknown, last writer wins),Op::KnownBand,Op::Edition,Field::Familiar;Library.words,Library.bands,Book.familiar,Book.editions; replayed by the export; caps on lang, lemma length and count.Mandatory tests:
tests/coverage.rs, 7): hand-counted 10/16 with a name, numbers and a Roman numeral excluded; every inflected form of a known lemma known; German names need a lexicon; later counts, warm-up, tapped word, levels, concept ids.tests/lemma.rs, 3): rules only on fixtures written here: English 88.9% (56/63), German 78.3% (47/60), Latin 80.7% (46/57); floors 85/75/75. Table and headwords precedence; table caps.tests/align.rs, 4): fixture pair (a story written here, DE/EN, CC0) with a merge, an omission and a split sentence: paragraph F1 1.00; sentence pairs (1:1, 1:2); a 1,500-paragraph synthetic book with omissions and merges: F1 0.999, last bead exact.Plus
liber-library/tests/words.rs(3): any-order merge, hostile events, export round trip.Workspace: 91 tests green; clippy 0;
scripts/deps.mjs101 crates, 0 not allowed (new: unicode-segmentation, MIT OR Apache-2.0).Self-review: