Datasets:
Commit ·
3756947
verified ·
0
Parent(s):
Duplicate from tyqiangz/multilingual-sentiments
Browse filesCo-authored-by: Tay Yong Qiang <tyqiangz@users.noreply.huggingface.co>
- .DS_Store +0 -0
- .gitattributes +51 -0
- README.md +39 -0
- dataset_infos.json +1 -0
- multilingual-sentiments.py +165 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
.gitattributes
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lz4 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 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
# Audio files - uncompressed
|
| 34 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
# Audio files - compressed
|
| 38 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
# Image files - uncompressed
|
| 44 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
# Image files - compressed
|
| 49 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- de
|
| 4 |
+
- en
|
| 5 |
+
- es
|
| 6 |
+
- fr
|
| 7 |
+
- ja
|
| 8 |
+
- zh
|
| 9 |
+
- id
|
| 10 |
+
- ar
|
| 11 |
+
- hi
|
| 12 |
+
- it
|
| 13 |
+
- ms
|
| 14 |
+
- pt
|
| 15 |
+
license: apache-2.0
|
| 16 |
+
multilinguality:
|
| 17 |
+
- monolingual
|
| 18 |
+
- multilingual
|
| 19 |
+
size_categories:
|
| 20 |
+
- 100K<n<1M
|
| 21 |
+
- 1M<n<10M
|
| 22 |
+
task_categories:
|
| 23 |
+
- text-classification
|
| 24 |
+
task_ids:
|
| 25 |
+
- sentiment-analysis
|
| 26 |
+
- sentiment-classification
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# Multilingual Sentiments Dataset
|
| 30 |
+
|
| 31 |
+
A collection of multilingual sentiments datasets grouped into 3 classes -- positive, neutral, negative.
|
| 32 |
+
|
| 33 |
+
Most multilingual sentiment datasets are either 2-class positive or negative, 5-class ratings of products reviews (e.g. Amazon multilingual dataset) or multiple classes of emotions. However, to an average person, sometimes positive, negative and neutral classes suffice and are more straightforward to perceive and annotate. Also, a positive/negative classification is too naive, most of the text in the world is actually neutral in sentiment. Furthermore, most multilingual sentiment datasets don't include Asian languages (e.g. Malay, Indonesian) and are dominated by Western languages (e.g. English, German).
|
| 34 |
+
|
| 35 |
+
Git repo: https://github.com/tyqiangz/multilingual-sentiment-datasets
|
| 36 |
+
|
| 37 |
+
## Dataset Description
|
| 38 |
+
|
| 39 |
+
- **Webpage:** https://github.com/tyqiangz/multilingual-sentiment-datasets
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"id": {"description": "This sentence-level sentiment analysis dataset (Purwarianti and Crisdayanti, 2019)\nis a collection of comments and reviews in Indonesian obtained from multiple online\nplatforms. The text was crawled and then annotated by several Indonesian linguists\nto construct this dataset. There are three possible sentiments on the SmSA\ndataset: positive, negative, and neutral.", "citation": "@inproceedings{purwarianti2019improving,\n title={Improving Bi-LSTM Performance for Indonesian Sentiment Analysis Using Paragraph Vector},\n author={Ayu Purwarianti and Ida Ayu Putu Ari Crisdayanti},\n booktitle={Proceedings of the 2019 International Conference of Advanced Informatics: Concepts, Theory and Applications (ICAICTA)},\n pages={1--5},\n year={2019},\n organization={IEEE}\n}", "homepage": "https://www.indobenchmark.com/", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "id", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2209866, "num_examples": 11000, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 249625, "num_examples": 1260, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 77037, "num_examples": 500, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/indobenchmark/indonlu/master/dataset/smsa_doc-sentiment-prosa/train_preprocess.tsv": {"num_bytes": 2186718, "checksum": "50f38ceed9b31521bf1581e126620532cc9b790712938159a2cdcf6906977a9b"}, "https://raw.githubusercontent.com/indobenchmark/indonlu/master/dataset/smsa_doc-sentiment-prosa/valid_preprocess.tsv": {"num_bytes": 246974, "checksum": "6ab41ddc9d58a35086f05ebd2e209c74cb03d87d4f51d6abdfba674eafbefa74"}, "https://raw.githubusercontent.com/indobenchmark/indonlu/master/dataset/smsa_doc-sentiment-prosa/test_preprocess_masked_label.tsv": {"num_bytes": 75537, "checksum": "ecc239ad7a069774954843da50eba266398bab70d0370f74684bf1c107b64e70"}}, "download_size": 2509229, "post_processing_size": null, "dataset_size": 2536528, "size_in_bytes": 5045757}, "en": {"description": "English dataset", "citation": "", "homepage": "https://www.indobenchmark.com/", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "en", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 0, "num_examples": 0, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 0, "num_examples": 0, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 0, "num_examples": 0, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/en/train.tsv": {"num_bytes": 217706, "checksum": "e25dfcb4d3f5fc87caa0e39e0410638dadb1f96f5923b17faea81a0cf5fe66bc"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/en/valid.tsv": {"num_bytes": 38316, "checksum": "84a25a7fe69a000acfd3adbc4aa19da735eeb448970f7f34c9066d298e7ce077"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/en/test.tsv": {"num_bytes": 91275, "checksum": "07514cbb73a28c029e4d7a41fc61f3d9a6d1060412ab392e9ef696ba0a215bb0"}}, "download_size": 347297, "post_processing_size": null, "dataset_size": 0, "size_in_bytes": 347297}, "malay": {"description": "malay dataset.", "citation": "malay citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "malay", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 650770, "num_examples": 4687, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 141131, "num_examples": 1005, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 141423, "num_examples": 1005, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/malay/train.csv": {"num_bytes": 630189, "checksum": "bd27eaaa2b014119fea0ffb90bcb3138b456d4047664724fc65ac74426615721"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/malay/valid.csv": {"num_bytes": 136755, "checksum": "ee885dcd773f6eed7894519a6af355b40f0928dd2895ef7d95ea9e2a5b5cf403"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/malay/test.csv": {"num_bytes": 137015, "checksum": "32ad79fc03f957c7d8ae0253a5a3df8b59c7c2d92b5d529cd8fec192c10a79f6"}}, "download_size": 903959, "post_processing_size": null, "dataset_size": 933324, "size_in_bytes": 1837283}, "hindi": {"description": "hindi dataset.", "citation": "hindi citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "hindi", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 187901, "num_examples": 1839, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 34352, "num_examples": 324, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 84056, "num_examples": 870, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/hindi/train.csv": {"num_bytes": 178773, "checksum": "b4a6bc117a89851c8367408edb0400a1405df0c246de070f99005f8bcaaa8fd0"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/hindi/valid.csv": {"num_bytes": 32776, "checksum": "cf56ec1c0a9a1e7d55dcc60170f4ab873bbb8b856dd4e8466e9a7f9c4dfc429c"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/hindi/test.csv": {"num_bytes": 79726, "checksum": "16be62d7f2b57f396637aabda7db50a63c7cea90571c331035a30d8e927ee480"}}, "download_size": 291275, "post_processing_size": null, "dataset_size": 306309, "size_in_bytes": 597584}, "japanese": {"description": "japanese dataset.", "citation": "japanese citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "japanese", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 38611796, "num_examples": 120000, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 944465, "num_examples": 3000, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 957070, "num_examples": 3000, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/japanese/train.csv": {"num_bytes": 37973716, "checksum": "399be7d47ddcf732804d0a03a1ecce9b7fabf82cc70355f2b3873314b4acc79b"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/japanese/valid.csv": {"num_bytes": 928531, "checksum": "174892a3a91d55314044d85a56a5d6becc48138d4d74cacd4c5f20606b9b7c01"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/japanese/test.csv": {"num_bytes": 941124, "checksum": "2e219b35caa16d82b6e27bd6ec5660b9ffb70c6d4996606286c0fb10b1259501"}}, "download_size": 39843371, "post_processing_size": null, "dataset_size": 40513331, "size_in_bytes": 80356702}, "german": {"description": "german dataset.", "citation": "german citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "german", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 179639, "num_examples": 1839, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 30160, "num_examples": 324, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 84383, "num_examples": 870, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/german/train.csv": {"num_bytes": 171290, "checksum": "4c1a9f9c0454fc081ddd41fbac6bc883cf181bca7100d008591bdf2f2a82636c"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/german/valid.csv": {"num_bytes": 28655, "checksum": "346f76a36ea1bcc7342a91599bc245d42f162c14874bc2adf332e4a866ba8fde"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/german/test.csv": {"num_bytes": 80482, "checksum": "9310082f16b14849db4c1515c3d07760bf7b2d8e9fe2199783aeaf5ec50e63aa"}}, "download_size": 280427, "post_processing_size": null, "dataset_size": 294182, "size_in_bytes": 574609}, "italian": {"description": "italian dataset.", "citation": "italian citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "italian", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 222353, "num_examples": 1839, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 39540, "num_examples": 324, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 107650, "num_examples": 870, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/italian/train.csv": {"num_bytes": 214014, "checksum": "99fd4f68ab487cf642667f80f45bc9278923f633556deea27bcffdfb1448d107"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/italian/valid.csv": {"num_bytes": 38109, "checksum": "6e786c68de7bad9d1a39d7270c003ceedc76a764ca9e26f3ac8fd166dc6972e6"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/italian/test.csv": {"num_bytes": 103373, "checksum": "30c8b7a76a918e32e1bf616914f858e0c50810e8eb40da80cdf89f116fa8df8b"}}, "download_size": 355496, "post_processing_size": null, "dataset_size": 369543, "size_in_bytes": 725039}, "english": {"description": "english dataset.", "citation": "english citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "english", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 254824, "num_examples": 1839, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 44791, "num_examples": 324, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 106864, "num_examples": 870, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/english/train.csv": {"num_bytes": 247350, "checksum": "08abf3a6995d732dc1af70892fdcd6728fb27cac00e0dbdde7aa1ac015ff6056"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/english/valid.csv": {"num_bytes": 43524, "checksum": "32a36e15fed9d7bf8b857e6a48217715d9e38b001ab8c34824ce2dfc6709617c"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/english/test.csv": {"num_bytes": 102826, "checksum": "a7db671f797205d15a0570091e967f9a04c1fc071cb53b4c4197b79b287f8f37"}}, "download_size": 393700, "post_processing_size": null, "dataset_size": 406479, "size_in_bytes": 800179}, "portuguese": {"description": "portuguese dataset.", "citation": "portuguese citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "portuguese", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 192301, "num_examples": 1839, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 32709, "num_examples": 324, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 90096, "num_examples": 870, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/portuguese/train.csv": {"num_bytes": 183757, "checksum": "0bc3fbbe0533275a57a3b00a451aecd43ddc04d81f061445bc4cfd86739c4881"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/portuguese/valid.csv": {"num_bytes": 31177, "checksum": "7b84b6e1f51e3f91b5c37b9624969afe5142bc72c7e2c3623bb3112747749516"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/portuguese/test.csv": {"num_bytes": 86108, "checksum": "07b93e2157fcc96085ac8dde11b1a16d2968627b4002ec2513a4ba25897cf864"}}, "download_size": 301042, "post_processing_size": null, "dataset_size": 315106, "size_in_bytes": 616148}, "french": {"description": "french dataset.", "citation": "french citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "french", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 230006, "num_examples": 1839, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 40188, "num_examples": 324, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 106596, "num_examples": 870, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/french/train.csv": {"num_bytes": 221700, "checksum": "b05f8c635217bb53d12307437c2430e0dcbbf77080fb142a9c7c82bef001d695"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/french/valid.csv": {"num_bytes": 38761, "checksum": "f0603e275ecdeea2b272334b26eb2950a5d7f0a178567278ea95f8c65fb5e0e3"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/french/test.csv": {"num_bytes": 102656, "checksum": "6bee140ec5d006b64df9b9b435024f59aa30aeb6873b722d0044b28baa431fef"}}, "download_size": 363117, "post_processing_size": null, "dataset_size": 376790, "size_in_bytes": 739907}, "spanish": {"description": "spanish dataset.", "citation": "spanish citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "spanish", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 211108, "num_examples": 1839, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 37617, "num_examples": 324, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 100902, "num_examples": 870, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/spanish/train.csv": {"num_bytes": 202908, "checksum": "25ae7837279100e20f113a8f1c3ea64299a264dbeecc53611e80d1db48238269"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/spanish/valid.csv": {"num_bytes": 36207, "checksum": "83e85b71571dcec666c5c085fb751ea7882a42e3478a4fe8f48223fce120a357"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/spanish/test.csv": {"num_bytes": 97052, "checksum": "ab50d69bf7fc6e7b32d30f692a0b72edec6a5a6cc4553634ff1d9e993b1bf79d"}}, "download_size": 336167, "post_processing_size": null, "dataset_size": 349627, "size_in_bytes": 685794}, "chinese": {"description": "chinese dataset.", "citation": "chinese citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "chinese", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 22474086, "num_examples": 120000, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 555785, "num_examples": 3000, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 563522, "num_examples": 3000, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/chinese/train.csv": {"num_bytes": 21839388, "checksum": "4d847b1d300e52c3a67cc863727dfe24d7fc7c35350aa21767a9b5536af51911"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/chinese/valid.csv": {"num_bytes": 539915, "checksum": "c1b20e7b276ce73f9f477e5c0b0359aed101373098bbb9464e2dfe7ae514903f"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/chinese/test.csv": {"num_bytes": 547674, "checksum": "5e44c1335c36d5694dc50bff125d0a0c0d4b869968c06fa54ef43606767acce3"}}, "download_size": 22926977, "post_processing_size": null, "dataset_size": 23593393, "size_in_bytes": 46520370}, "all": {"description": "All datasets.", "citation": "All citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "language": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "all", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 69063358, "num_examples": 270399, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 2354116, "num_examples": 10857, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 2744290, "num_examples": 14465, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/all/train.csv": {"num_bytes": 66848321, "checksum": "52cdd6dc19de069ac6e32289c1b3d461d883631739b240bf80a703f8a8c0d228"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/all/valid.csv": {"num_bytes": 2268536, "checksum": "6118f6916a420d75a6eca13fcf237aaabdd657adb1e9cc357031b19e5ddaf959"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/all/test.csv": {"num_bytes": 2629789, "checksum": "d1b31a5c99ff63c459d86e81abca10f766ea94dfacee76a47b0fd0d0cbe2bbce"}}, "download_size": 71746646, "post_processing_size": null, "dataset_size": 74161764, "size_in_bytes": 145908410}, "indonesian": {"description": "indonesian dataset.", "citation": "indonesian citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "indonesian", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2396866, "num_examples": 11000, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 271045, "num_examples": 1260, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 85537, "num_examples": 500, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/indonesian/train.csv": {"num_bytes": 2354108, "checksum": "6a8af2355d9e03f262602308328106e9e04b77b7fe345adfe73093805a39e1f5"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/indonesian/valid.csv": {"num_bytes": 266180, "checksum": "092675412a96d4411401078b124fb31a415b7ce17e94b0abe6357e70c4bf3306"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/indonesian/test.csv": {"num_bytes": 83485, "checksum": "4bb9b30cb0d8a288809e1b33065a78d7543f8d38377cd8d9812503ca087d9726"}}, "download_size": 2703773, "post_processing_size": null, "dataset_size": 2753448, "size_in_bytes": 5457221}, "arabic": {"description": "arabic dataset.", "citation": "arabic citation", "homepage": "", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["positive", "neutral", "negative"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "multilingual-sentiments", "config_name": "arabic", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 337371, "num_examples": 1839, "dataset_name": "multilingual-sentiments"}, "validation": {"name": "validation", "num_bytes": 58784, "num_examples": 324, "dataset_name": "multilingual-sentiments"}, "test": {"name": "test", "num_bytes": 156326, "num_examples": 870, "dataset_name": "multilingual-sentiments"}}, "download_checksums": {"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/arabic/train.csv": {"num_bytes": 328177, "checksum": "de04c3f30a250a1eea2b099a38b47950ffdb497de48505720979128cdafdcb87"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/arabic/valid.csv": {"num_bytes": 57157, "checksum": "aa2bfcacc2bb628e86fa637a2322f2b716558a9d03731a3ebbcd304333025a38"}, "https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/arabic/test.csv": {"num_bytes": 151987, "checksum": "aadb117e75f886b99edcdcd4bfaad9ace433bbe758700038dc7806596c889373"}}, "download_size": 537321, "post_processing_size": null, "dataset_size": 552481, "size_in_bytes": 1089802}}
|
multilingual-sentiments.py
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 16 |
+
|
| 17 |
+
import csv
|
| 18 |
+
import textwrap
|
| 19 |
+
import pandas as pd
|
| 20 |
+
|
| 21 |
+
import datasets
|
| 22 |
+
|
| 23 |
+
import pandas as pd
|
| 24 |
+
|
| 25 |
+
LANGUAGES = ['malay', 'hindi', 'japanese', 'german',
|
| 26 |
+
'italian', 'english', 'portuguese', 'french',
|
| 27 |
+
'spanish', 'chinese', 'indonesian', 'arabic'
|
| 28 |
+
]
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class MultilingualSentimentsConfig(datasets.BuilderConfig):
|
| 32 |
+
"""BuilderConfig for Multilingual Sentiments"""
|
| 33 |
+
|
| 34 |
+
def __init__(
|
| 35 |
+
self,
|
| 36 |
+
text_features,
|
| 37 |
+
label_column,
|
| 38 |
+
label_classes,
|
| 39 |
+
train_url,
|
| 40 |
+
valid_url,
|
| 41 |
+
test_url,
|
| 42 |
+
citation,
|
| 43 |
+
**kwargs,
|
| 44 |
+
):
|
| 45 |
+
"""BuilderConfig for Multilingual Sentiments.
|
| 46 |
+
|
| 47 |
+
Args:
|
| 48 |
+
text_features: `dict[string, string]`, map from the name of the feature
|
| 49 |
+
dict for each text field to the name of the column in the txt/csv/tsv file
|
| 50 |
+
label_column: `string`, name of the column in the txt/csv/tsv file corresponding
|
| 51 |
+
to the label
|
| 52 |
+
label_classes: `list[string]`, the list of classes if the label is categorical
|
| 53 |
+
train_url: `string`, url to train file from
|
| 54 |
+
valid_url: `string`, url to valid file from
|
| 55 |
+
test_url: `string`, url to test file from
|
| 56 |
+
citation: `string`, citation for the data set
|
| 57 |
+
**kwargs: keyword arguments forwarded to super.
|
| 58 |
+
"""
|
| 59 |
+
super(MultilingualSentimentsConfig, self).__init__(
|
| 60 |
+
version=datasets.Version("1.0.0", ""), **kwargs)
|
| 61 |
+
self.text_features = text_features
|
| 62 |
+
self.label_column = label_column
|
| 63 |
+
self.label_classes = label_classes
|
| 64 |
+
self.train_url = train_url
|
| 65 |
+
self.valid_url = valid_url
|
| 66 |
+
self.test_url = test_url
|
| 67 |
+
self.citation = citation
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class MultilingualSentiments(datasets.GeneratorBasedBuilder):
|
| 71 |
+
"""Multilingual Sentiments benchmark"""
|
| 72 |
+
|
| 73 |
+
BUILDER_CONFIGS = []
|
| 74 |
+
|
| 75 |
+
BUILDER_CONFIGS.append(
|
| 76 |
+
MultilingualSentimentsConfig(
|
| 77 |
+
name="all",
|
| 78 |
+
description=textwrap.dedent(
|
| 79 |
+
f"""\
|
| 80 |
+
All datasets."""
|
| 81 |
+
),
|
| 82 |
+
text_features={"text": "text", "source": "source", "language": "language"},
|
| 83 |
+
label_classes=["positive", "neutral", "negative"],
|
| 84 |
+
label_column="label",
|
| 85 |
+
train_url=f"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/all/train.csv",
|
| 86 |
+
valid_url=f"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/all/valid.csv",
|
| 87 |
+
test_url=f"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/all/test.csv",
|
| 88 |
+
citation=textwrap.dedent(
|
| 89 |
+
f"""\
|
| 90 |
+
All citation"""
|
| 91 |
+
),
|
| 92 |
+
),
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
for lang in LANGUAGES:
|
| 96 |
+
BUILDER_CONFIGS.append(
|
| 97 |
+
MultilingualSentimentsConfig(
|
| 98 |
+
name=lang,
|
| 99 |
+
description=textwrap.dedent(
|
| 100 |
+
f"""\
|
| 101 |
+
{lang} dataset."""
|
| 102 |
+
),
|
| 103 |
+
text_features={"text": "text", "source": "source"},
|
| 104 |
+
label_classes=["positive", "neutral", "negative"],
|
| 105 |
+
label_column="label",
|
| 106 |
+
train_url=f"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/{lang}/train.csv",
|
| 107 |
+
valid_url=f"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/{lang}/valid.csv",
|
| 108 |
+
test_url=f"https://raw.githubusercontent.com/tyqiangz/multilingual-sentiment-datasets/main/data/{lang}/test.csv",
|
| 109 |
+
citation=textwrap.dedent(
|
| 110 |
+
f"""\
|
| 111 |
+
{lang} citation"""
|
| 112 |
+
),
|
| 113 |
+
),
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
def _info(self):
|
| 117 |
+
features = {text_feature: datasets.Value(
|
| 118 |
+
"string") for text_feature in self.config.text_features}
|
| 119 |
+
|
| 120 |
+
features["label"] = datasets.features.ClassLabel(
|
| 121 |
+
names=self.config.label_classes)
|
| 122 |
+
|
| 123 |
+
return datasets.DatasetInfo(
|
| 124 |
+
description=self.config.description,
|
| 125 |
+
features=datasets.Features(features),
|
| 126 |
+
citation=self.config.citation,
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
def _split_generators(self, dl_manager):
|
| 130 |
+
"""Returns SplitGenerators."""
|
| 131 |
+
train_path = dl_manager.download_and_extract(self.config.train_url)
|
| 132 |
+
valid_path = dl_manager.download_and_extract(self.config.valid_url)
|
| 133 |
+
test_path = dl_manager.download_and_extract(self.config.test_url)
|
| 134 |
+
return [
|
| 135 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={
|
| 136 |
+
"filepath": train_path}),
|
| 137 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={
|
| 138 |
+
"filepath": valid_path}),
|
| 139 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={
|
| 140 |
+
"filepath": test_path}),
|
| 141 |
+
]
|
| 142 |
+
|
| 143 |
+
def _generate_examples(self, filepath):
|
| 144 |
+
|
| 145 |
+
df = pd.read_csv(filepath)
|
| 146 |
+
|
| 147 |
+
print('-'*100)
|
| 148 |
+
print(df.head())
|
| 149 |
+
print('-'*100)
|
| 150 |
+
|
| 151 |
+
for id_, row in df.iterrows():
|
| 152 |
+
if self.config.name != "all":
|
| 153 |
+
text = row["text"]
|
| 154 |
+
label = row["label"]
|
| 155 |
+
source = row["source"]
|
| 156 |
+
|
| 157 |
+
yield id_, {"text": text, "label": label, "source": source}
|
| 158 |
+
|
| 159 |
+
else:
|
| 160 |
+
text = row["text"]
|
| 161 |
+
label = row["label"]
|
| 162 |
+
source = row["source"]
|
| 163 |
+
language = row["language"]
|
| 164 |
+
|
| 165 |
+
yield id_, {"text": text, "label": label, "source": source, "language": language}
|