Swiftkey: Predict Next Word

Chiffon
12/12/2014

N-gram Models

  • Based on Markov model
  • At their heart, n-grams answer the question: “What is the likelihood of one word (or character, phrase, sentence…) following another word or sequence of words?”
  • The kernel equation: \[ P(w_n|w_1^{n-1}) \approx P(w_n|w_{n-N+1}^{n-1}) \] where \( N \) is the \( N \) in N-gram (i.e. the number of words used to build the grammar)

  • For example, if we have the string, “We are the Knights who say, 'Ni!'”, in the bigram model we're moving along the string asking: P(Knights|are the), P(who|the Knights), …

How to use the shiny apps

The shiny apps is here: http://chiffon.shinyapps.io/SwiftKey

How to use the shiny apps

  • Write something at the Text input
  • Adjust the ratio of 2 or 3 gram model
    • My model is a mixture of 2 or 3 grams which may control the weights of two kinds of the model.
  • Press Predict!

  • See the answer in the right-side.

Pictures of the shiny

  • Wordcloud
  • Boxplot
  • rCharts(interactive)

Thanks for your Evaluation

The shiny is developed by Chiffon, for the Coursera Data science final fianl project. The data Visualization used rCharts packages. CSS is from Nan Xiao @road2stat and Yihui Xie @yihui .

Contact me with [dawei.lang@supstat.com]

Further Reading