June 2026

The Problem & The Pitch

Typing is slow. Prediction is fast.

  • Mobile keyboards, search boxes, and chat apps all rely on next-word prediction to save users keystrokes.
  • Our app demonstrates a lightweight prediction engine that runs entirely in the browser session — no GPU, no cloud LLM, sub-second response.
  • Trained on millions of real sentences from Twitter, news, and blogs (the SwiftKey corpus).

Type “happy new” → the model instantly suggests “year”.

The Algorithm

We use an n-gram model with Stupid Backoff:

  1. Pre-process: lowercase, strip punctuation/numbers/URLs, remove profanity.
  2. Build tables: count the most frequent 2-, 3-, and 4-word sequences; keep the top 5 continuations per prefix.
  3. Predict (backoff): match the longest possible prefix, falling back to shorter n-grams with a 0.4 discount per level.

\[score = count(prefix \rightarrow word) \times 0.4^{\,levels\ dropped}\]

This balances accuracy (long context wins) with coverage (short context always answers). The final model compresses to a few MB so it loads instantly on shinyapps.io.

The App

Three controls, one result:

  • Phrase box — type any word or phrase.
  • Slider — choose how many predictions (1–5) you want returned.
  • Predict button — returns ranked next-word suggestions as pills.

A Home tab holds the predictor; an About tab explains the method and gives instructions. Clean, responsive, mobile-friendly UI.

Tested on 5 held-out Twitter/news phrases — a prediction returned for every one.

Why It Wins

Thank You