deftest_english(self): classifier = sentiment.Classifier('en') rtn = classifier.polarity('i love this cellphone') self.assertEqual(rtn['best_fit_cat'], 'positive') rtn = classifier.polarity('i am so sad today') self.assertEqual(rtn['best_fit_cat'], 'negative') rtn = classifier.polarity('i hate you fuck away') self.assertEqual(rtn['best_fit_cat'], 'negative')
rtn = classifier.emotion('i love this cellphone') self.assertEqual(rtn['best_fit_cat'], 'joy') rtn = classifier.emotion('i am so sad today') self.assertEqual(rtn['best_fit_cat'], 'sadness') rtn = classifier.emotion('i hate you fuck away') self.assertEqual(rtn['best_fit_cat'], 'anger')