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
515420a9
Commit
515420a9
authored
Jun 13, 2014
by
gradyward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored the feature_extractor file to include just what we want it to, in a logical manner.
parent
4b8ef34b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
24 deletions
+3
-24
ease/essay_set.py
+2
-2
ease/feature_extractor.py
+0
-0
ease/grade.py
+1
-22
No files found.
ease/essay_set.py
View file @
515420a9
...
@@ -52,7 +52,7 @@ class EssaySet(object):
...
@@ -52,7 +52,7 @@ class EssaySet(object):
self
.
_cleaned_spelled_essays
=
[]
self
.
_cleaned_spelled_essays
=
[]
self
.
_tokens
=
[]
self
.
_tokens
=
[]
self
.
_pos_tags
=
[]
self
.
_pos_tags
=
[]
self
.
_cleaned_stem_essays
=
[]
self
.
_cleaned_stem
med
_essays
=
[]
self
.
_generated
=
[]
self
.
_generated
=
[]
self
.
_prompt
=
""
self
.
_prompt
=
""
self
.
_spelling_errors
=
[]
self
.
_spelling_errors
=
[]
...
@@ -147,7 +147,7 @@ class EssaySet(object):
...
@@ -147,7 +147,7 @@ class EssaySet(object):
# from words in English.
# from words in English.
porter
=
nltk
.
PorterStemmer
()
porter
=
nltk
.
PorterStemmer
()
porter_tokens
=
" "
.
join
([
porter
.
stem
(
token
)
for
token
in
tokens
])
porter_tokens
=
" "
.
join
([
porter
.
stem
(
token
)
for
token
in
tokens
])
self
.
_cleaned_stem_essays
.
append
(
porter_tokens
)
self
.
_cleaned_stem
med
_essays
.
append
(
porter_tokens
)
return
"Essay Added. Text: "
+
cleaned_essay
+
" Score: "
+
str
(
essay_score
)
return
"Essay Added. Text: "
+
cleaned_essay
+
" Score: "
+
str
(
essay_score
)
...
...
ease/feature_extractor.py
View file @
515420a9
This diff is collapsed.
Click to expand it.
ease/grade.py
View file @
515420a9
...
@@ -66,36 +66,15 @@ def grade(grader_data, submission):
...
@@ -66,36 +66,15 @@ def grade(grader_data, submission):
grader_features
=
None
grader_features
=
None
try
:
try
:
grader_features
=
extractor
.
generate_features
(
grader_set
)
grader_features
=
extractor
.
generate_features
(
grader_set
)
feedback
=
extractor
.
generate_feedback
(
grader_set
,
grader_features
)[
0
]
results
[
'score'
]
=
int
(
model
.
predict
(
grader_features
)[
0
])
results
[
'score'
]
=
int
(
model
.
predict
(
grader_features
)[
0
])
except
:
except
:
error_message
=
"Could not extract features and score essay."
error_message
=
"Could not extract features and score essay."
log
.
exception
(
error_message
)
log
.
exception
(
error_message
)
results
[
'errors'
]
.
append
(
error_message
)
results
[
'errors'
]
.
append
(
error_message
)
# If we have errors above, we do not continue here, but return the dictionary of failure
if
len
(
results
[
'errors'
])
<
0
:
# We have gotten through without an error, so we have been successful
# We have gotten through without an error, so we have been successful
if
len
(
results
[
'errors'
])
<
0
:
results
[
'success'
]
=
True
results
[
'success'
]
=
True
# If the essay is just a copy of the prompt (or too similar), return a 0 as the score
if
'too_similar_to_prompt'
in
feedback
and
feedback
[
'too_similar_to_prompt'
]:
results
[
'score'
]
=
0
# Generate feedback, identifying a number of explicable problem areas
results
[
'feedback'
]
=
{
'spelling'
:
feedback
[
'spelling'
],
'grammar'
:
feedback
[
'grammar'
],
'markup-text'
:
feedback
[
'markup_text'
],
}
if
'topicality'
in
feedback
and
'prompt_overlap'
in
feedback
:
results
[
'feedback'
]
.
update
({
'topicality'
:
feedback
[
'topicality'
],
'prompt-overlap'
:
feedback
[
'prompt_overlap'
],
})
# If we get here, that means there was 1+ error above. Set success to false and return
# If we get here, that means there was 1+ error above. Set success to false and return
else
:
else
:
results
[
'success'
]
=
False
results
[
'success'
]
=
False
...
...
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