File size: 30,268 Bytes
6207f8f
c7a5837
4fab6b9
c7a5837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1889f0b
 
 
c7a5837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ffaa3c
 
 
 
c7a5837
 
 
 
6c3740d
c7a5837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b47191a
c7a5837
 
 
b47191a
c7a5837
 
 
 
 
 
 
 
 
1cb95de
 
 
 
 
 
bdf230e
d9245d1
bdf230e
 
 
b1444a3
e6f8644
e3e784a
1b998c2
e3e784a
496fde2
 
e3e784a
6c3740d
e3e784a
 
496fde2
 
b47191a
 
 
 
c7a5837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21bb2b1
c7a5837
 
1889f0b
496fde2
a01bec3
c7a5837
496fde2
 
c7a5837
6c3740d
c7a5837
 
496fde2
 
9b980f5
 
 
c7a5837
 
 
 
496fde2
fa5311d
 
 
 
 
496fde2
fa5311d
 
 
48e6c05
fa5311d
 
496fde2
fa5311d
 
b808a9e
fa5311d
b0d9e5e
 
 
 
 
 
 
 
fa5311d
 
 
 
 
 
c7a5837
fa5311d
 
 
 
d3d5a98
fa5311d
 
496fde2
fa5311d
 
 
13105d9
 
 
 
 
 
 
 
fa5311d
496fde2
fa5311d
 
 
 
 
 
 
c7a5837
fa5311d
 
3bcb3c1
fa5311d
3bcb3c1
 
 
 
 
 
fa5311d
6c3740d
fa5311d
 
 
 
befc158
fa5311d
c7a5837
fa5311d
 
 
 
 
8c7b3c5
fa5311d
c7a5837
59a5da9
 
 
 
 
3bcb3c1
 
59a5da9
 
 
 
 
c7a5837
fa5311d
 
 
310146c
fa5311d
c7a5837
fa5311d
 
 
310146c
fa5311d
c7a5837
fa5311d
3affcf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fa5311d
b47191a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c7a5837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285c6bd
 
 
bd4b9b1
1d799ca
11586d5
 
1d799ca
 
 
 
 
 
 
 
eceb157
 
11586d5
1d799ca
 
 
 
 
 
 
 
b318dab
6c3740d
eceb157
11586d5
1d799ca
 
 
 
 
 
 
 
 
4fab6b9
 
 
 
bd4b9b1
4fab6b9
496fde2
4fab6b9
496fde2
 
a01bec3
4fab6b9
496fde2
4fab6b9
dda7cb6
496fde2
 
 
 
 
 
e448142
 
 
 
 
 
 
496fde2
 
4fab6b9
e448142
4fab6b9
 
 
5ef976d
 
 
cf8f9b7
5ef976d
4fab6b9
496fde2
 
 
 
514ad8d
 
496fde2
 
 
 
 
 
 
 
 
4fab6b9
 
a1589d6
4fab6b9
15f54c7
 
 
4fab6b9
6c3740d
496fde2
 
 
 
 
 
4fab6b9
 
374ecc4
 
4fab6b9
 
374ecc4
4fab6b9
 
 
ccae210
 
 
 
 
4fab6b9
 
 
83770ba
 
 
4fab6b9
 
 
83770ba
 
 
4fab6b9
 
b47191a
6f5a36d
eceb157
6f5a36d
b47191a
eceb157
b47191a
 
4fab6b9
bd4e502
6f5a36d
 
bd4e502
6f5a36d
b47191a
 
 
 
 
 
 
 
 
4fab6b9
 
 
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
import os
import datasets
import pandas as pd

_CITATION = """\
"""

# You can copy an official description
_DESCRIPTION = """\
"""

_HOMEPAGE = ""

_LICENSE = ""

_SUPERLIM_CITATION = """\
Yvonne Adesam, Aleksandrs Berdicevskis, Felix Morger (2020): SwedishGLUE – Towards a Swedish Test Set for Evaluating Natural Language Understanding Models BibTeX
[1] Original Absabank:
Jacobo Rouces, Lars Borin, Nina Tahmasebi (2020): Creating an Annotated Corpus for Aspect-Based Sentiment Analysis in Swedish, in Proceedings of the 5th conference in Digital Humanities in the Nordic Countries, Riga, Latvia, October 21-23, 2020. BibTeX
[2] DaLAJ:
Volodina, Elena, Yousuf Ali Mohammed, and Julia Klezl (2021). DaLAJ - a dataset for linguistic acceptability judgments for Swedish. In Proceedings of the 10th Workshop on Natural Language Processing for Computer Assisted Language Learning (NLP4CALL 2021). Linköping Electronic Conference Proceedings 177:3, s. 28-37. https://ep.liu.se/ecp/177/003/ecp2021177003.pdf
[3] Analogy:
Tosin Adewumi, Foteini Liwicki, Markus Liwicki. (2020). Corpora compared: The case of the Swedish Gigaword & Wikipedia corpora. In: Proceedings of the 8th SLTC, Gothenburg. arXiv preprint arXiv:2011.03281
[4] Swedish Test Set for SemEval 2020 Task 1:
Unsupervised Lexical Semantic Change Detection: Dominik Schlechtweg, Barbara McGillivray, Simon Hengchen, Haim Dubossarsky, Nina Tahmasebi (2020): SemEval-2020 Task 1: Unsupervised Lexical Semantic Change Detection, in Proceedings of the Fourteenth Workshop on Semantic Evaluation (SemEval2020), Barcelona, Spain (Online), December 12, 2020. BibTeX
[5] Winogender:
Saga Hansson, Konstantinos Mavromatakis, Yvonne Adesam, Gerlof Bouma and Dana Dannélls (2021). The Swedish Winogender Dataset. In The 23rd Nordic Conference on Computational Linguistics (NoDaLiDa 2021), Reykjavik.
[6] SuperSim:
Hengchen, Simon and Tahmasebi, Nina (2021). SuperSim: a test set for word similarity and relatedness in Swedish. In The 23rd Nordic Conference on Computational Linguistics (NoDaLiDa 2021), Reykjavik. arXiv preprint arXiv:2014.05228
"""

_SUPERLIM_DESCRIPTION = """\
SuperLim, A standardized suite for evaluation and analysis of Swedish natural language understanding systems.
"""
_ABSABank_imm_DESCRIPTION = """\
Absabank-Imm (where ABSA stands for "Aspect-Based Sentiment Analysis" and Imm for "Immigration") is a subset of the Swedish ABSAbank, created to be a part of the SuperLim collection. In Absabank-Imm, texts and paragraphs are manually labelled according to the sentiment (on 1--5 scale) that the author expresses towards immigration in Sweden (this task is known as aspect-based sentiment analysis or stance analysis). To create Absabank-Imm, the original Absabank has been substantially reformatted, but no changes to the annotation were made. The dataset contains 4872 short texts.
"""
_DaLAJ_DESCRIPTION = """\
Determine whether a sentence is correct Swedish or not.
"""
_DaLAJ_CITATION = """\
[1] Original Absabank:
Jacobo Rouces, Lars Borin, Nina Tahmasebi (2020): Creating an Annotated Corpus for Aspect-Based Sentiment Analysis in Swedish, in Proceedings of the 5th conference in Digital Humanities in the Nordic Countries, Riga, Latvia, October 21-23, 2020. BibTeX
[2] DaLAJ:
Volodina, Elena, Yousuf Ali Mohammed, and Julia Klezl (2021). DaLAJ - a dataset for linguistic acceptability judgments for Swedish. In Proceedings of the 10th Workshop on Natural Language Processing for Computer Assisted Language Learning (NLP4CALL 2021). Linköping Electronic Conference Proceedings 177:3, s. 28-37. https://ep.liu.se/ecp/177/003/ecp2021177003.pdf
"""

_SweAna_DESCRIPTION = """\
The Swedish analogy test set follows the format of the original Google version. However, it is bigger and balanced across the 2 major categories, 
having a total of 20,638 samples, made up of 10,381 semantic and 10,257 syntactic samples. It is also roughly balanced across the syntactic subsections. 
There are 5 semantic subsections and 6 syntactic subsections. The dataset was constructed, partly using the samples in the English version, 
with the help of tools dedicated to Swedish translation and it was proof-read for corrections by two native speakers (with a percentage agreement of 98.93\%)."""
_SweAna_CITATION = """\
[1] Original Absabank:
Jacobo Rouces, Lars Borin, Nina Tahmasebi (2020): Creating an Annotated Corpus for Aspect-Based Sentiment Analysis in Swedish, in Proceedings of the 5th conference in Digital Humanities in the Nordic Countries, Riga, Latvia, October 21-23, 2020. BibTeX
"""

_SweDiag_DESCRIPTION = """\
Färdig preliminär översättning av SuperGLUE diagnostik. Datan innehåller alla ursprungliga annoterade satspar från SuperGLUE tillsammans 
med deras svenska översättningar."""
_SweDiag_CITATION = """\
"""
_SweDN_DESCRIPTION = """\
AbstractThe SWE-DN corpus is based on 1,963,576 news articles from the Swedish newspaper Dagens Nyheter (DN) during the years 2000--2020. The articles are filtered to resemble the CNN/DailyMail dataset both regarding textual structure"""
_SweDiag_CITATION = """\
"""
_SweFaq_DESCRIPTION = """\
Vanliga frågor från svenska myndigheters webbsidor med svar i randomiserad ordning"""
_SweFaq_CITATION = """\
"""
_SweNLI_DESCRIPTION = """\
A textual inference/entailment problem set, derived from FraCas. The original English Fracas [1] was converted to html and edited by Bill MacCartney [2], 
and then automatically translated to Swedish by Peter Ljunglöf and Magdalena Siverbo [3]. The current tabular form of the set was created by Aleksandrs Berdicevskis 
by merging the Swedish and English versions and removing some of the problems. Finally, Lars Borin went through all the translations, correcting and Swedifying them manually. 
As a result, many translations are rather liberal and diverge noticeably from the English original."""
_SweFracas_CITATION = """\
  """
_SwePar_DESCRIPTION = """\
SweParaphrase is a subset of the automatically translated Swedish Semantic Textual Similarity dataset (Isbister and Sahlgren, 2020). 
It consists of 165 manually corrected Swedish sentence pairs paired with the original English sentences and their similarity scores 
ranging between 0 (no meaning overlap) and 5 (meaning equivalence). These scores were taken from the English data, they were assigned 
by Crowdsourcing through Mechanical Turk. Each sentence pair belongs to one genre (e.g. news, forums or captions). 
The task is to determine how similar two sentences are."""
_SwePar_CITATION = """\
"""
_SweSat_DESCRIPTION = """\
The dataset provides a gold standard for Swedish word synonymy/definition. The test items are collected from the Swedish Scholastic 
Aptitude Test (högskoleprovet), currently spanning the years 2006--2021 and 822 vocabulary test items. The task for the tested system 
is to determine which synonym or definition of five alternatives is correct for each test item.
"""
_SweSat_CITATION = """\
"""

_SweSim_DESCRIPTION = """\
SuperSim is a large-scale similarity and relatedness test set for Swedish built with expert human judgments. The test set is composed of 1360 word-pairs independently judged for both relatedness and similarity by five annotators."""

_SweWinogender_DESCRIPTION = """\
The SweWinogender test set is diagnostic dataset to measure gender bias in coreference resolution. It is modelled after the English Winogender benchmark, 
and is released with reference statistics on the distribution of men and women between occupations and the association between gender and occupation in modern corpus material."""

_SweWinograd_DESCRIPTION = """\
SweWinograd is a pronoun resolution test set, containing constructed items in the style of Winograd schema’s. The interpretation of the target pronouns is determined by (common sense) 
reasoning and knowledge, and not by syntactic constraints, lexical distributional information or discourse structuring patterns. 
The dataset contains 90 multiple choice with multiple correct answers test items."""

_SweWic_DESCRIPTION = """\
The Swedish Word-in-Context dataset provides a benchmark for evaluating distributional models of word meaning, in particular context-sensitive/dynamic models. Constructed following the principles of the (English)
 Word-in-Context dataset, SweWiC consists of 1000 sentence pairs, where each sentence in a pair contains an occurence of a potentially ambiguous focus word specific to that pair. The question posed to the tested 
 system is whether these two occurrences represent instances of the same word sense. There are 500 same-sense pairs and 500 different-sense pairs."""

_argumentation_sentences_DESCRIPTION = """\
Argumentation sentences is a translated corpus for the task of identifying stance in relation to a topic. It consists of sentences labeled with pro, con or non in relation to one of six topics. 
The original dataset can be found here https://github.com/trtm/AURC.  The test set is manually corrected translations, the training set is machine translated. """

_argumentation_sentences_DESCRIPTION_CITATION = """\
"""

_RELEASE_VERSION = "2.0.4"
_GH_REPOSITORY = "https://raw.githubusercontent.com/spraakbanken/SuperLim-2/"
_URL = f"{_GH_REPOSITORY}/{_RELEASE_VERSION}/"

_TASKS = {
    "absabank-imm": "absabank-imm",
    "argumentation_sent":"argumentation-sentences",
    "dalaj-ged": "dalaj-ged-superlim",
    "sweana": "sweanalogy",
    "swediagnostics": "swediagnostics",
    "swedn": "swedn",
    "swefaq": "swefaq",
    "swenli": "swenli",
    "swepar": "sweparaphrase",
    "swesat": "swesat-synonyms",
    "swesim_relatedness": "supersim-superlim-relatedness",
    "swesim_similarity": "supersim-superlim-similarity",
    "swewic": "swewic",
    "swewinogender": "swewinogender",
    "swewinograd": "swewinograd"

}

class SuperLimConfig(datasets.BuilderConfig):
    """BuilderConfig for SuperLim."""

    def __init__(self, features, data_url, citation, url, label_classes=("False", "True"), **kwargs):
        """BuilderConfig for SuperLim.

        Args:
        features: `list[string]`, list of the features that will appear in the
            feature dict. Should not include "label".
        data_url: `string`, url to download the zip file from.
        citation: `string`, citation for the data set.
        url: `string`, url for information about the data set.
        label_classes: `list[string]`, the list of classes for the label if the
            label is present as a string. Non-string labels will be cast to either
            'False' or 'True'.
        **kwargs: keyword arguments forwarded to super.
        """
        # Version history:
        # 1.0.2: Fixed non-nondeterminism in ReCoRD.
        # 1.0.1: Change from the pre-release trial version of SuperLim (v1.9) to
        #        the full release (v2.0).
        # 1.0.0: S3 (new shuffling, sharding and slicing mechanism).
        # 0.0.2: Initial version.
        super(SuperLimConfig, self).__init__(version=datasets.Version("2.0.0"), **kwargs)
        self.features = features
        self.label_classes = label_classes
        self.data_url = data_url
        self.citation = citation
        self.url = url

class SuperLim(datasets.GeneratorBasedBuilder):
    """The SuperLim benchmark."""

    VERSION = datasets.Version("2.0.3")

    BUILDER_CONFIGS = [
        datasets.BuilderConfig(name="absabank-imm", version=VERSION, description=_ABSABank_imm_DESCRIPTION),
        datasets.BuilderConfig(name="argumentation_sent", version=VERSION, description=_argumentation_sentences_DESCRIPTION),
        datasets.BuilderConfig(name="dalaj-ged", version=VERSION, description=_DaLAJ_DESCRIPTION),
        datasets.BuilderConfig(name="sweana", version=VERSION, description=_SweAna_DESCRIPTION),
        datasets.BuilderConfig(name="swediagnostics", version=VERSION, description=_SweDiag_DESCRIPTION),
        datasets.BuilderConfig(name="swedn", version=VERSION, description=_SweDN_DESCRIPTION),
        datasets.BuilderConfig(name="swefaq", version=VERSION, description=_SweFaq_DESCRIPTION),
        datasets.BuilderConfig(name="swenli", version=VERSION, description=_SweNLI_DESCRIPTION),
        datasets.BuilderConfig(name="swepar", version=VERSION, description=_SwePar_DESCRIPTION),
        datasets.BuilderConfig(name="swesat", version=VERSION, description=_SweSat_DESCRIPTION),
        datasets.BuilderConfig(name="swesim_relatedness", version=VERSION, description=_SweSim_DESCRIPTION),
        datasets.BuilderConfig(name="swesim_similarity", version=VERSION, description=_SweSim_DESCRIPTION),
        datasets.BuilderConfig(name="swewic", version=VERSION, description=_SweWic_DESCRIPTION),
        datasets.BuilderConfig(name="swewinogender", version=VERSION, description=_SweWinogender_DESCRIPTION),
        datasets.BuilderConfig(name="swewinograd", version=VERSION, description=_SweWinograd_DESCRIPTION)
    ]

    def _info(self):
        # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
        if self.config.name == 'absabank-imm': # This is the name of the configuration selected in BUILDER_CONFIGS above
            features = datasets.Features({
                "id": datasets.Value("string"),
                "text": datasets.Value("string"),
                "label": datasets.Value(dtype='float32')
            })
        elif self.config.name == 'argumentation_sent':
            features = datasets.Features({
                "sentence_id": datasets.Value("string"),
                "topic": datasets.Value("string"),
                "label": datasets.ClassLabel(num_classes=3, names=['pro', 'con', 'non']),
                "sentence": datasets.Value("string")
            })
        elif self.config.name == "dalaj-ged":
            features = datasets.Features({
                "sentence": datasets.Value("string"),
                "label": datasets.ClassLabel(num_classes=2, names=['correct', 'incorrect']),
                "meta": datasets.Features({
                   'error_span': datasets.Features({
                        'start': datasets.Value(dtype='int64'),
                        'stop': datasets.Value(dtype='int64')
                    }),
                    'confusion_pair': datasets.Features({
                        'incorrect_span': datasets.Value("string"),
                        'correction': datasets.Value('string')
                    }),
                    'error_label': datasets.Value("string"),
                    'education_level': datasets.Value("string"),
                    'l1': datasets.Value("string"),
                    'data_source': datasets.Value("string")
                })
            })
        elif self.config.name == "sweana":
            features = datasets.Features({
                "pair1_element1": datasets.Value("string"),
                "pair1_element2": datasets.Value("string"),
                "pair2_element1": datasets.Value("string"),
                "label": datasets.Value("string"),
                "category": datasets.Value("string"),
            })
        elif self.config.name == 'swediagnostics':
            features = datasets.Features({
                'premise': datasets.Value("string"),
                'hypothesis': datasets.Value("string"),
                'label': datasets.ClassLabel(num_classes=3, names=['entailment', 'contradiction', 'neutral']),
                'meta': datasets.Features({
                    'lexical_semantics': datasets.Value("string"), 
                    'predicate_argument_structure': datasets.Value("string"),
                    'logic': datasets.Value("string"),
                    'knowledge': datasets.Value("string"),
                    'domain': datasets.Value("string")
                })
            })
        elif self.config.name == 'swedn':
            features = datasets.Features({
                "id": datasets.Value("string"),
                "headline": datasets.Value("string"),
                "summary": datasets.Value("string"),
                "article": datasets.Value("string"),
                "article_category": datasets.Value("string")
            })
        elif self.config.name == "swefaq":
            features = datasets.Features({
                "category_id": datasets.Value("string"),
                "candidate_answers": datasets.Sequence(datasets.Value("string")),
                "question": datasets.Value("string"),
                "label": datasets.Value(dtype='int32'),
                "meta": datasets.Features({
                    "category": datasets.Value("string"),
                    "source": datasets.Value("string"),
                    "link": datasets.Value("string"),
                })
            })
        elif self.config.name == 'swenli':
            features = datasets.Features({
                "id": datasets.Value("string"),
                "premise": datasets.Value("string"),
                "hypothesis": datasets.Value("string"),
                "label": datasets.ClassLabel(num_classes=3, names=['entailment', 'contradiction', 'neutral'])
            })
        elif self.config.name == "swepar":
            features = datasets.Features({
                "genre": datasets.Value("string"),
                "file": datasets.Value("string"),
                "sentence_1": datasets.Value("string"),
                "sentence_2": datasets.Value("string"),
                "label": datasets.Value(dtype='float32'),
            })
        elif self.config.name == "swesat":
            features = datasets.Features({
                "id": datasets.Value("string"),
                "item": datasets.Value("string"),
                "candidate_answers": datasets.Sequence(
                    datasets.Value("string"),
                    length=5
                ),
                "label": datasets.ClassLabel(5),
                "meta": datasets.Features({
                    "comment": datasets.Value("string")
                })
            })
        elif self.config.name == "swesim_relatedness":
            features = datasets.Features({
                "word_1": datasets.Value("string"),
                "word_2": datasets.Value("string"),
                "label": datasets.Value(dtype='float32')
            })
        elif self.config.name == "swesim_similarity":
            features = datasets.Features({
                "word_1": datasets.Value("string"),
                "word_2": datasets.Value("string"),
                "label": datasets.Value(dtype='float32')
            })
        elif self.config.name == "swewic":
            features = datasets.Features({
                "idx": datasets.Value(dtype='int32'),
                "first": datasets.Features({
                    "context": datasets.Value("string"),
                    "word": datasets.Features({
                        "location": datasets.Features({
                            "start": datasets.Value(dtype='int32'),
                            "stop": datasets.Value(dtype='int32')
                        }),
                        "text": datasets.Value("string")
                    })
                }),
                "second": datasets.Features({
                    "context": datasets.Value("string"),
                    "word": datasets.Features({
                        "location": datasets.Features({
                            "start": datasets.Value(dtype='int32'),
                            "stop": datasets.Value(dtype='int32')
                        }),
                        "text": datasets.Value("string")
                    })
                }),
                "label": datasets.ClassLabel(num_classes=2, names=['same_sense', 'different_sense']),
                "meta": datasets.Features({
                    "first_source": datasets.Value("string"),
                    "first_sense_id": datasets.Value("string"),
                    "second_source": datasets.Value("string"),
                    "second_sense_id": datasets.Value("string"),
                    "pos": datasets.Value("string")
                })
            })
        elif self.config.name == 'swewinogender':
            features = datasets.Features({
                "idx": datasets.Value(dtype='int32'),
                'premise': datasets.Value("string"),
                'hypothesis': datasets.Value("string"),
                'label': datasets.ClassLabel(num_classes=3, names=['entailment', 'contradiction', 'neutral']),
                'meta': datasets.Features({
                    'tuple_id': datasets.Value("string"),
                    'template_id': datasets.Value("string"),
                    'occupation_participant': datasets.Value("string"),
                    'other_participant': datasets.Value("string"),
                    'pronoun': datasets.Value("string")
                })
            })
        elif self.config.name == 'swewinograd':
            features = datasets.Features({
                "idx": datasets.Value(dtype='int32'),
                'text': datasets.Value("string"),
                'label': datasets.ClassLabel(num_classes=2, names=['not_coreferring', 'coreferring']),
                'pronoun': datasets.Features({
                    'text': datasets.Value("string"),
                    'location': datasets.Features({
                        "start": datasets.Value(dtype='int32'),
                        "stop": datasets.Value(dtype='int32')
                    })
                }),
                'candidate_antecedent': datasets.Features({
                    "text": datasets.Value("string"),
                    'location': datasets.Features({
                        "start": datasets.Value(dtype='int32'),
                        "stop": datasets.Value(dtype='int32')
                    })
                }),
                'meta': datasets.Features({
                    'snippet_id': datasets.Value("string")
                })
            })
        else:
            raise ValueError(f"Subset {self.config.name} does not exist.")
        return datasets.DatasetInfo(
            # This is the description that will appear on the datasets page.
            description=_DESCRIPTION,
            # This defines the different columns of the dataset and their types
            features=features,  # Here  define them above because they are different between the two configurations
            # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
            # specify them. They'll be used if as_supervised=True in builder.as_dataset.
            # supervised_keys=("sentence", "label"),
            # Homepage of the dataset for documentation
            homepage=_HOMEPAGE,
            # License for the dataset if available
            license=_LICENSE,
            # Citation for the dataset
            citation=_CITATION,
        )

    def _split_generators(self, dl_manager):
        file_format = 'jsonl'
        splits = []
        DATA_FOLDER = 'supersim-superlim' if self.config.name.startswith('swesim') else _TASKS[self.config.name]
        data_dir_test = dl_manager.download_and_extract(os.path.join(_URL,DATA_FOLDER,f"{_TASKS[self.config.name]}_test.{file_format}"))
        split_test = datasets.SplitGenerator(
            name=datasets.Split.TEST,
            gen_kwargs={
                "filepath": data_dir_test,
                "split": "test"
            },
        )
        splits.append(split_test)
        if self.config.name in ("absabank-imm", "argumentation_sent", "dalaj-ged", "swefaq",
                                "swewic", "swenli", "swedn", "swepar", "swewinograd"):
            data_dir_dev = dl_manager.download_and_extract(os.path.join(_URL,DATA_FOLDER,f"{_TASKS[self.config.name]}_dev.{file_format}"))
            split_dev = datasets.SplitGenerator(
                name=datasets.Split.VALIDATION,
                gen_kwargs={
                    "filepath": data_dir_dev,
                    "split": "dev",
                },
            )
            splits.append(split_dev)
        if self.config.name in ("absabank-imm", "argumentation_sent", "dalaj-ged", "swefaq",
                                "swewic", "swenli", "swedn", "swepar", "swesim_relatedness",
                                "swesim_similarity", "swesat", "sweana", "swewinograd"):
            data_dir_train = dl_manager.download_and_extract(os.path.join(_URL,DATA_FOLDER,f"{_TASKS[self.config.name]}_train.{file_format}"))
            split_train = datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                gen_kwargs={
                    "filepath": data_dir_train,
                    "split": "train",
                },
            )
            splits.append(split_train)
        return splits

    def _generate_examples(self, filepath, split):
        # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
        # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
        df = pd.read_json(filepath, lines=True)
        for key, row in df.iterrows():
            if self.config.name == "absabank-imm":
                yield key, {
                    "id": row['id'],
                    "text": row["text"],
                    "label": row["label"],
                }
            elif self.config.name == "argumentation_sent":
                yield key, {
                    "sentence_id": row["sentence_id"],
                    "topic": row["topic"],
                    "label": row["label"],
                    "sentence" : row["sentence"],
                }
            elif self.config.name == "dalaj-ged":
            # Yields examples as (key, example) tuples
                meta = row['meta']
                # Add None values when error span and confusion_pair values are missing.
                if not meta['error_span'] and not meta['confusion_pair']:
                    meta['error_span']['start'] = None
                    meta['error_span']['stop'] = None
                    meta['confusion_pair']['incorrect_span'] = None
                    meta['confusion_pair']['correction'] = None
                yield key, {
                    "sentence": row["sentence"],
                    "label": row["label"],
                    "meta": meta,
                }
            elif self.config.name == "sweana":
                yield key, {
                    "pair1_element1": row["pair1_element1"],
                    "pair1_element2": row["pair1_element2"],
                    "pair2_element1": row["pair2_element1"],
                    "label": row["label"],
                    "category": row["category"],
                }
            elif self.config.name == "swediagnostics":
                yield key, {
                    'premise': row['premise'],
                    'hypothesis': row['hypothesis'],
                    'label': row['label'],
                    'meta': row['meta'],
                }
            elif self.config.name == "swedn":
                yield key, {
                    'id': row['id'],
                    'headline': row['headline'],
                    'summary': row['summary'],
                    'article': row['article'],
                    'article_category': row['article_category']
                }
            elif self.config.name == "swefaq":
                yield key, {
                    "category_id": row['category_id'],
                    "question": row["question"],
                    "candidate_answers": row['candidate_answers'],
                    "label": row["label"],
                    "meta": row['meta'],
                }
            elif self.config.name == "swenli":
                yield key, {
                    'id': row['id'],
                    'premise': row['premise'],
                    'hypothesis': row['hypothesis'],
                    'label': row['label']
                }
            elif self.config.name == "swepar":
                yield key, {
                    "genre": row["genre"],
                    "file": row["file"],
                    "sentence_1": row["sentence_1"],
                    "sentence_2": row["sentence_2"],
                    "label": row["label"],
                }
            elif self.config.name == "swesat":
                yield key, {
                    "id": row["id"],
                    "item": row["item"],
                    "candidate_answers": row["candidate_answers"],
                    "label": row["label"],
                    "meta": row["meta"],
                }
            elif self.config.name == "swesim_relatedness":
                yield key, {
                    "word_1": row["word_1"],
                    "word_2": row["word_2"],
                    "label": row["label"],
                }
            elif self.config.name == "swesim_similarity":
                yield key, {
                    "word_1": row["word_1"],
                    "word_2": row["word_2"],
                    "label": row["label"],
                }
            elif self.config.name == "swewic":
                yield key, {
                    "idx": row["idx"],
                    "first": row["first"],
                    "second": row["second"],
                    "label": row["label"],
                    "meta": row["meta"],
                }
            elif self.config.name == "swewinogender":
                yield key, {
                    "idx": row["idx"],
                    "premise": row["premise"],
                    "hypothesis": row["hypothesis"],
                    "label": row["label"],
                    "meta": row["meta"],
                }
            elif self.config.name == "swewinograd":
                yield key, {
                    "idx": row["idx"],
                    "text": row["text"],
                    "label": row["label"],
                    "pronoun": row["pronoun"],
                    "candidate_antecedent": row["candidate_antecedent"],
                    "meta": row["meta"]
                }
            else:
                raise ValueError(f"Subset {self.config.name} does not exist")