Commit 62ea08b7 by Vik Paruchuri

markup bugfixes to display grammar errors and not display corrected spelling

parent a276d16c
......@@ -205,12 +205,12 @@ class FeatureExtractor(object):
all_feedback=[]
for m in xrange(0,len(e_set._text)):
individual_feedback={'grammar' : "Ok.", 'spelling' : "Ok.", 'topicality' : "Ok.", 'markup_text' : ""}
markup_tokens=nltk.word_tokenize(e_set._markup_text)
markup_tokens=nltk.word_tokenize(e_set._markup_text[m])
bad_pos_starts=[z[0] for z in bad_pos_positions[m]]
bad_pos_ends=[z[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)):
if z in bad_pos_starts:
markup_tokens[z]=="[[" + markup_tokens[z]
markup_tokens[z]="[[" + markup_tokens[z]
elif z in bad_pos_ends:
markup_tokens[z]=markup_tokens[z] + "]]"
......@@ -223,7 +223,8 @@ class FeatureExtractor(object):
f_row_prop=f_row_sum/len(e_set._text[m])
if f_row_prop<(self._mean_f_prop):
individual_feedback['topicality']="Essay may be off topic."
individual_feedback['markup_text']=" ".join(markup_tokens)
markup_string=" ".join(markup_tokens)
individual_feedback['markup_text']=markup_string
all_feedback.append(individual_feedback)
return all_feedback
In order to replicate this experiment, I would need to know additional information such as the four different samples that they used (because I could have choosen metal, carbboard and many other sample materials that they didn't use and would get different results. Also I would also need to know the amount of vinegar to pour because this can caute a major change. Lastly, they might want to tell where to sit the samples while they dry for 30 minutes because if they are sitting in room temp. or by a light source makes a difference too.
\ No newline at end of file
this is a aubsmission with some spelling errors thrown in and grammaris not so great eithwer i dont think its very good .
\ No newline at end of file
......@@ -88,7 +88,7 @@ def spell_correct(string):
sub_pat = r"\b" + incorrect_words[i] + r"\b"
sub_comp = re.compile(sub_pat)
newstring = re.sub(sub_comp, correct_spelling[i], newstring)
markup_string=re.sub(sub_comp,".." + correct_spelling[i] + "..", markup_string)
markup_string=re.sub(sub_comp," .." + incorrect_words[i] + ".. ", 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