Offensive Content Detection via Synthetic Code-Switched Text (2022)

Abstract: The prevalent use of offensive content in social media has become an important reason for concern for online platforms (customer service chat-boxes, social media platforms, etc). Classifying offensive and hate-speech content in online settings is an essential task in many applications that needs to be addressed accordingly. However, online text from online platforms can contain code-switching, a combination of more than one language. The non-availability of labeled code-switched data for low-resourced code-switching combinations adds difficulty to this problem. To overcome this, we release a real-world dataset containing around 10k samples for testing for three language combinations en-fr, en-es, and en-de, and a synthetic code-switched textual dataset containing ~30k samples for training In this paper, we describe the process for gathering the human-generated data and our algorithm for creating synthetic code-switched offensive content data. We also introduce the results of a keyword classification baseline and a multi-lingual transformer-based classification model.

## introduction the use of offensive content in online settings such as chat-boxes, and social media platforms continues to be a growing problem that requires addressing. it can have negative effects on the psychoemotional state of people @xcite . offensive content and hate-speech continue to be a challenge to people world. as such, it is important to keep social media and other communication platforms free from offensive content. considerable research has been conducted on deep-learning techniques for detecting offensive language @xcite . one of the growing challenges in the field of content detection is code-switching @xcite @xcite . code-switching refers to the use of two or more languages in a single conversation. code-switching can occur inter-sententially (across sentences) and intra-sententially (within sentences). the combination of code-switching and offensive content increases the complexity of the classification task. as code-switching is a combination of multiple languages, resources for these various combinations are extremely low. this causes researchers to find ways to create viable synthetic data that can serve in place of real-world data for training purposes. however, the real world benchmark test set still remains scarce. to stimulate the research, we create humanannotated testsets written in three pairs of languages (en-fr, en-es, and en-de). further, we propose a method for creating a synthetic train set and show its applicability to detect human-annotated code-switched text. ## related works researchers have attempted to solve the problem of synthetic data generation for various codeswitching tasks. theory based synthetic code-switching data generation: equivalency theory (ec theory) explains a range of interesting code-switched patterns beyond lexical substitution. the ec theory describes a cm sentence as a constrained combination of two sentences that are equivalent. @xcite (2018), sentiment analysis @xcite , conversational systems @xcite , machine translation @xcite . while these data-sets offer a resource for code-switching related tasks, there still is a significant shortage in available data for tasks based on data for our code-switching combinations used in this research (en-fr,en-es,ende). our synthetic and human generated data-sets offer a set of resources to address this shortage. for the task of hate/offensive speech detection, various approaches have been utilized. @xcite propose splitting a code-switched sentence into its constituent high resource languages to exploit both monolingual and cross-lingual settings. @xcite utilize apply transfer learning and design an lstm based model of hate speech detection for hate speech and offensive speech in hinglish (hindi-english). work performed on codeswitched tamil-english and malayalam-english text includes corpus created for sentiment analysis for these two languages @xcite . our work seeks to implement an algorithm for creating synthetic code-switched data and testing the efficacy of using that synthetic data for finetuning a multi-lingual language model for binary offensive content detection. ## dataset the language combinations produced from codeswitching can increase the complexities of nlp tasks (e.g. hatespeech detection, sentiment analysis, etc). to stimulate research in this domain and directly tackle the code-switched abusive language detection task, we create and release a 10k sentence test-set created by human annotators. additionally, we generate and release around 30k sentence synthetic dataset to train a model (see the statistics in ## method we employ a human-annotated lexicon dictionary for abusive language and build a binary classification model as a baseline model. furthermore, we explore the performance of the recently proposed multilingual neural network-based model. ## experimental results and discussion to fine-tune the xlm-r model, we perform a learning rate schedule. we base the scheduling on the validation split macro f1 scores instead of using the loss from the validation. we adopt this approach from @xcite where the authors focus on the validation scores at the end of each training iteration instead of using early-stopping to prevent over-fitting. if the validation performance decreases through an iteration, we backtrack to the previous model weights and decrease our learning rate. training ends when the learning rate reaches a significantly small value. this type of scheduling guarantees that the macro f1 score is maximized on the validation split. we ran three experiments for both our dictionary and transformer-based models; (1) training on a synthetic dataset and testing on swap/rewrite datasets, (2) training on swap, and testing on rewrite, (3) training on synthetic and swap datasets, and testing on rewrite. based on some of these observations, we believe this algorithm can be useful in extending model training sets by mixing both synthetic data with real-world training data. ## conclusion we released human-annotated testsets for the underresourced en-fr, en-de, en-es language combinations (approximately 10k). additionally, we proposed a synthetic code-switched data generation algorithm for training purposes in low resourced domains. using this algorithm, we generated a synthetic offensive-content dataset comprised of 30k entries for en-fr, en-de, en-es language combinations. we create two baselines models and report their results on the human-annotated testsets. we expect this resource will enable the researchers to address new and exciting problems in code-switching research.