Datasets:
trueorfalse441
commited on
Commit
•
6db1b6b
1
Parent(s):
dce730f
Upload 4 files
Browse files- .gitattributes +0 -1
- README.md +229 -1
- dataset_infos.json +85 -0
- kmhas_korean_hate_speech.py +114 -0
.gitattributes
CHANGED
@@ -26,7 +26,6 @@
|
|
26 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
27 |
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
28 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
30 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
31 |
*.tgz filter=lfs diff=lfs merge=lfs -text
|
32 |
*.wasm filter=lfs diff=lfs merge=lfs -text
|
|
|
26 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
27 |
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
28 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
|
|
29 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
*.wasm filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,231 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language:
|
5 |
+
- ko
|
6 |
+
language_creators:
|
7 |
+
- found
|
8 |
+
license:
|
9 |
+
- cc-by-sa-4.0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
pretty_name: 'K-MHaS'
|
13 |
+
size_categories:
|
14 |
+
- 100K<n<1M
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
tags:
|
18 |
+
- K-MHaS
|
19 |
+
- Korean NLP
|
20 |
+
- Hate Speech Detection
|
21 |
+
- Dataset
|
22 |
+
- Coling2022
|
23 |
+
task_categories:
|
24 |
+
- text-classification
|
25 |
+
task_ids:
|
26 |
+
- multi-label-classification
|
27 |
+
- hate-speech-detection
|
28 |
+
paperswithcode_id: korean-multi-label-hate-speech-dataset
|
29 |
+
dataset_info:
|
30 |
+
features:
|
31 |
+
- name: text
|
32 |
+
dtype: string
|
33 |
+
- name: label
|
34 |
+
sequence:
|
35 |
+
class_label:
|
36 |
+
names:
|
37 |
+
0: origin
|
38 |
+
1: physical
|
39 |
+
2: politics
|
40 |
+
3: profanity
|
41 |
+
4: age
|
42 |
+
5: gender
|
43 |
+
6: race
|
44 |
+
7: religion
|
45 |
+
8: not_hate_speech
|
46 |
+
splits:
|
47 |
+
- name: train
|
48 |
+
num_bytes: 6845463
|
49 |
+
num_examples: 78977
|
50 |
+
- name: validation
|
51 |
+
num_bytes: 748899
|
52 |
+
num_examples: 8776
|
53 |
+
- name: test
|
54 |
+
num_bytes: 1902352
|
55 |
+
num_examples: 21939
|
56 |
+
download_size: 9496714
|
57 |
+
dataset_size: 109692
|
58 |
---
|
59 |
+
|
60 |
+
# Dataset Card for K-MHaS
|
61 |
+
|
62 |
+
## Table of Contents
|
63 |
+
- [Dataset Description](#dataset-description)
|
64 |
+
- [Dataset Summary](#dataset-summary)
|
65 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
66 |
+
- [Languages](#languages)
|
67 |
+
- [Dataset Structure](#dataset-structure)
|
68 |
+
- [Data Instances](#data-instances)
|
69 |
+
- [Data Fields](#data-fields)
|
70 |
+
- [Data Splits](#data-splits)
|
71 |
+
- [Dataset Creation](#dataset-creation)
|
72 |
+
- [Curation Rationale](#curation-rationale)
|
73 |
+
- [Source Data](#source-data)
|
74 |
+
- [Annotations](#annotations)
|
75 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
76 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
77 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
78 |
+
- [Discussion of Biases](#discussion-of-biases)
|
79 |
+
- [Other Known Limitations](#other-known-limitations)
|
80 |
+
- [Additional Information](#additional-information)
|
81 |
+
- [Dataset Curators](#dataset-curators)
|
82 |
+
- [Licensing Information](#licensing-information)
|
83 |
+
- [Citation Information](#citation-information)
|
84 |
+
- [Contributions](#contributions)
|
85 |
+
|
86 |
+
## Sample Code
|
87 |
+
<a href="https://colab.research.google.com/drive/171KhS1_LVBtpAFd_kaT8lcrZmhcz5ehY?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="base"/></a>
|
88 |
+
|
89 |
+
|
90 |
+
## Dataset Description
|
91 |
+
|
92 |
+
- **Homepage:** [K-MHaS](https://github.com/adlnlp/K-MHaS)
|
93 |
+
- **Repository:** [Korean Multi-label Hate Speech Dataset](https://github.com/adlnlp/K-MHaS)
|
94 |
+
- **Paper:** [K-MHaS: A Multi-label Hate Speech Detection Dataset in Korean Online News Comment](https://arxiv.org/abs/2208.10684)
|
95 |
+
- **Point of Contact:** [Caren Han](caren.han@sydney.edu.au)
|
96 |
+
- **Sample code:** [Colab](https://colab.research.google.com/drive/171KhS1_LVBtpAFd_kaT8lcrZmhcz5ehY?usp=sharing)
|
97 |
+
|
98 |
+
|
99 |
+
### Dataset Summary
|
100 |
+
|
101 |
+
The Korean Multi-label Hate Speech Dataset, **K-MHaS**, consists of 109,692 utterances from Korean online news comments, labelled with 8 fine-grained hate speech classes (labels: `Politics`, `Origin`, `Physical`, `Age`, `Gender`, `Religion`, `Race`, `Profanity`) or `Not Hate Speech` class. Each utterance provides from a single to four labels that can handles Korean language patterns effectively. For more details, please refer to our paper about [**K-MHaS**](https://aclanthology.org/2022.coling-1.311), published at COLING 2022.
|
102 |
+
|
103 |
+
### Supported Tasks and Leaderboards
|
104 |
+
Hate Speech Detection
|
105 |
+
|
106 |
+
* `binary classification` (labels: `Hate Speech`, `Not Hate Speech`)
|
107 |
+
* `multi-label classification`: (labels: `Politics`, `Origin`, `Physical`, `Age`, `Gender`, `Religion`, `Race`, `Profanity`, `Not Hate Speech`)
|
108 |
+
|
109 |
+
For the multi-label classification, a `Hate Speech` class from the binary classification, is broken down into eight classes, associated with the hate speech category. In order to reflect the social and historical context, we select the eight hate speech classes. For example, the `Politics` class is chosen, due to a significant influence on the style of Korean hate speech.
|
110 |
+
|
111 |
+
### Languages
|
112 |
+
|
113 |
+
Korean
|
114 |
+
|
115 |
+
## Dataset Structure
|
116 |
+
|
117 |
+
### Data Instances
|
118 |
+
|
119 |
+
The dataset is provided with train/validation/test set in the txt format. Each instance is a news comment with a corresponding one or more hate speech classes (labels: `Politics`, `Origin`, `Physical`, `Age`, `Gender`, `Religion`, `Race`, `Profanity`) or `Not Hate Speech` class. The label numbers matching in both English and Korean is in the data fields section.
|
120 |
+
|
121 |
+
```python
|
122 |
+
{'text':'수꼴틀딱시키들이 다 디져야 나라가 똑바로 될것같다..답이 없는 종자들ㅠ'
|
123 |
+
'label': [2, 3, 4]
|
124 |
+
}
|
125 |
+
```
|
126 |
+
|
127 |
+
### Data Fields
|
128 |
+
|
129 |
+
* `text`: utterance from Korean online news comment.
|
130 |
+
* `label`: the label numbers matching with 8 fine-grained hate speech classes and `not hate speech` class are follows.
|
131 |
+
* `0`: `Origin`(`출신차별`) hate speech based on place of origin or identity;
|
132 |
+
* `1`: `Physical`(`외모차별`) hate speech based on physical appearance (e.g. body, face) or disability;
|
133 |
+
* `2`: `Politics`(`정치성향차별`) hate speech based on political stance;
|
134 |
+
* `3`: `Profanity`(`혐오욕설`) hate speech in the form of swearing, cursing, cussing, obscene words, or expletives; or an unspecified hate speech category;
|
135 |
+
* `4`: `Age`(`연령차별`) hate speech based on age;
|
136 |
+
* `5`: `Gender`(`성차별`) hate speech based on gender or sexual orientation (e.g. woman, homosexual);
|
137 |
+
* `6`: `Race`(`인종차별`) hate speech based on ethnicity;
|
138 |
+
* `7`: `Religion`(`종교차별`) hate speech based on religion;
|
139 |
+
* `8`: `Not Hate Speech`(`해당사항없음`).
|
140 |
+
|
141 |
+
### Data Splits
|
142 |
+
|
143 |
+
In our repository, we provide splitted datasets that have 78,977(train) / 8,776 (validation) / 21,939 (test) samples, preserving the class proportion.
|
144 |
+
|
145 |
+
## Dataset Creation
|
146 |
+
|
147 |
+
### Curation Rationale
|
148 |
+
|
149 |
+
We propose K-MHaS, a large size Korean multi-label hate speech detection dataset that represents Korean language patterns effectively. Most datasets in hate speech research are annotated using a single label classification of particular aspects, even though the subjectivity of hate speech cannot be explained with a mutually exclusive annotation scheme. We propose a multi-label hate speech annotation scheme that allows overlapping labels associated with the subjectivity and the intersectionality of hate speech.
|
150 |
+
|
151 |
+
### Source Data
|
152 |
+
|
153 |
+
#### Initial Data Collection and Normalization
|
154 |
+
|
155 |
+
Our dataset is based on the Korean online news comments available on Kaggle and Github. The unlabeled raw data was collected between January 2018 and June 2020. Please see the details in our paper [K-MHaS](https://aclanthology.org/2022.coling-1.311) published at COLING2020.
|
156 |
+
|
157 |
+
|
158 |
+
#### Who are the source language producers?
|
159 |
+
|
160 |
+
The language producers are users who left the comments on the Korean online news platform between 2018 and 2020.
|
161 |
+
|
162 |
+
### Annotations
|
163 |
+
|
164 |
+
#### Annotation process
|
165 |
+
|
166 |
+
We begin with the common categories of hate speech found in literature and match the keywords for each category. After the preliminary round, we investigate the results to merge or remove labels in order to provide the most representative subtype labels of hate speech contextual to the cultural background. Our annotation instructions explain a twolayered annotation to (a) distinguish hate and not hate speech, and (b) the categories of hate speech. Annotators are requested to consider given keywords or alternatives of each category within social, cultural, and historical circumstances. For more details, please refer to the paper [K-MHaS](https://aclanthology.org/2022.coling-1.311).
|
167 |
+
|
168 |
+
#### Who are the annotators?
|
169 |
+
|
170 |
+
Five native speakers were recruited for manual annotation in both the preliminary and main rounds.
|
171 |
+
|
172 |
+
### Personal and Sensitive Information
|
173 |
+
|
174 |
+
This datasets contains examples of hateful language, however, has no personal information.
|
175 |
+
|
176 |
+
## Considerations for Using the Data
|
177 |
+
|
178 |
+
### Social Impact of Dataset
|
179 |
+
|
180 |
+
We propose K-MHaS, a new large-sized dataset for Korean hate speech detection with a multi-label annotation scheme. We provided extensive baseline experiment results, presenting the usability of a dataset to detect Korean language patterns in hate speech.
|
181 |
+
|
182 |
+
### Discussion of Biases
|
183 |
+
|
184 |
+
All annotators were recruited from a crowdsourcing platform. They were informed about hate speech before handling the data. Our instructions allowed them to feel free to leave if they were uncomfortable with the content. With respect to the potential risks, we note that the subjectivity of human annotation would impact on the quality of the dataset.
|
185 |
+
|
186 |
+
### Other Known Limitations
|
187 |
+
|
188 |
+
[More Information Needed]
|
189 |
+
|
190 |
+
## Additional Information
|
191 |
+
|
192 |
+
### Dataset Curators
|
193 |
+
|
194 |
+
This dataset is curated by Taejun Lim, Heejun Lee and Bogeun Jo.
|
195 |
+
|
196 |
+
### Licensing Information
|
197 |
+
|
198 |
+
Creative Commons Attribution-ShareAlike 4.0 International (cc-by-sa-4.0).
|
199 |
+
|
200 |
+
### Citation Information
|
201 |
+
|
202 |
+
```
|
203 |
+
@inproceedings{lee-etal-2022-k,
|
204 |
+
title = "K-{MH}a{S}: A Multi-label Hate Speech Detection Dataset in {K}orean Online News Comment",
|
205 |
+
author = "Lee, Jean and
|
206 |
+
Lim, Taejun and
|
207 |
+
Lee, Heejun and
|
208 |
+
Jo, Bogeun and
|
209 |
+
Kim, Yangsok and
|
210 |
+
Yoon, Heegeun and
|
211 |
+
Han, Soyeon Caren",
|
212 |
+
booktitle = "Proceedings of the 29th International Conference on Computational Linguistics",
|
213 |
+
month = oct,
|
214 |
+
year = "2022",
|
215 |
+
address = "Gyeongju, Republic of Korea",
|
216 |
+
publisher = "International Committee on Computational Linguistics",
|
217 |
+
url = "https://aclanthology.org/2022.coling-1.311",
|
218 |
+
pages = "3530--3538",
|
219 |
+
abstract = "Online hate speech detection has become an important issue due to the growth of online content, but resources in languages other than English are extremely limited. We introduce K-MHaS, a new multi-label dataset for hate speech detection that effectively handles Korean language patterns. The dataset consists of 109k utterances from news comments and provides a multi-label classification using 1 to 4 labels, and handles subjectivity and intersectionality. We evaluate strong baselines on K-MHaS. KR-BERT with a sub-character tokenizer outperforms others, recognizing decomposed characters in each hate speech class.",
|
220 |
+
}
|
221 |
+
```
|
222 |
+
|
223 |
+
### Contributions
|
224 |
+
The contributors of the work are:
|
225 |
+
- [Jean Lee](https://jeanlee-ai.github.io/) (The University of Sydney)
|
226 |
+
- [Taejun Lim](https://github.com/taezun) (The University of Sydney)
|
227 |
+
- [Heejun Lee](https://bigwaveai.com/) (BigWave AI)
|
228 |
+
- [Bogeun Jo](https://bigwaveai.com/) (BigWave AI)
|
229 |
+
- Yangsok Kim (Keimyung University)
|
230 |
+
- Heegeun Yoon (National Information Society Agency)
|
231 |
+
- [Soyeon Caren Han](https://drcarenhan.github.io/) (The University of Western Australia and The University of Sydney)
|
dataset_infos.json
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{"default": {
|
2 |
+
"description": "Korean Multi-label Hate Speech Dataset - K-MHaS \n a new multi-label dataset for hate speech detection that consists of 109k utterances from Korean online news comments,\n labelled with 8 fine-grained hate speech classes or not hate speech class. \n",
|
3 |
+
"citation": "@inproceedings{lee-etal-2022-k,\n title = \"K-{MH}a{S}: A Multi-label Hate Speech Detection Dataset in {K}orean Online News Comment\",\n author = \"Lee, Jean and\n Lim, Taejun and\n Lee, Heejun and\n Jo, Bogeun and\n Kim, Yangsok and\n Yoon, Heegeun and\n Han, Soyeon Caren\",\n booktitle = \"Proceedings of the 29th International Conference on Computational Linguistics\",\n month = oct,\n year = \"2022\",\n address = \"Gyeongju, Republic of Korea\",\n publisher = \"International Committee on Computational Linguistics\",\n url = \"https://aclanthology.org/2022.coling-1.311\",\n pages = \"3530--3538\",\n abstract = \"Online hate speech detection has become an important issue due to the growth of online content, but resources in languages other than English are extremely limited. We introduce K-MHaS, a new multi-label dataset for hate speech detection that effectively handles Korean language patterns. The dataset consists of 109k utterances from news comments and provides a multi-label classification using 1 to 4 labels, and handles subjectivity and intersectionality. We evaluate strong baselines on K-MHaS. KR-BERT with a sub-character tokenizer outperforms others, recognizing decomposed characters in each hate speech class.\",\n}\n",
|
4 |
+
"homepage": "https://github.com/adlnlp/K-MHaS",
|
5 |
+
"license": "cc-by-sa-4.0",
|
6 |
+
"features": {
|
7 |
+
"text": {
|
8 |
+
"dtype": "string",
|
9 |
+
"id": null,
|
10 |
+
"_type": "Value"
|
11 |
+
},
|
12 |
+
"label": {
|
13 |
+
"feature": {
|
14 |
+
"num_classes": 9,
|
15 |
+
"names": [
|
16 |
+
"origin",
|
17 |
+
"physical",
|
18 |
+
"politics",
|
19 |
+
"profanity",
|
20 |
+
"age",
|
21 |
+
"gender",
|
22 |
+
"race",
|
23 |
+
"religion",
|
24 |
+
"not_hate_speech"
|
25 |
+
],
|
26 |
+
"names_file": null,
|
27 |
+
"id": null,
|
28 |
+
"_type": "ClassLabel"
|
29 |
+
},
|
30 |
+
"length": -1,
|
31 |
+
"id": null,
|
32 |
+
"_type": "Sequence"
|
33 |
+
}
|
34 |
+
},
|
35 |
+
"post_processed": null,
|
36 |
+
"supervised_keys": null,
|
37 |
+
"builder_name": "kmhas_korean_hate_speech",
|
38 |
+
"config_name": "default",
|
39 |
+
"version": {
|
40 |
+
"version_str": "1.0.0",
|
41 |
+
"description": null,
|
42 |
+
"major": 1,
|
43 |
+
"minor": 0,
|
44 |
+
"patch": 0
|
45 |
+
},
|
46 |
+
"splits": {
|
47 |
+
"train": {
|
48 |
+
"name": "train",
|
49 |
+
"num_bytes": 6845463,
|
50 |
+
"num_examples": 78977,
|
51 |
+
"dataset_name": "kmhas_korean_hate_speech"
|
52 |
+
},
|
53 |
+
"validation": {
|
54 |
+
"name": "validation",
|
55 |
+
"num_bytes": 748899,
|
56 |
+
"num_examples": 8776,
|
57 |
+
"dataset_name": "kmhas_korean_hate_speech"
|
58 |
+
},
|
59 |
+
"test": {
|
60 |
+
"name": "test",
|
61 |
+
"num_bytes": 1902352,
|
62 |
+
"num_examples": 21939,
|
63 |
+
"dataset_name": "kmhas_korean_hate_speech"
|
64 |
+
}
|
65 |
+
},
|
66 |
+
"download_checksums": {
|
67 |
+
"https://raw.githubusercontent.com/adlnlp/K-MHaS/main/data/kmhas_train.txt": {
|
68 |
+
"num_bytes": 6845463,
|
69 |
+
"checksum": "ca9145afc5fd70a2222094daa427e57a08b309cb42dcce7986528b44eb0e7008"
|
70 |
+
},
|
71 |
+
"https://raw.githubusercontent.com/adlnlp/K-MHaS/main/data/kmhas_valid.txt": {
|
72 |
+
"num_bytes": 748899,
|
73 |
+
"checksum": "cb0df9e3cd665125b554d4c5e6f48b0801d5535ead51269134de5b85ae469c18"
|
74 |
+
},
|
75 |
+
"https://raw.githubusercontent.com/adlnlp/K-MHaS/main/data/kmhas_test.txt": {
|
76 |
+
"num_bytes": 1902352,
|
77 |
+
"checksum": "9eaf470ee12c445817301d58672349500d6759516a730e879d36d6de17a2051a"
|
78 |
+
}
|
79 |
+
},
|
80 |
+
"download_size": 9496714,
|
81 |
+
"post_processing_size": null,
|
82 |
+
"dataset_size": 109692,
|
83 |
+
"size_in_bytes": 9496714
|
84 |
+
}
|
85 |
+
}
|
kmhas_korean_hate_speech.py
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""K-MHaS Korean Multi-label Hate Speech Dataset"""
|
16 |
+
|
17 |
+
|
18 |
+
import csv
|
19 |
+
|
20 |
+
import datasets
|
21 |
+
|
22 |
+
|
23 |
+
_CITATION = """\
|
24 |
+
@inproceedings{lee-etal-2022-k,
|
25 |
+
title = "K-{MH}a{S}: A Multi-label Hate Speech Detection Dataset in {K}orean Online News Comment",
|
26 |
+
author = "Lee, Jean and
|
27 |
+
Lim, Taejun and
|
28 |
+
Lee, Heejun and
|
29 |
+
Jo, Bogeun and
|
30 |
+
Kim, Yangsok and
|
31 |
+
Yoon, Heegeun and
|
32 |
+
Han, Soyeon Caren",
|
33 |
+
booktitle = "Proceedings of the 29th International Conference on Computational Linguistics",
|
34 |
+
month = oct,
|
35 |
+
year = "2022",
|
36 |
+
address = "Gyeongju, Republic of Korea",
|
37 |
+
publisher = "International Committee on Computational Linguistics",
|
38 |
+
url = "https://aclanthology.org/2022.coling-1.311",
|
39 |
+
pages = "3530--3538",
|
40 |
+
abstract = "Online hate speech detection has become an important issue due to the growth of online content, but resources in languages other than English are extremely limited. We introduce K-MHaS, a new multi-label dataset for hate speech detection that effectively handles Korean language patterns. The dataset consists of 109k utterances from news comments and provides a multi-label classification using 1 to 4 labels, and handles subjectivity and intersectionality. We evaluate strong baselines on K-MHaS. KR-BERT with a sub-character tokenizer outperforms others, recognizing decomposed characters in each hate speech class.",
|
41 |
+
}
|
42 |
+
"""
|
43 |
+
|
44 |
+
_DESCRIPTION = """\
|
45 |
+
The K-MHaS (Korean Multi-label Hate Speech) dataset contains 109k utterances from Korean online news comments labeled with 8 fine-grained hate speech classes or Not Hate Speech class.
|
46 |
+
The fine-grained hate speech classes are politics, origin, physical, age, gender, religion, race, and profanity and these categories are selected in order to reflect the social and historical context.
|
47 |
+
"""
|
48 |
+
|
49 |
+
_HOMEPAGE = "https://github.com/adlnlp/K-MHaS"
|
50 |
+
|
51 |
+
_LICENSE = "cc-by-sa-4.0"
|
52 |
+
|
53 |
+
_TRAIN_DOWNLOAD_URL = "https://raw.githubusercontent.com/adlnlp/K-MHaS/main/data/kmhas_train.txt"
|
54 |
+
_VALIDATION_DOWNLOAD_URL = "https://raw.githubusercontent.com/adlnlp/K-MHaS/main/data/kmhas_valid.txt"
|
55 |
+
_TEST_DOWNLOAD_URL = "https://raw.githubusercontent.com/adlnlp/K-MHaS/main/data/kmhas_test.txt"
|
56 |
+
|
57 |
+
_CLASS_NAMES = [
|
58 |
+
"origin",
|
59 |
+
"physical",
|
60 |
+
"politics",
|
61 |
+
"profanity",
|
62 |
+
"age",
|
63 |
+
"gender",
|
64 |
+
"race",
|
65 |
+
"religion",
|
66 |
+
"not_hate_speech"
|
67 |
+
]
|
68 |
+
|
69 |
+
class Kmhas(datasets.GeneratorBasedBuilder):
|
70 |
+
"""K-MHaS Korean Multi-label Hate Speech Dataset"""
|
71 |
+
|
72 |
+
VERSION = datasets.Version("1.0.0")
|
73 |
+
|
74 |
+
def _info(self):
|
75 |
+
features = datasets.Features(
|
76 |
+
{
|
77 |
+
"text": datasets.Value("string"),
|
78 |
+
"label": datasets.Sequence(datasets.ClassLabel(names=_CLASS_NAMES))
|
79 |
+
}
|
80 |
+
)
|
81 |
+
|
82 |
+
return datasets.DatasetInfo(
|
83 |
+
description=_DESCRIPTION,
|
84 |
+
features=features,
|
85 |
+
homepage=_HOMEPAGE,
|
86 |
+
license=_LICENSE,
|
87 |
+
citation=_CITATION,
|
88 |
+
)
|
89 |
+
|
90 |
+
def _split_generators(self, dl_manager):
|
91 |
+
train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
|
92 |
+
validation_path = dl_manager.download_and_extract(_VALIDATION_DOWNLOAD_URL)
|
93 |
+
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
|
94 |
+
return [
|
95 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
96 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": validation_path}),
|
97 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
|
98 |
+
]
|
99 |
+
|
100 |
+
def _generate_examples(self, filepath):
|
101 |
+
"""Generate K-MHaS Korean Multi-label Hate Speech examples"""
|
102 |
+
|
103 |
+
with open(filepath, 'r', encoding="utf-8") as f:
|
104 |
+
lines = f.readlines()[1:]
|
105 |
+
|
106 |
+
for index, line in enumerate(lines):
|
107 |
+
row = line.strip().split('\t')
|
108 |
+
sentence = row[0]
|
109 |
+
label = [int(ind) for ind in row[1].split(",")]
|
110 |
+
yield index, {
|
111 |
+
"text" : sentence,
|
112 |
+
"label": label,
|
113 |
+
}
|
114 |
+
|