def __init__(self, category=CATEGORY, indicator='default', verbose=True): self.category = category self.indicator = indicator self.verbose = verbose self.blob = Learnblob(self.category, indicator=self.indicator, load=True, save=False) self.blob.loadClassifier(self.category, self.indicator) print self.blob
class Applier(object): def __init__(self, category=CATEGORY, indicator='default', verbose=True): self.category = category self.indicator = indicator self.verbose = verbose self.blob = Learnblob(self.category, indicator=self.indicator, load=True, save=False) self.blob.loadClassifier(self.category, self.indicator) print self.blob def applyClassifier(self, text): prob_dist = self.blob.classifier.prob_classify(text) result = {"prob": prob_dist.prob("pos")} return result