holylovenia
commited on
Commit
•
0da8d77
1
Parent(s):
660ae64
Upload hoasa.py with huggingface_hub
Browse files
hoasa.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{azhar2019multi,
|
@@ -46,28 +46,28 @@ _SUPPORTED_TASKS = [Tasks.ASPECT_BASED_SENTIMENT_ANALYSIS]
|
|
46 |
|
47 |
_SOURCE_VERSION = "1.0.0"
|
48 |
|
49 |
-
|
50 |
|
51 |
|
52 |
class HoASA(datasets.GeneratorBasedBuilder):
|
53 |
"""HoASA is an aspect based sentiment analysis dataset"""
|
54 |
|
55 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
56 |
-
|
57 |
|
58 |
BUILDER_CONFIGS = [
|
59 |
-
|
60 |
name="hoasa_source",
|
61 |
version=SOURCE_VERSION,
|
62 |
description="HoASA source schema",
|
63 |
schema="source",
|
64 |
subset_id="hoasa",
|
65 |
),
|
66 |
-
|
67 |
-
name="
|
68 |
-
version=
|
69 |
description="HoASA Nusantara schema",
|
70 |
-
schema="
|
71 |
subset_id="hoasa",
|
72 |
),
|
73 |
]
|
@@ -93,7 +93,7 @@ class HoASA(datasets.GeneratorBasedBuilder):
|
|
93 |
}
|
94 |
)
|
95 |
|
96 |
-
elif self.config.schema == "
|
97 |
features = schemas.text_multi_features(["pos", "neut", "neg", "neg_pos"])
|
98 |
|
99 |
return datasets.DatasetInfo(
|
@@ -160,7 +160,7 @@ class HoASA(datasets.GeneratorBasedBuilder):
|
|
160 |
}
|
161 |
yield row.index, entry
|
162 |
|
163 |
-
elif self.config.schema == "
|
164 |
for row in df.itertuples():
|
165 |
entry = {
|
166 |
"id": str(row.index),
|
|
|
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{azhar2019multi,
|
|
|
46 |
|
47 |
_SOURCE_VERSION = "1.0.0"
|
48 |
|
49 |
+
_SEACROWD_VERSION = "2024.06.20"
|
50 |
|
51 |
|
52 |
class HoASA(datasets.GeneratorBasedBuilder):
|
53 |
"""HoASA is an aspect based sentiment analysis dataset"""
|
54 |
|
55 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
56 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
57 |
|
58 |
BUILDER_CONFIGS = [
|
59 |
+
SEACrowdConfig(
|
60 |
name="hoasa_source",
|
61 |
version=SOURCE_VERSION,
|
62 |
description="HoASA source schema",
|
63 |
schema="source",
|
64 |
subset_id="hoasa",
|
65 |
),
|
66 |
+
SEACrowdConfig(
|
67 |
+
name="hoasa_seacrowd_text_multi",
|
68 |
+
version=SEACROWD_VERSION,
|
69 |
description="HoASA Nusantara schema",
|
70 |
+
schema="seacrowd_text_multi",
|
71 |
subset_id="hoasa",
|
72 |
),
|
73 |
]
|
|
|
93 |
}
|
94 |
)
|
95 |
|
96 |
+
elif self.config.schema == "seacrowd_text_multi":
|
97 |
features = schemas.text_multi_features(["pos", "neut", "neg", "neg_pos"])
|
98 |
|
99 |
return datasets.DatasetInfo(
|
|
|
160 |
}
|
161 |
yield row.index, entry
|
162 |
|
163 |
+
elif self.config.schema == "seacrowd_text_multi":
|
164 |
for row in df.itertuples():
|
165 |
entry = {
|
166 |
"id": str(row.index),
|