Sebastian Gehrmann commited on
Commit
b7fbd2a
1 Parent(s): 77a3b13
datacards/overview.py CHANGED
@@ -34,6 +34,16 @@ def overview_page():
34
  st.session_state.card_dict["overview"] = st.session_state.card_dict.get(
35
  "overview", {}
36
  )
 
 
 
 
 
 
 
 
 
 
37
  with st.expander("Where to find the data and its documentation", expanded=False):
38
  key_pref = ["overview", "where"]
39
  st.session_state.card_dict["overview"]["where"] = st.session_state.card_dict[
 
34
  st.session_state.card_dict["overview"] = st.session_state.card_dict.get(
35
  "overview", {}
36
  )
37
+ with st.expander("Where to find the data and its documentation", expanded=True):
38
+ key_pref = ["overview", "what"]
39
+ st.session_state.card_dict["overview"]["what"] = st.session_state.card_dict[
40
+ "overview"
41
+ ].get("what", {})
42
+ make_text_area(
43
+ label="Provide a summary of this dataset in 3-4 sentences.",
44
+ key_list=key_pref + ["dataset"],
45
+ help="[free text]",
46
+ )
47
  with st.expander("Where to find the data and its documentation", expanded=False):
48
  key_pref = ["overview", "where"]
49
  st.session_state.card_dict["overview"]["where"] = st.session_state.card_dict[
formatting/format_as_md.py CHANGED
@@ -1,6 +1,7 @@
1
  import argparse
2
  import json
3
  import pathlib
 
4
 
5
  parser = argparse.ArgumentParser(
6
  description="Format the output of the data card tool as .md for the hub."
@@ -72,6 +73,6 @@ def construct_md(data_card_data: dict, text_by_key: dict):
72
 
73
  if __name__ == "__main__":
74
  data_card_data = read_json_file(args.input_path)
75
- text_by_key = read_json_file("key_to_question.json")
76
  data_card_md_string = construct_md(data_card_data, text_by_key)
77
  save_md_file(args.output_path, data_card_md_string)
 
1
  import argparse
2
  import json
3
  import pathlib
4
+ import os
5
 
6
  parser = argparse.ArgumentParser(
7
  description="Format the output of the data card tool as .md for the hub."
 
73
 
74
  if __name__ == "__main__":
75
  data_card_data = read_json_file(args.input_path)
76
+ text_by_key = read_json_file(os.path.join(os.path.dirname(__file__), "key_to_question.json"))
77
  data_card_md_string = construct_md(data_card_data, text_by_key)
78
  save_md_file(args.output_path, data_card_md_string)
formatting/key_to_question.json CHANGED
@@ -1,189 +1,952 @@
1
  {
2
- "overview": {
3
- "section-title": "Dataset Overview",
4
- "where": {
5
- "section-title": "Where to find the data and its documentation",
6
- "website": "What is the webpage for the dataset (if it exists)?",
7
- "data-url": "What is the link to where the original dataset is hosted?",
8
- "paper-url": "What is the link to the paper describing the dataset (open access preferred)?",
9
- "paper-bibtext": "Provide the BibTex-formatted reference for the dataset. Please use the correct published version (ACL anthology, etc.) instead of google scholar created Bibtex.",
10
- "contact-name": "If known, provide the name of at least one person the reader can contact for questions about the dataset.",
11
- "contact-email": "If known, provide the email of at least one person the reader can contact for questions about the dataset.",
12
- "has-leaderboard": "Does the dataset have an active leaderboard?",
13
- "leaderboard-url": "Provide a link to the leaderboard.",
14
- "leaderboard-description": "Briefly describe how the leaderboard evaluates models."
15
- },
16
- "languages": {
17
- "section-title": "Languages and Intended Use",
18
- "is-multilingual": "Is the dataset multilingual?",
19
- "language-dialects": "What dialects are covered? Are there multiple dialects per language?",
20
- "language-names": "What languages/dialects are covered in the dataset?",
21
- "language-speakers": "Whose language is in the dataset?",
22
- "license": "What is the license of the dataset?",
23
- "task-other": "What is the primary task?",
24
- "intended-use": "What is the intended use of the dataset?",
25
- "license-other": "What is the 'other' license of the dataset?",
26
- "task": "What primary task does the dataset support?",
27
- "communicative": "Provide a short description of the communicative goal of a model trained for this task on this dataset."
28
- },
29
- "credit": {
30
- "section-title": "Credit",
31
- "organization-type": "In what kind of organization did the dataset curation happen?",
32
- "organization-names": "Name the organization(s).",
33
- "creators": "Who created the original dataset? List the people involved in collecting the dataset and their affiliation(s).",
34
- "funding": "Who funded the data creation?",
35
- "gem-added-by": "Who contributed to the data card and adding the dataset to GEM? List the people+affiliations involved in creating this data card and who helped integrate this dataset into GEM."
36
- },
37
- "structure": {
38
- "section-title": "Structure",
39
- "data-fields": "List and describe the fields present in the dataset.",
40
- "structure-description": "How was the dataset structure determined?",
41
- "structure-labels": "How were the labels chosen?",
42
- "structure-example": "Provide a JSON formatted example of a typical instance in the dataset.",
43
- "structure-splits": "Describe and name the splits in the dataset if there are more than one.",
44
- "structure-splits-criteria": "Describe any criteria for splitting the data, if used. If there are differences between the splits (e.g., if the training annotations are machine-generated and the dev and test ones are created by humans, or if different numbers of annotators contributed to each example), describe them here.",
45
- "structure-outlier": "What does an outlier of the dataset in terms of length/perplexity/embedding look like?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
  },
48
- "gem": {
49
- "section-title": "Dataset in GEM",
50
- "rationale": {
51
- "section-title": "Rationale",
52
- "contribution": "What does this dataset contribute toward better generation evaluation and why is it part of GEM?",
53
- "sole-task-dataset": "Do other datasets for the high level task exist?",
54
- "sole-language-task-dataset": "Does this dataset cover other languages than other datasets for the same task?",
55
- "distinction-description": "What else sets this dataset apart from other similar datasets in GEM?",
56
- "model-ability": "What aspect of model ability can be measured with this dataset?"
57
- },
58
- "curation": {
59
- "section-title": "GEM Additional Curation",
60
- "has-additional-curation": "Has the GEM version of the dataset been modified in any way (data, processing, splits) from the original curated data?",
61
- "modification-types": "What changes have been made to he original dataset?",
62
- "modification-description": "For each of these changes, described them in more details and provided the intended purpose of the modification",
63
- "has-additional-splits": "Does GEM provide additional splits to the dataset?",
64
- "additional-splits-description": "Describe how the new splits were created",
65
- "additional-splits-capacicites": "What aspects of the model's generation capacities were the splits created to test?"
66
- },
67
- "starting": {
68
- "section-title": "Getting Started",
69
- "research-pointers": "Getting started with in-depth research on the task. Add relevant pointers to resources that researchers can consult when they want to get started digging deeper into the task.",
70
- "technical-terms": "Technical terms used in this card and the dataset and their definitions"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  "results": {
74
  "section-title": "Previous Results",
75
- "results": {
76
- "section-title": "Previous Results",
77
- "model-abilities": "What aspect of model ability can be measured with this dataset?",
78
- "metrics": "What metrics are typically used for this task?",
79
- "other-metrics-definitions": "Definitions of other metrics",
80
- "original-evaluation": "List and describe the purpose of the metrics and evaluation methodology (including human evaluation) that the dataset creators used when introducing this task.",
81
- "has-previous-results": "Are previous results available?",
82
- "current-evaluation": "What evaluation approaches have others used?",
83
- "previous-results": "What are the most relevant previous results for this task/dataset?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
  },
86
- "curation": {
87
- "section-title": "Dataset Curation",
88
- "original": {
89
- "section-title": "Original Curation",
90
- "rationale": "Original curation rationale",
91
- "communicative": "What was the communicative goal?",
92
- "is-aggregated": "Is the dataset aggregated from different data sources?",
93
- "aggregated-sources": "List the sources (one per line)"
94
- },
95
- "language": {
96
- "section-title": "Language Data",
97
- "obtained": "How was the language data obtained?",
98
- "found": "If found, where from?",
99
- "crowdsourced": "If crowdsourced, where from?",
100
- "created": "If created for the dataset, describe the creation process.",
101
- "machine-generated": "If text was machine-generated for the dataset, provide a link to the generation method if available (N/A otherwise).",
102
- "producers-description": "What further information do we have on the language producers?",
103
- "topics": "Does the language in the dataset focus on specific topics? How would you describe them?",
104
- "validated": "Was the text validated by a different worker or a data curator?",
105
- "pre-processed": "How was the text data pre-processed? (Enter N/A if the text was not pre-processed)",
106
- "is-filtered": "Were text instances selected or filtered?",
107
- "filtered-criteria": "What were the selection criteria?"
108
- },
109
- "annotations": {
110
- "section-title": "Structured Annotations",
111
- "origin": "Does the dataset have additional annotations for each instance?",
112
- "rater-number": "What is the number of raters",
113
- "rater-qualifications": "Describe the qualifications required of an annotator.",
114
- "rater-training-num": "How many annotators saw each training example?",
115
- "rater-test-num": "How many annotators saw each test example?",
116
- "rater-annotation-service-bool": "Was an annotation service used?",
117
- "rater-annotation-service": "Which annotation services were used?",
118
- "values": "Purpose and values for each annoation",
119
- "quality-control": "Quality control measures?",
120
- "quality-control-details": "Describe the quality control measures that were taken."
121
- },
122
- "consent": {
123
- "section-title": "Consent",
124
- "has-consent": "Was there a consent policy involved when gathering the data?",
125
- "consent-policy": "What was the consent policy?",
126
- "consent-other": "What other downstream uses of the data did the original data creators and the data curators consent to?",
127
- "no-consent-justification": "If not, what is the justification for reusing the data?"
128
- },
129
- "pii": {
130
- "section-title": "Private Identifying Information (PII)",
131
- "has-pii": "Does the source language data likely contain Personal Identifying Information about the data creators or subjects?",
132
- "no-pii-justification": "Provide a justification for selecting `no PII` above.",
133
- "pii-categories": "What categories of PII are present or suspected in the data?",
134
- "is-pii-identified": "Did the curators use any automatic/manual method to identify PII in the dataset?",
135
- "pii-identified-method": "Describe the method used to identify PII in the dataset.",
136
- "is-pii-replaced": "Was the PII pseudonymized/handled somehow?",
137
- "pii-replaced-method": "Describe the methods that were used to process the PII."
138
- },
139
- "maintenance": {
140
- "section-title": "Maintenance",
141
- "has-maintenance": "Does the original dataset have a maintenance plan?",
142
- "description": "Describe the original dataset's maintenance plan.",
143
- "contact": "Provide contact information of a person responsible for the dataset maintenance",
144
- "contestation-mechanism": "Does the maintenance plan include a contestation mechanism allowing individuals to request removal fo content?",
145
- "contestation-description": "Describe the contestation mechanism",
146
- "contestation-link": "Provide the form link or contact information"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
  },
149
- "context": {
150
- "section-title": "Broader Social Context",
151
- "previous": {
152
- "section-title": "Previous Work on the Social Impact of the Dataset",
153
- "is-deployed": "Are you aware of cases where models trained on the task featured in this dataset ore related tasks have been used in automated systems?",
154
- "described-risks": "Did any of these previous uses result in observations about the social impact of the systems? In particular, has there been work outlining the risks and limitations of the system? Provide links and descriptions here.",
155
- "changes-from-observation": "Have any changes been made to the dataset as a result of these observations?"
156
- },
157
- "underserved": {
158
- "section-title": "Impact on Under-Served Communities",
159
- "helps-underserved": "Does this dataset address the needs of communities that are traditionally underserved in language technology, and particularly language generation technology? Communities may be underserved for exemple because their language, language variety, or social or geographical context is underepresented in NLP and NLG resources (datasets and models).",
160
- "underserved-description": "Describe how this dataset addresses the needs of underserved communities."
161
- },
162
- "biases": {
163
- "section-title": "Discussion of Biases",
164
- "has-biases": "Are there documented social biases in the dataset? Biases in this context are variations in the ways members of different social categories are represented that can have harmful downstream consequences for members of the more disadvantaged group.",
165
- "bias-analyses": "Provide links to and summaries of works analyzing these biases.",
166
- "speaker-distibution": "Does the distribution of language producers in the dataset accurately represent the full distribution of speakers of the language world-wide? If not, how does it differ?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
  },
169
- "considerations": {
170
- "section-title": "Considerations for Using the Data",
171
- "pii": {
172
- "section-title": "PII Risks and Liability",
173
- "risks-description": "Considering your answers to the PII part of the Data Curation Section, describe any potential privacy to the data subjects and creators risks when using the dataset."
174
- },
175
- "licenses": {
176
- "section-title": "Licenses",
177
- "dataset-restrictions": "Based on your answers in the Intended Use part of the Data Overview Section, which of the following best describe the copyright and licensing status of the dataset?",
178
- "dataset-restrictions-other": "You selected `other` for the dataset licensing status, please elaborate here:",
179
- "data-copyright": "Based on your answers in the Language part of the Data Curation Section, which of the following best describe the copyright and licensing status of the underlying language data?",
180
- "data-copyright-other": "You selected `other` for the source data licensing status, please elaborate here:"
181
- },
182
- "limitations": {
183
- "section-title": "Known Technical Limitations",
184
- "data-technical-limitations": "Describe any known technical limitations, such as spurrious correlations, train/test overlap, annotation biases, or mis-annotations, and cite the works that first identified these limitations when possible.",
185
- "data-unsuited-applications": "When using a model trained on this dataset in a setting where users or the public may interact with its predictions, what are some pitfalls to look out for? In particular, describe some applications of the general task featured in this dataset that its curation or properties make it less suitable for.",
186
- "data-discouraged-use": "What are some discouraged use cases of a model trained to maximize the proposed metrics on this dataset? In particular, think about settings where decisions made by a model that performs reasonably well on the metric my still have strong negative consequences for user or members of the public."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  }
188
  }
189
- }
 
 
1
  {
2
+ "overview": {
3
+ "section-title": "Dataset Overview",
4
+ "where": {
5
+ "section-title": "Where to find the Data and its Documentation",
6
+ "website": {
7
+ "title": "Webpage",
8
+ "info": "What is the webpage for the dataset (if it exists)?",
9
+ "flags": [
10
+ "quick"
11
+ ],
12
+ "scope": "telescope"
13
+ },
14
+ "data-url": {
15
+ "title": "Download",
16
+ "info": "What is the link to where the original dataset is hosted?",
17
+ "flags": [
18
+ ""
19
+ ],
20
+ "scope": "telescope"
21
+ },
22
+ "paper-url": {
23
+ "title": "Paper",
24
+ "info": "What is the link to the paper describing the dataset (open access preferred)?",
25
+ "flags": [
26
+ ""
27
+ ],
28
+ "scope": "telescope"
29
+ },
30
+ "paper-bibtext": {
31
+ "title": "BibTex",
32
+ "info": "Provide the BibTex-formatted reference for the dataset. Please use the correct published version (ACL anthology, etc.) instead of google scholar created Bibtex.",
33
+ "flags": [
34
+ ""
35
+ ],
36
+ "scope": "periscope"
37
+ },
38
+ "contact-name": {
39
+ "title": "Contact Name",
40
+ "info": "If known, provide the name of at least one person the reader can contact for questions about the dataset.",
41
+ "flags": [
42
+ "quick"
43
+ ],
44
+ "scope": "periscope"
45
+ },
46
+ "contact-email": {
47
+ "title": "Contact Email",
48
+ "info": "If known, provide the email of at least one person the reader can contact for questions about the dataset.",
49
+ "flags": [
50
+ ""
51
+ ],
52
+ "scope": "periscope"
53
+ },
54
+ "has-leaderboard": {
55
+ "title": "Has a Leaderboard?",
56
+ "info": "Does the dataset have an active leaderboard?",
57
+ "flags": [
58
+ ""
59
+ ],
60
+ "scope": "telescope"
61
+ },
62
+ "leaderboard-url": {
63
+ "title": "Leaderboard Link",
64
+ "info": "Provide a link to the leaderboard.",
65
+ "flags": [
66
+ ""
67
+ ],
68
+ "scope": "periscope"
69
+ },
70
+ "leaderboard-description": {
71
+ "title": "Leaderboard Details",
72
+ "info": "Briefly describe how the leaderboard evaluates models.",
73
+ "flags": [
74
+ ""
75
+ ],
76
+ "scope": "microscope"
77
  }
78
  },
79
+ "languages": {
80
+ "section-title": "Languages and Intended Use",
81
+ "is-multilingual": {
82
+ "title": "Multilingual?",
83
+ "info": "Is the dataset multilingual?",
84
+ "flags": [
85
+ "quick"
86
+ ],
87
+ "scope": "telescope"
88
+ },
89
+ "language-dialects": {
90
+ "title": "Covered Dialects",
91
+ "info": "What dialects are covered? Are there multiple dialects per language?",
92
+ "flags": [
93
+ ""
94
+ ],
95
+ "scope": "periscope"
96
+ },
97
+ "language-names": {
98
+ "title": "Covered Languages",
99
+ "info": "What languages/dialects are covered in the dataset?",
100
+ "flags": [
101
+ "quick"
102
+ ],
103
+ "scope": "telescope"
104
+ },
105
+ "language-speakers": {
106
+ "title": "Whose Language?",
107
+ "info": "Whose language is in the dataset?",
108
+ "flags": [
109
+ ""
110
+ ],
111
+ "scope": "periscope"
112
+ },
113
+ "license": {
114
+ "title": "License",
115
+ "info": "What is the license of the dataset?",
116
+ "flags": [
117
+ "quick"
118
+ ],
119
+ "scope": "telescope"
120
+ },
121
+ "task-other": {
122
+ "title": "Primary Task",
123
+ "info": "What is the primary task?",
124
+ "flags": [
125
+ "quick"
126
+ ],
127
+ "scope": "periscope"
128
+ },
129
+ "intended-use": {
130
+ "title": "Intended Use",
131
+ "info": "What is the intended use of the dataset?",
132
+ "flags": [
133
+ ""
134
+ ],
135
+ "scope": "microscope"
136
+ },
137
+ "license-other": {
138
+ "title": "Add. License Info",
139
+ "info": "What is the 'other' license of the dataset?",
140
+ "flags": [
141
+ ""
142
+ ],
143
+ "scope": "periscope"
144
+ },
145
+ "task": {
146
+ "title": "Primary Task",
147
+ "info": "What primary task does the dataset support?",
148
+ "flags": [
149
+ ""
150
+ ],
151
+ "scope": "telescope"
152
+ },
153
+ "communicative": {
154
+ "title": "Communicative Goal",
155
+ "info": "Provide a short description of the communicative goal of a model trained for this task on this dataset.",
156
+ "flags": [
157
+ "quick"
158
+ ],
159
+ "scope": "periscope"
160
+ }
161
+ },
162
+ "credit": {
163
+ "section-title": "Credit",
164
+ "organization-type": {
165
+ "title": "Curation Organization Type(s)",
166
+ "info": "In what kind of organization did the dataset curation happen?",
167
+ "flags": [
168
+ ""
169
+ ],
170
+ "scope": "telescope"
171
+ },
172
+ "organization-names": {
173
+ "title": "Curation Organization(s)",
174
+ "info": "Name the organization(s).",
175
+ "flags": [
176
+ ""
177
+ ],
178
+ "scope": "periscope"
179
+ },
180
+ "creators": {
181
+ "title": "Dataset Creators",
182
+ "info": "Who created the original dataset? List the people involved in collecting the dataset and their affiliation(s).",
183
+ "flags": [
184
+ ""
185
+ ],
186
+ "scope": "microscope"
187
+ },
188
+ "funding": {
189
+ "title": "Funding",
190
+ "info": "Who funded the data creation?",
191
+ "flags": [
192
+ ""
193
+ ],
194
+ "scope": "microscope"
195
+ },
196
+ "gem-added-by": {
197
+ "title": "Who added the Dataset to GEM?",
198
+ "info": "Who contributed to the data card and adding the dataset to GEM? List the people+affiliations involved in creating this data card and who helped integrate this dataset into GEM.",
199
+ "flags": [
200
+ ""
201
+ ],
202
+ "scope": "microscope"
203
  }
204
  },
205
+ "structure": {
206
+ "section-title": "Dataset Structure",
207
+ "data-fields": {
208
+ "title": "Data Fields",
209
+ "info": "List and describe the fields present in the dataset.",
210
+ "flags": [
211
+ ""
212
+ ],
213
+ "scope": "telescope"
214
+ },
215
+ "structure-description": {
216
+ "title": "Reason for Structure",
217
+ "info": "How was the dataset structure determined?",
218
+ "flags": [
219
+ "quick"
220
+ ],
221
+ "scope": "microscope"
222
+ },
223
+ "structure-labels": {
224
+ "title": "How were labels chosen?",
225
+ "info": "How were the labels chosen?",
226
+ "flags": [
227
+ ""
228
+ ],
229
+ "scope": "microscope"
230
+ },
231
+ "structure-example": {
232
+ "title": "Example Instance",
233
+ "info": "Provide a JSON formatted example of a typical instance in the dataset.",
234
+ "flags": [
235
+ ""
236
+ ],
237
+ "scope": "periscope"
238
+ },
239
+ "structure-splits": {
240
+ "title": "Data Splits",
241
+ "info": "Describe and name the splits in the dataset if there are more than one.",
242
+ "flags": [
243
+ ""
244
+ ],
245
+ "scope": "periscope"
246
+ },
247
+ "structure-splits-criteria": {
248
+ "title": "Splitting Criteria",
249
+ "info": "Describe any criteria for splitting the data, if used. If there are differences between the splits (e.g., if the training annotations are machine-generated and the dev and test ones are created by humans, or if different numbers of annotators contributed to each example), describe them here.",
250
+ "flags": [
251
+ ""
252
+ ],
253
+ "scope": "microscope"
254
+ },
255
+ "structure-outlier": {
256
+ "title": "",
257
+ "info": "What does an outlier of the dataset in terms of length/perplexity/embedding look like?",
258
+ "flags": [
259
+ ""
260
+ ],
261
+ "scope": "microscope"
262
+ }
263
+ }
264
+ },
265
+ "gem": {
266
+ "section-title": "Dataset in GEM",
267
+ "rationale": {
268
+ "section-title": "Rationale for Inclusion in GEM",
269
+ "contribution": {
270
+ "title": "Why is the Dataset in GEM?",
271
+ "info": "What does this dataset contribute toward better generation evaluation and why is it part of GEM?",
272
+ "flags": [
273
+ ""
274
+ ],
275
+ "scope": "microscope"
276
+ },
277
+ "sole-task-dataset": {
278
+ "title": "Similar Datasets",
279
+ "info": "Do other datasets for the high level task exist?",
280
+ "flags": [
281
+ ""
282
+ ],
283
+ "scope": "telescope"
284
+ },
285
+ "sole-language-task-dataset": {
286
+ "title": "Unique Language Coverage",
287
+ "info": "Does this dataset cover other languages than other datasets for the same task?",
288
+ "flags": [
289
+ ""
290
+ ],
291
+ "scope": "periscope"
292
+ },
293
+ "distinction-description": {
294
+ "title": "Difference from other GEM datasets",
295
+ "info": "What else sets this dataset apart from other similar datasets in GEM?",
296
+ "flags": [
297
+ ""
298
+ ],
299
+ "scope": "microscope"
300
+ },
301
+ "model-ability": {
302
+ "title": "Ability that the Dataset measures",
303
+ "info": "What aspect of model ability can be measured with this dataset?",
304
+ "flags": [
305
+ ""
306
+ ],
307
+ "scope": "periscope"
308
+ }
309
+ },
310
+ "curation": {
311
+ "section-title": "GEM-Specific Curation",
312
+ "has-additional-curation": {
313
+ "title": "Modificatied for GEM?",
314
+ "info": "Has the GEM version of the dataset been modified in any way (data, processing, splits) from the original curated data?",
315
+ "flags": [
316
+ ""
317
+ ],
318
+ "scope": "telescope"
319
+ },
320
+ "modification-types": {
321
+ "title": "GEM Modifications",
322
+ "info": "What changes have been made to he original dataset?",
323
+ "flags": [
324
+ ""
325
+ ],
326
+ "scope": "periscope"
327
+ },
328
+ "modification-description": {
329
+ "title": "Modification Details",
330
+ "info": "For each of these changes, described them in more details and provided the intended purpose of the modification",
331
+ "flags": [
332
+ ""
333
+ ],
334
+ "scope": "microscope"
335
+ },
336
+ "has-additional-splits": {
337
+ "title": "Additional Splits?",
338
+ "info": "Does GEM provide additional splits to the dataset?",
339
+ "flags": [
340
+ ""
341
+ ],
342
+ "scope": "telescope"
343
+ },
344
+ "additional-splits-description": {
345
+ "title": "Split Information",
346
+ "info": "Describe how the new splits were created",
347
+ "flags": [
348
+ ""
349
+ ],
350
+ "scope": "periscope"
351
+ },
352
+ "additional-splits-capacicites": {
353
+ "title": "Split Motivation",
354
+ "info": "What aspects of the model's generation capacities were the splits created to test?",
355
+ "flags": [
356
+ ""
357
+ ],
358
+ "scope": "periscope"
359
+ }
360
+ },
361
+ "starting": {
362
+ "section-title": "Getting Started with the Task",
363
+ "research-pointers": {
364
+ "title": "Pointers to Resources",
365
+ "info": "Getting started with in-depth research on the task. Add relevant pointers to resources that researchers can consult when they want to get started digging deeper into the task.",
366
+ "flags": [
367
+ ""
368
+ ],
369
+ "scope": "microscope"
370
+ },
371
+ "technical-terms": {
372
+ "title": "Technical Terms",
373
+ "info": "Technical terms used in this card and the dataset and their definitions",
374
+ "flags": [
375
+ ""
376
+ ],
377
+ "scope": "microscope"
378
+ }
379
+ }
380
+ },
381
+ "results": {
382
+ "section-title": "Previous Results",
383
  "results": {
384
  "section-title": "Previous Results",
385
+ "model-abilities": {
386
+ "title": "Measured Model Abilities",
387
+ "info": "What aspect of model ability can be measured with this dataset?",
388
+ "flags": [
389
+ ""
390
+ ],
391
+ "scope": "telescope"
392
+ },
393
+ "metrics": {
394
+ "title": "Metrics",
395
+ "info": "What metrics are typically used for this task?",
396
+ "flags": [
397
+ ""
398
+ ],
399
+ "scope": "periscope"
400
+ },
401
+ "other-metrics-definitions": {
402
+ "title": "Other Metrics",
403
+ "info": "Definitions of other metrics",
404
+ "flags": [
405
+ ""
406
+ ],
407
+ "scope": "microscope"
408
+ },
409
+ "original-evaluation": {
410
+ "title": "Proposed Evaluation",
411
+ "info": "List and describe the purpose of the metrics and evaluation methodology (including human evaluation) that the dataset creators used when introducing this task.",
412
+ "flags": [
413
+ ""
414
+ ],
415
+ "scope": "microscope"
416
+ },
417
+ "has-previous-results": {
418
+ "title": "Previous results available?",
419
+ "info": "Are previous results available?",
420
+ "flags": [
421
+ ""
422
+ ],
423
+ "scope": "telescope"
424
+ },
425
+ "current-evaluation": {
426
+ "title": "Other Evaluation Approaches",
427
+ "info": "What evaluation approaches have others used?",
428
+ "flags": [
429
+ ""
430
+ ],
431
+ "scope": "periscope"
432
+ },
433
+ "previous-results": {
434
+ "title": "Relevant Previous Results",
435
+ "info": "What are the most relevant previous results for this task/dataset?",
436
+ "flags": [
437
+ ""
438
+ ],
439
+ "scope": "microscope"
440
+ }
441
+ }
442
+ },
443
+ "curation": {
444
+ "section-title": "Dataset Curation",
445
+ "original": {
446
+ "section-title": "Original Curation",
447
+ "rationale": {
448
+ "title": "Original Curation Rationale",
449
+ "info": "Original curation rationale",
450
+ "flags": [
451
+ ""
452
+ ],
453
+ "scope": "telescope"
454
+ },
455
+ "communicative": {
456
+ "title": "Communicative Goal",
457
+ "info": "What was the communicative goal?",
458
+ "flags": [
459
+ ""
460
+ ],
461
+ "scope": "periscope"
462
+ },
463
+ "is-aggregated": {
464
+ "title": "Sourced from Different Sources",
465
+ "info": "Is the dataset aggregated from different data sources?",
466
+ "flags": [
467
+ ""
468
+ ],
469
+ "scope": "telescope"
470
+ },
471
+ "aggregated-sources": {
472
+ "title": "Source Details",
473
+ "info": "List the sources (one per line)",
474
+ "flags": [
475
+ ""
476
+ ],
477
+ "scope": "periscope"
478
  }
479
  },
480
+ "language": {
481
+ "section-title": "Language Data",
482
+ "obtained": {
483
+ "title": "How was Language Data Obtained?",
484
+ "info": "How was the language data obtained?",
485
+ "flags": [
486
+ ""
487
+ ],
488
+ "scope": "telescope"
489
+ },
490
+ "found": {
491
+ "title": "Where was it found?",
492
+ "info": "If found, where from?",
493
+ "flags": [
494
+ ""
495
+ ],
496
+ "scope": "periscope"
497
+ },
498
+ "crowdsourced": {
499
+ "title": "Where was it crowdsourced?",
500
+ "info": "If crowdsourced, where from?",
501
+ "flags": [
502
+ ""
503
+ ],
504
+ "scope": "periscope"
505
+ },
506
+ "created": {
507
+ "title": "Creation Process",
508
+ "info": "If created for the dataset, describe the creation process.",
509
+ "flags": [
510
+ ""
511
+ ],
512
+ "scope": "microscope"
513
+ },
514
+ "machine-generated": {
515
+ "title": "Generation Method Link",
516
+ "info": "If text was machine-generated for the dataset, provide a link to the generation method if available (N/A otherwise).",
517
+ "flags": [
518
+ ""
519
+ ],
520
+ "scope": "periscope"
521
+ },
522
+ "producers-description": {
523
+ "title": "Language Producers",
524
+ "info": "What further information do we have on the language producers?",
525
+ "flags": [
526
+ ""
527
+ ],
528
+ "scope": "microscope"
529
+ },
530
+ "topics": {
531
+ "title": "Topics Covered",
532
+ "info": "Does the language in the dataset focus on specific topics? How would you describe them?",
533
+ "flags": [
534
+ ""
535
+ ],
536
+ "scope": "periscope"
537
+ },
538
+ "validated": {
539
+ "title": "Data Validation",
540
+ "info": "Was the text validated by a different worker or a data curator?",
541
+ "flags": [
542
+ ""
543
+ ],
544
+ "scope": "telescope"
545
+ },
546
+ "pre-processed": {
547
+ "title": "Data Preprocessing",
548
+ "info": "How was the text data pre-processed? (Enter N/A if the text was not pre-processed)",
549
+ "flags": [
550
+ ""
551
+ ],
552
+ "scope": "periscope"
553
+ },
554
+ "is-filtered": {
555
+ "title": "Was Data Filtered?",
556
+ "info": "Were text instances selected or filtered?",
557
+ "flags": [
558
+ ""
559
+ ],
560
+ "scope": "telescope"
561
+ },
562
+ "filtered-criteria": {
563
+ "title": "Filter Criteria",
564
+ "info": "What were the selection criteria?",
565
+ "flags": [
566
+ ""
567
+ ],
568
+ "scope": "periscope"
569
+ }
570
+ },
571
+ "annotations": {
572
+ "section-title": "Structured Annotations",
573
+ "origin": {
574
+ "title": "Additional Annotations?",
575
+ "info": "Does the dataset have additional annotations for each instance?",
576
+ "flags": [
577
+ "quick"
578
+ ],
579
+ "scope": "telescope"
580
+ },
581
+ "rater-number": {
582
+ "title": "Number of Raters",
583
+ "info": "What is the number of raters",
584
+ "flags": [
585
+ ""
586
+ ],
587
+ "scope": "telescope"
588
+ },
589
+ "rater-qualifications": {
590
+ "title": "Rater Qualifications",
591
+ "info": "Describe the qualifications required of an annotator.",
592
+ "flags": [
593
+ ""
594
+ ],
595
+ "scope": "periscope"
596
+ },
597
+ "rater-training-num": {
598
+ "title": "Raters per Training Example",
599
+ "info": "How many annotators saw each training example?",
600
+ "flags": [
601
+ ""
602
+ ],
603
+ "scope": "periscope"
604
+ },
605
+ "rater-test-num": {
606
+ "title": "Raters per Test Example",
607
+ "info": "How many annotators saw each test example?",
608
+ "flags": [
609
+ ""
610
+ ],
611
+ "scope": "periscope"
612
+ },
613
+ "rater-annotation-service-bool": {
614
+ "title": "Annotation Service?",
615
+ "info": "Was an annotation service used?",
616
+ "flags": [
617
+ ""
618
+ ],
619
+ "scope": "telescope"
620
+ },
621
+ "rater-annotation-service": {
622
+ "title": "Which Annotation Service",
623
+ "info": "Which annotation services were used?",
624
+ "flags": [
625
+ ""
626
+ ],
627
+ "scope": "periscope"
628
+ },
629
+ "values": {
630
+ "title": "Annotation Values",
631
+ "info": "Purpose and values for each annotation",
632
+ "flags": [
633
+ ""
634
+ ],
635
+ "scope": "microscope"
636
+ },
637
+ "quality-control": {
638
+ "title": "Any Quality Control?",
639
+ "info": "Quality control measures?",
640
+ "flags": [
641
+ ""
642
+ ],
643
+ "scope": "telescope"
644
+ },
645
+ "quality-control-details": {
646
+ "title": "Quality Control Details",
647
+ "info": "Describe the quality control measures that were taken.",
648
+ "flags": [
649
+ ""
650
+ ],
651
+ "scope": "microscope"
652
+ }
653
+ },
654
+ "consent": {
655
+ "section-title": "Consent",
656
+ "has-consent": {
657
+ "title": "Any Consent Policy?",
658
+ "info": "Was there a consent policy involved when gathering the data?",
659
+ "flags": [
660
+ ""
661
+ ],
662
+ "scope": "telescope"
663
+ },
664
+ "consent-policy": {
665
+ "title": "Consent Policy Details",
666
+ "info": "What was the consent policy?",
667
+ "flags": [
668
+ ""
669
+ ],
670
+ "scope": "microscope"
671
+ },
672
+ "consent-other": {
673
+ "title": "Other Consented Downstream Use",
674
+ "info": "What other downstream uses of the data did the original data creators and the data curators consent to?",
675
+ "flags": [
676
+ ""
677
+ ],
678
+ "scope": "microscope"
679
+ },
680
+ "no-consent-justification": {
681
+ "title": "Justification for Using the Data",
682
+ "info": "If not, what is the justification for reusing the data?",
683
+ "flags": [
684
+ ""
685
+ ],
686
+ "scope": "microscope"
687
+ }
688
+ },
689
+ "pii": {
690
+ "section-title": "Private Identifying Information (PII)",
691
+ "has-pii": {
692
+ "title": "Contains PII?",
693
+ "info": "Does the source language data likely contain Personal Identifying Information about the data creators or subjects?",
694
+ "flags": [
695
+ "quick"
696
+ ],
697
+ "scope": "telescope"
698
+ },
699
+ "no-pii-justification": {
700
+ "title": "Justification for no PII",
701
+ "info": "Provide a justification for selecting `no PII` above.",
702
+ "flags": [
703
+ ""
704
+ ],
705
+ "scope": "periscope"
706
+ },
707
+ "pii-categories": {
708
+ "title": "Categories of PII",
709
+ "info": "What categories of PII are present or suspected in the data?",
710
+ "flags": [
711
+ ""
712
+ ],
713
+ "scope": "periscope"
714
+ },
715
+ "is-pii-identified": {
716
+ "title": "Any PII Identification?",
717
+ "info": "Did the curators use any automatic/manual method to identify PII in the dataset?",
718
+ "flags": [
719
+ ""
720
+ ],
721
+ "scope": "periscope"
722
+ },
723
+ "pii-identified-method": {
724
+ "title": "PII Identification Details",
725
+ "info": "Describe the method used to identify PII in the dataset.",
726
+ "flags": [
727
+ ""
728
+ ],
729
+ "scope": "microscope"
730
+ },
731
+ "is-pii-replaced": {
732
+ "title": "Any Anonymization?",
733
+ "info": "Was the PII pseudonymized/handled somehow?",
734
+ "flags": [
735
+ ""
736
+ ],
737
+ "scope": "periscope"
738
+ },
739
+ "pii-replaced-method": {
740
+ "title": "Anonymization Details",
741
+ "info": "Describe the methods that were used to process the PII.",
742
+ "flags": [
743
+ ""
744
+ ],
745
+ "scope": "microscope"
746
+ }
747
+ },
748
+ "maintenance": {
749
+ "section-title": "Maintenance",
750
+ "has-maintenance": {
751
+ "title": "Any Maintenance Plan?",
752
+ "info": "Does the original dataset have a maintenance plan?",
753
+ "flags": [
754
+ ""
755
+ ],
756
+ "scope": "telescope"
757
+ },
758
+ "description": {
759
+ "title": "Maintenance Plan Details",
760
+ "info": "Describe the original dataset's maintenance plan.",
761
+ "flags": [
762
+ ""
763
+ ],
764
+ "scope": "microscope"
765
+ },
766
+ "contact": {
767
+ "title": "Maintainer Contact Information",
768
+ "info": "Provide contact information of a person responsible for the dataset maintenance",
769
+ "flags": [
770
+ ""
771
+ ],
772
+ "scope": "periscope"
773
+ },
774
+ "contestation-mechanism": {
775
+ "title": "Any Contestation Mechanism?",
776
+ "info": "Does the maintenance plan include a contestation mechanism allowing individuals to request removal fo content?",
777
+ "flags": [
778
+ ""
779
+ ],
780
+ "scope": "periscope"
781
+ },
782
+ "contestation-description": {
783
+ "title": "Contestation Mechanism Details",
784
+ "info": "Describe the contestation mechanism",
785
+ "flags": [
786
+ ""
787
+ ],
788
+ "scope": "microscope"
789
+ },
790
+ "contestation-link": {
791
+ "title": "Contestation Form Link",
792
+ "info": "Provide the form link or contact information",
793
+ "flags": [
794
+ ""
795
+ ],
796
+ "scope": "periscope"
797
+ }
798
+ }
799
+ },
800
+ "context": {
801
+ "section-title": "Broader Social Context",
802
+ "previous": {
803
+ "section-title": "Previous Work on the Social Impact of the Dataset",
804
+ "is-deployed": {
805
+ "title": "Usage of Models based on the Data",
806
+ "info": "Are you aware of cases where models trained on the task featured in this dataset ore related tasks have been used in automated systems?",
807
+ "flags": [
808
+ ""
809
+ ],
810
+ "scope": "telescope"
811
+ },
812
+ "described-risks": {
813
+ "title": "Social Impact Observations",
814
+ "info": "Did any of these previous uses result in observations about the social impact of the systems? In particular, has there been work outlining the risks and limitations of the system? Provide links and descriptions here.",
815
+ "flags": [
816
+ ""
817
+ ],
818
+ "scope": "microscope"
819
+ },
820
+ "changes-from-observation": {
821
+ "title": "Changes as Consequence of Social Impact",
822
+ "info": "Have any changes been made to the dataset as a result of these observations?",
823
+ "flags": [
824
+ ""
825
+ ],
826
+ "scope": "periscope"
827
+ }
828
+ },
829
+ "underserved": {
830
+ "section-title": "Impact on Under-Served Communities",
831
+ "helps-underserved": {
832
+ "title": "Addresses needs of underserved Communities?",
833
+ "info": "Does this dataset address the needs of communities that are traditionally underserved in language technology, and particularly language generation technology? Communities may be underserved for exemple because their language, language variety, or social or geographical context is underepresented in NLP and NLG resources (datasets and models).",
834
+ "flags": [
835
+ ""
836
+ ],
837
+ "scope": "telescope"
838
+ },
839
+ "underserved-description": {
840
+ "title": "Details on how Dataset Addresses the Needs",
841
+ "info": "Describe how this dataset addresses the needs of underserved communities.",
842
+ "flags": [
843
+ ""
844
+ ],
845
+ "scope": "microscope"
846
  }
847
  },
848
+ "biases": {
849
+ "section-title": "Discussion of Biases",
850
+ "has-biases": {
851
+ "title": "Any Documented Social Biases?",
852
+ "info": "Are there documented social biases in the dataset? Biases in this context are variations in the ways members of different social categories are represented that can have harmful downstream consequences for members of the more disadvantaged group.",
853
+ "flags": [
854
+ ""
855
+ ],
856
+ "scope": "telescope"
857
+ },
858
+ "bias-analyses": {
859
+ "title": "Links and Summaries of Analysis Work",
860
+ "info": "Provide links to and summaries of works analyzing these biases.",
861
+ "flags": [
862
+ ""
863
+ ],
864
+ "scope": "microscope"
865
+ },
866
+ "speaker-distibution": {
867
+ "title": "Are the Language Producers Representative of the Language?",
868
+ "info": "Does the distribution of language producers in the dataset accurately represent the full distribution of speakers of the language world-wide? If not, how does it differ?",
869
+ "flags": [
870
+ ""
871
+ ],
872
+ "scope": "periscope"
873
+ }
874
+ }
875
+ },
876
+ "considerations": {
877
+ "section-title": "Considerations for Using the Data",
878
+ "pii": {
879
+ "section-title": "PII Risks and Liability",
880
+ "risks-description": {
881
+ "title": "Potential PII Risk",
882
+ "info": "Considering your answers to the PII part of the Data Curation Section, describe any potential privacy to the data subjects and creators risks when using the dataset.",
883
+ "flags": [
884
+ ""
885
+ ],
886
+ "scope": "microscope"
887
  }
888
  },
889
+ "licenses": {
890
+ "section-title": "Licenses",
891
+ "dataset-restrictions": {
892
+ "title": "Copyright Restrictions on the Dataset",
893
+ "info": "Based on your answers in the Intended Use part of the Data Overview Section, which of the following best describe the copyright and licensing status of the dataset?",
894
+ "flags": [
895
+ ""
896
+ ],
897
+ "scope": "periscope"
898
+ },
899
+ "dataset-restrictions-other": {
900
+ "title": "Copyright Restriction - Elaboration",
901
+ "info": "You selected `other` for the dataset licensing status, please elaborate here:",
902
+ "flags": [
903
+ ""
904
+ ],
905
+ "scope": "microscope"
906
+ },
907
+ "data-copyright": {
908
+ "title": "Copyright Restrictions on the Language Data",
909
+ "info": "Based on your answers in the Language part of the Data Curation Section, which of the following best describe the copyright and licensing status of the underlying language data?",
910
+ "flags": [
911
+ ""
912
+ ],
913
+ "scope": "periscope"
914
+ },
915
+ "data-copyright-other": {
916
+ "title": "Source Data Copyright Restriction - Elaboration",
917
+ "info": "You selected `other` for the source data licensing status, please elaborate here:",
918
+ "flags": [
919
+ ""
920
+ ],
921
+ "scope": "microscope"
922
+ }
923
+ },
924
+ "limitations": {
925
+ "section-title": "Known Technical Limitations",
926
+ "data-technical-limitations": {
927
+ "title": "Technical Limitations",
928
+ "info": "Describe any known technical limitations, such as spurrious correlations, train/test overlap, annotation biases, or mis-annotations, and cite the works that first identified these limitations when possible.",
929
+ "flags": [
930
+ ""
931
+ ],
932
+ "scope": "microscope"
933
+ },
934
+ "data-unsuited-applications": {
935
+ "title": "Unsuited Applications",
936
+ "info": "When using a model trained on this dataset in a setting where users or the public may interact with its predictions, what are some pitfalls to look out for? In particular, describe some applications of the general task featured in this dataset that its curation or properties make it less suitable for.",
937
+ "flags": [
938
+ ""
939
+ ],
940
+ "scope": "microscope"
941
+ },
942
+ "data-discouraged-use": {
943
+ "title": "Discouraged Use Cases",
944
+ "info": "What are some discouraged use cases of a model trained to maximize the proposed metrics on this dataset? In particular, think about settings where decisions made by a model that performs reasonably well on the metric my still have strong negative consequences for user or members of the public.",
945
+ "flags": [
946
+ ""
947
+ ],
948
+ "scope": "microscope"
949
  }
950
  }
951
+ }
952
+ }
formatting/reformat_json.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import json
3
+ import pathlib
4
+ import os
5
+
6
+ parser = argparse.ArgumentParser(
7
+ description="Format the output of the data card tool as .md for the hub."
8
+ )
9
+ parser.add_argument("--input_path", "-i", type=pathlib.Path, required=False)
10
+ parser.add_argument("--output_path", "-o", type=pathlib.Path, required=False)
11
+ args = parser.parse_args()
12
+
13
+
14
+ def read_json_file(json_path: pathlib.Path):
15
+ """Load a json file and return it as object."""
16
+ with open(json_path, "r") as f:
17
+ data = json.load(f)
18
+ return data
19
+
20
+
21
+ def save_file(json_path: pathlib.Path, json_obj: str):
22
+ """Takes a string and saves it as .md file."""
23
+ with open(json_path, "w") as f:
24
+ f.write(json.dumps(json_obj, indent=2))
25
+
26
+
27
+ def construct_json(dataset_name: str, data_card_data: dict, text_by_key: dict):
28
+ """Constructs the json file
29
+
30
+ This function iterates through text_by_key and extracts all answers from
31
+ the data_card_data object. It uses the levels of hierarchy as indicator for
32
+ the heading indentation and does not change the order in which anything
33
+ appears.
34
+
35
+ Args:
36
+ data_card_data: Output from the data card tool
37
+ text_by_key: configuration defined in key_to_question.json
38
+
39
+ Returns:
40
+ data_card_md_string: json content
41
+ """
42
+
43
+ try:
44
+ website_link = data_card_data["overview"]["where"]["website"]
45
+ except KeyError:
46
+ website_link = ""
47
+ try:
48
+ paper_link = data_card_data["overview"]["where"]["paper-url"]
49
+ except KeyError:
50
+ paper_link = ""
51
+ try:
52
+ authors = data_card_data["overview"]["credit"]["creators"]
53
+ except KeyError:
54
+ authors = ""
55
+
56
+ new_json = {
57
+ "name": dataset_name,
58
+ "summary": "Placeholder",
59
+ "sections": [
60
+ ],
61
+ }
62
+
63
+ if website_link:
64
+ new_json["website"] = website_link
65
+ if paper_link:
66
+ new_json["paper"] = paper_link
67
+ if authors:
68
+ new_json["authors"] = authors
69
+
70
+
71
+ total_questions = 0
72
+ total_words = 0
73
+
74
+ for main_key, main_content in text_by_key.items():
75
+ l2_data = {
76
+ "title": main_content["section-title"],
77
+ "level": 2,
78
+ "subsections": []
79
+ }
80
+ if main_key not in data_card_data:
81
+ continue
82
+ for second_key, second_content in main_content.items():
83
+ if second_key == "section-title":
84
+ continue
85
+ l3_data = {
86
+ "title": second_content["section-title"],
87
+ "level": 3,
88
+ "fields": []
89
+ }
90
+ for final_key, final_content in second_content.items():
91
+ if final_key == "section-title":
92
+ continue
93
+ try:
94
+ total_questions += 1
95
+ answer = data_card_data[main_key][second_key].get(final_key, "N/A")
96
+ except:
97
+ print(main_key, second_key, final_key)
98
+ print("==="*50)
99
+ print(data_card_data)
100
+ # Skip empty answers.
101
+ if isinstance(answer, str):
102
+ if answer.lower() == "n/a":
103
+ continue
104
+ if not answer:
105
+ continue
106
+
107
+ if isinstance(answer, list):
108
+ answer = ", ".join([f"`{a}`" for a in answer])
109
+
110
+ json_answer = {
111
+ "title": final_content["title"],
112
+ "level": 4,
113
+ "content": answer,
114
+ "flags": final_content["flags"],
115
+ "info": final_content["info"],
116
+ "scope": final_content["scope"],
117
+ }
118
+ total_words += len(answer.split())
119
+ l3_data["fields"].append(json_answer)
120
+ l2_data["subsections"].append(l3_data)
121
+ new_json["sections"].append(l2_data)
122
+ print(f"Total questions {total_questions}")
123
+ print(f"total words: {total_words}")
124
+ return new_json, total_words
125
+
126
+
127
+
128
+
129
+ if __name__ == "__main__":
130
+
131
+ text_by_key = read_json_file(
132
+ os.path.join(os.path.dirname(__file__), "key_to_question.json")
133
+ )
134
+ total_words_across_everything = 0
135
+ for dataset in os.listdir("../../../GEMv2"):
136
+ data_card_path = f"../../../GEMv2/{dataset}/{dataset}.json"
137
+ if os.path.exists(data_card_path):
138
+ print(f"Now processing {dataset}.")
139
+ new_path = f"datacards/{dataset}.json"
140
+ data_card_data = read_json_file(data_card_path)
141
+ data_card_json, total_cur_words = construct_json(dataset, data_card_data, text_by_key)
142
+ total_words_across_everything += total_cur_words
143
+ save_file(new_path, data_card_json)
144
+ else:
145
+ print(f"{dataset} has no data card!")
146
+ print(total_words_across_everything)
147
+ # data_card_json = construct_json(data_card_data, text_by_key)
148
+ # save_file(args.output_path, data_card_json)