holylovenia
commited on
Commit
•
f4ed487
1
Parent(s):
9986912
Upload stif_indonesia.py with huggingface_hub
Browse files- stif_indonesia.py +12 -12
stif_indonesia.py
CHANGED
@@ -3,13 +3,13 @@ from typing import List
|
|
3 |
|
4 |
import datasets
|
5 |
|
6 |
-
from
|
7 |
-
from
|
8 |
-
from
|
9 |
|
10 |
_DATASETNAME = "stif_indonesia"
|
11 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
12 |
-
_UNIFIED_VIEW_NAME =
|
13 |
|
14 |
_LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
15 |
_LOCAL = False
|
@@ -45,25 +45,25 @@ _URLs = {
|
|
45 |
_SUPPORTED_TASKS = [Tasks.PARAPHRASING]
|
46 |
|
47 |
_SOURCE_VERSION = "1.0.0"
|
48 |
-
|
49 |
|
50 |
|
51 |
class STIFIndonesia(datasets.GeneratorBasedBuilder):
|
52 |
"""STIF-Indonesia is formal-informal/colloquial style transfer for Indonesian."""
|
53 |
|
54 |
BUILDER_CONFIGS = [
|
55 |
-
|
56 |
name="stif_indonesia_source",
|
57 |
version=datasets.Version(_SOURCE_VERSION),
|
58 |
description="STIF Indonesia source schema",
|
59 |
schema="source",
|
60 |
subset_id="stif_indonesia",
|
61 |
),
|
62 |
-
|
63 |
-
name="
|
64 |
-
version=datasets.Version(
|
65 |
description="STIF Indonesia Nusantara schema",
|
66 |
-
schema="
|
67 |
subset_id="stif_indonesia",
|
68 |
),
|
69 |
]
|
@@ -73,7 +73,7 @@ class STIFIndonesia(datasets.GeneratorBasedBuilder):
|
|
73 |
def _info(self):
|
74 |
if self.config.schema == "source":
|
75 |
features = datasets.Features({"id": datasets.Value("string"), "formal": datasets.Value("string"), "informal": datasets.Value("string")})
|
76 |
-
elif self.config.schema == "
|
77 |
features = schemas.text2text_features
|
78 |
|
79 |
return datasets.DatasetInfo(
|
@@ -127,7 +127,7 @@ class STIFIndonesia(datasets.GeneratorBasedBuilder):
|
|
127 |
for id, (row_for, row_inf) in enumerate(zip(data_for, data_inf)):
|
128 |
ex = {"id": id, "formal": row_for.strip(), "informal": row_inf.strip()}
|
129 |
yield id, ex
|
130 |
-
elif self.config.schema == "
|
131 |
for id, (row_for, row_inf) in enumerate(zip(data_for, data_inf)):
|
132 |
ex = {
|
133 |
"id": id,
|
|
|
3 |
|
4 |
import datasets
|
5 |
|
6 |
+
from seacrowd.utils import schemas
|
7 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
8 |
+
from seacrowd.utils.constants import Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_SEACROWD_VIEW_NAME
|
9 |
|
10 |
_DATASETNAME = "stif_indonesia"
|
11 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
12 |
+
_UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
|
13 |
|
14 |
_LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
15 |
_LOCAL = False
|
|
|
45 |
_SUPPORTED_TASKS = [Tasks.PARAPHRASING]
|
46 |
|
47 |
_SOURCE_VERSION = "1.0.0"
|
48 |
+
_SEACROWD_VERSION = "2024.06.20"
|
49 |
|
50 |
|
51 |
class STIFIndonesia(datasets.GeneratorBasedBuilder):
|
52 |
"""STIF-Indonesia is formal-informal/colloquial style transfer for Indonesian."""
|
53 |
|
54 |
BUILDER_CONFIGS = [
|
55 |
+
SEACrowdConfig(
|
56 |
name="stif_indonesia_source",
|
57 |
version=datasets.Version(_SOURCE_VERSION),
|
58 |
description="STIF Indonesia source schema",
|
59 |
schema="source",
|
60 |
subset_id="stif_indonesia",
|
61 |
),
|
62 |
+
SEACrowdConfig(
|
63 |
+
name="stif_indonesia_seacrowd_t2t",
|
64 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
65 |
description="STIF Indonesia Nusantara schema",
|
66 |
+
schema="seacrowd_t2t",
|
67 |
subset_id="stif_indonesia",
|
68 |
),
|
69 |
]
|
|
|
73 |
def _info(self):
|
74 |
if self.config.schema == "source":
|
75 |
features = datasets.Features({"id": datasets.Value("string"), "formal": datasets.Value("string"), "informal": datasets.Value("string")})
|
76 |
+
elif self.config.schema == "seacrowd_t2t":
|
77 |
features = schemas.text2text_features
|
78 |
|
79 |
return datasets.DatasetInfo(
|
|
|
127 |
for id, (row_for, row_inf) in enumerate(zip(data_for, data_inf)):
|
128 |
ex = {"id": id, "formal": row_for.strip(), "informal": row_inf.strip()}
|
129 |
yield id, ex
|
130 |
+
elif self.config.schema == "seacrowd_t2t":
|
131 |
for id, (row_for, row_inf) in enumerate(zip(data_for, data_inf)):
|
132 |
ex = {
|
133 |
"id": id,
|