Igor
commited on
Commit
·
3a1843e
1
Parent(s):
34e43aa
minor(dev): test mapping
Browse files
daiso.py
CHANGED
@@ -56,7 +56,7 @@ _URL = "https://raw.githubusercontent.com/igorktech/DAISO-benchmark/dev"
|
|
56 |
class DAISOConfig(datasets.BuilderConfig):
|
57 |
"""BuilderConfig for DAISO."""
|
58 |
|
59 |
-
def __init__(self, features, data_url, citation, url, **kwargs):
|
60 |
"""BuilderConfig for DAISO.
|
61 |
Args:
|
62 |
features: `list[string]`, list of the features that will appear in the
|
@@ -70,7 +70,7 @@ class DAISOConfig(datasets.BuilderConfig):
|
|
70 |
**kwargs: keyword arguments forwarded to super.
|
71 |
"""
|
72 |
super(DAISOConfig, self).__init__(version=_VERSION, **kwargs)
|
73 |
-
|
74 |
self.features = features
|
75 |
self.data_url = data_url
|
76 |
self.citation = citation
|
@@ -99,6 +99,24 @@ class DAISO(datasets.GeneratorBasedBuilder):
|
|
99 |
"""\
|
100 |
"""
|
101 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
features=[
|
103 |
"Utterance",
|
104 |
"Dialogue_Act",
|
@@ -129,6 +147,8 @@ class DAISO(datasets.GeneratorBasedBuilder):
|
|
129 |
def _info(self):
|
130 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
131 |
features = {feature: datasets.Value("string") for feature in self.config.features}
|
|
|
|
|
132 |
features["Idx"] = datasets.Value("int32")
|
133 |
# if self.config.name == "": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
134 |
# features = datasets.Features(
|
@@ -206,6 +226,7 @@ class DAISO(datasets.GeneratorBasedBuilder):
|
|
206 |
|
207 |
if "Dialogue_Act" in example:
|
208 |
label = example["Dialogue_Act"]
|
209 |
-
|
|
|
210 |
|
211 |
yield example["Idx"], example
|
|
|
56 |
class DAISOConfig(datasets.BuilderConfig):
|
57 |
"""BuilderConfig for DAISO."""
|
58 |
|
59 |
+
def __init__(self,label_classes, features, data_url, citation, url, **kwargs):
|
60 |
"""BuilderConfig for DAISO.
|
61 |
Args:
|
62 |
features: `list[string]`, list of the features that will appear in the
|
|
|
70 |
**kwargs: keyword arguments forwarded to super.
|
71 |
"""
|
72 |
super(DAISOConfig, self).__init__(version=_VERSION, **kwargs)
|
73 |
+
self.label_classes = label_classes
|
74 |
self.features = features
|
75 |
self.data_url = data_url
|
76 |
self.citation = citation
|
|
|
99 |
"""\
|
100 |
"""
|
101 |
),
|
102 |
+
label_classes =
|
103 |
+
{"commissive": {
|
104 |
+
"base": "Commissive",
|
105 |
+
"ISO": "commissive"
|
106 |
+
},
|
107 |
+
"directive": {
|
108 |
+
"base": "Directive",
|
109 |
+
"ISO": "directive"
|
110 |
+
},
|
111 |
+
"inform": {
|
112 |
+
"base": "Inform",
|
113 |
+
"ISO": "inform"
|
114 |
+
},
|
115 |
+
"question": {
|
116 |
+
"base": "Question",
|
117 |
+
"ISO": ""
|
118 |
+
}
|
119 |
+
},
|
120 |
features=[
|
121 |
"Utterance",
|
122 |
"Dialogue_Act",
|
|
|
147 |
def _info(self):
|
148 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
149 |
features = {feature: datasets.Value("string") for feature in self.config.features}
|
150 |
+
if self.config.label_classes:
|
151 |
+
features["Label"] = datasets.features.ClassLabel(names=self.config.label_classes.keys())
|
152 |
features["Idx"] = datasets.Value("int32")
|
153 |
# if self.config.name == "": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
154 |
# features = datasets.Features(
|
|
|
226 |
|
227 |
if "Dialogue_Act" in example:
|
228 |
label = example["Dialogue_Act"]
|
229 |
+
example["Label"] = label
|
230 |
+
example["Label_ISO"] = self.config.label_classes.get(label).get("ISO")
|
231 |
|
232 |
yield example["Idx"], example
|