from textblob.classifiers import NaiveBayesClassifier

trainingData = [
    ("The service was great!.", "pos"),
    ("Our waiter was awesome!", "pos"),
    ("They have great appetizers.", "pos"),
    ("Happy hour was busy and fun.", "pos"),
    ("Great place for a quick meal.", "pos"),
    ("Our foot took forever to arrive.", "neg"),
    ("The waiter was slow.", "neg"),
    ("The drinks were weak", "neg"),
    ("It was very crowded and noisy!", "neg"),
    ("My pasta was horrible.", "neg"),
    ("The cost was reasonable.", "pos"),
    ("The drinks were cold.", "pos"),
    ("The hostest was ditsy.", "neg")
]
testingData = [
    ("The wine list was complete.", "pos"),
    ("There was no place to park.", "neg"),
    ("I really liked the bread.", "pos"),
    ("I want to come back!", "pos"),
    ("The food was not that good.", "neg"),
    ("The beer was great!", "pos")
]

classifier = NaiveBayesClassifier(trainingData)
print("Accuracy: {0}".format(classifier.accuracy(testingData)))

# Classify some text
print("The food was awesome.", classifier.classify("The food was awesome."))       # "pos"
print("I didn't like my pasta.", classifier.classify("I didn't like my pasta."))   # "neg"

classifier.show_informative_features(10)
