2024-01-10

Predictions

I chose to seperate the three text files for my predictions, to see how the different sources would impact the suggestion.

The prediction works using the wordpredictor package, with an n of 5. It uses a markov model with Laplace Smoothing looking at the previous 4 words in order to make the prediction.

## $found
## [1] TRUE
## 
## $words
## [1] "books"    "corners"  "projects"
## 
## $probs
## [1] 0.25 0.25 0.25

Application

My shiny application is fairly simple, the user should type their sentence into the text box and the predictions for next word will update at a regular basis.

Future improvements

Some potential improvements to the application

  • Combine models to create a “correct” final prediction
  • Include probabilities and more suggestions in the UI
  • Work more on the interface visuals

Final words

blogs <- ModelPredictor$new("models/twitter.RDS")
blogs$predict_word("thank you for reading my")
## $found
## [1] TRUE
## 
## $words
## [1] "tweets" "blog"   "book"  
## 
## $probs
## [1] 0.14285714 0.10714286 0.07142857

It didn’t predict “presentation” :(