Igor Kuzmin commited on
Commit
c0fc359
·
1 Parent(s): 24ce672

feat(dev): add speaker ids support

Browse files
Files changed (1) hide show
  1. daiso.py +18 -0
daiso.py CHANGED
@@ -1049,6 +1049,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1049
  """
1050
  ),
1051
  label_classes=LABELS_MAPPING["ami"],
 
1052
  features=[
1053
  "Utterance",
1054
  "Dialogue_Act",
@@ -1082,6 +1083,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1082
  """
1083
  ),
1084
  label_classes=LABELS_MAPPING["oasis"],
 
1085
  features=[
1086
  "Speaker",
1087
  "Utterance",
@@ -1114,6 +1116,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1114
  """
1115
  ),
1116
  label_classes=LABELS_MAPPING["maptask"],
 
1117
  features=[
1118
  "Speaker",
1119
  "Utterance",
@@ -1144,6 +1147,11 @@ class DAISO(datasets.GeneratorBasedBuilder):
1144
  """
1145
  ),
1146
  label_classes=LABELS_MAPPING["mrda"],
 
 
 
 
 
1147
  features=[
1148
  "Speaker",
1149
  "Utterance",
@@ -1178,6 +1186,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1178
  """
1179
  ),
1180
  label_classes=LABELS_MAPPING["swda"],
 
1181
  features=[
1182
  "Speaker",
1183
  "Utterance",
@@ -1219,6 +1228,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1219
  "Dialogue_Act",
1220
  "Dialogue_Act_ISO"
1221
  ],
 
1222
  data_url={
1223
  "train": _URL + "/frames/train.csv",
1224
  "test": _URL + "/frames/test.csv",
@@ -1279,6 +1289,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1279
  "Dialogue_Id",
1280
  "Dialogue_Act_ISO"
1281
  ],
 
1282
  data_url={
1283
  "train": _URL + "/dyda/train.csv",
1284
  "dev": _URL + "/dyda/dev.csv",
@@ -1308,6 +1319,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1308
  "Dialogue_Act",
1309
  "Dialogue_Act_ISO"
1310
  ],
 
1311
  data_url={
1312
  "train": _URL + "/dstc3/train.csv",
1313
  "test": _URL + "/dstc3/test.csv",
@@ -1339,6 +1351,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1339
  "Dialogue_Id",
1340
  "Dialogue_Act_ISO"
1341
  ],
 
1342
  data_url={
1343
  "train": _URL + "/dstc8-sgd/train.csv",
1344
  "dev": _URL + "/dstc8-sgd/dev.csv",
@@ -1371,6 +1384,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
1371
  features["Label_ISO"] = datasets.features.ClassLabel(
1372
  names=list(set([map.get("ISO") for map in self.config.label_classes.values()])))
1373
  features["Idx"] = datasets.Value("int32")
 
1374
  # if self.config.name == "": # This is the name of the configuration selected in BUILDER_CONFIGS above
1375
  # features = datasets.Features(
1376
  # {
@@ -1452,4 +1466,8 @@ class DAISO(datasets.GeneratorBasedBuilder):
1452
  example["Label"] = label
1453
  example["Label_ISO"] = self.config.label_classes.get(label, {}).get("ISO")
1454
 
 
 
 
 
1455
  yield example["Idx"], example
 
1049
  """
1050
  ),
1051
  label_classes=LABELS_MAPPING["ami"],
1052
+ speakers=['A', 'B', 'D', 'C'],
1053
  features=[
1054
  "Utterance",
1055
  "Dialogue_Act",
 
1083
  """
1084
  ),
1085
  label_classes=LABELS_MAPPING["oasis"],
1086
+ speakers=['b', 'a'],
1087
  features=[
1088
  "Speaker",
1089
  "Utterance",
 
1116
  """
1117
  ),
1118
  label_classes=LABELS_MAPPING["maptask"],
1119
+ speakers=['g', 'f'],
1120
  features=[
1121
  "Speaker",
1122
  "Utterance",
 
1147
  """
1148
  ),
1149
  label_classes=LABELS_MAPPING["mrda"],
1150
+ speakers=['me003', 'me012', 'fe004', 'mn015', 'me010', 'me045', 'mn036', 'me013', 'me001', 'me011', 'mn005',
1151
+ 'fe016', 'fe008', 'mn017', 'me018', 'mn014', 'mn009', 'me026', 'me051', 'mn007', 'me034', 'me006',
1152
+ 'fn002', 'mn058', 'mn052', 'fe046', 'fn050', 'me025', 'mn048', 'mn047', 'mn059', 'me022', 'me028',
1153
+ 'mn082', 'mn021', 'fn083', 'mn030', 'mn081', 'mn035', 'mn040', 'mn049', 'me055', 'mn038', 'me056',
1154
+ 'mn057', 'fe068', 'fe069', 'fe066', 'me070', 'fe067', 'fe041', 'fn043'],
1155
  features=[
1156
  "Speaker",
1157
  "Utterance",
 
1186
  """
1187
  ),
1188
  label_classes=LABELS_MAPPING["swda"],
1189
+ speakers=['A', 'B'],
1190
  features=[
1191
  "Speaker",
1192
  "Utterance",
 
1228
  "Dialogue_Act",
1229
  "Dialogue_Act_ISO"
1230
  ],
1231
+ speakers=['USR', 'SYS'],
1232
  data_url={
1233
  "train": _URL + "/frames/train.csv",
1234
  "test": _URL + "/frames/test.csv",
 
1289
  "Dialogue_Id",
1290
  "Dialogue_Act_ISO"
1291
  ],
1292
+ speakers=[0, 1],
1293
  data_url={
1294
  "train": _URL + "/dyda/train.csv",
1295
  "dev": _URL + "/dyda/dev.csv",
 
1319
  "Dialogue_Act",
1320
  "Dialogue_Act_ISO"
1321
  ],
1322
+ speakers=['SYS', 'USR'],
1323
  data_url={
1324
  "train": _URL + "/dstc3/train.csv",
1325
  "test": _URL + "/dstc3/test.csv",
 
1351
  "Dialogue_Id",
1352
  "Dialogue_Act_ISO"
1353
  ],
1354
+ speakers=['USER', 'SYSTEM'],
1355
  data_url={
1356
  "train": _URL + "/dstc8-sgd/train.csv",
1357
  "dev": _URL + "/dstc8-sgd/dev.csv",
 
1384
  features["Label_ISO"] = datasets.features.ClassLabel(
1385
  names=list(set([map.get("ISO") for map in self.config.label_classes.values()])))
1386
  features["Idx"] = datasets.Value("int32")
1387
+ features["Speaker_Id"] = datasets.features.ClassLabel(names=self.config.speakers)
1388
  # if self.config.name == "": # This is the name of the configuration selected in BUILDER_CONFIGS above
1389
  # features = datasets.Features(
1390
  # {
 
1466
  example["Label"] = label
1467
  example["Label_ISO"] = self.config.label_classes.get(label, {}).get("ISO")
1468
 
1469
+ if "Speaker" in example:
1470
+ speaker = example["Speaker"]
1471
+ example["Speaker_Id"] = speaker
1472
+
1473
  yield example["Idx"], example