Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created November 22, 2013 01:19
Show Gist options
  • Save tmcw/7593095 to your computer and use it in GitHub Desktop.
Save tmcw/7593095 to your computer and use it in GitHub Desktop.
Gist from mistakes.io
void require('http://bit.ly/ss-js');
bayes = ss.bayesian();
for(var i = 0; i < 10; i++) {
bayes.train({'text': 'porn'}, 'spam');
}
bayes.train({'text': 'flowers'}, 'notspam');
bayes.train({'text': 'drugs'}, 'spam');
bayes.score({'text': 'flowers'});
bayes.score({'text': 'porn'});
bayes.score({'text': 'drugs'});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment