pepa commited on
Commit
d544699
1 Parent(s): 3d6c6e9

commit files to HF hub

Browse files
Files changed (3) hide show
  1. LICENSE +21 -0
  2. sufficient_facts.py +125 -0
  3. types.json +28 -0
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2022 CopeNLU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
sufficient_facts.py ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import json
16
+ import datasets
17
+
18
+
19
+ # TODO: Add BibTeX citation
20
+ # Find for instance the citation on arxiv or on the dataset repo/website
21
+ _CITATION = """\
22
+ @InProceedings{huggingface:dataset,
23
+ title = {A great new dataset},
24
+ author={huggingface, Inc.
25
+ },
26
+ year={2020}
27
+ }
28
+ """
29
+
30
+ # You can copy an official description
31
+ _DESCRIPTION = """\
32
+ SufficientFacts is a diagnostic test dataset for fact checking with insufficient evidence.
33
+ """
34
+
35
+ _HOMEPAGE = "https://github.com/copenlu/sufficient_facts"
36
+
37
+ _LICENSE = """MIT License
38
+ Copyright (c) 2022 CopeNLU
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining a copy
41
+ of this software and associated documentation files (the "Software"), to deal
42
+ in the Software without restriction, including without limitation the rights
43
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44
+ copies of the Software, and to permit persons to whom the Software is
45
+ furnished to do so, subject to the following conditions:
46
+
47
+ The above copyright notice and this permission notice shall be included in all
48
+ copies or substantial portions of the Software.
49
+
50
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56
+ SOFTWARE."""
57
+
58
+ _URLS = {
59
+ "fever": "https://raw.githubusercontent.com/copenlu/sufficient_facts/master/data/sufficient_facts/fever_sufficient_facts.jsonl",
60
+ "vitaminc": "https://raw.githubusercontent.com/copenlu/sufficient_facts/master/data/sufficient_facts/vitaminc_sufficient_facts.jsonl",
61
+ "hover": "https://raw.githubusercontent.com/copenlu/sufficient_facts/master/data/sufficient_facts/hover_sufficient_facts.jsonl",
62
+ }
63
+
64
+
65
+ class SufficientFacts(datasets.GeneratorBasedBuilder):
66
+ """SufficientFacts is a diagnostic test dataset for fact checking with insufficient evidence."""
67
+
68
+ VERSION = datasets.Version("1.1.0")
69
+
70
+ BUILDER_CONFIGS = [
71
+ datasets.BuilderConfig(name="fever", version=VERSION, description="FEVER test set."),
72
+ datasets.BuilderConfig(name="hover", version=VERSION, description="HoVer test set."),
73
+ datasets.BuilderConfig(name="vitaminc", version=VERSION, description="VitaminC test set."),
74
+ ]
75
+
76
+ def _info(self):
77
+ features = datasets.Features(
78
+ {
79
+ "claim": datasets.Value("string"),
80
+ "evidence": datasets.features.Sequence(datasets.features.Sequence(datasets.Value("string"))),
81
+ "label_before": datasets.Value("string"),
82
+ "label_after": datasets.Value("string"),
83
+ "type": datasets.Value("string"),
84
+ "removed": datasets.features.Sequence(datasets.Value("string")),
85
+ "text_orig": datasets.Value("string"),
86
+ "agreement": datasets.Value("string")
87
+ }
88
+ )
89
+
90
+ return datasets.DatasetInfo(
91
+ # This is the description that will appear on the datasets page.
92
+ description=_DESCRIPTION,
93
+ # This defines the different columns of the dataset and their types
94
+ features=features, # Here we define them above because they are different between the two configurations
95
+ # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
96
+ # specify them. They'll be used if as_supervised=True in builder.as_dataset.
97
+ # supervised_keys=("sentence", "label"),
98
+ # Homepage of the dataset for documentation
99
+ homepage=_HOMEPAGE,
100
+ # License for the dataset if available
101
+ license=_LICENSE,
102
+ # Citation for the dataset
103
+ citation=_CITATION,
104
+ )
105
+
106
+ def _split_generators(self, dl_manager):
107
+ urls = _URLS[self.config.name]
108
+ data_dir = dl_manager.download_and_extract(urls)
109
+ return [
110
+ datasets.SplitGenerator(
111
+ name=datasets.Split.TEST,
112
+ # These kwargs will be passed to _generate_examples
113
+ gen_kwargs={
114
+ "filepath": data_dir,
115
+ "split": "test"
116
+ },
117
+ ),
118
+ ]
119
+
120
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
121
+ def _generate_examples(self, filepath, split):
122
+ with open(filepath, encoding="utf-8") as f:
123
+ for key, row in enumerate(f):
124
+ data = json.loads(row)
125
+ yield key, data
types.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Adj-Adv": "PP",
3
+ "Mod-Adj-NOUN": "ADJM",
4
+ "Num-mod-CARDINAL": "NUMM",
5
+ "Num-mod-PERCENT": "NUMM",
6
+ "Mod-Date-month-day": "DATEM",
7
+ "Num-mod-": "NUMM",
8
+ "Mod-NOUN-NOUN": "NOUNM",
9
+ "Num-mod-DATE": "DATEM",
10
+ "WHNP": "SBAR",
11
+ "Mod-Date-day-month": "DATEM",
12
+ "Mod-Adv-VERB": "ADVM",
13
+ "WHADVP": "SBAR",
14
+ "ADVP": "SBAR",
15
+ "Mod-Date-year": "DATEM",
16
+ "Mod-Date-day": "DATEM",
17
+ "WHPP": "SBAR",
18
+ "Num-mod-TIME": "NUMM",
19
+ "SBAR": "SBAR",
20
+ "NP": "SBAR",
21
+ "Num-mod-MONEY": "NUMM",
22
+ "Num-mod-QUANTITY": "NUMM",
23
+ "Num-mod-LOC": "NUMM",
24
+ "Num-mod-PRODUCT": "NUMM",
25
+ "PP": "PP",
26
+ "S": "SBAR",
27
+ "SENT": "S"
28
+ }