2025-10-04

How It Works

  • Trained on a storytelling-style corpus of 10 narrative sentences.
  • Uses trigram modeling to predict the next word based on the last two.
  • Tokenized with tidytext and filtered using dplyr.
  • Prediction logic:
    • Extract last two words from input.
    • Match with trigram dataset.
    • Return most frequent third word.

App Features

  • Hosted on shinyapps.io
  • Input: Any phrase with at least two words
  • Output: Predicted next word from the corpus
  • Built with:
    • shiny for UI
    • tidytext for NLP
    • dplyr and tidyr for data wrangling

Real-World Examples

  • “Once upon” → a
  • “She would” → walk
  • “To the” → river
  • “The magical” → box
  • “Little girl” → who

Each prediction reflects the narrative tone and structure of the corpus.

Why It Matters

  • Enhances writing tools, educational apps, and creative assistants.
  • Lightweight, fast, and easy to scale.
  • Future potential:
    • Larger corpora (news, social media, books)
    • Multilingual support
    • Deep learning integration
  • Let’s build smarter storytelling together.