Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
natural-language-inference
Size:
100K - 1M
Tags:
quality-estimation
License:
Initial commit
Browse files- .gitattributes +1 -0
- data/.gitattributes +1 -0
- data/test.tsv.gz +3 -0
- data/train.tsv.gz +3 -0
- data/validation.tsv.gz +3 -0
- ik-nlp-22_transqe.py +138 -0
.gitattributes
CHANGED
|
@@ -25,3 +25,4 @@ saved_model/**/* 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
|
|
|
|
|
|
| 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
|
| 28 |
+
*.tsv.gz filter=lfs diff=lfs merge=lfs -text
|
data/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*.tsv.gz filter=lfs diff=lfs merge=lfs -text
|
data/test.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e1baf1c45acfe6e62ad60da63180e6ab7fc88eb09d460850fb78aab81dafc98
|
| 3 |
+
size 1822936
|
data/train.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07b39a7d1cff581ec3e532f34addd028529eb84fa2dcd04876d071f9158d5663
|
| 3 |
+
size 49754294
|
data/validation.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1c83cd0c3c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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 |
+
|
| 16 |
+
# Lint as: python3
|
| 17 |
+
"""Dutch translation of the e-SNLI corpus with added quality estimation scores"""
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
import csv
|
| 21 |
+
csv.register_dialect("tsv", delimiter="\t")
|
| 22 |
+
|
| 23 |
+
import datasets
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
_CITATION = """
|
| 27 |
+
@incollection{NIPS2018_8163,
|
| 28 |
+
title = {e-SNLI: Natural Language Inference with Natural Language Explanations},
|
| 29 |
+
author = {Camburu, Oana-Maria and Rockt\"{a}schel, Tim and Lukasiewicz, Thomas and Blunsom, Phil},
|
| 30 |
+
booktitle = {Advances in Neural Information Processing Systems 31},
|
| 31 |
+
editor = {S. Bengio and H. Wallach and H. Larochelle and K. Grauman and N. Cesa-Bianchi and R. Garnett},
|
| 32 |
+
pages = {9539--9549},
|
| 33 |
+
year = {2018},
|
| 34 |
+
publisher = {Curran Associates, Inc.},
|
| 35 |
+
url = {http://papers.nips.cc/paper/8163-e-snli-natural-language-inference-with-natural-language-explanations.pdf}
|
| 36 |
+
}
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
_DESCRIPTION = """
|
| 40 |
+
The e-SNLI dataset extends the Stanford Natural Language Inference Dataset to
|
| 41 |
+
include human-annotated natural language explanations of the entailment
|
| 42 |
+
relations. This version includes an automatic translation to Dutch and two quality estimation annotations
|
| 43 |
+
for each translated field.
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
_HOMEPAGE = "https://www.rug.nl/masters/information-science/?lang=en"
|
| 47 |
+
|
| 48 |
+
_URLS = {
|
| 49 |
+
"train": "https://huggingface.co/datasets/GroNLP/ik-nlp-22_transqe/raw/main/data/train.tsv",
|
| 50 |
+
"validation": "https://huggingface.co/datasets/GroNLP/ik-nlp-22_transqe/raw/main/data/validation.tsv",
|
| 51 |
+
"test": "https://huggingface.co/datasets/GroNLP/ik-nlp-22_transqe/raw/main/data/test.tsv",
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
class IkNlp22ExpNLIConfig(datasets.GeneratorBasedBuilder):
|
| 55 |
+
"""e-SNLI corpus with added translation and quality estimation scores"""
|
| 56 |
+
|
| 57 |
+
BUILDER_CONFIGS = [
|
| 58 |
+
datasets.BuilderConfig(
|
| 59 |
+
name="plain_text",
|
| 60 |
+
version=datasets.Version("0.0.2"),
|
| 61 |
+
description="Plain text import of e-SNLI",
|
| 62 |
+
)
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
def _info(self):
|
| 66 |
+
return datasets.DatasetInfo(
|
| 67 |
+
description=_DESCRIPTION,
|
| 68 |
+
features=datasets.Features(
|
| 69 |
+
{
|
| 70 |
+
"premise_en": datasets.Value("string"),
|
| 71 |
+
"premise_nl": datasets.Value("string"),
|
| 72 |
+
"hypothesis_en": datasets.Value("string"),
|
| 73 |
+
"hypothesis_nl": datasets.Value("string"),
|
| 74 |
+
"label": datasets.features.ClassLabel(names=["entailment", "neutral", "contradiction"]),
|
| 75 |
+
"explanation_1_en": datasets.Value("string"),
|
| 76 |
+
"explanation_1_nl": datasets.Value("string"),
|
| 77 |
+
"explanation_2_en": datasets.Value("string"),
|
| 78 |
+
"explanation_2_nl": datasets.Value("string"),
|
| 79 |
+
"explanation_3_en": datasets.Value("string"),
|
| 80 |
+
"explanation_3_nl": datasets.Value("string"),
|
| 81 |
+
"da_premise": datasets.Value("float32"),
|
| 82 |
+
"mqm_premise": datasets.Value("float32"),
|
| 83 |
+
"da_hypothesis": datasets.Value("float32"),
|
| 84 |
+
"mqm_hypothesis": datasets.Value("float32"),
|
| 85 |
+
"da_explanation_1": datasets.Value("float32"),
|
| 86 |
+
"mqm_explanation_1": datasets.Value("float32"),
|
| 87 |
+
"da_explanation_2": datasets.Value("float32"),
|
| 88 |
+
"mqm_explanation_2": datasets.Value("float32"),
|
| 89 |
+
"da_explanation_3": datasets.Value("float32"),
|
| 90 |
+
"mqm_explanation_3": datasets.Value("float32"),
|
| 91 |
+
}
|
| 92 |
+
),
|
| 93 |
+
supervised_keys=None,
|
| 94 |
+
homepage=_HOMEPAGE,
|
| 95 |
+
citation=_CITATION,
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
def _split_generators(self, dl_manager):
|
| 99 |
+
"""Returns SplitGenerators."""
|
| 100 |
+
|
| 101 |
+
files = dl_manager.download_and_extract(_URLS)
|
| 102 |
+
return [
|
| 103 |
+
datasets.SplitGenerator(
|
| 104 |
+
name=name,
|
| 105 |
+
gen_kwargs={"filepath": filepath},
|
| 106 |
+
)
|
| 107 |
+
for name, filepath in files.items()
|
| 108 |
+
]
|
| 109 |
+
|
| 110 |
+
def _generate_examples(self, files):
|
| 111 |
+
"""Yields examples."""
|
| 112 |
+
for filepath in files:
|
| 113 |
+
with open(filepath, encoding="utf-8") as f:
|
| 114 |
+
reader = csv.DictReader(f, dialect="tsv")
|
| 115 |
+
for i, row in enumerate(reader):
|
| 116 |
+
yield i, {
|
| 117 |
+
"premise_en": row["premise_en"],
|
| 118 |
+
"premise_nl": row["premise_nl"],
|
| 119 |
+
"hypothesis_en": row["hypothesis_en"],
|
| 120 |
+
"hypothesis_nl": row["hypothesis_nl"],
|
| 121 |
+
"label": row["label"],
|
| 122 |
+
"explanation_1_en": row["explanation_1_en"],
|
| 123 |
+
"explanation_1_nl": row["explanation_1_nl"],
|
| 124 |
+
"explanation_2_en": row["explanation_2_en"],
|
| 125 |
+
"explanation_2_nl": row["explanation_2_nl"],
|
| 126 |
+
"explanation_3_en": row["explanation_3_en"],
|
| 127 |
+
"explanation_3_nl": row["explanation_3_nl"],
|
| 128 |
+
"da_premise": row["da_premise"],
|
| 129 |
+
"mqm_premise": row["mqm_premise"],
|
| 130 |
+
"da_hypothesis": row["da_hypothesis"],
|
| 131 |
+
"mqm_hypothesis": row["mqm_hypothesis"],
|
| 132 |
+
"da_explanation_1": row["da_explanation_1"],
|
| 133 |
+
"mqm_explanation_1": row["mqm_explanation_1"],
|
| 134 |
+
"da_explanation_2": row["da_explanation_2"],
|
| 135 |
+
"mqm_explanation_2": row["mqm_explanation_2"],
|
| 136 |
+
"da_explanation_3": row["da_explanation_3"],
|
| 137 |
+
"mqm_explanation_3": row["mqm_explanation_3"]
|
| 138 |
+
}
|