Guest User

Untitled

a guest
May 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. require 'lib/basset'
  2. include Basset
  3.  
  4. coherent = Document.new("I have some logical opinions.")
  5. fe = FeatureExtractor.new(coherent.text.split)
  6.  
  7. nb = NaiveBayes.new
  8. nb.add_document("coherent", fe.extract(coherent))
  9. puts nb.classify(fe.extract(Document.new("I have some logical opinions.")))
  10.  
  11.  
  12.  
  13.  
  14. muppets = Document.new("marble muppet ball hat glove")
  15. fe2 = FeatureExtractor.new(coherent.text.split)
  16.  
  17. nb2 = NaiveBayes.new
  18. nb2.add_document("muppet", fe2.extract(muppets))
  19.  
  20. muppet = Document.new("marble muppet ball hat glove")
  21. puts nb2.classify(fe2.extract(muppet))
Add Comment
Please, Sign In to add comment