Text Generation Shiny App

AbdulAziz Ascandari

2024-11-06

Introduction

In many real-world applications, users need text prediction for fast communication or assistance. The solution is to have a Shiny app powered by an n-gram model (unigram, bigram, trigram) to predict the next word based on user input. So the objective of this app is to present an interactive predictive text model that enhances user experience in writing and typing applications. The app can be found here : https://acecube.shinyapps.io/Text_Generator/

How the Algorithm Works

  1. Trigram Prediction: First, check if the last two words can predict the next word using a trigram model.
  2. Bigram Prediction: If no trigram match is found, fall back to the bigram model using the last word.
  3. Unigram Prediction: If no bigram match, use the unigram model for a fallback prediction.

Key Features

User interface

  1. A text input box for typing.
  2. A button that triggers the word prediction.
  3. An area to display the predicted next word.

Potential Applications & Benefits