The bayesian spam classifier from SpamBayes
Project description
This package contains a stripped down version of the SpamBayes classifier, with the following changes:
The classifier and tokenizer code has been kept. All other code has been removed.
The tokenizer has been stripped down and simplified. In particular all code designed specifically for email parsing has been removed.
The ClassifierDb class has been reduced to a simple dict subclass. The custom pickling code has been removed, as have all database backends.
The remaining code has been updated and made compatible with Python 3.
An orthogonalsparse bigram (OSB) transformation has been added.
Unicode handling has been improved.
What’s it good for?
I use sbclassifier to protect websites against contact form spam.
With a training set of a handful each of spam and non-spam messages it is already useful. Once the training data set gets above about 20 messages of each type I am happy to let it filter out the most obvious spam.
Usage
The above script will print out:
0.902 [('*H*', 0.104), ('*S*', 0.908), ('can', 0.155), ('for', 0.845), ('service', 0.845), ('traffic', 0.845), ('and', 0.908)]
sbclassifier assigns 90% probability to this unknown message being spam. It can also produce a sequence of (word, probability) pairs that reveals the tokens that were important in this calculation.
More information
The spambayes source repository contains a wealth of information on how and why the classifier works as it works, as does the SpamBayes wiki.
Copyright
Copyright (C) 2002-2013 Python Software Foundation; All Rights Reserved
The Python Software Foundation (PSF) holds copyright on all material in this project. You may use it under the terms of the PSF license; see LICENSE.txt.
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
Built Distribution
Hashes for sbclassifier-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e23eff61b57e49c3df5afff432698d87e784223fdc970302488bc257f4236a5b |
|
MD5 | f6fb7f1abb9184e41c0c521d753c0e1c |
|
BLAKE2b-256 | ea00debdecd5991ccb48ddd0aae2607cda17c3776962b7c034716007269cc9b2 |