A simple Markovchain-Implementation written in Python
pip3 install markovpy
- Clone this repo
git clone https://github.com/Thor77/MarkovPy
and runpython3 setup.py install
Initialize a new MarkovPy
-Instance with an initialized store:
from markov.stores import Store
m = markov.MarkovPy(store=Store())
Now give it some data to learn from:
m.learn('hey how are you?')
m.learn('im fine.')
m.learn('great, see you')
And finally let it generate a reply:
m.reply('im')
# im fine.
markov.stores.Pickle
Using an in-memory-dict
and pickle
to persist it between sessions.
markov.stores.Redis
Using a redis-database.