Input: The user types any text phrase.
The model searches 3 tables in order:
- Trigram table — looks up the last 2 words as a prefix
- Bigram table — backs off to the last 1 word (if no trigram match)
- Unigram fallback — returns the most common words overall
This is called Stupid Backoff (Brants et al., 2007):
\[S(w \mid \text{context}) = \begin{cases} \frac{f(\text{context},\,w)}{f(\text{context})} & \text{if seen} \\ 0.4 \times S(w \mid \text{shorter context}) & \text{otherwise} \end{cases}\]
Output: Top 3 predicted next words, shown as clickable buttons.