Commit 883016d3 by Vik Paruchuri

Add way to pass back prompt overlap and punish essays that overlap too much.

parent 8a7ea7ec
......@@ -213,7 +213,7 @@ class FeatureExtractor(object):
#Iterate through essays and create a feedback dict for each
all_feedback=[]
for m in xrange(0,len(e_set._text)):
individual_feedback={'grammar' : "Ok.", 'spelling' : "Ok.", 'topicality' : "Ok.", 'markup_text' : ""}
individual_feedback={'grammar' : "Ok.", 'spelling' : "Ok.", 'topicality' : "Ok.", 'markup_text' : "", 'prompt_overlap' : "Ok."}
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
......@@ -243,6 +243,10 @@ class FeatureExtractor(object):
if f_row_prop<(self._mean_f_prop/1.5) or len(e_set._text[m])<20:
individual_feedback['topicality']="Essay may be off topic."
if(features[m,9]>.5):
individual_feedback['prompt_overlap']="Too much overlap with prompt."
log.debug(features[m,9])
#Create string representation of markup text
markup_string=" ".join(markup_tokens)
individual_feedback['markup_text']=markup_string
......
......@@ -31,7 +31,8 @@ feedback_template = u"""
<header>Feedback</header>
<div class="shortform">
<div class="result-output">
Number of potential problem areas identified: {problem_areas}
<p>Score: {score}</p>
<p>Number of potential problem areas identified: {problem_areas}</p>
</div>
</div>
<div class="longform">
......@@ -39,6 +40,9 @@ feedback_template = u"""
<div class="topicality">
Topicality: {topicality}
</div>
<div class="prompt_overlap">
Prompt Overlap : {prompt_overlap}
</div>
<div class="spelling">
Spelling: {spelling}
</div>
......@@ -115,6 +119,10 @@ def grade(grader_path,grader_config,submission,sandbox=None):
else:
results['correct']=False
if(len(feedback['prompt_overlap'])>4):
results['score']=0
results['correct']=False
results['success']=True
#Generate short form output--number of problem areas identified in feedback
......@@ -124,9 +132,16 @@ def grade(grader_path,grader_config,submission,sandbox=None):
problem_areas+=len(feedback[tag])>5
#Add feedback template to results
results['feedback']=feedback_template.format(topicality=feedback['topicality'],
spelling=feedback['spelling'],grammar=feedback['grammar'],
markup_text=feedback['markup_text'],problem_areas=problem_areas)
results['feedback']=feedback_template.format(
topicality=feedback['topicality'],
spelling=feedback['spelling'],
grammar=feedback['grammar'],
markup_text=feedback['markup_text'],
problem_areas=problem_areas,
score=results['score'],
prompt_overlap=feedback['prompt_overlap'],
)
else:
#If error, add errors to template.
results['feedback']=error_template.format(errors=' '.join(results['errors']))
......
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