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.

Level: intermediateTopic: NLP embeddings

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

More NLP embeddings terms

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.