October 2026

The product

Next Word Predictor suggests the next word as you type, like the keyboard on a phone.

  • Type any English phrase and the app instantly proposes the most likely next word
  • It also offers four alternatives; click one to add it to your text
  • Built from 4 million lines of real English text (blogs, news and Twitter)
  • Light and fast: the whole model is about 5 MB, so predictions are instant

Try it: https://ichivite.shinyapps.io/nextword/

The data and how it was prepared

  • Source: SwiftKey English corpus, about 100 million words from blogs, news and tweets
  • Sample: a random 10% (about 427,000 lines), enough to capture common usage while keeping the model small
  • Cleaning: lower case; URLs, e-mails, numbers and punctuation removed (apostrophes kept, so don’t and I’m stay intact)
  • N-grams: the text was split into sequences of 1, 2, 3 and 4 words, and each was counted
  • Pruning: sequences seen only once were dropped and only the top 5 next words per phrase were kept
Table 1-word 2-word 3-word 4-word
Entries 20 109,425 409,101 298,947

Exploratory analysis: rpubs.com/chivite/capstone-milestone

The algorithm: Stupid Backoff

The app looks for the longest match between what you typed and what it has seen before:

  1. Take the last 3 words and look up which words most often follow them in the 4-word table
  2. If there are not enough matches, back off to the last 2 words, then the last word, multiplying the score by 0.4 at each step (a longer context is more reliable)
  3. As a last resort, suggest the most common English words

Score of a candidate word = how often it follows the phrase / how often the phrase appears

This method, proposed by Brants et al. (2007) at Google, is simple and very fast, and performs close to more complex models on large datasets.

How to use the app

  1. Open the app and type a phrase in the text box
  2. The predicted next word appears in large blue text
  3. Other suggestions appear as buttons below; click one to add it to your text
  4. The How it works tab explains the model

Example predictions:

You type App suggests
at the end of the day, year, world
I want to go to the bathroom, gym, movies
I love you, the, it
thanks for the follow, rt, mention

The last example shows the influence of Twitter in the training data.

Summary and next steps

What it delivers

  • Instant, sensible next-word suggestions from a 5 MB model
  • A clean interface that anyone can use without instructions

Possible improvements

  • Use a larger sample and a smarter smoothing method (e.g. Kneser-Ney)
  • Adapt to the user: learn from the words each person types
  • Predict the word being typed, not only the next one
  • Train separate models for formal (news) and informal (Twitter) writing

Links