This project aims to develop a robust Next Word Prediction model using the Sherlock Holmes text dataset. The model predicts the most probable word following a given sequence of words, leveraging LSTM neural networks.
- Data Preprocessing: Text cleaning, tokenization, sequence creation.
- Model Building: Constructing the LSTM-based neural network.
- Model Training: Training the model on the dataset.
- Evaluation: Assessing model performance.
- Prediction Function: Function to predict the next word.
- Flask Application: Web app for interactive predictions.
- Clone the repository.
- Install the required libraries:
pip install flask nltk keras tensorflow
- Download the
sherlock_holmes.txt
dataset and place it in the project directory.
- Train the model: Run the script to preprocess the data, build, and train the model.
python Sherlock_Holmes_Next_Word_Prediction.IPYNB
- Run the Flask application:
python app.py
- Open a web browser and go to
http://127.0.0.1:5000/
.
Sherlock_Holmes_Next_Word_Prediction.IPYNB
: Script for data preprocessing, model training, and saving.app.py
: Flask application for next word prediction.templates/index.html
: HTML template for the web interface.sherlock-holm.es_stories_plain-text_advs.txt
: Text dataset.
The project demonstrates the use of LSTM neural networks for next word prediction. The model shows promising results and can be further improved with more data and fine-tuning.