Datasets:
Commit
•
c1cd661
0
Parent(s):
Update files from the datasets library (from 1.1.3)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.1.3
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/multinli_tr/1.0.0/dummy_data.zip +3 -0
- dummy/snli_tr/1.0.0/dummy_data.zip +3 -0
- nli_tr.py +167 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz 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
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"snli_tr": {"description": "The Natural Language Inference in Turkish (NLI-TR) is a set of two large scale datasets that were obtained by translating the foundational NLI corpora (SNLI and MNLI) using Amazon Translate.\n", "citation": "@inproceedings{budur-etal-2020-data,\n title = \"Data and Representation for Turkish Natural Language Inference\",\n author = \"Budur, Emrah and\n \"{O}z\u00e7elik, R\u0131za and\n G\"{u}ng\"{o}r, Tunga\",\n booktitle = \"Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)\",\n month = nov,\n year = \"2020\",\n address = \"Online\",\n publisher = \"Association for Computational Linguistics\",\n abstract = \"Large annotated datasets in NLP are overwhelmingly in English. This is an obstacle to progress in other languages. Unfortunately, obtaining new annotated resources for each task in each language would be prohibitively expensive. At the same time, commercial machine translation systems are now robust. Can we leverage these systems to translate English-language datasets automatically? In this paper, we offer a positive response for natural language inference (NLI) in Turkish. We translated two large English NLI datasets into Turkish and had a team of experts validate their translation quality and fidelity to the original labels. Using these datasets, we address core issues of representation for Turkish NLI. We find that in-language embeddings are essential and that morphological parsing can be avoided where the training set is large. Finally, we show that models trained on our machine-translated datasets are successful on human-translated evaluation sets. We share all code, models, and data publicly.\",\n}\n", "homepage": "https://github.com/boun-tabi/NLI-TR", "license": "", "features": {"idx": {"dtype": "int32", "id": null, "_type": "Value"}, "premise": {"dtype": "string", "id": null, "_type": "Value"}, "hypothesis": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["entailment", "neutral", "contradiction"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "nli_tr", "config_name": "snli_tr", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 71175743, "num_examples": 550152, "dataset_name": "nli_tr"}, "validation": {"name": "validation", "num_bytes": 1359639, "num_examples": 10000, "dataset_name": "nli_tr"}, "test": {"name": "test", "num_bytes": 1355409, "num_examples": 10000, "dataset_name": "nli_tr"}}, "download_checksums": {"https://tabilab.cmpe.boun.edu.tr/datasets/nli_datasets/snli_tr_1.0.zip": {"num_bytes": 40328942, "checksum": "c8ecee6c532ada2a1a6f7b9c29f618c6737662dde12d18f21c437682b2bdd851"}}, "download_size": 40328942, "post_processing_size": null, "dataset_size": 73890791, "size_in_bytes": 114219733}, "multinli_tr": {"description": "The Natural Language Inference in Turkish (NLI-TR) is a set of two large scale datasets that were obtained by translating the foundational NLI corpora (SNLI and MNLI) using Amazon Translate.\n", "citation": "@inproceedings{budur-etal-2020-data,\n title = \"Data and Representation for Turkish Natural Language Inference\",\n author = \"Budur, Emrah and\n \"{O}z\u00e7elik, R\u0131za and\n G\"{u}ng\"{o}r, Tunga\",\n booktitle = \"Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)\",\n month = nov,\n year = \"2020\",\n address = \"Online\",\n publisher = \"Association for Computational Linguistics\",\n abstract = \"Large annotated datasets in NLP are overwhelmingly in English. This is an obstacle to progress in other languages. Unfortunately, obtaining new annotated resources for each task in each language would be prohibitively expensive. At the same time, commercial machine translation systems are now robust. Can we leverage these systems to translate English-language datasets automatically? In this paper, we offer a positive response for natural language inference (NLI) in Turkish. We translated two large English NLI datasets into Turkish and had a team of experts validate their translation quality and fidelity to the original labels. Using these datasets, we address core issues of representation for Turkish NLI. We find that in-language embeddings are essential and that morphological parsing can be avoided where the training set is large. Finally, we show that models trained on our machine-translated datasets are successful on human-translated evaluation sets. We share all code, models, and data publicly.\",\n}\n", "homepage": "https://github.com/boun-tabi/NLI-TR", "license": "", "features": {"idx": {"dtype": "int32", "id": null, "_type": "Value"}, "premise": {"dtype": "string", "id": null, "_type": "Value"}, "hypothesis": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["entailment", "neutral", "contradiction"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "nli_tr", "config_name": "multinli_tr", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 75524150, "num_examples": 392702, "dataset_name": "nli_tr"}, "validation_matched": {"name": "validation_matched", "num_bytes": 1908283, "num_examples": 10000, "dataset_name": "nli_tr"}, "validation_mismatched": {"name": "validation_mismatched", "num_bytes": 2039392, "num_examples": 10000, "dataset_name": "nli_tr"}}, "download_checksums": {"https://tabilab.cmpe.boun.edu.tr/datasets/nli_datasets/multinli_tr_1.0.zip": {"num_bytes": 75518512, "checksum": "1fed6bb08ecac39cfa998296f5c77b1ca90a1634aa0351e3ef93d2de6f126aca"}}, "download_size": 75518512, "post_processing_size": null, "dataset_size": 79471825, "size_in_bytes": 154990337}}
|
dummy/multinli_tr/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:897611e60d756f85891c548e50ca9784021bcc0c41549ed9459421ba6d20adca
|
3 |
+
size 6857
|
dummy/snli_tr/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:edcd6839980eb61d7f819ceb3b106c2684d198e171c2c4f1f31e3841a7cbaa42
|
3 |
+
size 3156
|
nli_tr.py
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""NLI-TR: The Turkish translation of SNLI and MultiNLI datasets using Amazon Translate."""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import codecs
|
20 |
+
import json
|
21 |
+
import os
|
22 |
+
|
23 |
+
import datasets
|
24 |
+
|
25 |
+
|
26 |
+
_CITATION = """\
|
27 |
+
@inproceedings{budur-etal-2020-data,
|
28 |
+
title = "Data and Representation for Turkish Natural Language Inference",
|
29 |
+
author = "Budur, Emrah and
|
30 |
+
\"{O}zçelik, Rıza and
|
31 |
+
G\"{u}ng\"{o}r, Tunga",
|
32 |
+
booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
|
33 |
+
month = nov,
|
34 |
+
year = "2020",
|
35 |
+
address = "Online",
|
36 |
+
publisher = "Association for Computational Linguistics",
|
37 |
+
abstract = "Large annotated datasets in NLP are overwhelmingly in English. This is an obstacle to progress in other languages. Unfortunately, obtaining new annotated resources for each task in each language would be prohibitively expensive. At the same time, commercial machine translation systems are now robust. Can we leverage these systems to translate English-language datasets automatically? In this paper, we offer a positive response for natural language inference (NLI) in Turkish. We translated two large English NLI datasets into Turkish and had a team of experts validate their translation quality and fidelity to the original labels. Using these datasets, we address core issues of representation for Turkish NLI. We find that in-language embeddings are essential and that morphological parsing can be avoided where the training set is large. Finally, we show that models trained on our machine-translated datasets are successful on human-translated evaluation sets. We share all code, models, and data publicly.",
|
38 |
+
}
|
39 |
+
"""
|
40 |
+
|
41 |
+
_DESCRIPTION = """\
|
42 |
+
The Natural Language Inference in Turkish (NLI-TR) is a set of two large scale datasets that were obtained by translating the foundational NLI corpora (SNLI and MNLI) using Amazon Translate.
|
43 |
+
"""
|
44 |
+
|
45 |
+
_HOMEPAGE = "https://github.com/boun-tabi/NLI-TR"
|
46 |
+
|
47 |
+
|
48 |
+
class NLITRConfig(datasets.BuilderConfig):
|
49 |
+
""" BuilderConfig for NLI-TR"""
|
50 |
+
|
51 |
+
def __init__(self, version=None, data_url=None, **kwargs):
|
52 |
+
super(NLITRConfig, self).__init__(version=datasets.Version(version, ""), **kwargs)
|
53 |
+
self.data_url = data_url
|
54 |
+
|
55 |
+
|
56 |
+
class NliTr(datasets.GeneratorBasedBuilder):
|
57 |
+
"""NLI-TR: The Turkish translation of SNLI and MultiNLI datasets using Amazon Translate."""
|
58 |
+
|
59 |
+
VERSION = datasets.Version("1.0.0")
|
60 |
+
BUILDER_CONFIG_CLASS = NLITRConfig
|
61 |
+
BUILDER_CONFIGS = [
|
62 |
+
NLITRConfig(
|
63 |
+
name="snli_tr",
|
64 |
+
version="1.0.0",
|
65 |
+
data_url="https://tabilab.cmpe.boun.edu.tr/datasets/nli_datasets/snli_tr_1.0.zip",
|
66 |
+
),
|
67 |
+
NLITRConfig(
|
68 |
+
name="multinli_tr",
|
69 |
+
version="1.0.0",
|
70 |
+
data_url="https://tabilab.cmpe.boun.edu.tr/datasets/nli_datasets/multinli_tr_1.0.zip",
|
71 |
+
),
|
72 |
+
]
|
73 |
+
|
74 |
+
def _info(self):
|
75 |
+
features = datasets.Features(
|
76 |
+
{
|
77 |
+
"idx": datasets.Value("int32"),
|
78 |
+
"premise": datasets.Value("string"),
|
79 |
+
"hypothesis": datasets.Value("string"),
|
80 |
+
"label": datasets.features.ClassLabel(names=["entailment", "neutral", "contradiction"]),
|
81 |
+
}
|
82 |
+
)
|
83 |
+
return datasets.DatasetInfo(
|
84 |
+
description=_DESCRIPTION,
|
85 |
+
features=datasets.Features(features),
|
86 |
+
supervised_keys=None,
|
87 |
+
homepage=_HOMEPAGE,
|
88 |
+
citation=_CITATION,
|
89 |
+
)
|
90 |
+
|
91 |
+
def _split_generators(self, dl_manager):
|
92 |
+
"""Returns SplitGenerators."""
|
93 |
+
|
94 |
+
dl_dir = dl_manager.download_and_extract(self.config.data_url)
|
95 |
+
data_dir = os.path.join(dl_dir)
|
96 |
+
|
97 |
+
if self.config.name == "multinli_tr":
|
98 |
+
return [
|
99 |
+
datasets.SplitGenerator(
|
100 |
+
name=datasets.Split.TRAIN,
|
101 |
+
# These kwargs will be passed to _generate_examples
|
102 |
+
gen_kwargs={
|
103 |
+
"filepath": os.path.join(data_dir, "multinli_tr_1.0_train.jsonl"),
|
104 |
+
"split": "train",
|
105 |
+
},
|
106 |
+
),
|
107 |
+
datasets.SplitGenerator(
|
108 |
+
name="validation_matched",
|
109 |
+
# These kwargs will be passed to _generate_examples
|
110 |
+
gen_kwargs={
|
111 |
+
"filepath": os.path.join(data_dir, "multinli_tr_1.0_dev_matched.jsonl"),
|
112 |
+
"split": "dev",
|
113 |
+
},
|
114 |
+
),
|
115 |
+
datasets.SplitGenerator(
|
116 |
+
name="validation_mismatched",
|
117 |
+
# These kwargs will be passed to _generate_examples
|
118 |
+
gen_kwargs={
|
119 |
+
"filepath": os.path.join(data_dir, "multinli_tr_1.0_dev_mismatched.jsonl"),
|
120 |
+
"split": "dev",
|
121 |
+
},
|
122 |
+
),
|
123 |
+
]
|
124 |
+
|
125 |
+
if self.config.name == "snli_tr":
|
126 |
+
return [
|
127 |
+
datasets.SplitGenerator(
|
128 |
+
name=datasets.Split.TRAIN,
|
129 |
+
# These kwargs will be passed to _generate_examples
|
130 |
+
gen_kwargs={
|
131 |
+
"filepath": os.path.join(data_dir, "snli_tr_1.0_train.jsonl"),
|
132 |
+
"split": "train",
|
133 |
+
},
|
134 |
+
),
|
135 |
+
datasets.SplitGenerator(
|
136 |
+
name=datasets.Split.VALIDATION,
|
137 |
+
# These kwargs will be passed to _generate_examples
|
138 |
+
gen_kwargs={
|
139 |
+
"filepath": os.path.join(data_dir, "snli_tr_1.0_dev.jsonl"),
|
140 |
+
"split": "validation",
|
141 |
+
},
|
142 |
+
),
|
143 |
+
datasets.SplitGenerator(
|
144 |
+
name=datasets.Split.TEST,
|
145 |
+
# These kwargs will be passed to _generate_examples
|
146 |
+
gen_kwargs={
|
147 |
+
"filepath": os.path.join(data_dir, "snli_tr_1.0_test.jsonl"),
|
148 |
+
"split": "test",
|
149 |
+
},
|
150 |
+
),
|
151 |
+
]
|
152 |
+
|
153 |
+
def _generate_examples(self, filepath, split):
|
154 |
+
""" Yields examples. """
|
155 |
+
|
156 |
+
with codecs.open(filepath, encoding="utf-8") as f:
|
157 |
+
for idx, row in enumerate(f):
|
158 |
+
data = json.loads(row)
|
159 |
+
example = {"idx": idx, "premise": data["sentence1"], "hypothesis": data["sentence2"]}
|
160 |
+
|
161 |
+
if "gold_label" in data:
|
162 |
+
if data["gold_label"] != "-":
|
163 |
+
example["label"] = data["gold_label"]
|
164 |
+
else:
|
165 |
+
example["label"] = -1
|
166 |
+
|
167 |
+
yield idx, example
|