def __init__(self, sentence, level=None): global sensitiveWord global df self.sentence = sentence # self.sentenceCut = list(jieba.cut(self.sentence)) # if not self.sensitiveWord: if not sensitiveWord: print "+" * 10 sensitiveWordHelper = ClassHelper("SensitiveWord") items = sensitiveWordHelper.find({}) for item in items: sensitiveWord[item['word']] = item # self.sensitiveWord[item['word']] = item # if not df: # if not self.df: # print "-" * 10 # self.df = cDfa(self.sensitiveWord.keys()) df = cDfa(sensitiveWord.keys())
def relation(self, o1, o2): relateHelper = ClassHelper(self.className) return relateHelper.find({o1.className+'._id': o1.objectId, o2.className+'._id': o2.objectId})