holylovenia
commited on
Commit
•
e0825a2
1
Parent(s):
445db66
Upload id_sts.py with huggingface_hub
Browse files
id_sts.py
CHANGED
@@ -4,9 +4,9 @@ from typing import Dict, List, Tuple
|
|
4 |
import datasets
|
5 |
import pandas as pd
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
-
from
|
10 |
|
11 |
_CITATION = """
|
12 |
"""
|
@@ -38,7 +38,7 @@ _SUPPORTED_TASKS = [Tasks.SEMANTIC_SIMILARITY]
|
|
38 |
|
39 |
_SOURCE_VERSION = "1.0.0"
|
40 |
|
41 |
-
|
42 |
|
43 |
|
44 |
class IdSts(datasets.GeneratorBasedBuilder):
|
@@ -46,21 +46,21 @@ class IdSts(datasets.GeneratorBasedBuilder):
|
|
46 |
from 2012-2016 for Semantic Textual Similarity Task to Indonesian language"""
|
47 |
|
48 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
49 |
-
|
50 |
|
51 |
BUILDER_CONFIGS = [
|
52 |
-
|
53 |
name="id_sts_source",
|
54 |
version=SOURCE_VERSION,
|
55 |
description="ID_STS source schema",
|
56 |
schema="source",
|
57 |
subset_id="id_sts",
|
58 |
),
|
59 |
-
|
60 |
-
name="
|
61 |
-
version=
|
62 |
description="ID_STS Nusantara schema",
|
63 |
-
schema="
|
64 |
subset_id="id_sts",
|
65 |
),
|
66 |
]
|
@@ -77,7 +77,7 @@ class IdSts(datasets.GeneratorBasedBuilder):
|
|
77 |
"label": datasets.Value("float64"),
|
78 |
}
|
79 |
)
|
80 |
-
elif self.config.schema == "
|
81 |
features = schemas.pairs_features_score()
|
82 |
|
83 |
return datasets.DatasetInfo(
|
@@ -115,7 +115,7 @@ class IdSts(datasets.GeneratorBasedBuilder):
|
|
115 |
ex = {"text_1": row.text_1, "text_2": row.text_2, "label": row.score}
|
116 |
yield row.id, ex
|
117 |
|
118 |
-
elif self.config.schema == "
|
119 |
for row in df.itertuples():
|
120 |
ex = {"id": str(row.id), "text_1": row.text_1, "text_2": row.text_2, "label": row.score}
|
121 |
yield row.id, ex
|
|
|
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 Tasks
|
10 |
|
11 |
_CITATION = """
|
12 |
"""
|
|
|
38 |
|
39 |
_SOURCE_VERSION = "1.0.0"
|
40 |
|
41 |
+
_SEACROWD_VERSION = "2024.06.20"
|
42 |
|
43 |
|
44 |
class IdSts(datasets.GeneratorBasedBuilder):
|
|
|
46 |
from 2012-2016 for Semantic Textual Similarity Task to Indonesian language"""
|
47 |
|
48 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
49 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
50 |
|
51 |
BUILDER_CONFIGS = [
|
52 |
+
SEACrowdConfig(
|
53 |
name="id_sts_source",
|
54 |
version=SOURCE_VERSION,
|
55 |
description="ID_STS source schema",
|
56 |
schema="source",
|
57 |
subset_id="id_sts",
|
58 |
),
|
59 |
+
SEACrowdConfig(
|
60 |
+
name="id_sts_seacrowd_pairs_score",
|
61 |
+
version=SEACROWD_VERSION,
|
62 |
description="ID_STS Nusantara schema",
|
63 |
+
schema="seacrowd_pairs_score",
|
64 |
subset_id="id_sts",
|
65 |
),
|
66 |
]
|
|
|
77 |
"label": datasets.Value("float64"),
|
78 |
}
|
79 |
)
|
80 |
+
elif self.config.schema == "seacrowd_pairs_score":
|
81 |
features = schemas.pairs_features_score()
|
82 |
|
83 |
return datasets.DatasetInfo(
|
|
|
115 |
ex = {"text_1": row.text_1, "text_2": row.text_2, "label": row.score}
|
116 |
yield row.id, ex
|
117 |
|
118 |
+
elif self.config.schema == "seacrowd_pairs_score":
|
119 |
for row in df.itertuples():
|
120 |
ex = {"id": str(row.id), "text_1": row.text_1, "text_2": row.text_2, "label": row.score}
|
121 |
yield row.id, ex
|