Menu

1 / 6

NLP #4: N-gram Language Models

DEV Community: machinelearning·GradientGym·14 days ago
#81InKxbJ
Long article (3454 words) — no AI summary yet.
Reading 0:00
15s threshold

Originally published on almoghagbi.com , where the figures are interactive.

By the end of this post, you'll be able to compute the probability of a

sentence from a handful of counts, and predict the next word the way your

phone's keyboard does. A language model is the part of natural language

processing (NLP) that does this: it gives a probability to each word that could

come next. Section 3.1 of

Speech and Language Processing

starts with the simplest kind, the n-gram model. Its trick: look only at the

last word or two, count, and divide.

Intuition

A language model scores what comes next

Type "i want a" on your phone and it suggests a few next words. A speech

recognizer that hears "I scream" or "ice cream" picks the one people say more

often in that spot.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.