In this example we have two source texts:
The random text is generated by starting with two words that begin a sentence in the source text (randomly chosen), and then choosing a third word that is observed to follow those two words in the source text (again, randomly chosen). For these purposes, punctuation symbols are treated as words. The process then repeats, randomly choosing a word observed to follow the last two generated words, stopping when some specified length is reached and terminal punctuation is found.
Since any three consecutive words in the generated text must appear somewhere in the source text, shorter passages will tend to make more sense than longer ones. For the same reason that longer passages tend to drift into nonsense, parentheses and quotation marks won't always match up.
Finally, click the "Generate Text" button at the bottom of the page to generate random text based on the combined word-level trigraph model of the two texts. Check the "Highlight Source" checkbox to color the generated text according to the model that it came from.
See the jsmarkov github repository for more details.