Commit ·
ea32ef6
1
Parent(s): 9f20608
fixed bug in sequence feature schema definition
Browse files- phantom-wiki.py +5 -17
phantom-wiki.py
CHANGED
|
@@ -103,14 +103,14 @@ class PhantomWiki(datasets.GeneratorBasedBuilder):
|
|
| 103 |
"id": datasets.Value("string"),
|
| 104 |
"question": datasets.Value("string"),
|
| 105 |
"intermediate_answers": datasets.Value("string"),
|
| 106 |
-
"answer": datasets.Sequence("string"),
|
| 107 |
"prolog": datasets.Features(
|
| 108 |
{
|
| 109 |
"query": datasets.Value("string"),
|
| 110 |
"answer": datasets.Value("string"),
|
| 111 |
}
|
| 112 |
),
|
| 113 |
-
"template": datasets.Sequence("string"),
|
| 114 |
"type": datasets.Value("int64"), # this references the template type
|
| 115 |
"difficulty": datasets.Value("int64"),
|
| 116 |
}
|
|
@@ -168,23 +168,11 @@ class PhantomWiki(datasets.GeneratorBasedBuilder):
|
|
| 168 |
with open(filepath, encoding="utf-8") as f:
|
| 169 |
for key, data in enumerate(json.load(f)):
|
| 170 |
if self.config.name == "corpus":
|
| 171 |
-
yield key,
|
| 172 |
-
"title": data["title"],
|
| 173 |
-
"article": data["article"],
|
| 174 |
-
# "facts": data["facts"], # TODO
|
| 175 |
-
}
|
| 176 |
elif self.config.name == "question-answer":
|
| 177 |
-
yield key,
|
| 178 |
-
"id": data["id"],
|
| 179 |
-
"question": data["question"],
|
| 180 |
-
"intermediate_answers": data["intermediate_answers"],
|
| 181 |
-
"answer": data["answer"],
|
| 182 |
-
"prolog": data["prolog"],
|
| 183 |
-
"template": data["template"],
|
| 184 |
-
"type": data["type"],
|
| 185 |
-
"difficulty": data["difficulty"],
|
| 186 |
-
}
|
| 187 |
elif self.config.name == "database":
|
|
|
|
| 188 |
yield key, {
|
| 189 |
"content": data,
|
| 190 |
}
|
|
|
|
| 103 |
"id": datasets.Value("string"),
|
| 104 |
"question": datasets.Value("string"),
|
| 105 |
"intermediate_answers": datasets.Value("string"),
|
| 106 |
+
"answer": datasets.Sequence(datasets.Value("string")),
|
| 107 |
"prolog": datasets.Features(
|
| 108 |
{
|
| 109 |
"query": datasets.Value("string"),
|
| 110 |
"answer": datasets.Value("string"),
|
| 111 |
}
|
| 112 |
),
|
| 113 |
+
"template": datasets.Sequence(datasets.Value("string")),
|
| 114 |
"type": datasets.Value("int64"), # this references the template type
|
| 115 |
"difficulty": datasets.Value("int64"),
|
| 116 |
}
|
|
|
|
| 168 |
with open(filepath, encoding="utf-8") as f:
|
| 169 |
for key, data in enumerate(json.load(f)):
|
| 170 |
if self.config.name == "corpus":
|
| 171 |
+
yield key, data
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
elif self.config.name == "question-answer":
|
| 173 |
+
yield key, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
elif self.config.name == "database":
|
| 175 |
+
# NOTE: Our schema expects a dictionary with a single key "content"
|
| 176 |
yield key, {
|
| 177 |
"content": data,
|
| 178 |
}
|