holylovenia
commited on
Commit
•
308447d
1
Parent(s):
2e45e4a
Upload singgalang.py with huggingface_hub
Browse files- singgalang.py +13 -13
singgalang.py
CHANGED
@@ -18,10 +18,10 @@ from typing import Dict, List, Tuple
|
|
18 |
|
19 |
import datasets
|
20 |
|
21 |
-
from
|
22 |
-
from
|
23 |
-
from
|
24 |
-
from
|
25 |
|
26 |
_CITATION = """\
|
27 |
@INPROCEEDINGS{8355036,
|
@@ -67,14 +67,14 @@ _SUPPORTED_TASKS = [Tasks.NAMED_ENTITY_RECOGNITION]
|
|
67 |
|
68 |
_SOURCE_VERSION = "1.0.0"
|
69 |
|
70 |
-
|
71 |
|
72 |
|
73 |
class SinggalangDataset(datasets.GeneratorBasedBuilder):
|
74 |
"""Rule-based annotation Indonesian NER Dataset of 48,957 sentences with 3 NER tags"""
|
75 |
|
76 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
77 |
-
|
78 |
|
79 |
label_classes = [
|
80 |
"O",
|
@@ -84,18 +84,18 @@ class SinggalangDataset(datasets.GeneratorBasedBuilder):
|
|
84 |
]
|
85 |
|
86 |
BUILDER_CONFIGS = [
|
87 |
-
|
88 |
name=f"{_DATASETNAME}_source",
|
89 |
version=SOURCE_VERSION,
|
90 |
description=f"{_DATASETNAME} source schema",
|
91 |
schema="source",
|
92 |
subset_id=f"{_DATASETNAME}",
|
93 |
),
|
94 |
-
|
95 |
-
name=f"{_DATASETNAME}
|
96 |
-
version=
|
97 |
description=f"{_DATASETNAME} Nusantara schema",
|
98 |
-
schema="
|
99 |
subset_id=f"{_DATASETNAME}",
|
100 |
),
|
101 |
]
|
@@ -112,7 +112,7 @@ class SinggalangDataset(datasets.GeneratorBasedBuilder):
|
|
112 |
}
|
113 |
)
|
114 |
|
115 |
-
elif self.config.schema == "
|
116 |
features = schemas.seq_label_features(self.label_classes)
|
117 |
|
118 |
return datasets.DatasetInfo(
|
@@ -146,7 +146,7 @@ class SinggalangDataset(datasets.GeneratorBasedBuilder):
|
|
146 |
for key, ex in enumerate(dataset):
|
147 |
yield key, ex
|
148 |
|
149 |
-
elif self.config.schema == "
|
150 |
for key, ex in enumerate(dataset):
|
151 |
yield key, {
|
152 |
"id": str(key),
|
|
|
18 |
|
19 |
import datasets
|
20 |
|
21 |
+
from seacrowd.utils import schemas
|
22 |
+
from seacrowd.utils.common_parser import load_conll_data
|
23 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
24 |
+
from seacrowd.utils.constants import Tasks
|
25 |
|
26 |
_CITATION = """\
|
27 |
@INPROCEEDINGS{8355036,
|
|
|
67 |
|
68 |
_SOURCE_VERSION = "1.0.0"
|
69 |
|
70 |
+
_SEACROWD_VERSION = "2024.06.20"
|
71 |
|
72 |
|
73 |
class SinggalangDataset(datasets.GeneratorBasedBuilder):
|
74 |
"""Rule-based annotation Indonesian NER Dataset of 48,957 sentences with 3 NER tags"""
|
75 |
|
76 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
77 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
78 |
|
79 |
label_classes = [
|
80 |
"O",
|
|
|
84 |
]
|
85 |
|
86 |
BUILDER_CONFIGS = [
|
87 |
+
SEACrowdConfig(
|
88 |
name=f"{_DATASETNAME}_source",
|
89 |
version=SOURCE_VERSION,
|
90 |
description=f"{_DATASETNAME} source schema",
|
91 |
schema="source",
|
92 |
subset_id=f"{_DATASETNAME}",
|
93 |
),
|
94 |
+
SEACrowdConfig(
|
95 |
+
name=f"{_DATASETNAME}_seacrowd_seq_label",
|
96 |
+
version=SEACROWD_VERSION,
|
97 |
description=f"{_DATASETNAME} Nusantara schema",
|
98 |
+
schema="seacrowd_seq_label",
|
99 |
subset_id=f"{_DATASETNAME}",
|
100 |
),
|
101 |
]
|
|
|
112 |
}
|
113 |
)
|
114 |
|
115 |
+
elif self.config.schema == "seacrowd_seq_label":
|
116 |
features = schemas.seq_label_features(self.label_classes)
|
117 |
|
118 |
return datasets.DatasetInfo(
|
|
|
146 |
for key, ex in enumerate(dataset):
|
147 |
yield key, ex
|
148 |
|
149 |
+
elif self.config.schema == "seacrowd_seq_label":
|
150 |
for key, ex in enumerate(dataset):
|
151 |
yield key, {
|
152 |
"id": str(key),
|