Single word prediction application

Mahmoud Elsheikh
19-June-2019

1. The algorithm:

a. The algorithm depends on calculating katz's back-off probabilities for combinations of prewords and current words,the words to be predicted, and store it as a probability matrix as per the below equation:

\[ P_{bo}(w_{i}|w_{i-n+1}...w_{i-1}) = \begin{cases} d_{w_{i-n+1...w_{i}}}\frac{C(w_{i-n+1}...w_{i-1}w_{i})}{C(w_{i-n+1}...w_{i})} \\\\\ if C(w_{w_{i-n+1...wi}}>k)\;\;k =1 \\\\\alpha_{w_{i-n+1}...w_{i-1}}P_{bo}(w_{i}|w_{i-n+2}...w_{i-1}) \\\\ otherwise \end{cases} \]

b. Multiple samples were taken from the data and multiple probability matrices were produced.

1. The algorithm: cont'd

c. The probability matrices are incorporated in a word prediction function which in turn will look for the given sentence in the matrices cascade and return the most probable word for this preword as prediction.

d. If the algorithm didn't find a match of the preword it will return the most common word in English language which is “the”.

2. Application:

  • The application has a simple GUI and fast response time around 0.5 msec.
  • Simply type in the sentence,in the sentence entry box, and it will predict the next word as you are typing in the predicted word box.
  • Also there is an instruction box to remove any confusion that might be there.
  • The application has a side bar which contains the application and the documentation with links to the code of the algorithm.

3. Under the Hood:

For more details on how the algorithm was built please visit:

To test the application please visit Single word application