Commit b933419d by Vik Paruchuri

grammar feedback and modified tests

parent c04dc463
......@@ -158,7 +158,7 @@ class FeatureExtractor(object):
return prompt_arr.copy()
def gen_feedback(self, e_set):
def gen_feedback(self, e_set, features=None):
set_grammar=self._get_grammar_errors(e_set._pos,e_set._text,e_set._tokens)
set_grammar_per_character=[set_grammar[m]/len(e_set._text[m]) for m in xrange(0,len(e_set._text))]
set_spell_errors_per_character=[e_set._spelling_errors[m]/len(e_set._text[m]) for m in xrange(0,len(e_set._text))]
......@@ -170,6 +170,11 @@ class FeatureExtractor(object):
individual_feedback.append("Potential grammatical errors.")
if set_spell_errors_per_character[m]>self._spell_errors_per_character:
individual_feedback.append("Potential spelling errors.")
if features is not None:
f_row_sum=numpy.sum(features[m,12:])
f_row_prop=f_row_sum/len(e_set._text[m])
if f_row_prop<.05:
individual_feedback.append("Essay may be off topic.")
all_feedback.append(individual_feedback)
return all_feedback
......@@ -19,7 +19,7 @@ from essay_set import EssaySet
import feature_extractor
import sklearn.ensemble
def grade(grader_path,submission,sandbox):
def grade(grader_path,submission,sandbox=None):
results = {'errors': [],'tests': [],'correct': False,'score': 0, 'feedback' : []}
#Try to find and load the model file
......
......@@ -38,7 +38,8 @@ def send(payload, answer):
print "Request error:{0},{1},{2}".format(r.headers,payload,answer)
parsed_text=json.loads(r.text)
print "Score:{0} {1}".format(parsed_text['score'],parsed_text['correct'])
print(parsed_text)
#print "Score:{0} {1}".format(parsed_text['score'],parsed_text['correct'])
return r.text
......
in order to replicate this experiment , additional information is needed . first , the amount of vinegar would be needed . also , the type of wood used would be needed because different woods have different densities . finally , the temperatures of the room , where the solutions sat , needs to be known .
\ No newline at end of file
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
dfdsfgfgsdfdfdfdffg !
\ No newline at end of file
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 minutes because if they are sitting in room temp . or by a light source makes a difference too .
\ No newline at end of file
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