Upload parallel_su_id.py with huggingface_hub
Browse files- parallel_su_id.py +12 -12
parallel_su_id.py
CHANGED
@@ -4,13 +4,13 @@ from typing import List
|
|
4 |
import datasets
|
5 |
import json
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
-
from
|
10 |
|
11 |
_DATASETNAME = "parallel_su_id"
|
12 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
13 |
-
_UNIFIED_VIEW_NAME =
|
14 |
|
15 |
_LANGUAGES = ["ind", "sun"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
16 |
_LOCAL = False
|
@@ -40,25 +40,25 @@ _URLs = {"ind": "https://dataverse.telkomuniversity.ac.id/api/access/datafile/:p
|
|
40 |
_SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
|
41 |
|
42 |
_SOURCE_VERSION = "1.0.0"
|
43 |
-
|
44 |
|
45 |
|
46 |
class ParallelSuId(datasets.GeneratorBasedBuilder):
|
47 |
"""Parallel Su-Id is a machine translation dataset containing Indonesian-Sundanese parallel sentences collected from the online Sundanese language magazine Mangle, West Java Dakwah Council, and Balebat."""
|
48 |
|
49 |
BUILDER_CONFIGS = [
|
50 |
-
|
51 |
name="parallel_su_id_source",
|
52 |
version=datasets.Version(_SOURCE_VERSION),
|
53 |
description="Parallel Su-Id source schema",
|
54 |
schema="source",
|
55 |
subset_id="parallel_su_id",
|
56 |
),
|
57 |
-
|
58 |
-
name="
|
59 |
-
version=datasets.Version(
|
60 |
description="Parallel Su-Id Nusantara schema",
|
61 |
-
schema="
|
62 |
subset_id="parallel_su_id",
|
63 |
),
|
64 |
]
|
@@ -68,7 +68,7 @@ class ParallelSuId(datasets.GeneratorBasedBuilder):
|
|
68 |
def _info(self):
|
69 |
if self.config.schema == "source":
|
70 |
features = datasets.Features({"id": datasets.Value("string"), "text": datasets.Value("string"), "label": datasets.Value("string")})
|
71 |
-
elif self.config.schema == "
|
72 |
features = schemas.text2text_features
|
73 |
|
74 |
return datasets.DatasetInfo(
|
@@ -109,7 +109,7 @@ class ParallelSuId(datasets.GeneratorBasedBuilder):
|
|
109 |
"label": data['ind'][i].replace("\n","")
|
110 |
}
|
111 |
yield i, ex
|
112 |
-
elif self.config.schema == "
|
113 |
for i in range(len(data[lang])):
|
114 |
ex = {
|
115 |
"id": i,
|
|
|
4 |
import datasets
|
5 |
import json
|
6 |
|
7 |
+
from seacrowd.utils import schemas
|
8 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
9 |
+
from seacrowd.utils.constants import Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_SEACROWD_VIEW_NAME
|
10 |
|
11 |
_DATASETNAME = "parallel_su_id"
|
12 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
13 |
+
_UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
|
14 |
|
15 |
_LANGUAGES = ["ind", "sun"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
16 |
_LOCAL = False
|
|
|
40 |
_SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
|
41 |
|
42 |
_SOURCE_VERSION = "1.0.0"
|
43 |
+
_SEACROWD_VERSION = "2024.06.20"
|
44 |
|
45 |
|
46 |
class ParallelSuId(datasets.GeneratorBasedBuilder):
|
47 |
"""Parallel Su-Id is a machine translation dataset containing Indonesian-Sundanese parallel sentences collected from the online Sundanese language magazine Mangle, West Java Dakwah Council, and Balebat."""
|
48 |
|
49 |
BUILDER_CONFIGS = [
|
50 |
+
SEACrowdConfig(
|
51 |
name="parallel_su_id_source",
|
52 |
version=datasets.Version(_SOURCE_VERSION),
|
53 |
description="Parallel Su-Id source schema",
|
54 |
schema="source",
|
55 |
subset_id="parallel_su_id",
|
56 |
),
|
57 |
+
SEACrowdConfig(
|
58 |
+
name="parallel_su_id_seacrowd_t2t",
|
59 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
60 |
description="Parallel Su-Id Nusantara schema",
|
61 |
+
schema="seacrowd_t2t",
|
62 |
subset_id="parallel_su_id",
|
63 |
),
|
64 |
]
|
|
|
68 |
def _info(self):
|
69 |
if self.config.schema == "source":
|
70 |
features = datasets.Features({"id": datasets.Value("string"), "text": datasets.Value("string"), "label": datasets.Value("string")})
|
71 |
+
elif self.config.schema == "seacrowd_t2t":
|
72 |
features = schemas.text2text_features
|
73 |
|
74 |
return datasets.DatasetInfo(
|
|
|
109 |
"label": data['ind'][i].replace("\n","")
|
110 |
}
|
111 |
yield i, ex
|
112 |
+
elif self.config.schema == "seacrowd_t2t":
|
113 |
for i in range(len(data[lang])):
|
114 |
ex = {
|
115 |
"id": i,
|