def docToclassvector(self, document, alltopicsandkeys): result = alltopicsandkeys #self.traversePages("setTopicandTerms",'topicmodel') classifier = Classifier() classifier.init(result.topics, result.terms).MinKey(2) classifier.build(document) classifier.setweights() return classifier
def getTopics(self): result = self.traversePages("setTopicandTerms", 'topicmodel') classifier = Classifier() classifier.init(result.topics, result.terms).MinKey(2) classifier = self.traversePages("retrainClassifier", 'article', classifier).classifier classifier.setweights() os.remove("classvectors.json") classifier.tojson("classvectors") return "test2"