albertvillanova HF staff commited on
Commit
1087fc1
1 Parent(s): 610bdae

Delete loading script

Browse files
Files changed (1) hide show
  1. imdb.py +0 -111
imdb.py DELETED
@@ -1,111 +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
- """IMDB movie reviews dataset."""
18
-
19
- import datasets
20
- from datasets.tasks import TextClassification
21
-
22
-
23
- _DESCRIPTION = """\
24
- Large Movie Review Dataset.
25
- This is a dataset for binary sentiment classification containing substantially \
26
- more data than previous benchmark datasets. We provide a set of 25,000 highly \
27
- polar movie reviews for training, and 25,000 for testing. There is additional \
28
- unlabeled data for use as well.\
29
- """
30
-
31
- _CITATION = """\
32
- @InProceedings{maas-EtAl:2011:ACL-HLT2011,
33
- author = {Maas, Andrew L. and Daly, Raymond E. and Pham, Peter T. and Huang, Dan and Ng, Andrew Y. and Potts, Christopher},
34
- title = {Learning Word Vectors for Sentiment Analysis},
35
- booktitle = {Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies},
36
- month = {June},
37
- year = {2011},
38
- address = {Portland, Oregon, USA},
39
- publisher = {Association for Computational Linguistics},
40
- pages = {142--150},
41
- url = {http://www.aclweb.org/anthology/P11-1015}
42
- }
43
- """
44
-
45
- _DOWNLOAD_URL = "https://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz"
46
-
47
-
48
- class IMDBReviewsConfig(datasets.BuilderConfig):
49
- """BuilderConfig for IMDBReviews."""
50
-
51
- def __init__(self, **kwargs):
52
- """BuilderConfig for IMDBReviews.
53
-
54
- Args:
55
- **kwargs: keyword arguments forwarded to super.
56
- """
57
- super(IMDBReviewsConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
58
-
59
-
60
- class Imdb(datasets.GeneratorBasedBuilder):
61
- """IMDB movie reviews dataset."""
62
-
63
- BUILDER_CONFIGS = [
64
- IMDBReviewsConfig(
65
- name="plain_text",
66
- description="Plain text",
67
- )
68
- ]
69
-
70
- def _info(self):
71
- return datasets.DatasetInfo(
72
- description=_DESCRIPTION,
73
- features=datasets.Features(
74
- {"text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["neg", "pos"])}
75
- ),
76
- supervised_keys=None,
77
- homepage="http://ai.stanford.edu/~amaas/data/sentiment/",
78
- citation=_CITATION,
79
- task_templates=[TextClassification(text_column="text", label_column="label")],
80
- )
81
-
82
- def _split_generators(self, dl_manager):
83
- archive = dl_manager.download(_DOWNLOAD_URL)
84
- return [
85
- datasets.SplitGenerator(
86
- name=datasets.Split.TRAIN, gen_kwargs={"files": dl_manager.iter_archive(archive), "split": "train"}
87
- ),
88
- datasets.SplitGenerator(
89
- name=datasets.Split.TEST, gen_kwargs={"files": dl_manager.iter_archive(archive), "split": "test"}
90
- ),
91
- datasets.SplitGenerator(
92
- name=datasets.Split("unsupervised"),
93
- gen_kwargs={"files": dl_manager.iter_archive(archive), "split": "train", "labeled": False},
94
- ),
95
- ]
96
-
97
- def _generate_examples(self, files, split, labeled=True):
98
- """Generate aclImdb examples."""
99
- # For labeled examples, extract the label from the path.
100
- if labeled:
101
- label_mapping = {"pos": 1, "neg": 0}
102
- for path, f in files:
103
- if path.startswith(f"aclImdb/{split}"):
104
- label = label_mapping.get(path.split("/")[2])
105
- if label is not None:
106
- yield path, {"text": f.read().decode("utf-8"), "label": label}
107
- else:
108
- for path, f in files:
109
- if path.startswith(f"aclImdb/{split}"):
110
- if path.split("/")[2] == "unsup":
111
- yield path, {"text": f.read().decode("utf-8"), "label": -1}