holylovenia
commited on
Commit
•
0ce8494
1
Parent(s):
6b48d25
Upload liputan6.py with huggingface_hub
Browse files- liputan6.py +12 -12
liputan6.py
CHANGED
@@ -4,9 +4,9 @@ from typing import Dict, List, Tuple
|
|
4 |
|
5 |
import datasets
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
-
from
|
10 |
import json
|
11 |
|
12 |
_CITATION = """\
|
@@ -39,7 +39,7 @@ _SUPPORTED_TASKS = [Tasks.SUMMARIZATION]
|
|
39 |
|
40 |
_SOURCE_VERSION = "1.0.0"
|
41 |
|
42 |
-
|
43 |
|
44 |
|
45 |
class Liputan6(datasets.GeneratorBasedBuilder):
|
@@ -47,12 +47,12 @@ class Liputan6(datasets.GeneratorBasedBuilder):
|
|
47 |
|
48 |
|
49 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
50 |
-
|
51 |
|
52 |
TYPE_LIST = ['canonical', 'xtreme']
|
53 |
BUILDER_CONFIGS = (
|
54 |
[
|
55 |
-
|
56 |
name="liputan6_{fold_name}_source".format(fold_name=i),
|
57 |
version=_SOURCE_VERSION,
|
58 |
description="liputan6 source schema",
|
@@ -62,11 +62,11 @@ class Liputan6(datasets.GeneratorBasedBuilder):
|
|
62 |
]
|
63 |
+
|
64 |
[
|
65 |
-
|
66 |
-
name="liputan6_{fold_name}
|
67 |
-
version=
|
68 |
description="liputan6 Nusantara schema",
|
69 |
-
schema="
|
70 |
subset_id="liputan6_{fold_name}".format(fold_name=i),
|
71 |
) for i in TYPE_LIST
|
72 |
]
|
@@ -85,7 +85,7 @@ class Liputan6(datasets.GeneratorBasedBuilder):
|
|
85 |
}
|
86 |
)
|
87 |
|
88 |
-
elif self.config.schema == "
|
89 |
features = schemas.text2text_features
|
90 |
|
91 |
return datasets.DatasetInfo(
|
@@ -172,7 +172,7 @@ class Liputan6(datasets.GeneratorBasedBuilder):
|
|
172 |
}
|
173 |
yield each_data["id"], ex
|
174 |
|
175 |
-
elif self.config.schema == "
|
176 |
if "xtreme_train.json" in filepath:
|
177 |
with open(filepath) as f:
|
178 |
lines = f.read().split("{")
|
|
|
4 |
|
5 |
import datasets
|
6 |
|
7 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
8 |
+
from seacrowd.utils.constants import Tasks
|
9 |
+
from seacrowd.utils import schemas
|
10 |
import json
|
11 |
|
12 |
_CITATION = """\
|
|
|
39 |
|
40 |
_SOURCE_VERSION = "1.0.0"
|
41 |
|
42 |
+
_SEACROWD_VERSION = "2024.06.20"
|
43 |
|
44 |
|
45 |
class Liputan6(datasets.GeneratorBasedBuilder):
|
|
|
47 |
|
48 |
|
49 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
50 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
51 |
|
52 |
TYPE_LIST = ['canonical', 'xtreme']
|
53 |
BUILDER_CONFIGS = (
|
54 |
[
|
55 |
+
SEACrowdConfig(
|
56 |
name="liputan6_{fold_name}_source".format(fold_name=i),
|
57 |
version=_SOURCE_VERSION,
|
58 |
description="liputan6 source schema",
|
|
|
62 |
]
|
63 |
+
|
64 |
[
|
65 |
+
SEACrowdConfig(
|
66 |
+
name="liputan6_{fold_name}_seacrowd_t2t".format(fold_name=i),
|
67 |
+
version=_SEACROWD_VERSION,
|
68 |
description="liputan6 Nusantara schema",
|
69 |
+
schema="seacrowd_t2t",
|
70 |
subset_id="liputan6_{fold_name}".format(fold_name=i),
|
71 |
) for i in TYPE_LIST
|
72 |
]
|
|
|
85 |
}
|
86 |
)
|
87 |
|
88 |
+
elif self.config.schema == "seacrowd_t2t":
|
89 |
features = schemas.text2text_features
|
90 |
|
91 |
return datasets.DatasetInfo(
|
|
|
172 |
}
|
173 |
yield each_data["id"], ex
|
174 |
|
175 |
+
elif self.config.schema == "seacrowd_t2t":
|
176 |
if "xtreme_train.json" in filepath:
|
177 |
with open(filepath) as f:
|
178 |
lines = f.read().split("{")
|