Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jnrowe/reverend
Reverend - Simple Bayesian classifier
https://github.com/jnrowe/reverend
Last synced: 5 days ago
JSON representation
Reverend - Simple Bayesian classifier
- Host: GitHub
- URL: https://github.com/jnrowe/reverend
- Owner: JNRowe
- License: lgpl-2.1
- Created: 2010-05-06T17:58:58.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2010-05-06T18:10:51.000Z (almost 15 years ago)
- Last Synced: 2023-04-14T17:08:48.262Z (almost 2 years ago)
- Language: Python
- Homepage: http://divmod.org/trac/wiki/DivmodReverend
- Size: 113 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
- Changelog: changelog.txt
- License: COPYING
Awesome Lists containing this project
README
Reverend is a simple Bayesian classifier.
It is designed to be easy to adapt and extend for
your application.A simple example would look like:
from reverend.thomas import Bayes
guesser = Bayes()
guesser.train('fish', 'salmon trout cod carp')
guesser.train('fowl', 'hen chicken duck goose')guesser.guess('chicken tikka marsala')
You can also "forget" some training:
guesser.untrain('fish','salmon carp')The first argument of train is the bucket or class that
you want associated with the training. If the bucket does
not exists, Bayes will create it. The second argument
is the object that you want Bayes to be trained on. By
default, Bayes expects a string and uses something like
string.split to break it into indidual tokens (words).
It uses these tokens as the basis of its bookkeeping.The two ways to extend it are:
1. Pass in a function as the tokenizer when creating
your Bayes. The function should expect one argument
which will be whatever you pass to the train() method.
The function should return a list of strings, which
are the tokens that are relevant to your app.2. Subclass Bayes and override the method getTokens to
return a list of string tokens relevant to your app.I hope all you guesses are right,
[email protected]