system HF staff commited on
Commit
075fdd4
0 Parent(s):

Update files from the datasets library (from 1.0.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.0.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
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"plain_text": {"description": "Large Yelp Review Dataset.\nThis is a dataset for binary sentiment classification. We provide a set of 560,000 highly polar yelp reviews for training, and 38,000 for testing. \nORIGIN\nThe Yelp reviews dataset consists of reviews from Yelp. It is extracted\nfrom the Yelp Dataset Challenge 2015 data. For more information, please\nrefer to http://www.yelp.com/dataset_challenge\n\nThe Yelp reviews polarity dataset is constructed by\nXiang Zhang ([email protected]) from the above dataset.\nIt is first used as a text classification benchmark in the following paper:\nXiang Zhang, Junbo Zhao, Yann LeCun. Character-level Convolutional Networks\nfor Text Classification. Advances in Neural Information Processing Systems 28\n(NIPS 2015).\n\n\nDESCRIPTION\n\nThe Yelp reviews polarity dataset is constructed by considering stars 1 and 2\nnegative, and 3 and 4 positive. For each polarity 280,000 training samples and\n19,000 testing samples are take randomly. In total there are 560,000 trainig\nsamples and 38,000 testing samples. Negative polarity is class 1,\nand positive class 2.\n\nThe files train.csv and test.csv contain all the training samples as\ncomma-sparated values. There are 2 columns in them, corresponding to class\nindex (1 and 2) and review text. The review texts are escaped using double\nquotes (\"), and any internal double quote is escaped by 2 double quotes (\"\").\nNew lines are escaped by a backslash followed with an \"n\" character,\nthat is \"\n\".\n", "citation": "@article{zhangCharacterlevelConvolutionalNetworks2015,\n archivePrefix = {arXiv},\n eprinttype = {arxiv},\n eprint = {1509.01626},\n primaryClass = {cs},\n title = {Character-Level {{Convolutional Networks}} for {{Text Classification}}},\n abstract = {This article offers an empirical exploration on the use of character-level convolutional networks (ConvNets) for text classification. We constructed several large-scale datasets to show that character-level convolutional networks could achieve state-of-the-art or competitive results. Comparisons are offered against traditional models such as bag of words, n-grams and their TFIDF variants, and deep learning models such as word-based ConvNets and recurrent neural networks.},\n journal = {arXiv:1509.01626 [cs]},\n author = {Zhang, Xiang and Zhao, Junbo and LeCun, Yann},\n month = sep,\n year = {2015},\n}\n\n", "homepage": "https://course.fast.ai/datasets", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["1", "2"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "supervised_keys": null, "builder_name": "yelp_polarity", "config_name": "plain_text", "version": {"version_str": "1.0.0", "description": "", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 27976351, "num_examples": 38000, "dataset_name": "yelp_polarity"}, "train": {"name": "train", "num_bytes": 413768861, "num_examples": 560000, "dataset_name": "yelp_polarity"}}, "download_checksums": {"https://s3.amazonaws.com/fast-ai-nlp/yelp_review_polarity_csv.tgz": {"num_bytes": 166373201, "checksum": "528f22e286cad085948acbc3bea7e58188416546b0e364d0ae4ca0ce666abe35"}}, "download_size": 166373201, "dataset_size": 441745212, "size_in_bytes": 608118413}}
dummy/plain_text/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f30b83602c523b51eb65582a03eb1ecac081986905b8def6b40db72fbb5ed604
3
+ size 2016
yelp_polarity.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
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
+
16
+ # Lint as: python3
17
+ # Copyright 2019 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
18
+ #
19
+ # Licensed under the Apache License, Version 2.0 (the "License");
20
+ # you may not use this file except in compliance with the License.
21
+ # You may obtain a copy of the License at
22
+ #
23
+ # http://www.apache.org/licenses/LICENSE-2.0
24
+ #
25
+ # Unless required by applicable law or agreed to in writing, software
26
+ # distributed under the License is distributed on an "AS IS" BASIS,
27
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ # See the License for the specific language governing permissions and
29
+ # limitations under the License.
30
+ """Yelp Polarity Reviews dataset."""
31
+
32
+ from __future__ import absolute_import, division, print_function
33
+
34
+ import os
35
+
36
+ import datasets
37
+
38
+
39
+ _DESCRIPTION = """\
40
+ Large Yelp Review Dataset.
41
+ This is a dataset for binary sentiment classification. \
42
+ We provide a set of 560,000 highly polar yelp reviews for training, and 38,000 for testing. \
43
+
44
+ ORIGIN
45
+ The Yelp reviews dataset consists of reviews from Yelp. It is extracted
46
+ from the Yelp Dataset Challenge 2015 data. For more information, please
47
+ refer to http://www.yelp.com/dataset_challenge
48
+
49
+ The Yelp reviews polarity dataset is constructed by
50
+ Xiang Zhang ([email protected]) from the above dataset.
51
+ It is first used as a text classification benchmark in the following paper:
52
+ Xiang Zhang, Junbo Zhao, Yann LeCun. Character-level Convolutional Networks
53
+ for Text Classification. Advances in Neural Information Processing Systems 28
54
+ (NIPS 2015).
55
+
56
+
57
+ DESCRIPTION
58
+
59
+ The Yelp reviews polarity dataset is constructed by considering stars 1 and 2
60
+ negative, and 3 and 4 positive. For each polarity 280,000 training samples and
61
+ 19,000 testing samples are take randomly. In total there are 560,000 trainig
62
+ samples and 38,000 testing samples. Negative polarity is class 1,
63
+ and positive class 2.
64
+
65
+ The files train.csv and test.csv contain all the training samples as
66
+ comma-sparated values. There are 2 columns in them, corresponding to class
67
+ index (1 and 2) and review text. The review texts are escaped using double
68
+ quotes ("), and any internal double quote is escaped by 2 double quotes ("").
69
+ New lines are escaped by a backslash followed with an "n" character,
70
+ that is "\n".
71
+ """
72
+
73
+ _CITATION = """\
74
+ @article{zhangCharacterlevelConvolutionalNetworks2015,
75
+ archivePrefix = {arXiv},
76
+ eprinttype = {arxiv},
77
+ eprint = {1509.01626},
78
+ primaryClass = {cs},
79
+ title = {Character-Level {{Convolutional Networks}} for {{Text Classification}}},
80
+ abstract = {This article offers an empirical exploration on the use of character-level convolutional networks (ConvNets) for text classification. We constructed several large-scale datasets to show that character-level convolutional networks could achieve state-of-the-art or competitive results. Comparisons are offered against traditional models such as bag of words, n-grams and their TFIDF variants, and deep learning models such as word-based ConvNets and recurrent neural networks.},
81
+ journal = {arXiv:1509.01626 [cs]},
82
+ author = {Zhang, Xiang and Zhao, Junbo and LeCun, Yann},
83
+ month = sep,
84
+ year = {2015},
85
+ }
86
+
87
+ """
88
+
89
+ _DOWNLOAD_URL = "https://s3.amazonaws.com/fast-ai-nlp/yelp_review_polarity_csv.tgz"
90
+
91
+
92
+ class YelpPolarityReviewsConfig(datasets.BuilderConfig):
93
+ """BuilderConfig for YelpPolarityReviews."""
94
+
95
+ def __init__(self, **kwargs):
96
+ """BuilderConfig for YelpPolarityReviews.
97
+
98
+ Args:
99
+
100
+ **kwargs: keyword arguments forwarded to super.
101
+ """
102
+ super(YelpPolarityReviewsConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
103
+
104
+
105
+ class YelpPolarity(datasets.GeneratorBasedBuilder):
106
+ """Yelp Polarity reviews dataset."""
107
+
108
+ BUILDER_CONFIGS = [
109
+ YelpPolarityReviewsConfig(
110
+ name="plain_text",
111
+ description="Plain text",
112
+ )
113
+ ]
114
+
115
+ def _info(self):
116
+ return datasets.DatasetInfo(
117
+ description=_DESCRIPTION,
118
+ features=datasets.Features(
119
+ {
120
+ "text": datasets.Value("string"),
121
+ "label": datasets.features.ClassLabel(names=["1", "2"]),
122
+ }
123
+ ),
124
+ supervised_keys=None,
125
+ homepage="https://course.fast.ai/datasets",
126
+ citation=_CITATION,
127
+ )
128
+
129
+ def _vocab_text_gen(self, train_file):
130
+ for _, ex in self._generate_examples(train_file):
131
+ yield ex["text"]
132
+
133
+ def _split_generators(self, dl_manager):
134
+ arch_path = dl_manager.download_and_extract(_DOWNLOAD_URL)
135
+ train_file = os.path.join(arch_path, "yelp_review_polarity_csv", "train.csv")
136
+ test_file = os.path.join(arch_path, "yelp_review_polarity_csv", "test.csv")
137
+ return [
138
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_file}),
139
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_file}),
140
+ ]
141
+
142
+ def _generate_examples(self, filepath):
143
+ """Generate Yelp examples."""
144
+ with open(filepath, encoding="utf-8") as f:
145
+ for line_id, line in enumerate(f):
146
+ # The format of the line is:
147
+ # "1", "The text of the review."
148
+ yield line_id, {"text": line[5:-2].strip(), "label": line[1]}