File size: 3,919 Bytes
dd19425 |
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 |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import csv
import datasets
_CITATION = """\
@inproceedings{inproceedings,
author = {Ek, Adam and Noble, Bill and Chatzikyriakidis, Stergios and Cooper, Robin and Dobnik, Simon and Gregoromichelaki, Eleni and Howes, Christine and Larsson, Staffan and Maraev, Vladislav and Mills, Gregory and Wijnholds, Gijs},
year = {2024},
month = {08},
pages = {},
title = {I hea-umm think that's what they say: A Dataset of Inferences from Natural Language Dialogues}
}
"""
_DESCRIPTION = """\
DNLI is a dataset for NLI in transcripts of spoken dialogues"""
_HOMEPAGE = "https://github.com/GU-CLASP/DNLI/tree/main"
_LICENSE = "MIT"
_URLS_prefix = {
"dnli" : "https://github.com/GU-CLASP/DNLI/blob/main/data/compiled"
}
_URLS = {
"test_1": {
"test": _URLS_prefix["dnli"] + "/test_1_data.csv"
},
"test_2": {
"test": _URLS_prefix["dnli"] + "/test_2_data.csv"
},
"test_3": {
"test": _URLS_prefix["dnli"] + "/test_3_data.csv"
},
"test_4": {
"test": _URLS_prefix["dnli"] + "/test_4_data.csv"
},
"test_5": {
"test": _URLS_prefix["dnli"] + "/test_5_data.csv"
},
"test_6": {
"test": _URLS_prefix["dnli"] + "/test_6_data.csv"
},
"test_7": {
"test": _URLS_prefix["dnli"] + "/test_7_data.csv"
},
"test_8": {
"test": _URLS_prefix["dnli"] + "/test_8_data.csv"
},
"test_9": {
"test": _URLS_prefix["dnli"] + "/test_9_data.csv"
},
"test_10": {
"test": _URLS_prefix["dnli"] + "/test_10_data.csv"
},
"test_11": {
"test": _URLS_prefix["dnli"] + "/test_11_data.csv"
},
"test_12": {
"test": _URLS_prefix["dnli"] + "/test_12_data.csv"
},
"test_13": {
"test": _URLS_prefix["dnli"] + "/test_13_data.csv"
},
"test_14": {
"test": _URLS_prefix["dnli"] + "/test_14_data.csv"
},
"test_15": {
"test": _URLS_prefix["dnli"] + "/test_15_data.csv"
},
}
class DNLI(datasets.GeneratorBasedBuilder):
""" DNLI is a dataset for NLI in transcripts of spoken dialogues
"""
BUILDER_CONFIGS = [
datasets.BuilderConfig(
name=config_name,
version=datasets.Version("0.0.1"),
description=f"{config_name}"
)
for config_name in _URLS.keys()
]
def _info(self):
features = {
"hypothesis": datasets.Value("string"),
"premise": datasets.Value("string"),
"label": datasets.Value("string"),
}
def _split_generators(self, dl_manager):
urls = _URLS[self.config.name]
data_dir = dl_manager.download_and_extract(urls)
return [
datasets.SplitGenerator(
name = datasets.Split.TEST,
gen_kwargs = {
"filepath" : data_dir["test"],
"split" : "test",
}
)
]
def _generate_examples(self, filepath, split):
with open(filepath, encoding="utf-8") as fin:
reader = csv.reader(fin, delimiter='\t')
for idx, row in enumerate(reader):
yield idx, {
"hypothesis": row[0],
"premise": row[1],
"label": row[2]
} |