Datasets:

Languages:
Indonesian
ArXiv:
holylovenia commited on
Commit
94f0378
·
verified ·
1 Parent(s): 726aec3

Upload indolem_ud_id_pud.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. indolem_ud_id_pud.py +20 -20
indolem_ud_id_pud.py CHANGED
@@ -19,10 +19,10 @@ from typing import Dict, List, Tuple
19
 
20
  import datasets
21
 
22
- from nusacrowd.utils import schemas
23
- from nusacrowd.utils.common_parser import load_ud_data, load_ud_data_as_nusantara_kb
24
- from nusacrowd.utils.configs import NusantaraConfig
25
- from nusacrowd.utils.constants import Tasks
26
 
27
  _CITATION = """\
28
  @conference{2f8c7438a7f44f6b85b773586cff54e8,
@@ -86,49 +86,49 @@ _SUPPORTED_TASKS = [Tasks.DEPENDENCY_PARSING]
86
 
87
  _SOURCE_VERSION = "1.0.0"
88
 
89
- _NUSANTARA_VERSION = "1.0.0"
90
 
91
 
92
  class IndolemUDIDPUDDataset(datasets.GeneratorBasedBuilder):
93
  SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
94
- NUSANTARA_VERSION = datasets.Version(_NUSANTARA_VERSION)
95
 
96
  BUILDER_CONFIGS = list(
97
  chain(
98
  (
99
- NusantaraConfig(
100
  name=f"{_DATASETNAME}_source",
101
  version=SOURCE_VERSION,
102
  description=f"{_DATASETNAME} default fold ('{_DEFAULT_FOLD}') of source schema",
103
  schema="source",
104
  subset_id=f"{_DATASETNAME}_{_DEFAULT_FOLD}",
105
  ),
106
- NusantaraConfig(
107
- name=f"{_DATASETNAME}_nusantara_kb",
108
- version=NUSANTARA_VERSION,
109
  description=f"{_DATASETNAME} default fold ('{_DEFAULT_FOLD}') of Nusantara KB schema",
110
- schema="nusantara_kb",
111
  subset_id=f"{_DATASETNAME}_{_DEFAULT_FOLD}",
112
  ),
113
  ),
114
  *(
115
  (
116
- NusantaraConfig(
117
  name=f"{_DATASETNAME}_{fold}_source",
118
  version=ver_src,
119
  description=f"{_DATASETNAME} fold '{fold}' of source schema",
120
  schema="source",
121
  subset_id=f"{_DATASETNAME}_{fold}",
122
  ),
123
- NusantaraConfig(
124
- name=f"{_DATASETNAME}_{fold}_nusantara_kb",
125
  version=ver_nusa,
126
  description=f"{_DATASETNAME} fold '{fold}' of Nusantara KB schema",
127
- schema="nusantara_kb",
128
  subset_id=f"{_DATASETNAME}_{fold}",
129
  ),
130
  )
131
- for fold, ver_src, ver_nusa in zip(_FOLDS, repeat(SOURCE_VERSION), repeat(NUSANTARA_VERSION))
132
  ),
133
  )
134
  )
@@ -158,7 +158,7 @@ class IndolemUDIDPUDDataset(datasets.GeneratorBasedBuilder):
158
  }
159
  )
160
 
161
- elif self.config.schema == "nusantara_kb":
162
  features = schemas.kb_features
163
 
164
  else:
@@ -205,7 +205,7 @@ class IndolemUDIDPUDDataset(datasets.GeneratorBasedBuilder):
205
  try:
206
  generator_fn = {
207
  "source": load_ud_data,
208
- "nusantara_kb": load_ud_data_as_nusantara_kb,
209
  }[self.config.schema]
210
  except KeyError:
211
  raise NotImplementedError(f"Schema '{self.config.schema}' is not defined.")
@@ -216,7 +216,7 @@ class IndolemUDIDPUDDataset(datasets.GeneratorBasedBuilder):
216
 
217
  # if __name__ == "__main__":
218
  # datasets.load_dataset(__file__, name=f"indolem_ud_id_pud_source")
219
- # datasets.load_dataset(__file__, name=f"indolem_ud_id_pud_nusantara_kb")
220
  # for fold in _FOLDS:
221
  # datasets.load_dataset(__file__, name=f"indolem_ud_id_pud_{fold}_source")
222
- # datasets.load_dataset(__file__, name=f"indolem_ud_id_pud_{fold}_nusantara_kb")
 
19
 
20
  import datasets
21
 
22
+ from seacrowd.utils import schemas
23
+ from seacrowd.utils.common_parser import load_ud_data, load_ud_data_as_seacrowd_kb
24
+ from seacrowd.utils.configs import SEACrowdConfig
25
+ from seacrowd.utils.constants import Tasks
26
 
27
  _CITATION = """\
28
  @conference{2f8c7438a7f44f6b85b773586cff54e8,
 
86
 
87
  _SOURCE_VERSION = "1.0.0"
88
 
89
+ _SEACROWD_VERSION = "2024.06.20"
90
 
91
 
92
  class IndolemUDIDPUDDataset(datasets.GeneratorBasedBuilder):
93
  SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
94
+ SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
95
 
96
  BUILDER_CONFIGS = list(
97
  chain(
98
  (
99
+ SEACrowdConfig(
100
  name=f"{_DATASETNAME}_source",
101
  version=SOURCE_VERSION,
102
  description=f"{_DATASETNAME} default fold ('{_DEFAULT_FOLD}') of source schema",
103
  schema="source",
104
  subset_id=f"{_DATASETNAME}_{_DEFAULT_FOLD}",
105
  ),
106
+ SEACrowdConfig(
107
+ name=f"{_DATASETNAME}_seacrowd_kb",
108
+ version=SEACROWD_VERSION,
109
  description=f"{_DATASETNAME} default fold ('{_DEFAULT_FOLD}') of Nusantara KB schema",
110
+ schema="seacrowd_kb",
111
  subset_id=f"{_DATASETNAME}_{_DEFAULT_FOLD}",
112
  ),
113
  ),
114
  *(
115
  (
116
+ SEACrowdConfig(
117
  name=f"{_DATASETNAME}_{fold}_source",
118
  version=ver_src,
119
  description=f"{_DATASETNAME} fold '{fold}' of source schema",
120
  schema="source",
121
  subset_id=f"{_DATASETNAME}_{fold}",
122
  ),
123
+ SEACrowdConfig(
124
+ name=f"{_DATASETNAME}_{fold}_seacrowd_kb",
125
  version=ver_nusa,
126
  description=f"{_DATASETNAME} fold '{fold}' of Nusantara KB schema",
127
+ schema="seacrowd_kb",
128
  subset_id=f"{_DATASETNAME}_{fold}",
129
  ),
130
  )
131
+ for fold, ver_src, ver_nusa in zip(_FOLDS, repeat(SOURCE_VERSION), repeat(SEACROWD_VERSION))
132
  ),
133
  )
134
  )
 
158
  }
159
  )
160
 
161
+ elif self.config.schema == "seacrowd_kb":
162
  features = schemas.kb_features
163
 
164
  else:
 
205
  try:
206
  generator_fn = {
207
  "source": load_ud_data,
208
+ "seacrowd_kb": load_ud_data_as_seacrowd_kb,
209
  }[self.config.schema]
210
  except KeyError:
211
  raise NotImplementedError(f"Schema '{self.config.schema}' is not defined.")
 
216
 
217
  # if __name__ == "__main__":
218
  # datasets.load_dataset(__file__, name=f"indolem_ud_id_pud_source")
219
+ # datasets.load_dataset(__file__, name=f"indolem_ud_id_pud_seacrowd_kb")
220
  # for fold in _FOLDS:
221
  # datasets.load_dataset(__file__, name=f"indolem_ud_id_pud_{fold}_source")
222
+ # datasets.load_dataset(__file__, name=f"indolem_ud_id_pud_{fold}_seacrowd_kb")