Next_Word_App

Elisa Lerner
13/04/2016

This app predicts the next word to follow a given phrase, for example, if you type “what time is”, you would expect the next word to be “it”.

How it works - the general algorithm.

  • The algorithm has access to Ngram tables, where N=4,3,2,1. The 4gram table is inspected to find 4grams beginning with the last 3 words of the phrase. The 4th word of the 4gram with the highest relative frequency is the prediction.

  • If there are no 4grams beginning with those three words, “stupid backoff” is used to look for the last two words in the 3gram table, and if necessary, the last word in the 2gram table. If this does not succeed,the following rule is applied:

  • The table consisting of 1grams (single words) has a feature indicating which “cluster” a word belongs to. The word with the highest probalility of appearing as a continuation of a 2gram, will be chosen from the words in the union of clusters of the last three words of the phrase.

The actual implementation

  • The app actually starts making the prediction of the next word as soon as the first word typed is recognised. The prediction is updated as the user enters more words. Once more than four words have been typed the predcition will be updated by inspecting the last three words.

  • The English implementation uses the clustering algorithm described above if the 1gram table is reached without succeeding to make a prediction based on higher order ngrams . The German implemantation has no cluster feature and the 1gram prediction is simply the term with the highest probability of being a continuation of some 2gram.

How to use the app.

First choose a language from the dropdown menu: English or German.

Then you just start typing a phrase in the text box on the left side of the screen.

The app will calculate the prediction for the next word in the sequence, and show the prediction in the text box on the right.

What it looks like...