Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
hate-speech-detection
Languages:
Portuguese
Size:
1K - 10K
Tags:
instagram
DOI:
File size: 5,092 Bytes
eb60e1d 955707f eb60e1d 22d3e5b 0d52abc eb60e1d 67fcdad eb60e1d e12dd41 eb60e1d c3efdf4 34af89d c3efdf4 eb60e1d 22d3e5b eb60e1d 22d3e5b 67fcdad c3efdf4 67fcdad c3efdf4 67fcdad c3efdf4 22d3e5b 34af89d 67fcdad 955707f 22d3e5b 955707f 22d3e5b |
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 |
"""HateBR dataset"""
import datasets
import pandas as pd
_CITATION = """
@inproceedings{vargas2022hatebr,
title={HateBR: A Large Expert Annotated Corpus of Brazilian Instagram Comments for Offensive Language and Hate Speech Detection},
author={Vargas, Francielle and Carvalho, Isabelle and de G{\'o}es, Fabiana Rodrigues and Pardo, Thiago and Benevenuto, Fabr{\'\i}cio},
booktitle={Proceedings of the Thirteenth Language Resources and Evaluation Conference},
pages={7174--7183},
year={2022}
}
"""
_DESCRIPTION = """
HateBR is the first large-scale expert annotated corpus of Brazilian Instagram comments for hate speech and offensive language detection on the web and social media. The HateBR corpus was collected from Brazilian Instagram comments of politicians and manually annotated by specialists. It is composed of 7,000 documents annotated according to three different layers: a binary classification (offensive versus non-offensive comments), offensiveness-level (highly, moderately, and slightly offensive messages), and nine hate speech groups (xenophobia, racism, homophobia, sexism, religious intolerance, partyism, apology for the dictatorship, antisemitism, and fatphobia). Each comment was annotated by three different annotators and achieved high inter-annotator agreement. Furthermore, baseline experiments were implemented reaching 85% of F1-score outperforming the current literature models for the Portuguese language. Accordingly, we hope that the proposed expertly annotated corpus may foster research on hate speech and offensive language detection in the Natural Language Processing area.
"""
_URLS = {
"train": "https://raw.githubusercontent.com/franciellevargas/HateBR/2d18c5b9410c2dfdd6d5394caa54d608857dae7c/dataset/HateBR.csv",
"annotators": "https://raw.githubusercontent.com/franciellevargas/HateBR/83e8dea4e2d007a08ef534f3322aedeb80949f5c/annotators/final_concordancia_Kappa_Fleiss.csv"
}
_LABEL_INT_KEY = {
"antisemitism": 1,
"apology_for_the_dictatorship": 2,
"fatphobia": 3,
"homophobia": 4,
"partyism": 5,
"racism": 6,
"religious_intolerance": 7,
"sexism": 8,
"xenophobia": 9,
"offensive_&_non-hate_speech": -1,
"non-offensive": 0
}
_INT_LABEL_KEY = {v:k for k,v in _LABEL_INT_KEY.items()}
class Boun(datasets.GeneratorBasedBuilder):
VERSION = datasets.Version("1.0.0")
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"instagram_comments": datasets.Value("string"),
"offensive_language": datasets.Value("bool"),
"offensiveness_levels": datasets.Value("int32"),
"antisemitism": datasets.Value("bool"),
"apology_for_the_dictatorship": datasets.Value("bool"),
"fatphobia": datasets.Value("bool"),
"homophobia": datasets.Value("bool"),
"partyism": datasets.Value("bool"),
"racism": datasets.Value("bool"),
"religious_intolerance": datasets.Value("bool"),
"sexism": datasets.Value("bool"),
"xenophobia": datasets.Value("bool"),
"offensive_&_non-hate_speech": datasets.Value("bool"),
"non-offensive": datasets.Value("bool"),
"specialist_1_hate_speech": datasets.Value("bool"),
"specialist_2_hate_speech": datasets.Value("bool"),
"specialist_3_hate_speech": datasets.Value("bool")
}),
supervised_keys=None,
homepage="https://github.com/franciellevargas/HateBR",
citation=_CITATION,
)
def _split_generators(self, dl_manager):
downloaded_files = dl_manager.download(_URLS)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={
"filepath": downloaded_files["train"],
"annotators": downloaded_files["annotators"]
}
)
]
def _generate_examples(self, filepath, annotators):
def process_row(row, annotator_row):
categories = row["hate_speech"].split(",")
del row["hate_speech"]
for default_label in _LABEL_INT_KEY.keys():
row[default_label] = False
for int_label in categories:
row[_INT_LABEL_KEY[int(int_label)]] = True
row["specialist_1_hate_speech"] = bool(int(annotator_row["Avaliador 1"]))
row["specialist_2_hate_speech"] = bool(int(annotator_row["Avaliador 2"]))
row["specialist_3_hate_speech"] = bool(int(annotator_row["Avaliador 3"]))
return row
records = pd.read_csv(filepath).to_dict("records")
annotators = pd.read_csv(annotators).to_dict("records")
for idx, row in enumerate(records):
yield idx, process_row(row, annotators[idx]) |