From c0ffb0dfab2dda0ae52f48f8b2c1e66ddf253a95 Mon Sep 17 00:00:00 2001 From: Cristina Cochior Date: Fri, 31 May 2019 10:02:01 +0200 Subject: [PATCH] new changes to textedit 2 --- textedit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/textedit.py b/textedit.py index ffb346f..6364962 100644 --- a/textedit.py +++ b/textedit.py @@ -51,11 +51,12 @@ def analysis(the_word, file_name): content = f.read() sent_tokens = sent_tokenize(content) new_sent_tokens = [] + # the_word = the_word.lower() re_word = r"\b" + re.escape(the_word) + r"\b" # print(re_word) # print(the_word) for sent_token in sent_tokens: - if re.search(re_word, sent_token, re.IGNORECASE): + if re.search(re_word, sent_token): new_sent_tokens.append({'id': id, 'sentence': sent_token.replace('\n', ' ').strip("'<>()“”")}) if the_word in sentences_w_word: # if this is not the first iteration previous_sent_tokens = sentences_w_word[the_word]