2026

The Problem

Typing on mobile devices is slow and error-prone.

Goal: Build a fast, lightweight app that predicts the next word as you type — just like the keyboard on your phone.

  • Trained on 4.2 million lines of English text (blogs, news, Twitter)
  • Responds in < 100 ms per query
  • Runs entirely on shinyapps.io (no local install needed)

The Algorithm: Stupid Backoff N-Gram

The model uses Stupid Backoff (Brants et al., 2007) over uni-, bi-, and trigram tables stored as data.table objects.

Input: "I want to go"
  → Look up trigram  "want to go ___"   (score = freq / total)
  → If not found, bigram  "to go ___"   (score x 0.4)
  → If not found, unigram "___"         (score x 0.4^2)

Memory optimizations:

  • Removed hapax legomena (freq = 1) → 40–60% size reduction
  • Final model size: ~99 MB (under the 100 MB target)

How to Use the App

Live at: https://dirineo21.shinyapps.io/shiny_app/

  1. Type any English phrase in the text box
  2. Press “Predecir”
  3. Up to 6 word suggestions appear as clickable chips
  4. Click a chip to append the word and keep building your sentence
  5. The score table shows the probability for each suggestion

No setup required — works in any browser.

Performance & Experience

Metric Result
Model size (RAM) ~99 MB
Avg. response time < 100 ms
Vocabulary coverage ~90% of corpus
Suggestions shown Up to 6 words

The chip-click feature lets users build sentences word by word without retyping, making it genuinely useful for text composition.

Novel Approach & Summary

What makes this model stand out:

  • Stupid Backoff is production-grade (used by Google at scale) yet simple enough to deploy on a free shinyapps.io instance
  • Clickable word chips go beyond a simple text box — users can iteratively compose sentences
  • Score transparency: the probability table lets users understand why each word was suggested

Links: