|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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] |
|
} |