Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
hate-speech-detection
Size:
10K - 100K
ArXiv:
initial data + skeleton reader
Browse files- offenseval-ar-labela-v1.csv +3 -0
- offenseval-ar-test-v1.tsv +3 -0
- offenseval-ar-training-v1.tsv +3 -0
- offenseval-da-labela-v1.csv +3 -0
- offenseval-da-test-v1.tsv +3 -0
- offenseval-da-training-v1.tsv +3 -0
- offenseval-en-labela-v1.csv +3 -0
- offenseval-en-test-v1.tsv +3 -0
- offenseval-en-training-v1.tsv +3 -0
- offenseval-gr-labela-v1.csv +3 -0
- offenseval-gr-test-v1.tsv +3 -0
- offenseval-gr-training-v1.tsv +3 -0
- offenseval-tr-labela-v1.csv +3 -0
- offenseval-tr-test-v1.tsv +3 -0
- offenseval-tr-training-v1.tsv +3 -0
- offenseval_2020.py +124 -0
offenseval-ar-labela-v1.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a6bdef49799f4578343cf081ce324cb27a6c4aaa98e5dc0f3c73421be416b278
|
3 |
+
size 18001
|
offenseval-ar-test-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7111d80e3c0b2b54110de0388720652e2ccb3ecfcc45621c8d75fce6d49d0c8b
|
3 |
+
size 372636
|
offenseval-ar-training-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:85508d9048ecd096f74a3cb44256191b5174b938a6b81b89a420bc35d8947f8b
|
3 |
+
size 1511224
|
offenseval-da-labela-v1.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:132212843033d68136bfe4f6621fed72d1848d3f500201ff3f8670e15ba81de8
|
3 |
+
size 2829
|
offenseval-da-test-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f96deeeb2df72d079145934681ccd20dff6453663fdc8d410a0bdd5a83493232
|
3 |
+
size 31588
|
offenseval-da-training-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4701ddcccf3b438dce370a4467f6e37ae489822a22eeeeffe27ad4f2020c63c3
|
3 |
+
size 345829
|
offenseval-en-labela-v1.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1c5de13022a8ff6dff2c513efe144f7267ce9df9cf6edef1ef62dcd138f23658
|
3 |
+
size 37760
|
offenseval-en-test-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ae60a2a7d493fb27271b462b472d6ef60d61551aa89ce5dcff41258bd45823ea
|
3 |
+
size 337449
|
offenseval-en-training-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2f49126e616d2d2c2e4d859f91be555e0b06b8c09b2cbe9112c24030f1ef1c99
|
3 |
+
size 23
|
offenseval-gr-labela-v1.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:78ccbe32fae6938200c61a62df1abd8aa3b438e5e53b3f7ea63dbc83b89e238b
|
3 |
+
size 13757
|
offenseval-gr-test-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b69b3f98feb0fbde0f8070462f2eab96db5a435959c9b83c1c3526dd8d82e1b8
|
3 |
+
size 300740
|
offenseval-gr-training-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ced53064ea556009f8725c5c6ab5ad246579420a2ad2a8502d74a16f7ef8cf0d
|
3 |
+
size 1718398
|
offenseval-tr-labela-v1.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ae9b0837e948c3d9c3a147d2a415989a4940a7756d5821b3289276574941c9e3
|
3 |
+
size 35280
|
offenseval-tr-test-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9052784e13248e58658e34a4f86a3463ef8b2594d2feb289e4b29bba2866b437
|
3 |
+
size 449553
|
offenseval-tr-training-v1.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8509c01c4bf387d9e387c4637829585431cc045adaf7d0413c0022bf2bcd4baa
|
3 |
+
size 4101728
|
offenseval_2020.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2022 Leon Derczynski.
|
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 |
+
"""OffensEval 2020: Multilingual Offensive Language Detection"""
|
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{zampieri-etal-2020-semeval,
|
30 |
+
title = {{SemEval-2020 Task 12: Multilingual Offensive Language Identification in Social Media (OffensEval 2020)}},
|
31 |
+
author = {Zampieri, Marcos and Nakov, Preslav and Rosenthal, Sara and Atanasova, Pepa and Karadzhov, Georgi and Mubarak, Hamdy and Derczynski, Leon and Pitenis, Zeses and \c{C}\"{o}ltekin, \c{C}a\u{g}r{\i}},
|
32 |
+
booktitle = {Proceedings of SemEval},
|
33 |
+
year = {2020}
|
34 |
+
}
|
35 |
+
"""
|
36 |
+
|
37 |
+
_DESCRIPTION = """\
|
38 |
+
OffensEval 2020 features a multilingual dataset with five languages. The languages included in OffensEval 2020 are:
|
39 |
+
|
40 |
+
* Arabic
|
41 |
+
* Danish
|
42 |
+
* English
|
43 |
+
* Greek
|
44 |
+
* Turkish
|
45 |
+
|
46 |
+
The annotation follows the hierarchical tagset proposed in the Offensive Language Identification Dataset (OLID) and used in OffensEval 2019.
|
47 |
+
In this taxonomy we break down offensive content into the following three sub-tasks taking the type and target of offensive content into account.
|
48 |
+
The following sub-tasks were organized:
|
49 |
+
|
50 |
+
* Sub-task A - Offensive language identification;
|
51 |
+
* Sub-task B - Automatic categorization of offense types;
|
52 |
+
* Sub-task C - Offense target identification.
|
53 |
+
|
54 |
+
The English training data isn't included here (the text isn't available and needs rehydration of 9 million tweets;
|
55 |
+
see [https://zenodo.org/record/3950379#.XxZ-aFVKipp](https://zenodo.org/record/3950379#.XxZ-aFVKipp))
|
56 |
+
"""
|
57 |
+
|
58 |
+
# _URL = ""
|
59 |
+
|
60 |
+
|
61 |
+
class OffensEval2020Config(datasets.BuilderConfig):
|
62 |
+
"""BuilderConfig for OffensEval2020"""
|
63 |
+
|
64 |
+
def __init__(self, **kwargs):
|
65 |
+
"""BuilderConfig OffensEval2020.
|
66 |
+
|
67 |
+
Args:
|
68 |
+
**kwargs: keyword arguments forwarded to super.
|
69 |
+
"""
|
70 |
+
super(OffensEval2020Config, self).__init__(**kwargs)
|
71 |
+
|
72 |
+
|
73 |
+
class OffensEval2020(datasets.GeneratorBasedBuilder):
|
74 |
+
"""OffensEval2020 dataset."""
|
75 |
+
|
76 |
+
BUILDER_CONFIGS = [
|
77 |
+
OffensEval2020Config(name="ar", version=datasets.Version("1.0.0"), description="Offensive language data in Arabic"),
|
78 |
+
OffensEval2020Config(name="da", version=datasets.Version("1.0.0"), description="Offensive language data in Danish"),
|
79 |
+
OffensEval2020Config(name="en", version=datasets.Version("1.0.0"), description="Offensive language data in English"),
|
80 |
+
OffensEval2020Config(name="gr", version=datasets.Version("1.0.0"), description="Offensive language data in Greek"),
|
81 |
+
OffensEval2020Config(name="tr", version=datasets.Version("1.0.0"), description="Offensive language data in Turkish"),
|
82 |
+
]
|
83 |
+
|
84 |
+
def _info(self):
|
85 |
+
return datasets.DatasetInfo(
|
86 |
+
description=_DESCRIPTION,
|
87 |
+
features=datasets.Features(
|
88 |
+
{
|
89 |
+
"id": datasets.Value("string"),
|
90 |
+
"text": datasets.Value("string"),
|
91 |
+
"label": datasets.features.ClassLabel(
|
92 |
+
names=[
|
93 |
+
"OFF",
|
94 |
+
"NOT",
|
95 |
+
]
|
96 |
+
),
|
97 |
+
}
|
98 |
+
),
|
99 |
+
supervised_keys=None,
|
100 |
+
homepage="https://sites.google.com/site/offensevalsharedtask/results-and-paper-submission",
|
101 |
+
citation=_CITATION,
|
102 |
+
)
|
103 |
+
|
104 |
+
def _split_generators(self, dl_manager):
|
105 |
+
"""Returns SplitGenerators."""
|
106 |
+
train_text = dl_manager.download_and_extract(f"offenseval-{self.config.name}-training-v1.tsv")
|
107 |
+
train_labels = dl_manager.download_and_extract(f"offenseval-{self.config.name}-labela-v1.tsv")
|
108 |
+
test = dl_manager.download_and_extract(f"offenseval-{self.config.name}-test-v1.tsv")
|
109 |
+
|
110 |
+
return [
|
111 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}),
|
112 |
+
]
|
113 |
+
|
114 |
+
def _generate_examples(self, filepath):
|
115 |
+
logger.info("⏳ Generating examples from = %s", filepath)
|
116 |
+
with open(filepath, encoding="utf-8") as f:
|
117 |
+
OffensEval2020_reader = csv.DictReader(f, delimiter="\t", quotechar='"')
|
118 |
+
guid = 0
|
119 |
+
for instance in OffensEval2020_reader:
|
120 |
+
instance["id"] = str(guid)
|
121 |
+
for dropfield in ('post_id', 'search_keywords', 'itr', 'disagreement_solving', 'created_at', 'in_reply_to_status_id'):
|
122 |
+
instance.pop(dropfield)
|
123 |
+
yield guid, instance
|
124 |
+
guid += 1
|