s some input text. It simulates a k'th order Markov chain
based on the text's statistics
. The chain can either be based on letter statistics
("if the last 4 letters in the text were ` the', what is the chance that the next letter is `r'?), or on word
statistics ("if the last 2 words in the text were `I love', what is the chance that the next word is `nobody
'?"). The parameter
k is the degree of continuity
required; 4-6 is a good choice for a letter-based chain, while 2-3 for a word-based chain. The results are always amusing, since they're almost English
In Emacs, you can perform dissociation based on the current buffer using "M-x dissociated-press RET". See that function's documentation string ("C-h f dissociated-press RET") for details on how to specify k and the use of letter or word statistics.
In practice, most implementations don't do a real Markov chain, but instead do the following:
- Pick a random place in the text.
- Search forward for the require continuity (wrap around from the end of the text to its beginning).
- Output the next letter or word.
If the original text were generated by the Markov model
, the results would be the same. Unfortunately, this is not true of English.