n-gram language model
an n-gram model guesses the next word from the few words before it, by counting how often each word followed that context in a corpus. a bigram looks back one word, a trigram two. add-k smoothing pretends every word was seen k extra times, so nothing gets probability zero.
try this
- at k = 0, press generate a few times. every pair in the output occurs somewhere in the corpus: a pair it never saw has probability 0.
- slide k up to 1 and generate again. about two in three picks are now words that never followed the one before them. the rare words take over.
- switch to trigram with k at 0. most two-word contexts occur only once, so about half the sentences come out word for word from the corpus.