Upload posp.py with huggingface_hub
Browse files
posp.py
CHANGED
|
@@ -2,11 +2,11 @@ from pathlib import Path
|
|
| 2 |
from typing import Dict, List, Tuple
|
| 3 |
|
| 4 |
import datasets
|
| 5 |
-
from
|
| 6 |
-
from
|
| 7 |
|
| 8 |
-
from
|
| 9 |
-
from
|
| 10 |
|
| 11 |
_CITATION = """\
|
| 12 |
@inproceedings{hoesen2018investigating,
|
|
@@ -51,7 +51,7 @@ _URLS = {
|
|
| 51 |
_SUPPORTED_TASKS = [Tasks.POS_TAGGING]
|
| 52 |
|
| 53 |
_SOURCE_VERSION = "1.0.0"
|
| 54 |
-
|
| 55 |
|
| 56 |
|
| 57 |
class POSPDataset(datasets.GeneratorBasedBuilder):
|
|
@@ -87,21 +87,21 @@ class POSPDataset(datasets.GeneratorBasedBuilder):
|
|
| 87 |
]
|
| 88 |
|
| 89 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
| 90 |
-
|
| 91 |
|
| 92 |
BUILDER_CONFIGS = [
|
| 93 |
-
|
| 94 |
name="posp_source",
|
| 95 |
version=SOURCE_VERSION,
|
| 96 |
description="POSP source schema",
|
| 97 |
schema="source",
|
| 98 |
subset_id="posp",
|
| 99 |
),
|
| 100 |
-
|
| 101 |
-
name="
|
| 102 |
-
version=
|
| 103 |
description="POSP Nusantara schema",
|
| 104 |
-
schema="
|
| 105 |
subset_id="posp",
|
| 106 |
),
|
| 107 |
]
|
|
@@ -117,7 +117,7 @@ class POSPDataset(datasets.GeneratorBasedBuilder):
|
|
| 117 |
"pos_tags": [datasets.Value("string")],
|
| 118 |
}
|
| 119 |
)
|
| 120 |
-
elif self.config.schema == "
|
| 121 |
features = schemas.seq_label_features(self.label_classes)
|
| 122 |
|
| 123 |
return datasets.DatasetInfo(
|
|
@@ -169,7 +169,7 @@ class POSPDataset(datasets.GeneratorBasedBuilder):
|
|
| 169 |
}
|
| 170 |
yield i, ex
|
| 171 |
|
| 172 |
-
elif self.config.schema == "
|
| 173 |
for i, row in enumerate(conll_dataset):
|
| 174 |
ex = {
|
| 175 |
"id": str(i),
|
|
|
|
| 2 |
from typing import Dict, List, Tuple
|
| 3 |
|
| 4 |
import datasets
|
| 5 |
+
from seacrowd.utils import schemas
|
| 6 |
+
from seacrowd.utils.common_parser import load_conll_data
|
| 7 |
|
| 8 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
| 9 |
+
from seacrowd.utils.constants import Tasks
|
| 10 |
|
| 11 |
_CITATION = """\
|
| 12 |
@inproceedings{hoesen2018investigating,
|
|
|
|
| 51 |
_SUPPORTED_TASKS = [Tasks.POS_TAGGING]
|
| 52 |
|
| 53 |
_SOURCE_VERSION = "1.0.0"
|
| 54 |
+
_SEACROWD_VERSION = "2024.06.20"
|
| 55 |
|
| 56 |
|
| 57 |
class POSPDataset(datasets.GeneratorBasedBuilder):
|
|
|
|
| 87 |
]
|
| 88 |
|
| 89 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
| 90 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
| 91 |
|
| 92 |
BUILDER_CONFIGS = [
|
| 93 |
+
SEACrowdConfig(
|
| 94 |
name="posp_source",
|
| 95 |
version=SOURCE_VERSION,
|
| 96 |
description="POSP source schema",
|
| 97 |
schema="source",
|
| 98 |
subset_id="posp",
|
| 99 |
),
|
| 100 |
+
SEACrowdConfig(
|
| 101 |
+
name="posp_seacrowd_seq_label",
|
| 102 |
+
version=SEACROWD_VERSION,
|
| 103 |
description="POSP Nusantara schema",
|
| 104 |
+
schema="seacrowd_seq_label",
|
| 105 |
subset_id="posp",
|
| 106 |
),
|
| 107 |
]
|
|
|
|
| 117 |
"pos_tags": [datasets.Value("string")],
|
| 118 |
}
|
| 119 |
)
|
| 120 |
+
elif self.config.schema == "seacrowd_seq_label":
|
| 121 |
features = schemas.seq_label_features(self.label_classes)
|
| 122 |
|
| 123 |
return datasets.DatasetInfo(
|
|
|
|
| 169 |
}
|
| 170 |
yield i, ex
|
| 171 |
|
| 172 |
+
elif self.config.schema == "seacrowd_seq_label":
|
| 173 |
for i, row in enumerate(conll_dataset):
|
| 174 |
ex = {
|
| 175 |
"id": str(i),
|