Skip to content

Rithvik119am/nlp_ngram_word_predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

N-gram Model Prediction

This project uses an N-gram model to predict the next word in a sentence. It's implemented in Python using the NLTK and Streamlit libraries.

Features

  • Upload a text file to train the N-gram model.
  • Select the 'n' for the N-gram model.
  • Enter a sentence for prediction.
  • Predict the next set of words based on the input sentence.

How to Run

  1. Install the required Python libraries:
pip install nltk streamlit
  1. Run the Streamlit app:
streamlit run app.py

Functions

  • generate_ngrams(words, n): Generates n-grams from a list of words.
  • create_ngram_model(text, n): Creates an N-gram model from a given text.
  • predict_next_word(model, prefix): Predicts the next word based on the given model and prefix.
  • main(): The main function that runs the Streamlit app.

Files

  • app.py: The main Python script that contains the N-gram model and the Streamlit app.
  • Text files: Used for training the N-gram model.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages