Markov chain text generator

Enter some of your own text or choose one of the pre-populated texts, including Ulysses by James Joyce, the King James Bible, and my own vampire novel. A Markov chain text generator will mimic a pre-existing text based on probabilities of word order. The end result is nonsense that sounds very "real".

Input some text

OR select one of these texts




What are Markov chains?

Explanation from http://louphole.com/:
Markov chains are a mathematical tool used to generate output that mimics a given sample. For the Markov chains algorithm to work, it first needs a sample as big as possible of the kind of material it will generate. The program chunks this initial input into small items, in this case, words. For each item, it browses the sample and looks at which item immediately follows. Taking the number of items into account, the program computes a probability for each item to be the one that follows a given item. This process creates a statistical model of the input. It assumes that the input is representative enough as a sample to give an idea of the general rules followed by the material. Once the statistics are computed, the algorithm starts with a random item from the list and picks the item that succeeds based on the statistical model of the current item and a randomly computed probability. It repeats the process with each subsequent item.
See a deeper explanation on codinghorror.com.