Skip to content

Python module to create text based on existing text patterns

License

Notifications You must be signed in to change notification settings

gsideris/random_text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random_text

Python module to create text based on existing text patterns

example

from random_text.markovchain import MarkovChainWalker

# number of words 1300
words = 1300

# create a new object
dickens = MarkovChainWalker()

# parse books in text
dickens.parse('dickens/a_christmas_carol.txt')
dickens.parse('dickens/great_expectations.txt')  

dickens.process()
# start with 'i' and generate 1300 words
print dickens.generate('i', words)

Live Demo

As this is done in a single web request, try not to put a lot of books; it will timout https://random-text-163109.appspot.com/

About

Python module to create text based on existing text patterns

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages