Datasets:
Tasks:
Multiple Choice
Sub-tasks:
multiple-choice-coreference-resolution
Languages:
English
Size:
n<1K
ArXiv:
License:
Commit
•
1e21651
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/0.1.0/dummy_data.zip +3 -0
- mwsc.py +122 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "Examples taken from the Winograd Schema Challenge modified to ensure that answers are a single word from the context.\nThis modified Winograd Schema Challenge (MWSC) ensures that scores are neither inflated nor deflated by oddities in phrasing.\n", "citation": "@article{McCann2018decaNLP,\n title={The Natural Language Decathlon: Multitask Learning as Question Answering},\n author={Bryan McCann and Nitish Shirish Keskar and Caiming Xiong and Richard Socher},\n journal={arXiv preprint arXiv:1806.08730},\n year={2018}\n}\n", "homepage": "http://decanlp.com", "license": "", "features": {"sentence": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "options": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "mwsc", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 11022, "num_examples": 80, "dataset_name": "mwsc"}, "test": {"name": "test", "num_bytes": 15220, "num_examples": 100, "dataset_name": "mwsc"}, "validation": {"name": "validation", "num_bytes": 13109, "num_examples": 82, "dataset_name": "mwsc"}}, "download_checksums": {"https://raw.githubusercontent.com/salesforce/decaNLP/1e9605f246b9e05199b28bde2a2093bc49feeeaa/local_data/schema.txt": {"num_bytes": 19197, "checksum": "31da9bee05796bbe0f6c957f54d1eb82eb5c644a8ee59f2ff1fa890eff3885dd"}}, "download_size": 19197, "dataset_size": 39351, "size_in_bytes": 58548}}
|
dummy/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:59036cd4e01170c8ff1a1e5c078698469aa453884dd1cfb69305e46e8806196f
|
3 |
+
size 478
|
mwsc.py
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""A modification of the Winograd Schema Challenge to ensure answers are a single context word"""
|
2 |
+
from __future__ import absolute_import, division, print_function
|
3 |
+
|
4 |
+
import os
|
5 |
+
import re
|
6 |
+
|
7 |
+
import datasets
|
8 |
+
|
9 |
+
|
10 |
+
_CITATION = """\
|
11 |
+
@article{McCann2018decaNLP,
|
12 |
+
title={The Natural Language Decathlon: Multitask Learning as Question Answering},
|
13 |
+
author={Bryan McCann and Nitish Shirish Keskar and Caiming Xiong and Richard Socher},
|
14 |
+
journal={arXiv preprint arXiv:1806.08730},
|
15 |
+
year={2018}
|
16 |
+
}
|
17 |
+
"""
|
18 |
+
|
19 |
+
_DESCRIPTION = """\
|
20 |
+
Examples taken from the Winograd Schema Challenge modified to ensure that answers are a single word from the context.
|
21 |
+
This modified Winograd Schema Challenge (MWSC) ensures that scores are neither inflated nor deflated by oddities in phrasing.
|
22 |
+
"""
|
23 |
+
|
24 |
+
_DATA_URL = "https://raw.githubusercontent.com/salesforce/decaNLP/1e9605f246b9e05199b28bde2a2093bc49feeeaa/local_data/schema.txt"
|
25 |
+
# Alternate: https://s3.amazonaws.com/research.metamind.io/decaNLP/data/schema.txt
|
26 |
+
|
27 |
+
|
28 |
+
class MWSC(datasets.GeneratorBasedBuilder):
|
29 |
+
"""MWSC: modified Winograd Schema Challenge"""
|
30 |
+
|
31 |
+
VERSION = datasets.Version("0.1.0")
|
32 |
+
|
33 |
+
def _info(self):
|
34 |
+
return datasets.DatasetInfo(
|
35 |
+
description=_DESCRIPTION,
|
36 |
+
features=datasets.Features(
|
37 |
+
{
|
38 |
+
"sentence": datasets.Value("string"),
|
39 |
+
"question": datasets.Value("string"),
|
40 |
+
"options": datasets.features.Sequence(datasets.Value("string")),
|
41 |
+
"answer": datasets.Value("string"),
|
42 |
+
}
|
43 |
+
),
|
44 |
+
# If there's a common (input, target) tuple from the features,
|
45 |
+
# specify them here. They'll be used if as_supervised=True in
|
46 |
+
# builder.as_dataset.
|
47 |
+
supervised_keys=None,
|
48 |
+
# Homepage of the dataset for documentation
|
49 |
+
homepage="http://decanlp.com",
|
50 |
+
citation=_CITATION,
|
51 |
+
)
|
52 |
+
|
53 |
+
def _split_generators(self, dl_manager):
|
54 |
+
"""Returns SplitGenerators."""
|
55 |
+
schemas_file = dl_manager.download_and_extract(_DATA_URL)
|
56 |
+
|
57 |
+
if os.path.isdir(schemas_file):
|
58 |
+
# During testing the download manager mock gives us a directory
|
59 |
+
schemas_file = os.path.join(schemas_file, "schema.txt")
|
60 |
+
|
61 |
+
return [
|
62 |
+
datasets.SplitGenerator(
|
63 |
+
name=datasets.Split.TRAIN,
|
64 |
+
gen_kwargs={"filepath": schemas_file, "split": "train"},
|
65 |
+
),
|
66 |
+
datasets.SplitGenerator(
|
67 |
+
name=datasets.Split.TEST,
|
68 |
+
gen_kwargs={"filepath": schemas_file, "split": "test"},
|
69 |
+
),
|
70 |
+
datasets.SplitGenerator(
|
71 |
+
name=datasets.Split.VALIDATION,
|
72 |
+
gen_kwargs={"filepath": schemas_file, "split": "dev"},
|
73 |
+
),
|
74 |
+
]
|
75 |
+
|
76 |
+
def _get_both_schema(self, context):
|
77 |
+
"""Split [option1/option2] into 2 sentences.
|
78 |
+
From https://github.com/salesforce/decaNLP/blob/1e9605f246b9e05199b28bde2a2093bc49feeeaa/text/torchtext/datasets/generic.py#L815-L827"""
|
79 |
+
pattern = r"\[.*\]"
|
80 |
+
variations = [x[1:-1].split("/") for x in re.findall(pattern, context)]
|
81 |
+
splits = re.split(pattern, context)
|
82 |
+
results = []
|
83 |
+
for which_schema in range(2):
|
84 |
+
vs = [v[which_schema] for v in variations]
|
85 |
+
context = ""
|
86 |
+
for idx in range(len(splits)):
|
87 |
+
context += splits[idx]
|
88 |
+
if idx < len(vs):
|
89 |
+
context += vs[idx]
|
90 |
+
results.append(context)
|
91 |
+
return results
|
92 |
+
|
93 |
+
def _generate_examples(self, filepath, split):
|
94 |
+
"""Yields examples."""
|
95 |
+
|
96 |
+
schemas = []
|
97 |
+
with open(filepath, encoding="utf-8") as schema_file:
|
98 |
+
schema = []
|
99 |
+
for line in schema_file:
|
100 |
+
if len(line.split()) == 0:
|
101 |
+
schemas.append(schema)
|
102 |
+
schema = []
|
103 |
+
continue
|
104 |
+
else:
|
105 |
+
schema.append(line.strip())
|
106 |
+
|
107 |
+
# Train/test/dev split from decaNLP code
|
108 |
+
splits = {}
|
109 |
+
traindev = schemas[:-50]
|
110 |
+
splits["test"] = schemas[-50:]
|
111 |
+
splits["train"] = traindev[:40]
|
112 |
+
splits["dev"] = traindev[40:]
|
113 |
+
|
114 |
+
idx = 0
|
115 |
+
for schema in splits[split]:
|
116 |
+
sentence, question, answers = schema
|
117 |
+
sentence = self._get_both_schema(sentence)
|
118 |
+
question = self._get_both_schema(question)
|
119 |
+
answers = answers.split("/")
|
120 |
+
for i in range(2):
|
121 |
+
yield idx, {"sentence": sentence[i], "question": question[i], "options": answers, "answer": answers[i]}
|
122 |
+
idx += 1
|