holylovenia
commited on
Commit
•
33a513b
1
Parent(s):
3e52fda
Upload parallel_id_nyo.py with huggingface_hub
Browse files- parallel_id_nyo.py +13 -17
parallel_id_nyo.py
CHANGED
@@ -4,17 +4,17 @@ from typing import List
|
|
4 |
import datasets
|
5 |
import pandas as pd
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
-
from
|
10 |
-
|
11 |
DEFAULT_SOURCE_VIEW_NAME,
|
12 |
Tasks,
|
13 |
)
|
14 |
|
15 |
_DATASETNAME = "parallel_id_nyo"
|
16 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
17 |
-
_UNIFIED_VIEW_NAME =
|
18 |
|
19 |
_LOCAL = False
|
20 |
_LANGUAGES = ["ind", "abl"]
|
@@ -74,7 +74,7 @@ _URLs = {
|
|
74 |
_SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
|
75 |
|
76 |
_SOURCE_VERSION = "1.0.0"
|
77 |
-
|
78 |
|
79 |
COL_INDONESIA = "indo"
|
80 |
COL_LAMPUNG = "lampung"
|
@@ -84,18 +84,18 @@ class ParallelIdNyo(datasets.GeneratorBasedBuilder):
|
|
84 |
"""Dataset that contains Indonesian - Lampung language pairs."""
|
85 |
|
86 |
BUILDER_CONFIGS = [
|
87 |
-
|
88 |
name="parallel_id_nyo_source",
|
89 |
version=datasets.Version(_SOURCE_VERSION),
|
90 |
description="Parallel Id-Nyo source schema",
|
91 |
schema="source",
|
92 |
subset_id="parallel_id_nyo",
|
93 |
),
|
94 |
-
|
95 |
-
name="
|
96 |
-
version=datasets.Version(
|
97 |
description="Parallel Id-Nyo Nusantara schema",
|
98 |
-
schema="
|
99 |
subset_id="parallel_id_nyo",
|
100 |
),
|
101 |
]
|
@@ -111,7 +111,7 @@ class ParallelIdNyo(datasets.GeneratorBasedBuilder):
|
|
111 |
"label": datasets.Value("string"),
|
112 |
}
|
113 |
)
|
114 |
-
elif self.config.schema == "
|
115 |
features = schemas.text2text_features
|
116 |
|
117 |
return datasets.DatasetInfo(
|
@@ -146,7 +146,7 @@ class ParallelIdNyo(datasets.GeneratorBasedBuilder):
|
|
146 |
"label": str(row[COL_LAMPUNG]).rstrip(),
|
147 |
}
|
148 |
yield idx, ex
|
149 |
-
elif self.config.schema == "
|
150 |
for idx, row in df.iterrows():
|
151 |
ex = {
|
152 |
"id": str(idx),
|
@@ -158,7 +158,3 @@ class ParallelIdNyo(datasets.GeneratorBasedBuilder):
|
|
158 |
yield idx, ex
|
159 |
else:
|
160 |
raise ValueError(f"Invalid config: {self.config.name}")
|
161 |
-
|
162 |
-
|
163 |
-
if __name__ == "__main__":
|
164 |
-
datasets.load_dataset(__file__)
|
|
|
4 |
import datasets
|
5 |
import pandas as pd
|
6 |
|
7 |
+
from seacrowd.utils import schemas
|
8 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
9 |
+
from seacrowd.utils.constants import (
|
10 |
+
DEFAULT_SEACROWD_VIEW_NAME,
|
11 |
DEFAULT_SOURCE_VIEW_NAME,
|
12 |
Tasks,
|
13 |
)
|
14 |
|
15 |
_DATASETNAME = "parallel_id_nyo"
|
16 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
17 |
+
_UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
|
18 |
|
19 |
_LOCAL = False
|
20 |
_LANGUAGES = ["ind", "abl"]
|
|
|
74 |
_SUPPORTED_TASKS = [Tasks.MACHINE_TRANSLATION]
|
75 |
|
76 |
_SOURCE_VERSION = "1.0.0"
|
77 |
+
_SEACROWD_VERSION = "2024.06.20"
|
78 |
|
79 |
COL_INDONESIA = "indo"
|
80 |
COL_LAMPUNG = "lampung"
|
|
|
84 |
"""Dataset that contains Indonesian - Lampung language pairs."""
|
85 |
|
86 |
BUILDER_CONFIGS = [
|
87 |
+
SEACrowdConfig(
|
88 |
name="parallel_id_nyo_source",
|
89 |
version=datasets.Version(_SOURCE_VERSION),
|
90 |
description="Parallel Id-Nyo source schema",
|
91 |
schema="source",
|
92 |
subset_id="parallel_id_nyo",
|
93 |
),
|
94 |
+
SEACrowdConfig(
|
95 |
+
name="parallel_id_nyo_seacrowd_t2t",
|
96 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
97 |
description="Parallel Id-Nyo Nusantara schema",
|
98 |
+
schema="seacrowd_t2t",
|
99 |
subset_id="parallel_id_nyo",
|
100 |
),
|
101 |
]
|
|
|
111 |
"label": datasets.Value("string"),
|
112 |
}
|
113 |
)
|
114 |
+
elif self.config.schema == "seacrowd_t2t":
|
115 |
features = schemas.text2text_features
|
116 |
|
117 |
return datasets.DatasetInfo(
|
|
|
146 |
"label": str(row[COL_LAMPUNG]).rstrip(),
|
147 |
}
|
148 |
yield idx, ex
|
149 |
+
elif self.config.schema == "seacrowd_t2t":
|
150 |
for idx, row in df.iterrows():
|
151 |
ex = {
|
152 |
"id": str(idx),
|
|
|
158 |
yield idx, ex
|
159 |
else:
|
160 |
raise ValueError(f"Invalid config: {self.config.name}")
|
|
|
|
|
|
|
|