In this recipe, we will learn how to generate text similar to that written by William Shakespeare. The key idea is very simple: we take as input a real text written by Shakespeare and we give it as input to an RNN which will learn the sequences. This learning is then used to generate new text which looks like that written by the greatest writer in the English language.
For the sake of simplicity, we will use the framework TFLearn (http://tflearn.org/), which runs on top of TensorFlow. This example is part of the standard distribution and it is available at https://github.com/tflearn/tflearn/blob/master/examples/nlp/lstm_generator_shakespeare.py . The model developed one is an RNN character-level language model where the sequences considered are sequences of characters and not words.