albertvillanova HF staff commited on
Commit
c62813f
1 Parent(s): e5cf512

Convert dataset to Parquet (#4)

Browse files

- Convert dataset to Parquet (97fd57cc462e09e89e18d65cb004ddec70a69357)
- Delete loading script (1638c2b89ff2dbd6fe0c93eb3137f87c8a6edfcb)

README.md CHANGED
@@ -248,16 +248,25 @@ dataset_info:
248
  '1': 'true'
249
  splits:
250
  - name: train
251
- num_bytes: 10060799
252
  num_examples: 21046
253
  - name: test
254
- num_bytes: 1253810
255
  num_examples: 2629
256
  - name: validation
257
- num_bytes: 1266874
258
  num_examples: 2573
259
- download_size: 7201807
260
- dataset_size: 12581483
 
 
 
 
 
 
 
 
 
261
  ---
262
 
263
  # Dataset Card for Disaster Response Messages
 
248
  '1': 'true'
249
  splits:
250
  - name: train
251
+ num_bytes: 10060751
252
  num_examples: 21046
253
  - name: test
254
+ num_bytes: 1253794
255
  num_examples: 2629
256
  - name: validation
257
+ num_bytes: 1266858
258
  num_examples: 2573
259
+ download_size: 3635948
260
+ dataset_size: 12581403
261
+ configs:
262
+ - config_name: default
263
+ data_files:
264
+ - split: train
265
+ path: data/train-*
266
+ - split: test
267
+ path: data/test-*
268
+ - split: validation
269
+ path: data/validation-*
270
  ---
271
 
272
  # Dataset Card for Disaster Response Messages
data/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae38ee653cfe31d712b8d8b36114f2106d064855ce76e577b1d2b768bb1a26e0
3
+ size 379323
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4287f7b70f24b0026565fe1017be00694702188275c422e1fbcb92b93a0e3196
3
+ size 2868843
data/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a3c3f415cdb659113d9a2e956b1ce15cceaebd12d21b12a815d965a3810ea54
3
+ size 387782
disaster_response_messages.py DELETED
@@ -1,204 +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
- """Multilingual Disaster Response Messages dataset."""
18
-
19
-
20
- import csv
21
-
22
- import datasets
23
-
24
-
25
- _DESCRIPTION = """\
26
- This dataset contains 30,000 messages drawn from events including an earthquake in Haiti in 2010, an earthquake in Chile in 2010, floods in Pakistan in 2010, super-storm Sandy in the U.S.A. in 2012, and news articles spanning a large number of years and 100s of different disasters.
27
- The data has been encoded with 36 different categories related to disaster response and has been stripped of messages with sensitive information in their entirety.
28
- Upon release, this is the featured dataset of a new Udacity course on Data Science and the AI4ALL summer school and is especially utile for text analytics and natural language processing (NLP) tasks and models.
29
- The input data in this job contains thousands of untranslated disaster-related messages and their English translations.
30
- """
31
-
32
- _CITATION = """\
33
- @inproceedings{title={Multilingual Disaster Response Messages}
34
- }
35
- """
36
-
37
- _TRAIN_DOWNLOAD_URL = "https://s3.amazonaws.com/datasets.huggingface.co/disaster_response_messages_training.csv"
38
-
39
- _TEST_DOWNLOAD_URL = "https://s3.amazonaws.com/datasets.huggingface.co/disaster_response_messages_test.csv"
40
-
41
- _VALID_DOWNLOAD_URL = "https://s3.amazonaws.com/datasets.huggingface.co/disaster_response_messages_validation.csv"
42
-
43
-
44
- class DisasterResponseMessages(datasets.GeneratorBasedBuilder):
45
- """Multilingual Disaster Response Messages dataset."""
46
-
47
- def _info(self):
48
- return datasets.DatasetInfo(
49
- description=_DESCRIPTION,
50
- features=datasets.Features(
51
- {
52
- "split": datasets.Value("string"),
53
- "message": datasets.Value("string"),
54
- "original": datasets.Value("string"),
55
- "genre": datasets.Value("string"),
56
- "related": datasets.ClassLabel(names=["false", "true", "maybe"]),
57
- "PII": datasets.Value("int8"),
58
- "request": datasets.ClassLabel(names=["false", "true"]),
59
- "offer": datasets.Value("int8"),
60
- "aid_related": datasets.ClassLabel(names=["false", "true"]),
61
- "medical_help": datasets.ClassLabel(names=["false", "true"]),
62
- "medical_products": datasets.ClassLabel(names=["false", "true"]),
63
- "search_and_rescue": datasets.ClassLabel(names=["false", "true"]),
64
- "security": datasets.ClassLabel(names=["false", "true"]),
65
- "military": datasets.ClassLabel(names=["false", "true"]),
66
- "child_alone": datasets.Value("int8"),
67
- "water": datasets.ClassLabel(names=["false", "true"]),
68
- "food": datasets.ClassLabel(names=["false", "true"]),
69
- "shelter": datasets.ClassLabel(names=["false", "true"]),
70
- "clothing": datasets.ClassLabel(names=["false", "true"]),
71
- "money": datasets.ClassLabel(names=["false", "true"]),
72
- "missing_people": datasets.ClassLabel(names=["false", "true"]),
73
- "refugees": datasets.ClassLabel(names=["false", "true"]),
74
- "death": datasets.ClassLabel(names=["false", "true"]),
75
- "other_aid": datasets.ClassLabel(names=["false", "true"]),
76
- "infrastructure_related": datasets.ClassLabel(names=["false", "true"]),
77
- "transport": datasets.ClassLabel(names=["false", "true"]),
78
- "buildings": datasets.ClassLabel(names=["false", "true"]),
79
- "electricity": datasets.ClassLabel(names=["false", "true"]),
80
- "tools": datasets.ClassLabel(names=["false", "true"]),
81
- "hospitals": datasets.ClassLabel(names=["false", "true"]),
82
- "shops": datasets.ClassLabel(names=["false", "true"]),
83
- "aid_centers": datasets.ClassLabel(names=["false", "true"]),
84
- "other_infrastructure": datasets.ClassLabel(names=["false", "true"]),
85
- "weather_related": datasets.ClassLabel(names=["false", "true"]),
86
- "floods": datasets.ClassLabel(names=["false", "true"]),
87
- "storm": datasets.ClassLabel(names=["false", "true"]),
88
- "fire": datasets.ClassLabel(names=["false", "true"]),
89
- "earthquake": datasets.ClassLabel(names=["false", "true"]),
90
- "cold": datasets.ClassLabel(names=["false", "true"]),
91
- "other_weather": datasets.ClassLabel(names=["false", "true"]),
92
- "direct_report": datasets.ClassLabel(names=["false", "true"]),
93
- }
94
- ),
95
- homepage="https://appen.com/datasets/combined-disaster-response-data/",
96
- citation=_CITATION,
97
- )
98
-
99
- def _split_generators(self, dl_manager):
100
- train_path, test_path, valid_path = dl_manager.download_and_extract(
101
- [_TRAIN_DOWNLOAD_URL, _TEST_DOWNLOAD_URL, _VALID_DOWNLOAD_URL]
102
- )
103
- return [
104
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
105
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
106
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": valid_path}),
107
- ]
108
-
109
- def _generate_examples(self, filepath):
110
- """Generate Distaster Response Messages examples."""
111
- with open(filepath, encoding="utf-8") as csv_file:
112
- csv_reader = csv.reader(
113
- csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
114
- )
115
- next(csv_reader, None)
116
- for id_, row in enumerate(csv_reader):
117
- row = row[1:]
118
- (
119
- split,
120
- message,
121
- original,
122
- genre,
123
- related,
124
- PII,
125
- request,
126
- offer,
127
- aid_related,
128
- medical_help,
129
- medical_products,
130
- search_and_rescue,
131
- security,
132
- military,
133
- child_alone,
134
- water,
135
- food,
136
- shelter,
137
- clothing,
138
- money,
139
- missing_people,
140
- refugees,
141
- death,
142
- other_aid,
143
- infrastructure_related,
144
- transport,
145
- buildings,
146
- electricity,
147
- tools,
148
- hospitals,
149
- shops,
150
- aid_centers,
151
- other_infrastructure,
152
- weather_related,
153
- floods,
154
- storm,
155
- fire,
156
- earthquake,
157
- cold,
158
- other_weather,
159
- direct_report,
160
- ) = row
161
-
162
- yield id_, {
163
- "split": (split),
164
- "message": (message),
165
- "original": (original),
166
- "genre": (genre),
167
- "related": int(related),
168
- "PII": int(PII),
169
- "request": int(request),
170
- "offer": int(offer),
171
- "aid_related": int(aid_related),
172
- "medical_help": int(medical_help),
173
- "medical_products": int(medical_products),
174
- "search_and_rescue": int(search_and_rescue),
175
- "security": int(security),
176
- "military": int(military),
177
- "child_alone": int(child_alone),
178
- "water": int(water),
179
- "food": int(food),
180
- "shelter": int(shelter),
181
- "clothing": int(clothing),
182
- "money": int(money),
183
- "missing_people": int(missing_people),
184
- "refugees": int(refugees),
185
- "death": int(death),
186
- "other_aid": int(other_aid),
187
- "infrastructure_related": int(infrastructure_related),
188
- "transport": int(transport),
189
- "buildings": int(buildings),
190
- "electricity": int(electricity),
191
- "tools": int(tools),
192
- "hospitals": int(hospitals),
193
- "shops": int(shops),
194
- "aid_centers": int(aid_centers),
195
- "other_infrastructure": int(other_infrastructure),
196
- "weather_related": int(weather_related),
197
- "floods": int(floods),
198
- "storm": int(storm),
199
- "fire": int(fire),
200
- "earthquake": int(earthquake),
201
- "cold": int(cold),
202
- "other_weather": int(other_weather),
203
- "direct_report": int(direct_report),
204
- }