2026-07-22

Introduction

This app makes use of a text prediction model to predict the next word of your input! Without pressing an ‘Enter’ button, the page instantly refreshes with the number of predicted words of your choice.

With this app, you can also see the confidence score for each word as well as the model level used.

App Link: https://greywolffles.shinyapps.io/DataScienceCapstone_TextPrediction/

How It Works

The app makes use of n-grams (quadgrams, trigrams, bigrams, and unigrams) to predict the next word. In simpler terms, it matches an existing database of existing and recurring word combinations from within text. Examples would include “on my way,” “next time,” and more!

The model was trained on English (US) blogs, news, and tweets, where a sample size was taken to allow for smaller files to process. The sample was then cleaned for punctuation, capitalization, numerals, and more.

More About the App

Creating the corpora for the n-grams was done on a separate file to allow for the app to be easier to load. The steps of text sampling, tokenization, up to creation of n-gram .RData files were done here. In the server.R file, the input text is also cleaned, with the prediction function being applied on it. This will then be sent to the UI file to be displayed.

User Interface

The interface has a clean, sleek look that allows for the user to type in input without needing to press an ‘Enter’ button. The output not only shows the next three possible words, but also their confidence score and model type. An About section can also be found.