Igor Kuzmin commited on
Commit
ef182a3
·
1 Parent(s): e844ddc

upd(dev): update None labels to OOD

Browse files
Files changed (1) hide show
  1. daiso.py +67 -64
daiso.py CHANGED
@@ -60,11 +60,11 @@ LABELS_MAPPING = {
60
  },
61
  "stl": {
62
  "base": "Stall",
63
- "ISO": None
64
  },
65
  "fra": {
66
  "base": "Fragment",
67
- "ISO": None
68
  },
69
  "inf": {
70
  "base": "Inform",
@@ -80,7 +80,7 @@ LABELS_MAPPING = {
80
  },
81
  "el.inf": {
82
  "base": "Elicit-Inform",
83
- "ISO": None
84
  },
85
  "el.sug": {
86
  "base": "Elicit-Offer-Or-Suggestion",
@@ -88,11 +88,11 @@ LABELS_MAPPING = {
88
  },
89
  "el.ass": {
90
  "base": "Elicit-Assessment",
91
- "ISO": None
92
  },
93
  "el.und": {
94
  "base": "Elicit-Comment-Understanding",
95
- "ISO": None
96
  },
97
  "off": {
98
  "base": "Offer",
@@ -104,19 +104,19 @@ LABELS_MAPPING = {
104
  },
105
  "be.pos": {
106
  "base": "Be-Positive",
107
- "ISO": None
108
  },
109
  "be.neg": {
110
  "base": "Be-Negative",
111
- "ISO": None
112
  },
113
  "oth": {
114
  "base": "Other",
115
- "ISO": None
116
  },
117
  None: {
118
- "base": "None",
119
- "ISO": None
120
  }
121
  },
122
  "oasis": {
@@ -202,7 +202,7 @@ LABELS_MAPPING = {
202
  },
203
  "refer": {
204
  "base": "Refer",
205
- "ISO": None
206
  },
207
  "suggest": {
208
  "base": "Suggest",
@@ -218,7 +218,7 @@ LABELS_MAPPING = {
218
  },
219
  "exclaim": {
220
  "base": "Exclaim",
221
- "ISO": None
222
  },
223
  "pardon": {
224
  "base": "Pardon",
@@ -226,7 +226,7 @@ LABELS_MAPPING = {
226
  },
227
  "identifySelf": {
228
  "base": "Identify Self",
229
- "ISO": None
230
  },
231
  "expressPossibility": {
232
  "base": "Express Possibility",
@@ -234,7 +234,7 @@ LABELS_MAPPING = {
234
  },
235
  "raiseIssue": {
236
  "base": "Raise Issue",
237
- "ISO": None
238
  },
239
  "expressWish": {
240
  "base": "Express Wish",
@@ -246,7 +246,7 @@ LABELS_MAPPING = {
246
  },
247
  "complete": {
248
  "base": "Complete",
249
- "ISO": None
250
  },
251
  "directElab": {
252
  "base": "Direct Elaborate",
@@ -254,27 +254,27 @@ LABELS_MAPPING = {
254
  },
255
  "correct": {
256
  "base": "Correct",
257
- "ISO": None
258
  },
259
  "refuse": {
260
  "base": "Refuse",
261
- "ISO": None
262
  },
263
  "informIntent-hold": {
264
  "base": "Inform Intent Hold",
265
- "ISO": None
266
  },
267
  "informDisc": {
268
  "base": "Inform Continue",
269
- "ISO": None
270
  },
271
  "informCont": {
272
  "base": "Inform Discontinue",
273
- "ISO": None
274
  },
275
  "selfTalk": {
276
  "base": "Self Talk",
277
- "ISO": None
278
  },
279
  "correctSelf": {
280
  "base": "Correct Self",
@@ -282,11 +282,11 @@ LABELS_MAPPING = {
282
  },
283
  "expressRegret-inform": {
284
  "base": "Express Regret Inform",
285
- "ISO": None
286
  },
287
  "thank-identifySelf": {
288
  "base": "Thank Identify Self",
289
- "ISO": None
290
  }
291
  },
292
  "maptask": {
@@ -316,7 +316,7 @@ LABELS_MAPPING = {
316
  },
317
  "align": {
318
  "base": "Check Attention",
319
- "ISO": None
320
  },
321
  "query_yn": {
322
  "base": "Yes-No-Question",
@@ -370,11 +370,11 @@ LABELS_MAPPING = {
370
  },
371
  "%": {
372
  "base": "Interrupted/Abandoned/Uninterpretable",
373
- "ISO": None
374
  },
375
  "rt": {
376
  "base": "Rising Tone",
377
- "ISO": None
378
  },
379
  "fg": {
380
  "base": "Floor Grabber",
@@ -410,7 +410,7 @@ LABELS_MAPPING = {
410
  },
411
  "2": {
412
  "base": "Collaborative Completion",
413
- "ISO": None
414
  },
415
  "no": {
416
  "base": "Other Answers",
@@ -434,7 +434,7 @@ LABELS_MAPPING = {
434
  },
435
  "j": {
436
  "base": "Humorous Material",
437
- "ISO": None
438
  },
439
  "bd": {
440
  "base": "Downplayer",
@@ -450,7 +450,7 @@ LABELS_MAPPING = {
450
  },
451
  "am": {
452
  "base": "Maybe",
453
- "ISO": None
454
  },
455
  "qrr": {
456
  "base": "Or-Clause",
@@ -462,7 +462,7 @@ LABELS_MAPPING = {
462
  },
463
  "m": {
464
  "base": "Mimic Other",
465
- "ISO": None
466
  },
467
  "fa": {
468
  "base": "Apology",
@@ -470,7 +470,7 @@ LABELS_MAPPING = {
470
  },
471
  "t": {
472
  "base": "About-task",
473
- "ISO": None
474
  },
475
  "br": {
476
  "base": "Signal-non-understanding",
@@ -478,7 +478,7 @@ LABELS_MAPPING = {
478
  },
479
  "aap": {
480
  "base": "Accept-part",
481
- "ISO": None
482
  },
483
  "qh": {
484
  "base": "Rhetorical-Question",
@@ -494,11 +494,11 @@ LABELS_MAPPING = {
494
  },
495
  "t1": {
496
  "base": "Self-talk",
497
- "ISO": None
498
  },
499
  "t3": {
500
  "base": "3rd-party-talk",
501
- "ISO": None
502
  },
503
  "bh": {
504
  "base": "Rhetorical-question Continue",
@@ -506,11 +506,11 @@ LABELS_MAPPING = {
506
  },
507
  "bsc": {
508
  "base": "Reject-part",
509
- "ISO": None
510
  },
511
  "arp": {
512
  "base": "Misspeak Self-Correction",
513
- "ISO": None
514
  },
515
  "bs": {
516
  "base": "Reformulate/Summarize",
@@ -518,7 +518,7 @@ LABELS_MAPPING = {
518
  },
519
  "f": {
520
  "base": "Follow Me",
521
- "ISO": None
522
  },
523
  "qr": {
524
  "base": "Or-Question",
@@ -534,11 +534,11 @@ LABELS_MAPPING = {
534
  },
535
  "qo": {
536
  "base": "Open-Question",
537
- "ISO": None
538
  },
539
  "bc": {
540
  "base": "Correct-misspeaking",
541
- "ISO": None
542
  },
543
  "by": {
544
  "base": "Sympathy",
@@ -564,7 +564,7 @@ LABELS_MAPPING = {
564
  },
565
  "%": {
566
  "base": "Uninterpretable",
567
- "ISO": None
568
  },
569
  "aa": {
570
  "base": "Agree/Accept",
@@ -612,7 +612,7 @@ LABELS_MAPPING = {
612
  },
613
  "^q": {
614
  "base": "Quotation",
615
- "ISO": None
616
  },
617
  "bf": {
618
  "base": "Summarize/Reformulate",
@@ -632,7 +632,7 @@ LABELS_MAPPING = {
632
  },
633
  "o_\"_bc": {
634
  "base": "Other",
635
- "ISO": None
636
  },
637
  "na": {
638
  "base": "Affirmative Non-yes Answers",
@@ -644,7 +644,7 @@ LABELS_MAPPING = {
644
  },
645
  "^2": {
646
  "base": "Collaborative Completion",
647
- "ISO": None
648
  },
649
  "b^m": {
650
  "base": "Repeat-phrase",
@@ -652,7 +652,7 @@ LABELS_MAPPING = {
652
  },
653
  "qo": {
654
  "base": "Open-Question",
655
- "ISO": None
656
  },
657
  "qh": {
658
  "base": "Rhetorical-Question",
@@ -692,7 +692,7 @@ LABELS_MAPPING = {
692
  },
693
  "t3": {
694
  "base": "3rd-party-talk",
695
- "ISO": None
696
  },
697
  "oo": {
698
  "base": "Offers",
@@ -704,7 +704,7 @@ LABELS_MAPPING = {
704
  },
705
  "aap_am": {
706
  "base": "Maybe/Accept-part",
707
- "ISO": None
708
  },
709
  "t1": {
710
  "base": "Downplayer",
@@ -712,7 +712,7 @@ LABELS_MAPPING = {
712
  },
713
  "bd": {
714
  "base": "Self-talk",
715
- "ISO": None
716
  },
717
  "^g": {
718
  "base": "Tag-Question",
@@ -762,7 +762,7 @@ LABELS_MAPPING = {
762
  },
763
  "switch_frame": {
764
  "base": "Switch Frame",
765
- "ISO": None
766
  },
767
  "offer": {
768
  "base": "Offer",
@@ -774,7 +774,7 @@ LABELS_MAPPING = {
774
  },
775
  "null": {
776
  "base": "Other",
777
- "ISO": None
778
  },
779
  "goodbye": {
780
  "base": "Goodbye",
@@ -786,7 +786,7 @@ LABELS_MAPPING = {
786
  },
787
  "no_result": {
788
  "base": "No Result",
789
- "ISO": None
790
  },
791
  "affirm": {
792
  "base": "Affirm",
@@ -802,11 +802,11 @@ LABELS_MAPPING = {
802
  },
803
  "hearmore": {
804
  "base": "Hear More",
805
- "ISO": None
806
  },
807
  "canthelp": {
808
  "base": "Can not help",
809
- "ISO": None
810
  },
811
  "you_are_welcome": {
812
  "base": "Welcome",
@@ -818,7 +818,7 @@ LABELS_MAPPING = {
818
  },
819
  None: {
820
  "base": "None",
821
- "ISO": None
822
  }
823
  },
824
  "dyda": {
@@ -836,7 +836,7 @@ LABELS_MAPPING = {
836
  },
837
  "question": {
838
  "base": "Question",
839
- "ISO": None
840
  }
841
  },
842
  "dstc3": {
@@ -850,7 +850,7 @@ LABELS_MAPPING = {
850
  },
851
  "select": {
852
  "base": "Select",
853
- "ISO": None
854
  },
855
  "expl-conf": {
856
  "base": "Explicit Confirmation",
@@ -862,7 +862,7 @@ LABELS_MAPPING = {
862
  },
863
  "canthelp": {
864
  "base": "Can not help",
865
- "ISO": None
866
  },
867
  "request": {
868
  "base": "Request",
@@ -886,7 +886,7 @@ LABELS_MAPPING = {
886
  },
887
  "null": {
888
  "base": "Other",
889
- "ISO": None
890
  },
891
  "reqalts": {
892
  "base": "Request Alternative",
@@ -894,11 +894,11 @@ LABELS_MAPPING = {
894
  },
895
  "canthelp.missing_slot_value": {
896
  "base": "Can not help",
897
- "ISO": None
898
  },
899
  "restart": {
900
  "base": "Restart",
901
- "ISO": None
902
  },
903
  "ack": {
904
  "base": "Acknowledge",
@@ -926,7 +926,7 @@ LABELS_MAPPING = {
926
  },
927
  None: {
928
  "base": "None",
929
- "ISO": None
930
  }
931
  },
932
  "dstc8-sgd": {
@@ -980,7 +980,7 @@ LABELS_MAPPING = {
980
  },
981
  "SELECT": {
982
  "base": "Select",
983
- "ISO": None
984
  },
985
  "OFFER_INTENT": {
986
  "base": "Offer Intent",
@@ -1382,7 +1382,10 @@ class DAISO(datasets.GeneratorBasedBuilder):
1382
  # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
1383
  features = {feature: datasets.Value("string") for feature in self.config.features}
1384
  if self.config.label_classes:
1385
- features["Label"] = datasets.features.ClassLabel(names=list(self.config.label_classes.keys()))
 
 
 
1386
  features["Label_ISO"] = datasets.features.ClassLabel(
1387
  names=list(set([map.get("ISO") for map in self.config.label_classes.values()])))
1388
  features["Idx"] = datasets.Value("int32")
@@ -1454,8 +1457,8 @@ class DAISO(datasets.GeneratorBasedBuilder):
1454
  df = pd.read_csv(file, delimiter=",", header=0, quotechar='"', dtype=str)[
1455
  self.config.features
1456
  ]
1457
- df['Dialogue_Act'] = df['Dialogue_Act'].apply(lambda x: None if pd.isna(x) else x)
1458
- df['Dialogue_Act_ISO'] = df['Dialogue_Act_ISO'].apply(lambda x: None if pd.isna(x) else x)
1459
 
1460
  rows = df.to_dict(orient="records")
1461
 
 
60
  },
61
  "stl": {
62
  "base": "Stall",
63
+ "ISO": "OOD"
64
  },
65
  "fra": {
66
  "base": "Fragment",
67
+ "ISO": "OOD"
68
  },
69
  "inf": {
70
  "base": "Inform",
 
80
  },
81
  "el.inf": {
82
  "base": "Elicit-Inform",
83
+ "ISO": "OOD"
84
  },
85
  "el.sug": {
86
  "base": "Elicit-Offer-Or-Suggestion",
 
88
  },
89
  "el.ass": {
90
  "base": "Elicit-Assessment",
91
+ "ISO": "OOD"
92
  },
93
  "el.und": {
94
  "base": "Elicit-Comment-Understanding",
95
+ "ISO": "OOD"
96
  },
97
  "off": {
98
  "base": "Offer",
 
104
  },
105
  "be.pos": {
106
  "base": "Be-Positive",
107
+ "ISO": "OOD"
108
  },
109
  "be.neg": {
110
  "base": "Be-Negative",
111
+ "ISO": "OOD"
112
  },
113
  "oth": {
114
  "base": "Other",
115
+ "ISO": "OOD"
116
  },
117
  None: {
118
+ "base": "OOD",
119
+ "ISO": "OOD"
120
  }
121
  },
122
  "oasis": {
 
202
  },
203
  "refer": {
204
  "base": "Refer",
205
+ "ISO": "OOD"
206
  },
207
  "suggest": {
208
  "base": "Suggest",
 
218
  },
219
  "exclaim": {
220
  "base": "Exclaim",
221
+ "ISO": "OOD"
222
  },
223
  "pardon": {
224
  "base": "Pardon",
 
226
  },
227
  "identifySelf": {
228
  "base": "Identify Self",
229
+ "ISO": "OOD"
230
  },
231
  "expressPossibility": {
232
  "base": "Express Possibility",
 
234
  },
235
  "raiseIssue": {
236
  "base": "Raise Issue",
237
+ "ISO": "OOD"
238
  },
239
  "expressWish": {
240
  "base": "Express Wish",
 
246
  },
247
  "complete": {
248
  "base": "Complete",
249
+ "ISO": "OOD"
250
  },
251
  "directElab": {
252
  "base": "Direct Elaborate",
 
254
  },
255
  "correct": {
256
  "base": "Correct",
257
+ "ISO": "OOD"
258
  },
259
  "refuse": {
260
  "base": "Refuse",
261
+ "ISO": "OOD"
262
  },
263
  "informIntent-hold": {
264
  "base": "Inform Intent Hold",
265
+ "ISO": "OOD"
266
  },
267
  "informDisc": {
268
  "base": "Inform Continue",
269
+ "ISO": "OOD"
270
  },
271
  "informCont": {
272
  "base": "Inform Discontinue",
273
+ "ISO": "OOD"
274
  },
275
  "selfTalk": {
276
  "base": "Self Talk",
277
+ "ISO": "OOD"
278
  },
279
  "correctSelf": {
280
  "base": "Correct Self",
 
282
  },
283
  "expressRegret-inform": {
284
  "base": "Express Regret Inform",
285
+ "ISO": "OOD"
286
  },
287
  "thank-identifySelf": {
288
  "base": "Thank Identify Self",
289
+ "ISO": "OOD"
290
  }
291
  },
292
  "maptask": {
 
316
  },
317
  "align": {
318
  "base": "Check Attention",
319
+ "ISO": "OOD"
320
  },
321
  "query_yn": {
322
  "base": "Yes-No-Question",
 
370
  },
371
  "%": {
372
  "base": "Interrupted/Abandoned/Uninterpretable",
373
+ "ISO": "OOD"
374
  },
375
  "rt": {
376
  "base": "Rising Tone",
377
+ "ISO": "OOD"
378
  },
379
  "fg": {
380
  "base": "Floor Grabber",
 
410
  },
411
  "2": {
412
  "base": "Collaborative Completion",
413
+ "ISO": "OOD"
414
  },
415
  "no": {
416
  "base": "Other Answers",
 
434
  },
435
  "j": {
436
  "base": "Humorous Material",
437
+ "ISO": "OOD"
438
  },
439
  "bd": {
440
  "base": "Downplayer",
 
450
  },
451
  "am": {
452
  "base": "Maybe",
453
+ "ISO": "OOD"
454
  },
455
  "qrr": {
456
  "base": "Or-Clause",
 
462
  },
463
  "m": {
464
  "base": "Mimic Other",
465
+ "ISO": "OOD"
466
  },
467
  "fa": {
468
  "base": "Apology",
 
470
  },
471
  "t": {
472
  "base": "About-task",
473
+ "ISO": "OOD"
474
  },
475
  "br": {
476
  "base": "Signal-non-understanding",
 
478
  },
479
  "aap": {
480
  "base": "Accept-part",
481
+ "ISO": "OOD"
482
  },
483
  "qh": {
484
  "base": "Rhetorical-Question",
 
494
  },
495
  "t1": {
496
  "base": "Self-talk",
497
+ "ISO": "OOD"
498
  },
499
  "t3": {
500
  "base": "3rd-party-talk",
501
+ "ISO": "OOD"
502
  },
503
  "bh": {
504
  "base": "Rhetorical-question Continue",
 
506
  },
507
  "bsc": {
508
  "base": "Reject-part",
509
+ "ISO": "OOD"
510
  },
511
  "arp": {
512
  "base": "Misspeak Self-Correction",
513
+ "ISO": "OOD"
514
  },
515
  "bs": {
516
  "base": "Reformulate/Summarize",
 
518
  },
519
  "f": {
520
  "base": "Follow Me",
521
+ "ISO": "OOD"
522
  },
523
  "qr": {
524
  "base": "Or-Question",
 
534
  },
535
  "qo": {
536
  "base": "Open-Question",
537
+ "ISO": "OOD"
538
  },
539
  "bc": {
540
  "base": "Correct-misspeaking",
541
+ "ISO": "OOD"
542
  },
543
  "by": {
544
  "base": "Sympathy",
 
564
  },
565
  "%": {
566
  "base": "Uninterpretable",
567
+ "ISO": "OOD"
568
  },
569
  "aa": {
570
  "base": "Agree/Accept",
 
612
  },
613
  "^q": {
614
  "base": "Quotation",
615
+ "ISO": "OOD"
616
  },
617
  "bf": {
618
  "base": "Summarize/Reformulate",
 
632
  },
633
  "o_\"_bc": {
634
  "base": "Other",
635
+ "ISO": "OOD"
636
  },
637
  "na": {
638
  "base": "Affirmative Non-yes Answers",
 
644
  },
645
  "^2": {
646
  "base": "Collaborative Completion",
647
+ "ISO": "OOD"
648
  },
649
  "b^m": {
650
  "base": "Repeat-phrase",
 
652
  },
653
  "qo": {
654
  "base": "Open-Question",
655
+ "ISO": "OOD"
656
  },
657
  "qh": {
658
  "base": "Rhetorical-Question",
 
692
  },
693
  "t3": {
694
  "base": "3rd-party-talk",
695
+ "ISO": "OOD"
696
  },
697
  "oo": {
698
  "base": "Offers",
 
704
  },
705
  "aap_am": {
706
  "base": "Maybe/Accept-part",
707
+ "ISO": "OOD"
708
  },
709
  "t1": {
710
  "base": "Downplayer",
 
712
  },
713
  "bd": {
714
  "base": "Self-talk",
715
+ "ISO": "OOD"
716
  },
717
  "^g": {
718
  "base": "Tag-Question",
 
762
  },
763
  "switch_frame": {
764
  "base": "Switch Frame",
765
+ "ISO": "OOD"
766
  },
767
  "offer": {
768
  "base": "Offer",
 
774
  },
775
  "null": {
776
  "base": "Other",
777
+ "ISO": "OOD"
778
  },
779
  "goodbye": {
780
  "base": "Goodbye",
 
786
  },
787
  "no_result": {
788
  "base": "No Result",
789
+ "ISO": "OOD"
790
  },
791
  "affirm": {
792
  "base": "Affirm",
 
802
  },
803
  "hearmore": {
804
  "base": "Hear More",
805
+ "ISO": "OOD"
806
  },
807
  "canthelp": {
808
  "base": "Can not help",
809
+ "ISO": "OOD"
810
  },
811
  "you_are_welcome": {
812
  "base": "Welcome",
 
818
  },
819
  None: {
820
  "base": "None",
821
+ "ISO": "OOD"
822
  }
823
  },
824
  "dyda": {
 
836
  },
837
  "question": {
838
  "base": "Question",
839
+ "ISO": "OOD"
840
  }
841
  },
842
  "dstc3": {
 
850
  },
851
  "select": {
852
  "base": "Select",
853
+ "ISO": "OOD"
854
  },
855
  "expl-conf": {
856
  "base": "Explicit Confirmation",
 
862
  },
863
  "canthelp": {
864
  "base": "Can not help",
865
+ "ISO": "OOD"
866
  },
867
  "request": {
868
  "base": "Request",
 
886
  },
887
  "null": {
888
  "base": "Other",
889
+ "ISO": "OOD"
890
  },
891
  "reqalts": {
892
  "base": "Request Alternative",
 
894
  },
895
  "canthelp.missing_slot_value": {
896
  "base": "Can not help",
897
+ "ISO": "OOD"
898
  },
899
  "restart": {
900
  "base": "Restart",
901
+ "ISO": "OOD"
902
  },
903
  "ack": {
904
  "base": "Acknowledge",
 
926
  },
927
  None: {
928
  "base": "None",
929
+ "ISO": "OOD"
930
  }
931
  },
932
  "dstc8-sgd": {
 
980
  },
981
  "SELECT": {
982
  "base": "Select",
983
+ "ISO": "OOD"
984
  },
985
  "OFFER_INTENT": {
986
  "base": "Offer Intent",
 
1382
  # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
1383
  features = {feature: datasets.Value("string") for feature in self.config.features}
1384
  if self.config.label_classes:
1385
+ features["Label"] = datasets.features.ClassLabel(names=list(
1386
+ set(['OOD' if label == 'null' or label is None else label for label in
1387
+ list(self.config.label_classes.keys())])
1388
+ ))
1389
  features["Label_ISO"] = datasets.features.ClassLabel(
1390
  names=list(set([map.get("ISO") for map in self.config.label_classes.values()])))
1391
  features["Idx"] = datasets.Value("int32")
 
1457
  df = pd.read_csv(file, delimiter=",", header=0, quotechar='"', dtype=str)[
1458
  self.config.features
1459
  ]
1460
+ df['Dialogue_Act'] = df['Dialogue_Act'].apply(lambda x: "OOD" if pd.isna(x) else x)
1461
+ df['Dialogue_Act_ISO'] = df['Dialogue_Act_ISO'].apply(lambda x: "OOD" if pd.isna(x) else x)
1462
 
1463
  rows = df.to_dict(orient="records")
1464