1/16/2020

Coursera Capstone project

Coursera Capstone project for Data science course:

Prediction of next word based on a word typed on a web interface

Rad

07 January 2020

Coursera Capstone project

Contents

The ‘Next Word Prediction’ Web application mainly predicts the next word in a sentence when typed into a user input. Here we will:

Describe the app and give instructions and describe how the app functions.

Description of the Algorithm used to make the prediction Model has been worked out.

Description of the R Codes and Datasets on which prediction Model has been worked out.

Coursera Capstone project

Application Description and Instructions

When a user types words at the prompt,

  1. the next word is displayed at the predicted word prompt.

  2. In addition, the typed text is displayed below.

The algorithm is based on the conditional proability.

The words with maximum frequency is considered first.

Please use the below listed link to access the App:

Here is the link to the application

Coursera Capstone project

Background of the Algorithm

According to the statistics rules, the conditional probability of an event A given that event B has occurred is

P(A|B)=P(A intersect B)/P(B)……..(Eq.1)

i.e.

P(A intersect B) = P(B) P(A|B))……..(Eq.2)

Applying the rule, the probability of predicting a given word Wn, with the previous words,W1,W2, …Wn-1 is

P(Wn | W1 …Wn-1) = P(W1 …Wn) x P(W1 …Wn-1))……..(Eq.3)

For an individual word the formula is:

P(W1)=(Freq. of W1 instances)/ (Total No. of words))……..(Eq.4)

–> –>

–> –> –> –> –> –> –> –> –> –> –> –>