Skip to content

Instantly share code, notes, and snippets.

@rakasaka
Created August 24, 2011 21:44
Show Gist options
  • Save rakasaka/1169338 to your computer and use it in GitHub Desktop.
Save rakasaka/1169338 to your computer and use it in GitHub Desktop.
Classification using Latent Semantic Indexing
require 'classifier'
require 'stemmer'
classifier_lsi = Classifier::LSI.new
classifier_lsi.add_item "a lion is a wild feline animal", :cat
classifier_lsi.add_item "a dog is a friendly animal", :dog
classifier_lsi.classify "a cat is a feline animal"
# Results
# => :cat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment