parquet-converter
commited on
Commit
•
31a6ccc
1
Parent(s):
059927b
Update parquet files
Browse files- .gitattributes +0 -41
- README.md +0 -3
- contract-nli.py +0 -210
- contract_nli.zip → contractnli_a/contract-nli-test.parquet +2 -2
- contract_nli_long.zip → contractnli_a/contract-nli-train.parquet +2 -2
- contractnli_a/contract-nli-validation.parquet +3 -0
- contractnli_b/contract-nli-test.parquet +3 -0
- contractnli_b/contract-nli-train.parquet +3 -0
- contractnli_b/contract-nli-validation.parquet +3 -0
.gitattributes
DELETED
@@ -1,41 +0,0 @@
|
|
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 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
8 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
23 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
26 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
-
# Audio files - uncompressed
|
33 |
-
*.pcm filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.sam filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*.raw filter=lfs diff=lfs merge=lfs -text
|
36 |
-
# Audio files - compressed
|
37 |
-
*.aac filter=lfs diff=lfs merge=lfs -text
|
38 |
-
*.flac filter=lfs diff=lfs merge=lfs -text
|
39 |
-
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
40 |
-
*.ogg filter=lfs diff=lfs merge=lfs -text
|
41 |
-
*.wav filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-nc-sa-4.0
|
3 |
-
---
|
|
|
|
|
|
|
|
contract-nli.py
DELETED
@@ -1,210 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
"""ContractNLI: A Benchmark Dataset for ContractNLI in English."""
|
16 |
-
|
17 |
-
import json
|
18 |
-
import os
|
19 |
-
import textwrap
|
20 |
-
|
21 |
-
import datasets
|
22 |
-
|
23 |
-
MAIN_PATH = 'https://huggingface.co/datasets/cognitivplus/contract-nli/resolve/main'
|
24 |
-
|
25 |
-
MAIN_CITATION = """\
|
26 |
-
@inproceedings{koreeda-manning-2021-contractnli-dataset,
|
27 |
-
title = "{C}ontract{NLI}: A Dataset for Document-level Natural Language Inference for Contracts",
|
28 |
-
author = "Koreeda, Yuta and
|
29 |
-
Manning, Christopher",
|
30 |
-
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2021",
|
31 |
-
month = nov,
|
32 |
-
year = "2021",
|
33 |
-
address = "Punta Cana, Dominican Republic",
|
34 |
-
publisher = "Association for Computational Linguistics",
|
35 |
-
url = "https://aclanthology.org/2021.findings-emnlp.164",
|
36 |
-
doi = "10.18653/v1/2021.findings-emnlp.164",
|
37 |
-
pages = "1907--1919",
|
38 |
-
}"""
|
39 |
-
|
40 |
-
_DESCRIPTION = """\
|
41 |
-
ContractNLI: A Benchmark Dataset for ContractNLI in English
|
42 |
-
"""
|
43 |
-
|
44 |
-
|
45 |
-
CONTRACTNLI_LABELS = ["contradiction", "entailment", "neutral"]
|
46 |
-
|
47 |
-
|
48 |
-
class ContractNLIConfig(datasets.BuilderConfig):
|
49 |
-
"""BuilderConfig for ContractNLI."""
|
50 |
-
|
51 |
-
def __init__(
|
52 |
-
self,
|
53 |
-
url,
|
54 |
-
data_url,
|
55 |
-
data_file,
|
56 |
-
citation,
|
57 |
-
label_classes=None,
|
58 |
-
**kwargs,
|
59 |
-
):
|
60 |
-
"""BuilderConfig for ContractNLI.
|
61 |
-
|
62 |
-
Args:
|
63 |
-
url: `string`, url for the original project
|
64 |
-
data_url: `string`, url to download the zip file from
|
65 |
-
data_file: `string`, filename for data set
|
66 |
-
citation: `string`, citation for the data set
|
67 |
-
url: `string`, url for information about the data set
|
68 |
-
label_classes: `list[string]`, the list of classes if the label is
|
69 |
-
categorical. If not provided, then the label will be of type
|
70 |
-
`datasets.Value('float32')`.
|
71 |
-
**kwargs: keyword arguments forwarded to super.
|
72 |
-
"""
|
73 |
-
super(ContractNLIConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
74 |
-
self.label_classes = label_classes
|
75 |
-
self.url = url
|
76 |
-
self.data_url = data_url
|
77 |
-
self.data_file = data_file
|
78 |
-
self.citation = citation
|
79 |
-
|
80 |
-
|
81 |
-
class ContractNLI(datasets.GeneratorBasedBuilder):
|
82 |
-
"""ContractNLI: A Benchmark Dataset for ContractNLI in English. Version 1.0"""
|
83 |
-
|
84 |
-
BUILDER_CONFIGS = [
|
85 |
-
ContractNLIConfig(
|
86 |
-
name="contractnli_a",
|
87 |
-
description=textwrap.dedent(
|
88 |
-
"""\
|
89 |
-
The ContractNLI dataset consists of Non-Disclosure Agreements (NDAs). All NDAs have been labeled based
|
90 |
-
on several hypothesis templates as entailment, neutral or contradiction. In this version of the task
|
91 |
-
(Task A), the input consists of the relevant part of the document w.r.t. to the hypothesis.
|
92 |
-
"""
|
93 |
-
),
|
94 |
-
label_classes=CONTRACTNLI_LABELS,
|
95 |
-
data_url=f"{MAIN_PATH}/contract_nli.zip",
|
96 |
-
data_file="contract_nli_v1.jsonl",
|
97 |
-
url="https://stanfordnlp.github.io/ contract- nli/",
|
98 |
-
citation=textwrap.dedent(
|
99 |
-
"""\
|
100 |
-
@inproceedings{koreeda-manning-2021-contractnli-dataset,
|
101 |
-
title = "{C}ontract{NLI}: A Dataset for Document-level Natural Language Inference for Contracts",
|
102 |
-
author = "Koreeda, Yuta and
|
103 |
-
Manning, Christopher",
|
104 |
-
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2021",
|
105 |
-
month = nov,
|
106 |
-
year = "2021",
|
107 |
-
address = "Punta Cana, Dominican Republic",
|
108 |
-
publisher = "Association for Computational Linguistics",
|
109 |
-
url = "https://aclanthology.org/2021.findings-emnlp.164",
|
110 |
-
doi = "10.18653/v1/2021.findings-emnlp.164",
|
111 |
-
pages = "1907--1919",
|
112 |
-
}
|
113 |
-
}"""
|
114 |
-
),
|
115 |
-
),
|
116 |
-
ContractNLIConfig(
|
117 |
-
name="contractnli_b",
|
118 |
-
description=textwrap.dedent(
|
119 |
-
"""\
|
120 |
-
The ContractNLI dataset consists of Non-Disclosure Agreements (NDAs). All NDAs have been labeled based
|
121 |
-
on several hypothesis templates as entailment, neutral or contradiction. In this version of the task
|
122 |
-
(Task B), the input consists of the full document.
|
123 |
-
"""
|
124 |
-
),
|
125 |
-
label_classes=CONTRACTNLI_LABELS,
|
126 |
-
data_url=f"{MAIN_PATH}/contract_nli_long.zip",
|
127 |
-
data_file="contract_nli_long.jsonl",
|
128 |
-
url="https://stanfordnlp.github.io/ contract- nli/",
|
129 |
-
citation=textwrap.dedent(
|
130 |
-
"""\
|
131 |
-
@inproceedings{koreeda-manning-2021-contractnli-dataset,
|
132 |
-
title = "{C}ontract{NLI}: A Dataset for Document-level Natural Language Inference for Contracts",
|
133 |
-
author = "Koreeda, Yuta and
|
134 |
-
Manning, Christopher",
|
135 |
-
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2021",
|
136 |
-
month = nov,
|
137 |
-
year = "2021",
|
138 |
-
address = "Punta Cana, Dominican Republic",
|
139 |
-
publisher = "Association for Computational Linguistics",
|
140 |
-
url = "https://aclanthology.org/2021.findings-emnlp.164",
|
141 |
-
doi = "10.18653/v1/2021.findings-emnlp.164",
|
142 |
-
pages = "1907--1919",
|
143 |
-
}
|
144 |
-
}"""
|
145 |
-
),
|
146 |
-
),
|
147 |
-
]
|
148 |
-
|
149 |
-
def _info(self):
|
150 |
-
features = {
|
151 |
-
"premise": datasets.Value("string"),
|
152 |
-
"hypothesis": datasets.Value("string"),
|
153 |
-
"label": datasets.ClassLabel(names=CONTRACTNLI_LABELS)
|
154 |
-
}
|
155 |
-
|
156 |
-
return datasets.DatasetInfo(
|
157 |
-
description=self.config.description,
|
158 |
-
features=datasets.Features(features),
|
159 |
-
homepage=self.config.url,
|
160 |
-
citation=self.config.citation + "\n" + MAIN_CITATION,
|
161 |
-
)
|
162 |
-
|
163 |
-
def _split_generators(self, dl_manager):
|
164 |
-
data_dir = dl_manager.download_and_extract(self.config.data_url)
|
165 |
-
return [
|
166 |
-
datasets.SplitGenerator(
|
167 |
-
name=datasets.Split.TRAIN,
|
168 |
-
# These kwargs will be passed to _generate_examples
|
169 |
-
gen_kwargs={"filepath": os.path.join(data_dir, self.config.data_file), "split": "train"},
|
170 |
-
),
|
171 |
-
datasets.SplitGenerator(
|
172 |
-
name=datasets.Split.TEST,
|
173 |
-
# These kwargs will be passed to _generate_examples
|
174 |
-
gen_kwargs={"filepath": os.path.join(data_dir, self.config.data_file), "split": "test"},
|
175 |
-
),
|
176 |
-
datasets.SplitGenerator(
|
177 |
-
name=datasets.Split.VALIDATION,
|
178 |
-
# These kwargs will be passed to _generate_examples
|
179 |
-
gen_kwargs={
|
180 |
-
"filepath": os.path.join(data_dir, self.config.data_file),
|
181 |
-
"split": "dev",
|
182 |
-
},
|
183 |
-
),
|
184 |
-
]
|
185 |
-
|
186 |
-
def _generate_examples(self, filepath, split):
|
187 |
-
"""This function returns the examples in the raw (text) form."""
|
188 |
-
if self.config.name == "contractnli_a":
|
189 |
-
with open(filepath, "r", encoding="utf-8") as f:
|
190 |
-
for id_, row in enumerate(f):
|
191 |
-
data = json.loads(row)
|
192 |
-
if data["subset"] == split:
|
193 |
-
yield id_, {
|
194 |
-
"premise": data["premise"],
|
195 |
-
"hypothesis": data["hypothesis"],
|
196 |
-
"label": data["label"],
|
197 |
-
}
|
198 |
-
elif self.config.name == "contractnli_b":
|
199 |
-
with open(filepath, "r", encoding="utf-8") as f:
|
200 |
-
sid = -1
|
201 |
-
for id_, row in enumerate(f):
|
202 |
-
data = json.loads(row)
|
203 |
-
if data["subset"] == split:
|
204 |
-
for sample in data['hypothesises/labels']:
|
205 |
-
sid += 1
|
206 |
-
yield sid, {
|
207 |
-
"premise": data["premise"],
|
208 |
-
"hypothesis": sample['hypothesis'],
|
209 |
-
"label": sample['label'],
|
210 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contract_nli.zip → contractnli_a/contract-nli-test.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:409080352c166e6b39f97028872bf9f075464b0ac672d8e1c46f99cc4795c250
|
3 |
+
size 212581
|
contract_nli_long.zip → contractnli_a/contract-nli-train.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6dd1b93ade3e02e3a218a6275b4a8a3f2334ab7faadc589752ea0db03a1cd801
|
3 |
+
size 795702
|
contractnli_a/contract-nli-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:93e38c320a7466c7b3dafac26121a1fae7a85b86922d8a37cf7dbe82defe4c63
|
3 |
+
size 113918
|
contractnli_b/contract-nli-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:165e877bea5c84c6ac81f462295b1d57ad2df44077cb0a9e6aaf44639ade53cb
|
3 |
+
size 630854
|
contractnli_b/contract-nli-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ba5b1d09cf27d545d1b233729a4b9daaecbae492ac69a821ebfde40bea14e06
|
3 |
+
size 2178456
|
contractnli_b/contract-nli-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cc516260ed262bf756a32ffc6cd812d087daedbabe37112bf08f31926afedb10
|
3 |
+
size 344562
|