holylovenia
commited on
Commit
•
e7e7eee
1
Parent(s):
eef48bb
Upload xsid.py with huggingface_hub
Browse files
xsid.py
CHANGED
@@ -3,9 +3,9 @@ from typing import List
|
|
3 |
|
4 |
import datasets
|
5 |
|
6 |
-
from
|
7 |
-
from
|
8 |
-
from
|
9 |
|
10 |
_CITATION = """\
|
11 |
@inproceedings{van-der-goot-etal-2020-cross,
|
@@ -30,7 +30,7 @@ _URLS = {
|
|
30 |
}
|
31 |
_SUPPORTED_TASKS = [Tasks.INTENT_CLASSIFICATION, Tasks.POS_TAGGING]
|
32 |
_SOURCE_VERSION = "0.3.0"
|
33 |
-
|
34 |
|
35 |
INTENT_LIST = [
|
36 |
"AddToPlaylist",
|
@@ -132,25 +132,25 @@ class XSID(datasets.GeneratorBasedBuilder):
|
|
132 |
"""xSID datasets contains datasets to detect the intent from the text"""
|
133 |
|
134 |
BUILDER_CONFIGS = [
|
135 |
-
|
136 |
name="xsid_source",
|
137 |
version=datasets.Version(_SOURCE_VERSION),
|
138 |
description="xSID source schema",
|
139 |
schema="source",
|
140 |
subset_id="xsid",
|
141 |
),
|
142 |
-
|
143 |
-
name="
|
144 |
-
version=datasets.Version(
|
145 |
description="xSID Nusantara intent classification schema",
|
146 |
-
schema="
|
147 |
subset_id="xsid",
|
148 |
),
|
149 |
-
|
150 |
-
name="
|
151 |
-
version=datasets.Version(
|
152 |
description="xSID Nusantara pos tagging schema",
|
153 |
-
schema="
|
154 |
subset_id="xsid",
|
155 |
),
|
156 |
]
|
@@ -168,9 +168,9 @@ class XSID(datasets.GeneratorBasedBuilder):
|
|
168 |
"tokens": datasets.Sequence(datasets.Value("string")),
|
169 |
}
|
170 |
)
|
171 |
-
elif self.config.schema == "
|
172 |
features = schemas.text_features(label_names=INTENT_LIST)
|
173 |
-
elif self.config.schema == "
|
174 |
features = schemas.seq_label_features(label_names=TAG_LIST)
|
175 |
else:
|
176 |
raise ValueError(f"Invalid config schema: {self.config.schema}")
|
@@ -243,7 +243,7 @@ class XSID(datasets.GeneratorBasedBuilder):
|
|
243 |
}
|
244 |
yield id, ex
|
245 |
|
246 |
-
elif self.config.name == "
|
247 |
with open(filepath, "r") as file:
|
248 |
data = file.read().strip("\n").split("\n\n")
|
249 |
|
@@ -270,7 +270,7 @@ class XSID(datasets.GeneratorBasedBuilder):
|
|
270 |
}
|
271 |
yield id, ex
|
272 |
|
273 |
-
elif self.config.name == "
|
274 |
with open(filepath, "r") as file:
|
275 |
data = file.read().strip("\n").split("\n\n")
|
276 |
|
|
|
3 |
|
4 |
import datasets
|
5 |
|
6 |
+
from seacrowd.utils import schemas
|
7 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
8 |
+
from seacrowd.utils.constants import Tasks
|
9 |
|
10 |
_CITATION = """\
|
11 |
@inproceedings{van-der-goot-etal-2020-cross,
|
|
|
30 |
}
|
31 |
_SUPPORTED_TASKS = [Tasks.INTENT_CLASSIFICATION, Tasks.POS_TAGGING]
|
32 |
_SOURCE_VERSION = "0.3.0"
|
33 |
+
_SEACROWD_VERSION = "2024.06.20"
|
34 |
|
35 |
INTENT_LIST = [
|
36 |
"AddToPlaylist",
|
|
|
132 |
"""xSID datasets contains datasets to detect the intent from the text"""
|
133 |
|
134 |
BUILDER_CONFIGS = [
|
135 |
+
SEACrowdConfig(
|
136 |
name="xsid_source",
|
137 |
version=datasets.Version(_SOURCE_VERSION),
|
138 |
description="xSID source schema",
|
139 |
schema="source",
|
140 |
subset_id="xsid",
|
141 |
),
|
142 |
+
SEACrowdConfig(
|
143 |
+
name="xsid_seacrowd_text",
|
144 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
145 |
description="xSID Nusantara intent classification schema",
|
146 |
+
schema="seacrowd_text",
|
147 |
subset_id="xsid",
|
148 |
),
|
149 |
+
SEACrowdConfig(
|
150 |
+
name="xsid_seacrowd_seq_label",
|
151 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
152 |
description="xSID Nusantara pos tagging schema",
|
153 |
+
schema="seacrowd_seq_label",
|
154 |
subset_id="xsid",
|
155 |
),
|
156 |
]
|
|
|
168 |
"tokens": datasets.Sequence(datasets.Value("string")),
|
169 |
}
|
170 |
)
|
171 |
+
elif self.config.schema == "seacrowd_text":
|
172 |
features = schemas.text_features(label_names=INTENT_LIST)
|
173 |
+
elif self.config.schema == "seacrowd_seq_label":
|
174 |
features = schemas.seq_label_features(label_names=TAG_LIST)
|
175 |
else:
|
176 |
raise ValueError(f"Invalid config schema: {self.config.schema}")
|
|
|
243 |
}
|
244 |
yield id, ex
|
245 |
|
246 |
+
elif self.config.name == "xsid_seacrowd_text":
|
247 |
with open(filepath, "r") as file:
|
248 |
data = file.read().strip("\n").split("\n\n")
|
249 |
|
|
|
270 |
}
|
271 |
yield id, ex
|
272 |
|
273 |
+
elif self.config.name == "xsid_seacrowd_seq_label":
|
274 |
with open(filepath, "r") as file:
|
275 |
data = file.read().strip("\n").split("\n\n")
|
276 |
|