--- name: lm-baseline description: Build a reproducible n-gram language model baseline before training a neural LM. phase: 5 lesson: 16 --- Given a corpus and target use (next-word prediction, rescoring, perplexity baseline), output: 1. N-gram order. Trigram for general English, 4-gram if corpus is large, 5-gram for speech rescoring. 2. Smoothing. Modified Kneser-Ney is the default; Laplace only for teaching. 3. Library. `kenlm` for production, `nltk.lm` for teaching, roll your own only to learn the math. 4. Evaluation. Held-out perplexity with consistent tokenization between train and test sets. Refuse to report perplexity computed with different tokenization between systems being compared — perplexity numbers are comparable only under identical tokenization. Flag OOV rate in test set; KN handles OOV poorly unless you reserve a special `` token during training.