Commit
·
9a23a8b
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +183 -0
- dataset_infos.json +1 -0
- dummy/1.1.0/dummy_data.zip +3 -0
- oclar.py +99 -0
.gitattributes
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* 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 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
annotations_creators:
|
| 3 |
+
- crowdsourced
|
| 4 |
+
language_creators:
|
| 5 |
+
- crowdsourced
|
| 6 |
+
languages:
|
| 7 |
+
- ar
|
| 8 |
+
licenses:
|
| 9 |
+
- unknown
|
| 10 |
+
multilinguality:
|
| 11 |
+
- monolingual
|
| 12 |
+
size_categories:
|
| 13 |
+
- 1K<n<10K
|
| 14 |
+
source_datasets:
|
| 15 |
+
- original
|
| 16 |
+
task_categories:
|
| 17 |
+
- text-classification
|
| 18 |
+
- text-scoring
|
| 19 |
+
task_ids:
|
| 20 |
+
- sentiment-classification
|
| 21 |
+
- sentiment-scoring
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# Dataset Card for OCLAR
|
| 25 |
+
|
| 26 |
+
## Table of Contents
|
| 27 |
+
|
| 28 |
+
- [Dataset Description](#dataset-description)
|
| 29 |
+
- [Dataset Summary](#dataset-summary)
|
| 30 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
| 31 |
+
- [Languages](#languages)
|
| 32 |
+
- [Dataset Structure](#dataset-structure)
|
| 33 |
+
- [Data Instances](#data-instances)
|
| 34 |
+
- [Data Fields](#data-instances)
|
| 35 |
+
- [Data Splits](#data-instances)
|
| 36 |
+
- [Dataset Creation](#dataset-creation)
|
| 37 |
+
- [Curation Rationale](#curation-rationale)
|
| 38 |
+
- [Source Data](#source-data)
|
| 39 |
+
- [Annotations](#annotations)
|
| 40 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
| 41 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
| 42 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
| 43 |
+
- [Discussion of Biases](#discussion-of-biases)
|
| 44 |
+
- [Other Known Limitations](#other-known-limitations)
|
| 45 |
+
- [Additional Information](#additional-information)
|
| 46 |
+
- [Dataset Curators](#dataset-curators)
|
| 47 |
+
- [Licensing Information](#licensing-information)
|
| 48 |
+
- [Citation Information](#citation-information)
|
| 49 |
+
|
| 50 |
+
## Dataset Description
|
| 51 |
+
|
| 52 |
+
- **Homepage:** [OCLAR homepage](http://archive.ics.uci.edu/ml/datasets/Opinion+Corpus+for+Lebanese+Arabic+Reviews+%28OCLAR%29#)
|
| 53 |
+
- **Paper:** [paper link](https://www.semanticscholar.org/paper/Sentiment-Classifier%3A-Logistic-Regression-for-in-Omari-Al-Hajj/9319f4d9e8b3b7bfd0d214314911c071ba7ce1a0)
|
| 54 |
+
- **Point of Contact:** Marwan Al Omari <marwanalomari '@' yahoo.com>
|
| 55 |
+
|
| 56 |
+
### Dataset Summary
|
| 57 |
+
|
| 58 |
+
The researchers of OCLAR Marwan et al. (2019), they gathered Arabic costumer reviews [Zomato website](https://www.zomato.com/lebanon)
|
| 59 |
+
on wide scope of domain, including restaurants, hotels, hospitals, local shops, etc.
|
| 60 |
+
The corpus finally contains 3916 reviews in 5-rating scale. For this research purpose, the positive class considers
|
| 61 |
+
rating stars from 5 to 3 of 3465 reviews, and the negative class is represented from values of 1 and 2 of about 451
|
| 62 |
+
texts.
|
| 63 |
+
|
| 64 |
+
### Supported Tasks and Leaderboards
|
| 65 |
+
|
| 66 |
+
Opinion Corpus for Lebanese Arabic Reviews (OCLAR) corpus is utilizable for Arabic sentiment classification on services
|
| 67 |
+
reviews, including hotels, restaurants, shops, and others.
|
| 68 |
+
|
| 69 |
+
### Languages
|
| 70 |
+
|
| 71 |
+
The text in the dataset is in Arabic, mainly in Lebanese (LB). The associated BCP-47 code is `ar-LB`.
|
| 72 |
+
|
| 73 |
+
## Dataset Structure
|
| 74 |
+
|
| 75 |
+
### Data Instances
|
| 76 |
+
|
| 77 |
+
A typical data point comprises a `pagename` which is the name of service / location being reviewed, a `review` which is
|
| 78 |
+
the review left by the user / client , and a `rating` which is a score between 1 and 5.
|
| 79 |
+
|
| 80 |
+
The authors consider a review to be positive if the score is greater or equal than `3`, else it is considered negative.
|
| 81 |
+
|
| 82 |
+
An example from the OCLAR data set looks as follows:
|
| 83 |
+
|
| 84 |
+
```
|
| 85 |
+
"pagename": 'Ramlet Al Baida Beirut Lebanon',
|
| 86 |
+
"review": 'مكان يطير العقل ويساعد على الاسترخاء',
|
| 87 |
+
"rating": 5,
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
### Data Fields
|
| 91 |
+
|
| 92 |
+
- `pagename`: string name of the service / location being reviewed
|
| 93 |
+
- `review`: string review left by the user / costumer
|
| 94 |
+
- `rating`: number of stars left by the reviewer. It ranges from 1 to 5.
|
| 95 |
+
|
| 96 |
+
### Data Splits
|
| 97 |
+
|
| 98 |
+
The data set comes in a single csv file of a total `3916` reviews :
|
| 99 |
+
- `3465` are considered positive (a rating of 3 to 5)
|
| 100 |
+
- `451` are considered negative (a rating of 1 or 2)
|
| 101 |
+
|
| 102 |
+
## Dataset Creation
|
| 103 |
+
|
| 104 |
+
### Curation Rationale
|
| 105 |
+
|
| 106 |
+
This dataset was created for Arabic sentiment classification on services’ reviews in Lebanon country.
|
| 107 |
+
Reviews are about public services, including hotels, restaurants, shops, and others.
|
| 108 |
+
|
| 109 |
+
### Source Data
|
| 110 |
+
|
| 111 |
+
#### Initial Data Collection and Normalization
|
| 112 |
+
|
| 113 |
+
The data was collected from Google Reviews and [Zomato website](https://www.zomato.com/lebanon)
|
| 114 |
+
|
| 115 |
+
#### Who are the source language producers?
|
| 116 |
+
|
| 117 |
+
The source language producers are people who posted their reviews on Google Reviews or [Zomato website](https://www.zomato.com/lebanon).
|
| 118 |
+
They're mainly Arabic speaking Lebanese people.
|
| 119 |
+
|
| 120 |
+
### Annotations
|
| 121 |
+
|
| 122 |
+
#### Annotation process
|
| 123 |
+
|
| 124 |
+
The dataset does not contain any additional annotations
|
| 125 |
+
|
| 126 |
+
#### Who are the annotators?
|
| 127 |
+
|
| 128 |
+
[More Information Needed]
|
| 129 |
+
|
| 130 |
+
### Personal and Sensitive Information
|
| 131 |
+
|
| 132 |
+
[More Information Needed]
|
| 133 |
+
|
| 134 |
+
## Considerations for Using the Data
|
| 135 |
+
|
| 136 |
+
### Social Impact of Dataset
|
| 137 |
+
|
| 138 |
+
The author's research has tackled a highly important task of sentiment analysis for Arabic language in the Lebanese
|
| 139 |
+
context on 3916 reviews’ services from Google and Zomato. Experiments show three main findings:
|
| 140 |
+
1) The classifier is confident when used to predict positive reviews,
|
| 141 |
+
2) while it is biased on predicting reviews with negative sentiment, and finally
|
| 142 |
+
3) the low percentage of negative reviews in the corpus contributes to the diffidence of LR.
|
| 143 |
+
|
| 144 |
+
### Discussion of Biases
|
| 145 |
+
|
| 146 |
+
[More Information Needed]
|
| 147 |
+
|
| 148 |
+
### Other Known Limitations
|
| 149 |
+
|
| 150 |
+
[More Information Needed]
|
| 151 |
+
|
| 152 |
+
## Additional Information
|
| 153 |
+
|
| 154 |
+
### Dataset Curators
|
| 155 |
+
|
| 156 |
+
This dataset was curated by Marwan Al Omari, Moustafa Al-Hajj from Centre for Language Sciences and Communication,
|
| 157 |
+
Lebanese University, Beirut, Lebanon; Nacereddine Hammami from college of Computer and Information Sciences,
|
| 158 |
+
Jouf University, Aljouf, KSA; and Amani Sabra from Centre for Language Sciences and Communication, Lebanese University,
|
| 159 |
+
Beirut, Lebanon.
|
| 160 |
+
|
| 161 |
+
### Licensing Information
|
| 162 |
+
|
| 163 |
+
[More Information Needed]
|
| 164 |
+
|
| 165 |
+
### Citation Information
|
| 166 |
+
- Marwan Al Omari, Centre for Language Sciences and Communication, Lebanese University, Beirut, Lebanon, marwanalomari '@' yahoo.com
|
| 167 |
+
- Moustafa Al-Hajj, Centre for Language Sciences and Communication, Lebanese University, Beirut, Lebanon, moustafa.alhajj '@' ul.edu.lb
|
| 168 |
+
- Nacereddine Hammami, college of Computer and Information Sciences, Jouf University, Aljouf, KSA, n.hammami '@' ju.edu.sa
|
| 169 |
+
- Amani Sabra, Centre for Language Sciences and Communication, Lebanese University, Beirut, Lebanon, amani.sabra '@' ul.edu.lb
|
| 170 |
+
```
|
| 171 |
+
@misc{Dua:2019 ,
|
| 172 |
+
author = "Dua, Dheeru and Graff, Casey",
|
| 173 |
+
year = "2017",
|
| 174 |
+
title = "{UCI} Machine Learning Repository",
|
| 175 |
+
url = "http://archive.ics.uci.edu/ml",
|
| 176 |
+
institution = "University of California, Irvine, School of Information and Computer Sciences" }
|
| 177 |
+
|
| 178 |
+
@InProceedings{AlOmari2019oclar,
|
| 179 |
+
title = {Sentiment Classifier: Logistic Regression for Arabic Services Reviews in Lebanon},
|
| 180 |
+
authors={Al Omari, M., Al-Hajj, M., Hammami, N., & Sabra, A.},
|
| 181 |
+
year={2019}
|
| 182 |
+
}
|
| 183 |
+
```
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"default": {"description": "The researchers of OCLAR Marwan et al. (2019), they gathered Arabic costumer reviews from Google reviewsa and Zomato website \n(https://www.zomato.com/lebanon) on wide scope of domain, including restaurants, hotels, hospitals, local shops, etc.\nThe corpus finally contains 3916 reviews in 5-rating scale. For this research purpose, the positive class considers\nrating stars from 5 to 3 of 3465 reviews, and the negative class is represented from values of 1 and 2 of about 451 texts.\n", "citation": "\n@misc{Dua:2019 ,\nauthor = \"Dua, Dheeru and Graff, Casey\",\nyear = \"2017\",\ntitle = \"{UCI} Machine Learning Repository\",\nurl = \"http://archive.ics.uci.edu/ml\",\ninstitution = \"University of California, Irvine, School of Information and Computer Sciences\" }\n\n@InProceedings{AlOmari2019oclar,\ntitle = {Sentiment Classifier: Logistic Regression for Arabic Services Reviews in Lebanon},\nauthors={Al Omari, M., Al-Hajj, M., Hammami, N., & Sabra, A.},\nyear={2019}\n}\n", "homepage": "http://archive.ics.uci.edu/ml/datasets/Opinion+Corpus+for+Lebanese+Arabic+Reviews+%28OCLAR%29#", "license": "", "features": {"pagename": {"dtype": "string", "id": null, "_type": "Value"}, "review": {"dtype": "string", "id": null, "_type": "Value"}, "rating": {"dtype": "int8", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "oclar", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 398204, "num_examples": 3916, "dataset_name": "oclar"}}, "download_checksums": {"http://archive.ics.uci.edu/ml/machine-learning-databases/00499/OCLAR%20-%20Opinion%20Corpus%20for%20Lebanese%20Arabic%20Reviews.csv": {"num_bytes": 382976, "checksum": "78e0bc3d5accd737d3df45297f3f384a0238e2aa81006d546fa2cda92de12197"}}, "download_size": 382976, "post_processing_size": null, "dataset_size": 398204, "size_in_bytes": 781180}}
|
dummy/1.1.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c37690e3614177b10ab5b45712de3066ee6c01a31b7997e365216aa539fd55eb
|
| 3 |
+
size 807
|
oclar.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
from __future__ import absolute_import, division, print_function
|
| 18 |
+
|
| 19 |
+
import csv
|
| 20 |
+
|
| 21 |
+
import datasets
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
_CITATION = """
|
| 25 |
+
@misc{Dua:2019 ,
|
| 26 |
+
author = "Dua, Dheeru and Graff, Casey",
|
| 27 |
+
year = "2017",
|
| 28 |
+
title = "{UCI} Machine Learning Repository",
|
| 29 |
+
url = "http://archive.ics.uci.edu/ml",
|
| 30 |
+
institution = "University of California, Irvine, School of Information and Computer Sciences" }
|
| 31 |
+
|
| 32 |
+
@InProceedings{AlOmari2019oclar,
|
| 33 |
+
title = {Sentiment Classifier: Logistic Regression for Arabic Services Reviews in Lebanon},
|
| 34 |
+
authors={Al Omari, M., Al-Hajj, M., Hammami, N., & Sabra, A.},
|
| 35 |
+
year={2019}
|
| 36 |
+
}
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
_DESCRIPTION = """\
|
| 40 |
+
The researchers of OCLAR Marwan et al. (2019), they gathered Arabic costumer reviews from Google reviewsa and Zomato
|
| 41 |
+
website (https://www.zomato.com/lebanon) on wide scope of domain, including restaurants, hotels, hospitals, local shops,
|
| 42 |
+
etc.The corpus finally contains 3916 reviews in 5-rating scale. For this research purpose, the positive class considers
|
| 43 |
+
rating stars from 5 to 3 of 3465 reviews, and the negative class is represented from values of 1 and 2 of about
|
| 44 |
+
451 texts.
|
| 45 |
+
"""
|
| 46 |
+
|
| 47 |
+
_HOMEPAGE = "http://archive.ics.uci.edu/ml/datasets/Opinion+Corpus+for+Lebanese+Arabic+Reviews+%28OCLAR%29#"
|
| 48 |
+
|
| 49 |
+
# TODO: Add the licence for the dataset here if you can find it
|
| 50 |
+
_LICENSE = ""
|
| 51 |
+
|
| 52 |
+
_URL = "http://archive.ics.uci.edu/ml/machine-learning-databases/00499/OCLAR%20-%20Opinion%20Corpus%20for%20Lebanese%20Arabic%20Reviews.csv"
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
class Oclar(datasets.GeneratorBasedBuilder):
|
| 56 |
+
"""TOpinion Corpus for Lebanese Arabic Reviews (OCLAR) corpus is utilizable for Arabic sentiment classification on
|
| 57 |
+
services reviews, including hotels, restaurants, shops, and others.
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
+
VERSION = datasets.Version("1.1.0")
|
| 61 |
+
|
| 62 |
+
def _info(self):
|
| 63 |
+
return datasets.DatasetInfo(
|
| 64 |
+
description=_DESCRIPTION,
|
| 65 |
+
features=datasets.Features(
|
| 66 |
+
{
|
| 67 |
+
"pagename": datasets.Value("string"),
|
| 68 |
+
"review": datasets.Value("string"),
|
| 69 |
+
"rating": datasets.Value("int8"),
|
| 70 |
+
}
|
| 71 |
+
),
|
| 72 |
+
supervised_keys=None,
|
| 73 |
+
homepage=_HOMEPAGE,
|
| 74 |
+
license=_LICENSE,
|
| 75 |
+
citation=_CITATION,
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
def _split_generators(self, dl_manager):
|
| 79 |
+
"""Returns SplitGenerators."""
|
| 80 |
+
data_path = dl_manager.download_and_extract(_URL)
|
| 81 |
+
return [
|
| 82 |
+
datasets.SplitGenerator(
|
| 83 |
+
name=datasets.Split.TRAIN,
|
| 84 |
+
gen_kwargs={
|
| 85 |
+
"filepath": data_path,
|
| 86 |
+
"split": "train",
|
| 87 |
+
},
|
| 88 |
+
)
|
| 89 |
+
]
|
| 90 |
+
|
| 91 |
+
def _generate_examples(self, filepath, split):
|
| 92 |
+
""" Yields examples. """
|
| 93 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
| 94 |
+
csv_reader = csv.reader(csv_file, delimiter=",", skipinitialspace=True)
|
| 95 |
+
next(csv_reader, None) # skipping headers
|
| 96 |
+
for id_, row in enumerate(csv_reader):
|
| 97 |
+
pagename, review, rating = row
|
| 98 |
+
rating = int(rating)
|
| 99 |
+
yield id_, {"pagename": pagename, "review": review, "rating": rating}
|