def do_actions(self, noargs): if not Category.all(): print "no categories" return count = 0 for x in Category.all(): if x.action().exists(): count += 1 print x.name if not count: print 'no actions defined'
def _classify(self): self.current_category = self.current_probability = None if not Category.all(): print "Can't classify because I have no categories" return if not self.current_message: return cat, prob = Category.classify(str(self.current_message)) self.current_category = cat self.current_probability = prob return self.current_category
def _complete_categories(self, text, line, begidx, endidx): return [ x.name for x in Category.all() if x.name.startswith(text) ]
def do_categories(self, noargs): """just return the list of currently known categories""" for x in Category.all(): print x.name