Created
November 14, 2011 02:01
-
-
Save joshcutler/1363069 to your computer and use it in GitHub Desktop.
Use case of Classyfier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'classyfier' | |
@classyfier = Classyfier::NaiveBayes::NaiveBayesClassifier.new | |
@classyfier.train({:subject => 'Must read!', :text => 'Get Viagra cheap!'}, :spam) | |
@classyfier.train({:subject => 'Gotta see this', :text => 'Viagra. You can get it at cut rates'}, :spam) | |
@classyfier.train({:subject => 'Call me tomorrow', :text => 'We need to talk about scheduling. Call me.'}, :not_spam) | |
@classyfier.train({:subject => 'That was hilarious', :text => 'Just saw that link you sent me'}, :not_spam) | |
@classyfier.train({:subject => 'dinner at 7', :text => 'I got us a reservation tomorrow at 7'}, :not_spam) | |
@scores = @classyfier.classify({:subject => 'See it to believe it', :text => 'Best rates you\'ll see'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment