Skip to content

Instantly share code, notes, and snippets.

@daspecster
Created May 17, 2012 01:19
Show Gist options
  • Save daspecster/2715449 to your computer and use it in GitHub Desktop.
Save daspecster/2715449 to your computer and use it in GitHub Desktop.
Start of bayes_on_redis implementation
import bayes
import sqlite3
bor = bayes.BayesOnRedis(redis_host='localhost', redis_port=6379, redis_db=0)
conn = sqlite3.connect("connotation.db")
c = conn.cursor()
for row in c.execute('''SELECT * FROM source_data'''):
#print "Training..." + row[2]
#bor.train(row[2], row[1])
print "Training...negative"
bor.train("sad", "sucks")
print bor.classify("sucks")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment