holylovenia
commited on
Commit
•
474f20c
1
Parent(s):
bc7e52e
Upload id_multilabel_hs.py with huggingface_hub
Browse files- id_multilabel_hs.py +12 -12
id_multilabel_hs.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 |
@inproceedings{ibrohim-budi-2019-multi,
|
@@ -53,28 +53,28 @@ _URLS = {
|
|
53 |
}
|
54 |
_SUPPORTED_TASKS = [Tasks.ASPECT_BASED_SENTIMENT_ANALYSIS]
|
55 |
_SOURCE_VERSION = "1.0.0"
|
56 |
-
|
57 |
|
58 |
|
59 |
class IdAbusive(datasets.GeneratorBasedBuilder):
|
60 |
"""The ID_MULTILABEL_HS dataset is multi-label hate speech and abusive language detection in Indonesian tweets"""
|
61 |
|
62 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
63 |
-
|
64 |
|
65 |
BUILDER_CONFIGS = [
|
66 |
-
|
67 |
name="id_multilabel_hs_source",
|
68 |
version=SOURCE_VERSION,
|
69 |
description="ID Multilabel HS source schema",
|
70 |
schema="source",
|
71 |
subset_id="id_multilabel_hs",
|
72 |
),
|
73 |
-
|
74 |
-
name="
|
75 |
-
version=
|
76 |
description="ID Multilabel HS Nusantara schema",
|
77 |
-
schema="
|
78 |
subset_id="id_multilabel_hs",
|
79 |
),
|
80 |
]
|
@@ -98,7 +98,7 @@ class IdAbusive(datasets.GeneratorBasedBuilder):
|
|
98 |
"HS_Moderate": datasets.Value("bool"),
|
99 |
"HS_Strong": datasets.Value("bool"),
|
100 |
})
|
101 |
-
elif self.config.schema == "
|
102 |
features = schemas.text_multi_features([0, 1])
|
103 |
|
104 |
return datasets.DatasetInfo(
|
@@ -142,7 +142,7 @@ class IdAbusive(datasets.GeneratorBasedBuilder):
|
|
142 |
ex[label] = getattr(row, label)
|
143 |
yield row.id, ex
|
144 |
|
145 |
-
elif self.config.schema == "
|
146 |
for row in df.itertuples():
|
147 |
ex = {
|
148 |
"id": str(row.id),
|
|
|
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 |
@inproceedings{ibrohim-budi-2019-multi,
|
|
|
53 |
}
|
54 |
_SUPPORTED_TASKS = [Tasks.ASPECT_BASED_SENTIMENT_ANALYSIS]
|
55 |
_SOURCE_VERSION = "1.0.0"
|
56 |
+
_SEACROWD_VERSION = "2024.06.20"
|
57 |
|
58 |
|
59 |
class IdAbusive(datasets.GeneratorBasedBuilder):
|
60 |
"""The ID_MULTILABEL_HS dataset is multi-label hate speech and abusive language detection in Indonesian tweets"""
|
61 |
|
62 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
63 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
64 |
|
65 |
BUILDER_CONFIGS = [
|
66 |
+
SEACrowdConfig(
|
67 |
name="id_multilabel_hs_source",
|
68 |
version=SOURCE_VERSION,
|
69 |
description="ID Multilabel HS source schema",
|
70 |
schema="source",
|
71 |
subset_id="id_multilabel_hs",
|
72 |
),
|
73 |
+
SEACrowdConfig(
|
74 |
+
name="id_multilabel_hs_seacrowd_text_multi",
|
75 |
+
version=SEACROWD_VERSION,
|
76 |
description="ID Multilabel HS Nusantara schema",
|
77 |
+
schema="seacrowd_text_multi",
|
78 |
subset_id="id_multilabel_hs",
|
79 |
),
|
80 |
]
|
|
|
98 |
"HS_Moderate": datasets.Value("bool"),
|
99 |
"HS_Strong": datasets.Value("bool"),
|
100 |
})
|
101 |
+
elif self.config.schema == "seacrowd_text_multi":
|
102 |
features = schemas.text_multi_features([0, 1])
|
103 |
|
104 |
return datasets.DatasetInfo(
|
|
|
142 |
ex[label] = getattr(row, label)
|
143 |
yield row.id, ex
|
144 |
|
145 |
+
elif self.config.schema == "seacrowd_text_multi":
|
146 |
for row in df.itertuples():
|
147 |
ex = {
|
148 |
"id": str(row.id),
|