July 15, 2022

Overview

The project’s goal is to build a text prediction application using the R Shiny package that uses a natural language processing (NLP) model to predict words, or to build a text prediction application.

The program will attempt to anticipate the next word after receiving a word or phrase as input, much like the majority of modern smart phone keyboards, which use Swiftkey’s technology.

Prediction Model

The prediction model employs tidy data concepts used in R text mining. The prediction model involves the following key steps.

  • For model training, it requires raw text files as an input.
  • Clean up the raw data, and divide it into n grams of 2, 3, and 4 words.
  • Save the data as.rds files after frequency-sorting the n grams.
  • Using a back-off type prediction model is the N-grams function.
  • User enters a word or phrase
  • The model predicts the best match in the data by using the most recent words.
  • It produces a next word prediction.

Word Predictor App

Overview: The word prediction app has a straightforward user interface. A phrase or words are entered into the app’s input text box, and after a suitable delay, it provides a prediction of the next word. One can use up to three next word predictions using the slider tool.

Reference