Repository navigation
v0.3.0
Pre-release
Pre-release
Replace the hand-written letter-to-sound rules with a trained model English spelling is too irregular to enumerate by hand, and the rules had hit their ceiling at 15.6% word accuracy. This learns the mapping from CMUdict itself instead: 64.2% of held-out words exactly right, phoneme error rate down from 30.7% to 9.0%. The new `trainer` subproject (not published) does the work in two stages, and writes a 375 KB binary the library ships as a resource: - `Aligner` infers, by expectation-maximization, which phonemes each letter of a word is responsible for — the detail a dictionary never states and every later step needs. All but 25 of 118,714 training entries align. - `TreeTrainer` grows one CART decision tree per letter over that alignment, splitting on the surrounding letters and on the phonemes already emitted to the left. That second group of features is what stops the model dropping the vowel out of a syllable, and is worth ~4 points on its own. Decoding is a pointer chase down one tree per letter: no floating point, no new dependencies, and 3-11 ms to load the whole model. Accuracy claims are kept honest by `TrainingSplit`, which holds out one word in twenty by hashing the word. The trainer excludes exactly those words and `LtsModelBenchmarkTest` scores only those words, both through the same function, so a model trained on the dictionary can never be graded on its own memory. Three ideas that looked right and measured worse are recorded in the README rather than left to be re-attempted: wider letter context, position-in-word features, and beam search over whole words. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BtiynRL3VisERGpMquRg8x