SwiftKey Next Word Prediction App

Suneel Kumar
November 2026

Data Science Capstone Project

An intelligent application that predicts the next word based on the user's input phrase.

Dataset Overview

The project uses three English text datasets:

  • Blogs: Text collected from blog posts.
  • News: Text collected from news articles.
  • Twitter: Short messages from Twitter.

Data Preparation

  • Selected 10,000 random lines from each dataset.
  • Combined all three samples.
  • Converted text to lowercase.
  • Removed punctuation and unwanted characters.
  • Prepared clean text for prediction.

Training Sample

30,000 text lines from three different sources.

Prediction Algorithm

The application uses an N-gram frequency-based model.

How It Works

  • Text is processed into bigrams and trigrams.
  • Trigrams use the last two words as context.
  • Bigrams are used when trigram predictions are unavailable.
  • Word frequencies are used to rank possible next words.
  • The application returns the top three suggestions.

Example

Input: “I love”

Predicted words: you, the, it

The most frequent matching words are displayed first.

Shiny Application

The prediction model is deployed as an interactive Shiny web application.

Key Features

  • Simple and user-friendly interface.
  • Accepts a phrase containing multiple words.
  • Predicts the next possible words.
  • Displays the top three suggestions.
  • Provides predictions in real time after clicking the Predict button.

Live Application

https://suneelkumar04.shinyapps.io/swiftkey-next-word-prediction/

Conclusion and Future Improvements

Conclusion

  • Successfully developed a next-word prediction model.
  • Used English text from blogs, news, and Twitter.
  • Implemented bigram and trigram techniques.
  • Deployed an interactive Shiny application.
  • The application provides three word suggestions for a given phrase.

Future Improvements

  • Train the model on a larger dataset.
  • Improve prediction accuracy.
  • Handle more language patterns and contexts.
  • Optimize performance for faster predictions.

Thank You!