tanmaylaud commited on
Commit
42d54de
·
1 Parent(s): be5c5ac

added scidcc

Browse files
Files changed (1) hide show
  1. climabench.py +87 -21
climabench.py CHANGED
@@ -23,7 +23,7 @@ import json
23
 
24
 
25
  _CITATION = """
26
- @misc{laud2023climabench,
27
  title={ClimaBench: A Benchmark Dataset For Climate Change Text Understanding in English},
28
  author={Tanmay Laud and Daniel Spokoyny and Tom Corringham and Taylor Berg-Kirkpatrick},
29
  year={2023},
@@ -37,7 +37,7 @@ _DESCRIPTION = """\
37
  The topic of Climate Change (CC) has received limited attention in NLP despite its real world urgency.
38
  Activists and policy-makers need NLP tools in order to effectively process the vast and rapidly growing textual data produced on CC.
39
  Their utility, however, primarily depends on whether the current state-of-the-art models can generalize across various tasks in the CC domain.
40
- In order to address this gap, we introduce Climate Change Benchmark (ClimaBench), a benchmark collection of existing disparate datasets for evaluating model performance across a diverse set of CC NLU tasks systematically.
41
  Further, we enhance the benchmark by releasing two large-scale labelled text classification and question-answering datasets curated from publicly available environmental disclosures.
42
  Lastly, we provide an analysis of several generic and CC-oriented models answering whether fine-tuning on domain text offers any improvements across these tasks. We hope this work provides a standard assessment tool for research on CC text data.
43
  """
@@ -47,15 +47,15 @@ _HOMEPAGE = "https://arxiv.org/abs/2301.04253"
47
  _LICENSE = ""
48
 
49
  _URL = "https://drive.google.com/u/0/uc?id=1RnZDC-KMOx8JkhbrFl86TsDpsskZB6fO&export=download&confirm=t&uuid=33b5ea55-a99a-431c-b805-0f298ed2912a&at=AKKF8vzyC_uPCdXvV4-gPlJ11X1J:1688024195786"
50
-
51
- _CLIMABENCH_BASE_KWARGS = dict(
52
  citation=_CITATION,
53
  url=_HOMEPAGE,
54
  )
55
 
56
 
57
- class ClimaBenchConfig(datasets.BuilderConfig):
58
- """BuilderConfig for ClimaBench."""
59
 
60
  def __init__(
61
  self,
@@ -68,7 +68,7 @@ class ClimaBenchConfig(datasets.BuilderConfig):
68
  process_label=lambda x: x,
69
  **kwargs,
70
  ):
71
- """BuilderConfig for ClimaBench.
72
  Args:
73
  text_features: `dict[string, string]`, map from the name of the feature
74
  dict for each text field to the name of the column in the tsv file
@@ -85,7 +85,7 @@ class ClimaBenchConfig(datasets.BuilderConfig):
85
  of the label and processing it to the form required by the label feature
86
  **kwargs: keyword arguments forwarded to super.
87
  """
88
- super(ClimaBenchConfig, self).__init__(
89
  version=datasets.Version("1.0.0", ""), **kwargs
90
  )
91
  self.text_features = text_features
@@ -97,11 +97,11 @@ class ClimaBenchConfig(datasets.BuilderConfig):
97
  self.process_label = process_label
98
 
99
 
100
- class ClimaBench(datasets.GeneratorBasedBuilder):
101
  """FLORES-200 dataset."""
102
 
103
  BUILDER_CONFIGS = [
104
- ClimaBenchConfig(
105
  name="climate_stance",
106
  description=textwrap.dedent(
107
  """\
@@ -132,7 +132,7 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
132
  ),
133
  url="https://github.com/roopalv54/finegrained-climate-change-social-media",
134
  ),
135
- ClimaBenchConfig(
136
  name="climate_eng",
137
  description=textwrap.dedent(
138
  """\
@@ -163,7 +163,7 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
163
  ),
164
  url="https://github.com/roopalv54/finegrained-climate-change-social-media",
165
  ),
166
- ClimaBenchConfig(
167
  name="climate_fever",
168
  description=textwrap.dedent(
169
  """\
@@ -184,7 +184,7 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
184
  ),
185
  url="http://climatefever.ai",
186
  ),
187
- ClimaBenchConfig(
188
  name="climatext",
189
  description=textwrap.dedent(
190
  """\
@@ -208,7 +208,7 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
208
  ),
209
  url="https://www.sustainablefinance.uzh.ch/en/research/climate-fever/climatext.html",
210
  ),
211
- ClimaBenchConfig(
212
  name="clima_insurance",
213
  description=textwrap.dedent(
214
  """\
@@ -222,9 +222,9 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
222
  data_dir="all_data/ClimateInsurance",
223
  text_features={"text": "text"},
224
  label_column="label",
225
- **_CLIMABENCH_BASE_KWARGS,
226
  ),
227
- ClimaBenchConfig(
228
  name="clima_insurance_plus",
229
  description=textwrap.dedent(
230
  """\
@@ -238,9 +238,9 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
238
  data_dir="all_data/ClimateInsuranceMulti",
239
  text_features={"text": "text"},
240
  label_column="label",
241
- **_CLIMABENCH_BASE_KWARGS,
242
  ),
243
- ClimaBenchConfig(
244
  name="clima_cdp",
245
  description=textwrap.dedent(
246
  """\
@@ -271,9 +271,9 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
271
  data_dir="all_data/CDP/Cities/Cities Responses",
272
  text_features={"text": "Text"},
273
  label_column="Label",
274
- **_CLIMABENCH_BASE_KWARGS,
275
  ),
276
- ClimaBenchConfig(
277
  name="clima_qa",
278
  description=textwrap.dedent(
279
  """\
@@ -291,7 +291,62 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
291
  text_features={"question": "question", "answer": "answer"},
292
  label_classes=["0", "1"],
293
  label_column="label",
294
- **_CLIMABENCH_BASE_KWARGS,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  ),
296
  ]
297
 
@@ -348,6 +403,17 @@ class ClimaBench(datasets.GeneratorBasedBuilder):
348
  dl_dir = dl_manager.download_and_extract(_URL)
349
  data_dir = os.path.join(dl_dir, self.config.data_dir)
350
 
 
 
 
 
 
 
 
 
 
 
 
351
  if self.config.name == "climate_fever":
352
  return [
353
  datasets.SplitGenerator(
 
23
 
24
 
25
  _CITATION = """
26
+ @misc{laud2023Climabench,
27
  title={ClimaBench: A Benchmark Dataset For Climate Change Text Understanding in English},
28
  author={Tanmay Laud and Daniel Spokoyny and Tom Corringham and Taylor Berg-Kirkpatrick},
29
  year={2023},
 
37
  The topic of Climate Change (CC) has received limited attention in NLP despite its real world urgency.
38
  Activists and policy-makers need NLP tools in order to effectively process the vast and rapidly growing textual data produced on CC.
39
  Their utility, however, primarily depends on whether the current state-of-the-art models can generalize across various tasks in the CC domain.
40
+ In order to address this gap, we introduce Climate Change Benchmark (Climabench), a benchmark collection of existing disparate datasets for evaluating model performance across a diverse set of CC NLU tasks systematically.
41
  Further, we enhance the benchmark by releasing two large-scale labelled text classification and question-answering datasets curated from publicly available environmental disclosures.
42
  Lastly, we provide an analysis of several generic and CC-oriented models answering whether fine-tuning on domain text offers any improvements across these tasks. We hope this work provides a standard assessment tool for research on CC text data.
43
  """
 
47
  _LICENSE = ""
48
 
49
  _URL = "https://drive.google.com/u/0/uc?id=1RnZDC-KMOx8JkhbrFl86TsDpsskZB6fO&export=download&confirm=t&uuid=33b5ea55-a99a-431c-b805-0f298ed2912a&at=AKKF8vzyC_uPCdXvV4-gPlJ11X1J:1688024195786"
50
+ # _URL = "https://drive.google.com/drive/folders/1zaOPdS88m2oMRqmDGs4KqtWEIRJcPsMO"
51
+ _Climabench_BASE_KWARGS = dict(
52
  citation=_CITATION,
53
  url=_HOMEPAGE,
54
  )
55
 
56
 
57
+ class ClimabenchConfig(datasets.BuilderConfig):
58
+ """BuilderConfig for Climabench."""
59
 
60
  def __init__(
61
  self,
 
68
  process_label=lambda x: x,
69
  **kwargs,
70
  ):
71
+ """BuilderConfig for Climabench.
72
  Args:
73
  text_features: `dict[string, string]`, map from the name of the feature
74
  dict for each text field to the name of the column in the tsv file
 
85
  of the label and processing it to the form required by the label feature
86
  **kwargs: keyword arguments forwarded to super.
87
  """
88
+ super(ClimabenchConfig, self).__init__(
89
  version=datasets.Version("1.0.0", ""), **kwargs
90
  )
91
  self.text_features = text_features
 
97
  self.process_label = process_label
98
 
99
 
100
+ class Climabench(datasets.GeneratorBasedBuilder):
101
  """FLORES-200 dataset."""
102
 
103
  BUILDER_CONFIGS = [
104
+ ClimabenchConfig(
105
  name="climate_stance",
106
  description=textwrap.dedent(
107
  """\
 
132
  ),
133
  url="https://github.com/roopalv54/finegrained-climate-change-social-media",
134
  ),
135
+ ClimabenchConfig(
136
  name="climate_eng",
137
  description=textwrap.dedent(
138
  """\
 
163
  ),
164
  url="https://github.com/roopalv54/finegrained-climate-change-social-media",
165
  ),
166
+ ClimabenchConfig(
167
  name="climate_fever",
168
  description=textwrap.dedent(
169
  """\
 
184
  ),
185
  url="http://climatefever.ai",
186
  ),
187
+ ClimabenchConfig(
188
  name="climatext",
189
  description=textwrap.dedent(
190
  """\
 
208
  ),
209
  url="https://www.sustainablefinance.uzh.ch/en/research/climate-fever/climatext.html",
210
  ),
211
+ ClimabenchConfig(
212
  name="clima_insurance",
213
  description=textwrap.dedent(
214
  """\
 
222
  data_dir="all_data/ClimateInsurance",
223
  text_features={"text": "text"},
224
  label_column="label",
225
+ **_Climabench_BASE_KWARGS,
226
  ),
227
+ ClimabenchConfig(
228
  name="clima_insurance_plus",
229
  description=textwrap.dedent(
230
  """\
 
238
  data_dir="all_data/ClimateInsuranceMulti",
239
  text_features={"text": "text"},
240
  label_column="label",
241
+ **_Climabench_BASE_KWARGS,
242
  ),
243
+ ClimabenchConfig(
244
  name="clima_cdp",
245
  description=textwrap.dedent(
246
  """\
 
271
  data_dir="all_data/CDP/Cities/Cities Responses",
272
  text_features={"text": "Text"},
273
  label_column="Label",
274
+ **_Climabench_BASE_KWARGS,
275
  ),
276
+ ClimabenchConfig(
277
  name="clima_qa",
278
  description=textwrap.dedent(
279
  """\
 
291
  text_features={"question": "question", "answer": "answer"},
292
  label_classes=["0", "1"],
293
  label_column="label",
294
+ **_Climabench_BASE_KWARGS,
295
+ ),
296
+ ClimabenchConfig(
297
+ name="scidcc",
298
+ description=textwrap.dedent(
299
+ """\
300
+ The Science Daily Climate Change (SCIDCC) dataset is
301
+ curated by web scraping news articles from the
302
+ Science Daily (SD) website. It contains around
303
+ 11k news articles from 20 categories relevant to
304
+ climate change, where each article comprises of
305
+ a title, summary, and a body. Some of the major
306
+ categories are Earthquakes, Pollution, Hurricanes
307
+ and Cyclones. We propose to use this dataset for
308
+ the first time as a category classification task for
309
+ two reasons. Firstly, the SD news articles are relatively
310
+ more scientific as compared to other online
311
+ news. Secondly, the average document length is
312
+ around 500-600 words with a maximum of roughly
313
+ 2.5k words, which is significantly longer than other
314
+ existing public CC datasets."""
315
+ ),
316
+ label_classes=[
317
+ "Ozone Holes",
318
+ "Pollution",
319
+ "Hurricanes Cyclones",
320
+ "Earthquakes",
321
+ "Climate",
322
+ "Environment",
323
+ "Geography",
324
+ "Geology",
325
+ "Global Warming",
326
+ "Weather",
327
+ "Agriculture & Food",
328
+ "Animals",
329
+ "Biology",
330
+ "Endangered Animals",
331
+ "Extinction",
332
+ "New Species",
333
+ "Zoology",
334
+ "Biotechnology",
335
+ "Genetically Modified",
336
+ "Microbes",
337
+ ],
338
+ data_dir="all_data",
339
+ text_features={"title": "Title", "summary": "Summary", "body": "Body"},
340
+ label_column="Category",
341
+ citation=textwrap.dedent(
342
+ """@inproceedings{mishra2021neuralnere,
343
+ title={NeuralNERE: Neural Named Entity Relationship Extraction for End-to-End Climate Change Knowledge Graph Construction},
344
+ author={Mishra, Prakamya and Mittal, Rohan},
345
+ booktitle={ICML 2021 Workshop on Tackling Climate Change with Machine Learning},
346
+ url={https://www.climatechange.ai/papers/icml2021/76},
347
+ year={2021}
348
+ }"""
349
+ ),
350
  ),
351
  ]
352
 
 
403
  dl_dir = dl_manager.download_and_extract(_URL)
404
  data_dir = os.path.join(dl_dir, self.config.data_dir)
405
 
406
+ if self.config.name == "scidcc":
407
+ return [
408
+ datasets.SplitGenerator(
409
+ name=datasets.Split.TEST,
410
+ gen_kwargs={
411
+ "data_file": os.path.join(data_dir or "", "SciDCC.csv"),
412
+ "split": "test",
413
+ },
414
+ ),
415
+ ]
416
+
417
  if self.config.name == "climate_fever":
418
  return [
419
  datasets.SplitGenerator(