Commit e291f7ee by Vik Paruchuri

fix bug with spell check fallback option and add modifier ratio for grammar/spelling

parent c6c7477b
......@@ -180,15 +180,16 @@ class FeatureExtractor(object):
in order to get off topic feedback.
Returns a list of lists (one list per essay in e_set)
"""
modifier_ratio=1.1
set_grammar=self._get_grammar_errors(e_set._pos,e_set._text,e_set._tokens)
set_grammar_per_character=[set_grammar[m]/float(len(e_set._text[m])) for m in xrange(0,len(e_set._text))]
set_spell_errors_per_character=[e_set._spelling_errors[m]/float(len(e_set._text[m])) for m in xrange(0,len(e_set._text))]
all_feedback=[]
for m in xrange(0,len(e_set._text)):
individual_feedback=[]
if set_grammar_per_character[m]>(self._grammar_errors_per_character):
if set_grammar_per_character[m]>(self._grammar_errors_per_character*modifier_ratio):
individual_feedback.append("Potential grammar errors.")
if set_spell_errors_per_character[m]>(self._spell_errors_per_character):
if set_spell_errors_per_character[m]>(self._spell_errors_per_character*modifier_ratio):
individual_feedback.append("Potential spelling errors.")
if features is not None:
f_row_sum=numpy.sum(features[m,12:])
......
in order to replicate this experiment , we would need to know the temperature of the vinegar as well as how much vinegar to put in . both of these could vary and therefore change the result of the experiment .
\ No newline at end of file
you would need many more pieces of information to replicate the experiment . you would need the type of samples to begin with in the procedure . you would also need to know the amount of vinegar used in each container . you would also need to know exactly how to mass the samples and what types of container to use plastic for example , might alter the results .
\ No newline at end of file
......@@ -62,7 +62,7 @@ def spell_correct(string):
try:
p = os.popen(aspell_path + " -a < " + f_path + " --sug-mode=ultra")
except:
return string
return string,0
incorrect = p.readlines()
p.close()
incorrect_words = list()
......
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