Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
sentiment-classification
Languages:
Arabic
Size:
10K - 100K
License:
Delete loading script
Browse files- emotone_ar.py +0 -79
emotone_ar.py
DELETED
@@ -1,79 +0,0 @@
|
|
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 |
-
"""Dataset of 10065 tweets in Arabic for Emotion detection in Arabic text """
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
|
20 |
-
import datasets
|
21 |
-
from datasets.tasks import TextClassification
|
22 |
-
|
23 |
-
|
24 |
-
_CITATION = """\
|
25 |
-
@inbook{inbook,
|
26 |
-
author = {Al-Khatib, Amr and El-Beltagy, Samhaa},
|
27 |
-
year = {2018},
|
28 |
-
month = {01},
|
29 |
-
pages = {105-114},
|
30 |
-
title = {Emotional Tone Detection in Arabic Tweets: 18th International Conference, CICLing 2017, Budapest, Hungary, April 17–23, 2017, Revised Selected Papers, Part II},
|
31 |
-
isbn = {978-3-319-77115-1},
|
32 |
-
doi = {10.1007/978-3-319-77116-8_8}
|
33 |
-
}
|
34 |
-
"""
|
35 |
-
|
36 |
-
|
37 |
-
_DESCRIPTION = """\
|
38 |
-
Dataset of 10065 tweets in Arabic for Emotion detection in Arabic text"""
|
39 |
-
|
40 |
-
|
41 |
-
_HOMEPAGE = "https://github.com/AmrMehasseb/Emotional-Tone"
|
42 |
-
|
43 |
-
|
44 |
-
_DOWNLOAD_URL = "https://raw.githubusercontent.com/AmrMehasseb/Emotional-Tone/master/Emotional-Tone-Dataset.csv"
|
45 |
-
|
46 |
-
|
47 |
-
class EmotoneAr(datasets.GeneratorBasedBuilder):
|
48 |
-
"""Dataset of 10065 tweets in Arabic for Emotions detection in Arabic text"""
|
49 |
-
|
50 |
-
def _info(self):
|
51 |
-
return datasets.DatasetInfo(
|
52 |
-
description=_DESCRIPTION,
|
53 |
-
features=datasets.Features(
|
54 |
-
{
|
55 |
-
"tweet": datasets.Value("string"),
|
56 |
-
"label": datasets.features.ClassLabel(
|
57 |
-
names=["none", "anger", "joy", "sadness", "love", "sympathy", "surprise", "fear"]
|
58 |
-
),
|
59 |
-
}
|
60 |
-
),
|
61 |
-
homepage=_HOMEPAGE,
|
62 |
-
citation=_CITATION,
|
63 |
-
task_templates=[TextClassification(text_column="tweet", label_column="label")],
|
64 |
-
)
|
65 |
-
|
66 |
-
def _split_generators(self, dl_manager):
|
67 |
-
"""Returns SplitGenerators."""
|
68 |
-
data_dir = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
69 |
-
return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir})]
|
70 |
-
|
71 |
-
def _generate_examples(self, filepath):
|
72 |
-
"""Generate labeled arabic tweets examples for emoptions detection."""
|
73 |
-
with open(filepath, encoding="utf-8", mode="r") as csv_file:
|
74 |
-
next(csv_file) # skip header
|
75 |
-
csv_reader = csv.reader(csv_file, quotechar='"', delimiter=",")
|
76 |
-
|
77 |
-
for id_, row in enumerate(csv_reader):
|
78 |
-
_, tweet, label = row
|
79 |
-
yield id_, {"tweet": tweet, "label": label}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|