albertvillanova HF staff commited on
Commit
199add7
1 Parent(s): d4fcd4f

Delete loading script

Browse files
Files changed (1) hide show
  1. bbc_hindi_nli.py +0 -160
bbc_hindi_nli.py DELETED
@@ -1,160 +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
- """TODO: Add a description here."""
16
-
17
-
18
- import csv
19
-
20
- import datasets
21
-
22
-
23
- # TODO: Add BibTeX citation
24
- # Find for instance the citation on arxiv or on the dataset repo/website
25
- _CITATION = """\
26
- @inproceedings{uppal-etal-2020-two,
27
- title = "Two-Step Classification using Recasted Data for Low Resource Settings",
28
- author = "Uppal, Shagun and
29
- Gupta, Vivek and
30
- Swaminathan, Avinash and
31
- Zhang, Haimin and
32
- Mahata, Debanjan and
33
- Gosangi, Rakesh and
34
- Shah, Rajiv Ratn and
35
- Stent, Amanda",
36
- booktitle = "Proceedings of the 1st Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics and the 10th International Joint Conference on Natural Language Processing",
37
- month = dec,
38
- year = "2020",
39
- address = "Suzhou, China",
40
- publisher = "Association for Computational Linguistics",
41
- url = "https://www.aclweb.org/anthology/2020.aacl-main.71",
42
- pages = "706--719",
43
- abstract = "An NLP model{'}s ability to reason should be independent of language. Previous works utilize Natural Language Inference (NLI) to understand the reasoning ability of models, mostly focusing on high resource languages like English. To address scarcity of data in low-resource languages such as Hindi, we use data recasting to create NLI datasets for four existing text classification datasets. Through experiments, we show that our recasted dataset is devoid of statistical irregularities and spurious patterns. We further study the consistency in predictions of the textual entailment models and propose a consistency regulariser to remove pairwise-inconsistencies in predictions. We propose a novel two-step classification method which uses textual-entailment predictions for classification task. We further improve the performance by using a joint-objective for classification and textual entailment. We therefore highlight the benefits of data recasting and improvements on classification performance using our approach with supporting experimental results.",
44
- }
45
- """
46
-
47
- # TODO: Add description of the dataset here
48
- # You can copy an official description
49
- _DESCRIPTION = """\
50
- This dataset is used to train models for Natural Language Inference Tasks in Low-Resource Languages like Hindi.
51
- """
52
-
53
- # TODO: Add a link to an official homepage for the dataset here
54
- _HOMEPAGE = "https://github.com/avinsit123/hindi-nli-data"
55
-
56
- # TODO: Add the licence for the dataset here if you can find it
57
- _LICENSE = """
58
- MIT License
59
-
60
- Copyright (c) 2019 MIDAS, IIIT Delhi
61
-
62
- Permission is hereby granted, free of charge, to any person obtaining a copy
63
- of this software and associated documentation files (the "Software"), to deal
64
- in the Software without restriction, including without limitation the rights
65
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
66
- copies of the Software, and to permit persons to whom the Software is
67
- furnished to do so, subject to the following conditions:
68
-
69
- The above copyright notice and this permission notice shall be included in all
70
- copies or substantial portions of the Software.
71
-
72
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
73
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
74
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
75
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
76
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
77
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
78
- SOFTWARE.
79
- """
80
-
81
- _TRAIN_DOWNLOAD_URL = (
82
- "https://raw.githubusercontent.com/avinsit123/hindi-nli-data/master/Textual_Entailment/BBC/BBC_recasted_train.tsv"
83
- )
84
- _VALID_DOWNLOAD_URL = (
85
- "https://raw.githubusercontent.com/avinsit123/hindi-nli-data/master/Textual_Entailment/BBC/BBC_recasted_dev.tsv"
86
- )
87
- _TEST_DOWNLOAD_URL = (
88
- "https://raw.githubusercontent.com/avinsit123/hindi-nli-data/master/Textual_Entailment/BBC/BBC_recasted_test.tsv"
89
- )
90
-
91
-
92
- class BbcHindiNLIConfig(datasets.BuilderConfig):
93
- """BuilderConfig for BBC Hindi NLI Config"""
94
-
95
- def __init__(self, **kwargs):
96
- """BuilderConfig for BBC Hindi NLI Config.
97
- Args:
98
- **kwargs: keyword arguments forwarded to super.
99
- """
100
- super(BbcHindiNLIConfig, self).__init__(**kwargs)
101
-
102
-
103
- class BbcHindiNLI(datasets.GeneratorBasedBuilder):
104
- """BBC Hindi NLI dataset -- Dataset providing textual-entailment pairs for NLI tasks in Hindi"""
105
-
106
- BUILDER_CONFIGS = [
107
- BbcHindiNLIConfig(
108
- name="bbc hindi nli",
109
- version=datasets.Version("1.1.0"),
110
- description="BBC Hindi NLI: Natural Language Inference Dataset in Hindi",
111
- ),
112
- ]
113
-
114
- def _info(self):
115
-
116
- return datasets.DatasetInfo(
117
- description=_DESCRIPTION,
118
- features=datasets.Features(
119
- {
120
- "premise": datasets.Value("string"),
121
- "hypothesis": datasets.Value("string"),
122
- "label": datasets.ClassLabel(names=["not-entailment", "entailment"]),
123
- "topic": datasets.ClassLabel(
124
- names=["india", "news", "international", "entertainment", "sport", "science"]
125
- ),
126
- }
127
- ),
128
- supervised_keys=None,
129
- homepage=_HOMEPAGE,
130
- license=_LICENSE,
131
- citation=_CITATION,
132
- )
133
-
134
- def _split_generators(self, dl_manager):
135
- """Returns SplitGenerators."""
136
- train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
137
- test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
138
- valid_path = dl_manager.download_and_extract(_VALID_DOWNLOAD_URL)
139
-
140
- return [
141
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
142
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": valid_path}),
143
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
144
- ]
145
-
146
- def _generate_examples(self, filepath):
147
- """Yields examples."""
148
-
149
- with open(filepath, encoding="utf-8") as tsv_file:
150
- tsv_reader = csv.reader(tsv_file, delimiter="\t")
151
- for id_, row in enumerate(tsv_reader):
152
- if id_ == 0:
153
- continue
154
- (premise, hypothesis, label, topic) = row
155
- yield id_, {
156
- "premise": premise,
157
- "hypothesis": hypothesis,
158
- "label": 1 if label == "entailed" else 0,
159
- "topic": int(topic),
160
- }