Datasets:

License:
momentino commited on
Commit
dd19425
·
verified ·
1 Parent(s): a9b4977

Upload dnli.py

Browse files
Files changed (1) hide show
  1. dnli.py +131 -0
dnli.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ import csv
17
+ import datasets
18
+
19
+
20
+ _CITATION = """\
21
+ @inproceedings{inproceedings,
22
+ 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},
23
+ year = {2024},
24
+ month = {08},
25
+ pages = {},
26
+ title = {I hea-umm think that's what they say: A Dataset of Inferences from Natural Language Dialogues}
27
+ }
28
+ """
29
+
30
+ _DESCRIPTION = """\
31
+ DNLI is a dataset for NLI in transcripts of spoken dialogues"""
32
+
33
+ _HOMEPAGE = "https://github.com/GU-CLASP/DNLI/tree/main"
34
+
35
+ _LICENSE = "MIT"
36
+
37
+
38
+ _URLS_prefix = {
39
+ "dnli" : "https://github.com/GU-CLASP/DNLI/blob/main/data/compiled"
40
+ }
41
+ _URLS = {
42
+ "test_1": {
43
+ "test": _URLS_prefix["dnli"] + "/test_1_data.csv"
44
+ },
45
+ "test_2": {
46
+ "test": _URLS_prefix["dnli"] + "/test_2_data.csv"
47
+ },
48
+ "test_3": {
49
+ "test": _URLS_prefix["dnli"] + "/test_3_data.csv"
50
+ },
51
+ "test_4": {
52
+ "test": _URLS_prefix["dnli"] + "/test_4_data.csv"
53
+ },
54
+ "test_5": {
55
+ "test": _URLS_prefix["dnli"] + "/test_5_data.csv"
56
+ },
57
+ "test_6": {
58
+ "test": _URLS_prefix["dnli"] + "/test_6_data.csv"
59
+ },
60
+ "test_7": {
61
+ "test": _URLS_prefix["dnli"] + "/test_7_data.csv"
62
+ },
63
+ "test_8": {
64
+ "test": _URLS_prefix["dnli"] + "/test_8_data.csv"
65
+ },
66
+ "test_9": {
67
+ "test": _URLS_prefix["dnli"] + "/test_9_data.csv"
68
+ },
69
+ "test_10": {
70
+ "test": _URLS_prefix["dnli"] + "/test_10_data.csv"
71
+ },
72
+ "test_11": {
73
+ "test": _URLS_prefix["dnli"] + "/test_11_data.csv"
74
+ },
75
+ "test_12": {
76
+ "test": _URLS_prefix["dnli"] + "/test_12_data.csv"
77
+ },
78
+ "test_13": {
79
+ "test": _URLS_prefix["dnli"] + "/test_13_data.csv"
80
+ },
81
+ "test_14": {
82
+ "test": _URLS_prefix["dnli"] + "/test_14_data.csv"
83
+ },
84
+ "test_15": {
85
+ "test": _URLS_prefix["dnli"] + "/test_15_data.csv"
86
+ },
87
+ }
88
+
89
+
90
+
91
+ class DNLI(datasets.GeneratorBasedBuilder):
92
+ """ DNLI is a dataset for NLI in transcripts of spoken dialogues
93
+ """
94
+
95
+ BUILDER_CONFIGS = [
96
+ datasets.BuilderConfig(
97
+ name=config_name,
98
+ version=datasets.Version("0.0.1"),
99
+ description=f"{config_name}"
100
+ )
101
+ for config_name in _URLS.keys()
102
+ ]
103
+ def _info(self):
104
+ features = {
105
+ "hypothesis": datasets.Value("string"),
106
+ "premise": datasets.Value("string"),
107
+ "label": datasets.Value("string"),
108
+ }
109
+
110
+ def _split_generators(self, dl_manager):
111
+ urls = _URLS[self.config.name]
112
+ data_dir = dl_manager.download_and_extract(urls)
113
+ return [
114
+ datasets.SplitGenerator(
115
+ name = datasets.Split.TEST,
116
+ gen_kwargs = {
117
+ "filepath" : data_dir["test"],
118
+ "split" : "test",
119
+ }
120
+ )
121
+ ]
122
+
123
+ def _generate_examples(self, filepath, split):
124
+ with open(filepath, encoding="utf-8") as fin:
125
+ reader = csv.reader(fin, delimiter='\t')
126
+ for idx, row in enumerate(reader):
127
+ yield idx, {
128
+ "hypothesis": row[0],
129
+ "premise": row[1],
130
+ "label": row[2]
131
+ }