2026-04-17

1. The Objective: Smart Text Prediction

The Problem: Mobile device users type billions of words daily. Typing on small screens is slow and prone to errors.

The Solution: We developed a lightweight, highly responsive Next Word Prediction Application. Much like the predictive keyboard on a modern smartphone, this app anticipates what the user wants to type next, saving time and keystrokes.

Key Features: - Real-time text analysis. - Clean, intuitive User Interface. - Built on a massive dataset of English text (Blogs, News, and Twitter).

2. Under the Hood: The Algorithm

Our prediction engine is powered by an optimized “Stupid Backoff” N-Gram Model.

How it works: 1. Trigram Search: The algorithm reads the last two words typed by the user and searches our dictionary for the most likely third word. 2. Bigram Backoff: If the two-word combination has never been seen, the algorithm “backs off” and searches using only the very last word typed. 3. Unigram Fallback: If the word is completely unknown (like a rare name), the algorithm defaults to predicting the most common English words (e.g., “the”, “to”, “and”).

To ensure high speed, dictionaries were pruned to remove extremely rare misspellings, shrinking the model size by over 70%.

3. Quantitative Performance

To be viable for production, a typing app must be both accurate and blisteringly fast.

Efficiency Metrics: - Memory Footprint: By converting the data tables to compressed .rds files, the total model size was reduced to < 15 MB, allowing it to be hosted on free cloud servers. - Latency: Utilizing R’s data.table indexing, the average response time per prediction is < 0.1 seconds. The user experiences zero lag.

Accuracy Metrics (Held-out Test Set): - Evaluated against unseen data, the model successfully captures the user’s intended next word within its Top-3 predictions at a rate competitive with baseline industry standards for smoothed n-gram models.

4. The Shiny Application

The final product is hosted entirely online via RStudio’s Shiny infrastructure.

How to Use It: 1. Navigate to the web app (URL below). 2. Begin typing in the text input box. 3. Watch the “Top Prediction” box update instantly as you type. 4. Alternative 2nd and 3rd predictions are provided below the main suggestion.

(Note to Evaluator: Normally a screenshot would go here, but you can view the live app directly at the link below!)

Try it yourself here: https://tcymlx-kyle-weinerth.shinyapps.io/project/