Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bayesian spam filtering library for Python

I am looking for a Python library which does Bayesian Spam Filtering. I looked at SpamBayes and OpenBayes, but both seem to be unmaintained (I might be wrong).

Can anyone suggest a good Python (or Clojure, Common Lisp, even Ruby) library which implements Bayesian Spam Filtering?

Thanks in advance.

Clarification: I am actually looking for a Bayesian Spam Classifier and not necessarily a spam filter. I just want to train it using some data and later tell me whether some given data is spam. Sorry for any confusion.

like image 908
Baishampayan Ghose Avatar asked Feb 17 '09 18:02

Baishampayan Ghose


3 Answers

Do you want spam filtering or Bayesian classification?

For Bayesian classification there are a number of Python modules. I was just recently reviewing Orange which looks very impressive. R has a number of Bayesian modules. You can use Rpy to hook into R.

like image 176
Daniel Avatar answered Sep 27 '22 20:09

Daniel


Try Reverend. It's a spam filtering module.

like image 33
Seun Osewa Avatar answered Sep 27 '22 18:09

Seun Osewa


RedisBayes looks good to me:

http://pypi.python.org/pypi/redisbayes/0.1.3

In my experience Redis is an awesome addition to your stack and can help process data at blazing fast speeds compared to MySQL, PostgreSQL or any other RDBMS.

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')

Hope that helps a bit.

like image 29
gnrfan Avatar answered Sep 27 '22 19:09

gnrfan