← Classical AI, NLP & Linguistics
N-Gram
An N-gram is a contiguous sequence of N tokens drawn from a text. Unigrams are individual words, bigrams are adjacent pairs, and trigrams are three-word sequences. N-gram models estimate the probability of a word given the preceding N-1 words, forming the statistical basis of language modeling before neural methods. N-gram features are also used directly in bag-of-words pipelines to capture local phrase context that unigram representations miss entirely.