Skip to content

Instantly share code, notes, and snippets.

@terrillo
Created April 28, 2017 21:32
Show Gist options
  • Save terrillo/f7ea6a016e517ab773965ccea7214d07 to your computer and use it in GitHub Desktop.
Save terrillo/f7ea6a016e517ab773965ccea7214d07 to your computer and use it in GitHub Desktop.
classifier example
from textblob.classifiers import NaiveBayesClassifier
from textblob import TextBlob
train = [
('what did I miss', 'show-notifications'),
('what happen while I was gone', 'show-notifications'),
('any new events', 'show-notifications'),
('clear all', 'clear-notifications'),
('delete all','clear-notifications')
]
cl = NaiveBayesClassifier(train)
print cl.classify('delete everything')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment