# Next Word Prediction

Natural Language Processing Data Product

Objective

  • Predict the next word in an English phrase.
  • Build an interactive Shiny application using NLP.
  • Use English Blogs, News, and Twitter datasets.

Product

An interactive application where users enter a phrase and receive one predicted next word.

Prediction Algorithm

How the Model Works

  1. User enters a phrase.
  2. The model checks the word patterns.
  3. It first searches for a matching trigram.
  4. If unavailable, it uses a bigram.
  5. One next word is returned.

Model Summary

  • Bigram patterns: 84,287
  • Trigram patterns: 54,680

Shiny Application

How It Works

  • Enter a multiple-word English phrase.
  • Click Predict Next Word.
  • Receive one predicted word.

Example

Input: I am going

Prediction: to

The app provides a simple and interactive interface.

Results and User Experience

Key Findings

  • The app successfully generates predictions.
  • It accepts multiple-word phrases.
  • It returns a single predicted word.
  • Trigram prediction is used first.
  • Bigram prediction provides a fallback.

User Experience

Enter phrase → Predict → Receive one word

Conclusion and Future Improvements

Conclusion

  • Built a working NLP prediction model.
  • Used Bigram and Trigram patterns.
  • Developed an interactive Shiny application.

Future Improvements

  • Use more training data.
  • Improve prediction accuracy.
  • Handle uncommon words better.
  • Improve prediction speed.
  • Explore advanced language models.

Final Takeaway

A simple NLP model can provide an interactive next-word prediction experience.