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
1865c54d
Commit
1865c54d
authored
Dec 12, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix encoding issues
parent
aa57934c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
essay_set.py
+8
-1
feature_extractor.py
+2
-2
No files found.
essay_set.py
View file @
1865c54d
...
...
@@ -58,6 +58,13 @@ class EssaySet(object):
# Verify that essay_score is an int, essay_text is a string, and essay_generated equals 0 or 1
try
:
essay_text
=
essay_text
.
encode
(
'ascii'
,
'ignore'
)
if
len
(
essay_text
)
<
5
:
essay_text
=
"Invalid essay."
except
:
log
.
exception
(
"Could not parse essay into ascii."
)
try
:
#Try conversion of types
essay_score
=
int
(
essay_score
)
essay_text
=
str
(
essay_text
)
...
...
@@ -65,7 +72,7 @@ class EssaySet(object):
#Nothing needed here, will return error in any case.
log
.
exception
(
"Invalid type for essay score : {0} or essay text : {1}"
.
format
(
type
(
essay_score
),
type
(
essay_text
)))
if
type
(
essay_score
)
==
type
(
0
)
and
type
(
essay_text
)
==
type
(
"text"
)
\
if
isinstance
(
essay_score
,
int
)
and
isinstance
(
essay_text
,
basestring
)
\
and
(
essay_generated
==
0
or
essay_generated
==
1
):
self
.
_id
.
append
(
max_id
+
1
)
self
.
_score
.
append
(
essay_score
)
...
...
feature_extractor.py
View file @
1865c54d
...
...
@@ -213,8 +213,8 @@ class FeatureExtractor(object):
#Calc number of grammar and spelling errors per character
set_grammar
,
bad_pos_positions
=
self
.
_get_grammar_errors
(
e_set
.
_pos
,
e_set
.
_text
,
e_set
.
_tokens
)
set_grammar_per_character
=
[
set_grammar
[
m
]
/
float
(
len
(
e_set
.
_text
[
m
]))
for
m
in
xrange
(
0
,
len
(
e_set
.
_text
))]
set_spell_errors_per_character
=
[
e_set
.
_spelling_errors
[
m
]
/
float
(
len
(
e_set
.
_text
[
m
]))
for
m
in
xrange
(
0
,
len
(
e_set
.
_text
))]
set_grammar_per_character
=
[
set_grammar
[
m
]
/
float
(
len
(
e_set
.
_text
[
m
])
+.
1
)
for
m
in
xrange
(
0
,
len
(
e_set
.
_text
))]
set_spell_errors_per_character
=
[
e_set
.
_spelling_errors
[
m
]
/
float
(
len
(
e_set
.
_text
[
m
])
+.
1
)
for
m
in
xrange
(
0
,
len
(
e_set
.
_text
))]
#Iterate through essays and create a feedback dict for each
all_feedback
=
[]
...
...
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