Published: August 26, 2026
For my capstone I built a Stupid-Backoff n-gram model that predicts the next word as you type — the same idea behind SwiftKey’s keyboard. The model is really just a giant set of counts: “how often did this word (or phrase) follow that one?”
This page lets you explore those counts yourself. Pick an n-gram size below, drag the rank slider to zoom in on the very top phrases, and watch the chart update — no page reload, no server, just your browser.
The bigger and rarer a phrase is, the less the model has seen it — so the predictor leans on shorter, more common n-grams as a fallback when it doesn’t recognize a longer phrase. Try switching between 1-gram and 4-gram above: notice how quickly the counts drop off as phrases get longer. That drop-off is exactly why “stupid backoff” is needed.
This chart is built from the same model that powers my live prediction app:
nicsookraj.shinyapps.io/next-word-predictor
Type a few words in and watch it suggest what comes next.