Datasets:
GEM
/

Tasks:
Other
Modalities:
Text
Languages:
English
ArXiv:
Tags:
question-generation
License:
Abinaya Mahendiran commited on
Commit
8b9563a
1 Parent(s): a43fa96

Updated data loader script

Browse files
Files changed (1) hide show
  1. squad_v2.py +8 -8
squad_v2.py CHANGED
@@ -127,15 +127,15 @@ class SquadV2(datasets.GeneratorBasedBuilder):
127
  """Yields examples."""
128
  # TODO(squad_v2): Yields (key, example) tuples from the dataset
129
  with open(filepath, encoding="utf-8") as f:
130
- for id_, row in enumerate(f):
131
- data = json.loads(row)
132
  # Features currently used are "context", "question", and "answers".
133
  # Others are extracted here for the ease of future expansions.
134
  yield id_, {
135
- "id": data["id"],
136
- "gem_id": data["gem_id"],
137
- "title": data["title"],
138
- "context": data["context"],
139
- "question": data["question"],
140
- "answers": data["answers"],
141
  }
 
127
  """Yields examples."""
128
  # TODO(squad_v2): Yields (key, example) tuples from the dataset
129
  with open(filepath, encoding="utf-8") as f:
130
+ data = json.loads(f)
131
+ for id_, row in enumerate(data["data"]):
132
  # Features currently used are "context", "question", and "answers".
133
  # Others are extracted here for the ease of future expansions.
134
  yield id_, {
135
+ "id": row["id"],
136
+ "gem_id": row["gem_id"],
137
+ "title": row["title"],
138
+ "context": row["context"],
139
+ "question": row["question"],
140
+ "answers": row["answers"],
141
  }