holylovenia commited on
Commit
e7e7eee
1 Parent(s): eef48bb

Upload xsid.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. xsid.py +17 -17
xsid.py CHANGED
@@ -3,9 +3,9 @@ from typing import List
3
 
4
  import datasets
5
 
6
- from nusacrowd.utils import schemas
7
- from nusacrowd.utils.configs import NusantaraConfig
8
- from nusacrowd.utils.constants import Tasks
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
- _NUSANTARA_VERSION = "1.0.0"
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
- NusantaraConfig(
136
  name="xsid_source",
137
  version=datasets.Version(_SOURCE_VERSION),
138
  description="xSID source schema",
139
  schema="source",
140
  subset_id="xsid",
141
  ),
142
- NusantaraConfig(
143
- name="xsid_nusantara_text",
144
- version=datasets.Version(_NUSANTARA_VERSION),
145
  description="xSID Nusantara intent classification schema",
146
- schema="nusantara_text",
147
  subset_id="xsid",
148
  ),
149
- NusantaraConfig(
150
- name="xsid_nusantara_seq_label",
151
- version=datasets.Version(_NUSANTARA_VERSION),
152
  description="xSID Nusantara pos tagging schema",
153
- schema="nusantara_seq_label",
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 == "nusantara_text":
172
  features = schemas.text_features(label_names=INTENT_LIST)
173
- elif self.config.schema == "nusantara_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,7 +243,7 @@ class XSID(datasets.GeneratorBasedBuilder):
243
  }
244
  yield id, ex
245
 
246
- elif self.config.name == "xsid_nusantara_text":
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 == "xsid_nusantara_seq_label":
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