Markov Biological Madness WordMash

In high school, I wrote a short JavaScript program to create Markov chains while waiting in an airport. The idea is simple but yields incredible results. First, you enter some lengthy text. A model is created by keeping track of all of the words that follow a given word. If there is a fairly large input text (Sherlock Holmes, or the Times), the slight amount of context will be enough to create sentences that (almost) make sense:

I told you yesterday, and I trust, with you, however, as I spoke, and it is clear and concise.


However, the randomness produces results that are often ridiculous!

Mr. Gordon, a retired Marine lieutenant general and a metal-schooled three-ax attack into songs that are both action-packed and gratuitously stylized. "Where Can I Stab Myself in the course of research for gut-level emotional impact," sheriff's officers said.


I recently made a site called WordMash where you can try it yourself, with texts like The Adventures of Sherlock Holmes. Best of all, you can paste your own text in, and see what happens. The code is all GPL, so have fun with it. Leave a comment if you come up with something good.