Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ease
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ease
Commits
5e05459f
Commit
5e05459f
authored
Nov 07, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix classes in template, add number of problem areas in shortform feedback.
parent
9a39aeb3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
grade.py
+36
-15
No files found.
grade.py
View file @
5e05459f
...
...
@@ -23,34 +23,49 @@ import sklearn.ensemble
log
=
logging
.
getLogger
(
__name__
)
feedback_template
=
u"""
<div class="feedback">
<header>Feedback</header>
<section>
<section>
<div class="shortform">
<div class="result-output">
There are {problem_areas} potential problem areas in your submission.
</div>
</div>
<div class="longform">
<div class="result-output">
<div class="topicality">
{topicality}
Topicality:
{topicality}
</div>
<div class="spelling">
{spelling}
Spelling:
{spelling}
</div>
<div class="grammar">
{grammar}
Grammar:
{grammar}
</div>
<div class="markup_
text">
<div class="markup-
text">
{markup_text}
</div>
</section>
</div>
</div>
</div>
</section>
"""
error_template
=
u"""
<div class="feedback">
<header>Feedback</header>
<section>
<div class="error">
<section>
<div class="shortform">
<div class="result-errors">
There was an error with your submission. Please contact course staff.
</div>
</div>
<div class="longform">
<div class="result-errors">
{errors}
</div>
</section>
</div>
</div>
</section>
"""
...
...
@@ -86,6 +101,11 @@ def grade(grader_path,submission,sandbox=None):
results
[
'errors'
]
.
append
(
"Could not extract features and score essay."
)
has_error
=
True
#Generate short form output--number of problem areas identified in feedback
problem_areas
=
0
for
tag
in
feedback
:
problem_areas
+=
len
(
feedback
[
tag
])
>
5
#Determine maximum score and correctness of response
max_score
=
numpy
.
max
(
grader_data
[
'model'
]
.
classes_
)
if
results
[
'score'
]
/
float
(
max_score
)
>=
.
66
:
...
...
@@ -96,7 +116,8 @@ def grade(grader_path,submission,sandbox=None):
#Add feedback template to results
if
not
has_error
:
results
[
'feedback'
]
=
feedback_template
.
format
(
topicality
=
feedback
[
'topicality'
],
spelling
=
feedback
[
'spelling'
],
grammar
=
feedback
[
'grammar'
],
markup_text
=
feedback
[
'markup_text'
])
spelling
=
feedback
[
'spelling'
],
grammar
=
feedback
[
'grammar'
],
markup_text
=
feedback
[
'markup_text'
],
problem_areas
=
problem_areas
)
else
:
results
[
'feedback'
]
=
error_template
.
format
(
errors
=
' '
.
join
(
results
[
'errors'
]))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment