Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
fact-checking
Size:
10K - 100K
ArXiv:
Tags:
stance-detection
License:
dataloader
Browse files- dataset_infos.json +1 -0
- x-stance.py +102 -0
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"de": {"description": "The x-stance dataset contains more than 150 political questions, and 67k comments written by candidates on those questions. The comments are partly German, partly French and Italian. The data have been extracted from the Swiss voting advice platform Smartvote.\n", "citation": "@inproceedings{vamvas2020xstance,\n author = \"Vamvas, Jannis and Sennrich, Rico\",\n title = \"{X-Stance}: A Multilingual Multi-Target Dataset for Stance Detection\",\n booktitle = \"Proceedings of the 5th Swiss Text Analytics Conference (SwissText) \\& 16th Conference on Natural Language Processing (KONVENS)\",\n address = \"Zurich, Switzerland\",\n year = \"2020\",\n month = \"jun\",\n url = \"http://ceur-ws.org/Vol-2624/paper9.pdf\"\n}\n", "homepage": "", "license": "cc-by-4.0", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "comment": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["FAVOR", "AGAINST"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "x_stance", "config_name": "de", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 11290213, "num_examples": 33850, "dataset_name": "x_stance"}, "validation": {"name": "validation", "num_bytes": 954346, "num_examples": 2871, "dataset_name": "x_stance"}, "test": {"name": "test", "num_bytes": 3788752, "num_examples": 11891, "dataset_name": "x_stance"}}, "download_checksums": {"x-stance-train-de.csv": {"num_bytes": 11023000, "checksum": "74842e9dd186851c4b71b8da57987c92cca29a9c86acd99dc057e32e507976c8"}, "x-stance-valid-de.csv": {"num_bytes": 931688, "checksum": "99b81cca23ffe41b3f5d4576c293f0265dada74dd49368a251934712456c834c"}, "x-stance-test-de.csv": {"num_bytes": 3694416, "checksum": "9ce9fc600881a052fb48b6e58f2485b0d7a86a9fda23679574acf37426c9b478"}}, "download_size": 15649104, "post_processing_size": null, "dataset_size": 16033311, "size_in_bytes": 31682415}, "fr": {"description": "The x-stance dataset contains more than 150 political questions, and 67k comments written by candidates on those questions. The comments are partly German, partly French and Italian. The data have been extracted from the Swiss voting advice platform Smartvote.\n", "citation": "@inproceedings{vamvas2020xstance,\n author = \"Vamvas, Jannis and Sennrich, Rico\",\n title = \"{X-Stance}: A Multilingual Multi-Target Dataset for Stance Detection\",\n booktitle = \"Proceedings of the 5th Swiss Text Analytics Conference (SwissText) \\& 16th Conference on Natural Language Processing (KONVENS)\",\n address = \"Zurich, Switzerland\",\n year = \"2020\",\n month = \"jun\",\n url = \"http://ceur-ws.org/Vol-2624/paper9.pdf\"\n}\n", "homepage": "", "license": "cc-by-4.0", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "comment": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["FAVOR", "AGAINST"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "x_stance", "config_name": "fr", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4357694, "num_examples": 11790, "dataset_name": "x_stance"}, "validation": {"name": "validation", "num_bytes": 378539, "num_examples": 1055, "dataset_name": "x_stance"}, "test": {"name": "test", "num_bytes": 2035193, "num_examples": 5814, "dataset_name": "x_stance"}}, "download_checksums": {"x-stance-train-fr.csv": {"num_bytes": 4260329, "checksum": "01c3d47b3758263a0b1e07d9bb124d9fa91eeaaa44fb002a2f6a41a3e3d76c30"}, "x-stance-valid-fr.csv": {"num_bytes": 369863, "checksum": "5886d34e849610c565172f0d0138dac3d645ab9e34251c46af89f8a6756f6eef"}, "x-stance-test-fr.csv": {"num_bytes": 1986935, "checksum": "ce413cd614f6a345125d1f2d692a31f9c017c48bd1b741eb86c815f4da4444f0"}}, "download_size": 6617127, "post_processing_size": null, "dataset_size": 6771426, "size_in_bytes": 13388553}}
|
x-stance.py
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2022 Mads Kongsbak and Leon Derczynski
|
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 |
+
"""X-stance dataset for German and French/Italian stance detection"""
|
15 |
+
|
16 |
+
|
17 |
+
import csv
|
18 |
+
import json
|
19 |
+
import os
|
20 |
+
|
21 |
+
import datasets
|
22 |
+
|
23 |
+
_CITATION = """\
|
24 |
+
@inproceedings{vamvas2020xstance,
|
25 |
+
author = "Vamvas, Jannis and Sennrich, Rico",
|
26 |
+
title = "{X-Stance}: A Multilingual Multi-Target Dataset for Stance Detection",
|
27 |
+
booktitle = "Proceedings of the 5th Swiss Text Analytics Conference (SwissText) \& 16th Conference on Natural Language Processing (KONVENS)",
|
28 |
+
address = "Zurich, Switzerland",
|
29 |
+
year = "2020",
|
30 |
+
month = "jun",
|
31 |
+
url = "http://ceur-ws.org/Vol-2624/paper9.pdf"
|
32 |
+
}
|
33 |
+
"""
|
34 |
+
|
35 |
+
_DESCRIPTION = """\
|
36 |
+
The x-stance dataset contains more than 150 political questions, and 67k comments written by candidates on those questions. The comments are partly German, partly French and Italian. The data have been extracted from the Swiss voting advice platform Smartvote.
|
37 |
+
"""
|
38 |
+
|
39 |
+
_HOMEPAGE = ""
|
40 |
+
|
41 |
+
_LICENSE = "cc-by-4.0"
|
42 |
+
|
43 |
+
class XStanceConfig(datasets.BuilderConfig):
|
44 |
+
|
45 |
+
def __init__(self, **kwargs):
|
46 |
+
super(XStanceConfig, self).__init__(**kwargs)
|
47 |
+
|
48 |
+
class XStance(datasets.GeneratorBasedBuilder):
|
49 |
+
"""The x-stance dataset split into two datasets in German and French/Italian"""
|
50 |
+
|
51 |
+
VERSION = datasets.Version("1.0.0")
|
52 |
+
|
53 |
+
BUILDER_CONFIGS = [
|
54 |
+
XStanceConfig(name="de", version=VERSION, description=""),
|
55 |
+
XStanceConfig(name="fr", version=VERSION, description="")
|
56 |
+
]
|
57 |
+
|
58 |
+
def _info(self):
|
59 |
+
features = datasets.Features(
|
60 |
+
{
|
61 |
+
"id": datasets.Value("string"),
|
62 |
+
"question": datasets.Value("string"),
|
63 |
+
"comment": datasets.Value("string"),
|
64 |
+
"label": datasets.features.ClassLabel(
|
65 |
+
names=[
|
66 |
+
"FAVOR",
|
67 |
+
"AGAINST",
|
68 |
+
]
|
69 |
+
)
|
70 |
+
}
|
71 |
+
)
|
72 |
+
|
73 |
+
return datasets.DatasetInfo(
|
74 |
+
description=_DESCRIPTION,
|
75 |
+
features=features,
|
76 |
+
homepage=_HOMEPAGE,
|
77 |
+
license=_LICENSE,
|
78 |
+
citation=_CITATION,
|
79 |
+
)
|
80 |
+
|
81 |
+
def _split_generators(self, dl_manager):
|
82 |
+
train_text = dl_manager.download_and_extract(f"x-stance-train-{self.config.name}.csv")
|
83 |
+
valid_text = dl_manager.download_and_extract(f"x-stance-valid-{self.config.name}.csv")
|
84 |
+
test_text = dl_manager.download_and_extract(f"x-stance-test-{self.config.name}.csv")
|
85 |
+
|
86 |
+
return [
|
87 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_text, "split": "train"}),
|
88 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": valid_text, "split": "validation"}),
|
89 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_text, "split": "test"}),
|
90 |
+
]
|
91 |
+
|
92 |
+
def _generate_examples(self, filepath, split):
|
93 |
+
with open(filepath, encoding="utf-8") as f:
|
94 |
+
reader = csv.DictReader(f, delimiter=",")
|
95 |
+
guid = 0
|
96 |
+
for instance in reader:
|
97 |
+
instance["question"] = instance.pop("question")
|
98 |
+
instance["comment"] = instance.pop("comment")
|
99 |
+
instance["label"] = instance.pop("label")
|
100 |
+
instance['id'] = str(guid)
|
101 |
+
yield guid, instance
|
102 |
+
guid += 1
|