Skip to content

Latest commit

 

History

History
executable file
·
23 lines (18 loc) · 834 Bytes

README.md

File metadata and controls

executable file
·
23 lines (18 loc) · 834 Bytes

dashkov

C++ text markov chain generator. Feel free to leverage the code within however you wish!

-Jack Carlson ([email protected])

Building

To run a test on the sample text (Nightmare Abbey by Thomas Love Peacock):

make
./dashkovgen

Python Bindings

Build the shared object by running python setup.py build. The python interface is in a declarative style:

import dashkov
dashkov.populate('somefile.txt') # learns from file (if db doesn't exist)
dashkov.load_db() # load model from default 'dashkov.db' file
reply = dashkov.get_reply('Some string', 15) # returns a string from the markov model. 
# the input string is used to seed the model. the integer argument is a maximum of words to return.
dashkov.learn('Some other string') # add a string to the model