Commit 334a94c6 by Vik Paruchuri

alter markup to xml tags

parent f11695c7
......@@ -210,11 +210,11 @@ class FeatureExtractor(object):
bad_pos_ends=[z[1]-1 for z in bad_pos_positions[m]]
for z in xrange(0,len(markup_tokens)):
if z in bad_pos_starts:
markup_tokens[z]="[[" + markup_tokens[z]
markup_tokens[z]="<badgrammar>" + markup_tokens[z]
elif z in bad_pos_ends:
markup_tokens[z]=markup_tokens[z] + "]]"
markup_tokens[z]=markup_tokens[z] + "</badgrammar>"
if max(bad_pos_ends)>(len(markup_tokens)-1) and max(bad_pos_starts)<(len(markup_tokens)-1):
markup_tokens[len(markup_tokens)-1]+="]]"
markup_tokens[len(markup_tokens)-1]+="</badgrammar>"
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,"<badspelling>" + incorrect_words[i] + "</badspelling>", 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