Datasets:
asdf6675
/

Sub-tasks:
fact-checking
Languages:
English
ArXiv:
License:
asdf6675 parquet-converter commited on
Commit
28a7c26
·
0 Parent(s):

Duplicate from wenhu/tab_fact

Browse files

Co-authored-by: Parquet-converter (BOT) <parquet-converter@users.noreply.huggingface.co>

Files changed (3) hide show
  1. .gitattributes +27 -0
  2. README.md +207 -0
  3. tab_fact.py +165 -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
README.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ language:
7
+ - en
8
+ license:
9
+ - cc-by-4.0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 100K<n<1M
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - text-classification
18
+ task_ids:
19
+ - fact-checking
20
+ paperswithcode_id: tabfact
21
+ pretty_name: TabFact
22
+ dataset_info:
23
+ - config_name: tab_fact
24
+ features:
25
+ - name: id
26
+ dtype: int32
27
+ - name: table_id
28
+ dtype: string
29
+ - name: table_text
30
+ dtype: string
31
+ - name: table_caption
32
+ dtype: string
33
+ - name: statement
34
+ dtype: string
35
+ - name: label
36
+ dtype:
37
+ class_label:
38
+ names:
39
+ '0': refuted
40
+ '1': entailed
41
+ splits:
42
+ - name: train
43
+ num_bytes: 99852664
44
+ num_examples: 92283
45
+ - name: validation
46
+ num_bytes: 13846872
47
+ num_examples: 12792
48
+ - name: test
49
+ num_bytes: 13493391
50
+ num_examples: 12779
51
+ download_size: 196508436
52
+ dataset_size: 127192927
53
+ - config_name: blind_test
54
+ features:
55
+ - name: id
56
+ dtype: int32
57
+ - name: table_id
58
+ dtype: string
59
+ - name: table_text
60
+ dtype: string
61
+ - name: table_caption
62
+ dtype: string
63
+ - name: statement
64
+ dtype: string
65
+ - name: test_id
66
+ dtype: string
67
+ splits:
68
+ - name: test
69
+ num_bytes: 10954442
70
+ num_examples: 9750
71
+ download_size: 196508436
72
+ dataset_size: 10954442
73
+ ---
74
+
75
+ # Dataset Card for TabFact
76
+
77
+ ## Table of Contents
78
+ - [Dataset Description](#dataset-description)
79
+ - [Dataset Summary](#dataset-summary)
80
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
81
+ - [Languages](#languages)
82
+ - [Dataset Structure](#dataset-structure)
83
+ - [Data Instances](#data-instances)
84
+ - [Data Fields](#data-fields)
85
+ - [Data Splits](#data-splits)
86
+ - [Dataset Creation](#dataset-creation)
87
+ - [Curation Rationale](#curation-rationale)
88
+ - [Source Data](#source-data)
89
+ - [Annotations](#annotations)
90
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
91
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
92
+ - [Social Impact of Dataset](#social-impact-of-dataset)
93
+ - [Discussion of Biases](#discussion-of-biases)
94
+ - [Other Known Limitations](#other-known-limitations)
95
+ - [Additional Information](#additional-information)
96
+ - [Dataset Curators](#dataset-curators)
97
+ - [Licensing Information](#licensing-information)
98
+ - [Citation Information](#citation-information)
99
+ - [Contributions](#contributions)
100
+
101
+ ## Dataset Description
102
+
103
+ - **Homepage:** [TabFact](https://tabfact.github.io/index.html)
104
+ - **Repository:** [GitHub](https://github.com/wenhuchen/Table-Fact-Checking)
105
+ - **Paper:** [TabFact: A Large-scale Dataset for Table-based Fact Verification](https://arxiv.org/abs/1909.02164)
106
+ - **Leaderboard:** [Leaderboard](https://competitions.codalab.org/competitions/21611)
107
+ - **Point of Contact:** [Wenhu Chen](wenhuchen@cs.ucsb.edu)
108
+
109
+ ### Dataset Summary
110
+
111
+ The problem of verifying whether a textual hypothesis holds the truth based on the given evidence, also known as fact verification, plays an important role in the study of natural language understanding and semantic representation. However, existing studies are restricted to dealing with unstructured textual evidence (e.g., sentences and passages, a pool of passages), while verification using structured forms of evidence, such as tables, graphs, and databases, remains unexplored. TABFACT is large scale dataset with 16k Wikipedia tables as evidence for 118k human annotated statements designed for fact verification with semi-structured evidence. The statements are labeled as either ENTAILED or REFUTED. TABFACT is challenging since it involves both soft linguistic reasoning and hard symbolic reasoning.
112
+
113
+ ### Supported Tasks and Leaderboards
114
+
115
+ [More Information Needed]
116
+
117
+ ### Languages
118
+
119
+ [More Information Needed]
120
+
121
+ ## Dataset Structure
122
+
123
+ ### Data Instances
124
+
125
+ [More Information Needed]
126
+
127
+ ### Data Fields
128
+
129
+ [More Information Needed]
130
+
131
+ ### Data Splits
132
+
133
+ [More Information Needed]
134
+ ## Dataset Creation
135
+
136
+ ### Curation Rationale
137
+
138
+ [More Information Needed]
139
+
140
+ ### Source Data
141
+
142
+ [More Information Needed]
143
+
144
+ #### Initial Data Collection and Normalization
145
+
146
+ [More Information Needed]
147
+
148
+ #### Who are the source language producers?
149
+
150
+ [More Information Needed]
151
+
152
+ ### Annotations
153
+
154
+ [More Information Needed]
155
+
156
+ #### Annotation process
157
+
158
+ [More Information Needed]
159
+
160
+ #### Who are the annotators?
161
+
162
+ [More Information Needed]
163
+
164
+ ### Personal and Sensitive Information
165
+
166
+ [More Information Needed]
167
+
168
+ ## Considerations for Using the Data
169
+
170
+ ### Social Impact of Dataset
171
+
172
+ [More Information Needed]
173
+
174
+ ### Discussion of Biases
175
+
176
+ [More Information Needed]
177
+
178
+ ### Other Known Limitations
179
+
180
+ [More Information Needed]
181
+
182
+ ## Additional Information
183
+
184
+ ### Dataset Curators
185
+
186
+ [More Information Needed]
187
+
188
+ ### Licensing Information
189
+
190
+ [More Information Needed]
191
+
192
+ ### Citation Information
193
+
194
+ ```
195
+ @inproceedings{2019TabFactA,
196
+ title={TabFact : A Large-scale Dataset for Table-based Fact Verification},
197
+ author={Wenhu Chen, Hongmin Wang, Jianshu Chen, Yunkai Zhang, Hong Wang, Shiyang Li, Xiyou Zhou and William Yang Wang},
198
+ booktitle = {International Conference on Learning Representations (ICLR)},
199
+ address = {Addis Ababa, Ethiopia},
200
+ month = {April},
201
+ year = {2020}
202
+ }
203
+ ```
204
+
205
+ ### Contributions
206
+
207
+ Thanks to [@patil-suraj](https://github.com/patil-suraj) for adding this dataset.
tab_fact.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 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
+ """TabFact: A Large-scale Dataset for Table-based Fact Verification"""
16
+
17
+
18
+ import json
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ _CITATION = """\
25
+ @inproceedings{2019TabFactA,
26
+ title={TabFact : A Large-scale Dataset for Table-based Fact Verification},
27
+ author={Wenhu Chen, Hongmin Wang, Jianshu Chen, Yunkai Zhang, Hong Wang, Shiyang Li, Xiyou Zhou and William Yang Wang},
28
+ booktitle = {International Conference on Learning Representations (ICLR)},
29
+ address = {Addis Ababa, Ethiopia},
30
+ month = {April},
31
+ year = {2020}
32
+ }
33
+ """
34
+
35
+ _DESCRIPTION = """\
36
+ The problem of verifying whether a textual hypothesis holds the truth based on the given evidence, \
37
+ also known as fact verification, plays an important role in the study of natural language \
38
+ understanding and semantic representation. However, existing studies are restricted to \
39
+ dealing with unstructured textual evidence (e.g., sentences and passages, a pool of passages), \
40
+ while verification using structured forms of evidence, such as tables, graphs, and databases, remains unexplored. \
41
+ TABFACT is large scale dataset with 16k Wikipedia tables as evidence for 118k human annotated statements \
42
+ designed for fact verification with semi-structured evidence. \
43
+ The statements are labeled as either ENTAILED or REFUTED. \
44
+ TABFACT is challenging since it involves both soft linguistic reasoning and hard symbolic reasoning.
45
+ """
46
+
47
+ _HOMEPAGE = "https://tabfact.github.io/"
48
+
49
+ _GIT_ARCHIVE_URL = (
50
+ "https://github.com/wenhuchen/Table-Fact-Checking/archive/948b5560e2f7f8c9139bd91c7f093346a2bb56a8.zip"
51
+ )
52
+
53
+
54
+ class TabFact(datasets.GeneratorBasedBuilder):
55
+ """TabFact: A Large-scale Dataset for Table-based Fact Verification"""
56
+
57
+ VERSION = datasets.Version("1.0.0")
58
+ BUILDER_CONFIGS = [
59
+ datasets.BuilderConfig(
60
+ name="tab_fact",
61
+ version=datasets.Version("1.0.0"),
62
+ ),
63
+ datasets.BuilderConfig(
64
+ name="blind_test",
65
+ version=datasets.Version("1.0.0"),
66
+ description="Blind test dataset",
67
+ ),
68
+ ]
69
+
70
+ def _info(self):
71
+ features = {
72
+ "id": datasets.Value("int32"),
73
+ "table_id": datasets.Value("string"),
74
+ "table_text": datasets.Value("string"),
75
+ "table_caption": datasets.Value("string"),
76
+ "statement": datasets.Value("string"),
77
+ }
78
+ if self.config.name == "tab_fact":
79
+ features["label"] = datasets.ClassLabel(names=["refuted", "entailed"])
80
+ else:
81
+ features["test_id"] = datasets.Value("string")
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
+ extracted_path = dl_manager.download_and_extract(_GIT_ARCHIVE_URL)
93
+
94
+ repo_path = os.path.join(extracted_path, "Table-Fact-Checking-948b5560e2f7f8c9139bd91c7f093346a2bb56a8")
95
+ all_csv_path = os.path.join(repo_path, "data", "all_csv")
96
+
97
+ if self.config.name == "blind_test":
98
+ test_file_path = os.path.join(repo_path, "challenge", "blind_test.json")
99
+ return [
100
+ datasets.SplitGenerator(
101
+ name=datasets.Split.TEST,
102
+ gen_kwargs={"statements_file": test_file_path, "all_csv_path": all_csv_path},
103
+ ),
104
+ ]
105
+
106
+ train_statements_file = os.path.join(repo_path, "tokenized_data", "train_examples.json")
107
+ val_statements_file = os.path.join(repo_path, "tokenized_data", "val_examples.json")
108
+ test_statements_file = os.path.join(repo_path, "tokenized_data", "test_examples.json")
109
+
110
+ return [
111
+ datasets.SplitGenerator(
112
+ name=datasets.Split.TRAIN,
113
+ gen_kwargs={"statements_file": train_statements_file, "all_csv_path": all_csv_path},
114
+ ),
115
+ datasets.SplitGenerator(
116
+ name=datasets.Split.VALIDATION,
117
+ gen_kwargs={"statements_file": val_statements_file, "all_csv_path": all_csv_path},
118
+ ),
119
+ datasets.SplitGenerator(
120
+ name=datasets.Split.TEST,
121
+ gen_kwargs={"statements_file": test_statements_file, "all_csv_path": all_csv_path},
122
+ ),
123
+ ]
124
+
125
+ def _generate_examples(self, statements_file, all_csv_path):
126
+ with open(statements_file, encoding="utf-8") as f:
127
+ examples = json.load(f)
128
+
129
+ if self.config.name == "blind_test":
130
+ test_examples = self._generate_blind_test_examples(examples, all_csv_path)
131
+ for idx, example in test_examples:
132
+ yield idx, example
133
+ else:
134
+ for i, (table_id, example) in enumerate(examples.items()):
135
+ table_file_path = os.path.join(all_csv_path, table_id)
136
+ with open(table_file_path, encoding="utf-8") as f:
137
+ tabel_text = f.read()
138
+
139
+ statements, labels, caption = example
140
+
141
+ for statement_idx, (statement, label) in enumerate(zip(statements, labels)):
142
+ yield f"{i}_{statement_idx}", {
143
+ "id": i,
144
+ "table_id": table_id,
145
+ "table_text": tabel_text,
146
+ "table_caption": caption,
147
+ "statement": statement,
148
+ "label": label,
149
+ }
150
+
151
+ def _generate_blind_test_examples(self, examples, all_csv_path):
152
+ for i, (test_id, example) in enumerate(examples.items()):
153
+ statement, table_id, caption = example
154
+ table_file_path = os.path.join(all_csv_path, table_id)
155
+ with open(table_file_path, encoding="utf-8") as f:
156
+ tabel_text = f.read()
157
+
158
+ yield i, {
159
+ "id": i,
160
+ "test_id": test_id,
161
+ "table_id": table_id,
162
+ "table_text": tabel_text,
163
+ "table_caption": caption,
164
+ "statement": statement,
165
+ }