Felix
commited on
Commit
·
b47191a
1
Parent(s):
6c3740d
add winogender and winograd
Browse files- superlim-2.py +62 -5
superlim-2.py
CHANGED
|
@@ -94,11 +94,11 @@ _SweSat_CITATION = """\
|
|
| 94 |
_SweSim_DESCRIPTION = """\
|
| 95 |
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."""
|
| 96 |
|
| 97 |
-
|
| 98 |
The SweWinogender test set is diagnostic dataset to measure gender bias in coreference resolution. It is modelled after the English Winogender benchmark,
|
| 99 |
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."""
|
| 100 |
|
| 101 |
-
|
| 102 |
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)
|
| 103 |
reasoning and knowledge, and not by syntactic constraints, lexical distributional information or discourse structuring patterns.
|
| 104 |
The dataset contains 90 multiple choice with multiple correct answers test items."""
|
|
@@ -129,7 +129,10 @@ _TASKS = {
|
|
| 129 |
"swesat": "swesat-synonyms",
|
| 130 |
"swesim_relatedness": "supersim-superlim-relatedness",
|
| 131 |
"swesim_similarity": "supersim-superlim-similarity",
|
| 132 |
-
"swewic": "swewic"
|
|
|
|
|
|
|
|
|
|
| 133 |
}
|
| 134 |
|
| 135 |
class SuperLimConfig(datasets.BuilderConfig):
|
|
@@ -324,6 +327,43 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
| 324 |
"pos": datasets.Value("string")
|
| 325 |
})
|
| 326 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
else:
|
| 328 |
raise ValueError(f"Subset {self.config.name} does not exist.")
|
| 329 |
return datasets.DatasetInfo(
|
|
@@ -471,12 +511,29 @@ class SuperLim(datasets.GeneratorBasedBuilder):
|
|
| 471 |
"label": row["label"],
|
| 472 |
}
|
| 473 |
elif self.config.name == "swewic":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
yield key, {
|
| 475 |
"idx": row["idx"],
|
| 476 |
-
"
|
| 477 |
"second": row["second"],
|
| 478 |
"label": row["label"],
|
| 479 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
}
|
| 481 |
else:
|
| 482 |
raise ValueError(f"Subset {self.config.name} does not exist")
|
|
|
|
| 94 |
_SweSim_DESCRIPTION = """\
|
| 95 |
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."""
|
| 96 |
|
| 97 |
+
_SweWinogender_DESCRIPTION = """\
|
| 98 |
The SweWinogender test set is diagnostic dataset to measure gender bias in coreference resolution. It is modelled after the English Winogender benchmark,
|
| 99 |
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."""
|
| 100 |
|
| 101 |
+
_SweWinograd_DESCRIPTION = """\
|
| 102 |
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)
|
| 103 |
reasoning and knowledge, and not by syntactic constraints, lexical distributional information or discourse structuring patterns.
|
| 104 |
The dataset contains 90 multiple choice with multiple correct answers test items."""
|
|
|
|
| 129 |
"swesat": "swesat-synonyms",
|
| 130 |
"swesim_relatedness": "supersim-superlim-relatedness",
|
| 131 |
"swesim_similarity": "supersim-superlim-similarity",
|
| 132 |
+
"swewic": "swewic",
|
| 133 |
+
"swewinogender": "swewinogender",
|
| 134 |
+
"swewinograd": "swewinograd"
|
| 135 |
+
|
| 136 |
}
|
| 137 |
|
| 138 |
class SuperLimConfig(datasets.BuilderConfig):
|
|
|
|
| 327 |
"pos": datasets.Value("string")
|
| 328 |
})
|
| 329 |
})
|
| 330 |
+
elif self.config.name == 'swewinogender':
|
| 331 |
+
features = datasets.Features({
|
| 332 |
+
"idx": datasets.Value(dtype='int32'),
|
| 333 |
+
'premise': datasets.Value("string"),
|
| 334 |
+
'hypothesis': datasets.Value("string"),
|
| 335 |
+
'label': datasets.ClassLabel(num_classes=3, names=['entailment', 'contradiction', 'neutral']),
|
| 336 |
+
'meta': datasets.Features({
|
| 337 |
+
'tuple_id': datasets.Value("string"),
|
| 338 |
+
'template_id': datasets.Value("string"),
|
| 339 |
+
'occupation_participant': datasets.Value("string"),
|
| 340 |
+
'other_participant': datasets.Value("string"),
|
| 341 |
+
'pronoun': datasets.Value("string")
|
| 342 |
+
})
|
| 343 |
+
})
|
| 344 |
+
elif self.config.name == 'swewinograd':
|
| 345 |
+
features = datasets.Features({
|
| 346 |
+
"idx": datasets.Value(dtype='int32'),
|
| 347 |
+
'text': datasets.Value("string"),
|
| 348 |
+
'label': datasets.ClassLabel(num_classes=2, names=['not_coreferring', 'coreferring']),
|
| 349 |
+
'pronoun': datasets.Features({
|
| 350 |
+
'text': datasets.Value("string"),
|
| 351 |
+
'location': datasets.Features({
|
| 352 |
+
"start": datasets.Value(dtype='int32'),
|
| 353 |
+
"stop": datasets.Value(dtype='int32')
|
| 354 |
+
})
|
| 355 |
+
}),
|
| 356 |
+
'candidate_antecedent': datasets.Features({
|
| 357 |
+
"text": datasets.Value("string"),
|
| 358 |
+
'location': datasets.Features({
|
| 359 |
+
"start": datasets.Value(dtype='int32'),
|
| 360 |
+
"stop": datasets.Value(dtype='int32')
|
| 361 |
+
})
|
| 362 |
+
}),
|
| 363 |
+
'meta': datasets.Features({
|
| 364 |
+
'snippet_id': datasets.Value("string")
|
| 365 |
+
})
|
| 366 |
+
})
|
| 367 |
else:
|
| 368 |
raise ValueError(f"Subset {self.config.name} does not exist.")
|
| 369 |
return datasets.DatasetInfo(
|
|
|
|
| 511 |
"label": row["label"],
|
| 512 |
}
|
| 513 |
elif self.config.name == "swewic":
|
| 514 |
+
yield key, {
|
| 515 |
+
"premise": row["premise"],
|
| 516 |
+
"hypothesis": row["hypothesis"],
|
| 517 |
+
"label": row["label"],
|
| 518 |
+
"label": row["label"],
|
| 519 |
+
"meta": row["meta"],
|
| 520 |
+
}
|
| 521 |
+
elif self.config.name == "swewinogender":
|
| 522 |
yield key, {
|
| 523 |
"idx": row["idx"],
|
| 524 |
+
"text": row["text"],
|
| 525 |
"second": row["second"],
|
| 526 |
"label": row["label"],
|
| 527 |
+
"pronoun": row["pronoun"],
|
| 528 |
+
}
|
| 529 |
+
elif self.config.name == "swewinograd":
|
| 530 |
+
yield key, {
|
| 531 |
+
"idx": row["idx"],
|
| 532 |
+
"text": row["text"],
|
| 533 |
+
"label": row["label"],
|
| 534 |
+
"pronoun": row["pronoun"],
|
| 535 |
+
"candidate_antecedent": row["candidate_antecedent"],
|
| 536 |
+
"meta": row["meta"]
|
| 537 |
}
|
| 538 |
else:
|
| 539 |
raise ValueError(f"Subset {self.config.name} does not exist")
|