2025-10-02

Problem

  • Typing repetitive words and phrases is time-consuming.
  • Predictive text is standard on smartphones; why not in R?
  • Goal: Build a Next Word Prediction Algorithm with an interactive Shiny app.

Solution: Our App

  • Developed in R + Shiny.
  • Uses n-gram language models (bigrams & trigrams).
  • Predicts the most likely next word based on user input.
  • Deployable on Posit Cloud / shinyapps.io.

How It Works

  1. Clean & tokenize the text corpus.
  2. Build bigram and trigram frequency tables.
  3. Prediction logic:
    • If ≥2 words: use trigram
    • Else if ≥1 word: use bigram
    • Else: fallback to most frequent unigram

Demo App UI