Datasets:
Maxime
commited on
Commit
·
9e640f6
1
Parent(s):
4b3c826
flat config
Browse files
mfaq.py
CHANGED
@@ -55,21 +55,33 @@ class MFAQ(datasets.GeneratorBasedBuilder):
|
|
55 |
DEFAULT_CONFIG_NAME = "all"
|
56 |
|
57 |
def _info(self):
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
return datasets.DatasetInfo(
|
74 |
description=_DESCRIPTION,
|
75 |
features=features, # Here we define them above because they are different between the two configurations
|
@@ -109,7 +121,8 @@ class MFAQ(datasets.GeneratorBasedBuilder):
|
|
109 |
"domain": data["domain"],
|
110 |
"language": data["language"],
|
111 |
"num_pairs": 1,
|
112 |
-
"
|
|
|
113 |
}
|
114 |
else:
|
115 |
yield f"{filepath}_{_id}", {
|
|
|
55 |
DEFAULT_CONFIG_NAME = "all"
|
56 |
|
57 |
def _info(self):
|
58 |
+
if "_flat" in self.config.name:
|
59 |
+
features = datasets.Features(
|
60 |
+
{
|
61 |
+
"id": datasets.Value("int64"),
|
62 |
+
"language": datasets.Value("string"),
|
63 |
+
"num_pairs": datasets.Value("int64"),
|
64 |
+
"domain": datasets.Value("string"),
|
65 |
+
"question": datasets.Value("string"),
|
66 |
+
"answer": datasets.Value("string")
|
67 |
+
}
|
68 |
+
)
|
69 |
+
else:
|
70 |
+
features = datasets.Features(
|
71 |
+
{
|
72 |
+
"id": datasets.Value("int64"),
|
73 |
+
"language": datasets.Value("string"),
|
74 |
+
"num_pairs": datasets.Value("int64"),
|
75 |
+
"domain": datasets.Value("string"),
|
76 |
+
"qa_pairs": datasets.features.Sequence(
|
77 |
+
{
|
78 |
+
"question": datasets.Value("string"),
|
79 |
+
"answer": datasets.Value("string"),
|
80 |
+
"language": datasets.Value("string")
|
81 |
+
}
|
82 |
+
)
|
83 |
+
}
|
84 |
+
)
|
85 |
return datasets.DatasetInfo(
|
86 |
description=_DESCRIPTION,
|
87 |
features=features, # Here we define them above because they are different between the two configurations
|
|
|
121 |
"domain": data["domain"],
|
122 |
"language": data["language"],
|
123 |
"num_pairs": 1,
|
124 |
+
"question": pair["question"],
|
125 |
+
"answer": pair["answer"]
|
126 |
}
|
127 |
else:
|
128 |
yield f"{filepath}_{_id}", {
|