Update NCR.py
Browse files
NCR.py
CHANGED
@@ -98,17 +98,18 @@ class NCR(datasets.GeneratorBasedBuilder):
|
|
98 |
|
99 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
100 |
def _generate_examples(self, filepath, split):
|
101 |
-
|
102 |
with open(filepath, encoding="utf-8") as f:
|
103 |
data = json.loads(f.read())
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
98 |
|
99 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
100 |
def _generate_examples(self, filepath, split):
|
101 |
+
|
102 |
with open(filepath, encoding="utf-8") as f:
|
103 |
data = json.loads(f.read())
|
104 |
+
for article_idx,single_data in enumerate(data):
|
105 |
+
questions = single_data["Questions"]
|
106 |
+
for i in range(len(questions)):
|
107 |
+
question = questions[i]
|
108 |
+
|
109 |
+
yield f"{article_idx}_{i}", {
|
110 |
+
"example_id": single_data["Id"],
|
111 |
+
"article": single_data["Content"],
|
112 |
+
"question": question["Question"],
|
113 |
+
"answer": question["Answer"],
|
114 |
+
"options": question["Choices"],
|
115 |
+
}
|