Datasets:

Modalities:
Text
Formats:
parquet
Libraries:
Datasets
pandas
License:

Initial data import

#1
by SkyWater21 - opened
README.md CHANGED
@@ -1,3 +1,134 @@
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
+ dataset_info:
4
+ config_name: simplified_ekman
5
+ features:
6
+ - name: lv_text
7
+ dtype: string
8
+ - name: text
9
+ dtype: string
10
+ - name: labels
11
+ dtype:
12
+ class_label:
13
+ names:
14
+ '0': sadness
15
+ '1': joy
16
+ '2': love
17
+ '3': anger
18
+ '4': fear
19
+ '5': surprise
20
+ - name: labels_ekman
21
+ dtype:
22
+ class_label:
23
+ names:
24
+ '0': anger
25
+ '1': disgust
26
+ '2': fear
27
+ '3': joy
28
+ '4': sadness
29
+ '5': surprise
30
+ '6': neutral
31
+ splits:
32
+ - name: train
33
+ num_bytes: 72761213.15815398
34
+ num_examples: 333447
35
+ - name: validation
36
+ num_bytes: 9095178.920923013
37
+ num_examples: 41681
38
+ - name: test
39
+ num_bytes: 9095178.920923013
40
+ num_examples: 41681
41
+ download_size: 56044603
42
+ dataset_size: 90951571
43
+ configs:
44
+ - config_name: simplified_ekman
45
+ data_files:
46
+ - split: train
47
+ path: simplified_ekman/train-*
48
+ - split: validation
49
+ path: simplified_ekman/validation-*
50
+ - split: test
51
+ path: simplified_ekman/test-*
52
+ task_categories:
53
+ - text-classification
54
+ language:
55
+ - lv
56
+ - en
57
+ size_categories:
58
+ - 100K<n<1M
59
  ---
60
+ The original dataset: https://www.kaggle.com/datasets/nelgiriyewithana/emotions
61
+
62
+ The derived dataset was machine translated from English into Latvian using the free Google Translate API (with [deep-translator](https://pypi.org/project/deep-translator/)). The translation script:
63
+
64
+ ```python
65
+ import pandas as pd
66
+ from deep_translator import GoogleTranslator
67
+ from deep_translator.exceptions import TranslationNotFound
68
+
69
+ # Load dataset and drop the ID column
70
+ df = pd.read_csv("path_to_your_downloaded_file/text.csv").iloc[:, 1:]
71
+
72
+ translator = GoogleTranslator(source="en", target="lv")
73
+
74
+ def translate_samples(samples):
75
+ texts = samples["text"].tolist()
76
+
77
+ while True:
78
+ try:
79
+ translated = translator.translate_batch(texts)
80
+ break
81
+ except TranslationNotFound:
82
+ print(f"Translation failed for '{texts}', retrying...")
83
+
84
+ # Replace None with original text if translation is not applicable
85
+ translated = [
86
+ t if t is not None else orig
87
+ for t, orig in zip(translated, texts)
88
+ ]
89
+
90
+ # Print replacements
91
+ for t, orig in zip(translated, texts):
92
+ if t == orig:
93
+ print(f"Replaced {orig} with {t}")
94
+
95
+ samples["lv_text"] = translated
96
+ return samples
97
+
98
+ # Apply batch translation
99
+ batch_size = 500
100
+ translated_dataset = df.groupby(df.index // batch_size, group_keys=False).apply(translate_samples)
101
+ ```
102
+
103
+ Column `labels` contain the following classes:
104
+ ```yaml
105
+ 0: sadness
106
+ 1: joy
107
+ 2: love
108
+ 3: anger
109
+ 4: fear
110
+ 5: surprise
111
+ ```
112
+
113
+ Column `labels_ekman` contains the Ekman emotion classes:
114
+ ```yaml
115
+ 0: anger
116
+ 1: disgust - omitted in this dataset
117
+ 2: fear
118
+ 3: joy
119
+ 4: sadness
120
+ 5: surprise
121
+ 6: neutral - omitted in this dataset
122
+ ```
123
+ which were mapped from the original classes as follows:
124
+ ```yaml
125
+ Original -> Ekman
126
+ sadness (0) -> sadness (4)
127
+ joy (1) -> joy (3)
128
+ love (2) -> joy (3)
129
+ anger (3) -> anger (0)
130
+ fear (4) -> fear (2)
131
+ surprise (5) -> surprise (5)
132
+ ```
133
+
134
+
simplified_ekman/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7e3592db12ecdf24c9985442f58a8f79df6945410a91dec1f75124d7c4f602d
3
+ size 5445038
simplified_ekman/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98c01d786756be955ba76204880e6bc6dc69638207ce627bada96e2f89f19f76
3
+ size 43161945
simplified_ekman/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e2dc47267983099ac118863dbbb0fcfbd0bda597f6c35020c95d574663e11e7
3
+ size 5449524