Datasets:

Modalities:
Text
Formats:
parquet
Libraries:
Datasets
pandas
License:
twitter_emotions-ru / README.md
normundsg's picture
Bug-fix
6d48e9c
metadata
language:
  - ru
  - en
license: apache-2.0
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
    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
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-*

Twitter Emotions dataset in Russian

The original dataset: Emotions

The derived dataset was machine translated from English into Russian using the free Google Translate API (with deep-translator). It also contains an additional labels_ekman column that maps the original emotion classes to the Paul Ekman's classification.

The translation script:

import pandas as pd
from deep_translator import GoogleTranslator
from deep_translator.exceptions import TranslationNotFound

# Loads the dataset and drops the ID column
df = pd.read_csv("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...")

    # Replaces None values with the original text if translation was not successful
    translated = [
        t if t is not None else orig
        for t, orig in zip(translated, texts)
    ]

    # Prints 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)

The column labels contains the emotion classes of the original dataset:

0: sadness
1: joy
2: love - not distinguished in the Ekman's classification
3: anger
4: fear
5: surprise

The column labels_ekman contains the corresponding Ekman's emotion classes:

0: anger
1: disgust - omitted, since not used in the original dataset
2: fear
3: joy
4: sadness
5: surprise

The mapping from the original to the Ekman's classification is made as follows:

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)

See also

https://huggingface.co/datasets/AiLab-IMCS-UL/go_emotions-ru

Acknowledgements

This work was supported by the EU Recovery and Resilience Facility project Language Technology Initiative (2.3.1.1.i.0/1/22/I/CFLA/002).