N-gram
Category: NLP / Language Processing
A contiguous sequence of N items (words, characters, or tokens) from a text, used to capture local word order and context patterns.
Full Explanation
An n-gram is a sequence of N consecutive elements from a text. Common types include unigrams (single words), bigrams (two-word sequences), and trigrams (three-word sequences). N-gram models estimate the probability of a word based on the preceding N-1 words, forming the basis of classical statistical language models. In text analysis, n-gram features extend the bag-of-words model by partially capturing word order: "not good" as a bigram carries different information than "not" and "good" separately. N-grams are used in language modeling, text classification, spell checking, and machine translation. Character-level n-grams are useful for language identification and handling out-of-vocabulary words. While neural language models have largely superseded n-gram language models, the concept remains foundational in NLP.
Related Terms
More in NLP / Language Processing
Explore More
- AI Tools Library — Discover AI tools related to N-gram
- AI Education — Courses to learn about NLP / Language Processing
- AI News — Latest news and updates