Python interface to libcrm114
Project description
pycrm114
Python bindings for libcrm114
Minimal quickstart
No persistence
import pycrm114
crm = pycrm114.CRM114(classes=["spam", "ham"])
crm.learn("spam", "foo bar")
crm.learn("ham", "bar is good")
assert crm.classify("is bar good")["class"] == "ham"
assert crm.classify("foo bar good")["class"] == "spam"
File System Persistence
import pycrm114
crm = pycrm114.CRM114(classes=["spam", "ham"], storage=pycrm.storage.FileSystemStorage("/var/tmp/crm-test"))
crm.learn("spam", "foo bar")
crm.learn("ham", "bar is good")
crm.save()
new_crm = pycrm114.CRM114(classes=["spam", "ham"], storage=pycrm.storage.FileSystemStorage("/var/tmp/crm-test"))
assert new_crm.classify("is bar good")["class"] == "ham"
assert new_crm.classify("foo bar good")["class"] == "spam"
Dependencies
Debian/Ubuntu: sudo apt-get install libtre5 libtre-dev
OS X: brew install tre
Tests
Dependencies
pip install -r requirements/test.txt
To test against different python versions use tox:
tox
To run the tests with the active python:
python setup.py build && nosetests tests
Building
python setup.py build
References
Changelog
0.2.0 2015-04-18
Python 3 compatibility
Added a Pythonic wrapper with a potentially pluggable storage backend
Support for dumping control block/data block to string instead of file
Added basic tests
0.1.0 2015-04-10
Initial import from pmundkur/libcrm114
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycrm114-0.2.1.tar.gz
(242.6 kB
view hashes)
Built Distribution
Close
Hashes for pycrm114-0.2.1-py2.7-macosx-10.10-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6bee9644acdefe0619caffe47c8adeef79b62b71b85bd8ca8c1a6b89bafb637 |
|
MD5 | c991a7bb5f4976e4e1931b1278eba919 |
|
BLAKE2b-256 | 694889b1ca9888f5f6f9ff39341a4bbbdd2fcd14d7438a61d2bc7bc49fa7e2e0 |