Generating Free Text with RNNs
Now that we have seen how RNNs can be used for text classification, we can move on to the next case study. Here, we want to train an RNN to generate new free text in a certain style, be it Shakespearean English, a rap song, or mimicking a Brothers Grimm fairy tale. We will focus on the last application: training a network to generate free text in the style of Brothers Grimm fairy tales. However, the network and the process can be easily adjusted to produce a new rap song or a text in old Shakespearean English.
So, how can we train an RNN to generate new text?
The Dataset
First of all, you need a text corpus to train the network to generate new text. Any text corpus is good. However, keep in mind that the text you use for training will define the style of the text automatically generated. If you train the network on Shakespearean theater, you will get new text in old Shakespearean English; if you train the network on rap songs, you will get urban...