Robot Shakespeare

A Shakespearean sonnet generator, powered by a Keras LSTM network and Flask.

Robot Shakespeare was an opportunity to play with Keras & learn about LSTM neural networks. I chose Shakespeare’s sonnets as a text corpus because I wanted to see how the model would handle the hoghly-structured text of a poem. I think it’s fascinating how even a simple model like this one can, when given nothing but raw characters as input, learn not only to make mostly-coherent words but even some high-level features of the sonnet form, such as appropriate capitalization and punctuation, linebreaks at the correct points, and sometimes even indentation mimicking the typesetting of the original. I also took the opportunity to build a web interface in Flask and toss it up on Heroku so others can play with it. I wrote up a blog post about my thought processes while building it. The code is, of course, all on my GitHub.


Updated