leondz commited on
Commit
c773d00
1 Parent(s): 1a96d43

reader & data

Browse files
Files changed (2) hide show
  1. ZUstance.json +0 -0
  2. zulu_stance.py +118 -0
ZUstance.json ADDED
The diff for this file is too large to render. See raw diff
zulu_stance.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Introduction to the CoNLL-2003 Shared Task: Language-Independent Named Entity Recognition"""
18
+
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ logger = datasets.logging.get_logger(__name__)
26
+
27
+
28
+ _CITATION = """\
29
+ @inproceedings{dlamini_zulu_stance,
30
+ title={Bridging the Domain Gap for Stance Detection for the Zulu language},
31
+ author={Dlamini, Gcinizwe and Bekkouch, Imad Eddine Ibrahim and Khan, Adil and Derczynski, Leon},
32
+ booktitle={Proceedings of IEEE IntelliSys},
33
+ year={2022}
34
+ }
35
+ """
36
+
37
+ _DESCRIPTION = """\
38
+ Misinformation has become a major concern in recent last years given its
39
+ spread across our information sources. In the past years, many NLP tasks have
40
+ been introduced in this area, with some systems reaching good results on
41
+ English language datasets. Existing AI based approaches for fighting
42
+ misinformation in literature suggest automatic stance detection as an integral
43
+ first step to success. Our paper aims at utilizing this progress made for
44
+ English to transfers that knowledge into other languages, which is a
45
+ non-trivial task due to the domain gap between English and the target
46
+ languages. We propose a black-box non-intrusive method that utilizes techniques
47
+ from Domain Adaptation to reduce the domain gap, without requiring any human
48
+ expertise in the target language, by leveraging low-quality data in both a
49
+ supervised and unsupervised manner. This allows us to rapidly achieve similar
50
+ results for stance detection for the Zulu language, the target language in
51
+ this work, as are found for English. We also provide a stance detection dataset
52
+ in the Zulu language.
53
+ """
54
+
55
+ _URL = "ZUstance.json"
56
+
57
+
58
+ class ZuluStanceConfig(datasets.BuilderConfig):
59
+ """BuilderConfig for ZuluStance"""
60
+
61
+ def __init__(self, **kwargs):
62
+ """BuilderConfig ZuluStance.
63
+
64
+ Args:
65
+ **kwargs: keyword arguments forwarded to super.
66
+ """
67
+ super(ZuluStanceConfig, self).__init__(**kwargs)
68
+
69
+
70
+ class ZuluStance(datasets.GeneratorBasedBuilder):
71
+ """ZuluStance dataset."""
72
+
73
+ BUILDER_CONFIGS = [
74
+ ZuluStanceConfig(name="zulu-stance", version=datasets.Version("1.0.0"), description="Stance dataset in Zulu"),
75
+ ]
76
+
77
+ def _info(self):
78
+ return datasets.DatasetInfo(
79
+ description=_DESCRIPTION,
80
+ features=datasets.Features(
81
+ {
82
+ "id": datasets.Value("string"),
83
+ "text": datasets.Value("string"),
84
+ "target": datasets.Value("string"),
85
+ "stance": datasets.features.ClassLabel(
86
+ names=[
87
+ "FAVOR",
88
+ "AGAINST",
89
+ "NONE",
90
+ ]
91
+ )
92
+ }
93
+ ),
94
+ supervised_keys=None,
95
+ homepage="https://arxiv.org/abs/2205.03153",
96
+ citation=_CITATION,
97
+ )
98
+
99
+ def _split_generators(self, dl_manager):
100
+ """Returns SplitGenerators."""
101
+ downloaded_file = dl_manager.download_and_extract(_URL)
102
+
103
+ return [
104
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}),
105
+ ]
106
+
107
+ def _generate_examples(self, filepath):
108
+ logger.info("⏳ Generating examples from = %s", filepath)
109
+ with open(filepath, encoding="utf-8") as f:
110
+ guid = 0
111
+ zustance_dataset = json.load(f)
112
+ for instance in zustance_dataset:
113
+ instance["id"] = str(guid)
114
+ instance["text"] = instance.pop("Tweet")
115
+ instance["target"] = instance.pop("Target")
116
+ instance["stance"] = instance.pop("Stance")
117
+ yield guid, instance
118
+ guid += 1