holylovenia
commited on
Commit
•
dbbf02f
1
Parent(s):
f38dc39
Upload id_abusive_news_comment.py with huggingface_hub
Browse files- id_abusive_news_comment.py +12 -12
id_abusive_news_comment.py
CHANGED
@@ -4,13 +4,13 @@ from typing import List
|
|
4 |
import datasets
|
5 |
import pandas as pd
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
-
from
|
10 |
|
11 |
_DATASETNAME = "id_abusive_news_comment"
|
12 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
13 |
-
_UNIFIED_VIEW_NAME =
|
14 |
|
15 |
_LANGUAGES = ["ind"] # We follow ISO639-3 langauge code (https://iso639-3.sil.org/code_tables/639/data)
|
16 |
_LOCAL = False
|
@@ -36,24 +36,24 @@ _URLs = {
|
|
36 |
_SUPPORTED_TASKS = [Tasks.SENTIMENT_ANALYSIS]
|
37 |
|
38 |
_SOURCE_VERSION = "1.0.0"
|
39 |
-
|
40 |
|
41 |
|
42 |
class IdAbusiveNewsComment(datasets.GeneratorBasedBuilder):
|
43 |
|
44 |
BUILDER_CONFIGS = [
|
45 |
-
|
46 |
name="id_abusive_news_comment_source",
|
47 |
version=datasets.Version(_SOURCE_VERSION),
|
48 |
description="Abusive Online News Comment source schema",
|
49 |
schema="source",
|
50 |
subset_id="id_abusive_news_comment",
|
51 |
),
|
52 |
-
|
53 |
-
name="
|
54 |
-
version=datasets.Version(
|
55 |
description="Abusive Online News Comment Nusantara schema",
|
56 |
-
schema="
|
57 |
subset_id="id_abusive_news_comment",
|
58 |
),
|
59 |
]
|
@@ -69,7 +69,7 @@ class IdAbusiveNewsComment(datasets.GeneratorBasedBuilder):
|
|
69 |
"label": datasets.Value("string"),
|
70 |
}
|
71 |
)
|
72 |
-
elif self.config.schema == "
|
73 |
features = schemas.text_features(['1', '2', '3'])
|
74 |
|
75 |
return datasets.DatasetInfo(
|
@@ -100,7 +100,7 @@ class IdAbusiveNewsComment(datasets.GeneratorBasedBuilder):
|
|
100 |
for row in df.itertuples():
|
101 |
ex = {"index": str(row.index), "text": row.Kalimat, "label": str(row.label)}
|
102 |
yield row.index, ex
|
103 |
-
elif self.config.schema == "
|
104 |
for row in df.itertuples():
|
105 |
ex = {"id": str(row.index), "text": row.Kalimat, "label": str(row.label)}
|
106 |
yield row.index, 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 DEFAULT_SEACROWD_VIEW_NAME, DEFAULT_SOURCE_VIEW_NAME, Tasks
|
10 |
|
11 |
_DATASETNAME = "id_abusive_news_comment"
|
12 |
_SOURCE_VIEW_NAME = DEFAULT_SOURCE_VIEW_NAME
|
13 |
+
_UNIFIED_VIEW_NAME = DEFAULT_SEACROWD_VIEW_NAME
|
14 |
|
15 |
_LANGUAGES = ["ind"] # We follow ISO639-3 langauge code (https://iso639-3.sil.org/code_tables/639/data)
|
16 |
_LOCAL = False
|
|
|
36 |
_SUPPORTED_TASKS = [Tasks.SENTIMENT_ANALYSIS]
|
37 |
|
38 |
_SOURCE_VERSION = "1.0.0"
|
39 |
+
_SEACROWD_VERSION = "2024.06.20"
|
40 |
|
41 |
|
42 |
class IdAbusiveNewsComment(datasets.GeneratorBasedBuilder):
|
43 |
|
44 |
BUILDER_CONFIGS = [
|
45 |
+
SEACrowdConfig(
|
46 |
name="id_abusive_news_comment_source",
|
47 |
version=datasets.Version(_SOURCE_VERSION),
|
48 |
description="Abusive Online News Comment source schema",
|
49 |
schema="source",
|
50 |
subset_id="id_abusive_news_comment",
|
51 |
),
|
52 |
+
SEACrowdConfig(
|
53 |
+
name="id_abusive_news_comment_seacrowd_text",
|
54 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
55 |
description="Abusive Online News Comment Nusantara schema",
|
56 |
+
schema="seacrowd_text",
|
57 |
subset_id="id_abusive_news_comment",
|
58 |
),
|
59 |
]
|
|
|
69 |
"label": datasets.Value("string"),
|
70 |
}
|
71 |
)
|
72 |
+
elif self.config.schema == "seacrowd_text":
|
73 |
features = schemas.text_features(['1', '2', '3'])
|
74 |
|
75 |
return datasets.DatasetInfo(
|
|
|
100 |
for row in df.itertuples():
|
101 |
ex = {"index": str(row.index), "text": row.Kalimat, "label": str(row.label)}
|
102 |
yield row.index, ex
|
103 |
+
elif self.config.schema == "seacrowd_text":
|
104 |
for row in df.itertuples():
|
105 |
ex = {"id": str(row.index), "text": row.Kalimat, "label": str(row.label)}
|
106 |
yield row.index, ex
|