Markov Text Generator
This is a simple Markov text generator that has been customized to generate poem like output using sonnets written by Shakespeare  as the source material. Inspired by this article from Coding Horror , and loosely based on the code from the Usware Blog .
Some of the changes I made were to consider line counts instead of word counts for termination and a reseeder to continue word generation if a matching key could not be found for the next state. In addition I emit some statistics about the database constructed such as the number of key entries and the mean and standard deviation of the number of possible words generated by each key.
This is written and tested in Python 2.6.1, no extra batteries required.
|||Shabda. (2009, Jun.). Generating pseudo random text with Markov chains using Python. [Online]. Available: http://uswaretech.com/blog/2009/06/pseudo-random-text-markov-chains-python|