• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    Python
  • Created almost 13 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Naïve Bayesian Text Classifier on Redis

redisbayes Build Status

What Is This?

It's a Naïve Bayesian Text Classifier on Redis (aka 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 God love sex lobster sloth')
rb.train('bad', 'fear death horror government zombie')

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

print rb.score('i fear God and hate the government')

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

More Repositories

1

cosmopolitan

build-once run-anywhere c library
C
18,192
star
2

blink

tiniest x86-64-linux emulator
C
6,951
star
3

sectorlisp

Bootstrapping LISP in a Boot Sector
C
1,255
star
4

hiptext

Turn images into text better than caca/aalib
C++
761
star
5

gosip

Public Switched Telecommunications Network Unleashed
Go
429
star
6

bestline

ANSI Standard X3.64 Teletypewriter Command Session Library
C
349
star
7

fabulous

Print images, colors, and stylish text to the terminal with Python
Python
340
star
8

disaster

Disassemble C/C++ code under cursor in Emacs
Emacs Lisp
287
star
9

landlock-make

Sandboxing for GNU Make has never been easier
C++
178
star
10

occupywallst

Stomping out capitalism, one line of code at a time
JavaScript
94
star
11

pledge

OpenBSD APIs ported to Linux userspace using SECCOMP BPF and Landlock LSM
C
93
star
12

jtckdint

C23 Checked Arithmetic
C++
61
star
13

json.cpp

JSON for Classic C++
C++
31
star
14

asterisk-voicechanger

Asterisk module for adjusting pitch of voices
C
31
star
15

spandsp

C
28
star
16

tokenbucket

Atomic SWAR Token Buckets
C
27
star
17

poemy2

poemy (a poetry generator) rewritten in C++
C++
24
star
18

django-bone

Generates Django Project Skeletons Simply and Properly
JavaScript
23
star
19

swatpd

Stolen WiFi Aggregate Tunneling Protocol Dæmon (RAID your internet connections!)
C
18
star
20

zsh

Zsh patched to support Actually Portable Executables git://git.code.sf.net/p/zsh/code (upstream pending)
C
15
star
21

sofia-sip

Forked for features and packaging
C
14
star
22

blink-isystem

C++
11
star
23

includeme

Automatic C/C++ '#include' and 'using' in Emacs (WORK IN PROGRESS)
Emacs Lisp
10
star
24

justinemacs

My emacs25 text editor configuration
Emacs Lisp
9
star
25

timespan

Check if timestamp falls within specific boundaries
Python
7
star
26

js2-closure

Automatic goog.require for Closure
Emacs Lisp
5
star
27

sparkles

A decision making tool (defunct, incomplete)
JavaScript
5
star
28

web_library_example

Bootstrap Web Apps for ML Visualization
HTML
5
star
29

emacs-copilot

Large language model code completion for Emacs
Emacs Lisp
5
star
30

asterisk-parrot

Annoying robot that repeats what you say on the phone
C
4
star
31

jart.github.io

4
star
32

poemy

Poetry Generator (DEPRECATED: See poemy2)
JavaScript
4
star
33

tensorflow-makefile

C++
3
star
34

chessy

A happy toy chess engine, just for fun :) If you want a proper chess engine, check out Stockfish.
C++
3
star
35

libc-test

C
3
star
36

long-s.org

Vintage Engliſh Tranſlator
CoffeeScript
2
star
37

freeswitch

Open Source Telecommunications Platform (Unofficial Fork)
C
2
star
38

verobject

Version controlled object database on Redis
Python
1
star