July 2026

Data Science Capstone Project

Next Word Prediction App

This application predicts the next word based on an input phrase.

The goal is to create an interactive text prediction tool using Natural Language Processing (NLP) techniques in R.

Algorithm

The prediction algorithm uses an N-gram language model.

The main steps include:

  • Text cleaning and preprocessing
  • Tokenization of English text
  • Creation of bigram and trigram frequency tables
  • Selecting the most frequent possible next word

The training data consists of:

  • Twitter messages
  • News articles
  • Blog posts

How the App Works

The application works through a simple user interface:

  1. User enters a phrase in the text input box.
  2. The app analyzes the entered words.
  3. The algorithm searches the n-gram frequency tables.
  4. The app returns a predicted next word.

The application was developed using R Shiny.

Application Experience

The app provides:

  • A simple and user-friendly interface
  • Quick prediction response
  • Single-word prediction output

Example:

Input: “I love”

Output: Predicted next word

This demonstrates how Natural Language Processing can be used for predictive text applications.

Conclusion and Future Improvements

This project demonstrates a basic next-word prediction system using an N-gram language model.

Future improvements include:

  • Training on a larger dataset
  • Improving prediction accuracy
  • Using advanced NLP models
  • Adding spelling correction and better context understanding

Thank you!