File size: 30,768 Bytes
b9a3784
 
 
 
 
 
 
9365349
b9a3784
 
 
 
 
 
 
 
 
 
 
 
 
8d6beca
 
 
 
b9a3784
 
f855cd8
c5bb763
b9a3784
 
1bcd926
0de32ae
f855cd8
9365349
ed648f2
9365349
b9a3784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c615e95
b9a3784
4c4cd3b
 
f855cd8
4c4cd3b
b9a3784
 
 
 
 
 
 
 
 
 
888f2c7
b9a3784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888f2c7
b9a3784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888f2c7
b9a3784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9365349
b9a3784
 
 
cc824e1
b9a3784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5525641
b9a3784
 
 
cc824e1
b9a3784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d6beca
b9a3784
 
8d6beca
b9a3784
 
888f2c7
b9a3784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d6beca
 
 
 
 
 
 
5525641
8d6beca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9a3784
8d6beca
 
 
 
 
 
 
7ef3f12
c615e95
 
 
8d6beca
 
7ef3f12
8d6beca
 
4dec95d
8d6beca
 
 
 
9365349
8d6beca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c5bb763
 
8d6beca
 
1bcd926
 
 
c5bb763
1bcd926
c5bb763
 
8d6beca
 
 
 
c5bb763
8d6beca
 
 
 
 
 
90af898
f855cd8
 
 
90af898
f855cd8
 
 
 
 
c5bb763
8d6beca
 
 
 
c5bb763
8d6beca
 
 
 
 
 
c5bb763
8d6beca
 
 
 
 
 
c5bb763
8d6beca
 
 
 
 
 
 
 
c5bb763
7ef3f12
8d6beca
 
 
 
 
 
 
 
1bcd926
90af898
f855cd8
 
 
90af898
 
f855cd8
 
 
 
 
 
1bcd926
c5bb763
8d6beca
 
 
 
c5bb763
 
 
 
8d6beca
 
 
 
 
 
c5bb763
8d6beca
 
 
 
 
 
c5bb763
8d6beca
 
 
 
 
 
c5bb763
 
 
 
 
 
90af898
f855cd8
 
 
90af898
f855cd8
 
 
 
 
 
1bcd926
c5bb763
9365349
4dec95d
c5bb763
8d6beca
 
 
 
c5bb763
 
 
 
 
8d6beca
 
 
 
 
 
c5bb763
 
 
 
 
8d6beca
 
 
 
 
 
c5bb763
 
 
 
 
8d6beca
 
 
 
c5bb763
90af898
f855cd8
 
 
90af898
f855cd8
 
 
 
 
 
1bcd926
9365349
 
c5bb763
8d6beca
 
 
 
 
c5bb763
8d6beca
 
 
 
 
 
c5bb763
8d6beca
 
 
 
 
 
c5bb763
8d6beca
 
 
 
 
 
 
 
 
 
e1c48fc
cfb1906
 
9365349
e1c48fc
8d6beca
 
 
 
4dec95d
8d6beca
 
 
9365349
 
 
8d6beca
9365349
8d6beca
9365349
8d6beca
 
 
 
 
 
 
 
9365349
 
8d6beca
 
7ef3f12
8d6beca
7ef3f12
 
 
 
 
 
8d6beca
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
"""Climate Evaluation: Datasets used in the ClimateGPT paper"""

import os
import datasets
import csv
import textwrap
import json
from pathlib import Path


_CITATION = """
@misc{thulke2024climategpt,
      title={ClimateGPT: Towards AI Synthesizing Interdisciplinary Research on Climate Change}, 
      author={David Thulke and Yingbo Gao and Petrus Pelser and Rein Brune and Rricha Jalota and Floris Fok and Michael Ramos and Ian van Wyk and Abdallah Nasir and Hayden Goldstein and Taylor Tragemann and Katie Nguyen and Ariana Fowler and Andrew Stanco and Jon Gabriel and Jordan Taylor and Dean Moro and Evgenii Tsymbalov and Juliette de Waal and Evgeny Matusov and Mudar Yaghi and Mohammad Shihadah and Hermann Ney and Christian Dugast and Jonathan Dotan and Daniel Erasmus},
      year={2024},
      eprint={2401.09646},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}
"""

_DESCRIPTION = """\
Datasets for Climate Evaluation.
"""

_HOMEPAGE = "https://arxiv.org/abs/2401.09646"

_URL = "https://huggingface.co./datasets/eci-io/climate-evaluation/resolve/main/"

_LICENSE = ""

# _BASE_HF_URL = "https://huggingface.co./datasets/eci-io/climate-evaluation/resolve/main" #Path("./")

# _BASE_HF_URL = Path("./")

# print(f"_BASE_HF_URL: {_BASE_HF_URL}")

_ClimateEvaluation_BASE_KWARGS = dict(
    citation=_CITATION,
    url=_HOMEPAGE,
)

# DEFAULT_CONFIG_NAME = "climate_stance"

class ClimateEvaluationConfig(datasets.BuilderConfig):
    """BuilderConfig for ClimateEvaluation."""

    def __init__(
        self,
        data_dir,
        citation,
        url=None,
        text_features=None,
        label_column=None,
        label_classes=None,
        process_label=lambda x: x,
        **kwargs,
    ):
        """BuilderConfig for ClimateGPT-Evaluation.
        Args:
          text_features: `dict[string, string]`, map from the name of the feature
            dict for each text field to the name of the column in the tsv file
          label_column: `string`, name of the column in the tsv file corresponding
            to the label
          data_dir: `string`, the path to the folder containing the tsv files in the
            downloaded zip
          citation: `string`, citation for the data set
          url: `string`, url for information about the data set
          label_classes: `list[string]`, the list of classes if the label is
            categorical. If not provided, then the label will be of type
            `datasets.Value('float32')`.
          process_label: `Function[string, any]`, function  taking in the raw value
            of the label and processing it to the form required by the label feature
          **kwargs: keyword arguments forwarded to super.
        """
        super(ClimateEvaluationConfig, self).__init__(
            version=datasets.Version("1.0.0", ""), **kwargs
        )
        self.text_features = text_features
        self.label_column = label_column
        self.label_classes = label_classes
        self.data_dir = data_dir
        self.citation = citation
        self.url = url
        self.process_label = process_label


class ClimateEvaluation(datasets.GeneratorBasedBuilder):
    """On ClimaBench, Pira 2.0 MCQs, Exeter datasets"""

    VERSION = datasets.Version("1.0.0")

    BUILDER_CONFIG_CLASS = ClimateEvaluationConfig

    BUILDER_CONFIGS = [
        ClimateEvaluationConfig(
            name="climate_stance",
            description=textwrap.dedent(
                """\
            Climate-Stance contains climate change-related tweets that were posted during the 2019 United Nations Framework Convention on Climate Change. The tweets have been manually categorized into three groups for the purpose of stance detection: those expressing support for climate change prevention, those opposing it, and those with an ambiguous stance."""
            ),
            text_features={"text": "text"},
            label_classes=[0, 1, 2],
            label_column="label",
            data_dir="ClimateStance",
            citation=textwrap.dedent(
                """\
             @inproceedings{vaid-etal-2022-towards,
                    title = "Towards Fine-grained Classification of Climate Change related Social Media Text",
                    author = "Vaid, Roopal  and
                    Pant, Kartikey  and
                    Shrivastava, Manish",
                    booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics: Student Research Workshop",
                    month = may,
                    year = "2022",
                    address = "Dublin, Ireland",
                    publisher = "Association for Computational Linguistics",
                    url = "https://aclanthology.org/2022.acl-srw.35",
                    doi = "10.18653/v1/2022.acl-srw.35",
                    pages = "434--443",
                    abstract = "With climate change becoming a cause of concern worldwide, it becomes essential to gauge people{'}s reactions. This can help educate and spread awareness about it and help leaders improve decision-making. This work explores the fine-grained classification and Stance detection of climate change-related social media text. Firstly, we create two datasets, ClimateStance and ClimateEng, consisting of 3777 tweets each, posted during the 2019 United Nations Framework Convention on Climate Change and comprehensively outline the dataset collection, annotation methodology, and dataset composition. Secondly, we propose the task of Climate Change stance detection based on our proposed ClimateStance dataset. Thirdly, we propose a fine-grained classification based on the ClimateEng dataset, classifying social media text into five categories: Disaster, Ocean/Water, Agriculture/Forestry, Politics, and General. We benchmark both the datasets for climate change stance detection and fine-grained classification using state-of-the-art methods in text classification. We also create a Reddit-based dataset for both the tasks, ClimateReddit, consisting of 6262 pseudo-labeled comments along with 329 manually annotated comments for the label. We then perform semi-supervised experiments for both the tasks and benchmark their results using the best-performing model for the supervised experiments. Lastly, we provide insights into the ClimateStance and ClimateReddit using part-of-speech tagging and named-entity recognition.",
                }
            }"""
            ),
            url="https://github.com/roopalv54/finegrained-climate-change-social-media",
        ),
        ClimateEvaluationConfig(
            name="climate_eng",
            description=textwrap.dedent(
                """\
            ClimateEng contains climate change-related tweets that were posted during the 2019 United Nations Framework Convention on Climate Change. The tweets have been manually categorized for the task of fine-grained classification into topics such as: Disaster, Ocean/Water, Agriculture/forestry, Politics, General. """
            ),
            text_features={"text": "text"},
            label_classes=["0", "1", "2", "3", "4"],
            label_column="label",
            data_dir="ClimateEng",
            citation=textwrap.dedent(
                """\
            @inproceedings{vaid-etal-2022-towards,
                    title = "Towards Fine-grained Classification of Climate Change related Social Media Text",
                    author = "Vaid, Roopal  and
                    Pant, Kartikey  and
                    Shrivastava, Manish",
                    booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics: Student Research Workshop",
                    month = may,
                    year = "2022",
                    address = "Dublin, Ireland",
                    publisher = "Association for Computational Linguistics",
                    url = "https://aclanthology.org/2022.acl-srw.35",
                    doi = "10.18653/v1/2022.acl-srw.35",
                    pages = "434--443",
                    abstract = "With climate change becoming a cause of concern worldwide, it becomes essential to gauge people{'}s reactions. This can help educate and spread awareness about it and help leaders improve decision-making. This work explores the fine-grained classification and Stance detection of climate change-related social media text. Firstly, we create two datasets, ClimateStance and ClimateEng, consisting of 3777 tweets each, posted during the 2019 United Nations Framework Convention on Climate Change and comprehensively outline the dataset collection, annotation methodology, and dataset composition. Secondly, we propose the task of Climate Change stance detection based on our proposed ClimateStance dataset. Thirdly, we propose a fine-grained classification based on the ClimateEng dataset, classifying social media text into five categories: Disaster, Ocean/Water, Agriculture/Forestry, Politics, and General. We benchmark both the datasets for climate change stance detection and fine-grained classification using state-of-the-art methods in text classification. We also create a Reddit-based dataset for both the tasks, ClimateReddit, consisting of 6262 pseudo-labeled comments along with 329 manually annotated comments for the label. We then perform semi-supervised experiments for both the tasks and benchmark their results using the best-performing model for the supervised experiments. Lastly, we provide insights into the ClimateStance and ClimateReddit using part-of-speech tagging and named-entity recognition.",
                }
            }"""
            ),
            url="https://github.com/roopalv54/finegrained-climate-change-social-media",
        ),
        ClimateEvaluationConfig(
            name="climatext",
            description=textwrap.dedent(
                """\
            ClimaText is a binary classification dataset containing sentences from the web, Wikipedia and the section of US public companies' 10-K reports that addresses climate-related risks. The dataset is employed for the task of predicting whether a given sentence is relevant to climate change or not. """
            ),
            text_features={"text": "sentence"},
            label_classes=["0", "1"],
            label_column="label",
            data_dir="ClimaText",
            citation=textwrap.dedent(
                """\
                @misc{varini2021climatext,
                    title={ClimaText: A Dataset for Climate Change Topic Detection}, 
                    author={Francesco S. Varini and Jordan Boyd-Graber and Massimiliano Ciaramita and Markus Leippold},
                    year={2021},
                    eprint={2012.00483},
                    archivePrefix={arXiv},
                    primaryClass={cs.CL}
                }
            }"""
            ),
            url="https://www.sustainablefinance.uzh.ch/en/research/climate-fever/climatext.html",
        ),
        ClimateEvaluationConfig(
            name="cdp_qa",
            description=textwrap.dedent(
                """\
                CDP-QA is a dataset compiled from the questionnaires of the Carbon Disclosure Project, where cities, corporations, and states disclose their environmental information. The dataset presents pairs of questions and answers, and the objective is to predict whether a given answer is valid for the corresponding question. We benchmarked ClimateGPT on the questionnaires from the Combined split. """
            ),
            data_dir="CDP/Combined",
            text_features={"question": "question", "answer": "answer"},
            label_classes=["0", "1"],
            label_column="label",
            url="https://arxiv.org/abs/2301.04253",
            citation=textwrap.dedent(
                """\
                @misc{laud2023Climabench,
                    title={ClimaBench: A Benchmark Dataset For Climate Change Text Understanding in English}, 
                    author={Tanmay Laud and Daniel Spokoyny and Tom Corringham and Taylor Berg-Kirkpatrick},
                    year={2023},
                    eprint={2301.04253},
                    archivePrefix={arXiv},
                    primaryClass={cs.CL}
                }
            }"""
            ),
        ),
        ClimateEvaluationConfig(
            name="exeter",
            description=textwrap.dedent(
                """\
                The Exeter Climate Claims dataset contains textual data from 33 influential climate contrarian blogs and the climate-change-related content from 20 conservative think tanks spanning the years 1998 to 2020. Annotation of the dataset was done manually using a thorough three-layer taxonomy of (climate-change related) contrarian claims, which was developed by the authors. We utilize this dataset specifically for the binary classification task of discerning whether a given text contains a contrarian claim pertaining to climate change or not.  """
            ),
            data_dir="exeter",
            text_features={"text": "text"},
            label_classes=["0", "1"],
            label_column="label",
            url="https://www.nature.com/articles/s41598-021-01714-4",
            citation=textwrap.dedent(
                """\
                @article{coan2021computer,
                    title={Computer-assisted classification of contrarian claims about climate change},
                    author={Coan, Travis G and Boussalis, Constantine and Cook, John and Nanko, Mirjam O},
                    journal={Scientific reports},
                    volume={11},
                    number={1},
                    pages={22320},
                    year={2021},
                    publisher={Nature Publishing Group UK London}
                }
            }"""
            ),
        ),
        ClimateEvaluationConfig(
            name="translated_exams",
            description=textwrap.dedent(
                """\
                EXAMS is a multiple choice question answering collected from high school examinations. To evaluate ClimateGPT on the cascaded machine translation approach, we evaluate on the English translation of the Arabic subset of this dataset. The Arabic subset covers questions from biology, physics, science, social science and Islamic studies.
                """
            ),
            data_dir="exams/translated",
            text_features={"subject": "subject", "question_stem": "question_stem", "choices": "choices"},
            label_classes=["A", "B", "C", "D"],
            label_column="answerKey",
            url="https://arxiv.org/abs/2301.04253",
            citation=textwrap.dedent(
                    """\
                    @inproceedings{hardalov-etal-2020-exams,
                    title = "{EXAMS}: A Multi-subject High School Examinations Dataset for Cross-lingual and Multilingual Question Answering",
                    author = "Hardalov, Momchil  and
                    Mihaylov, Todor  and
                    Zlatkova, Dimitrina  and
                    Dinkov, Yoan  and
                    Koychev, Ivan  and
                    Nakov, Preslav",
                    editor = "Webber, Bonnie  and
                    Cohn, Trevor  and
                    He, Yulan  and
                    Liu, Yang",
                    booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
                    month = nov,
                    year = "2020",
                    address = "Online",
                    publisher = "Association for Computational Linguistics",
                    url = "https://aclanthology.org/2020.emnlp-main.438",
                    doi = "10.18653/v1/2020.emnlp-main.438",
                    pages = "5427--5444",
                }
            }"""
            ),
        ),
        ClimateEvaluationConfig(
            name="exams",
            description=textwrap.dedent(
                """\
                EXAMS is a multiple choice question answering collected from high school examinations. To evaluate ClimateGPT on the cascaded machine translation approach, we evaluate on the Arabic subset of this dataset. The Arabic subset covers questions from biology, physics, science, social science and Islamic studies. Note, this dataset is in arabic.  
                """
            ),
            data_dir="exams",
            text_features={"subject": "subject", "question_stem": "question_stem", "choices": "choices"},
            label_classes=["A", "B", "C", "D"],
            label_column="answerKey",
            url="https://arxiv.org/abs/2301.04253",
            citation=textwrap.dedent(
                    """\
                    @inproceedings{hardalov-etal-2020-exams,
                    title = "{EXAMS}: A Multi-subject High School Examinations Dataset for Cross-lingual and Multilingual Question Answering",
                    author = "Hardalov, Momchil  and
                    Mihaylov, Todor  and
                    Zlatkova, Dimitrina  and
                    Dinkov, Yoan  and
                    Koychev, Ivan  and
                    Nakov, Preslav",
                    editor = "Webber, Bonnie  and
                    Cohn, Trevor  and
                    He, Yulan  and
                    Liu, Yang",
                    booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
                    month = nov,
                    year = "2020",
                    address = "Online",
                    publisher = "Association for Computational Linguistics",
                    url = "https://aclanthology.org/2020.emnlp-main.438",
                    doi = "10.18653/v1/2020.emnlp-main.438",
                    pages = "5427--5444",
                }
            }"""
            ),
        ),
    ]

    def _info(self):
        if self.config.name == "exams" or self.config.name == "translated_exams":
            features = datasets.Features(
                {
                    "subject": datasets.Value("string"),
                    "question_stem": datasets.Value("string"),
                    "choices": datasets.Value("string"),
                    "answerKey": datasets.ClassLabel(
                        names=["A", "B", "C", "D"]
                    ),
                }
            )
            features["idx"] = datasets.Value("int32")
        else:
            if self.config.name == "cdp_qa":
                #print(f"self.config.text_features: {self.config.text_features.keys()}")
                features = {
                    text_feature: datasets.Value("string")
                    for text_feature in self.config.text_features.keys()
                }
                # features["category"] = datasets.Value("string")
            else:
                features = {
                    text_feature: datasets.Value("string")
                    for text_feature in self.config.text_features.keys()
                }
            if self.config.label_classes:
                features["label"] = datasets.features.ClassLabel(
                    names=self.config.label_classes
                )
            else:
                features["label"] = datasets.Value("float32")
            features["idx"] = datasets.Value("int32")
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=datasets.Features(features),
            homepage=self.config.url,
            citation=self.config.citation + "\n" + _CITATION,
        )

    def _split_generators(self, dl_manager):
        data_dir = self.config.data_dir
        # urls_to_download = _URL
        # print(f"self.config.data_dir: {self.config.data_dir}")

        if self.config.name == "exams" or self.config.name == "translated_exams":
            # urls_to_download={
            #     "test": _BASE_HF_URL / data_dir / f"test.csv"
            # }
            urls_to_download={
                "test": _URL + os.path.join(data_dir or "", "test.csv"),
            }
            downloaded_files = dl_manager.download_and_extract(urls_to_download)
            return [
                datasets.SplitGenerator(
                    name=datasets.Split.TEST,
                    gen_kwargs={
                        "data_file": downloaded_files["test"], #os.path.join(data_dir or "", "test.csv"),
                        "split": "test",
                    },
                ),
            ]
        
        if self.config.name == "exeter":
            # urls_to_download={
            #     "train": _BASE_HF_URL / data_dir / f"training.csv",
            #     "valid": _BASE_HF_URL / data_dir / f"validation.csv",
            #     "test": _BASE_HF_URL / data_dir / f"test.csv"
            # }
            urls_to_download={
                "train": _URL + os.path.join(data_dir or "", "training.csv"),
                "valid": _URL + os.path.join(data_dir or "", "validation.csv"),
                "test": _URL + os.path.join(data_dir or "", "test.csv"),
            }
            downloaded_files = dl_manager.download_and_extract(urls_to_download)
            return [
                datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                gen_kwargs={
                    "data_file": downloaded_files["train"],
                    "split": "train",
                },
            ),
            datasets.SplitGenerator(
                name=datasets.Split.VALIDATION,
                gen_kwargs={
                    "data_file": downloaded_files["valid"],
                    "split": "valid",
                },
            ),
            datasets.SplitGenerator(
                name=datasets.Split.TEST,
                gen_kwargs={
                    "data_file": downloaded_files["test"],
                    "split": "test",
                },
            ),
            ]

        if self.config.name == "climatext":
            files = {
                "train": [
                    "train-data/AL-10Ks.tsv : 3000 (58 positives, 2942 negatives) (TSV, 127138 KB).tsv",
                    "train-data/AL-Wiki (train).tsv",
                ],
                "valid": ["dev-data/Wikipedia (dev).tsv"],
                "test": [
                    "test-data/Claims (test).tsv",
                    "test-data/Wikipedia (test).tsv",
                    "test-data/10-Ks (2018, test).tsv",
                ],
            }
            # os.path.join(data_dir or "", f)
            # urls_to_download={
            #     "train": [_BASE_HF_URL / data_dir / f for f in files["train"]], 
            #     "valid": [_BASE_HF_URL / data_dir / f for f in files["valid"]],
            #     "test": [_BASE_HF_URL / data_dir / f for f in files["test"]],
            # }

            urls_to_download={
                "train": [_URL + os.path.join(data_dir or "", f) for f in files["train"]], 
                "valid": [_URL + os.path.join(data_dir or "", f) for f in files["valid"]],
                "test": [_URL + os.path.join(data_dir or "", f) for f in files["test"]],
            }

            
            downloaded_files = dl_manager.download_and_extract(urls_to_download)
            return [
                datasets.SplitGenerator(
                    name=datasets.Split.TRAIN,
                    gen_kwargs={
                        "data_file": downloaded_files["train"],
                        # [
                        #     os.path.join(data_dir or "", f) for f in files["train"]
                        # ],
                        "split": "train",
                    },
                ),
                datasets.SplitGenerator(
                    name=datasets.Split.VALIDATION,
                    gen_kwargs={
                        "data_file": downloaded_files["valid"],
                        "split": "valid",
                    },
                ),
                datasets.SplitGenerator(
                    name=datasets.Split.TEST,
                    gen_kwargs={
                        "data_file": downloaded_files["test"],
                        "split": "test",
                    },
                ),
            ]

        if self.config.name == "cdp_qa":
            # categories = {
            #     "cities": "Cities/Cities Responses",
            #     "states": "States",
            #     "corporations": "Corporations/Corporations Responses/Climate Change",
            #     "combined": "Combined",
            # }
            # urls_to_download={
            #     "train": _BASE_HF_URL / data_dir / f"train_qa.csv", 
            #     "valid": _BASE_HF_URL / data_dir / f"val_qa.csv", 
            #     "test": _BASE_HF_URL / data_dir / f"test_qa.csv" 
            # }

            urls_to_download={
                "train": _URL + os.path.join(data_dir or "", "train_qa.csv"),
                "valid": _URL + os.path.join(data_dir or "", "val_qa.csv"),
                "test": _URL + os.path.join(data_dir or "", "test_qa.csv"),
            }
            
            downloaded_files = dl_manager.download_and_extract(urls_to_download)

            #print(f"downloaded_files: {downloaded_files['train']}")
            
            return [
                datasets.SplitGenerator(
                    name=datasets.Split.TRAIN,
                    gen_kwargs={
                        "data_file": downloaded_files["train"],
                        # "data_file": [
                        #     (k, os.path.join(data_dir or "", v, "train_qa.csv"))
                        #     for k, v in categories.items()
                        # ],
                        "split": "train",
                    },
                ),
                datasets.SplitGenerator(
                    name=datasets.Split.VALIDATION,
                    gen_kwargs={
                        "data_file": downloaded_files["valid"],
                        # [
                        #     (k, os.path.join(data_dir or "", v, "val_qa.csv"))
                        #     for k, v in categories.items()
                        # ],
                        "split": "valid",
                    },
                ),
                datasets.SplitGenerator(
                    name=datasets.Split.TEST,
                    gen_kwargs={
                        "data_file": downloaded_files["test"],
                        # [
                        #     (k, os.path.join(data_dir or "", v, "test_qa.csv"))
                        #     for k, v in categories.items()
                        # ],
                        "split": "test",
                    },
                ),
            ]
        
        # urls_to_download={
        #         "train": _BASE_HF_URL / data_dir / f"train.csv", #os.path.join(data_dir or "", "train.csv"),
        #         "valid": _BASE_HF_URL / data_dir / f"val.csv", #+ os.path.join(data_dir or "", "val.csv"),
        #         "test": _BASE_HF_URL / data_dir / f"test.csv", #+ os.path.join(data_dir or "", "test.csv")
        #     }

        urls_to_download={
                "train": _URL + os.path.join(data_dir or "", "train.csv"),
                "valid": _URL + os.path.join(data_dir or "", "val.csv"),
                "test": _URL + os.path.join(data_dir or "", "test.csv")
            }
            
        # print(f"urls_to_download['train']: {urls_to_download['train']}")
        # print(f"urls_to_download['valid']: {urls_to_download['valid']}")
        downloaded_files = dl_manager.download_and_extract(urls_to_download)

        return [
            datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                gen_kwargs={
                    "data_file": downloaded_files["train"],
                    "split": "train",
                },
            ),
            datasets.SplitGenerator(
                name=datasets.Split.VALIDATION,
                gen_kwargs={
                    "data_file": downloaded_files["valid"],
                    "split": "valid",
                },
            ),
            datasets.SplitGenerator(
                name=datasets.Split.TEST,
                gen_kwargs={
                    "data_file": downloaded_files["test"],
                    "split": "test",
                },
            ),
        ]

    def _generate_examples(self, data_file, split):
        if self.config.name == "climatext":
            idx = iter(range(100000))
            for file in data_file:
                yield from self._process_file(file, delimiter="\t", idx=idx)
        # elif self.config.name == "cdp_qa":
            # idx = iter(range(10000000))
            # print(f"!!!data_file: {data_file}")
            # for file in data_file:
            # yield from self._process_file(data_file)
        else:
            yield from self._process_file(data_file)

    def _process_file(self, data_file, delimiter=",", idx=None, category=None):
        # print(f"data_file: {data_file}")
        with open(data_file, encoding="utf8") as f:
            process_label = self.config.process_label
            label_classes = self.config.label_classes
            # print(f"self.config.text_features: {self.config.text_features}")
            # data = f.read()
            # print(f"data: {data}")
            reader = csv.DictReader(f, delimiter=delimiter, quoting=csv.QUOTE_ALL)
            # print(f"reader: {reader}")
            for n, row in enumerate(reader):
                # print(f"row: {row}")
                example = {
                    feat: row[col] for feat, col in self.config.text_features.items()
                }
                if idx:
                    example["idx"] = next(idx)
                else:
                    example["idx"] = n

                # if category:
                #     example["category"] = category

                if self.config.label_column in row:
                    # print(f"self.config.label_column: {self.config.label_column}")
                    label = row[self.config.label_column]
                    if self.config.name in ["exams", "translated_exams"]:
                        example["answerKey"] = process_label(label)
                    else:
                        if label_classes and label not in label_classes:
                            label = int(label) if label else None
                        example["label"] = process_label(label)
                else:
                    example["label"] = process_label(-1)

                # Filter out corrupted rows.
                for value in example.values():
                    if value is None:
                        break
                else:
                    yield example["idx"], example