sh110495 commited on
Commit
f710c4c
1 Parent(s): 7366bc9

Add mutiple answer dataset

Browse files
Files changed (1) hide show
  1. klue-mrc.py +10 -4
klue-mrc.py CHANGED
@@ -80,10 +80,16 @@ class KoreanNewspaper(datasets.GeneratorBasedBuilder):
80
  question = q['question']
81
 
82
  answer_key = 'answers' if len(q['answers']) > 0 else 'plausible_answers'
83
- answer = q[answer_key][0]
84
- answer_text = answer['text']
85
- answer_start = answer['answer_start']
86
- answer_data = {'answer_start' : [answer_start], 'text': [answer_text]}
 
 
 
 
 
 
87
  guid = q['guid']
88
 
89
  yield key, {
 
80
  question = q['question']
81
 
82
  answer_key = 'answers' if len(q['answers']) > 0 else 'plausible_answers'
83
+ answer = q[answer_key]
84
+
85
+ answer_text_list = []
86
+ answer_start_list = []
87
+
88
+ for ans in answer :
89
+ answer_text_list.append(ans['text'])
90
+ answer_start_list.append(ans['answer_start'])
91
+
92
+ answer_data = {'text' : answer_text_list, 'answer_start' : answer_start_list}
93
  guid = q['guid']
94
 
95
  yield key, {