Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
multi-class-classification
Languages:
English
Size:
100K - 1M
Tags:
emotion-classification
License:
Commit
•
0f2013a
1
Parent(s):
4b41f73
Delete loading script
Browse files- emotion.py +0 -88
emotion.py
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
|
3 |
-
import datasets
|
4 |
-
from datasets.tasks import TextClassification
|
5 |
-
|
6 |
-
|
7 |
-
_CITATION = """\
|
8 |
-
@inproceedings{saravia-etal-2018-carer,
|
9 |
-
title = "{CARER}: Contextualized Affect Representations for Emotion Recognition",
|
10 |
-
author = "Saravia, Elvis and
|
11 |
-
Liu, Hsien-Chi Toby and
|
12 |
-
Huang, Yen-Hao and
|
13 |
-
Wu, Junlin and
|
14 |
-
Chen, Yi-Shin",
|
15 |
-
booktitle = "Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing",
|
16 |
-
month = oct # "-" # nov,
|
17 |
-
year = "2018",
|
18 |
-
address = "Brussels, Belgium",
|
19 |
-
publisher = "Association for Computational Linguistics",
|
20 |
-
url = "https://www.aclweb.org/anthology/D18-1404",
|
21 |
-
doi = "10.18653/v1/D18-1404",
|
22 |
-
pages = "3687--3697",
|
23 |
-
abstract = "Emotions are expressed in nuanced ways, which varies by collective or individual experiences, knowledge, and beliefs. Therefore, to understand emotion, as conveyed through text, a robust mechanism capable of capturing and modeling different linguistic nuances and phenomena is needed. We propose a semi-supervised, graph-based algorithm to produce rich structural descriptors which serve as the building blocks for constructing contextualized affect representations from text. The pattern-based representations are further enriched with word embeddings and evaluated through several emotion recognition tasks. Our experimental results demonstrate that the proposed method outperforms state-of-the-art techniques on emotion recognition tasks.",
|
24 |
-
}
|
25 |
-
"""
|
26 |
-
|
27 |
-
_DESCRIPTION = """\
|
28 |
-
Emotion is a dataset of English Twitter messages with six basic emotions: anger, fear, joy, love, sadness, and surprise. For more detailed information please refer to the paper.
|
29 |
-
"""
|
30 |
-
|
31 |
-
_HOMEPAGE = "https://github.com/dair-ai/emotion_dataset"
|
32 |
-
|
33 |
-
_LICENSE = "The dataset should be used for educational and research purposes only"
|
34 |
-
|
35 |
-
_URLS = {
|
36 |
-
"split": {
|
37 |
-
"train": "data/train.jsonl.gz",
|
38 |
-
"validation": "data/validation.jsonl.gz",
|
39 |
-
"test": "data/test.jsonl.gz",
|
40 |
-
},
|
41 |
-
"unsplit": {
|
42 |
-
"train": "data/data.jsonl.gz",
|
43 |
-
},
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
class Emotion(datasets.GeneratorBasedBuilder):
|
48 |
-
VERSION = datasets.Version("1.0.0")
|
49 |
-
BUILDER_CONFIGS = [
|
50 |
-
datasets.BuilderConfig(
|
51 |
-
name="split", version=VERSION, description="Dataset split in train, validation and test"
|
52 |
-
),
|
53 |
-
datasets.BuilderConfig(name="unsplit", version=VERSION, description="Unsplit dataset"),
|
54 |
-
]
|
55 |
-
DEFAULT_CONFIG_NAME = "split"
|
56 |
-
|
57 |
-
def _info(self):
|
58 |
-
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
|
59 |
-
return datasets.DatasetInfo(
|
60 |
-
description=_DESCRIPTION,
|
61 |
-
features=datasets.Features(
|
62 |
-
{"text": datasets.Value("string"), "label": datasets.ClassLabel(names=class_names)}
|
63 |
-
),
|
64 |
-
supervised_keys=("text", "label"),
|
65 |
-
homepage=_HOMEPAGE,
|
66 |
-
citation=_CITATION,
|
67 |
-
license=_LICENSE,
|
68 |
-
task_templates=[TextClassification(text_column="text", label_column="label")],
|
69 |
-
)
|
70 |
-
|
71 |
-
def _split_generators(self, dl_manager):
|
72 |
-
"""Returns SplitGenerators."""
|
73 |
-
paths = dl_manager.download_and_extract(_URLS[self.config.name])
|
74 |
-
if self.config.name == "split":
|
75 |
-
return [
|
76 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": paths["train"]}),
|
77 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": paths["validation"]}),
|
78 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": paths["test"]}),
|
79 |
-
]
|
80 |
-
else:
|
81 |
-
return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": paths["train"]})]
|
82 |
-
|
83 |
-
def _generate_examples(self, filepath):
|
84 |
-
"""Generate examples."""
|
85 |
-
with open(filepath, encoding="utf-8") as f:
|
86 |
-
for idx, line in enumerate(f):
|
87 |
-
example = json.loads(line)
|
88 |
-
yield idx, example
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|