|
|
--- |
|
|
language: |
|
|
- en |
|
|
- ru |
|
|
license: mit |
|
|
task_categories: |
|
|
- text-classification |
|
|
dataset_info: |
|
|
config_name: simplified_ekman |
|
|
features: |
|
|
- name: ru_text |
|
|
dtype: string |
|
|
- name: text |
|
|
dtype: string |
|
|
- name: labels |
|
|
dtype: |
|
|
class_label: |
|
|
names: |
|
|
'0': sadness |
|
|
'1': joy |
|
|
'2': love |
|
|
'3': anger |
|
|
'4': fear |
|
|
'5': surprise |
|
|
- name: labels_ekman |
|
|
dtype: |
|
|
class_label: |
|
|
names: |
|
|
'0': anger |
|
|
'1': disgust |
|
|
'2': fear |
|
|
'3': joy |
|
|
'4': sadness |
|
|
'5': surprise |
|
|
'6': neutral |
|
|
splits: |
|
|
- name: train |
|
|
num_bytes: 103759867.36530161 |
|
|
num_examples: 333447 |
|
|
- name: validation |
|
|
num_bytes: 12970022.317349194 |
|
|
num_examples: 41681 |
|
|
- name: test |
|
|
num_bytes: 12970022.317349194 |
|
|
num_examples: 41681 |
|
|
download_size: 68831057 |
|
|
dataset_size: 129699912.0 |
|
|
configs: |
|
|
- config_name: simplified_ekman |
|
|
data_files: |
|
|
- split: train |
|
|
path: simplified_ekman/train-* |
|
|
- split: validation |
|
|
path: simplified_ekman/validation-* |
|
|
- split: test |
|
|
path: simplified_ekman/test-* |
|
|
--- |
|
|
The original dataset: https://www.kaggle.com/datasets/nelgiriyewithana/emotions |
|
|
|
|
|
The derived dataset was machine translated from English into Russian using the free Google Translate API (with [deep-translator](https://pypi.org/project/deep-translator/)). The translation script: |
|
|
|
|
|
```python |
|
|
import pandas as pd |
|
|
from deep_translator import GoogleTranslator |
|
|
from deep_translator.exceptions import TranslationNotFound |
|
|
|
|
|
# Load dataset and drop the ID column |
|
|
df = pd.read_csv("path_to_your_downloaded_file/text.csv").iloc[:, 1:] |
|
|
|
|
|
translator = GoogleTranslator(source="en", target="ru") |
|
|
|
|
|
def translate_samples(samples): |
|
|
texts = samples["text"].tolist() |
|
|
|
|
|
while True: |
|
|
try: |
|
|
translated = translator.translate_batch(texts) |
|
|
break |
|
|
except TranslationNotFound: |
|
|
print(f"Translation failed for '{texts}', retrying...") |
|
|
|
|
|
# Replace None with original text if translation is not applicable |
|
|
translated = [ |
|
|
t if t is not None else orig |
|
|
for t, orig in zip(translated, texts) |
|
|
] |
|
|
|
|
|
# Print replacements |
|
|
for t, orig in zip(translated, texts): |
|
|
if t == orig: |
|
|
print(f"Replaced {orig} with {t}") |
|
|
|
|
|
samples["ru_text"] = translated |
|
|
return samples |
|
|
|
|
|
# Apply batch translation |
|
|
batch_size = 500 |
|
|
translated_dataset = df.groupby(df.index // batch_size, group_keys=False).apply(translate_samples) |
|
|
``` |
|
|
|
|
|
Column `labels` contain the following classes: |
|
|
```yaml |
|
|
0: sadness |
|
|
1: joy |
|
|
2: love |
|
|
3: anger |
|
|
4: fear |
|
|
5: surprise |
|
|
``` |
|
|
|
|
|
Column `labels_ekman` contains the Ekman emotion classes: |
|
|
```yaml |
|
|
0: anger |
|
|
1: disgust - omitted in this dataset |
|
|
2: fear |
|
|
3: joy |
|
|
4: sadness |
|
|
5: surprise |
|
|
6: neutral - omitted in this dataset |
|
|
``` |
|
|
which were mapped from the original classes as follows: |
|
|
```yaml |
|
|
Original -> Ekman |
|
|
sadness (0) -> sadness (4) |
|
|
joy (1) -> joy (3) |
|
|
love (2) -> joy (3) |
|
|
anger (3) -> anger (0) |
|
|
fear (4) -> fear (2) |
|
|
surprise (5) -> surprise (5) |
|
|
``` |
|
|
|