2024-08-04

Next Word Prediction Shiny App

  • Overview: This presentation shows a Shiny app designed to predict the next word in a phrase using bigram analysis.
  • Objective: To demonstrate the app’s functionality, explain the underlying algorithm, and provide user instructions.

Predictive Algorithm

  • Bigram Analysis: The app uses bigram frequency analysis to predict the next word.
  • Process:
    • Tokenization: Input text is tokenized and cleaned.
    • Bigram Matching: The last word of the input is matched with the first word of bigrams in the dataset.
    • Frequency Ranking: Bigrams are ranked by frequency to find the most likely next word.
  • Data Source: Preprocessed bigrams dataset loaded at the start.

App Description and Instructions

  • Description: A user-friendly Shiny app for next word prediction.
  • User Instructions:
    • Input Field: Enter a phrase in the text input box.
    • Prediction Display: The predicted next word is displayed based on the input.
  • Functionality: The app processes input (almost) in real-time and updates predictions dynamically.

User Experience

  • Intuitive Interface: Simple and easy to navigate interface.
  • Real-time Feedback: Near-instant predictions as users type.
  • Utility: Helpful for text completion, writing assistance and linguistic analysis.
  • Performance: Efficient and responsive (not with very large datasets).

Evaluation and Conclusion

  • Novel Approach: Leverages bigram analysis for predictive text, demonstrating a practical application of NLP techniques.
  • Implementation: The app is executed with a focus on usability and performance.
  • Try it: https://gianluca-pastorelli.shinyapps.io/NLP_app/