def to_classification_object(cls, json): c = ClassificationObject() c.source = 'twitter' c.text = json['text'] c.created_at = json['created_at'] return c
def classify_text(self, text): if not hasattr(self, 'classifiers'): self.train() # Extract keywords like we do when learning c = ClassificationObject() c.text = text c.process() return self.classify(c)
def save_classification_object(line, tags): c = ClassificationObject() c.text = line c.process() c.tags = tags c.save()