Convert dataset to Parquet

#4
README.md CHANGED
@@ -31,16 +31,25 @@ dataset_info:
31
  '1': pos
32
  splits:
33
  - name: train
34
- num_bytes: 1074810
35
  num_examples: 8530
36
  - name: validation
37
- num_bytes: 134679
38
  num_examples: 1066
39
  - name: test
40
- num_bytes: 135972
41
  num_examples: 1066
42
- download_size: 487770
43
- dataset_size: 1345461
 
 
 
 
 
 
 
 
 
44
  train-eval-index:
45
  - config: default
46
  task: text-classification
 
31
  '1': pos
32
  splits:
33
  - name: train
34
+ num_bytes: 1074806
35
  num_examples: 8530
36
  - name: validation
37
+ num_bytes: 134675
38
  num_examples: 1066
39
  - name: test
40
+ num_bytes: 135968
41
  num_examples: 1066
42
+ download_size: 881052
43
+ dataset_size: 1345449
44
+ configs:
45
+ - config_name: default
46
+ data_files:
47
+ - split: train
48
+ path: data/train-*
49
+ - split: validation
50
+ path: data/validation-*
51
+ - split: test
52
+ path: data/test-*
53
  train-eval-index:
54
  - config: default
55
  task: text-classification
data/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:960f73534d561dcac3f2606a331c05b95635ea5dd6cd7585fe0a866e58d16546
3
+ size 92206
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88ed3800f8db5e7ae1404e86f20469e92fb57cf2d7519813b8a1cec599ea1a5e
3
+ size 698845
data/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53d17c4b866ded1e76951f386169a0881120a4edda9d4bb5bd94bc4ed4cdd5bc
3
+ size 90001
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"default": {"description": "Movie Review Dataset.\nThis is a dataset of containing 5,331 positive and 5,331 negative processed\nsentences from Rotten Tomatoes movie reviews. This data was first used in Bo\nPang and Lillian Lee, ``Seeing stars: Exploiting class relationships for\nsentiment categorization with respect to rating scales.'', Proceedings of the\nACL, 2005.\n", "citation": "@InProceedings{Pang+Lee:05a,\n author = {Bo Pang and Lillian Lee},\n title = {Seeing stars: Exploiting class relationships for sentiment\n categorization with respect to rating scales},\n booktitle = {Proceedings of the ACL},\n year = 2005\n}\n", "homepage": "http://www.cs.cornell.edu/people/pabo/movie-review-data/", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["neg", "pos"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "", "output": ""}, "task_templates": [{"task": "text-classification", "text_column": "text", "label_column": "label", "labels": ["neg", "pos"]}], "builder_name": "rotten_tomatoes_movie_review", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1074810, "num_examples": 8530, "dataset_name": "rotten_tomatoes_movie_review"}, "validation": {"name": "validation", "num_bytes": 134679, "num_examples": 1066, "dataset_name": "rotten_tomatoes_movie_review"}, "test": {"name": "test", "num_bytes": 135972, "num_examples": 1066, "dataset_name": "rotten_tomatoes_movie_review"}}, "download_checksums": {"https://storage.googleapis.com/seldon-datasets/sentence_polarity_v1/rt-polaritydata.tar.gz": {"num_bytes": 487770, "checksum": "a05befe52aafda71d458d188a1c54506a998b1308613ba76bbda2e5029409ce9"}}, "download_size": 487770, "post_processing_size": null, "dataset_size": 1345461, "size_in_bytes": 1833231}}
 
 
rotten_tomatoes.py DELETED
@@ -1,121 +0,0 @@
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
- """Rotten tomatoes movie reviews dataset."""
18
-
19
- import datasets
20
- from datasets.tasks import TextClassification
21
-
22
-
23
- _DESCRIPTION = """\
24
- Movie Review Dataset.
25
- This is a dataset of containing 5,331 positive and 5,331 negative processed
26
- sentences from Rotten Tomatoes movie reviews. This data was first used in Bo
27
- Pang and Lillian Lee, ``Seeing stars: Exploiting class relationships for
28
- sentiment categorization with respect to rating scales.'', Proceedings of the
29
- ACL, 2005.
30
- """
31
-
32
- _CITATION = """\
33
- @InProceedings{Pang+Lee:05a,
34
- author = {Bo Pang and Lillian Lee},
35
- title = {Seeing stars: Exploiting class relationships for sentiment
36
- categorization with respect to rating scales},
37
- booktitle = {Proceedings of the ACL},
38
- year = 2005
39
- }
40
- """
41
-
42
- _DOWNLOAD_URL = "https://storage.googleapis.com/seldon-datasets/sentence_polarity_v1/rt-polaritydata.tar.gz"
43
-
44
-
45
- class RottenTomatoesMovieReview(datasets.GeneratorBasedBuilder):
46
- """Cornell Rotten Tomatoes movie reviews dataset."""
47
-
48
- VERSION = datasets.Version("1.0.0")
49
-
50
- def _info(self):
51
- return datasets.DatasetInfo(
52
- description=_DESCRIPTION,
53
- features=datasets.Features(
54
- {"text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["neg", "pos"])}
55
- ),
56
- supervised_keys=[""],
57
- homepage="http://www.cs.cornell.edu/people/pabo/movie-review-data/",
58
- citation=_CITATION,
59
- task_templates=[TextClassification(text_column="text", label_column="label")],
60
- )
61
-
62
- def _split_generators(self, dl_manager):
63
- """Downloads Rotten Tomatoes sentences."""
64
- archive = dl_manager.download(_DOWNLOAD_URL)
65
- return [
66
- datasets.SplitGenerator(
67
- name=datasets.Split.TRAIN,
68
- gen_kwargs={"split_key": "train", "files": dl_manager.iter_archive(archive)},
69
- ),
70
- datasets.SplitGenerator(
71
- name=datasets.Split.VALIDATION,
72
- gen_kwargs={"split_key": "validation", "files": dl_manager.iter_archive(archive)},
73
- ),
74
- datasets.SplitGenerator(
75
- name=datasets.Split.TEST,
76
- gen_kwargs={"split_key": "test", "files": dl_manager.iter_archive(archive)},
77
- ),
78
- ]
79
-
80
- def _get_examples_from_split(self, split_key, files):
81
- """Reads Rotten Tomatoes sentences and splits into 80% train,
82
- 10% validation, and 10% test, as is the practice set out in Jinfeng
83
- Li, ``TEXTBUGGER: Generating Adversarial Text Against Real-world
84
- Applications.''
85
- """
86
- data_dir = "rt-polaritydata/"
87
- pos_samples, neg_samples = None, None
88
- for path, f in files:
89
- if path == data_dir + "rt-polarity.pos":
90
- pos_samples = [line.decode("latin-1").strip() for line in f]
91
- elif path == data_dir + "rt-polarity.neg":
92
- neg_samples = [line.decode("latin-1").strip() for line in f]
93
- if pos_samples is not None and neg_samples is not None:
94
- break
95
-
96
- # 80/10/10 split
97
- i1 = int(len(pos_samples) * 0.8 + 0.5)
98
- i2 = int(len(pos_samples) * 0.9 + 0.5)
99
- train_samples = pos_samples[:i1] + neg_samples[:i1]
100
- train_labels = (["pos"] * i1) + (["neg"] * i1)
101
- validation_samples = pos_samples[i1:i2] + neg_samples[i1:i2]
102
- validation_labels = (["pos"] * (i2 - i1)) + (["neg"] * (i2 - i1))
103
- test_samples = pos_samples[i2:] + neg_samples[i2:]
104
- test_labels = (["pos"] * (len(pos_samples) - i2)) + (["neg"] * (len(pos_samples) - i2))
105
-
106
- if split_key == "train":
107
- return (train_samples, train_labels)
108
- if split_key == "validation":
109
- return (validation_samples, validation_labels)
110
- if split_key == "test":
111
- return (test_samples, test_labels)
112
- else:
113
- raise ValueError(f"Invalid split key {split_key}")
114
-
115
- def _generate_examples(self, split_key, files):
116
- """Yields examples for a given split of MR."""
117
- split_text, split_labels = self._get_examples_from_split(split_key, files)
118
- for text, label in zip(split_text, split_labels):
119
- data_key = split_key + "_" + text
120
- feature_dict = {"text": text, "label": label}
121
- yield data_key, feature_dict