SwiftKey Next Word Prediction
1. Project Overview
SwiftKey Next Word Prediction
An intelligent text prediction application using Natural Language Processing
- Developed using R programming.
- Uses text data from blogs, news and Twitter.
- Predicts the next word based on the words entered by the user.
- Provides an interactive interface using Shiny.
Project Goal: To make text entry faster and easier through next-word prediction.
2. Data Collection and Preparation
Understanding the Data
The project uses three English text datasets:
- US Blogs
- US News
- US Twitter
Data Preparation Steps
- Loaded the three text datasets.
- Selected 30,000 lines from each dataset.
- Combined them into 90,000 text lines.
- Converted text into lowercase.
- Removed URLs, punctuation and unnecessary characters.
- Tokenized the cleaned text for analysis.
3. Prediction Algorithm
N-gram Language Model
The application uses two types of n-grams:
- Bigram: Uses the previous one word to predict the next word.
- Trigram: Uses the previous two words to predict the next word.
Prediction Strategy
- Clean the user’s input.
- Check the last two words against the trigram model.
- If no match is found, check the last word against the bigram model.
- If no match is found, return the most common word.
Example:
Input: I want to
Predicted word: be
4. Application Development
Interactive Shiny Application
The application was developed using R and Shiny.
Main Features:
- Simple and user-friendly interface.
- Text input for entering sentence fragments.
- Predict Next Word button.
- Displays the predicted next word.
- Lightweight prediction model for deployment.
Technologies Used
- R Programming
- RStudio
- Quanteda
- Shiny
- N-gram Language Modeling
5. Deployment and Conclusion
Live Application
The project was successfully deployed using ShinyApps.io.
Try the application:
https://swiftkey-predictor-2026.shinyapps.io/swiftkey_final_project/
Conclusion
- Successfully developed a next-word prediction model.
- Applied text cleaning and NLP techniques.
- Implemented bigram and trigram prediction.
- Created and deployed an interactive web application.
Thank You!