Every time your phone suggests the next word, or a search engine completes your query, something is estimating the probability of a word given its context. Long before neural networks dominated language, one idea handled this task surprisingly well: just count.
An n-gram is a sequence of consecutive words. A bigram is two words in a row — "the cat", "cat sat", "sat on". A trigram is three. The core insight is brutally simple: the probability of the next word depends only on the last words, not the entire preceding history. This is the Markov assumption, and it turns an impossible problem (condition on arbitrarily long histories) into a tractable one (condition on a short, fixed-length window).
Collect a large text, count every bigram, divide by unigram counts, and you have a working bigram language model:
The beauty and the curse are the same: the model knows exactly what it has seen, and absolutely nothing about what it has not. Every unseen bigram gets probability zero — even plausible ones. This is the zero-frequency problem, and solving it with smoothing is where the real engineering lives.
Comments
Loading comments...