def findInfoWithMethod(self): 'Finds and collects all needed information' result = [] list_of_sentence = sent_tokenize(self.text) for sent in list_of_sentence: res = Matcher(sent.lower(), self.keyword) articleDate = "" r = 0 if self.method == 'optionBM': r = res.BMMatch() elif self.method == 'optionKMP': r = res.KMPMatch() elif self.method == 'optionRE': r = res.REMatch() if r > -1: result.append(sent) if articleDate == "" or articleDate == " ": resDate = Matcher(sent, self.keyword) # articleDate = resDate return result, articleDate