DomLoyer parquet-converter commited on
Commit
daeeccc
·
0 Parent(s):

Duplicate from ucsbnlp/liar

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 +244 -0
  3. liar.py +138 -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,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - found
6
+ language:
7
+ - en
8
+ license:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 10K<n<100K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - text-classification
18
+ task_ids: []
19
+ paperswithcode_id: liar
20
+ pretty_name: LIAR
21
+ tags:
22
+ - fake-news-detection
23
+ dataset_info:
24
+ features:
25
+ - name: id
26
+ dtype: string
27
+ - name: label
28
+ dtype:
29
+ class_label:
30
+ names:
31
+ '0': 'false'
32
+ '1': half-true
33
+ '2': mostly-true
34
+ '3': 'true'
35
+ '4': barely-true
36
+ '5': pants-fire
37
+ - name: statement
38
+ dtype: string
39
+ - name: subject
40
+ dtype: string
41
+ - name: speaker
42
+ dtype: string
43
+ - name: job_title
44
+ dtype: string
45
+ - name: state_info
46
+ dtype: string
47
+ - name: party_affiliation
48
+ dtype: string
49
+ - name: barely_true_counts
50
+ dtype: float32
51
+ - name: false_counts
52
+ dtype: float32
53
+ - name: half_true_counts
54
+ dtype: float32
55
+ - name: mostly_true_counts
56
+ dtype: float32
57
+ - name: pants_on_fire_counts
58
+ dtype: float32
59
+ - name: context
60
+ dtype: string
61
+ splits:
62
+ - name: train
63
+ num_bytes: 2730651
64
+ num_examples: 10269
65
+ - name: test
66
+ num_bytes: 341414
67
+ num_examples: 1283
68
+ - name: validation
69
+ num_bytes: 341592
70
+ num_examples: 1284
71
+ download_size: 1013571
72
+ dataset_size: 3413657
73
+ train-eval-index:
74
+ - config: default
75
+ task: text-classification
76
+ task_id: multi_class_classification
77
+ splits:
78
+ train_split: train
79
+ eval_split: test
80
+ col_mapping:
81
+ statement: text
82
+ label: target
83
+ metrics:
84
+ - type: accuracy
85
+ name: Accuracy
86
+ - type: f1
87
+ name: F1 macro
88
+ args:
89
+ average: macro
90
+ - type: f1
91
+ name: F1 micro
92
+ args:
93
+ average: micro
94
+ - type: f1
95
+ name: F1 weighted
96
+ args:
97
+ average: weighted
98
+ - type: precision
99
+ name: Precision macro
100
+ args:
101
+ average: macro
102
+ - type: precision
103
+ name: Precision micro
104
+ args:
105
+ average: micro
106
+ - type: precision
107
+ name: Precision weighted
108
+ args:
109
+ average: weighted
110
+ - type: recall
111
+ name: Recall macro
112
+ args:
113
+ average: macro
114
+ - type: recall
115
+ name: Recall micro
116
+ args:
117
+ average: micro
118
+ - type: recall
119
+ name: Recall weighted
120
+ args:
121
+ average: weighted
122
+ ---
123
+
124
+ # Dataset Card for [Dataset Name]
125
+
126
+ ## Table of Contents
127
+ - [Dataset Description](#dataset-description)
128
+ - [Dataset Summary](#dataset-summary)
129
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
130
+ - [Languages](#languages)
131
+ - [Dataset Structure](#dataset-structure)
132
+ - [Data Instances](#data-instances)
133
+ - [Data Fields](#data-fields)
134
+ - [Data Splits](#data-splits)
135
+ - [Dataset Creation](#dataset-creation)
136
+ - [Curation Rationale](#curation-rationale)
137
+ - [Source Data](#source-data)
138
+ - [Annotations](#annotations)
139
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
140
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
141
+ - [Social Impact of Dataset](#social-impact-of-dataset)
142
+ - [Discussion of Biases](#discussion-of-biases)
143
+ - [Other Known Limitations](#other-known-limitations)
144
+ - [Additional Information](#additional-information)
145
+ - [Dataset Curators](#dataset-curators)
146
+ - [Licensing Information](#licensing-information)
147
+ - [Citation Information](#citation-information)
148
+ - [Contributions](#contributions)
149
+
150
+ ## Dataset Description
151
+
152
+ - **Homepage:** https://sites.cs.ucsb.edu/~william/
153
+ - **Repository:**
154
+ - **Paper:** https://arxiv.org/abs/1705.00648
155
+ - **Leaderboard:**
156
+ - **Point of Contact:**
157
+
158
+ ### Dataset Summary
159
+
160
+ LIAR is a dataset for fake news detection with 12.8K human labeled short statements from politifact.com's API, and each statement is evaluated by a politifact.com editor for its truthfulness. The distribution of labels in the LIAR dataset is relatively well-balanced: except for 1,050 pants-fire cases, the instances for all other labels range from 2,063 to 2,638. In each case, the labeler provides a lengthy analysis report to ground each judgment.
161
+
162
+ ### Supported Tasks and Leaderboards
163
+
164
+ [More Information Needed]
165
+
166
+ ### Languages
167
+
168
+ English.
169
+
170
+ ## Dataset Structure
171
+
172
+ ### Data Instances
173
+
174
+ [More Information Needed]
175
+
176
+ ### Data Fields
177
+
178
+ [More Information Needed]
179
+
180
+ ### Data Splits
181
+
182
+ [More Information Needed]
183
+
184
+ ## Dataset Creation
185
+
186
+ ### Curation Rationale
187
+
188
+ [More Information Needed]
189
+
190
+ ### Source Data
191
+
192
+ #### Initial Data Collection and Normalization
193
+
194
+ [More Information Needed]
195
+
196
+ #### Who are the source language producers?
197
+
198
+ [More Information Needed]
199
+
200
+ ### Annotations
201
+
202
+ #### Annotation process
203
+
204
+ [More Information Needed]
205
+
206
+ #### Who are the annotators?
207
+
208
+ [More Information Needed]
209
+
210
+ ### Personal and Sensitive Information
211
+
212
+ [More Information Needed]
213
+
214
+ ## Considerations for Using the Data
215
+
216
+ ### Social Impact of Dataset
217
+
218
+ [More Information Needed]
219
+
220
+ ### Discussion of Biases
221
+
222
+ [More Information Needed]
223
+
224
+ ### Other Known Limitations
225
+
226
+ [More Information Needed]
227
+
228
+ ## Additional Information
229
+
230
+ ### Dataset Curators
231
+
232
+ [More Information Needed]
233
+
234
+ ### Licensing Information
235
+
236
+ [More Information Needed]
237
+
238
+ ### Citation Information
239
+
240
+ [More Information Needed]
241
+
242
+ ### Contributions
243
+
244
+ Thanks to [@hugoabonizio](https://github.com/hugoabonizio) for adding this dataset.
liar.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """LIAR is a dataset for fake news detection with annotated claims."""
16
+
17
+
18
+ import csv
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ _CITATION = """\
25
+ @inproceedings{wang-2017-liar,
26
+ title = "{``}Liar, Liar Pants on Fire{''}: A New Benchmark Dataset for Fake News Detection",
27
+ author = "Wang, William Yang",
28
+ booktitle = "Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)",
29
+ month = jul,
30
+ year = "2017",
31
+ address = "Vancouver, Canada",
32
+ publisher = "Association for Computational Linguistics",
33
+ url = "https://www.aclweb.org/anthology/P17-2067",
34
+ doi = "10.18653/v1/P17-2067",
35
+ pages = "422--426",
36
+ abstract = "Automatic fake news detection is a challenging problem in deception detection, and it has tremendous real-world political and social impacts. However, statistical approaches to combating fake news has been dramatically limited by the lack of labeled benchmark datasets. In this paper, we present LIAR: a new, publicly available dataset for fake news detection. We collected a decade-long, 12.8K manually labeled short statements in various contexts from PolitiFact.com, which provides detailed analysis report and links to source documents for each case. This dataset can be used for fact-checking research as well. Notably, this new dataset is an order of magnitude larger than previously largest public fake news datasets of similar type. Empirically, we investigate automatic fake news detection based on surface-level linguistic patterns. We have designed a novel, hybrid convolutional neural network to integrate meta-data with text. We show that this hybrid approach can improve a text-only deep learning model.",
37
+ }
38
+ """
39
+
40
+ _DESCRIPTION = """\
41
+ LIAR is a dataset for fake news detection with 12.8K human labeled short statements from politifact.com's API, and each statement is evaluated by a politifact.com editor for its truthfulness. The distribution of labels in the LIAR dataset is relatively well-balanced: except for 1,050 pants-fire cases, the instances for all other labels range from 2,063 to 2,638. In each case, the labeler provides a lengthy analysis report to ground each judgment.
42
+ """
43
+
44
+ _HOMEPAGE = "https://www.aclweb.org/anthology/P17-2067"
45
+
46
+ _LICENSE = "Unknown"
47
+
48
+ _URL = "https://www.cs.ucsb.edu/~william/data/liar_dataset.zip"
49
+
50
+
51
+ class Liar(datasets.GeneratorBasedBuilder):
52
+ """LIAR is a dataset for fake news detection with annotated claims."""
53
+
54
+ VERSION = datasets.Version("1.0.0")
55
+
56
+ def _info(self):
57
+ return datasets.DatasetInfo(
58
+ description=_DESCRIPTION,
59
+ features=datasets.Features(
60
+ {
61
+ "id": datasets.Value("string"),
62
+ "label": datasets.ClassLabel(
63
+ names=[
64
+ "false",
65
+ "half-true",
66
+ "mostly-true",
67
+ "true",
68
+ "barely-true",
69
+ "pants-fire",
70
+ ]
71
+ ),
72
+ "statement": datasets.Value("string"),
73
+ "subject": datasets.Value("string"),
74
+ "speaker": datasets.Value("string"),
75
+ "job_title": datasets.Value("string"),
76
+ "state_info": datasets.Value("string"),
77
+ "party_affiliation": datasets.Value("string"),
78
+ "barely_true_counts": datasets.Value("float"),
79
+ "false_counts": datasets.Value("float"),
80
+ "half_true_counts": datasets.Value("float"),
81
+ "mostly_true_counts": datasets.Value("float"),
82
+ "pants_on_fire_counts": datasets.Value("float"),
83
+ "context": datasets.Value("string"),
84
+ }
85
+ ),
86
+ supervised_keys=("statement", "label"),
87
+ homepage=_HOMEPAGE,
88
+ license=_LICENSE,
89
+ citation=_CITATION,
90
+ )
91
+
92
+ def _split_generators(self, dl_manager):
93
+ """Returns SplitGenerators."""
94
+
95
+ data_dir = dl_manager.download_and_extract(_URL)
96
+ return [
97
+ datasets.SplitGenerator(
98
+ name=datasets.Split.TRAIN,
99
+ gen_kwargs={
100
+ "filepath": os.path.join(data_dir, "train.tsv"),
101
+ "split": "train",
102
+ },
103
+ ),
104
+ datasets.SplitGenerator(
105
+ name=datasets.Split.TEST,
106
+ gen_kwargs={"filepath": os.path.join(data_dir, "test.tsv"), "split": "test"},
107
+ ),
108
+ datasets.SplitGenerator(
109
+ name=datasets.Split.VALIDATION,
110
+ gen_kwargs={
111
+ "filepath": os.path.join(data_dir, "valid.tsv"),
112
+ "split": "valid",
113
+ },
114
+ ),
115
+ ]
116
+
117
+ def _generate_examples(self, filepath, split):
118
+ """Yields examples."""
119
+
120
+ with open(filepath, encoding="utf-8") as tsv_file:
121
+ reader = csv.reader(tsv_file, delimiter="\t", quoting=csv.QUOTE_NONE)
122
+ for id_, row in enumerate(reader):
123
+ yield id_, {
124
+ "id": row[0],
125
+ "label": row[1],
126
+ "statement": row[2],
127
+ "subject": row[3],
128
+ "speaker": row[4],
129
+ "job_title": row[5],
130
+ "state_info": row[6],
131
+ "party_affiliation": row[7],
132
+ "barely_true_counts": row[8],
133
+ "false_counts": row[9],
134
+ "half_true_counts": row[10],
135
+ "mostly_true_counts": row[11],
136
+ "pants_on_fire_counts": row[12],
137
+ "context": row[13],
138
+ }