Skip to main content

Naïve Bayesian Text Classifier on Redis

Project description

name:

redisbayes

description:

Naïve Bayesian Text Classifier on Redis

license:

MIT

What Is This?

It’s a spam filter. I wrote this to filter spammy comments from a high traffic forum website and it worked pretty well. It can work for you too :) It’s not tied to any particular format like email, it just deals with the raw text.

This is probably the only spam filtering library you’ll find for Python that’s simple (170 lines of code), works (30 lines of test code), and doesn’t suck.

Installation

From folder:

sudo python setup.py install

From cheeseshop:

sudo pip install redisbayes

From git:

sudo pip install git+git://github.com/jart/redisbayes.git

Basic Usage

import redis, redisbayes
rb = redisbayes.RedisBayes(redis=redis.Redis())

rb.train('good', 'sunshine drugs love sex lobster sloth')
rb.train('bad', 'fear death horror government zombie god')

assert rb.classify('sloths are so cute i love them') == 'good'
assert rb.classify('i fear god and love the government') == 'bad'

print rb.score('i fear god and love the government')

rb.untrain('good', 'sunshine drugs love sex lobster sloth')
rb.untrain('bad', 'fear death horror government zombie god')

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

redisbayes-0.1.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file redisbayes-0.1.tar.gz.

File metadata

  • Download URL: redisbayes-0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for redisbayes-0.1.tar.gz
Algorithm Hash digest
SHA256 5e9934ab3d89b336d1cf113c4776c89d340198a54aeea0aa7bc84874f1d19a89
MD5 9468987a332a77eb7c167e26a69d92e6
BLAKE2b-256 abe13079d97dc957b0c348cd28c3ae097c3f25f29a03b2449a08ce5bc9514e7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page