Django Bayesian inference based comment moderation app.
Project description
Django Moderator
Django Bayesian inference based comment moderation app.
django-moderator integrates Django’s comments framework with SpamBayes to automatically classify comments into three categories, ham, spam or unknown, based on previous training (see Paul Graham’s A Plan for Spam for some background).
Comments classified as unknown have to be manually classified as either spam or ham via admin, thereby training the system to automatically classify similarly worded comments in future.
Comments classified as spam will have their is_removed field set to True and as such it will no longer be visible in comment listings.
Comments classified as ham will remain unchanged and as such will be visible in comment listings.
django-moderator also implements a user friendly admin interface for efficiently moderating comments.
Installation
Install or add django-moderator to your Python path.
Add moderator to your INSTALLED_APPS setting.
Add a MODERATOR setting to your project’s settings.py file. This setting specifies what classifier storage backend to use (see below) and also classification thresholds:
MODERATOR = { 'CLASSIFIER': 'moderator.storage.DjangoClassifier', 'HAM_CUTOFF': 0.3, 'SPAM_CUTOFF': 0.7, }
Specifically a HAM_CUTOFF value of 0.3 as in this example specifies that any comment scoring less than 0.3 during Bayesian inference will be classified as ham. A SPAM_CUTOFF value of 0.7 as in this example specifies that any comment scoring more than 0.7 during Bayesian inference will be classified as spam. Anything between 0.3 and 0.7 will be classified as unsure, awaiting manual user classification. HAM_CUTOFF and SPAM_CUTOFF can be ommited in which case the default cuttofs are 0.3 and 0.7 respectively.
Classifier Storage Backends
django-moderator includes two SpamBayes storage backends, moderator.storage.DjangoClassifier and moderator.storage.RedisClassifier respectively.
To use moderator.storage.RedisClassifier as your classifier storage backend specify it in your MODERATOR setting, i.e.:
MODERATOR = { 'CLASSIFIER': 'moderator.storage.RedisClassifier', 'CLASSIFIER_CONFIG': { 'host': 'localhost', 'port': 6379, 'db': 0, 'password': None, }, 'HAM_CUTOFF': 0.3, 'SPAM_CUTOFF': 0.7, }
You can aslo create your own backends, in which case take note that the content of CLASSIFIER_CONFIG will be passed as keyword agruments to your backend’s __init__ method.
Usage
Once correctly configured you’ll use the classifycomments management command to automatically classify comments as either ham, spam or unsure based on previous training, i.e.:
$ ./manage.py classifycomments
Unsure comments can be manually classified as either ham or spam via the Classified comments page in admin.
Changelog
0.0.1 (2012-05-23)
Initial release
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 django_moderator-0.0.1-py2.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9f1e3a1e5d26f853da7681116b2c18771909c9546f017bfc3a521f10ad83b7b |
|
MD5 | 720fe15a24d860a1d58dd69bc85bc7ba |
|
BLAKE2b-256 | eafcc1506c858fa33c01ed60953d55f8606e7ebc6adfed6f3214c24d36c42b2f |