12/30/2019

Introduction

The goal of this presentation is to describe the my prediction algorithm used in a Shiny app that takes as input a phrase (multiple words) in a text box input and outputs a prediction of the next word.

Prediction Algorothm ( Stupid Backoff )

I use Stupid Backoff algorithm for the prediction model .

The algorithm use scoring function :

with lambda = 0.4

so the algorithm as follows :

I get last word of 5-grams that start with the input sentence , then store the top 3 words with highest Probability which is the Number of times that 5-grams ended with this last word divided by number of times the first four words of this 5-gram show up in the 4-gram table , then step wise back off to the 2-gram level by repeating the procedure with an adjusted probability (x*0.4) as 0.4 is the recommended lambda value , and dropping the words that are suggested again during the backoff.

App

How to use the App

  1. Enter the sentence that you want to predict the last word for it in the input text
  2. Press the submit button
  3. The input sentence will be outputted in the first output box , and the predicted word with the highest Probability

Project Materials Links