Datasets:
Commit
·
ab3b240
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +161 -0
- dataset_infos.json +1 -0
- dummy/en_annotated/1.1.0/dummy_data.zip +3 -0
- dummy/en_neutral/1.1.0/dummy_data.zip +3 -0
- dummy/fi_annotated/1.1.0/dummy_data.zip +3 -0
- dummy/fi_neutral/1.1.0/dummy_data.zip +3 -0
- xed_en_fi.py +144 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
- fi
|
9 |
+
licenses:
|
10 |
+
- cc-by-4-0
|
11 |
+
multilinguality:
|
12 |
+
- multilingual
|
13 |
+
size_categories:
|
14 |
+
- n<1K
|
15 |
+
source_datasets:
|
16 |
+
- extended|other-OpenSubtitles2016
|
17 |
+
task_categories:
|
18 |
+
- text-classification
|
19 |
+
task_ids:
|
20 |
+
- intent-classification
|
21 |
+
- multi-class-classification
|
22 |
+
- multi-label-classification
|
23 |
+
- sentiment-classification
|
24 |
+
---
|
25 |
+
|
26 |
+
# Dataset Card for xed_english_finnish
|
27 |
+
|
28 |
+
## Table of Contents
|
29 |
+
- [Dataset Description](#dataset-description)
|
30 |
+
- [Dataset Summary](#dataset-summary)
|
31 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
32 |
+
- [Languages](#languages)
|
33 |
+
- [Dataset Structure](#dataset-structure)
|
34 |
+
- [Data Instances](#data-instances)
|
35 |
+
- [Data Fields](#data-instances)
|
36 |
+
- [Data Splits](#data-instances)
|
37 |
+
- [Dataset Creation](#dataset-creation)
|
38 |
+
- [Curation Rationale](#curation-rationale)
|
39 |
+
- [Source Data](#source-data)
|
40 |
+
- [Annotations](#annotations)
|
41 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
42 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
43 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
44 |
+
- [Discussion of Biases](#discussion-of-biases)
|
45 |
+
- [Other Known Limitations](#other-known-limitations)
|
46 |
+
- [Additional Information](#additional-information)
|
47 |
+
- [Dataset Curators](#dataset-curators)
|
48 |
+
- [Licensing Information](#licensing-information)
|
49 |
+
- [Citation Information](#citation-information)
|
50 |
+
|
51 |
+
## Dataset Description
|
52 |
+
|
53 |
+
- **Homepage:**
|
54 |
+
- **Repository:** [Github](https://github.com/Helsinki-NLP/XED)
|
55 |
+
- **Paper:** [Arxiv](https://arxiv.org/abs/2011.01612)
|
56 |
+
- **Leaderboard:**
|
57 |
+
- **Point of Contact:**
|
58 |
+
|
59 |
+
### Dataset Summary
|
60 |
+
|
61 |
+
This is the XED dataset. The dataset consists of emotion annotated movie subtitles from OPUS. We use Plutchik's 8 core emotions to annotate. The data is multilabel. The original annotations have been sourced for mainly English and Finnish.
|
62 |
+
For the English data we used Stanford NER (named entity recognition) (Finkel et al., 2005) to replace names and locations with the tags: [PERSON] and [LOCATION] respectively.
|
63 |
+
For the Finnish data, we replaced names and locations using the Turku NER corpus (Luoma et al., 2020).
|
64 |
+
|
65 |
+
### Supported Tasks and Leaderboards
|
66 |
+
|
67 |
+
Sentiment Classification, Multilabel Classification, Multilabel Classification, Intent Classification
|
68 |
+
|
69 |
+
### Languages
|
70 |
+
|
71 |
+
English, Finnish
|
72 |
+
|
73 |
+
## Dataset Structure
|
74 |
+
|
75 |
+
### Data Instances
|
76 |
+
|
77 |
+
```
|
78 |
+
{ "sentence": "A confession that you hired [PERSON] ... and are responsible for my father's murder."
|
79 |
+
"labels": [1, 6] # anger, sadness
|
80 |
+
}
|
81 |
+
```
|
82 |
+
|
83 |
+
### Data Fields
|
84 |
+
|
85 |
+
- sentence: a line from the dataset
|
86 |
+
- labels: labels corresponding to the emotion as an integer
|
87 |
+
|
88 |
+
Where the number indicates the emotion in ascending alphabetical order: anger:1, anticipation:2, disgust:3, fear:4, joy:5, sadness:6, surprise:7, trust:8, with neutral:0 where applicable.
|
89 |
+
|
90 |
+
### Data Splits
|
91 |
+
|
92 |
+
For English:
|
93 |
+
Number of unique data points: 17528 ('en_annotated' config) + 9675 ('en_neutral' config)
|
94 |
+
Number of emotions: 8 (+neutral)
|
95 |
+
|
96 |
+
For Finnish:
|
97 |
+
Number of unique data points: 14449 ('fi_annotated' config) + 10794 ('fi_neutral' config)
|
98 |
+
Number of emotions: 8 (+neutral)
|
99 |
+
|
100 |
+
## Dataset Creation
|
101 |
+
|
102 |
+
### Curation Rationale
|
103 |
+
|
104 |
+
[More Information Needed]
|
105 |
+
|
106 |
+
### Source Data
|
107 |
+
|
108 |
+
#### Initial Data Collection and Normalization
|
109 |
+
|
110 |
+
[More Information Needed]
|
111 |
+
|
112 |
+
#### Who are the source language producers?
|
113 |
+
|
114 |
+
[More Information Needed]
|
115 |
+
|
116 |
+
### Annotations
|
117 |
+
|
118 |
+
#### Annotation process
|
119 |
+
|
120 |
+
[More Information Needed]
|
121 |
+
|
122 |
+
#### Who are the annotators?
|
123 |
+
|
124 |
+
[More Information Needed]
|
125 |
+
|
126 |
+
### Personal and Sensitive Information
|
127 |
+
|
128 |
+
[More Information Needed]
|
129 |
+
|
130 |
+
## Considerations for Using the Data
|
131 |
+
|
132 |
+
### Social Impact of Dataset
|
133 |
+
|
134 |
+
[More Information Needed]
|
135 |
+
|
136 |
+
### Discussion of Biases
|
137 |
+
|
138 |
+
[More Information Needed]
|
139 |
+
|
140 |
+
### Other Known Limitations
|
141 |
+
|
142 |
+
[More Information Needed]
|
143 |
+
|
144 |
+
## Additional Information
|
145 |
+
|
146 |
+
### Dataset Curators
|
147 |
+
|
148 |
+
[More Information Needed]
|
149 |
+
|
150 |
+
### Licensing Information
|
151 |
+
|
152 |
+
License: Creative Commons Attribution 4.0 International License (CC-BY)
|
153 |
+
|
154 |
+
### Citation Information
|
155 |
+
|
156 |
+
@inproceedings{ohman2020xed,
|
157 |
+
title={XED: A Multilingual Dataset for Sentiment Analysis and Emotion Detection},
|
158 |
+
author={{\"O}hman, Emily and P{\`a}mies, Marc and Kajava, Kaisla and Tiedemann, J{\"o}rg},
|
159 |
+
booktitle={The 28th International Conference on Computational Linguistics (COLING 2020)},
|
160 |
+
year={2020}
|
161 |
+
}
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"en_annotated": {"description": "A multilingual fine-grained emotion dataset. The dataset consists of human annotated Finnish (25k) and English sentences (30k). Plutchik\u2019s\ncore emotions are used to annotate the dataset with the addition of neutral to create a multilabel multiclass\ndataset. The dataset is carefully evaluated using language-specific BERT models and SVMs to\nshow that XED performs on par with other similar datasets and is therefore a useful tool for\nsentiment analysis and emotion detection.\n", "citation": "@inproceedings{ohman2020xed,\n title={XED: A Multilingual Dataset for Sentiment Analysis and Emotion Detection},\n author={{\"O}hman, Emily and P{\"a}mies, Marc and Kajava, Kaisla and Tiedemann, J{\"o}rg},\n booktitle={The 28th International Conference on Computational Linguistics (COLING 2020)},\n year={2020}\n}\n", "homepage": "", "license": "License: Creative Commons Attribution 4.0 International License (CC-BY)", "features": {"sentence": {"dtype": "string", "id": null, "_type": "Value"}, "labels": {"feature": {"num_classes": 9, "names": ["neutral", "anger", "anticipation", "disgust", "fear", "joy", "sadness", "surprise", "trust"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "xed_en_fi", "config_name": "en_annotated", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1018485, "num_examples": 17528, "dataset_name": "xed_en_fi"}}, "download_checksums": {"https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/en-annotated.tsv": {"num_bytes": 783663, "checksum": "26ac0254fbdb8b09cf2b00d44041d9084ece31bd200ae7c0e0662fbd8b037d98"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/fi-annotated.tsv": {"num_bytes": 560675, "checksum": "0b5ba26b2636c3a773b77a12b1b6a86a0b6ad49c6a50572ac43868d443992392"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_en.txt": {"num_bytes": 314079, "checksum": "6e8b38af83b80fb64ec1139007973b1f09ec16d48549e82de22423cdba259f08"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_fi.txt": {"num_bytes": 762818, "checksum": "05634a802d7ceb34b17a78c04bf240714b8b814524892cef85ffe67223e4c777"}}, "download_size": 2421235, "post_processing_size": null, "dataset_size": 1018485, "size_in_bytes": 3439720}, "en_neutral": {"description": "A multilingual fine-grained emotion dataset. The dataset consists of human annotated Finnish (25k) and English sentences (30k). Plutchik\u2019s\ncore emotions are used to annotate the dataset with the addition of neutral to create a multilabel multiclass\ndataset. The dataset is carefully evaluated using language-specific BERT models and SVMs to\nshow that XED performs on par with other similar datasets and is therefore a useful tool for\nsentiment analysis and emotion detection.\n", "citation": "@inproceedings{ohman2020xed,\n title={XED: A Multilingual Dataset for Sentiment Analysis and Emotion Detection},\n author={{\"O}hman, Emily and P{\"a}mies, Marc and Kajava, Kaisla and Tiedemann, J{\"o}rg},\n booktitle={The 28th International Conference on Computational Linguistics (COLING 2020)},\n year={2020}\n}\n", "homepage": "", "license": "License: Creative Commons Attribution 4.0 International License (CC-BY)", "features": {"sentence": {"dtype": "string", "id": null, "_type": "Value"}, "labels": {"num_classes": 9, "names": ["neutral", "anger", "anticipation", "disgust", "fear", "joy", "sadness", "surprise", "trust"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "xed_en_fi", "config_name": "en_neutral", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 401129, "num_examples": 9675, "dataset_name": "xed_en_fi"}}, "download_checksums": {"https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/en-annotated.tsv": {"num_bytes": 783663, "checksum": "26ac0254fbdb8b09cf2b00d44041d9084ece31bd200ae7c0e0662fbd8b037d98"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/fi-annotated.tsv": {"num_bytes": 560675, "checksum": "0b5ba26b2636c3a773b77a12b1b6a86a0b6ad49c6a50572ac43868d443992392"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_en.txt": {"num_bytes": 314079, "checksum": "6e8b38af83b80fb64ec1139007973b1f09ec16d48549e82de22423cdba259f08"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_fi.txt": {"num_bytes": 762818, "checksum": "05634a802d7ceb34b17a78c04bf240714b8b814524892cef85ffe67223e4c777"}}, "download_size": 2421235, "post_processing_size": null, "dataset_size": 401129, "size_in_bytes": 2822364}, "fi_annotated": {"description": "A multilingual fine-grained emotion dataset. The dataset consists of human annotated Finnish (25k) and English sentences (30k). Plutchik\u2019s\ncore emotions are used to annotate the dataset with the addition of neutral to create a multilabel multiclass\ndataset. The dataset is carefully evaluated using language-specific BERT models and SVMs to\nshow that XED performs on par with other similar datasets and is therefore a useful tool for\nsentiment analysis and emotion detection.\n", "citation": "@inproceedings{ohman2020xed,\n title={XED: A Multilingual Dataset for Sentiment Analysis and Emotion Detection},\n author={{\"O}hman, Emily and P{\"a}mies, Marc and Kajava, Kaisla and Tiedemann, J{\"o}rg},\n booktitle={The 28th International Conference on Computational Linguistics (COLING 2020)},\n year={2020}\n}\n", "homepage": "", "license": "License: Creative Commons Attribution 4.0 International License (CC-BY)", "features": {"sentence": {"dtype": "string", "id": null, "_type": "Value"}, "labels": {"feature": {"num_classes": 9, "names": ["neutral", "anger", "anticipation", "disgust", "fear", "joy", "sadness", "surprise", "trust"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "xed_en_fi", "config_name": "fi_annotated", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 756224, "num_examples": 14449, "dataset_name": "xed_en_fi"}}, "download_checksums": {"https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/en-annotated.tsv": {"num_bytes": 783663, "checksum": "26ac0254fbdb8b09cf2b00d44041d9084ece31bd200ae7c0e0662fbd8b037d98"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/fi-annotated.tsv": {"num_bytes": 560675, "checksum": "0b5ba26b2636c3a773b77a12b1b6a86a0b6ad49c6a50572ac43868d443992392"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_en.txt": {"num_bytes": 314079, "checksum": "6e8b38af83b80fb64ec1139007973b1f09ec16d48549e82de22423cdba259f08"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_fi.txt": {"num_bytes": 762818, "checksum": "05634a802d7ceb34b17a78c04bf240714b8b814524892cef85ffe67223e4c777"}}, "download_size": 2421235, "post_processing_size": null, "dataset_size": 756224, "size_in_bytes": 3177459}, "fi_neutral": {"description": "A multilingual fine-grained emotion dataset. The dataset consists of human annotated Finnish (25k) and English sentences (30k). Plutchik\u2019s\ncore emotions are used to annotate the dataset with the addition of neutral to create a multilabel multiclass\ndataset. The dataset is carefully evaluated using language-specific BERT models and SVMs to\nshow that XED performs on par with other similar datasets and is therefore a useful tool for\nsentiment analysis and emotion detection.\n", "citation": "@inproceedings{ohman2020xed,\n title={XED: A Multilingual Dataset for Sentiment Analysis and Emotion Detection},\n author={{\"O}hman, Emily and P{\"a}mies, Marc and Kajava, Kaisla and Tiedemann, J{\"o}rg},\n booktitle={The 28th International Conference on Computational Linguistics (COLING 2020)},\n year={2020}\n}\n", "homepage": "", "license": "License: Creative Commons Attribution 4.0 International License (CC-BY)", "features": {"sentence": {"dtype": "string", "id": null, "_type": "Value"}, "labels": {"num_classes": 9, "names": ["neutral", "anger", "anticipation", "disgust", "fear", "joy", "sadness", "surprise", "trust"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "xed_en_fi", "config_name": "fi_neutral", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 427499, "num_examples": 10794, "dataset_name": "xed_en_fi"}}, "download_checksums": {"https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/en-annotated.tsv": {"num_bytes": 783663, "checksum": "26ac0254fbdb8b09cf2b00d44041d9084ece31bd200ae7c0e0662fbd8b037d98"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/fi-annotated.tsv": {"num_bytes": 560675, "checksum": "0b5ba26b2636c3a773b77a12b1b6a86a0b6ad49c6a50572ac43868d443992392"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_en.txt": {"num_bytes": 314079, "checksum": "6e8b38af83b80fb64ec1139007973b1f09ec16d48549e82de22423cdba259f08"}, "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_fi.txt": {"num_bytes": 762818, "checksum": "05634a802d7ceb34b17a78c04bf240714b8b814524892cef85ffe67223e4c777"}}, "download_size": 2421235, "post_processing_size": null, "dataset_size": 427499, "size_in_bytes": 2848734}}
|
dummy/en_annotated/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d1390a7e979c52afa8d6763ad0a205fa4c3c65602a1d946910d1f0c3ab696d09
|
3 |
+
size 1243
|
dummy/en_neutral/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:43f07d44d30d685038e23eef4141462fe53b57865f22aaade215f8287fae8c0f
|
3 |
+
size 1243
|
dummy/fi_annotated/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ecee9980e0db6e83ccd71ab51f5fd572d594fb579ddb0ddedb1b4b5040fe7a3e
|
3 |
+
size 1243
|
dummy/fi_neutral/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:66fc92745c607a5905966c52dd6a4ba45250fb0c1f7a7826d237334d3486924c
|
3 |
+
size 1243
|
xed_en_fi.py
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
"""XED: A multilingual fine-grained emotion dataset. The dataset consists of humanannotated Finnish (25k) and English sentences (30k)."""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import datasets
|
20 |
+
|
21 |
+
|
22 |
+
_CITATION = """\
|
23 |
+
@inproceedings{ohman2020xed,
|
24 |
+
title={XED: A Multilingual Dataset for Sentiment Analysis and Emotion Detection},
|
25 |
+
author={{\"O}hman, Emily and P{\"a}mies, Marc and Kajava, Kaisla and Tiedemann, J{\"o}rg},
|
26 |
+
booktitle={The 28th International Conference on Computational Linguistics (COLING 2020)},
|
27 |
+
year={2020}
|
28 |
+
}
|
29 |
+
"""
|
30 |
+
|
31 |
+
_DESCRIPTION = """\
|
32 |
+
A multilingual fine-grained emotion dataset. The dataset consists of human annotated Finnish (25k) and English sentences (30k). Plutchik’s
|
33 |
+
core emotions are used to annotate the dataset with the addition of neutral to create a multilabel multiclass
|
34 |
+
dataset. The dataset is carefully evaluated using language-specific BERT models and SVMs to
|
35 |
+
show that XED performs on par with other similar datasets and is therefore a useful tool for
|
36 |
+
sentiment analysis and emotion detection.
|
37 |
+
"""
|
38 |
+
|
39 |
+
_HOMEPAGE = ""
|
40 |
+
|
41 |
+
_LICENSE = "License: Creative Commons Attribution 4.0 International License (CC-BY)"
|
42 |
+
|
43 |
+
_URLs = {
|
44 |
+
"en_annotated": "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/en-annotated.tsv",
|
45 |
+
"fi_annotated": "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/fi-annotated.tsv",
|
46 |
+
"en_neutral": "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_en.txt",
|
47 |
+
"fi_neutral": "https://raw.githubusercontent.com/Helsinki-NLP/XED/master/AnnotatedData/neu_fi.txt",
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
class XedEnFi(datasets.GeneratorBasedBuilder):
|
52 |
+
"""XED: A multilingual fine-grained emotion dataset. The dataset consists of humanannotated Finnish (25k) and English sentences (30k)."""
|
53 |
+
|
54 |
+
VERSION = datasets.Version("1.1.0")
|
55 |
+
|
56 |
+
BUILDER_CONFIGS = [
|
57 |
+
datasets.BuilderConfig(
|
58 |
+
name="en_annotated", version=VERSION, description="English, Covers 8 classes without neutral"
|
59 |
+
),
|
60 |
+
datasets.BuilderConfig(name="en_neutral", version=VERSION, description="English, Covers neutral"),
|
61 |
+
datasets.BuilderConfig(
|
62 |
+
name="fi_annotated", version=VERSION, description="Finnish, Covers 8 classes without neutral"
|
63 |
+
),
|
64 |
+
datasets.BuilderConfig(name="fi_neutral", version=VERSION, description="Finnish, Covers neutral"),
|
65 |
+
]
|
66 |
+
|
67 |
+
def _info(self):
|
68 |
+
if self.config.name == "en_annotated" or self.config.name == "fi_annotated":
|
69 |
+
features = datasets.Features(
|
70 |
+
{
|
71 |
+
"sentence": datasets.Value("string"),
|
72 |
+
"labels": datasets.Sequence(
|
73 |
+
datasets.features.ClassLabel(
|
74 |
+
names=[
|
75 |
+
"neutral",
|
76 |
+
"anger",
|
77 |
+
"anticipation",
|
78 |
+
"disgust",
|
79 |
+
"fear",
|
80 |
+
"joy",
|
81 |
+
"sadness",
|
82 |
+
"surprise",
|
83 |
+
"trust",
|
84 |
+
]
|
85 |
+
)
|
86 |
+
)
|
87 |
+
# the number indicates the emotion in ascending alphabetical order: neutral:0, anger:1, anticipation:2, disgust:3, fear:4, joy:5, #sadness:6, surprise:7, trust:8 in the text.
|
88 |
+
}
|
89 |
+
)
|
90 |
+
else:
|
91 |
+
features = datasets.Features(
|
92 |
+
{
|
93 |
+
"sentence": datasets.Value("string"),
|
94 |
+
"labels": datasets.features.ClassLabel(
|
95 |
+
names=[
|
96 |
+
"neutral",
|
97 |
+
"anger",
|
98 |
+
"anticipation",
|
99 |
+
"disgust",
|
100 |
+
"fear",
|
101 |
+
"joy",
|
102 |
+
"sadness",
|
103 |
+
"surprise",
|
104 |
+
"trust",
|
105 |
+
]
|
106 |
+
),
|
107 |
+
}
|
108 |
+
)
|
109 |
+
return datasets.DatasetInfo(
|
110 |
+
description=_DESCRIPTION,
|
111 |
+
features=features,
|
112 |
+
supervised_keys=None,
|
113 |
+
homepage=_HOMEPAGE,
|
114 |
+
license=_LICENSE,
|
115 |
+
citation=_CITATION,
|
116 |
+
)
|
117 |
+
|
118 |
+
def _split_generators(self, dl_manager):
|
119 |
+
"""Returns SplitGenerators."""
|
120 |
+
my_urls = _URLs
|
121 |
+
data_dir = dl_manager.download_and_extract(my_urls)
|
122 |
+
return [
|
123 |
+
datasets.SplitGenerator(
|
124 |
+
name=datasets.Split.TRAIN,
|
125 |
+
# These kwargs will be passed to _generate_examples
|
126 |
+
gen_kwargs={"filepath": data_dir[self.config.name]},
|
127 |
+
),
|
128 |
+
]
|
129 |
+
|
130 |
+
def _generate_examples(self, filepath):
|
131 |
+
""" Yields examples. """
|
132 |
+
with open(filepath, encoding="utf-8") as f:
|
133 |
+
for id_, line in enumerate(f):
|
134 |
+
if self.config.name == "en_neutral":
|
135 |
+
sentence = line[1:].strip()
|
136 |
+
labels = "neutral"
|
137 |
+
elif self.config.name == "fi_neutral":
|
138 |
+
sentence = line.split("\t")[1].strip()
|
139 |
+
labels = "neutral"
|
140 |
+
else:
|
141 |
+
sentence = line.split("\t")[0]
|
142 |
+
labels = list(map(int, line.split("\t")[1].split(",")))
|
143 |
+
|
144 |
+
yield id_, {"sentence": sentence, "labels": labels}
|