holylovenia
commited on
Commit
•
59b39bf
1
Parent(s):
a8d34be
Upload emot.py with huggingface_hub
Browse files
emot.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 = "emot"
|
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
|
@@ -51,25 +51,25 @@ _URLs = {
|
|
51 |
_SUPPORTED_TASKS = [Tasks.EMOTION_CLASSIFICATION]
|
52 |
|
53 |
_SOURCE_VERSION = "1.0.0"
|
54 |
-
|
55 |
|
56 |
|
57 |
class EmoT(datasets.GeneratorBasedBuilder):
|
58 |
"""SMSA is a sentiment analysis dataset consisting of 3 labels (positive, neutral, and negative) which comes from comments and reviews collected from multiple online platforms."""
|
59 |
|
60 |
BUILDER_CONFIGS = [
|
61 |
-
|
62 |
name="emot_source",
|
63 |
version=datasets.Version(_SOURCE_VERSION),
|
64 |
description="EmoT source schema",
|
65 |
schema="source",
|
66 |
subset_id="emot",
|
67 |
),
|
68 |
-
|
69 |
-
name="
|
70 |
-
version=datasets.Version(
|
71 |
description="EmoT Nusantara schema",
|
72 |
-
schema="
|
73 |
subset_id="emot",
|
74 |
),
|
75 |
]
|
@@ -85,7 +85,7 @@ class EmoT(datasets.GeneratorBasedBuilder):
|
|
85 |
"label": datasets.Value("string"),
|
86 |
}
|
87 |
)
|
88 |
-
elif self.config.schema == "
|
89 |
features = schemas.text_features(["happy", "love", "fear", "anger", "sadness"])
|
90 |
|
91 |
return datasets.DatasetInfo(
|
@@ -129,7 +129,7 @@ class EmoT(datasets.GeneratorBasedBuilder):
|
|
129 |
for row in df.itertuples():
|
130 |
ex = {"index": str(row.id), "tweet": row.tweet, "label": row.label}
|
131 |
yield row.id, ex
|
132 |
-
elif self.config.schema == "
|
133 |
for row in df.itertuples():
|
134 |
ex = {"id": str(row.id), "text": row.tweet, "label": row.label}
|
135 |
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 DEFAULT_SEACROWD_VIEW_NAME, DEFAULT_SOURCE_VIEW_NAME, Tasks
|
10 |
|
11 |
_DATASETNAME = "emot"
|
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
|
|
|
51 |
_SUPPORTED_TASKS = [Tasks.EMOTION_CLASSIFICATION]
|
52 |
|
53 |
_SOURCE_VERSION = "1.0.0"
|
54 |
+
_SEACROWD_VERSION = "2024.06.20"
|
55 |
|
56 |
|
57 |
class EmoT(datasets.GeneratorBasedBuilder):
|
58 |
"""SMSA is a sentiment analysis dataset consisting of 3 labels (positive, neutral, and negative) which comes from comments and reviews collected from multiple online platforms."""
|
59 |
|
60 |
BUILDER_CONFIGS = [
|
61 |
+
SEACrowdConfig(
|
62 |
name="emot_source",
|
63 |
version=datasets.Version(_SOURCE_VERSION),
|
64 |
description="EmoT source schema",
|
65 |
schema="source",
|
66 |
subset_id="emot",
|
67 |
),
|
68 |
+
SEACrowdConfig(
|
69 |
+
name="emot_seacrowd_text",
|
70 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
71 |
description="EmoT Nusantara schema",
|
72 |
+
schema="seacrowd_text",
|
73 |
subset_id="emot",
|
74 |
),
|
75 |
]
|
|
|
85 |
"label": datasets.Value("string"),
|
86 |
}
|
87 |
)
|
88 |
+
elif self.config.schema == "seacrowd_text":
|
89 |
features = schemas.text_features(["happy", "love", "fear", "anger", "sadness"])
|
90 |
|
91 |
return datasets.DatasetInfo(
|
|
|
129 |
for row in df.itertuples():
|
130 |
ex = {"index": str(row.id), "tweet": row.tweet, "label": row.label}
|
131 |
yield row.id, ex
|
132 |
+
elif self.config.schema == "seacrowd_text":
|
133 |
for row in df.itertuples():
|
134 |
ex = {"id": str(row.id), "text": row.tweet, "label": row.label}
|
135 |
yield row.id, ex
|