Skip to content

NextWordAI : predict the next word using the LSTM, GRU. This project aims to develop a deep learning model for predicting the next word in a given sequence of words. The model is built using Long Short-Term Memory (LSTM) networks, which are well-suited for sequence prediction tasks.

License

Notifications You must be signed in to change notification settings

SINGHxTUSHAR/NextWordAI

Repository files navigation

GitHub license GitHub contributors GitHub issues GitHub pull-requests PRs Welcome

GitHub watchers GitHub forks GitHub stars

Open in Visual Studio Code

NextWordAI

Preview Image

Project Overview:

This project focuses on developing a deep learning model for predicting the next word in a given sequence of words using Long Short-Term Memory (LSTM) networks. LSTMs are particularly effective for sequence prediction tasks because they capture long-term dependencies in data. The model is trained on the text of Shakespeare's "Hamlet," providing a rich and complex dataset that challenges the model's predictive capabilities.

The project utilizes advanced deep-learning techniques to enhance natural language processing capabilities, specifically in next-word prediction tasks. By leveraging LSTM networks, it captures intricate patterns and dependencies within text data, ultimately providing a tool for applications such as text auto-completion and interactive chatbots. The deployment through a web application allows for user-friendly interaction with the model, showcasing its practical utility in real-time scenarios.

Workflow Description

The project follows a structured workflow consisting of six key steps:

1- Data Collection: We use the text of Shakespeare's "Hamlet" as our dataset. This rich, complex text provides a good challenge for our model.

2- Data Preprocessing: The text data is tokenized, converted into sequences, and padded to ensure uniform input lengths. The sequences are then split into training and testing sets.

3- Model Building: An LSTM model is constructed with an embedding layer, two LSTM layers, and a dense output layer with a softmax activation function to predict the probability of the next word.

4- Model Training: The model is trained using the prepared sequences, with early stopping implemented to prevent overfitting. Early stopping monitors the validation loss and stops training when the loss stops improving.

5- Model Evaluation: The model is evaluated using a set of example sentences to test its ability to predict the next word accurately.

6- Deployment: A Streamlit web application is developed to allow users to input a sequence of words and get the predicted next word in real-time.

Requirements💻 :

Ensure you have the following dependencies installed:

  • Python (version 3.11.x || 3.12.x)
  • IDE: VS-CODE or collab
  • Virtual-environment(venv)
  • Other dependencies (refer to the requirement.txt)

You can install the required Python packages using:

pip install -r requirement.txt

Setup 💿:

  • Clone the repository:
git clone /~https://github.com/SINGHxTUSHAR/NextWordAI.git
cd NextWordAI
  • Create a virtual environment (optional but recommended):
python -m venv venv
  • Activate the virtual environment:
    • On Windows:
    venv\Scripts\activate
    • On macOS/Linux:
    source venv/bin/activate

Contributing 📌:

If you'd like to contribute to this project, please follow the standard GitHub fork and pull request process. Contributions, issues, and feature requests are welcome!

Suggestion 🚀:

If you have any suggestions for me related to this project, feel free to contact me at tusharsinghrawat.delhi@gmail.com or LinkedIn.

License 📝:

This project is licensed under the MIT License - see the LICENSE file for details.

About

NextWordAI : predict the next word using the LSTM, GRU. This project aims to develop a deep learning model for predicting the next word in a given sequence of words. The model is built using Long Short-Term Memory (LSTM) networks, which are well-suited for sequence prediction tasks.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published