holylovenia
commited on
Commit
•
721ffc5
1
Parent(s):
62e3e39
Upload wrete.py with huggingface_hub
Browse files
wrete.py
CHANGED
@@ -7,13 +7,13 @@ from unicodedata import category
|
|
7 |
import datasets
|
8 |
import pandas as pd
|
9 |
|
10 |
-
from
|
11 |
-
from
|
12 |
-
from
|
13 |
|
14 |
_DATASETNAME = "wrete"
|
15 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
16 |
-
_UNIFIED_VIEW_NAME =
|
17 |
|
18 |
_LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
19 |
_LOCAL = False
|
@@ -54,25 +54,25 @@ _URLs = {
|
|
54 |
_SUPPORTED_TASKS = [Tasks.TEXTUAL_ENTAILMENT]
|
55 |
|
56 |
_SOURCE_VERSION = "1.0.0"
|
57 |
-
|
58 |
|
59 |
|
60 |
class WReTe(datasets.GeneratorBasedBuilder):
|
61 |
"""WReTe consists of premise, hypothesis, category, and label. The Data are labeled as entailed when the meaning of the second sentence can be derived from the first one, and not entailed otherwise"""
|
62 |
|
63 |
BUILDER_CONFIGS = [
|
64 |
-
|
65 |
name="wrete_source",
|
66 |
version=datasets.Version(_SOURCE_VERSION),
|
67 |
description="WReTe source schema",
|
68 |
schema="source",
|
69 |
subset_id="wrete",
|
70 |
),
|
71 |
-
|
72 |
-
name="
|
73 |
-
version=datasets.Version(
|
74 |
description="WReTe Nusantara schema",
|
75 |
-
schema="
|
76 |
subset_id="wrete",
|
77 |
),
|
78 |
]
|
@@ -87,7 +87,7 @@ class WReTe(datasets.GeneratorBasedBuilder):
|
|
87 |
"sent_B": datasets.Value("string"),
|
88 |
"category" : datasets.Value("string"),
|
89 |
"label": datasets.Value("string")})
|
90 |
-
elif self.config.schema == "
|
91 |
features = schemas.pairs_features(self.labels)
|
92 |
|
93 |
return datasets.DatasetInfo(
|
@@ -135,7 +135,7 @@ class WReTe(datasets.GeneratorBasedBuilder):
|
|
135 |
"label" : row.label
|
136 |
}
|
137 |
yield row.index, ex
|
138 |
-
elif self.config.schema == "
|
139 |
for row in df.itertuples():
|
140 |
ex = {
|
141 |
"id": row.index,
|
|
|
7 |
import datasets
|
8 |
import pandas as pd
|
9 |
|
10 |
+
from seacrowd.utils import schemas
|
11 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
12 |
+
from seacrowd.utils.constants import Tasks, DEFAULT_SOURCE_VIEW_NAME, DEFAULT_SEACROWD_VIEW_NAME
|
13 |
|
14 |
_DATASETNAME = "wrete"
|
15 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
16 |
+
_UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
|
17 |
|
18 |
_LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
19 |
_LOCAL = False
|
|
|
54 |
_SUPPORTED_TASKS = [Tasks.TEXTUAL_ENTAILMENT]
|
55 |
|
56 |
_SOURCE_VERSION = "1.0.0"
|
57 |
+
_SEACROWD_VERSION = "2024.06.20"
|
58 |
|
59 |
|
60 |
class WReTe(datasets.GeneratorBasedBuilder):
|
61 |
"""WReTe consists of premise, hypothesis, category, and label. The Data are labeled as entailed when the meaning of the second sentence can be derived from the first one, and not entailed otherwise"""
|
62 |
|
63 |
BUILDER_CONFIGS = [
|
64 |
+
SEACrowdConfig(
|
65 |
name="wrete_source",
|
66 |
version=datasets.Version(_SOURCE_VERSION),
|
67 |
description="WReTe source schema",
|
68 |
schema="source",
|
69 |
subset_id="wrete",
|
70 |
),
|
71 |
+
SEACrowdConfig(
|
72 |
+
name="wrete_seacrowd_pairs",
|
73 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
74 |
description="WReTe Nusantara schema",
|
75 |
+
schema="seacrowd_pairs",
|
76 |
subset_id="wrete",
|
77 |
),
|
78 |
]
|
|
|
87 |
"sent_B": datasets.Value("string"),
|
88 |
"category" : datasets.Value("string"),
|
89 |
"label": datasets.Value("string")})
|
90 |
+
elif self.config.schema == "seacrowd_pairs":
|
91 |
features = schemas.pairs_features(self.labels)
|
92 |
|
93 |
return datasets.DatasetInfo(
|
|
|
135 |
"label" : row.label
|
136 |
}
|
137 |
yield row.index, ex
|
138 |
+
elif self.config.schema == "seacrowd_pairs":
|
139 |
for row in df.itertuples():
|
140 |
ex = {
|
141 |
"id": row.index,
|