Next Word Prediction
Cheng Nie
October 9th, 2016
Next word Prediction
- Next word prediction is essential for any text input APP.
- If it can predict the next word based on what the user has already input, then it can save the user's time to prompt some potential options of words from which the user can choose
- An example would the SwiftKey APP
- These slides demonstrates
- The algorithms of my implementation
- An inlustration of the Shiny App
Algorithm
- Use the tm package to read the corpus containing the news, blog, twitter files.
- Use functions in tm package to clean the text (remove punctuation, remove extra spaces, remove numbers, change to lower case)
- Generate uni-, bi-, tri-, and quad-gram and sorted the trems by frequency (decreasing order)
- Use the Backoff smoothing to start matching in the order of quad-, tri-, bi-gram until we find a match
- Output the predicted word
Demo of how to use the APP

- Type text in box.
- Click on the Predict button.
- Show predicted next word.