Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
Libraries:
Datasets
pandas
License:
parquet-converter commited on
Commit
e2277d5
·
1 Parent(s): 6ae2656

Update parquet files

Browse files
.gitattributes CHANGED
@@ -16,3 +16,5 @@
16
  *.pth filter=lfs diff=lfs merge=lfs -text
17
  data/train-00000-of-00001.parquet filter=lfs diff=lfs merge=lfs -text
18
  data/test-00000-of-00001.parquet filter=lfs diff=lfs merge=lfs -text
 
 
 
16
  *.pth filter=lfs diff=lfs merge=lfs -text
17
  data/train-00000-of-00001.parquet filter=lfs diff=lfs merge=lfs -text
18
  data/test-00000-of-00001.parquet filter=lfs diff=lfs merge=lfs -text
19
+ HumAID/hum_aid-train.parquet filter=lfs diff=lfs merge=lfs -text
20
+ HumAID/hum_aid-test.parquet filter=lfs diff=lfs merge=lfs -text
HumAID.py DELETED
@@ -1,210 +0,0 @@
1
- """
2
- @author: Firoj Alam
3
- @email: firojalam@gmail.com
4
- Modified:
5
- """
6
-
7
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
8
- #
9
- # Licensed under the Apache License, Version 2.0 (the "License");
10
- # you may not use this file except in compliance with the License.
11
- # You may obtain a copy of the License at
12
- #
13
- # http://www.apache.org/licenses/LICENSE-2.0
14
- #
15
- # Unless required by applicable law or agreed to in writing, software
16
- # distributed under the License is distributed on an "AS IS" BASIS,
17
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- # See the License for the specific language governing permissions and
19
- # limitations under the License.
20
- # TODO: Address all TODOs and remove all explanatory comments
21
- """
22
- Data loader for HumAID dataset
23
- """
24
-
25
-
26
- import csv
27
- import json
28
- import os
29
-
30
- import datasets
31
-
32
-
33
- # TODO: Add BibTeX citation
34
- # Find for instance the citation on arxiv or on the dataset repo/website
35
- _CITATION = """\
36
- @inproceedings{humaid2020,
37
- Author = {Firoj Alam, Umair Qazi, Muhammad Imran, Ferda Ofli},
38
- booktitle={Proceedings of the Fifteenth International AAAI Conference on Web and Social Media},
39
- series={ICWSM~'21},
40
- Keywords = {Social Media, Crisis Computing, Tweet Text Classification, Disaster Response},
41
- Title = {HumAID: Human-Annotated Disaster Incidents Data from Twitter},
42
- Year = {2021},
43
- publisher={AAAI},
44
- address={Online},
45
- }
46
- """
47
-
48
- # TODO: Add description of the dataset here
49
- # You can copy an official description
50
- _DESCRIPTION = """\
51
- The HumAID Twitter dataset consists of several thousands of manually annotated tweets that has been collected during 19 major natural disaster events including earthquakes, hurricanes, wildfires, and floods, which happened from 2016 to 2019 across different parts of the World. The annotations in the provided datasets consists of following humanitarian categories. The dataset consists only english tweets and it is the largest dataset for crisis informatics so far.
52
- ** Humanitarian categories **
53
- - Caution and advice
54
- - Displaced people and evacuations
55
- - Dont know cant judge
56
- - Infrastructure and utility damage
57
- - Injured or dead people
58
- - Missing or found people
59
- - Not humanitarian
60
- - Other relevant information
61
- - Requests or urgent needs
62
- - Rescue volunteering or donation effort
63
- - Sympathy and support
64
- """
65
-
66
- # TODO: Add a link to an official homepage for the dataset here
67
- _HOMEPAGE = "https://crisisnlp.qcri.org/humaid_dataset"
68
-
69
- # TODO: Add the licence for the dataset here if you can find it
70
- _LICENSE = "https://crisisnlp.qcri.org/terms-of-use.html"
71
-
72
- # TODO: Add link to the official dataset URLs here
73
- # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
74
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
75
- _URLS = {
76
- "HumAID": "https://crisisnlp.qcri.org/data/humaid/humaid_data_all.zip",
77
- }
78
-
79
- class HumAIDConfig(datasets.BuilderConfig):
80
- """BuilderConfig for SuperGLUE."""
81
-
82
- def __init__(self, features, data_url, citation, url,label_classes=("False", "True"), **kwargs):
83
- """BuilderConfig for SuperGLUE.
84
- Args:
85
- features: `list[string]`, list of the features that will appear in the
86
- feature dict. Should not include "label".
87
- data_url: `string`, url to download the zip file from.
88
- citation: `string`, citation for the data set.
89
- url: `string`, url for information about the data set.
90
- label_classes: `list[string]`, the list of classes for the label if the
91
- label is present as a string. Non-string labels will be cast to either
92
- 'False' or 'True'.
93
- **kwargs: keyword arguments forwarded to super.
94
- """
95
- # Version history:
96
- # 1.0.2: Fixed non-nondeterminism in ReCoRD.
97
- # 1.0.1: Change from the pre-release trial version of SuperGLUE (v1.9) to
98
- # the full release (v2.0).
99
- # 1.0.0: S3 (new shuffling, sharding and slicing mechanism).
100
- # 0.0.2: Initial version.
101
- super(HumAIDConfig, self).__init__(version=datasets.Version("1.1.0"), **kwargs)
102
- self.features = features
103
- self.label_classes = label_classes
104
- self.data_url = data_url
105
- self.citation = citation
106
- self.url = url
107
-
108
-
109
- # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
110
- class HumAID(datasets.GeneratorBasedBuilder):
111
- """TODO: Short description of my dataset."""
112
-
113
- VERSION = datasets.Version("1.1.0")
114
-
115
- # This is an example of a dataset with multiple configurations.
116
- # If you don't want/need to define several sub-sets in your dataset,
117
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
118
-
119
- # If you need to make complex sub-parts in the datasets with configurable options
120
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
121
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
122
-
123
- # You will be able to load one or the other configurations in the following list with
124
- # data = datasets.load_dataset('my_dataset', 'first_domain')
125
-
126
- BUILDER_CONFIGS = [
127
- HumAIDConfig(
128
- name="HumAID",
129
- features = ["tweet_text", "class_label"],
130
- data_url = "https://crisisnlp.qcri.org/data/humaid/humaid_data_all.zip",
131
- citation = _CITATION,
132
- url = "https://github.com/google"
133
- )
134
- ]
135
- print(BUILDER_CONFIGS[0].name)
136
- # DEFAULT_CONFIG_NAME = "HumAID" # It's not mandatory to have a default configuration. Just use one if it make sense.
137
-
138
- def _info(self):
139
- features = datasets.Features(
140
- {
141
- "tweet_text": datasets.Value("string"),
142
- "class_label": datasets.Value("string"),
143
- }
144
- )
145
- return datasets.DatasetInfo(
146
- # This is the description that will appear on the datasets page.
147
- description=_DESCRIPTION,
148
- # This defines the different columns of the dataset and their types
149
- features=features, # Here we define them above because they are different between the two configurations
150
- # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
151
- # specify them. They'll be used if as_supervised=True in builder.as_dataset.
152
- # supervised_keys=("sentence", "label"),
153
- # Homepage of the dataset for documentation
154
- supervised_keys=None,
155
- homepage=_HOMEPAGE,
156
- # License for the dataset if available
157
- license=_LICENSE,
158
- # Citation for the dataset
159
- citation=_CITATION,
160
- )
161
-
162
- def _split_generators(self, dl_manager):
163
- # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
164
- # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
165
-
166
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
167
- # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
168
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
169
- urls = _URLS[self.config.name]
170
- print(urls)
171
- data_dir = dl_manager.download_and_extract(urls)
172
- return [
173
- datasets.SplitGenerator(
174
- name=datasets.Split.TRAIN,
175
- # These kwargs will be passed to _generate_examples
176
- gen_kwargs={
177
- "filepath": os.path.join(data_dir, "train.jsonl"),
178
- "split": "train",
179
- },
180
- ),
181
- datasets.SplitGenerator(
182
- name=datasets.Split.TEST,
183
- # These kwargs will be passed to _generate_examples
184
- gen_kwargs={
185
- "filepath": os.path.join(data_dir, "test.jsonl"),
186
- "split": "test"
187
- },
188
- ),
189
- datasets.SplitGenerator(
190
- name=datasets.Split.VALIDATION,
191
- # These kwargs will be passed to _generate_examples
192
- gen_kwargs={
193
- "filepath": os.path.join(data_dir, "dev.jsonl"),
194
- "split": "dev",
195
- },
196
- ),
197
- ]
198
-
199
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
200
- def _generate_examples(self, filepath, split):
201
- # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
202
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
203
- with open(filepath, encoding="utf-8") as f:
204
- for key, row in enumerate(f):
205
- data = json.loads(row)
206
- # Yields examples as (key, example) tuples
207
- yield key, {
208
- "tweet_text": data["tweet_text"],
209
- "class_label": data["class_label"],
210
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/test-00000-of-00001.parquet → HumAID/hum_aid-test.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:12b733d2f0f3e54af79ff372567bed7ecb7562a329f4d81f9acf94cae784edcf
3
- size 1438693
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce0203cd5cbb1169f23c756f9718a8fb6c72a34c9f698eb26ce3844c9d9df167
3
+ size 1463657
data/train-00000-of-00001.parquet → HumAID/hum_aid-train.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7e8b5d898ab119da3b9b219cd2b04a33fff0ae264857ebc8c51c6e5dd6788d28
3
- size 5045706
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d914bb3f11e492c4a046dcd36b5c41f24982ee1e2bd3fe6183e4b8ae7f607e38
3
+ size 5145409
HumAID/hum_aid-validation.parquet ADDED
Binary file (752 kB). View file
 
README.md DELETED
@@ -1,147 +0,0 @@
1
- # Dataset Card for HumAID
2
-
3
- ## Table of Contents
4
- - [Dataset Description](#dataset-description)
5
- - [Dataset Summary](#dataset-summary)
6
- - [Supported Tasks](#supported-tasks-and-leaderboards)
7
- - [Languages](#languages)
8
- - [Dataset Structure](#dataset-structure)
9
- - [Data Instances](#data-instances)
10
- - [Data Fields](#data-instances)
11
- - [Data Splits](#data-instances)
12
- - [Dataset Creation](#dataset-creation)
13
- - [Curation Rationale](#curation-rationale)
14
- - [Source Data](#source-data)
15
- - [Annotations](#annotations)
16
- - [Personal and Sensitive Information](#personal-and-sensitive-information)
17
- - [Considerations for Using the Data](#considerations-for-using-the-data)
18
- - [Social Impact of Dataset](#social-impact-of-dataset)
19
- - [Discussion of Biases](#discussion-of-biases)
20
- - [Other Known Limitations](#other-known-limitations)
21
- - [Additional Information](#additional-information)
22
- - [Dataset Curators](#dataset-curators)
23
- - [Licensing Information](#licensing-information)
24
- - [Citation Information](#citation-information)
25
-
26
- ## Dataset Description
27
-
28
- - **Homepage:** https://crisisnlp.qcri.org/humaid_dataset
29
- - **Repository:** https://crisisnlp.qcri.org/data/humaid/humaid_data_all.zip
30
- - **Paper:** https://ojs.aaai.org/index.php/ICWSM/article/view/18116/17919
31
- <!-- - **Leaderboard:** [Needs More Information] -->
32
- <!-- - **Point of Contact:** [Needs More Information] -->
33
-
34
- ### Dataset Summary
35
-
36
- The HumAID Twitter dataset consists of several thousands of manually annotated tweets that has been collected during 19 major natural disaster events including earthquakes, hurricanes, wildfires, and floods, which happened from 2016 to 2019 across different parts of the World. The annotations in the provided datasets consists of following humanitarian categories. The dataset consists only english tweets and it is the largest dataset for crisis informatics so far.
37
- ** Humanitarian categories **
38
- - Caution and advice
39
- - Displaced people and evacuations
40
- - Dont know cant judge
41
- - Infrastructure and utility damage
42
- - Injured or dead people
43
- - Missing or found people
44
- - Not humanitarian
45
- - Other relevant information
46
- - Requests or urgent needs
47
- - Rescue volunteering or donation effort
48
- - Sympathy and support
49
-
50
- The resulting annotated dataset consists of 11 labels.
51
-
52
- ### Supported Tasks and Benchmark
53
- The dataset can be used to train a model for multiclass tweet classification for disaster response. The benchmark results can be found in https://ojs.aaai.org/index.php/ICWSM/article/view/18116/17919.
54
-
55
- Dataset is also released with event-wise and JSON objects for further research.
56
- Full set of the dataset can be found in https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/A7NVF7
57
-
58
- ### Languages
59
-
60
- English
61
-
62
- ## Dataset Structure
63
-
64
- ### Data Instances
65
-
66
- ```
67
- {
68
-
69
- "tweet_text": "@RT_com: URGENT: Death toll in #Ecuador #quake rises to 233 \u2013 President #Correa #1 in #Pakistan",
70
-
71
- "class_label": "injured_or_dead_people"
72
-
73
- }
74
- ```
75
- ### Data Fields
76
-
77
- * tweet_text: corresponds to the tweet text.
78
- * class_label: corresponds to a label assigned to a given tweet text
79
-
80
-
81
- ### Data Splits
82
-
83
- * Train
84
- * Development
85
- * Test
86
-
87
- ## Dataset Creation
88
-
89
- <!-- ### Curation Rationale -->
90
-
91
- ### Source Data
92
-
93
- #### Initial Data Collection and Normalization
94
-
95
- Tweets has been collected during several disaster events.
96
-
97
-
98
- ### Annotations
99
-
100
- #### Annotation process
101
-
102
- AMT has been used to annotate the dataset. Please check the paper for a more detail.
103
-
104
- #### Who are the annotators?
105
-
106
- - crowdsourced
107
-
108
-
109
- <!-- ## Considerations for Using the Data -->
110
-
111
- <!-- ### Social Impact of Dataset -->
112
-
113
-
114
-
115
- <!-- ### Discussion of Biases -->
116
-
117
- <!-- [Needs More Information] -->
118
-
119
- <!-- ### Other Known Limitations -->
120
-
121
- <!-- [Needs More Information] -->
122
-
123
- ## Additional Information
124
-
125
- ### Dataset Curators
126
-
127
- Authors of the paper.
128
-
129
-
130
- ### Licensing Information
131
-
132
- - cc-by-nc-4.0
133
-
134
- ### Citation Information
135
-
136
- ```
137
- @inproceedings{humaid2020,
138
- Author = {Firoj Alam, Umair Qazi, Muhammad Imran, Ferda Ofli},
139
- booktitle={Proceedings of the Fifteenth International AAAI Conference on Web and Social Media},
140
- series={ICWSM~'21},
141
- Keywords = {Social Media, Crisis Computing, Tweet Text Classification, Disaster Response},
142
- Title = {HumAID: Human-Annotated Disaster Incidents Data from Twitter},
143
- Year = {2021},
144
- publisher={AAAI},
145
- address={Online},
146
- }
147
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/validation-00000-of-00001.parquet DELETED
Binary file (739 kB)
 
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"Firoj--HumAID": {"description": "The HumAID Twitter dataset consists of several thousands of manually annotated tweets that has been collected during 19 major natural disaster events including earthquakes, hurricanes, wildfires, and floods, which happened from 2016 to 2019 across different parts of the World. The annotations in the provided datasets consists of following humanitarian categories. The dataset consists only english tweets and it is the largest dataset for crisis informatics so far.\n** Humanitarian categories **\n- Caution and advice\n- Displaced people and evacuations\n- Dont know cant judge\n- Infrastructure and utility damage\n- Injured or dead people\n- Missing or found people\n- Not humanitarian\n- Other relevant information\n- Requests or urgent needs\n- Rescue volunteering or donation effort\n- Sympathy and support\n", "citation": "@inproceedings{humaid2020,\nAuthor = {Firoj Alam, Umair Qazi, Muhammad Imran, Ferda Ofli},\nbooktitle={Proceedings of the Fifteenth International AAAI Conference on Web and Social Media},\nseries={ICWSM~'21},\nKeywords = {Social Media, Crisis Computing, Tweet Text Classification, Disaster Response},\nTitle = {HumAID: Human-Annotated Disaster Incidents Data from Twitter},\nYear = {2021},\npublisher={AAAI},\naddress={Online},\n}\n", "homepage": "https://crisisnlp.qcri.org/humaid_dataset", "license": "https://crisisnlp.qcri.org/terms-of-use.html", "features": {"tweet_text": {"dtype": "string", "id": null, "_type": "Value"}, "class_label": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "hum_aid", "config_name": "HumAID", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 9547288, "num_examples": 53531, "dataset_name": "HumAID"}, "test": {"name": "test", "num_bytes": 2706119, "num_examples": 15160, "dataset_name": "HumAID"}, "validation": {"name": "validation", "num_bytes": 1385929, "num_examples": 7793, "dataset_name": "HumAID"}}, "download_checksums": null, "download_size": 7223756, "post_processing_size": null, "dataset_size": 13639336, "size_in_bytes": 20863092}}
 
 
humaid.py DELETED
@@ -1,210 +0,0 @@
1
- """
2
- @author: Firoj Alam
3
- @email: firojalam@gmail.com
4
- Modified:
5
- """
6
-
7
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
8
- #
9
- # Licensed under the Apache License, Version 2.0 (the "License");
10
- # you may not use this file except in compliance with the License.
11
- # You may obtain a copy of the License at
12
- #
13
- # http://www.apache.org/licenses/LICENSE-2.0
14
- #
15
- # Unless required by applicable law or agreed to in writing, software
16
- # distributed under the License is distributed on an "AS IS" BASIS,
17
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- # See the License for the specific language governing permissions and
19
- # limitations under the License.
20
- # TODO: Address all TODOs and remove all explanatory comments
21
- """
22
- Data loader for HumAID dataset
23
- """
24
-
25
-
26
- import csv
27
- import json
28
- import os
29
-
30
- import datasets
31
-
32
-
33
- # TODO: Add BibTeX citation
34
- # Find for instance the citation on arxiv or on the dataset repo/website
35
- _CITATION = """\
36
- @inproceedings{humaid2020,
37
- Author = {Firoj Alam, Umair Qazi, Muhammad Imran, Ferda Ofli},
38
- booktitle={Proceedings of the Fifteenth International AAAI Conference on Web and Social Media},
39
- series={ICWSM~'21},
40
- Keywords = {Social Media, Crisis Computing, Tweet Text Classification, Disaster Response},
41
- Title = {HumAID: Human-Annotated Disaster Incidents Data from Twitter},
42
- Year = {2021},
43
- publisher={AAAI},
44
- address={Online},
45
- }
46
- """
47
-
48
- # TODO: Add description of the dataset here
49
- # You can copy an official description
50
- _DESCRIPTION = """\
51
- The HumAID Twitter dataset consists of several thousands of manually annotated tweets that has been collected during 19 major natural disaster events including earthquakes, hurricanes, wildfires, and floods, which happened from 2016 to 2019 across different parts of the World. The annotations in the provided datasets consists of following humanitarian categories. The dataset consists only english tweets and it is the largest dataset for crisis informatics so far.
52
- ** Humanitarian categories **
53
- - Caution and advice
54
- - Displaced people and evacuations
55
- - Dont know cant judge
56
- - Infrastructure and utility damage
57
- - Injured or dead people
58
- - Missing or found people
59
- - Not humanitarian
60
- - Other relevant information
61
- - Requests or urgent needs
62
- - Rescue volunteering or donation effort
63
- - Sympathy and support
64
- """
65
-
66
- # TODO: Add a link to an official homepage for the dataset here
67
- _HOMEPAGE = "https://crisisnlp.qcri.org/humaid_dataset"
68
-
69
- # TODO: Add the licence for the dataset here if you can find it
70
- _LICENSE = "https://crisisnlp.qcri.org/terms-of-use.html"
71
-
72
- # TODO: Add link to the official dataset URLs here
73
- # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
74
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
75
- _URLS = {
76
- "humaid": "https://crisisnlp.qcri.org/data/humaid/humaid_data_all.zip",
77
- }
78
-
79
- class HumAIDConfig(datasets.BuilderConfig):
80
- """BuilderConfig for SuperGLUE."""
81
-
82
- def __init__(self, features, data_url, citation, url,label_classes=("False", "True"), **kwargs):
83
- """BuilderConfig for SuperGLUE.
84
- Args:
85
- features: `list[string]`, list of the features that will appear in the
86
- feature dict. Should not include "label".
87
- data_url: `string`, url to download the zip file from.
88
- citation: `string`, citation for the data set.
89
- url: `string`, url for information about the data set.
90
- label_classes: `list[string]`, the list of classes for the label if the
91
- label is present as a string. Non-string labels will be cast to either
92
- 'False' or 'True'.
93
- **kwargs: keyword arguments forwarded to super.
94
- """
95
- # Version history:
96
- # 1.0.2: Fixed non-nondeterminism in ReCoRD.
97
- # 1.0.1: Change from the pre-release trial version of SuperGLUE (v1.9) to
98
- # the full release (v2.0).
99
- # 1.0.0: S3 (new shuffling, sharding and slicing mechanism).
100
- # 0.0.2: Initial version.
101
- super(HumAIDConfig, self).__init__(version=datasets.Version("1.1.0"), **kwargs)
102
- self.features = features
103
- self.label_classes = label_classes
104
- self.data_url = data_url
105
- self.citation = citation
106
- self.url = url
107
-
108
-
109
- # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
110
- class HumAID(datasets.GeneratorBasedBuilder):
111
- """TODO: Short description of my dataset."""
112
-
113
- VERSION = datasets.Version("1.1.0")
114
-
115
- # This is an example of a dataset with multiple configurations.
116
- # If you don't want/need to define several sub-sets in your dataset,
117
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
118
-
119
- # If you need to make complex sub-parts in the datasets with configurable options
120
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
121
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
122
-
123
- # You will be able to load one or the other configurations in the following list with
124
- # data = datasets.load_dataset('my_dataset', 'first_domain')
125
-
126
- BUILDER_CONFIGS = [
127
- HumAIDConfig(
128
- name="humaid",
129
- features = ["tweet_text", "class_label"],
130
- data_url = "https://crisisnlp.qcri.org/data/humaid/humaid_data_all.zip",
131
- citation = _CITATION,
132
- url = "https://github.com/google"
133
- )
134
- ]
135
- print(BUILDER_CONFIGS[0].name)
136
- # DEFAULT_CONFIG_NAME = "humaid" # It's not mandatory to have a default configuration. Just use one if it make sense.
137
-
138
- def _info(self):
139
- features = datasets.Features(
140
- {
141
- "tweet_text": datasets.Value("string"),
142
- "class_label": datasets.Value("string"),
143
- }
144
- )
145
- return datasets.DatasetInfo(
146
- # This is the description that will appear on the datasets page.
147
- description=_DESCRIPTION,
148
- # This defines the different columns of the dataset and their types
149
- features=features, # Here we define them above because they are different between the two configurations
150
- # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
151
- # specify them. They'll be used if as_supervised=True in builder.as_dataset.
152
- # supervised_keys=("sentence", "label"),
153
- # Homepage of the dataset for documentation
154
- supervised_keys=None,
155
- homepage=_HOMEPAGE,
156
- # License for the dataset if available
157
- license=_LICENSE,
158
- # Citation for the dataset
159
- citation=_CITATION,
160
- )
161
-
162
- def _split_generators(self, dl_manager):
163
- # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
164
- # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
165
-
166
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
167
- # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
168
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
169
- urls = _URLS[self.config.name]
170
- print(urls)
171
- data_dir = dl_manager.download_and_extract(urls)
172
- return [
173
- datasets.SplitGenerator(
174
- name=datasets.Split.TRAIN,
175
- # These kwargs will be passed to _generate_examples
176
- gen_kwargs={
177
- "filepath": os.path.join(data_dir, "train.jsonl"),
178
- "split": "train",
179
- },
180
- ),
181
- datasets.SplitGenerator(
182
- name=datasets.Split.TEST,
183
- # These kwargs will be passed to _generate_examples
184
- gen_kwargs={
185
- "filepath": os.path.join(data_dir, "test.jsonl"),
186
- "split": "test"
187
- },
188
- ),
189
- datasets.SplitGenerator(
190
- name=datasets.Split.VALIDATION,
191
- # These kwargs will be passed to _generate_examples
192
- gen_kwargs={
193
- "filepath": os.path.join(data_dir, "dev.jsonl"),
194
- "split": "dev",
195
- },
196
- ),
197
- ]
198
-
199
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
200
- def _generate_examples(self, filepath, split):
201
- # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
202
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
203
- with open(filepath, encoding="utf-8") as f:
204
- for key, row in enumerate(f):
205
- data = json.loads(row)
206
- # Yields examples as (key, example) tuples
207
- yield key, {
208
- "tweet_text": data["tweet_text"],
209
- "class_label": data["class_label"],
210
- }