AI engineering glossary · NLP embeddings
What is n-gram language model?
N-gram language model (also called N-gram model): A language model that estimates the probability of the next word from counts of the previous n-1 words in a corpus. It is fast and easy to build, but cannot use long-range context and struggles with word sequences it has not seen.
N-gram language model: an example
With counts "good morning" = 90 and "good" = 300, a bigram model gives P(morning | good) = 90 / 300 = 0.3.
Related terms
- Markov assumption
- Smoothing
- Language model
More NLP embeddings terms
- Named entity
- Named entity recognition
- Natural language processing
- Natural language understanding
- Negative sampling
- NLTK
- One-hot word vector
- Out-of-vocabulary word
Where you learn it
N-gram language model is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.