Coder Social home page Coder Social logo

selcia25 / text-generation-using-lstm Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 649 KB

💬This project is a research work on text generation using LSTM (Long Short-Term Memory) neural networks.

License: MIT License

Jupyter Notebook 100.00%
lstm-neural-networks tensorflow text-to-speech textgeneration

text-generation-using-lstm's Introduction

Text Generation using LSTM

This project explores text generation using LSTM (Long Short-Term Memory) neural networks. It trains an LSTM model on a dataset of Medium article titles to predict the next word in a sequence, allowing for the generation of new text based on a seed text.

Installation

  1. Clone the repository:

    git clone https://github.com/selcia25/text-generation-using-lstm.git
  2. Install the required libraries:

    pip install pandas numpy tensorflow matplotlib

Dataset

The dataset used for training the model is a collection of Medium article titles. The dataset (medium_data.csv) contains a multiple columns including title with the titles of the articles.

Model Training

  1. Preprocess the data: Clean the text by removing unnecessary characters and tokenize the text using the Tokenizer class from Keras.

  2. Generate input sequences: Create input sequences of varying lengths to train the model.

  3. Pad sequences: Pad the input sequences to ensure uniform length.

  4. Build the LSTM model: Construct a Sequential model with an Embedding layer, a Bidirectional LSTM layer, and a Dense output layer with a softmax activation.

  5. Compile the model: Compile the model using the Adam optimizer and categorical crossentropy loss function.

  6. Train the model: Train the model on the input sequences and corresponding labels.

Usage

  1. Run the script to train the model.

  2. Use the trained model to generate text by providing a seed text and specifying the number of words to generate.

Examples

Here are some examples of generating text using the trained model:

  • Seed text: "implementation of"
    • Generated text: "implementation of rnn lstm"

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes.

License

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

text-generation-using-lstm's People

Contributors

selcia25 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.