May 1, 2026

Algorithm

The app uses a backoff n-gram model:

  • Clean input by lowercasing text and removing punctuation
  • Try a trigram match using the last two words
  • If unavailable, back off to a bigram match using the last word
  • If still unavailable, return the most common unigram

The prediction is selected from the most frequent next-word candidate for the matched context.

This backoff design ensures the app returns a prediction even for unfamiliar phrases.

App Workflow

Next Word Predictor is a Shiny app that accepts an English phrase and returns one predicted next word.

Users type an English phrase into the text box and press Predict next word.

The app returns a single predicted word, the model level used, the matched context, and a simple confidence estimate.

Experience

The experience is simple: enter text, click once, and receive an immediate next-word suggestion.

The interface is intentionally lightweight so the prediction is the focus. It loads quickly, accepts multi-word phrases, and always returns a result through the fallback model.

Startup Value

This product demonstrates the core idea behind mobile keyboard prediction: combine text cleaning, n-gram frequencies, and graceful fallback into an interactive data product.

The approach is explainable, practical, and easy to improve with a larger training corpus, smoothing, and top-three suggestions.