Next-Word Prediction App

dyangny
April 2015

Introduction

Predictive keyboards, such as SwiftKey, predict the next word in a sentence. Thus, users save time and effort otherwise spent on typing the next word.

The next-word prediction app mimics this functionality of predictive keyboards. The app can be found here.

Technical Details

The app's n-gram prediction algorithm was trained on English text from blogs, news and twitter feeds.

To achieve high prediction accuracy, the state-of-the-art Modified Kneser-Ney Smoothing technique was employed in building the app's algorithm.

The app's fast prediction speed is due to the usage R's data.table package and the use of a hash table.

User Interface

The user simply needs to:

  • Select the desired number of predictions using the slider on the left
  • Input text in the Text Input Box on the right

Current Limitations and Future Improvements

Prediction Accuracy:

  • App uses only up to trigrams currently
  • Could incorporate higher order n-grams and skip-grams
  • Subjected to data size constraints

Data Size Constraints:

  • Data size used is already 70% of 100Mb allowed by Shiny
  • Might need a more efficient data structure for storing predictions