Delete loading script
Browse files
oclar.py
DELETED
|
@@ -1,98 +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 |
-
"""Opinion Corpus for Lebanese Arabic Reviews (OCLAR) Data Set"""
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
import csv
|
| 19 |
-
|
| 20 |
-
import datasets
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
_CITATION = """
|
| 24 |
-
@misc{Dua:2019 ,
|
| 25 |
-
author = "Dua, Dheeru and Graff, Casey",
|
| 26 |
-
year = "2017",
|
| 27 |
-
title = "{UCI} Machine Learning Repository",
|
| 28 |
-
url = "http://archive.ics.uci.edu/ml",
|
| 29 |
-
institution = "University of California, Irvine, School of Information and Computer Sciences" }
|
| 30 |
-
|
| 31 |
-
@InProceedings{AlOmari2019oclar,
|
| 32 |
-
title = {Sentiment Classifier: Logistic Regression for Arabic Services Reviews in Lebanon},
|
| 33 |
-
authors={Al Omari, M., Al-Hajj, M., Hammami, N., & Sabra, A.},
|
| 34 |
-
year={2019}
|
| 35 |
-
}
|
| 36 |
-
"""
|
| 37 |
-
|
| 38 |
-
_DESCRIPTION = """\
|
| 39 |
-
The researchers of OCLAR Marwan et al. (2019), they gathered Arabic costumer reviews from Google reviewsa and Zomato
|
| 40 |
-
website (https://www.zomato.com/lebanon) on wide scope of domain, including restaurants, hotels, hospitals, local shops,
|
| 41 |
-
etc.The corpus finally contains 3916 reviews in 5-rating scale. For this research purpose, the positive class considers
|
| 42 |
-
rating stars from 5 to 3 of 3465 reviews, and the negative class is represented from values of 1 and 2 of about
|
| 43 |
-
451 texts.
|
| 44 |
-
"""
|
| 45 |
-
|
| 46 |
-
_HOMEPAGE = "http://archive.ics.uci.edu/ml/datasets/Opinion+Corpus+for+Lebanese+Arabic+Reviews+%28OCLAR%29#"
|
| 47 |
-
|
| 48 |
-
# TODO: Add the licence for the dataset here if you can find it
|
| 49 |
-
_LICENSE = ""
|
| 50 |
-
|
| 51 |
-
_URL = "http://archive.ics.uci.edu/ml/machine-learning-databases/00499/OCLAR%20-%20Opinion%20Corpus%20for%20Lebanese%20Arabic%20Reviews.csv"
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
class Oclar(datasets.GeneratorBasedBuilder):
|
| 55 |
-
"""TOpinion Corpus for Lebanese Arabic Reviews (OCLAR) corpus is utilizable for Arabic sentiment classification on
|
| 56 |
-
services reviews, including hotels, restaurants, shops, and others.
|
| 57 |
-
"""
|
| 58 |
-
|
| 59 |
-
VERSION = datasets.Version("1.1.0")
|
| 60 |
-
|
| 61 |
-
def _info(self):
|
| 62 |
-
return datasets.DatasetInfo(
|
| 63 |
-
description=_DESCRIPTION,
|
| 64 |
-
features=datasets.Features(
|
| 65 |
-
{
|
| 66 |
-
"pagename": datasets.Value("string"),
|
| 67 |
-
"review": datasets.Value("string"),
|
| 68 |
-
"rating": datasets.Value("int8"),
|
| 69 |
-
}
|
| 70 |
-
),
|
| 71 |
-
supervised_keys=None,
|
| 72 |
-
homepage=_HOMEPAGE,
|
| 73 |
-
license=_LICENSE,
|
| 74 |
-
citation=_CITATION,
|
| 75 |
-
)
|
| 76 |
-
|
| 77 |
-
def _split_generators(self, dl_manager):
|
| 78 |
-
"""Returns SplitGenerators."""
|
| 79 |
-
data_path = dl_manager.download_and_extract(_URL)
|
| 80 |
-
return [
|
| 81 |
-
datasets.SplitGenerator(
|
| 82 |
-
name=datasets.Split.TRAIN,
|
| 83 |
-
gen_kwargs={
|
| 84 |
-
"filepath": data_path,
|
| 85 |
-
"split": "train",
|
| 86 |
-
},
|
| 87 |
-
)
|
| 88 |
-
]
|
| 89 |
-
|
| 90 |
-
def _generate_examples(self, filepath, split):
|
| 91 |
-
"""Yields examples."""
|
| 92 |
-
with open(filepath, encoding="utf-8") as csv_file:
|
| 93 |
-
csv_reader = csv.reader(csv_file, delimiter=",", skipinitialspace=True)
|
| 94 |
-
next(csv_reader, None) # skipping headers
|
| 95 |
-
for id_, row in enumerate(csv_reader):
|
| 96 |
-
pagename, review, rating = row
|
| 97 |
-
rating = int(rating)
|
| 98 |
-
yield id_, {"pagename": pagename, "review": review, "rating": rating}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|