Datasets:

Languages:
English
ArXiv:
License:
system HF staff commited on
Commit
30631f3
0 Parent(s):

Update files from the datasets library (from 1.3.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.3.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,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - crowdsourced
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - cc-by-4-0
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
+ - text-classification-other-hate-speech-detection
20
+ ---
21
+
22
+ # Dataset Card for hatexplain
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-instances)
32
+ - [Data Splits](#data-instances)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+ - [Contributions](#contributions)
47
+
48
+ ## Dataset Description
49
+
50
+ - **Homepage:** [Needs More Information]
51
+ - **Repository:** https://github.com/punyajoy/HateXplain/
52
+ - **Paper:** https://arxiv.org/abs/2012.10289
53
+ - **Leaderboard:** [Needs More Information]
54
+ - **Point of Contact:** [Needs More Information]
55
+
56
+ ### Dataset Summary
57
+
58
+ Hatexplain is the first benchmark hate speech dataset covering multiple aspects of the issue. Each post in the dataset is annotated from three different perspectives: the basic, commonly used 3-class classification (i.e., hate, offensive or normal), the target community (i.e., the community that has been the victim of hate speech/offensive speech in the post), and the rationales, i.e., the portions of the post on which their labeling decision (as hate, offensive or normal) is based.
59
+
60
+ WARNING: This dataset contains content that are offensive and/or hateful in nature.
61
+
62
+ ### Supported Tasks and Leaderboards
63
+
64
+ [Needs More Information]
65
+
66
+ ### Languages
67
+
68
+ The language supported is English.
69
+
70
+ ## Dataset Structure
71
+
72
+ ### Data Instances
73
+
74
+ Sample Entry:
75
+ ```
76
+ {
77
+ "id": "24198545_gab",
78
+ "annotators": [
79
+ {
80
+ "label": 0, # hatespeech
81
+ "annotator_id": 4,
82
+ "target": ["African"]
83
+ },
84
+ {
85
+ "label": 0, # hatespeech
86
+ "annotator_id": 3,
87
+ "target": ["African"]
88
+ },
89
+ {
90
+ "label": 2, # offensive
91
+ "annotator_id": 5,
92
+ "target": ["African"]
93
+ }
94
+ ],
95
+ "rationales":[
96
+ [0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0],
97
+ [0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
98
+ [0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
99
+ ],
100
+ "post_tokens": ["and","this","is","why","i","end","up","with","nigger","trainee","doctors","who","can","not","speak","properly","lack","basic","knowledge","of","biology","it","truly","scary","if","the","public","only","knew"]
101
+ }
102
+ }
103
+ ```
104
+
105
+ ### Data Fields
106
+
107
+ :small_blue_diamond:post_id : Unique id for each post<br/>
108
+ :small_blue_diamond:annotators : The list of annotations from each annotator<br/>
109
+ :small_blue_diamond:annotators[label] : The label assigned by the annotator to this post. Possible values: `hatespeech` (0), `normal` (1) or `offensive` (2)<br/>
110
+ :small_blue_diamond:annotators[annotator_id] : The unique Id assigned to each annotator<br/>
111
+ :small_blue_diamond:annotators[target] : A list of target community present in the post<br/>
112
+ :small_blue_diamond:rationales : A list of rationales selected by annotators. Each rationales represents a list with values 0 or 1. A value of 1 means that the token is part of the rationale selected by the annotator. To get the particular token, we can use the same index position in "post_tokens"<br/>
113
+ :small_blue_diamond:post_tokens : The list of tokens representing the post which was annotated<br/>
114
+
115
+ ### Data Splits
116
+
117
+ [Post_id_divisions](https://github.com/punyajoy/HateXplain/blob/master/Data/post_id_divisions.json) has a dictionary having train, valid and test post ids that are used to divide the dataset into train, val and test set in the ratio of 8:1:1.
118
+
119
+
120
+
121
+ ## Dataset Creation
122
+
123
+ ### Curation Rationale
124
+
125
+ [Needs More Information]
126
+
127
+ ### Source Data
128
+
129
+ #### Initial Data Collection and Normalization
130
+
131
+ [Needs More Information]
132
+
133
+ #### Who are the source language producers?
134
+
135
+ [Needs More Information]
136
+
137
+ ### Annotations
138
+
139
+ #### Annotation process
140
+
141
+ [Needs More Information]
142
+
143
+ #### Who are the annotators?
144
+
145
+ [Needs More Information]
146
+
147
+ ### Personal and Sensitive Information
148
+
149
+ [Needs More Information]
150
+
151
+ ## Considerations for Using the Data
152
+
153
+ ### Social Impact of Dataset
154
+
155
+ [Needs More Information]
156
+
157
+ ### Discussion of Biases
158
+
159
+ [Needs More Information]
160
+
161
+ ### Other Known Limitations
162
+
163
+ [Needs More Information]
164
+
165
+ ## Additional Information
166
+
167
+ ### Dataset Curators
168
+
169
+ [Needs More Information]
170
+
171
+ ### Licensing Information
172
+
173
+ [Needs More Information]
174
+
175
+ ### Citation Information
176
+
177
+ ```bibtex
178
+ @misc{mathew2020hatexplain,
179
+ title={HateXplain: A Benchmark Dataset for Explainable Hate Speech Detection},
180
+ author={Binny Mathew and Punyajoy Saha and Seid Muhie Yimam and Chris Biemann and Pawan Goyal and Animesh Mukherjee},
181
+ year={2020},
182
+ eprint={2012.10289},
183
+ archivePrefix={arXiv},
184
+ primaryClass={cs.CL}
185
+ }
186
+
187
+ ### Contributions
188
+
189
+ Thanks to [@kushal2000](https://github.com/kushal2000) for adding this dataset.
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"plain_text": {"description": "Hatexplain is the first benchmark hate speech dataset covering multiple aspects of the issue. Each post in the dataset is annotated from three different perspectives: the basic, commonly used 3-class classification (i.e., hate, offensive or normal), the target community (i.e., the community that has been the victim of hate speech/offensive speech in the post), and the rationales, i.e., the portions of the post on which their labelling decision (as hate, offensive or normal) is based.\n", "citation": "@misc{mathew2020hatexplain,\n title={HateXplain: A Benchmark Dataset for Explainable Hate Speech Detection}, \n author={Binny Mathew and Punyajoy Saha and Seid Muhie Yimam and Chris Biemann and Pawan Goyal and Animesh Mukherjee},\n year={2020},\n eprint={2012.10289},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "", "license": "cc-by-4.0", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "annotators": {"feature": {"label": {"num_classes": 3, "names": ["hatespeech", "normal", "offensive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "annotator_id": {"dtype": "int32", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "length": -1, "id": null, "_type": "Sequence"}, "rationales": {"feature": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "post_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "hatexplain", "config_name": "plain_text", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 7114730, "num_examples": 15383, "dataset_name": "hatexplain"}, "validation": {"name": "validation", "num_bytes": 884940, "num_examples": 1922, "dataset_name": "hatexplain"}, "test": {"name": "test", "num_bytes": 884784, "num_examples": 1924, "dataset_name": "hatexplain"}}, "download_checksums": {"https://raw.githubusercontent.com/punyajoy/HateXplain/master/Data/dataset.json": {"num_bytes": 12256170, "checksum": "63bb3340fee0ec469b09690d04cb68f7c187787dd8b83807f071892c084967fb"}, "https://raw.githubusercontent.com/punyajoy/HateXplain/master/Data/post_id_divisions.json": {"num_bytes": 591921, "checksum": "c2fb0d89862e7897b11ea3e9380753f15a793482b4b70ad0532dfb1212212835"}}, "download_size": 12848091, "post_processing_size": null, "dataset_size": 8884454, "size_in_bytes": 21732545}}
dummy/plain_text/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:471d89f681b671b8cd2cee80067d448e5521293e941851e2db9b4a178066abf8
3
+ size 1202
hatexplain.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Hatexplain: A Benchmark Dataset for Explainable Hate Speech Detection"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import json
20
+
21
+ import datasets
22
+
23
+
24
+ _CITATION = """\
25
+ @misc{mathew2020hatexplain,
26
+ title={HateXplain: A Benchmark Dataset for Explainable Hate Speech Detection},
27
+ author={Binny Mathew and Punyajoy Saha and Seid Muhie Yimam and Chris Biemann and Pawan Goyal and Animesh Mukherjee},
28
+ year={2020},
29
+ eprint={2012.10289},
30
+ archivePrefix={arXiv},
31
+ primaryClass={cs.CL}
32
+ }
33
+ """
34
+
35
+ # You can copy an official description
36
+ _DESCRIPTION = """\
37
+ Hatexplain is the first benchmark hate speech dataset covering multiple aspects of the issue. \
38
+ Each post in the dataset is annotated from three different perspectives: the basic, commonly used 3-class classification \
39
+ (i.e., hate, offensive or normal), the target community (i.e., the community that has been the victim of \
40
+ hate speech/offensive speech in the post), and the rationales, i.e., the portions of the post on which their labelling \
41
+ decision (as hate, offensive or normal) is based.
42
+ """
43
+
44
+ _HOMEPAGE = ""
45
+
46
+ _LICENSE = "cc-by-4.0"
47
+
48
+ _URL = "https://raw.githubusercontent.com/punyajoy/HateXplain/master/Data/"
49
+ _URLS = {
50
+ "dataset": _URL + "dataset.json",
51
+ "post_id_divisions": _URL + "post_id_divisions.json",
52
+ }
53
+
54
+
55
+ class HatexplainConfig(datasets.BuilderConfig):
56
+ """BuilderConfig for Hatexplain."""
57
+
58
+ def __init__(self, **kwargs):
59
+ """BuilderConfig for Hatexplain.
60
+ Args:
61
+ **kwargs: keyword arguments forwarded to super.
62
+ """
63
+ super(HatexplainConfig, self).__init__(**kwargs)
64
+
65
+
66
+ class Hatexplain(datasets.GeneratorBasedBuilder):
67
+ """Hatexplain: A Benchmark Dataset for Explainable Hate Speech Detection"""
68
+
69
+ BUILDER_CONFIGS = [
70
+ HatexplainConfig(
71
+ name="plain_text",
72
+ version=datasets.Version("1.0.0", ""),
73
+ description="Plain text",
74
+ ),
75
+ ]
76
+
77
+ def _info(self):
78
+ return datasets.DatasetInfo(
79
+ description=_DESCRIPTION,
80
+ features=datasets.Features(
81
+ {
82
+ "id": datasets.Value("string"),
83
+ "annotators": datasets.features.Sequence(
84
+ {
85
+ "label": datasets.ClassLabel(names=["hatespeech", "normal", "offensive"]),
86
+ "annotator_id": datasets.Value("int32"),
87
+ "target": datasets.Sequence(datasets.Value("string")),
88
+ }
89
+ ),
90
+ "rationales": datasets.features.Sequence(datasets.features.Sequence(datasets.Value("int32"))),
91
+ "post_tokens": datasets.features.Sequence(datasets.Value("string")),
92
+ }
93
+ ),
94
+ supervised_keys=None,
95
+ homepage="",
96
+ citation=_CITATION,
97
+ license=_LICENSE,
98
+ )
99
+
100
+ def _split_generators(self, dl_manager):
101
+ downloaded_files = dl_manager.download_and_extract(_URLS)
102
+
103
+ return [
104
+ datasets.SplitGenerator(
105
+ name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files, "split": "train"}
106
+ ),
107
+ datasets.SplitGenerator(
108
+ name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files, "split": "val"}
109
+ ),
110
+ datasets.SplitGenerator(
111
+ name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files, "split": "test"}
112
+ ),
113
+ ]
114
+
115
+ def _generate_examples(self, filepath, split):
116
+ """This function returns the examples depending on split"""
117
+
118
+ with open(filepath["post_id_divisions"], encoding="utf-8") as f:
119
+ post_id_divisions = json.load(f)
120
+ with open(filepath["dataset"], encoding="utf-8") as f:
121
+ dataset = json.load(f)
122
+
123
+ for id_, tweet_id in enumerate(post_id_divisions[split]):
124
+ info = dataset[tweet_id]
125
+ annotators, rationales, post_tokens = info["annotators"], info["rationales"], info["post_tokens"]
126
+
127
+ yield id_, {"id": tweet_id, "annotators": annotators, "rationales": rationales, "post_tokens": post_tokens}