Next Word Predictor
Saad Ul Islam
2025-06-17
Slide 1: Introduction & Problem
- Problem: Typing on mobile devices is slow and
error-prone.
- Solution: Predict the next word a
user is likely to type.
- Use Case: Messaging, email apps, note-taking
tools.
- Goal: Increase typing efficiency using a
smart text predictor trained on real-world data.
Slide 2: The App (UI & Features)
- Built using R Shiny with a professional UI.
- User enters a phrase; app predicts top next word(s).
- Features:
- Loading spinner animation
- Clean, responsive interface
- Pre-filled examples
- Model explanation tab
- Technologies:
shiny, shinyjs,
shinythemes, dplyr, quanteda
App Screenshot
Slide 3: Algorithm Overview
- N-Gram Model (Quadgrams with Katz Backoff)
- Trained on:
- 100M+ words from Twitter, News, Blogs
- Prediction Process:
- Extract last bigram/trigram
- Match in preprocessed n-gram model
- If no match: fallback to smaller n-grams
- Model Size: ~50,000 most frequent phrases
Slide 4: Data Preparation Pipeline
prepare_data.R script:
- Reads raw text (blogs, news, twitter)
- Cleans & tokenizes text
- Generates 2- to 4-grams
- Aggregates & saves top phrases
- Key Tools:
quanteda, textstat_frequency
readtext, dplyr, purrr
- Output:
ngrams_final.RDS (used by the app)
Slide 5: Value & Next Steps
- 📱 Practical, real-world NLP application
- 🚀 65% Top-1 accuracy, <50ms response time
- 💼 Potential use in:
- Chatbots
- Typing Assistants
- Predictive Search
- ✅ Ready to integrate with mobile apps
- Next: Add personalization, deep learning
models