Source-linked AI summary
Offensive Language and Hate Speech Detection for Danish
Gudbjartur Ingi Sigurbergsson, Leon Derczynski
TL;DR
Offensive language on social platforms requires automatic detection, but research has focused largely on English. The paper constructs and annotates Danish social-media data and evaluates models for English and Danish across offensiveness, targeting, and target type, achieving its strongest reported results at macro averaged F1-scores of 0.74 for English and 0.70 for Danish offensive-language detection. The work captures multiple offensive-language types and targets, while differing definitions and limited Danish data constrain comparison and performance.
Problem
Automatic detection is needed for the large volume of offensive user-generated content, while existing research has focused largely on English despite the multilingual nature of the problem.
Method
The paper constructs and annotates Danish Reddit and Facebook comments and evaluates English- and Danish-capable classification systems across offensiveness, targeting, and target type.
Results
The best offensive-language detector achieves a macro averaged F1-score of 0.74 for English and 0.70 for Danish.
Takeaways & Limitations
The work captures offensive-language types and targets and presents automatic methods for detecting forms such as hate speech and cyberbullying.
Takeaways & Limitations
Cross-study comparison is constrained by contradictory definitions and annotation schemas, while Danish results are affected by substantially less training data and a smaller offensive class.
Abstract
from arXiv · showhide
The presence of offensive language on social media platforms and the implications this poses is becoming a major concern in modern society. Given the enormous amount of content created every day, automatic methods are required to detect and deal with this type of content. Until now, most of the research has focused on solving the problem for the English language, while the problem is multilingual. We construct a Danish dataset containing user-generated comments from \textit{Reddit} and \textit{Facebook}. It contains user generated comments from various social media platforms, and to our knowledge, it is the first of its kind. Our dataset is annotated to capture various types and target of offensive language. We develop four automatic classification systems, each designed to work for both the English and the Danish language. In the detection of offensive language in English, the best performing system achieves a macro averaged F1-score of $0.74$, and the best performing system for Danish achieves a macro averaged F1-score of $0.70$. In the detection of whether or not an offensive post is targeted, the best performing system for English achieves a macro averaged F1-score of $0.62$, while the best performing system for Danish achieves a macro averaged F1-score of $0.73$. Finally, in the detection of the target type in a targeted offensive post, the best performing system for English achieves a macro averaged F1-score of $0.56$, and the best performing system for Danish achieves a macro averaged F1-score of $0.63$. Our work for both the English and the Danish language captures the type and targets of offensive language, and present automatic methods for detecting different kinds of offensive language such as hate speech and cyberbullying.
1 Introduction
The paper addresses the need for automatic detection of offensive user-generated language and extends research beyond its predominant English focus to English and Danish.
- Automatic NLP and machine-learning methods are needed to process the enormous volume of user-generated content containing offensive language.
- The study constructs and annotates a Danish dataset while designing models usable for both English and Danish.
- The authors analyze linguistic patterns that prove difficult for offensive-language detection.
2 Background
The background distinguishes offensive language, hate speech, and cyberbullying while emphasizing inconsistent definitions and annotation schemas as a major comparability challenge.
- Hate speech is presented as a harmful form of offensive language targeting groups based on characteristics such as race, ethnicity, gender, sexuality, nationality, or religion.
- Research spans general offensive-language detection and refined tasks such as hate-speech and cyberbullying detection.
- High-quality, well-annotated data is essential for supervised classification because low-quality data is unlikely to produce meaningful results.
- Cyberbullying concerns targeted insults or threats against individuals and is associated with intent to harm, repetitiveness, and an imbalance of power.
- Contradictory definitions and annotation schemas make results difficult to compare across studies.
3 Dataset
The dataset and task structure operationalize offensive language through three nested classification subtasks covering offensiveness, targeting, and target type across social-media data.
- Task structure: The framework divides offensive-content detection into three subtasks for identifying offensiveness, targeting, and target type.
- Subtask A: Subtask A classifies posts as offensive or not offensive, including insults, threats, and untargeted profanity.
- Subtask B: Subtask B classifies offensive posts as targeted or untargeted, with targeted language directed at an individual, group, or other target.
- Subtask C: Subtask C classifies targeted insults by target type, including individuals, groups, and other targets.
- Dataset composition: The dataset is split into training and test sets while preserving label distributions, with approximately 88% of posts labeled not offensive.
- Data collection: The corpus combines Facebook and Reddit data after Twitter was rejected because Danish usage produced low-quality data with underrepresented classes.
- Annotation: Annotation disagreements were assessed with Jaccard indices and largely reflected missing context or uncertainty about how profanity should be labeled.
4 Features
The paper compares lexical, linguistic, sentiment, readability, and embedding-based representations, including multilingual FastText embeddings suited to English and Danish.
- Top-level features: Feature representations include bag-of-words and word or character n-grams, with prior work reporting differing strengths for unigram and character features.
- Linguistic features: Linguistic features include sample length, punctuation, capitalization, URLs, polite words, unknown words, insults, and hate-speech terms.
- Word representations: Word representations provide generalization when predictive words do not occur in both training and test data.
- Sentiment scores: The systems use VADER and AFINN compound sentiment scores ranging from −1 to +1.
- Readability: The models also use Flesch-Kincaid Grade Level and Flesch Reading Ease scores to represent text readability.
- Pre-trained embeddings: Pre-trained FastText embeddings cover 157 languages, including English and Danish, and can generate embeddings for out-of-vocabulary words.
5 Models
The paper compares baseline, logistic-regression, and three BiLSTM-based classifiers, varying embeddings and auxiliary features across offensive-language subtasks. The models use class weighting and tuned training hyperparameters, with task-specific output configurations.
- Model families: The study compares majority-class baselines, logistic regression, Learned-BiLSTM, Fast-BiLSTM, and AUX-Fast-BiLSTM models.The baseline assigns every sample to the largest class, while the neural models differ in embedding initialization and auxiliary features.
- Model families: Logistic regression estimates class probabilities with a sigmoid-based function applied to a linear model.The model uses explanatory variables and learned coefficients to predict the dependent class variable.
- Neural architectures: Learned-BiLSTM uses random embeddings, a bidirectional LSTM, a fully connected hidden layer, and a task-specific output layer.The BiLSTM has forward and backward LSTMs of size 20, followed by 16 hidden units.
- Neural architectures: Fast-BiLSTM retains the Learned-BiLSTM architecture but initializes its embedding layer with fixed FastText embeddings.The FastText embeddings remain unchanged during model training.
- Neural architectures: AUX-Fast-BiLSTM extends Fast-BiLSTM with sentiment, TF-IDF n-grams, part-of-speech features, text counts, and readability measures.The auxiliary inputs include counts of characters, syllables, words, hashtags, URLs, mentions, and retweets.
- Training: Hyperparameter tuning selects batch size 128, Adam with learning rate 0.001, dropout 0.2, and inverse-frequency class weights.These settings are selected through grid-search cross-validation and are used to address class imbalance.
6 Results and Analysis
The results compare English and Danish systems across offensive-language identification and targeted-language categorization. Performance varies by language, task, model architecture, and dataset balance.
- A - Offensive language identification: 0.735 macro averaged F1-score is achieved by Fast-BiLSTM for English offensive-language identification.The model is trained for 100 epochs on the OLID dataset.
- A - Offensive language identification: Additional HSAOFL training data does not consistently improve results across models.It worsens results for word-embedding models but helps Logistic Regression and AUX-Fast-BiLSTM.
- A - Offensive language identification: 0.699 F1-score is achieved by Logistic Regression for Danish offensive-language identification.Fast-BiLSTM, the best English model, performs worst for Danish.
- B - Categorization of offensive language type: 0.619 macro F1-score is achieved by Learned-BiLSTM for English targeted-language categorization.The model is trained for 60 epochs and performs best in English sub-task B.
- B - Categorization of offensive language type: 0.729 macro F1-score is achieved by AUX-Fast-BiLSTM for Danish targeted-language categorization.The model is trained for 100 epochs; the result suggests reliance on pre-trained embeddings alone may be suboptimal.
- B - Categorization of offensive language type: 42% of Danish training posts are labeled UNT, compared with around 14% in the English data, which may explain better Danish sub-task B performance.The English UNT category has lower recall and precision, while Danish performance is associated with a more balanced training set.
C - Offensive language target identification
Sub-task C identifies the target type of targeted offensive language in English and Danish. The Learned-BiLSTM performs best in both languages, while additional features perform poorly in Danish and vague OTH definitions limit classification.
- 0.557 macro averaged F1-score is achieved by the English Learned-BiLSTM model trained for 10 epochs.
- The OTH category is difficult to classify because its definitions are vague and include samples outside the previous two categories.
- 0.629 macro averaged F1-score is achieved by the Danish Learned-BiLSTM model trained for 100 epochs.
- Additional features are not beneficial for this refined Danish sub-task, as Logistic Regression and AUX-Fast-BiLSTM perform worst.
7 Analysis
Error analysis examines misclassified samples using TF-IDF n-grams and manual inspection. Across tasks and languages, obfuscation, profanity-based shortcuts, data-quality issues, and class imbalance produce recurring errors.
- TF-IDF n-grams and manual inspection are used to analyze misclassified samples and identify classifier weaknesses.
- Obfuscated offensive terms and targeted insults are frequently missed, including concatenated words and hashtag-like sequences.
- Profanity causes false offensive or targeted predictions, while gendered and lexical associations also produce misclassifications.
- The classifier favors longer sequences as offensive, with misclassified offensive samples averaging 204.7 characters versus 107.9 for misclassified non-offensive samples.
- Class imbalance and vague or noisy labels constrain classification, including errors involving OTH samples and mislabeled targeted insults.
8 Conclusion
The paper addresses harmful offensive language on social media, where automatic detection is needed and prior research has focused mainly on English. Its English-Danish experiments find that sharing information across languages and platforms leads to good models.
- The study explores English and Danish offensive-language detection and categorization because prior research has focused mainly on English.
- Sharing information across languages and platforms leads to good models for the task.
- The resources and classifiers are available from the authors under a CC-BY license, pending use in a shared task.
A Data statement
The data statement identifies the resource as examples of offensive language and hate speech in Danish. It specifies Danish as the language variety using BCP-47 code da-DK.
- The resource contains examples of offensive language and hate speech in Danish.
- The dataset’s language variety is Danish, represented by BCP-47 code da-DK.
Speaker demographic
The dataset represents Danish-speaking users of Reddit and Facebook, with demographic details largely unspecified. The speech consists of colloquial Danish web discussions drawn from public platform conversations.
- The dataset contains Danish-speaking users from Reddit and Facebook, with age, gender, race or ethnicity, and socioeconomic status unspecified and mixed.
- The number of distinct speakers is unknown, with the number of posts providing only an upper bound.
- The discussions took place publicly on Reddit or Facebook.
- The text consists of Danish colloquial web speech.
- The data were originally collected from Reddit and Facebook in 2018.