June 2026

The Problem

  • Typing on mobile is slow and error-prone
  • Predictive text saves time and improves user experience
  • Used by SwiftKey, Gboard and every modern keyboard

Goal: Build a fast and accurate next-word prediction app using NLP techniques on real-world English text data.

The Data & Algorithm

Training Data: HC Corpora (Blogs, News, Twitter)

  • 150,000 lines sampled from 4 million lines of text

Algorithm: N-gram Backoff Model

  1. Clean and tokenize input phrase
  2. Match last 3 words in Quadgram table
  3. Back off to last 2 words in Trigram table
  4. Back off to last word in Bigram table
  5. Return most frequent match at each level

The App

Live at: https://bizsubba.shinyapps.io/nextword-app/

How to use:

  • Type any phrase in the text box
  • Click Predict Next Word button
  • Top predicted word displayed instantly
  • Top 5 candidate words shown in a table

Built with: R, Shiny, tidytext, dplyr, stringr

Performance & Accuracy

N-gram Level Coverage
Quadgram 32%
Trigram 41%
Bigram 23%
Fallback 4%
  • Response time: less than 200ms
  • Tested on 5 phrases: 5/5 predictions returned
  • Model size: optimized for shinyapps.io

Try It Yourself!

App URL: https://bizsubba.shinyapps.io/nextword-app/

Why this works:

  • Trained on real Blogs, News and Twitter data
  • Fast backoff model with no deep learning needed
  • Clean simple interface anyone can use
  • Easily extendable to other languages

Thank you!