albertvillanova HF staff commited on
Commit
bd262ab
1 Parent(s): 9b32063

Delete loading script

Browse files
Files changed (1) hide show
  1. paws-x.py +0 -171
paws-x.py DELETED
@@ -1,171 +0,0 @@
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
- """PAWS-X, a multilingual version of PAWS for six languages."""
16
-
17
-
18
- import csv
19
-
20
- import datasets
21
-
22
-
23
- _CITATION = """\
24
- @InProceedings{pawsx2019emnlp,
25
- title = {{PAWS-X: A Cross-lingual Adversarial Dataset for Paraphrase Identification}},
26
- author = {Yang, Yinfei and Zhang, Yuan and Tar, Chris and Baldridge, Jason},
27
- booktitle = {Proc. of EMNLP},
28
- year = {2019}
29
- }
30
- """
31
-
32
- _DESCRIPTION = """\
33
- PAWS-X, a multilingual version of PAWS (Paraphrase Adversaries from Word Scrambling) for six languages.
34
-
35
- This dataset contains 23,659 human translated PAWS evaluation pairs and 296,406 machine
36
- translated training pairs in six typologically distinct languages: French, Spanish, German,
37
- Chinese, Japanese, and Korean. English language is available by default. All translated
38
- pairs are sourced from examples in PAWS-Wiki.
39
-
40
- For further details, see the accompanying paper: PAWS-X: A Cross-lingual Adversarial Dataset
41
- for Paraphrase Identification (https://arxiv.org/abs/1908.11828)
42
-
43
- NOTE: There might be some missing or wrong labels in the dataset and we have replaced them with -1.
44
- """
45
-
46
- _HOMEPAGE = "https://github.com/google-research-datasets/paws/tree/master/pawsx"
47
-
48
- # TODO: Add the licence for the dataset here if you can find it
49
- _LICENSE = 'The dataset may be freely used for any purpose, although acknowledgement of Google LLC ("Google") as the data source would be appreciated. The dataset is provided "AS IS" without any warranty, express or implied. Google disclaims all liability for any damages, direct or indirect, resulting from the use of the dataset.'
50
-
51
- # TODO: Add link to the official dataset URLs here
52
- # The HuggingFace dataset library don't host the datasets but only point to the original files
53
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
54
- _DATA_OPTIONS = [
55
- "en",
56
- "de",
57
- "es",
58
- "fr",
59
- "ja",
60
- "ko",
61
- "zh",
62
- ]
63
-
64
- _DATA_URL = "https://storage.googleapis.com/paws/pawsx/x-final.tar.gz"
65
-
66
-
67
- class PAWSXConfig(datasets.BuilderConfig):
68
- """BuilderConfig for PAWSX."""
69
-
70
- def __init__(self, **kwargs):
71
- """Constructs a PAWSXConfig.
72
- Args:
73
- **kwargs: keyword arguments forwarded to super.
74
- """
75
- super(PAWSXConfig, self).__init__(version=datasets.Version("1.1.0", ""), **kwargs),
76
-
77
-
78
- class PAWSX(datasets.GeneratorBasedBuilder):
79
- """PAWS-X, a multilingual version of PAWS for six languages."""
80
-
81
- VERSION = datasets.Version("1.1.0")
82
-
83
- BUILDER_CONFIGS = [
84
- PAWSXConfig(
85
- name=config_name,
86
- description=(f"This config contains samples in {config_name}."),
87
- )
88
- for config_name in _DATA_OPTIONS
89
- ]
90
-
91
- def _info(self):
92
- features = datasets.Features(
93
- {
94
- "id": datasets.Value("int32"),
95
- "sentence1": datasets.Value("string"),
96
- "sentence2": datasets.Value("string"),
97
- "label": datasets.features.ClassLabel(names=["0", "1"]),
98
- }
99
- )
100
- return datasets.DatasetInfo(
101
- # This is the description that will appear on the datasets page.
102
- description=_DESCRIPTION,
103
- # This defines the different columns of the dataset and their types
104
- features=features, # Here we define them above because they are different between the two configurations
105
- # If there's a common (input, target) tuple from the features,
106
- # specify them here. They'll be used if as_supervised=True in
107
- # builder.as_dataset.
108
- supervised_keys=None,
109
- # Homepage of the dataset for documentation
110
- homepage=_HOMEPAGE,
111
- # License for the dataset if available
112
- license=_LICENSE,
113
- # Citation for the dataset
114
- citation=_CITATION,
115
- )
116
-
117
- def _split_generators(self, dl_manager):
118
- """Returns SplitGenerators."""
119
-
120
- archive = dl_manager.download(_DATA_URL)
121
-
122
- _TEST_FILE_NAME = f"x-final/{self.config.name}/test_2k.tsv"
123
- _VAL_FILE_NAME = f"x-final/{self.config.name}/dev_2k.tsv"
124
-
125
- if self.config.name == "en":
126
- _TRAIN_FILE_NAME = f"x-final/{self.config.name}/train.tsv"
127
- else:
128
- _TRAIN_FILE_NAME = f"x-final/{self.config.name}/translated_train.tsv"
129
-
130
- return [
131
- datasets.SplitGenerator(
132
- name=datasets.Split.TRAIN,
133
- # These kwargs will be passed to _generate_examples
134
- gen_kwargs={
135
- "filepath": _TRAIN_FILE_NAME,
136
- "files": dl_manager.iter_archive(archive),
137
- },
138
- ),
139
- datasets.SplitGenerator(
140
- name=datasets.Split.TEST,
141
- # These kwargs will be passed to _generate_examples
142
- gen_kwargs={
143
- "filepath": _TEST_FILE_NAME,
144
- "files": dl_manager.iter_archive(archive),
145
- },
146
- ),
147
- datasets.SplitGenerator(
148
- name=datasets.Split.VALIDATION,
149
- # These kwargs will be passed to _generate_examples
150
- gen_kwargs={
151
- "filepath": _VAL_FILE_NAME,
152
- "files": dl_manager.iter_archive(archive),
153
- },
154
- ),
155
- ]
156
-
157
- def _generate_examples(self, filepath, files):
158
- """Yields examples."""
159
-
160
- for path, f in files:
161
- if path == filepath:
162
- lines = (line.decode("utf-8") for line in f)
163
- data = csv.DictReader(lines, delimiter="\t", quoting=csv.QUOTE_NONE)
164
- for id_, row in enumerate(data):
165
- yield id_, {
166
- "id": row["id"],
167
- "sentence1": row["sentence1"],
168
- "sentence2": row["sentence2"],
169
- "label": row["label"],
170
- }
171
- break