Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
sentiment-classification
Languages:
English
Size:
1M - 10M
ArXiv:
License:
Commit
•
cb5f6c0
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 +153 -0
- amazon_polarity.py +126 -0
- dataset_infos.json +1 -0
- dummy/amazon_polarity/3.0.0/dummy_data.zip +3 -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,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- apache-2-0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- n>1M
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- text-classification
|
18 |
+
task_ids:
|
19 |
+
- sentiment-classification
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for amazon_polarity
|
23 |
+
|
24 |
+
## Table of Contents
|
25 |
+
- [Dataset Description](#dataset-description)
|
26 |
+
- [Dataset Summary](#dataset-summary)
|
27 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
28 |
+
- [Languages](#languages)
|
29 |
+
- [Dataset Structure](#dataset-structure)
|
30 |
+
- [Data Instances](#data-instances)
|
31 |
+
- [Data Fields](#data-instances)
|
32 |
+
- [Data Splits](#data-instances)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Source Data](#source-data)
|
36 |
+
- [Annotations](#annotations)
|
37 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
38 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
39 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
40 |
+
- [Discussion of Biases](#discussion-of-biases)
|
41 |
+
- [Other Known Limitations](#other-known-limitations)
|
42 |
+
- [Additional Information](#additional-information)
|
43 |
+
- [Dataset Curators](#dataset-curators)
|
44 |
+
- [Licensing Information](#licensing-information)
|
45 |
+
- [Citation Information](#citation-information)
|
46 |
+
|
47 |
+
## Dataset Description
|
48 |
+
|
49 |
+
- **Homepage:** https://registry.opendata.aws/
|
50 |
+
- **Repository:** https://github.com/zhangxiangxiao/Crepe
|
51 |
+
- **Paper:** https://arxiv.org/abs/1509.01626
|
52 |
+
- **Leaderboard:** [Needs More Information]
|
53 |
+
- **Point of Contact:** [Xiang Zhang](mailto:xiang.zhang@nyu.edu)
|
54 |
+
|
55 |
+
### Dataset Summary
|
56 |
+
|
57 |
+
The Amazon reviews dataset consists of reviews from amazon.
|
58 |
+
The data span a period of 18 years, including ~35 million reviews up to March 2013.
|
59 |
+
Reviews include product and user information, ratings, and a plaintext review.
|
60 |
+
|
61 |
+
### Supported Tasks and Leaderboards
|
62 |
+
|
63 |
+
- `text-classification`, `sentiment-classification`: The dataset is mainly used for text classification: given the content and the title, predict the correct star rating.
|
64 |
+
|
65 |
+
### Languages
|
66 |
+
|
67 |
+
Mainly English.
|
68 |
+
|
69 |
+
## Dataset Structure
|
70 |
+
|
71 |
+
### Data Instances
|
72 |
+
|
73 |
+
A typical data point, comprises of a title, a content and the corresponding label.
|
74 |
+
|
75 |
+
An example from the AmazonPolarity test set looks as follows:
|
76 |
+
|
77 |
+
```
|
78 |
+
{
|
79 |
+
'title':'Great CD',
|
80 |
+
'content':"My lovely Pat has one of the GREAT voices of her generation. I have listened to this CD for YEARS and I still LOVE IT. When I'm in a good mood it makes me feel better. A bad mood just evaporates like sugar in the rain. This CD just oozes LIFE. Vocals are jusat STUUNNING and lyrics just kill. One of life's hidden gems. This is a desert isle CD in my book. Why she never made it big is just beyond me. Everytime I play this, no matter black, white, young, old, male, female EVERYBODY says one thing ""Who was that singing ?""",
|
81 |
+
'label':1
|
82 |
+
}
|
83 |
+
```
|
84 |
+
|
85 |
+
### Data Fields
|
86 |
+
|
87 |
+
- 'title': a string containing the title of the review - escaped using double quotes (") and any internal double quote is escaped by 2 double quotes (""). New lines are escaped by a backslash followed with an "n" character, that is "\n".
|
88 |
+
- 'content': a string containing the body of the document - escaped using double quotes (") and any internal double quote is escaped by 2 double quotes (""). New lines are escaped by a backslash followed with an "n" character, that is "\n".
|
89 |
+
- 'label': either 1 (positive) or 0 (negative) rating.
|
90 |
+
|
91 |
+
### Data Splits
|
92 |
+
|
93 |
+
The Amazon reviews polarity dataset is constructed by taking review score 1 and 2 as negative, and 4 and 5 as positive. Samples of score 3 is ignored. Each class has 1,800,000 training samples and 200,000 testing samples.
|
94 |
+
|
95 |
+
## Dataset Creation
|
96 |
+
|
97 |
+
### Curation Rationale
|
98 |
+
|
99 |
+
The Amazon reviews polarity dataset is constructed by Xiang Zhang (xiang.zhang@nyu.edu). It is used as a text classification benchmark in the following paper: Xiang Zhang, Junbo Zhao, Yann LeCun. Character-level Convolutional Networks for Text Classification. Advances in Neural Information Processing Systems 28 (NIPS 2015).
|
100 |
+
|
101 |
+
### Source Data
|
102 |
+
|
103 |
+
#### Initial Data Collection and Normalization
|
104 |
+
|
105 |
+
[Needs More Information]
|
106 |
+
|
107 |
+
#### Who are the source language producers?
|
108 |
+
|
109 |
+
[Needs More Information]
|
110 |
+
|
111 |
+
### Annotations
|
112 |
+
|
113 |
+
#### Annotation process
|
114 |
+
|
115 |
+
[Needs More Information]
|
116 |
+
|
117 |
+
#### Who are the annotators?
|
118 |
+
|
119 |
+
[Needs More Information]
|
120 |
+
|
121 |
+
### Personal and Sensitive Information
|
122 |
+
|
123 |
+
[Needs More Information]
|
124 |
+
|
125 |
+
## Considerations for Using the Data
|
126 |
+
|
127 |
+
### Social Impact of Dataset
|
128 |
+
|
129 |
+
[Needs More Information]
|
130 |
+
|
131 |
+
### Discussion of Biases
|
132 |
+
|
133 |
+
[Needs More Information]
|
134 |
+
|
135 |
+
### Other Known Limitations
|
136 |
+
|
137 |
+
[Needs More Information]
|
138 |
+
|
139 |
+
## Additional Information
|
140 |
+
|
141 |
+
### Dataset Curators
|
142 |
+
|
143 |
+
[Needs More Information]
|
144 |
+
|
145 |
+
### Licensing Information
|
146 |
+
|
147 |
+
Apache License 2.0
|
148 |
+
|
149 |
+
### Citation Information
|
150 |
+
|
151 |
+
McAuley, Julian, and Jure Leskovec. "Hidden factors and hidden topics: understanding rating dimensions with review text." In Proceedings of the 7th ACM conference on Recommender systems, pp. 165-172. 2013.
|
152 |
+
|
153 |
+
Xiang Zhang, Junbo Zhao, Yann LeCun. Character-level Convolutional Networks for Text Classification. Advances in Neural Information Processing Systems 28 (NIPS 2015)
|
amazon_polarity.py
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""The amazon polarity dataset for text classification."""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import csv
|
20 |
+
import os
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
|
25 |
+
_CITATION = """\
|
26 |
+
@inproceedings{mcauley2013hidden,
|
27 |
+
title={Hidden factors and hidden topics: understanding rating dimensions with review text},
|
28 |
+
author={McAuley, Julian and Leskovec, Jure},
|
29 |
+
booktitle={Proceedings of the 7th ACM conference on Recommender systems},
|
30 |
+
pages={165--172},
|
31 |
+
year={2013}
|
32 |
+
}
|
33 |
+
"""
|
34 |
+
|
35 |
+
_DESCRIPTION = """\
|
36 |
+
The Amazon reviews dataset consists of reviews from amazon.
|
37 |
+
The data span a period of 18 years, including ~35 million reviews up to March 2013.
|
38 |
+
Reviews include product and user information, ratings, and a plaintext review.
|
39 |
+
"""
|
40 |
+
|
41 |
+
_HOMEPAGE = "https://registry.opendata.aws/"
|
42 |
+
|
43 |
+
_LICENSE = "Apache License 2.0"
|
44 |
+
|
45 |
+
_URLs = {
|
46 |
+
"amazon_polarity": "https://drive.google.com/u/0/uc?id=0Bz8a_Dbh9QhbaW12WVVZS2drcnM&export=download",
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
class AmazonPolarityConfig(datasets.BuilderConfig):
|
51 |
+
"""BuilderConfig for AmazonPolarity."""
|
52 |
+
|
53 |
+
def __init__(self, **kwargs):
|
54 |
+
"""BuilderConfig for AmazonPolarity.
|
55 |
+
|
56 |
+
Args:
|
57 |
+
**kwargs: keyword arguments forwarded to super.
|
58 |
+
"""
|
59 |
+
super(AmazonPolarityConfig, self).__init__(**kwargs)
|
60 |
+
|
61 |
+
|
62 |
+
class AmazonPolarity(datasets.GeneratorBasedBuilder):
|
63 |
+
"""Amazon Polarity Classification Dataset."""
|
64 |
+
|
65 |
+
VERSION = datasets.Version("3.0.0")
|
66 |
+
|
67 |
+
BUILDER_CONFIGS = [
|
68 |
+
AmazonPolarityConfig(
|
69 |
+
name="amazon_polarity", version=VERSION, description="Amazon Polarity Classification Dataset."
|
70 |
+
),
|
71 |
+
]
|
72 |
+
|
73 |
+
def _info(self):
|
74 |
+
features = datasets.Features(
|
75 |
+
{
|
76 |
+
"label": datasets.features.ClassLabel(
|
77 |
+
names=[
|
78 |
+
"negative",
|
79 |
+
"positive",
|
80 |
+
]
|
81 |
+
),
|
82 |
+
"title": datasets.Value("string"),
|
83 |
+
"content": datasets.Value("string"),
|
84 |
+
}
|
85 |
+
)
|
86 |
+
return datasets.DatasetInfo(
|
87 |
+
description=_DESCRIPTION,
|
88 |
+
features=features,
|
89 |
+
supervised_keys=None,
|
90 |
+
homepage=_HOMEPAGE,
|
91 |
+
license=_LICENSE,
|
92 |
+
citation=_CITATION,
|
93 |
+
)
|
94 |
+
|
95 |
+
def _split_generators(self, dl_manager):
|
96 |
+
"""Returns SplitGenerators."""
|
97 |
+
my_urls = _URLs[self.config.name]
|
98 |
+
data_dir = dl_manager.download_and_extract(my_urls)
|
99 |
+
return [
|
100 |
+
datasets.SplitGenerator(
|
101 |
+
name=datasets.Split.TRAIN,
|
102 |
+
gen_kwargs={
|
103 |
+
"filepath": os.path.join(data_dir, "amazon_review_polarity_csv", "train.csv"),
|
104 |
+
"split": "train",
|
105 |
+
},
|
106 |
+
),
|
107 |
+
datasets.SplitGenerator(
|
108 |
+
name=datasets.Split.TEST,
|
109 |
+
gen_kwargs={
|
110 |
+
"filepath": os.path.join(data_dir, "amazon_review_polarity_csv", "test.csv"),
|
111 |
+
"split": "test",
|
112 |
+
},
|
113 |
+
),
|
114 |
+
]
|
115 |
+
|
116 |
+
def _generate_examples(self, filepath, split):
|
117 |
+
""" Yields examples. """
|
118 |
+
|
119 |
+
with open(filepath, encoding="utf-8") as f:
|
120 |
+
data = csv.reader(f, delimiter=",", quoting=csv.QUOTE_ALL)
|
121 |
+
for id_, row in enumerate(data):
|
122 |
+
yield id_, {
|
123 |
+
"title": row[1],
|
124 |
+
"content": row[2],
|
125 |
+
"label": int(row[0]) - 1,
|
126 |
+
}
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"amazon_polarity": {"description": "The Amazon reviews dataset consists of reviews from amazon.\nThe data span a period of 18 years, including ~35 million reviews up to March 2013.\nReviews include product and user information, ratings, and a plaintext review.\n", "citation": "@inproceedings{mcauley2013hidden,\n title={Hidden factors and hidden topics: understanding rating dimensions with review text},\n author={McAuley, Julian and Leskovec, Jure},\n booktitle={Proceedings of the 7th ACM conference on Recommender systems},\n pages={165--172},\n year={2013}\n}\n", "homepage": "https://registry.opendata.aws/", "license": "Apache License 2.0", "features": {"label": {"num_classes": 2, "names": ["negative", "positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "content": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "amazon_polarity", "config_name": "amazon_polarity", "version": {"version_str": "3.0.0", "description": null, "major": 3, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1604367312, "num_examples": 3600000, "dataset_name": "amazon_polarity"}, "test": {"name": "test", "num_bytes": 178176513, "num_examples": 400000, "dataset_name": "amazon_polarity"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=0Bz8a_Dbh9QhbaW12WVVZS2drcnM&export=download": {"num_bytes": 688340758, "checksum": "119dd30cb8226c1df21b009bd02cda3ef09b625a80864e454371904e6d2eaee4"}}, "download_size": 688340758, "post_processing_size": null, "dataset_size": 1782543825, "size_in_bytes": 2470884583}}
|
dummy/amazon_polarity/3.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:218fae2e6f137441a749cb15ea6aba43506a4ae09e3247685ebe1e23a7acd4e6
|
3 |
+
size 4277
|