Commit
•
5c5b425
1
Parent(s):
ffd58f5
quick fixes
Browse files- massive.py +2 -33
massive.py
CHANGED
@@ -174,29 +174,8 @@ class MASSIVE(datasets.GeneratorBasedBuilder):
|
|
174 |
features=datasets.Features(
|
175 |
{
|
176 |
"id": datasets.Value("string"),
|
177 |
-
"
|
178 |
-
"
|
179 |
-
"scenario": datasets.features.ClassLabel(names=_SCENARIOS),
|
180 |
-
"intent": datasets.features.ClassLabel(names=_INTENTS),
|
181 |
-
"utt": datasets.Value("string"),
|
182 |
-
"annot_utt": datasets.Value("string"),
|
183 |
-
"worker_id": datasets.Value("string"),
|
184 |
-
"slot_method": datasets.Sequence(
|
185 |
-
{
|
186 |
-
"slot": datasets.Value("string"),
|
187 |
-
"method": datasets.Value("string"),
|
188 |
-
}
|
189 |
-
),
|
190 |
-
"judgments": datasets.Sequence(
|
191 |
-
{
|
192 |
-
"worker_id": datasets.Value("string"),
|
193 |
-
"intent_score": datasets.Value("int8"),
|
194 |
-
"slots_score": datasets.Value("int8"),
|
195 |
-
"grammar_score": datasets.Value("int8"),
|
196 |
-
"spelling_score": datasets.Value("int8"),
|
197 |
-
"language_identification": datasets.Value("string"),
|
198 |
-
}
|
199 |
-
),
|
200 |
},
|
201 |
),
|
202 |
supervised_keys=None,
|
@@ -239,29 +218,19 @@ class MASSIVE(datasets.GeneratorBasedBuilder):
|
|
239 |
]
|
240 |
|
241 |
def _generate_examples(self, files, split, lang):
|
242 |
-
|
243 |
filepath = "1.0/data/" + lang + ".jsonl"
|
244 |
-
|
245 |
logger.info("⏳ Generating examples from = %s", filepath)
|
246 |
-
|
247 |
for path, f in files:
|
248 |
if path == filepath:
|
249 |
-
# Read the file
|
250 |
lines = f.readlines()
|
251 |
-
|
252 |
key_ = 0
|
253 |
-
|
254 |
for line in lines:
|
255 |
-
|
256 |
data = json.loads(line)
|
257 |
-
|
258 |
if data["partition"] != split:
|
259 |
continue
|
260 |
-
|
261 |
yield key_, {
|
262 |
"id": data["id"],
|
263 |
"label": data["scenario"],
|
264 |
"text": data["utt"],
|
265 |
}
|
266 |
-
|
267 |
key_ += 1
|
|
|
174 |
features=datasets.Features(
|
175 |
{
|
176 |
"id": datasets.Value("string"),
|
177 |
+
"label": datasets.features.ClassLabel(names=_SCENARIOS),
|
178 |
+
"text": datasets.Value("string"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
},
|
180 |
),
|
181 |
supervised_keys=None,
|
|
|
218 |
]
|
219 |
|
220 |
def _generate_examples(self, files, split, lang):
|
|
|
221 |
filepath = "1.0/data/" + lang + ".jsonl"
|
|
|
222 |
logger.info("⏳ Generating examples from = %s", filepath)
|
|
|
223 |
for path, f in files:
|
224 |
if path == filepath:
|
|
|
225 |
lines = f.readlines()
|
|
|
226 |
key_ = 0
|
|
|
227 |
for line in lines:
|
|
|
228 |
data = json.loads(line)
|
|
|
229 |
if data["partition"] != split:
|
230 |
continue
|
|
|
231 |
yield key_, {
|
232 |
"id": data["id"],
|
233 |
"label": data["scenario"],
|
234 |
"text": data["utt"],
|
235 |
}
|
|
|
236 |
key_ += 1
|