This repository contains a Next Word Prediction project built in R and Shiny as part of the Data Science Capstone. The goal is to create a predictive text model that suggests the next word given a phrase. This project was completed as part of the Data Science Capstone from the Johns Hopkins University Data Science Specialization on Coursera.
π Completed on October 11, 2016
.
βββ ShinyApp/
β βββ NextWordPrediction/ # R/Shiny app for interactive prediction
βββ SlideDeck/ # Project presentation slides
βββ README.md # Project documentation
- R (version 4.0 or higher recommended)
- R packages:
shinystringrdata.table- (add more based on your actual code)
Install packages in R:
install.packages(c("shiny", "stringr", "data.table"))- Navigate to the Shiny app folder:
setwd("ShinyApp/NextWordPrediction") - Run the app:
library(shiny) runApp()
This will launch the interactive web app where you can type a phrase and get next-word predictions.
The app predicts the next word by analyzing text data and applying natural language processing techniques.
It uses n-gram models trained on text datasets to provide probable next words.
Key steps include:
- Data preprocessing (cleaning, tokenization, removing punctuation/stopwords)
- Building n-gram frequency models
- Prediction logic based on most frequent n-grams
- Shiny app interface for real-time predictions
- Input a phrase and get next word suggestions
- Lightweight Shiny interface
- Supports interactive exploration of text prediction
Hereβs how the Shiny app looks in action:
The SlideDeck/ folder contains the presentation that explains:
- Project motivation
- Methodology
- Model design
- Results and challenges
Contributions are welcome!
- Fork this repository
- Create a new branch (
git checkout -b feature-branch) - Commit your changes (
git commit -m "Added new feature") - Push to the branch (
git push origin feature-branch) - Open a Pull Request
This project is licensed under the MIT License (or update with your actual license).