Commit 9ad3a9ef by Vik Paruchuri

Change span tag to custom feedback tag

parent 6f6617ba
...@@ -210,12 +210,12 @@ class FeatureExtractor(object): ...@@ -210,12 +210,12 @@ class FeatureExtractor(object):
bad_pos_ends=[z[1]-1 for z in bad_pos_positions[m]] bad_pos_ends=[z[1]-1 for z in bad_pos_positions[m]]
for z in xrange(0,len(markup_tokens)): for z in xrange(0,len(markup_tokens)):
if z in bad_pos_starts: if z in bad_pos_starts:
markup_tokens[z]='<span class="badgrammar">' + markup_tokens[z] markup_tokens[z]='<feedback class="badgrammar">' + markup_tokens[z]
elif z in bad_pos_ends: elif z in bad_pos_ends:
markup_tokens[z]=markup_tokens[z] + "</span>" markup_tokens[z]=markup_tokens[z] + "</feedback>"
if(len(bad_pos_ends)>0 and len(bad_pos_starts)>0 and len(markup_tokens)>1): if(len(bad_pos_ends)>0 and len(bad_pos_starts)>0 and len(markup_tokens)>1):
if max(bad_pos_ends)>(len(markup_tokens)-1) and max(bad_pos_starts)<(len(markup_tokens)-1): if max(bad_pos_ends)>(len(markup_tokens)-1) and max(bad_pos_starts)<(len(markup_tokens)-1):
markup_tokens[len(markup_tokens)-1]+="</span>" markup_tokens[len(markup_tokens)-1]+="</feedback>"
if set_grammar_per_character[m]>(self._grammar_errors_per_character*modifier_ratio): if set_grammar_per_character[m]>(self._grammar_errors_per_character*modifier_ratio):
individual_feedback['grammar']="Potential grammar errors." individual_feedback['grammar']="Potential grammar errors."
......
...@@ -90,7 +90,7 @@ def spell_correct(string): ...@@ -90,7 +90,7 @@ def spell_correct(string):
sub_comp = re.compile(sub_pat) sub_comp = re.compile(sub_pat)
newstring = re.sub(sub_comp, correct_spelling[i], newstring) newstring = re.sub(sub_comp, correct_spelling[i], newstring)
if incorrect_words[i] not in already_subbed: if incorrect_words[i] not in already_subbed:
markup_string=re.sub(sub_comp,'<span class="badspelling">' + incorrect_words[i] + "</span>", markup_string) markup_string=re.sub(sub_comp,'<feedback class="badspelling">' + incorrect_words[i] + "</feedback>", markup_string)
already_subbed.append(incorrect_words[i]) already_subbed.append(incorrect_words[i])
return newstring,len(incorrect_words),markup_string return newstring,len(incorrect_words),markup_string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment