Datasets:
Tasks:
Text Classification
Sub-tasks:
sentiment-analysis
Languages:
Danish
Size:
n<1K
Tags:
stance-detection
License:
reader and metadata for polstance
Browse files- README.md +182 -0
- dataset_infos.json +1 -0
- polstance.py +110 -0
README.md
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- da
|
8 |
+
licenses:
|
9 |
+
- cc-by-4.0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
pretty_name: Political Stance for Danish
|
13 |
+
size_categories:
|
14 |
+
- n<1K
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
- text-classification
|
19 |
+
task_ids:
|
20 |
+
- sentiment-analysis
|
21 |
+
---
|
22 |
+
|
23 |
+
# Dataset Card for "rustance"
|
24 |
+
|
25 |
+
## Table of Contents
|
26 |
+
- [Dataset Description](#dataset-description)
|
27 |
+
- [Dataset Summary](#dataset-summary)
|
28 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
29 |
+
- [Languages](#languages)
|
30 |
+
- [Dataset Structure](#dataset-structure)
|
31 |
+
- [Data Instances](#data-instances)
|
32 |
+
- [Data Fields](#data-fields)
|
33 |
+
- [Data Splits](#data-splits)
|
34 |
+
- [Dataset Creation](#dataset-creation)
|
35 |
+
- [Curation Rationale](#curation-rationale)
|
36 |
+
- [Source Data](#source-data)
|
37 |
+
- [Annotations](#annotations)
|
38 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
39 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
40 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
41 |
+
- [Discussion of Biases](#discussion-of-biases)
|
42 |
+
- [Other Known Limitations](#other-known-limitations)
|
43 |
+
- [Additional Information](#additional-information)
|
44 |
+
- [Dataset Curators](#dataset-curators)
|
45 |
+
- [Licensing Information](#licensing-information)
|
46 |
+
- [Citation Information](#citation-information)
|
47 |
+
- [Contributions](#contributions)
|
48 |
+
|
49 |
+
## Dataset Description
|
50 |
+
|
51 |
+
- **Homepage:** [https://stromberg.ai/publication/politicalstanceindanish/](https://stromberg.ai/publication/politicalstanceindanish/)
|
52 |
+
- **Repository:** [https://github.com/StrombergNLP/Political-Stance-in-Danish/](https://github.com/StrombergNLP/Political-Stance-in-Danish/)
|
53 |
+
- **Paper:** [https://aclanthology.org/W19-6121/](https://aclanthology.org/W19-6121/)
|
54 |
+
- **Point of Contact:** [Leon Derczynski](https://github.com/leondz)
|
55 |
+
- **Size of downloaded dataset files:** 548 KB
|
56 |
+
- **Size of the generated dataset:** 222 KB
|
57 |
+
- **Total amount of disk used:** 770 KB
|
58 |
+
|
59 |
+
### Dataset Summary
|
60 |
+
|
61 |
+
Political stance in Danish. Examples represent statements by
|
62 |
+
politicians and are annotated for, against, or neutral to a given topic/article.
|
63 |
+
|
64 |
+
### Supported Tasks and Leaderboards
|
65 |
+
|
66 |
+
*
|
67 |
+
|
68 |
+
### Languages
|
69 |
+
|
70 |
+
Danish, bcp47 `da-DK`
|
71 |
+
|
72 |
+
## Dataset Structure
|
73 |
+
|
74 |
+
### Data Instances
|
75 |
+
|
76 |
+
#### polstance
|
77 |
+
|
78 |
+
An example of 'train' looks as follows.
|
79 |
+
|
80 |
+
```
|
81 |
+
{
|
82 |
+
'id': '0',
|
83 |
+
'topic': 'integration',
|
84 |
+
'quote': 'Der kunne jeg godt tænke mig, at der stod mere eksplicit, at de (landene, red.) skal bekæmpe menneskesmuglere og tage imod deres egne borgere',
|
85 |
+
'label': 2,
|
86 |
+
'quoteID': '516',
|
87 |
+
'party': 'Det Konservative Folkeparti',
|
88 |
+
'politician': 'Naser Khader',
|
89 |
+
}
|
90 |
+
```
|
91 |
+
|
92 |
+
|
93 |
+
### Data Fields
|
94 |
+
|
95 |
+
- `id`: a `string` feature.
|
96 |
+
- `topic`: a `string` expressing a topic.
|
97 |
+
- `quote`: a `string` to be classified for its stance to the topic.
|
98 |
+
- `label`: a class label representing the stance the text expresses towards the target. Full tagset with indices:
|
99 |
+
|
100 |
+
```
|
101 |
+
0: "against",
|
102 |
+
1: "neutral",
|
103 |
+
2: "for",
|
104 |
+
```
|
105 |
+
- `quoteID`: a `string` of the internal quote ID.
|
106 |
+
- `party`: a `string` describing the party affiliation of the quote utterer at the time of utterance.
|
107 |
+
- `politician`: a `string` naming the politician who uttered the quote.
|
108 |
+
|
109 |
+
### Data Splits
|
110 |
+
|
111 |
+
| name |train|
|
112 |
+
|---------|----:|
|
113 |
+
|polstance|900 sentences|
|
114 |
+
|
115 |
+
## Dataset Creation
|
116 |
+
|
117 |
+
### Curation Rationale
|
118 |
+
|
119 |
+
Collection of quotes from politicians to allow detecting how political quotes orient to issues.
|
120 |
+
|
121 |
+
### Source Data
|
122 |
+
|
123 |
+
#### Initial Data Collection and Normalization
|
124 |
+
|
125 |
+
The data is taken from proceedings of the Danish parliament, the Folketing - [ft.dk](https://ft.dk).
|
126 |
+
|
127 |
+
#### Who are the source language producers?
|
128 |
+
|
129 |
+
Danish polticians
|
130 |
+
|
131 |
+
### Annotations
|
132 |
+
|
133 |
+
#### Annotation process
|
134 |
+
|
135 |
+
Annotators labelled comments for being against, neutral, or for a specified topic
|
136 |
+
|
137 |
+
#### Who are the annotators?
|
138 |
+
|
139 |
+
Danish native speakers, 20s, male, studying Software Design.
|
140 |
+
|
141 |
+
### Personal and Sensitive Information
|
142 |
+
|
143 |
+
The data was public at the time of collection and will remain open public record by law in Denmark.
|
144 |
+
|
145 |
+
## Considerations for Using the Data
|
146 |
+
|
147 |
+
### Social Impact of Dataset
|
148 |
+
|
149 |
+
|
150 |
+
### Discussion of Biases
|
151 |
+
|
152 |
+
|
153 |
+
### Other Known Limitations
|
154 |
+
|
155 |
+
The above limitations apply.
|
156 |
+
|
157 |
+
## Additional Information
|
158 |
+
|
159 |
+
### Dataset Curators
|
160 |
+
|
161 |
+
The dataset is curated by the paper's authors.
|
162 |
+
|
163 |
+
### Licensing Information
|
164 |
+
|
165 |
+
The authors distribute this data under Creative Commons attribution license, CC-BY 4.0.
|
166 |
+
|
167 |
+
### Citation Information
|
168 |
+
|
169 |
+
```
|
170 |
+
@inproceedings{lehmann2019political,
|
171 |
+
title={Political Stance in Danish},
|
172 |
+
author={Lehmann, Rasmus and Derczynski, Leon},
|
173 |
+
booktitle={Proceedings of the 22nd Nordic Conference on Computational Linguistics},
|
174 |
+
pages={197--207},
|
175 |
+
year={2019}
|
176 |
+
}
|
177 |
+
```
|
178 |
+
|
179 |
+
|
180 |
+
### Contributions
|
181 |
+
|
182 |
+
Author-added dataset [@leondz](https://github.com/leondz)
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"PolStance": {"description": "Political stance in Danish. Examples represent statements by \npoliticians and are annotated for, against, or neutral to a given topic/article.\n", "citation": "@inproceedings{lehmann2019political,\n title={Political Stance in Danish},\n author={Lehmann, Rasmus and Derczynski, Leon},\n booktitle={Proceedings of the 22nd Nordic Conference on Computational Linguistics},\n pages={197--207},\n year={2019}\n}\n", "homepage": "https://stromberg.ai/publication/politicalstanceindanish/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "topic": {"dtype": "string", "id": null, "_type": "Value"}, "quote": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["a", "n", "f"], "id": null, "_type": "ClassLabel"}, "quoteID": {"dtype": "string", "id": null, "_type": "Value"}, "party": {"dtype": "string", "id": null, "_type": "Value"}, "politician": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "pol_stance", "config_name": "PolStance", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 214873, "num_examples": 900, "dataset_name": "pol_stance"}}, "download_checksums": {"https://raw.githubusercontent.com/StrombergNLP/Political-Stance-in-Danish/master/Scraper/resources/parsedQuotes/quote_db.csv": {"num_bytes": 548952, "checksum": "3f611d4146279d0779931163961b876e786a5b47856c2f2817512f47d03d9217"}}, "download_size": 548952, "post_processing_size": null, "dataset_size": 214873, "size_in_bytes": 763825}}
|
polstance.py
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 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 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""Political Stance in Danish"""
|
18 |
+
|
19 |
+
import csv
|
20 |
+
import os
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
|
25 |
+
logger = datasets.logging.get_logger(__name__)
|
26 |
+
|
27 |
+
|
28 |
+
_CITATION = """\
|
29 |
+
@inproceedings{lehmann2019political,
|
30 |
+
title={Political Stance in Danish},
|
31 |
+
author={Lehmann, Rasmus and Derczynski, Leon},
|
32 |
+
booktitle={Proceedings of the 22nd Nordic Conference on Computational Linguistics},
|
33 |
+
pages={197--207},
|
34 |
+
year={2019}
|
35 |
+
}
|
36 |
+
"""
|
37 |
+
|
38 |
+
_DESCRIPTION = """\
|
39 |
+
Political stance in Danish. Examples represent statements by
|
40 |
+
politicians and are annotated for, against, or neutral to a given topic/article.
|
41 |
+
"""
|
42 |
+
|
43 |
+
_URL = "https://raw.githubusercontent.com/StrombergNLP/Political-Stance-in-Danish/master/Scraper/resources/parsedQuotes/quote_db.csv"
|
44 |
+
|
45 |
+
|
46 |
+
class PolStanceConfig(datasets.BuilderConfig):
|
47 |
+
"""BuilderConfig for PolStance"""
|
48 |
+
|
49 |
+
def __init__(self, **kwargs):
|
50 |
+
"""BuilderConfig PolStance.
|
51 |
+
|
52 |
+
Args:
|
53 |
+
**kwargs: keyword arguments forwarded to super.
|
54 |
+
"""
|
55 |
+
super(PolStanceConfig, self).__init__(**kwargs)
|
56 |
+
|
57 |
+
|
58 |
+
class PolStance(datasets.GeneratorBasedBuilder):
|
59 |
+
"""PolStance dataset."""
|
60 |
+
|
61 |
+
BUILDER_CONFIGS = [
|
62 |
+
PolStanceConfig(name="PolStance", version=datasets.Version("1.0.0"), description="Political Stance in Danish"),
|
63 |
+
]
|
64 |
+
|
65 |
+
def _info(self):
|
66 |
+
return datasets.DatasetInfo(
|
67 |
+
description=_DESCRIPTION,
|
68 |
+
features=datasets.Features(
|
69 |
+
# quoteID;party;politician;date;quote;falsePositive;subTopic;fan;articleID;topic
|
70 |
+
{
|
71 |
+
"id": datasets.Value("string"),
|
72 |
+
"topic": datasets.Value("string"),
|
73 |
+
"quote": datasets.Value("string"),
|
74 |
+
"label": datasets.features.ClassLabel(
|
75 |
+
names=["a", "n", "f"]
|
76 |
+
),
|
77 |
+
"quoteID": datasets.Value("string"),
|
78 |
+
"party": datasets.Value("string"),
|
79 |
+
"politician": datasets.Value("string"),
|
80 |
+
"quoteID": datasets.Value("string"),
|
81 |
+
}
|
82 |
+
),
|
83 |
+
supervised_keys=None,
|
84 |
+
homepage="https://stromberg.ai/publication/politicalstanceindanish/",
|
85 |
+
citation=_CITATION,
|
86 |
+
)
|
87 |
+
|
88 |
+
def _split_generators(self, dl_manager):
|
89 |
+
"""Returns SplitGenerators."""
|
90 |
+
downloaded_file = dl_manager.download_and_extract(_URL)
|
91 |
+
|
92 |
+
return [
|
93 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}),
|
94 |
+
]
|
95 |
+
|
96 |
+
def _generate_examples(self, filepath):
|
97 |
+
logger.info("⏳ Generating examples from = %s", filepath)
|
98 |
+
with open(filepath, encoding="utf-16") as f:
|
99 |
+
PolStance_reader = csv.DictReader(f, delimiter=";", quotechar='"')
|
100 |
+
guid = 0
|
101 |
+
for instance in PolStance_reader:
|
102 |
+
if not instance["fan"]:
|
103 |
+
continue
|
104 |
+
instance["topic"] = instance["topic"].rstrip()
|
105 |
+
instance["id"] = str(guid)
|
106 |
+
instance["label"] = instance.pop("fan")
|
107 |
+
for dropfield in ('falsePositive', 'subTopic', 'date', 'articleID'):
|
108 |
+
instance.pop(dropfield)
|
109 |
+
yield guid, instance
|
110 |
+
guid += 1
|