def testCatCount(self): c = Classifier(getwords) c.incc("Bad") c.incc("Bad") c.incc("Good") self.assertEqual(c.catcount("Good"), 1) self.assertEqual(c.catcount("Bad"), 2)
def testTrain(self): c = Classifier(getwords) item = "Hello hello world, my name is Python." cat = "Good" c.train(item, cat) self.assertEqual(c.catcount("Good"), 1) self.assertEqual(c.fcount("hello", "Good"), 1) self.assertFalse(c.fc.has_key("my"))