Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
6dc77db
1 Parent(s): c4f4109

Delete loading script

Browse files
Files changed (1) hide show
  1. multi_nli.py +0 -118
multi_nli.py DELETED
@@ -1,118 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
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
-
16
- # Lint as: python3
17
- """The Multi-Genre NLI Corpus."""
18
-
19
-
20
- import json
21
- import os
22
-
23
- import datasets
24
-
25
-
26
- _CITATION = """\
27
- @InProceedings{N18-1101,
28
- author = {Williams, Adina
29
- and Nangia, Nikita
30
- and Bowman, Samuel},
31
- title = {A Broad-Coverage Challenge Corpus for
32
- Sentence Understanding through Inference},
33
- booktitle = {Proceedings of the 2018 Conference of
34
- the North American Chapter of the
35
- Association for Computational Linguistics:
36
- Human Language Technologies, Volume 1 (Long
37
- Papers)},
38
- year = {2018},
39
- publisher = {Association for Computational Linguistics},
40
- pages = {1112--1122},
41
- location = {New Orleans, Louisiana},
42
- url = {http://aclweb.org/anthology/N18-1101}
43
- }
44
- """
45
-
46
- _DESCRIPTION = """\
47
- The Multi-Genre Natural Language Inference (MultiNLI) corpus is a
48
- crowd-sourced collection of 433k sentence pairs annotated with textual
49
- entailment information. The corpus is modeled on the SNLI corpus, but differs in
50
- that covers a range of genres of spoken and written text, and supports a
51
- distinctive cross-genre generalization evaluation. The corpus served as the
52
- basis for the shared task of the RepEval 2017 Workshop at EMNLP in Copenhagen.
53
- """
54
-
55
-
56
- class MultiNli(datasets.GeneratorBasedBuilder):
57
- """MultiNLI: The Stanford Question Answering Dataset. Version 1.1."""
58
-
59
- def _info(self):
60
- return datasets.DatasetInfo(
61
- description=_DESCRIPTION,
62
- features=datasets.Features(
63
- {
64
- "promptID": datasets.Value("int32"),
65
- "pairID": datasets.Value("string"),
66
- "premise": datasets.Value("string"),
67
- "premise_binary_parse": datasets.Value("string"), # parses in unlabeled binary-branching format
68
- "premise_parse": datasets.Value("string"), # sentence as parsed by the Stanford PCFG Parser 3.5.2
69
- "hypothesis": datasets.Value("string"),
70
- "hypothesis_binary_parse": datasets.Value("string"), # parses in unlabeled binary-branching format
71
- "hypothesis_parse": datasets.Value(
72
- "string"
73
- ), # sentence as parsed by the Stanford PCFG Parser 3.5.2
74
- "genre": datasets.Value("string"),
75
- "label": datasets.features.ClassLabel(names=["entailment", "neutral", "contradiction"]),
76
- }
77
- ),
78
- # No default supervised_keys (as we have to pass both premise
79
- # and hypothesis as input).
80
- supervised_keys=None,
81
- homepage="https://www.nyu.edu/projects/bowman/multinli/",
82
- citation=_CITATION,
83
- )
84
-
85
- def _split_generators(self, dl_manager):
86
-
87
- downloaded_dir = dl_manager.download_and_extract("https://cims.nyu.edu/~sbowman/multinli/multinli_1.0.zip")
88
- mnli_path = os.path.join(downloaded_dir, "multinli_1.0")
89
- train_path = os.path.join(mnli_path, "multinli_1.0_train.jsonl")
90
- matched_validation_path = os.path.join(mnli_path, "multinli_1.0_dev_matched.jsonl")
91
- mismatched_validation_path = os.path.join(mnli_path, "multinli_1.0_dev_mismatched.jsonl")
92
-
93
- return [
94
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
95
- datasets.SplitGenerator(name="validation_matched", gen_kwargs={"filepath": matched_validation_path}),
96
- datasets.SplitGenerator(name="validation_mismatched", gen_kwargs={"filepath": mismatched_validation_path}),
97
- ]
98
-
99
- def _generate_examples(self, filepath):
100
- """Generate mnli examples"""
101
-
102
- with open(filepath, encoding="utf-8") as f:
103
- for id_, row in enumerate(f):
104
- data = json.loads(row)
105
- if data["gold_label"] == "-":
106
- continue
107
- yield id_, {
108
- "promptID": data["promptID"],
109
- "pairID": data["pairID"],
110
- "premise": data["sentence1"],
111
- "premise_binary_parse": data["sentence1_binary_parse"],
112
- "premise_parse": data["sentence1_parse"],
113
- "hypothesis": data["sentence2"],
114
- "hypothesis_binary_parse": data["sentence2_binary_parse"],
115
- "hypothesis_parse": data["sentence2_parse"],
116
- "genre": data["genre"],
117
- "label": data["gold_label"],
118
- }