Commit 5afc5007 by Usman Khalid

TraningExamples should accept answers with multiple parts.

TNL-708
parent be92b732
......@@ -6,6 +6,7 @@ from httplib import HTTPException
from django.db import DatabaseError
from dogapi import dog_stats_api
from openassessment.assessment.models import (
essay_text_from_submission,
AITrainingWorkflow, AIGradingWorkflow,
ClassifierUploadError, ClassifierSerializeError,
IncompleteClassifierSet, NoTrainingExamples,
......@@ -197,19 +198,13 @@ def get_training_task_params(training_workflow_uuid):
returned_examples = []
for example in workflow.training_examples.all():
answer = example.answer
if isinstance(answer, dict):
text = answer.get('answer', '')
else:
text = answer
scores = {
option.criterion.name: option.points
for option in example.options_selected.all()
}
returned_examples.append({
'text': text,
'text': essay_text_from_submission({'answer': example.answer}),
'scores': scores
})
......
......@@ -126,7 +126,15 @@ def deserialize_training_examples(examples, rubric_dict):
>>>
>>> examples = [
>>> {
>>> 'answer': u'Lorem ipsum',
>>> 'answer': {
>>> 'parts': {
>>> [
>>> {'text:' 'Answer part 1'},
>>> {'text:' 'Answer part 2'},
>>> {'text:' 'Answer part 3'}
>>> ]
>>> }
>>> },
>>> 'options_selected': {
>>> 'vocabulary': 'good',
>>> 'grammar': 'excellent'
......
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