Next Word Predictor — Shiny app that predicts the next word based on user input.
Model: N-grams (2 to 4) with Stupid Backoff
Corpus: HC Corpora — blogs, news and Twitter (English)
Sample: ~2% (~43k lines) due to Posit Cloud Free tier limits
Live app: CapstoneDaraScience
Data Architecture
├── en_US.blogs.txt ─┐
├── en_US.news.txt ├── sample(2%) ──→ clean ──→ n-grams
└── en_US.twitter.txt ┘
├── unigram.rds (unique words)
├── bigram.rds (2-grams)
├── trigram.rds (3-grams)
└── fourgram.rds (4-grams)
▼
Shiny App
Input: any sentence
Output: top 5 next words
Method: Stupid Backoff (α=0.4)