From 235f32127428cb49cb39717c756e55ff238ef14d Mon Sep 17 00:00:00 2001 From: Samyu Comandur Date: Wed, 8 Apr 2020 20:17:24 -0400 Subject: [PATCH] closed #112 --- Main/views.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Main/views.py b/Main/views.py index 388d982f..a8fa83d3 100644 --- a/Main/views.py +++ b/Main/views.py @@ -268,19 +268,20 @@ def pos(txt, present_txt, sw): tagged = nltk.pos_tag(wordsList) for tag in tagged: d[tag[1]] += 1 - if tag[1].startswith('N'): - s = '' + tag[0] + '' - txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl) - elif tag[1].startswith('V'): - s = '' + tag[0] + '' - txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl) - elif tag[1].startswith('J'): - s = '' + tag[0] + '' - txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl) - elif tag[1].startswith('R'): - s = '' + tag[0] + '' - txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl) - file_string += tag[0] + "_" + tag[1] + "\n" + if tag[0].lower() not in stop_words: + if tag[1].startswith('N'): + s = '' + tag[0] + '' + txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl) + elif tag[1].startswith('V'): + s = '' + tag[0] + '' + txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl) + elif tag[1].startswith('J'): + s = '' + tag[0] + '' + txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl) + elif tag[1].startswith('R'): + s = '' + tag[0] + '' + txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl) + file_string += tag[0] + "_" + tag[1] + "\n" if d != {}: data = []