holylovenia
commited on
Upload indolem_ud_id_pud.py with huggingface_hub
Browse files- 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
|
23 |
-
from
|
24 |
-
from
|
25 |
-
from
|
26 |
|
27 |
_CITATION = """\
|
28 |
@conference{2f8c7438a7f44f6b85b773586cff54e8,
|
@@ -86,49 +86,49 @@ _SUPPORTED_TASKS = [Tasks.DEPENDENCY_PARSING]
|
|
86 |
|
87 |
_SOURCE_VERSION = "1.0.0"
|
88 |
|
89 |
-
|
90 |
|
91 |
|
92 |
class IndolemUDIDPUDDataset(datasets.GeneratorBasedBuilder):
|
93 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
94 |
-
|
95 |
|
96 |
BUILDER_CONFIGS = list(
|
97 |
chain(
|
98 |
(
|
99 |
-
|
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 |
-
|
107 |
-
name=f"{_DATASETNAME}
|
108 |
-
version=
|
109 |
description=f"{_DATASETNAME} default fold ('{_DEFAULT_FOLD}') of Nusantara KB schema",
|
110 |
-
schema="
|
111 |
subset_id=f"{_DATASETNAME}_{_DEFAULT_FOLD}",
|
112 |
),
|
113 |
),
|
114 |
*(
|
115 |
(
|
116 |
-
|
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 |
-
|
124 |
-
name=f"{_DATASETNAME}_{fold}
|
125 |
version=ver_nusa,
|
126 |
description=f"{_DATASETNAME} fold '{fold}' of Nusantara KB schema",
|
127 |
-
schema="
|
128 |
subset_id=f"{_DATASETNAME}_{fold}",
|
129 |
),
|
130 |
)
|
131 |
-
for fold, ver_src, ver_nusa in zip(_FOLDS, repeat(SOURCE_VERSION), repeat(
|
132 |
),
|
133 |
)
|
134 |
)
|
@@ -158,7 +158,7 @@ class IndolemUDIDPUDDataset(datasets.GeneratorBasedBuilder):
|
|
158 |
}
|
159 |
)
|
160 |
|
161 |
-
elif self.config.schema == "
|
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 |
-
"
|
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"
|
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}
|
|
|
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")
|