Next Word Predictor
Alex Brijo
2026-09-13
The Problem
- Typing on phones is slow and error-prone.
- Predictive text saves time and reduces typos.
- Goal: predict the next word given a phrase.
The Algorithm
- Trained on blogs, news, and Twitter (~150,000 lines sampled).
- Text cleaned: lowercase, punctuation removed, non-ASCII
stripped.
- Built a trigram back-off model:
- Try trigram match first
- Fall back to bigram
- Fall back to most common unigram
The App
- Simple text box: type a phrase.
- Click Predict to see the next word.
- Fast (< 1 second) because the model is precomputed and
small.
Why It Works
- Lightweight model → fast and free to host.
- Back-off strategy handles unseen phrases gracefully.
- Trained on real-world text: tweets, blogs, news.
- Easily extendable to 4-grams or 5-grams.
Thank You