Ejemplo n.º 1
0
    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'
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
 def _complete_categories(self, text, line, begidx, endidx):
     return [ x.name for x in Category.all()
              if x.name.startswith(text) ]
Ejemplo n.º 4
0
 def do_categories(self, noargs):
     """just return the list of currently known categories"""
     for x in Category.all():
         print x.name