Giter Club home page Giter Club logo

next-word-prediction's Introduction

Next Word Prediction

This project demonstrates a basic implementation of a next word prediction model using LSTM (Long Short-Term Memory) neural networks. The model is trained on a text corpus, and given a sequence of words, it predicts the most likely next word.

Project Structure

  • next_word_prediction.ipynb: Jupyter Notebook containing the code.
  • 1661-0.txt: Sample text file used for training (Project Gutenberg's "The Adventures of Sherlock Holmes" by Arthur Conan Doyle).
  • keras_next_word_model.h5: Trained LSTM model saved in the Hierarchical Data Format (HDF5).
  • history.p: Pickle file storing training history for visualization.

Usage

  1. Open the Jupyter Notebook next_word_prediction.ipynb.
  2. Execute each cell sequentially.
  3. The model will be trained on the provided text file (1661-0.txt).
  4. The notebook demonstrates text preprocessing, model creation, training, and prediction.

Dependencies

  • numpy
  • nltk
  • keras (TensorFlow backend)
  • matplotlib

Training Results

The training process includes two epochs, and the model's performance can be observed through the accuracy and loss metrics.

LinkedIn

Connect with me on LinkedIn: LinkedIn

Note

  • The provided text file (1661-0.txt) is a sample, and you can replace it with your own corpus for training.
  • The model is saved as keras_next_word_model.h5 for future use.
  • Experiment with different sequences to observe varied predictions.

Feel free to enhance and experiment with the model for more accurate predictions.

next-word-prediction's People

Contributors

hardikjp7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.