Skip to content

fm4d/PyMarkovTextGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple and probably quite inefficient pseudorandom text generator based on Markov chains.
It creates and stores chains for you, but for any real use other than testing, you should reimplement demo functions.

Example:

from markov import *

#Create an instance of MarkovGenerator binded to shelve file
mg = MarkovGenerator('path_to_shelve_file')

#Create chain, pass name and markov chain order (see theory behind markov chains)
mg.add_chain("test", 2)

#List chains in this shelve file
mg.chains

#Build chain from source, pass path to file and chain
mg.build_chain(parse('path_to_src'), mg.chains.test)

#Repeat untl you have your chain ready

#Generate text from chain
mg.generate_sentence(mg.chains.test)

About

Python script for generating random text strings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages