Commit f11695c7 by Vik Paruchuri

appropriately close grammar markup tags

parent fe57f9a3
......@@ -213,6 +213,8 @@ class FeatureExtractor(object):
markup_tokens[z]="[[" + markup_tokens[z]
elif z in bad_pos_ends:
markup_tokens[z]=markup_tokens[z] + "]]"
if max(bad_pos_ends)>(len(markup_tokens)-1) and max(bad_pos_starts)<(len(markup_tokens)-1):
markup_tokens[len(markup_tokens)-1]+="]]"
if set_grammar_per_character[m]>(self._grammar_errors_per_character*modifier_ratio):
individual_feedback['grammar']="Potential grammar errors."
......
......@@ -90,7 +90,7 @@ def spell_correct(string):
sub_comp = re.compile(sub_pat)
newstring = re.sub(sub_comp, correct_spelling[i], newstring)
if incorrect_words[i] not in already_subbed:
markup_string=re.sub(sub_comp," {{" + incorrect_words[i] + "}} ", markup_string)
markup_string=re.sub(sub_comp,"{{" + incorrect_words[i] + "}}", markup_string)
already_subbed.append(incorrect_words[i])
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