A memory-based, non-persistent naïve bayesian text classifier.
This work is heavily inspired by the python "redisbayes" module found here: [https://github.com/jart/redisbayes] and [https://pypi.python.org/pypi/redisbayes] I've elected to write this to alleviate the network/time requirements when using the bayesian classifier to classify large sets of text, or when attempting to train with very large sets of sample data.
Installation
PIP:
sudo pip install simplebayes
GIT:
sudo pip install git+git://github.com/hickeroar/simplebayes.git
Basic Usage
import simplebayes
bayes = simplebayes.SimpleBayes()
bayes.train('good', 'sunshine drugs love sex lobster sloth')
bayes.train('bad', 'fear death horror government zombie')
assert bayes.classify('sloths are so cute i love them') == 'good'
assert bayes.classify('i would fear a zombie and love the government') == 'bad'
print bayes.score('i fear god and love the government')
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
simplebayes-1.0.6.tar.gz
(4.0 kB
view details)
File details
Details for the file simplebayes-1.0.6.tar.gz.
File metadata
- Download URL: simplebayes-1.0.6.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef86a79d60f24cbb9ab9e105915febec2be4457061d1841c76e6b64bc94f6815
|
|
| MD5 |
b1db800cf85478a1070b8c9cec180108
|
|
| BLAKE2b-256 |
7fde7bb65ccb39b1d4350bcba38efc271ca02f18e96b6d0c4d60cc628fdf5e4f
|