Skip to content

JamesBrill/Markov-Chain-Text-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

Markov Chain Text Generator

Takes text from a file and generates some random (but readable) text from it using a Markov chain. Bigger input text is recommended for more interesting results. Comes with an example input file that combines The Hobbit with Fifty Shades of Grey.

Options

  • -f --file (required): Name of file to read text from.
  • -o --order: Number of past states each state depends on. The lower the order, the greater the randomness. The higher the order, the closer the output text will match the input text.
  • -w --words: Number of words to generate.

Example usage

To generate 500 words from text in example-input with a Markov chain of order 1:

python textgen.py -f example-input -o 1 -w 500

Example output

...but how Gandalf got there, with all his wet hole, and filled with velvety soft, organic bamboo viscose that you mean about them, when Bilbo (who had got quite uncomfortable dreams...

About

Script that generates random text based on a source text using a Markov chain.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages