Python for NLP: Deep Learning Text Generation with Keras

python_tutorials

This is the 21st article in my series of articles on Python for NLP. In the previous article, I explained how to use Facebook’s FastText library for finding semantic similarity and to perform text classification. In this article, you will see how to generate text via deep learning technique in Python using the Keras library.

Text generation is one of the state-of-the-art applications of NLP. Deep learning techniques are being used for a variety of text generation tasks such as writing poetry, generating scripts for movies, and even for composing music. However, in this article we will see a very simple example of text generation where given an input string of words, we will predict the next word. We will use the raw text from Shakespeare’s famous novel “Macbeth” and will use that to predict the next word given a sequence of input words.

After completing this article, you will be able to perform text generation using the dataset of your choice. So, let’s begin without further ado.

Importing Libraries and Dataset

The first step is to import the libraries required to execute the scripts in this article, along with the dataset. The

To finish reading, please visit source site