Commit
•
874acd3
1
Parent(s):
9e80d05
Upload sentiment_nathasa_review.py with huggingface_hub
Browse files- sentiment_nathasa_review.py +12 -12
sentiment_nathasa_review.py
CHANGED
@@ -4,9 +4,9 @@ from typing import Dict, List, Tuple
|
|
4 |
|
5 |
import datasets
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
-
from
|
10 |
import csv
|
11 |
|
12 |
_CITATION = """\
|
@@ -42,27 +42,27 @@ _SUPPORTED_TASKS = [Tasks.SENTIMENT_ANALYSIS]
|
|
42 |
|
43 |
_SOURCE_VERSION = "1.0.0"
|
44 |
|
45 |
-
|
46 |
|
47 |
class SentimentNathasaReview(datasets.GeneratorBasedBuilder):
|
48 |
"""Customer Review (Natasha Skincare) is a customers emotion dataset, with amounted to 19,253 samples with the division for each class is 804 joy, 43 surprise, 154 anger, 61 fear, 287 sad, 167 disgust, and 17736 no-emotions."""
|
49 |
|
50 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
51 |
-
|
52 |
|
53 |
BUILDER_CONFIGS = [
|
54 |
-
|
55 |
name="sentiment_nathasa_review_source",
|
56 |
version=datasets.Version(_SOURCE_VERSION),
|
57 |
description="sentiment_nathasa_review source schema",
|
58 |
schema="source",
|
59 |
subset_id="sentiment_nathasa_review",
|
60 |
),
|
61 |
-
|
62 |
-
name="
|
63 |
-
version=datasets.Version(
|
64 |
description="sentiment_nathasa_review Nusantara schema",
|
65 |
-
schema="
|
66 |
subset_id="sentiment_nathasa_review",
|
67 |
),
|
68 |
]
|
@@ -79,7 +79,7 @@ class SentimentNathasaReview(datasets.GeneratorBasedBuilder):
|
|
79 |
"label": datasets.Value("string"),
|
80 |
}
|
81 |
)
|
82 |
-
elif self.config.schema == "
|
83 |
features = schemas.text_features(['NOEMOTION', 'SURPRISE', 'SAD', 'JOY', 'FEAR', 'DISGUST', 'ANGER'])
|
84 |
|
85 |
return datasets.DatasetInfo(
|
@@ -137,7 +137,7 @@ class SentimentNathasaReview(datasets.GeneratorBasedBuilder):
|
|
137 |
}
|
138 |
yield row_data[0], ex
|
139 |
|
140 |
-
elif self.config.schema == "
|
141 |
with open(filepath, "r") as F:
|
142 |
csvreader = csv.reader(F)
|
143 |
for row in csvreader:
|
|
|
4 |
|
5 |
import datasets
|
6 |
|
7 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
8 |
+
from seacrowd.utils.constants import Tasks
|
9 |
+
from seacrowd.utils import schemas
|
10 |
import csv
|
11 |
|
12 |
_CITATION = """\
|
|
|
42 |
|
43 |
_SOURCE_VERSION = "1.0.0"
|
44 |
|
45 |
+
_SEACROWD_VERSION = "2024.06.20"
|
46 |
|
47 |
class SentimentNathasaReview(datasets.GeneratorBasedBuilder):
|
48 |
"""Customer Review (Natasha Skincare) is a customers emotion dataset, with amounted to 19,253 samples with the division for each class is 804 joy, 43 surprise, 154 anger, 61 fear, 287 sad, 167 disgust, and 17736 no-emotions."""
|
49 |
|
50 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
51 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
52 |
|
53 |
BUILDER_CONFIGS = [
|
54 |
+
SEACrowdConfig(
|
55 |
name="sentiment_nathasa_review_source",
|
56 |
version=datasets.Version(_SOURCE_VERSION),
|
57 |
description="sentiment_nathasa_review source schema",
|
58 |
schema="source",
|
59 |
subset_id="sentiment_nathasa_review",
|
60 |
),
|
61 |
+
SEACrowdConfig(
|
62 |
+
name="sentiment_nathasa_review_seacrowd_text",
|
63 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
64 |
description="sentiment_nathasa_review Nusantara schema",
|
65 |
+
schema="seacrowd_text",
|
66 |
subset_id="sentiment_nathasa_review",
|
67 |
),
|
68 |
]
|
|
|
79 |
"label": datasets.Value("string"),
|
80 |
}
|
81 |
)
|
82 |
+
elif self.config.schema == "seacrowd_text":
|
83 |
features = schemas.text_features(['NOEMOTION', 'SURPRISE', 'SAD', 'JOY', 'FEAR', 'DISGUST', 'ANGER'])
|
84 |
|
85 |
return datasets.DatasetInfo(
|
|
|
137 |
}
|
138 |
yield row_data[0], ex
|
139 |
|
140 |
+
elif self.config.schema == "seacrowd_text":
|
141 |
with open(filepath, "r") as F:
|
142 |
csvreader = csv.reader(F)
|
143 |
for row in csvreader:
|