Commit e77640db by Vik Paruchuri

Minor feedback updates (only display spelling/grammar for low scoring responses)

parent 9cd70797
...@@ -224,7 +224,9 @@ class FeatureExtractor(object): ...@@ -224,7 +224,9 @@ class FeatureExtractor(object):
'topicality' : "Topicality: Ok.", 'markup_text' : "", 'topicality' : "Topicality: Ok.", 'markup_text' : "",
'prompt_overlap' : "Prompt Overlap: Ok.", 'prompt_overlap' : "Prompt Overlap: Ok.",
'grammar_per_char' : set_grammar_per_character[m], 'grammar_per_char' : set_grammar_per_character[m],
'spelling_per_char' : set_spell_errors_per_character[m]} 'spelling_per_char' : set_spell_errors_per_character[m],
'too_similar_to_prompt' : False,
}
markup_tokens=e_set._markup_text[m].split(" ") markup_tokens=e_set._markup_text[m].split(" ")
#This loop ensures that sequences of bad grammar get put together into one sequence instead of staying #This loop ensures that sequences of bad grammar get put together into one sequence instead of staying
...@@ -256,6 +258,7 @@ class FeatureExtractor(object): ...@@ -256,6 +258,7 @@ class FeatureExtractor(object):
if(features[m,9]>.6): if(features[m,9]>.6):
individual_feedback['prompt_overlap']="Prompt Overlap: Too much overlap with prompt." individual_feedback['prompt_overlap']="Prompt Overlap: Too much overlap with prompt."
individual_feedback['too_similar_to_prompt']=True
log.debug(features[m,9]) log.debug(features[m,9])
#Create string representation of markup text #Create string representation of markup text
......
...@@ -55,6 +55,7 @@ def grade(grader_data,grader_config,submission): ...@@ -55,6 +55,7 @@ def grade(grader_data,grader_config,submission):
#Try to determine confidence level #Try to determine confidence level
try: try:
min_score=min(numpy.asarray(grader_data['score'])) min_score=min(numpy.asarray(grader_data['score']))
max_score=max(numpy.asarray(grader_data['score']))
raw_confidence=grader_data['model'].predict_proba(grader_feats)[0,(results['score']-min_score)] raw_confidence=grader_data['model'].predict_proba(grader_feats)[0,(results['score']-min_score)]
#TODO: Normalize confidence somehow here #TODO: Normalize confidence somehow here
results['confidence']=raw_confidence results['confidence']=raw_confidence
...@@ -64,7 +65,7 @@ def grade(grader_data,grader_config,submission): ...@@ -64,7 +65,7 @@ def grade(grader_data,grader_config,submission):
if not has_error: if not has_error:
if(len(feedback['prompt_overlap'])>20): if(feedback['too_similar_to_prompt']):
results['score']=0 results['score']=0
results['correct']=False results['correct']=False
...@@ -80,10 +81,14 @@ def grade(grader_data,grader_config,submission): ...@@ -80,10 +81,14 @@ def grade(grader_data,grader_config,submission):
results['feedback']={ results['feedback']={
'topicality' : feedback['topicality'], 'topicality' : feedback['topicality'],
'prompt-overlap' : feedback['prompt_overlap'], 'prompt-overlap' : feedback['prompt_overlap'],
'spelling' : feedback['spelling'], }
if results['score']/float(max_score)<.5:
results['feedback'].update(
{'spelling' : feedback['spelling'],
'grammar' : feedback['grammar'], 'grammar' : feedback['grammar'],
'markup-text' : feedback['markup_text'], 'markup-text' : feedback['markup_text'],
} })
else: else:
#If error, success is False. #If error, success is False.
......
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