holylovenia
commited on
Commit
•
10ed30c
1
Parent(s):
b539064
Upload id_panl_bppt.py with huggingface_hub
Browse files- id_panl_bppt.py +12 -12
id_panl_bppt.py
CHANGED
@@ -8,9 +8,9 @@ except ImportError:
|
|
8 |
|
9 |
import datasets
|
10 |
|
11 |
-
from
|
12 |
-
from
|
13 |
-
from
|
14 |
|
15 |
_CITATION = """\
|
16 |
@inproceedings{id_panl_bppt,
|
@@ -38,7 +38,7 @@ _URLS = {
|
|
38 |
_SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
|
39 |
# Source has no versioning
|
40 |
_SOURCE_VERSION = "1.0.0"
|
41 |
-
|
42 |
|
43 |
|
44 |
class IdPanlBppt(datasets.GeneratorBasedBuilder):
|
@@ -48,7 +48,7 @@ class IdPanlBppt(datasets.GeneratorBasedBuilder):
|
|
48 |
"""
|
49 |
|
50 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
51 |
-
|
52 |
|
53 |
class Topic(TypedDict):
|
54 |
name: Literal["Economy", "International", "Science", "Sport"]
|
@@ -61,18 +61,18 @@ class IdPanlBppt(datasets.GeneratorBasedBuilder):
|
|
61 |
TARGET_LANGUAGE = "id"
|
62 |
|
63 |
BUILDER_CONFIGS = [
|
64 |
-
|
65 |
name="id_panl_bppt_source",
|
66 |
version=SOURCE_VERSION,
|
67 |
description="PANL BPPT source schema",
|
68 |
schema="source",
|
69 |
subset_id="id_panl_bppt",
|
70 |
),
|
71 |
-
|
72 |
-
name="
|
73 |
-
version=
|
74 |
description="PANL BPPT Nusantara schema",
|
75 |
-
schema="
|
76 |
subset_id="id_panl_bppt",
|
77 |
),
|
78 |
]
|
@@ -88,7 +88,7 @@ class IdPanlBppt(datasets.GeneratorBasedBuilder):
|
|
88 |
"topic": datasets.features.ClassLabel(names=list(map(lambda topic: topic["name"], self.TOPICS))),
|
89 |
}
|
90 |
)
|
91 |
-
elif self.config.schema == "
|
92 |
features = schemas.text2text_features
|
93 |
|
94 |
return datasets.DatasetInfo(
|
@@ -129,7 +129,7 @@ class IdPanlBppt(datasets.GeneratorBasedBuilder):
|
|
129 |
"translation": {self.SOURCE_LANGUAGE: s, self.TARGET_LANGUAGE: t},
|
130 |
"topic": topic["name"],
|
131 |
}
|
132 |
-
elif self.config.schema == "
|
133 |
# Schema does not have topics or any other fields to have the topics
|
134 |
yield id, {
|
135 |
"id": str(id),
|
|
|
8 |
|
9 |
import datasets
|
10 |
|
11 |
+
from seacrowd.utils import schemas
|
12 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
13 |
+
from seacrowd.utils.constants import Tasks
|
14 |
|
15 |
_CITATION = """\
|
16 |
@inproceedings{id_panl_bppt,
|
|
|
38 |
_SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
|
39 |
# Source has no versioning
|
40 |
_SOURCE_VERSION = "1.0.0"
|
41 |
+
_SEACROWD_VERSION = "2024.06.20"
|
42 |
|
43 |
|
44 |
class IdPanlBppt(datasets.GeneratorBasedBuilder):
|
|
|
48 |
"""
|
49 |
|
50 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
51 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
52 |
|
53 |
class Topic(TypedDict):
|
54 |
name: Literal["Economy", "International", "Science", "Sport"]
|
|
|
61 |
TARGET_LANGUAGE = "id"
|
62 |
|
63 |
BUILDER_CONFIGS = [
|
64 |
+
SEACrowdConfig(
|
65 |
name="id_panl_bppt_source",
|
66 |
version=SOURCE_VERSION,
|
67 |
description="PANL BPPT source schema",
|
68 |
schema="source",
|
69 |
subset_id="id_panl_bppt",
|
70 |
),
|
71 |
+
SEACrowdConfig(
|
72 |
+
name="id_panl_bppt_seacrowd_t2t",
|
73 |
+
version=SEACROWD_VERSION,
|
74 |
description="PANL BPPT Nusantara schema",
|
75 |
+
schema="seacrowd_t2t",
|
76 |
subset_id="id_panl_bppt",
|
77 |
),
|
78 |
]
|
|
|
88 |
"topic": datasets.features.ClassLabel(names=list(map(lambda topic: topic["name"], self.TOPICS))),
|
89 |
}
|
90 |
)
|
91 |
+
elif self.config.schema == "seacrowd_t2t":
|
92 |
features = schemas.text2text_features
|
93 |
|
94 |
return datasets.DatasetInfo(
|
|
|
129 |
"translation": {self.SOURCE_LANGUAGE: s, self.TARGET_LANGUAGE: t},
|
130 |
"topic": topic["name"],
|
131 |
}
|
132 |
+
elif self.config.schema == "seacrowd_t2t":
|
133 |
# Schema does not have topics or any other fields to have the topics
|
134 |
yield id, {
|
135 |
"id": str(id),
|