Markov chains for text and anything else

go get



This is a general-purpose Go implementation of Markov chains. Specifically, it can build Markov chains from a stream of states and then sample from that chain. As a result, it is good for tasks like text prediction and generation.

Text example

The textchain directory includes a program which uses a Markov chain on text to produce more text. Here is some example output with a history size of 2, generated using Wikipedia articles:

of the Mahābhāṣya of Patañjali in 1856, and a content dispute at the time of formation of a subject of major Chinese scholars in these areas. Subjects receive attention and be logged in must not constitute a foul hit. Pitchers can also refer to translation to machine code, for correctly rounded when converted to Islam in the material. Wikipedia discourages needless wordiness, and rather free word order. Other authorities such as an accrediting body recognized by the equatorial Chimborazo volcano in the Queen". The Canadian Coast Guard Auxiliary (CCGA), formerly the bar, i.e., the reputed apparitions began in 2011 had