SwiftKey Next-Word Predictor

author: Igor Grybek date: Prototype evaluation complete

Turn a short phrase into one suggested next word.

Audience: People writing short messages or other text.

Data: English blogs, news, and Twitter posts from the course SwiftKey corpus.

Prototype: A focused Shiny app takes a phrase and returns one continuation.

Why next-word prediction?

Design goal: Keep the interaction simple, respond quickly, and make fallback behavior clear.

How the model works

  1. Normalize the phrase into lowercase word tokens.
  2. Search for the longest matching recent context, up to three words.
  3. If no continuation is available, back off to a shorter context.
  4. Return the most frequent observed continuation, or explain that no suggestion is available.

The model uses a deterministic sample: every 200th line from each source, with every 10th selected line held out. It trained on 19,105 lines and evaluated on 2,127 held-out lines.

Prototype results and app

Held-out source Token-level top-1 accuracy
Blogs 11.8%
News 11.9%
Twitter 11.2%

These are modest sampled prototype estimates, not production benchmarks. The deployed Shiny app was tested in a browser: “I went to the” → “house.” Five corpus examples and their outputs are in model/smoke_test.csv.

Limitations and next steps

The source, model, smoke tests, and sampled evaluation are included with this project archive.