def __init__(self, keywords, operator='AND'): # Clean the p_keywords that the user has entered. words = normalizeText(keywords) if words == '*': words = '' for c in self.toRemove: words = words.replace(c, ' ') self.keywords = words.split() # Store the operator to apply to the keywords (AND or OR) self.operator = operator
def __init__(self, keywords, operator='AND', ignore=2): # Clean the p_keywords that the user has entered words = sutils.normalizeText(keywords) if words == '*': words = '' for c in self.toRemove: words = words.replace(c, ' ') self.keywords = splitIntoWords(words, ignore=ignore) # Store the operator to apply to the keywords (AND or OR) self.operator = operator
def process(self, texts): res = set() for text in texts: cleanText = normalizeText(text) res = res.union(splitIntoWords(cleanText)) return list(res)
def characters(self, content): c = normalizeText(content) if len(c) > 1: self.res.append(c)