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
ccd8f04b
Commit
ccd8f04b
authored
Jun 06, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes
parent
2e6cb8e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
ease/essay_set.py
+4
-4
No files found.
ease/essay_set.py
View file @
ccd8f04b
...
...
@@ -113,21 +113,21 @@ class EssaySet(object):
prompt_text should be a string.
Returns the prompt as a confirmation.
"""
if
(
isinstance
(
prompt_text
,
type
(
"text"
)
)):
if
(
isinstance
(
prompt_text
,
basestring
)):
self
.
_prompt
=
util_functions
.
sub_chars
(
prompt_text
)
ret
=
self
.
_prompt
else
:
raise
util_functions
.
InputError
(
prompt_text
,
"Invalid prompt. Need to enter a string value."
)
return
ret
def
generate_additional_essays
(
self
,
e_text
,
e_score
,
dict
=
None
,
max_syns
=
3
):
def
generate_additional_essays
(
self
,
e_text
,
e_score
,
dict
ionary
=
None
,
max_syns
=
3
):
"""
Substitute synonyms to generate extra essays from existing ones.
This is done to increase the amount of training data.
Should only be used with lowest scoring essays.
e_text is the text of the original essay.
e_score is the score of the original essay.
dict is a fixed dictionary (list) of words to replace.
dict
ionary
is a fixed dictionary (list) of words to replace.
max_syns defines the maximum number of additional essays to generate. Do not set too high.
"""
random
.
seed
(
1
)
...
...
@@ -142,7 +142,7 @@ class EssaySet(object):
for
i
in
range
(
0
,
max_syns
):
syn_toks
=
e_toks
for
z
in
range
(
0
,
len
(
e_toks
)):
if
len
(
all_syns
[
z
])
>
i
and
(
dict
==
None
or
e_toks
[
z
]
in
dict
):
if
len
(
all_syns
[
z
])
>
i
and
(
dict
ionary
==
None
or
e_toks
[
z
]
in
dictionary
):
syn_toks
[
z
]
=
all_syns
[
z
][
i
]
new_essays
.
append
(
" "
.
join
(
syn_toks
))
for
z
in
xrange
(
0
,
len
(
new_essays
)):
...
...
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