Datasets:

Languages:
Zulu
Multilinguality:
monolingual
Size Categories:
1K<n<10K
Language Creators:
found
Annotations Creators:
expert-generated
Source Datasets:
original
ArXiv:
Tags:
stance-detection
License:
File size: 4,491 Bytes
c773d00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3887a5b
 
c773d00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# coding=utf-8
# Copyright 2020 HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Lint as: python3
"""Introduction to the CoNLL-2003 Shared Task: Language-Independent Named Entity Recognition"""

import json
import os

import datasets


logger = datasets.logging.get_logger(__name__)


_CITATION = """\
@inproceedings{dlamini_zulu_stance,
  title={Bridging the Domain Gap for Stance Detection for the Zulu language},
  author={Dlamini, Gcinizwe and Bekkouch, Imad Eddine Ibrahim and Khan, Adil and Derczynski, Leon},
  booktitle={Proceedings of IEEE IntelliSys},
  year={2022}
}
"""

_DESCRIPTION = """\
This is a stance detection dataset in the Zulu language. The data is translated to Zulu by Zulu native speakers, from English source texts.

Misinformation has become a major concern in recent last years given its 
spread across our information sources. In the past years, many NLP tasks have
been introduced in this area, with some systems reaching good results on 
English language datasets. Existing AI based approaches for fighting 
misinformation in literature suggest automatic stance detection as an integral
first step to success. Our paper aims at utilizing this progress made for
English to transfers that knowledge into other languages, which is a 
non-trivial task due to the domain gap between English and the target 
languages. We propose a black-box non-intrusive method that utilizes techniques
from Domain Adaptation to reduce the domain gap, without requiring any human
expertise in the target language, by leveraging low-quality data in both a
supervised and unsupervised manner. This allows us to rapidly achieve similar
results for stance detection for the Zulu language, the target language in
this work, as are found for English. We also provide a stance detection dataset
in the Zulu language. 
"""

_URL = "ZUstance.json"


class ZuluStanceConfig(datasets.BuilderConfig):
    """BuilderConfig for ZuluStance"""

    def __init__(self, **kwargs):
        """BuilderConfig ZuluStance.

        Args:
          **kwargs: keyword arguments forwarded to super.
        """
        super(ZuluStanceConfig, self).__init__(**kwargs)


class ZuluStance(datasets.GeneratorBasedBuilder):
    """ZuluStance dataset."""

    BUILDER_CONFIGS = [
        ZuluStanceConfig(name="zulu-stance", version=datasets.Version("1.0.0"), description="Stance dataset in Zulu"),
    ]

    def _info(self):
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=datasets.Features(
                {
                    "id": datasets.Value("string"),
                    "text": datasets.Value("string"),
                    "target": datasets.Value("string"),
                    "stance": datasets.features.ClassLabel(
                        names=[
                            "FAVOR",
                            "AGAINST",
                            "NONE",
                        ]
                    )
                }
            ),
            supervised_keys=None,
            homepage="https://arxiv.org/abs/2205.03153",
            citation=_CITATION,
        )

    def _split_generators(self, dl_manager):
        """Returns SplitGenerators."""
        downloaded_file = dl_manager.download_and_extract(_URL)

        return [
            datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}),
        ]

    def _generate_examples(self, filepath):
        logger.info("⏳ Generating examples from = %s", filepath)
        with open(filepath, encoding="utf-8") as f:
            guid = 0
            zustance_dataset = json.load(f)
            for instance in zustance_dataset:
                instance["id"] = str(guid)
                instance["text"] = instance.pop("Tweet")
                instance["target"] = instance.pop("Target")
                instance["stance"] = instance.pop("Stance")
                yield guid, instance
                guid += 1