Skip to content

Commit

Permalink
closed #112
Browse files Browse the repository at this point in the history
  • Loading branch information
Samyu Comandur committed Apr 9, 2020
1 parent 47ff00c commit 235f321
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions Main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<span style="background-color:' + colors[0] + '">' + tag[0] + '</span>'
txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl)
elif tag[1].startswith('V'):
s = '<span style="background-color:' + colors[1] + '">' + tag[0] + '</span>'
txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl)
elif tag[1].startswith('J'):
s = '<span style="color:white;background-color:' + colors[2] + '">' + tag[0] + '</span>'
txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl)
elif tag[1].startswith('R'):
s = '<span style="color:white;background-color:' + colors[3] + '">' + tag[0] + '</span>'
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 = '<span style="background-color:' + colors[0] + '">' + tag[0] + '</span>'
txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl)
elif tag[1].startswith('V'):
s = '<span style="background-color:' + colors[1] + '">' + tag[0] + '</span>'
txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl)
elif tag[1].startswith('J'):
s = '<span style="color:white;background-color:' + colors[2] + '">' + tag[0] + '</span>'
txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl)
elif tag[1].startswith('R'):
s = '<span style="color:white;background-color:' + colors[3] + '">' + tag[0] + '</span>'
txt_hl = re.sub(r'\b'+tag[0]+r'\b', s, txt_hl)
file_string += tag[0] + "_" + tag[1] + "\n"

if d != {}:
data = []
Expand Down

0 comments on commit 235f321

Please sign in to comment.