Next Word Prediction App

Mayank Jain

Introduction

This app predicts the next word based on a user-input phrase.

Built using R, Shiny, and NLP techniques.

Focused on real-time performance and ease of use.

Data & Preprocessing

  • Dataset: Blogs, News, Twitter data from SwiftKey.
  • Text cleaned: removed punctuation, numbers, stopwords.
  • Created n-grams (1–4) using tidytext and tokenizers.

Prediction Algorithm

  • Used a Stupid Backoff model.
  • App searches for matching 4-gram, then backs off to 3, 2, and 1.
  • Efficient lookup with data.table.

App Features

  • Users enter a phrase like: “I love”
  • App instantly predicts next likely word.
  • Clean, fast, mobile-responsive UI using Shiny.

Business Use Case

  • Ideal for mobile keyboards, email auto-complete, chatbot typing aids.
  • Saves time and enhances user experience.
  • Can be scaled to support multiple languages and domains.