Filippo Broggini commited on
Commit
de196e7
1 Parent(s): a9b0ef8

Push directly with git

Browse files
README.md ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - cc-by-4-0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 10K<n<100K
14
+ task_categories:
15
+ - text-classification
16
+ task_ids:
17
+ - natural-language-inference
18
+ pretty_name: OSDG Community Dataset (OSDG-CD)
19
+ ---
20
+ # Dataset Card for OSDG-CD
21
+
22
+ ## Table of Contents
23
+ - [Dataset Description](#dataset-description)
24
+ - [Dataset Summary](#dataset-summary)
25
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
26
+ - [Languages](#languages)
27
+ - [Dataset Structure](#dataset-structure)
28
+ - [Data Instances](#data-instances)
29
+ - [Data Fields](#data-fields)
30
+ - [Data Splits](#data-splits)
31
+ - [Dataset Creation](#dataset-creation)
32
+ - [Curation Rationale](#curation-rationale)
33
+ - [Source Data](#source-data)
34
+ - [Annotations](#annotations)
35
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
36
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
37
+ - [Social Impact of Dataset](#social-impact-of-dataset)
38
+ - [Discussion of Biases](#discussion-of-biases)
39
+ - [Other Known Limitations](#other-known-limitations)
40
+ - [Additional Information](#additional-information)
41
+ - [Dataset Curators](#dataset-curators)
42
+ - [Licensing Information](#licensing-information)
43
+ - [Citation Information](#citation-information)
44
+ - [Contributions](#contributions)
45
+
46
+ ## Dataset Description
47
+
48
+ - **Homepage:** [OSDG-CD homepage](https://doi.org/10.5281/zenodo.6393942)
49
+
50
+ ### Dataset Summary
51
+
52
+ The OSDG Community Dataset (OSDG-CD) is a public dataset of thousands of text excerpts, which were validated by approximately 1,000 OSDG Community Platform (OSDG-CP) citizen scientists from over 110 countries, with respect to the Sustainable Development Goals (SDGs).
53
+
54
+ ### Supported Tasks and Leaderboards
55
+
56
+ TBD
57
+
58
+ ### Languages
59
+
60
+ The language in the dataset is English.
61
+
62
+ ## Dataset Structure
63
+
64
+ ### Data Instances
65
+
66
+ For each instance, there is a string for the text, a string for the SDG, and an integer for the label.
67
+
68
+ ```
69
+ {'text': 'Each section states the economic principle, reviews international good practice and discusses the situation in Brazil.',
70
+ 'label': 5}
71
+ ```
72
+
73
+ The average token count for the premises and hypotheses are given below:
74
+
75
+ | Feature | Mean Token Count |
76
+ | ---------- | ---------------- |
77
+ | Premise | 14.1 |
78
+ | Hypothesis | 8.3 |
79
+
80
+ ### Data Fields
81
+
82
+ - `doi`: Digital Object Identifier of the original document
83
+ - `text_id`: unique text identifier
84
+ - `text`: text excerpt from the document
85
+ - `sdg`: the SDG the text is validated against
86
+ - `label`: an integer from `0` to `17` which corresponds to the `sdg` field
87
+ - `labels_negative`: the number of volunteers who rejected the suggested SDG label
88
+ - `labels_positive`: the number of volunteers who accepted the suggested SDG label
89
+ - `agreement`: agreement score based on the formula
90
+
91
+
92
+ ### Data Splits
93
+
94
+ The OSDG-CD dataset has 1 splits: _train_.
95
+
96
+ | Dataset Split | Number of Instances in Split |
97
+ | ------------- |----------------------------- |
98
+ | Train | 32,327 |
99
+
100
+ ## Dataset Creation
101
+
102
+ ### Curation Rationale
103
+
104
+ The [The OSDG Community Dataset (OSDG-CD)](https://doi.org/10.5281/zenodo.6393942) was developed as a benchmark for ...
105
+ with the goal of producing a dataset large enough to train models using neural methodologies.
106
+
107
+ ### Source Data
108
+
109
+ #### Initial Data Collection and Normalization
110
+
111
+ TBD
112
+
113
+ #### Who are the source language producers?
114
+
115
+ TBD
116
+
117
+ ### Annotations
118
+
119
+ #### Annotation process
120
+
121
+ TBD
122
+
123
+ #### Who are the annotators?
124
+
125
+ TBD
126
+
127
+ ### Personal and Sensitive Information
128
+
129
+ The dataset does not contain any personal information about the authors or the crowdworkers.
130
+
131
+ ## Considerations for Using the Data
132
+
133
+ ### Social Impact of Dataset
134
+
135
+ TBD
136
+
137
+ ## Additional Information
138
+
139
+ TBD
140
+
141
+ ### Dataset Curators
142
+
143
+ TBD
144
+
145
+ ### Licensing Information
146
+
147
+ The OSDG Community Dataset (OSDG-CD) is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
148
+
149
+ ### Citation Information
150
+
151
+ ```
152
+ @dataset{osdg_2022_6393942,
153
+ author = {OSDG and
154
+ UNDP IICPSD SDG AI Lab and
155
+ PPMI},
156
+ title = {OSDG Community Dataset (OSDG-CD)},
157
+ month = apr,
158
+ year = 2022,
159
+ note = {{This CSV file uses UTF-8 character encoding. For
160
+ easy access on MS Excel, open the file using Data
161
+ → From Text/CSV. Please split CSV data into
162
+ different columns by using a TAB delimiter.}},
163
+ publisher = {Zenodo},
164
+ version = {2022.04},
165
+ doi = {10.5281/zenodo.6393942},
166
+ url = {https://doi.org/10.5281/zenodo.6393942}
167
+ }
168
+ ```
169
+
170
+ ### Contributions
171
+
172
+ TBD
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"Filippo--osdg_cd": {"description": "The OSDG Community Dataset (OSDG-CD) is a public dataset of thousands of text excerpts, which were validated by approximately 1,000 OSDG Community Platform (OSDG-CP) citizen scientists from over 110 countries, with respect to the Sustainable Development Goals (SDGs).\n", "citation": "@dataset{osdg_2022_6393942,\n author = {OSDG and\n UNDP IICPSD SDG AI Lab and\n PPMI},\n title = {OSDG Community Dataset (OSDG-CD)},\n month = apr,\n year = 2022,\n note = {{This CSV file uses UTF-8 character encoding. For \n easy access on MS Excel, open the file using Data\n \u2192 From Text/CSV. Please split CSV data into\n different columns by using a TAB delimiter.}},\n publisher = {Zenodo},\n version = {2022.04},\n doi = {10.5281/zenodo.6393942},\n url = {https://doi.org/10.5281/zenodo.6393942}\n}\n", "homepage": "https://doi.org/10.5281/zenodo.6393942", "license": "https://creativecommons.org/licenses/by/4.0/", "features": {"doi": {"dtype": "string", "id": null, "_type": "Value"}, "text_id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "sdg": {"dtype": "uint16", "id": null, "_type": "Value"}, "label": {"num_classes": 17, "names": ["SDG 1", "SDG 2", "SDG 3", "SDG 4", "SDG 5", "SDG 6", "SDG 7", "SDG 8", "SDG 9", "SDG 10", "SDG 11", "SDG 12", "SDG 13", "SDG 14", "SDG 15", "SDG 16", "SDG 17"], "id": null, "_type": "ClassLabel"}, "labels_negative": {"dtype": "uint16", "id": null, "_type": "Value"}, "labels_positive": {"dtype": "uint16", "id": null, "_type": "Value"}, "agreement": {"dtype": "float32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "text-classification", "text_column": "text", "label_column": "label"}], "builder_name": "osdgcd", "config_name": "main_config", "version": {"version_str": "1.0.2", "description": "", "major": 1, "minor": 0, "patch": 2}, "splits": {"train": {"name": "train", "num_bytes": 21936802, "num_examples": 32327, "dataset_name": "osdg_cd"}}, "download_checksums": null, "download_size": 12952287, "post_processing_size": null, "dataset_size": 21936802, "size_in_bytes": 34889089}}
 
1
+ {"main_config": {"description": "The OSDG Community Dataset (OSDG-CD) is a public dataset of thousands of text excerpts, which were validated by approximately 1,000 OSDG Community Platform (OSDG-CP) citizen scientists from over 110 countries, with respect to the Sustainable Development Goals (SDGs).\n", "citation": "@dataset{osdg_2022_6393942,\n author = {OSDG and\n UNDP IICPSD SDG AI Lab and\n PPMI},\n title = {OSDG Community Dataset (OSDG-CD)},\n month = apr,\n year = 2022,\n note = {{This CSV file uses UTF-8 character encoding. For \n easy access on MS Excel, open the file using Data\n \u2192 From Text/CSV. Please split CSV data into\n different columns by using a TAB delimiter.}},\n publisher = {Zenodo},\n version = {2022.04},\n doi = {10.5281/zenodo.6393942},\n url = {https://doi.org/10.5281/zenodo.6393942}\n}\n", "homepage": "https://doi.org/10.5281/zenodo.6393942", "license": "https://creativecommons.org/licenses/by/4.0/", "features": {"doi": {"dtype": "string", "id": null, "_type": "Value"}, "text_id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "sdg": {"dtype": "uint16", "id": null, "_type": "Value"}, "label": {"num_classes": 17, "names": ["SDG 1", "SDG 2", "SDG 3", "SDG 4", "SDG 5", "SDG 6", "SDG 7", "SDG 8", "SDG 9", "SDG 10", "SDG 11", "SDG 12", "SDG 13", "SDG 14", "SDG 15", "SDG 16", "SDG 17"], "id": null, "_type": "ClassLabel"}, "labels_negative": {"dtype": "uint16", "id": null, "_type": "Value"}, "labels_positive": {"dtype": "uint16", "id": null, "_type": "Value"}, "agreement": {"dtype": "float32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "text-classification", "text_column": "text", "label_column": "label"}], "builder_name": "osdgcd", "config_name": "main_config", "version": {"version_str": "1.0.2", "description": "", "major": 1, "minor": 0, "patch": 2}, "splits": {"train": {"name": "train", "num_bytes": 21952966, "num_examples": 32327, "dataset_name": "osdgcd"}}, "download_checksums": {"https://zenodo.org/record/6393942/files/osdg-community-dataset-v2022-04-01.csv": {"num_bytes": 21618165, "checksum": "5d82cac00567fab0bfd361c8211c6eb67ecb525ee730e5bf93a83385713ea8a6"}}, "download_size": 21618165, "post_processing_size": null, "dataset_size": 21952966, "size_in_bytes": 43571131}}
data/train-00000-of-00001.parquet → dummy/main_config/1.0.2/dummy_data.zip RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4ef39efdd9cc7aaf0259e4f2b2075e0bad8454de72d58d69754f747a4d56b443
3
- size 12952287
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:110c81e1d587154eb6d9ae170adf1d375562c5e4deb17585d50a92566bedc165
3
+ size 1679
dummy/main_config/1.0.2/dummy_data.zip.lock ADDED
File without changes
osdg_cd.py ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """OSGD-CD: The OSDG Community Dataset."""
18
+
19
+
20
+ import csv
21
+ import json
22
+
23
+ import datasets
24
+ from datasets.tasks import TextClassification
25
+
26
+
27
+ logger = datasets.logging.get_logger(__name__)
28
+
29
+
30
+ _CITATION = """\
31
+ @dataset{osdg_2022_6393942,
32
+ author = {OSDG and
33
+ UNDP IICPSD SDG AI Lab and
34
+ PPMI},
35
+ title = {OSDG Community Dataset (OSDG-CD)},
36
+ month = apr,
37
+ year = 2022,
38
+ note = {{This CSV file uses UTF-8 character encoding. For
39
+ easy access on MS Excel, open the file using Data
40
+ → From Text/CSV. Please split CSV data into
41
+ different columns by using a TAB delimiter.}},
42
+ publisher = {Zenodo},
43
+ version = {2022.04},
44
+ doi = {10.5281/zenodo.6393942},
45
+ url = {https://doi.org/10.5281/zenodo.6393942}
46
+ }
47
+ """
48
+
49
+ _HOMEPAGE = "https://doi.org/10.5281/zenodo.6393942"
50
+
51
+ _LICENSE = "https://creativecommons.org/licenses/by/4.0/"
52
+
53
+ _DESCRIPTION = """\
54
+ The OSDG Community Dataset (OSDG-CD) is a public dataset of thousands of text excerpts, \
55
+ which were validated by approximately 1,000 OSDG Community Platform (OSDG-CP) \
56
+ citizen scientists from over 110 countries, with respect to the Sustainable Development Goals (SDGs).
57
+ """
58
+
59
+ _VERSIONS = {
60
+ "2021.09": "1.0.0",
61
+ "2022.01": "1.0.1",
62
+ "2022.04": "1.0.2",
63
+ }
64
+
65
+ _VERSION = _VERSIONS["2022.04"]
66
+
67
+ _URLS = {
68
+ # "train" :"https://zenodo.org/record/6393942/files/osdg-community-dataset-v2022-04-01.csv?download=1"
69
+ "train" :"https://zenodo.org/record/6393942/files/osdg-community-dataset-v2022-04-01.csv"
70
+ }
71
+
72
+
73
+ class OSDGCDConfig(datasets.BuilderConfig):
74
+ """BuilderConfig for OSDG-CD."""
75
+
76
+ def __init__(self, **kwargs):
77
+ """BuilderConfig for OSDG-CD.
78
+
79
+ Args:
80
+ **kwargs: keyword arguments forwarded to super.
81
+ """
82
+ super(OSDGCDConfig, self).__init__(**kwargs)
83
+
84
+
85
+ class OSDGCD(datasets.GeneratorBasedBuilder):
86
+ """OSDG-CD: The OSDG Community Dataset (OSDG-CD). Version 2022.04."""
87
+
88
+ # This is an example of a dataset with multiple configurations.
89
+ # If you don't want/need to define several sub-sets in your dataset,
90
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
91
+
92
+ # If you need to make complex sub-parts in the datasets with configurable options
93
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
94
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
95
+
96
+ # You will be able to load one or the other configurations in the following list with
97
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
98
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
99
+ BUILDER_CONFIGS = [
100
+ OSDGCDConfig(
101
+ name="main_config",
102
+ version=datasets.Version(_VERSION, ""),
103
+ description="Main configuration",
104
+ ),
105
+ ]
106
+
107
+ DEFAULT_CONFIG_NAME = "main_config"
108
+
109
+ def _info(self) -> datasets.DatasetInfo:
110
+ return datasets.DatasetInfo(
111
+ description=_DESCRIPTION,
112
+ license=_LICENSE,
113
+ features=datasets.Features(
114
+ {
115
+ "doi": datasets.Value("string"),
116
+ "text_id": datasets.Value("string"),
117
+ "text": datasets.Value("string"),
118
+ "sdg": datasets.Value("uint16"),
119
+ "label": datasets.ClassLabel(num_classes=17, names=[f"SDG {sdg}" for sdg in range(1, 18)]),
120
+ "labels_negative": datasets.Value("uint16"),
121
+ "labels_positive": datasets.Value("uint16"),
122
+ "agreement": datasets.Value("float"),
123
+ }
124
+ ),
125
+ homepage=_HOMEPAGE,
126
+ citation=_CITATION,
127
+ task_templates=[
128
+ TextClassification(
129
+ text_column="text", label_column="label",
130
+ )
131
+ ],
132
+ )
133
+
134
+ def _split_generators(self, dl_manager):
135
+ downloaded_files = dl_manager.download_and_extract(_URLS)
136
+
137
+ return [
138
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
139
+ ]
140
+
141
+ def _generate_examples(self, filepath):
142
+ """This function returns the examples in the raw (text) form."""
143
+ logger.info("generating examples from = %s", filepath)
144
+ key = 0
145
+ with open(filepath, encoding="utf-8") as f:
146
+ osdg = csv.DictReader(f, delimiter="\t")
147
+ for row in osdg:
148
+ row["label"] = int(row["sdg"]) - 1
149
+ yield key, row
150
+ key += 1