Simple markov chain implementation
Project description
=============
PyMarkovChain
=============
PyMarkovChain supplies an easy-to-use implementation of a markov chain text generator.
To use it, you can simply do
#!/usr/bin/env python
from pymarkovchain import MarkovChain
# Create an instance of the markov chain. By default, it uses MarkovChain.py's location to
# store and load its database files to. You probably want to give it another location, like so:
mc = MarkovChain("./markov")
# To generate the markov chain's language model, in case it's not present
mc.generateDatabase("This is a string of Text. It won't generate an interesting database though.")
# To let the markov chain generate some text, execute
mc.generateString()
To store its data, PyMarkovChain simply uses pickle to dump all of its data to disk.
This entails that you have to use the same version of python to store the data and to
restore the data, as pickle is one of those things that have changed from python2 to python3.
See also [code on github](https://github.com/MaxWagner/PyMarkovChain) and [PyPI page](http://pypi.python.org/pypi/PyMarkovChain/).
To install, simply use pip like so:
pip install PyMarkovChain
PyMarkovChain
=============
PyMarkovChain supplies an easy-to-use implementation of a markov chain text generator.
To use it, you can simply do
#!/usr/bin/env python
from pymarkovchain import MarkovChain
# Create an instance of the markov chain. By default, it uses MarkovChain.py's location to
# store and load its database files to. You probably want to give it another location, like so:
mc = MarkovChain("./markov")
# To generate the markov chain's language model, in case it's not present
mc.generateDatabase("This is a string of Text. It won't generate an interesting database though.")
# To let the markov chain generate some text, execute
mc.generateString()
To store its data, PyMarkovChain simply uses pickle to dump all of its data to disk.
This entails that you have to use the same version of python to store the data and to
restore the data, as pickle is one of those things that have changed from python2 to python3.
See also [code on github](https://github.com/MaxWagner/PyMarkovChain) and [PyPI page](http://pypi.python.org/pypi/PyMarkovChain/).
To install, simply use pip like so:
pip install PyMarkovChain
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyMarkovChain-1.8.tar.gz
(3.9 kB
view details)
File details
Details for the file PyMarkovChain-1.8.tar.gz
.
File metadata
- Download URL: PyMarkovChain-1.8.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8a03fba5d9f390b528991f5e3411188b545aa16a7131cea44c5f9cf1814d08a |
|
MD5 | 88abd4321d503220c0fcbdae6ab528fe |
|
BLAKE2b-256 | 57f929f29ec225348684304a199c387ae07c967530057b85f48b224a91fdcb96 |