Datasets:
Update poquad.py
Browse files
poquad.py
CHANGED
@@ -99,6 +99,7 @@ class SquadV2(datasets.GeneratorBasedBuilder):
|
|
99 |
# TODO(squad_v2): Yields (key, example) tuples from the dataset
|
100 |
with open(filepath, encoding="utf-8") as f:
|
101 |
squad = json.load(f)
|
|
|
102 |
for example in squad["data"]:
|
103 |
title = example.get("title", "")
|
104 |
paragraph_id = example["id"]
|
@@ -113,7 +114,8 @@ class SquadV2(datasets.GeneratorBasedBuilder):
|
|
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 |
-
|
|
|
117 |
"title": title,
|
118 |
"context": context,
|
119 |
"question": question,
|
|
|
99 |
# TODO(squad_v2): Yields (key, example) tuples from the dataset
|
100 |
with open(filepath, encoding="utf-8") as f:
|
101 |
squad = json.load(f)
|
102 |
+
id_ = 0
|
103 |
for example in squad["data"]:
|
104 |
title = example.get("title", "")
|
105 |
paragraph_id = example["id"]
|
|
|
114 |
is_impossible = qa["is_impossible"]
|
115 |
# Features currently used are "context", "question", and "answers".
|
116 |
# Others are extracted here for the ease of future expansions.
|
117 |
+
id_ += 1
|
118 |
+
yield id_, {
|
119 |
"title": title,
|
120 |
"context": context,
|
121 |
"question": question,
|