Mayank Pundir
August 20th, 2015
Introduction
How it works
Algorithm
Next word Prediction is an application created using Shiny Apps.With this application a user can predict next word by entering a word or a string.The application uses predefined set of tables containing ngrams claculated using Ngram markov model to find the top 10 words.To read more about Ngram please use the link.
To find the next word a user has to enter a word or a string in the text Input panel and click submit button. The application will display top 10 best matching words based on users input on the right hand side of the application.To try the application you can click on the link to website here.
To claculate top 10 next words the application uses 3 tables called Onegram,Bigram and Trigram.The data in these tables are loaded using Ngram package in R for one,two and three gram words.These tables contains 2 columns each with First column containing one word for Onegram two words for Bigram and Three words for Trigram.The second column on each table contains the most likely/widely used word for the combination of words in First column.When a user enters a string/word the algorithm looks for the last 3 words of the string and does a lookup on trigram table and then checks for last 2 words in bigram and then last word in onegram tables.It creates a set of words matched in the order and display the results in the result panel.If no match is found then the user is asked to re-enter a string.