Final Project Submission- Word Prediction -

Word prediction: A shiny app

17.11.2017

Goal and data basis of the app

Goal:

A Shiny app that takes as input a phrase (multiple words) in a text box input and outputs after a suitable delay a prediction of the next word.

Data basis:

Data basis are US blogs, news, and twitter data downloaded from: https://d396qusza40orc.cloudfront.net/dsscapstone/dataset/Coursera-SwiftKey.zip

- Preprocessing -

For preprocessing the data the library “ngram” is used and the blogs, news and twitter data is loaded.

Then all 2-grams are build and their frequencies are calculated. Now we can apply the word predicting funtion.

- Word Predicting Funtion -

Core of the app is a function that takes the last word of the text input, searches the 2-gram with this word as startword and the highest frequency. The the second word of this 2-gram is displayed.

If no corresponding 2-gram is found, the text “Sorry, no suggestion” is displayed.

Result

Result is a simple but therefore performant app:

https://ghcoursera.shinyapps.io/WordPrediction/