kwojtasik commited on
Commit
45a09eb
1 Parent(s): 2a8c9e6

Update poquad.py

Browse files
Files changed (1) hide show
  1. poquad.py +5 -3
poquad.py CHANGED
@@ -101,22 +101,24 @@ class SquadV2(datasets.GeneratorBasedBuilder):
101
  squad = json.load(f)
102
  for example in squad["data"]:
103
  title = example.get("title", "")
 
104
  for paragraph in example["paragraphs"]:
105
  context = paragraph["context"] # do not strip leading blank spaces GH-2585
106
  for qa in paragraph["qas"]:
107
  question = qa["question"]
108
- id_ = qa["id"]
109
 
110
  answer_starts = [answer["answer_start"] for answer in qa["answers"]]
111
  answers = [answer["text"] for answer in qa["answers"]]
112
-
113
  # Features currently used are "context", "question", and "answers".
114
  # Others are extracted here for the ease of future expansions.
115
  yield id_, {
116
  "title": title,
117
  "context": context,
118
  "question": question,
119
- "id": id_,
 
120
  "answers": {
121
  "answer_start": answer_starts,
122
  "text": answers,
 
101
  squad = json.load(f)
102
  for example in squad["data"]:
103
  title = example.get("title", "")
104
+ paragraph_id = example["id"]
105
  for paragraph in example["paragraphs"]:
106
  context = paragraph["context"] # do not strip leading blank spaces GH-2585
107
  for qa in paragraph["qas"]:
108
  question = qa["question"]
109
+
110
 
111
  answer_starts = [answer["answer_start"] for answer in qa["answers"]]
112
  answers = [answer["text"] for answer in qa["answers"]]
113
+ is_impossible = qa[is_impossible]
114
  # Features currently used are "context", "question", and "answers".
115
  # Others are extracted here for the ease of future expansions.
116
  yield id_, {
117
  "title": title,
118
  "context": context,
119
  "question": question,
120
+ "is_impossible" : is_impossible,
121
+ "paragraph_id": paragraph_id,
122
  "answers": {
123
  "answer_start": answer_starts,
124
  "text": answers,