CyranoB commited on
Commit
9128883
1 Parent(s): 85e3800

Third version version

Browse files
Files changed (2) hide show
  1. README.md +160 -0
  2. load_script.py +126 -0
README.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ - 1M<n<10M
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - text-classification
18
+ task_ids:
19
+ - sentiment-classification
20
+ paperswithcode_id: null
21
+ pretty_name: Amazon Review Polarity
22
+ ---
23
+
24
+ # Dataset Card for Amazon Review Polarity
25
+
26
+ ## Table of Contents
27
+ - [Dataset Description](#dataset-description)
28
+ - [Dataset Summary](#dataset-summary)
29
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
30
+ - [Languages](#languages)
31
+ - [Dataset Structure](#dataset-structure)
32
+ - [Data Instances](#data-instances)
33
+ - [Data Fields](#data-fields)
34
+ - [Data Splits](#data-splits)
35
+ - [Dataset Creation](#dataset-creation)
36
+ - [Curation Rationale](#curation-rationale)
37
+ - [Source Data](#source-data)
38
+ - [Annotations](#annotations)
39
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
40
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
41
+ - [Social Impact of Dataset](#social-impact-of-dataset)
42
+ - [Discussion of Biases](#discussion-of-biases)
43
+ - [Other Known Limitations](#other-known-limitations)
44
+ - [Additional Information](#additional-information)
45
+ - [Dataset Curators](#dataset-curators)
46
+ - [Licensing Information](#licensing-information)
47
+ - [Citation Information](#citation-information)
48
+ - [Contributions](#contributions)
49
+
50
+ ## Dataset Description
51
+
52
+ - **Homepage:** https://registry.opendata.aws/
53
+ - **Repository:** https://github.com/zhangxiangxiao/Crepe
54
+ - **Paper:** https://arxiv.org/abs/1509.01626
55
+ - **Leaderboard:** [Needs More Information]
56
+ - **Point of Contact:** [Xiang Zhang](mailto:xiang.zhang@nyu.edu)
57
+
58
+ ### Dataset Summary
59
+
60
+ The Amazon reviews dataset consists of reviews from amazon.
61
+ The data span a period of 18 years, including ~35 million reviews up to March 2013.
62
+ Reviews include product and user information, ratings, and a plaintext review.
63
+
64
+ ### Supported Tasks and Leaderboards
65
+
66
+ - `text-classification`, `sentiment-classification`: The dataset is mainly used for text classification: given the content and the title, predict the correct star rating.
67
+
68
+ ### Languages
69
+
70
+ Mainly English.
71
+
72
+ ## Dataset Structure
73
+
74
+ ### Data Instances
75
+
76
+ A typical data point, comprises of a title, a content and the corresponding label.
77
+
78
+ An example from the AmazonPolarity test set looks as follows:
79
+
80
+ ```
81
+ {
82
+ 'title':'Great CD',
83
+ '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 ?""",
84
+ 'label':1
85
+ }
86
+ ```
87
+
88
+ ### Data Fields
89
+
90
+ - '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".
91
+ - '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".
92
+ - 'label': either 1 (positive) or 0 (negative) rating.
93
+
94
+ ### Data Splits
95
+
96
+ 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.
97
+
98
+ ## Dataset Creation
99
+
100
+ ### Curation Rationale
101
+
102
+ 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).
103
+
104
+ ### Source Data
105
+
106
+ #### Initial Data Collection and Normalization
107
+
108
+ [Needs More Information]
109
+
110
+ #### Who are the source language producers?
111
+
112
+ [Needs More Information]
113
+
114
+ ### Annotations
115
+
116
+ #### Annotation process
117
+
118
+ [Needs More Information]
119
+
120
+ #### Who are the annotators?
121
+
122
+ [Needs More Information]
123
+
124
+ ### Personal and Sensitive Information
125
+
126
+ [Needs More Information]
127
+
128
+ ## Considerations for Using the Data
129
+
130
+ ### Social Impact of Dataset
131
+
132
+ [Needs More Information]
133
+
134
+ ### Discussion of Biases
135
+
136
+ [Needs More Information]
137
+
138
+ ### Other Known Limitations
139
+
140
+ [Needs More Information]
141
+
142
+ ## Additional Information
143
+
144
+ ### Dataset Curators
145
+
146
+ [Needs More Information]
147
+
148
+ ### Licensing Information
149
+
150
+ Apache License 2.0
151
+
152
+ ### Citation Information
153
+
154
+ 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.
155
+
156
+ Xiang Zhang, Junbo Zhao, Yann LeCun. Character-level Convolutional Networks for Text Classification. Advances in Neural Information Processing Systems 28 (NIPS 2015)
157
+
158
+ ### Contributions
159
+
160
+ Thanks to [@hfawaz](https://github.com/hfawaz) for adding this dataset.
load_script.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
+
18
+ import csv
19
+
20
+ import datasets
21
+
22
+
23
+ _CITATION = """\
24
+ @inproceedings{mcauley2013hidden,
25
+ title={Hidden factors and hidden topics: understanding rating dimensions with review text},
26
+ author={McAuley, Julian and Leskovec, Jure},
27
+ booktitle={Proceedings of the 7th ACM conference on Recommender systems},
28
+ pages={165--172},
29
+ year={2013}
30
+ }
31
+ """
32
+
33
+ _DESCRIPTION = """\
34
+ The Amazon reviews dataset consists of reviews from amazon.
35
+ The data span a period of 18 years, including ~35 million reviews up to March 2013.
36
+ Reviews include product and user information, ratings, and a plaintext review.
37
+ """
38
+
39
+ _HOMEPAGE = "https://registry.opendata.aws/"
40
+
41
+ _LICENSE = "Apache License 2.0"
42
+
43
+ _URLs = {
44
+ "amazon_polarity": "https://drive.google.com/u/0/uc?id=0Bz8a_Dbh9QhbaW12WVVZS2drcnM&export=download",
45
+ }
46
+
47
+
48
+ class AmazonPolarityConfig(datasets.BuilderConfig):
49
+ """BuilderConfig for AmazonPolarity."""
50
+
51
+ def __init__(self, **kwargs):
52
+ """BuilderConfig for AmazonPolarity.
53
+
54
+ Args:
55
+ **kwargs: keyword arguments forwarded to super.
56
+ """
57
+ super(AmazonPolarityConfig, self).__init__(**kwargs)
58
+
59
+
60
+ class AmazonPolarity(datasets.GeneratorBasedBuilder):
61
+ """Amazon Polarity Classification Dataset."""
62
+
63
+ VERSION = datasets.Version("3.0.0")
64
+
65
+ BUILDER_CONFIGS = [
66
+ AmazonPolarityConfig(
67
+ name="amazon_polarity", version=VERSION, description="Amazon Polarity Classification Dataset."
68
+ ),
69
+ ]
70
+
71
+ def _info(self):
72
+ features = datasets.Features(
73
+ {
74
+ "label": datasets.features.ClassLabel(
75
+ names=[
76
+ "negative",
77
+ "positive",
78
+ ]
79
+ ),
80
+ "title": datasets.Value("string"),
81
+ "content": datasets.Value("string"),
82
+ }
83
+ )
84
+ return datasets.DatasetInfo(
85
+ description=_DESCRIPTION,
86
+ features=features,
87
+ supervised_keys=None,
88
+ homepage=_HOMEPAGE,
89
+ license=_LICENSE,
90
+ citation=_CITATION,
91
+ )
92
+
93
+ def _split_generators(self, dl_manager):
94
+ """Returns SplitGenerators."""
95
+ my_urls = _URLs[self.config.name]
96
+ archive = dl_manager.download(my_urls)
97
+ return [
98
+ datasets.SplitGenerator(
99
+ name=datasets.Split.TRAIN,
100
+ gen_kwargs={
101
+ "filepath": "/".join(["amazon_review_polarity_csv", "train.csv"]),
102
+ "files": dl_manager.iter_archive(archive),
103
+ },
104
+ ),
105
+ datasets.SplitGenerator(
106
+ name=datasets.Split.TEST,
107
+ gen_kwargs={
108
+ "filepath": "/".join(["amazon_review_polarity_csv", "test.csv"]),
109
+ "files": dl_manager.iter_archive(archive),
110
+ },
111
+ ),
112
+ ]
113
+
114
+ def _generate_examples(self, filepath, files):
115
+ """Yields examples."""
116
+ for path, f in files:
117
+ if path == filepath:
118
+ lines = (line.decode("utf-8") for line in f)
119
+ data = csv.reader(lines, delimiter=",", quoting=csv.QUOTE_ALL)
120
+ for id_, row in enumerate(data):
121
+ yield id_, {
122
+ "title": row[1],
123
+ "content": row[2],
124
+ "label": int(row[0]) - 1,
125
+ }
126
+ break