Igor
commited on
Commit
·
61d46ad
1
Parent(s):
e0c2ae1
Update daiso.py
Browse files
daiso.py
CHANGED
@@ -1387,58 +1387,21 @@ class DAISO(datasets.GeneratorBasedBuilder):
|
|
1387 |
def _info(self):
|
1388 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
1389 |
features = {feature: datasets.Value("string") for feature in self.config.features}
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
|
1403 |
-
|
1404 |
-
|
1405 |
-
original_labels = set(self.config.label_classes.keys())
|
1406 |
-
|
1407 |
-
# Determine if 'OOD' needs to be included
|
1408 |
-
# 'OOD' is needed if any of the original labels are 'null', 'None', or 'OOD'
|
1409 |
-
needs_ood = any(label in {'null', 'None', 'OOD'} for label in original_labels)
|
1410 |
-
|
1411 |
-
# Create the 'Label' ClassLabel
|
1412 |
-
label_names = set()
|
1413 |
-
for label in original_labels:
|
1414 |
-
if label in {'null', 'None', 'OOD'}:
|
1415 |
-
label_names.add('OOD')
|
1416 |
-
else:
|
1417 |
-
label_names.add(label)
|
1418 |
-
|
1419 |
-
# Always include 'OOD' if any label was mapped to it
|
1420 |
-
if needs_ood or any(
|
1421 |
-
label_map.get("ISO") == "OOD" or label_map.get("base") == "OOD"
|
1422 |
-
for label_map in self.config.label_classes.values()
|
1423 |
-
):
|
1424 |
-
label_names.add('OOD')
|
1425 |
-
|
1426 |
-
features["Label"] = datasets.features.ClassLabel(names=sorted(label_names))
|
1427 |
-
|
1428 |
-
# Create the 'Label_ISO' ClassLabel
|
1429 |
-
iso_labels = set(
|
1430 |
-
map.get("ISO", "OOD") for map in self.config.label_classes.values()
|
1431 |
-
)
|
1432 |
-
features["Label_ISO"] = datasets.features.ClassLabel(names=sorted(iso_labels))
|
1433 |
-
|
1434 |
-
# Create the 'Label_Base' ClassLabel
|
1435 |
-
base_labels = set(
|
1436 |
-
map.get("base", "OOD") for map in self.config.label_classes.values()
|
1437 |
-
)
|
1438 |
-
features["Label_Base"] = datasets.features.ClassLabel(names=sorted(base_labels))
|
1439 |
-
|
1440 |
-
features["Idx"] = datasets.Value("int32")
|
1441 |
-
features["Speaker_Id"] = datasets.features.ClassLabel(names=self.config.speakers)
|
1442 |
# if self.config.name == "": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
1443 |
# features = datasets.Features(
|
1444 |
# {
|
|
|
1387 |
def _info(self):
|
1388 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
1389 |
features = {feature: datasets.Value("string") for feature in self.config.features}
|
1390 |
+
if self.config.label_classes:
|
1391 |
+
features["Label"] = datasets.features.ClassLabel(names=list(
|
1392 |
+
set(['OOD' if label == 'null' or label is None or label == 'None' or label == 'OOD' else label for label in
|
1393 |
+
list(self.config.label_classes.keys())])
|
1394 |
+
))
|
1395 |
+
features["Label_ISO"] = datasets.features.ClassLabel(
|
1396 |
+
names=list(set([map.get("ISO", "OOD") for map in self.config.label_classes.values()])))
|
1397 |
|
1398 |
+
# Add the missing features
|
1399 |
+
features["Dialogue_Act_Base"] = datasets.Value("string")
|
1400 |
+
features["Label_Base"] = datasets.features.ClassLabel(
|
1401 |
+
names=list(set([map.get("base", "OOD") for map in self.config.label_classes.values()])))
|
1402 |
|
1403 |
+
features["Idx"] = datasets.Value("int32")
|
1404 |
+
features["Speaker_Id"] = datasets.features.ClassLabel(names=self.config.speakers)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1405 |
# if self.config.name == "": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
1406 |
# features = datasets.Features(
|
1407 |
# {
|