Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'lib/basset'
- include Basset
- coherent = Document.new("I have some logical opinions.")
- fe = FeatureExtractor.new(coherent.text.split)
- nb = NaiveBayes.new
- nb.add_document("coherent", fe.extract(coherent))
- puts nb.classify(fe.extract(Document.new("I have some logical opinions.")))
- muppets = Document.new("marble muppet ball hat glove")
- fe2 = FeatureExtractor.new(coherent.text.split)
- nb2 = NaiveBayes.new
- nb2.add_document("muppet", fe2.extract(muppets))
- muppet = Document.new("marble muppet ball hat glove")
- puts nb2.classify(fe2.extract(muppet))
Add Comment
Please, Sign In to add comment