sh110495 commited on
Commit
2df2d46
1 Parent(s): 93e6883

Check script file

Browse files
Files changed (1) hide show
  1. klue-mrc.py +9 -11
klue-mrc.py CHANGED
@@ -30,13 +30,11 @@ class KoreanNewspaper(datasets.GeneratorBasedBuilder):
30
  description=_DESCRIPTION,
31
  features=datasets.Features(
32
  {
33
- "guid": datasets.Value("string"),
34
- "source": datasets.Value("string"),
35
- "news_category": datasets.Value("string"),
36
  "context": datasets.Value("string"),
37
  "question": datasets.Value("string"),
38
  "answer_text":datasets.Value("string"),
39
  "answer_start":datasets.Value("int32"),
 
40
 
41
  }
42
  ),
@@ -63,28 +61,28 @@ class KoreanNewspaper(datasets.GeneratorBasedBuilder):
63
  data = data['data']
64
 
65
  for info in data :
66
- guid = info['title']
67
  news_category = info['news_category']
68
  source = info['source']
 
69
  paragraphs = info['paragraphs']
70
 
 
 
 
71
  context = paragraphs[0]['context']
 
72
 
73
- qas = paragraphs[0]['qas'][0]
74
  question = qas['question']
75
 
76
- if len(qas['answers']) == 0 :
77
- continue
78
-
79
- answer = qas['answers'][0]
80
  answer_text = answer['text']
81
  answer_start = answer['answer_start']
82
  guid = qas['guid']
83
 
84
  yield key, {
85
  "guid" : guid,
86
- "news_category" : news_category,
87
- "source" : source,
88
  "context" : context,
89
  "question" : question,
90
  "answer_text" : answer_text,
 
30
  description=_DESCRIPTION,
31
  features=datasets.Features(
32
  {
 
 
 
33
  "context": datasets.Value("string"),
34
  "question": datasets.Value("string"),
35
  "answer_text":datasets.Value("string"),
36
  "answer_start":datasets.Value("int32"),
37
+ "guid":datasets.Value("string"),
38
 
39
  }
40
  ),
 
61
  data = data['data']
62
 
63
  for info in data :
64
+ title = info['title']
65
  news_category = info['news_category']
66
  source = info['source']
67
+
68
  paragraphs = info['paragraphs']
69
 
70
+ if len(paragraphs) == 0 :
71
+ continue
72
+
73
  context = paragraphs[0]['context']
74
+ qas = paragraphs[0]['qas']
75
 
 
76
  question = qas['question']
77
 
78
+ answer_key = 'answers' if len(qas['answers']) > 0 else 'plausible_answers'
79
+ answer = qas[answer_key][0]
 
 
80
  answer_text = answer['text']
81
  answer_start = answer['answer_start']
82
  guid = qas['guid']
83
 
84
  yield key, {
85
  "guid" : guid,
 
 
86
  "context" : context,
87
  "question" : question,
88
  "answer_text" : answer_text,