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 function.

- 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. Then the second word of this 2-gram is displayed.

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

- Functionality -

The user types a word or sentence in the text box on the left, then after using the button “Predict next word” the predicted word is displayed on the right side.

- Result -

Result is a simple but therefore performant app.

You can try it here:

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