Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (15 sloc) 427 Bytes
require 'nbayes'
require 'yaml'
class SubmissionGrader
def initialize
@@nbayes = YAML.load_file("results.yml")
@@nbayes.reset_after_import()
end
def grade_awesomeness(submission)
tokens = submission.split(/\s+/)
result = @@nbayes.classify(tokens)
p "#{result.max_class} #{result['awesome']}, #{result['ok']}"
end
end
g = SubmissionGrader.new
g.grade_awesomeness("I like flamethrowers")