Datasets:
Tasks:
Question Answering
Modalities:
Text
Languages:
English
Size:
1K - 10K
Tags:
knowledge-base-qa
License:
Revert adding answers
Browse files
SciQA.py
CHANGED
|
@@ -92,8 +92,7 @@ class SciQA(datasets.GeneratorBasedBuilder):
|
|
| 92 |
"query_shape": datasets.Value("string"),
|
| 93 |
"query_class": datasets.Value("string"),
|
| 94 |
"auto_generated": datasets.Value("bool"),
|
| 95 |
-
"number_of_patterns": datasets.Value("int32")
|
| 96 |
-
"answers": datasets.dataset_dict.DatasetDict(),
|
| 97 |
}
|
| 98 |
),
|
| 99 |
supervised_keys=None,
|
|
@@ -124,11 +123,8 @@ class SciQA(datasets.GeneratorBasedBuilder):
|
|
| 124 |
def _generate_examples(self, filepath):
|
| 125 |
"""Yields examples."""
|
| 126 |
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
with open(question_filepath, encoding="utf-8") as qf, open(answers_filepath, encoding="utf-8") as af:
|
| 130 |
-
questions_data = json.load(qf)["questions"]
|
| 131 |
-
answers_data = json.load(af)["answers"]
|
| 132 |
for id_, row in enumerate(questions_data):
|
| 133 |
yield id_, {
|
| 134 |
"id": row["id"],
|
|
@@ -140,6 +136,5 @@ class SciQA(datasets.GeneratorBasedBuilder):
|
|
| 140 |
"query_shape": row["query_shape"],
|
| 141 |
"query_class": row["query_class"],
|
| 142 |
"auto_generated": row["auto_generated"],
|
| 143 |
-
"number_of_patterns": row["number_of_patterns"]
|
| 144 |
-
"answers": answers_data[id_]["answer"]
|
| 145 |
}
|
|
|
|
| 92 |
"query_shape": datasets.Value("string"),
|
| 93 |
"query_class": datasets.Value("string"),
|
| 94 |
"auto_generated": datasets.Value("bool"),
|
| 95 |
+
"number_of_patterns": datasets.Value("int32")
|
|
|
|
| 96 |
}
|
| 97 |
),
|
| 98 |
supervised_keys=None,
|
|
|
|
| 123 |
def _generate_examples(self, filepath):
|
| 124 |
"""Yields examples."""
|
| 125 |
|
| 126 |
+
with open(filepath, encoding="utf-8") as f:
|
| 127 |
+
questions_data = json.load(f)["questions"]
|
|
|
|
|
|
|
|
|
|
| 128 |
for id_, row in enumerate(questions_data):
|
| 129 |
yield id_, {
|
| 130 |
"id": row["id"],
|
|
|
|
| 136 |
"query_shape": row["query_shape"],
|
| 137 |
"query_class": row["query_class"],
|
| 138 |
"auto_generated": row["auto_generated"],
|
| 139 |
+
"number_of_patterns": row["number_of_patterns"]
|
|
|
|
| 140 |
}
|