Update tydiqa-goldp.py
Browse files- tydiqa-goldp.py +10 -2
tydiqa-goldp.py
CHANGED
@@ -98,9 +98,16 @@ class tydiqa_GoldP(datasets.GeneratorBasedBuilder):
|
|
98 |
def _generate_examples(self, filepath):
|
99 |
"""Yields examples."""
|
100 |
# TODO(tydiqa): Yields (key, example) tuples from the dataset
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
with open(filepath, encoding="utf-8") as f:
|
103 |
data = json.load(f)
|
|
|
104 |
for article in data["data"]:
|
105 |
title = article.get("title", "").strip()
|
106 |
for paragraph in article["paragraphs"]:
|
@@ -123,4 +130,5 @@ class tydiqa_GoldP(datasets.GeneratorBasedBuilder):
|
|
123 |
"answer_start": answer_starts,
|
124 |
"text": answers,
|
125 |
},
|
126 |
-
}
|
|
|
|
98 |
def _generate_examples(self, filepath):
|
99 |
"""Yields examples."""
|
100 |
# TODO(tydiqa): Yields (key, example) tuples from the dataset
|
101 |
+
with open(filepath, encoding="utf-8") as f:
|
102 |
+
for row in f:
|
103 |
+
data = json.loads(row)
|
104 |
+
idx = data["id"]
|
105 |
+
yield idx, data
|
106 |
+
|
107 |
+
"""
|
108 |
with open(filepath, encoding="utf-8") as f:
|
109 |
data = json.load(f)
|
110 |
+
|
111 |
for article in data["data"]:
|
112 |
title = article.get("title", "").strip()
|
113 |
for paragraph in article["paragraphs"]:
|
|
|
130 |
"answer_start": answer_starts,
|
131 |
"text": answers,
|
132 |
},
|
133 |
+
}
|
134 |
+
"""
|