My word-prediction model is based on Katz backoff model for trigrams.
Katz back-off is a generative n-gram language model that estimates the conditional probability of a word given its history in the n-gram. It accomplishes this estimation by backing off through progressively shorter history models under certain conditions. By doing so, the model with the most reliable information about a given history is used to provide the better results.
My model takes the two last words (wi-1 and wi-2) to predict the next word (wi). In case, we only have a last word (wi-1) our model keeps working fine. After that, my model shows results for the possible predicted words (wi) in terms of their probabilities.