Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
sentiment-classification
Languages:
Arabic
Size:
1K - 10K
License:
Commit
·
8759c49
1
Parent(s):
0d5b85c
Delete loading script
Browse files- ar_res_reviews.py +0 -85
ar_res_reviews.py
DELETED
@@ -1,85 +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 8364 restaurant reviews scrapped from qaym.com in Arabic for sentiment analysis"""
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
|
20 |
-
import datasets
|
21 |
-
|
22 |
-
|
23 |
-
_CITATION = """\
|
24 |
-
@InProceedings{10.1007/978-3-319-18117-2_2,
|
25 |
-
author="ElSahar, Hady
|
26 |
-
and El-Beltagy, Samhaa R.",
|
27 |
-
editor="Gelbukh, Alexander",
|
28 |
-
title="Building Large Arabic Multi-domain Resources for Sentiment Analysis",
|
29 |
-
booktitle="Computational Linguistics and Intelligent Text Processing",
|
30 |
-
year="2015",
|
31 |
-
publisher="Springer International Publishing",
|
32 |
-
address="Cham",
|
33 |
-
pages="23--34",
|
34 |
-
isbn="978-3-319-18117-2"
|
35 |
-
}
|
36 |
-
"""
|
37 |
-
|
38 |
-
_DESCRIPTION = """\
|
39 |
-
Dataset of 8364 restaurant reviews scrapped from qaym.com in Arabic for sentiment analysis
|
40 |
-
"""
|
41 |
-
|
42 |
-
_HOMEPAGE = "https://github.com/hadyelsahar/large-arabic-sentiment-analysis-resouces"
|
43 |
-
|
44 |
-
_DOWNLOAD_URL = (
|
45 |
-
"https://raw.githubusercontent.com/hadyelsahar/large-arabic-sentiment-analysis-resouces/master/datasets/RES1.csv"
|
46 |
-
)
|
47 |
-
|
48 |
-
|
49 |
-
class ArResReviews(datasets.GeneratorBasedBuilder):
|
50 |
-
"""Dataset of 8364 restaurant reviews in Arabic for sentiment analysis"""
|
51 |
-
|
52 |
-
def _info(self):
|
53 |
-
return datasets.DatasetInfo(
|
54 |
-
description=_DESCRIPTION,
|
55 |
-
features=datasets.Features(
|
56 |
-
{
|
57 |
-
"polarity": datasets.ClassLabel(names=["negative", "positive"]),
|
58 |
-
"text": datasets.Value("string"),
|
59 |
-
"restaurant_id": datasets.Value("string"),
|
60 |
-
"user_id": datasets.Value("string"),
|
61 |
-
}
|
62 |
-
),
|
63 |
-
homepage=_HOMEPAGE,
|
64 |
-
citation=_CITATION,
|
65 |
-
)
|
66 |
-
|
67 |
-
def _split_generators(self, dl_manager):
|
68 |
-
"""Returns SplitGenerators."""
|
69 |
-
|
70 |
-
data_dir = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
71 |
-
return [
|
72 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir}),
|
73 |
-
]
|
74 |
-
|
75 |
-
def _generate_examples(self, filepath):
|
76 |
-
"""Generate arabic restaurant reviews examples."""
|
77 |
-
with open(filepath, encoding="utf-8") as csv_file:
|
78 |
-
next(csv_file)
|
79 |
-
csv_reader = csv.reader(
|
80 |
-
csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
81 |
-
)
|
82 |
-
for id_, row in enumerate(csv_reader):
|
83 |
-
polarity, text, restaurant_id, user_id = row
|
84 |
-
polarity = "negative" if polarity == "-1" else "positive"
|
85 |
-
yield id_, {"polarity": polarity, "text": text, "restaurant_id": restaurant_id, "user_id": user_id}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|