Offensive Language Detection in N epali Social Media (2021)

Abstract: Social media texts such as blog posts, comments, and tweets often contain offensive languages including racial hate speech comments, personal attacks, and sexual harassment. Detecting inappropriate use of language is, therefore, of utmost importance for the safety of the users as well as for suppressing hateful conduct and aggression. Existing approaches to this problem are mostly available for resource-rich languages such as English and German. In this paper, we characterize the offensive language in Nepali, a low-resource language, highlighting the challenges that need to be addressed for processing Nepali social media text. We also present experiments for detecting offensive language using supervised machine learning. Besides contributing the first baseline approaches of detecting offensive language in Nepali, we also release human annotated data sets to encourage future research on this crucial topic.

## introduction user-generated content on social media and discussion forums has surged with the advent of technology and the availability of affordable mobile devices. users interact on these platforms with natural language posts and comments on diverse topics. such interactions may contain toxic comments or posts that are acutely insulting or harmful to other participants. such content (foul language) typically consists of racial hate speech, personal attacks, and sexual harassment. detection of inappropriate use of language is, therefore, of utmost importance. it keeps the discussion healthy by eliminating foul language and also enhances the security of the users by suppressing hateful conduct and aggression. ## related work detection of hate speech and offensive language across multiple languages is ramping up in recent years. this task is typically modeled as a supervised learning problem that requires a set of human-labeled training examples corresponding to different target classes. the target classes are the types of hate speech or offensive language under the study. @xcite provides a comprehensive survey of the approaches in several aspects such as the features used, classification algorithms, and data sets and annotations. as mentioned previously, majority of studies on hate speech and offensive language detection have been conducted in resource-rich languages such as english and german. such research is further facilitated by recent competitions and shared tasks that make availability of gold training examples. toxic comment classification challenge by kaggle foot_0 , for example, provides thousands of humanlabeled examples for detecting toxic behaviors in wikipedia comments. similarly, first shared task on aggression identification @xcite for hindi and english, and germeval @xcite for german provide gold data sets for detecting offensive languages. the former contains 15000 aggression-annotated facebook posts and comments each in hindi and english and the latter contains over 8000 human annotated tweets for german. an example of hate speech detection in english language is by burnap and williams (2016) who studied the detection in tweets with different categories: (a) race (ethnicity), (b) disability, (c) religion, and (c) sexual orientation and transgender status. their data set consisted of 1803 tweets related to sexual orientation with 183 instances of offensive or antagonistic content, 1876 tweets related to race with 70 instances of offensive or antagonistic content, and 1914 tweets related to the disability with 51 instances of offensive or antagonistic content. the authors modeled the hate speech detection as a classification problem, achieving f-measures of 0.77, 0.75, 0.75, and 0.47 for religion, disability, race, and sexual orientation respectively. davidson et al. (2017) differentiated hate speech from offensive languages. they classified each english tweet into (a) offensive (b) hate speech and (c) none using different classifiers. thousands of tweets were labeled using crowdflower for the training examples. several classifiers were trained using a one-versusrest framework in which a separate classifier was trained for each class and the class label with the highest predicted probability across all classifiers was assigned to each tweet. out of the several classifiers, logistic regression and support vector machine performed the best achieving the overall precision and recall as 0.91 and 0.90 respectively. however, the precision and recall scores for the hate class were low ( precision of 0.44 and recall 0.61), suggesting that the classification of hate speech is challenging. similarly, @xcite trained convolutional neural networks using 6655 twitter hate-speech data-set originally created by @xcite to classify utterances into (a) sexism, (b) racism, (c) sexism and racism, and (d) non-hate speech, achieving an overall precision, recall, and f-measure as 0.7287, 0.7775, and 0.7389, respectively. like in english, detecting offensive languages in german language has also been increased recently especially due to the shared tasks at germeval 2018 foot_1 and germeval 2019 foot_2 . germeval 2018 provided 5009 categorized tweets as training data sets and 3532 as test data sets. it offered two tasks : (1) a coarse-grained binary classification with the categories offensive and other and (2) a fine-grained classification with the four categories profanity, insult, abuse, and other. the training data set consists of 66.3% tweets as other, 20.4% as abuse, and 11.9% as in-sult, and only 1.4% as profanity. the best performing system in task 1, tuwienkbs (montani, 2018), received overall precision, recall, and f-measure of 0.71, 0.65, and 0.68 for offensive and 0.82, 0.86, and 0.84 for other respectively. the best performing system, uhhlt @xcite , for the fine-grained task (task 2) achieved average precision, recall, and f-measure as 0.56, 0.49, and 0.52, respectively. the closest work to ours is the study of linguistic taboos and euphemisms in nepali by @xcite . the authors presented how the offensive contents are formed in nepali and also created a resource containing a list of common offensive terms in nepali. however, they have not addressed the detection of offensive content itself. ## offensive language in nepali social media hate speech is a communication that disparages a person or a group based on some characteristic such as race, color, ethnicity, gender, sexual orientation, nationality, religion, or other characteristic @xcite . hate speech can have strong cultural implications @xcite and thus an utterance can be perceived as offensive or not depending on the observer's cultural background. besides, the distribution of hate speech can be different in different countries. for example, a country with a mix of religions most likely contains more hate speech related to religions than a country having a singly dominant religion. therefore, in this section, we discuss different kinds of offensive languages that we observed in nepali social media. we reviewed several social media posts and comments on twitter, youtube, facebook, blogs, and news portals and identified the common hate speech types. we listed the common types in we can expect more of racist comments because nepali society is a mix of several ethnic groups, casts and regions (pahade -people live in hilly region; madheshi -people live in the south; ethnic groups -gurung, magar; casts -bahun, chhetri, dalit, etc.). the social tensions among these races and ethnic groups are reflected in the posts and comments. hate speeches related to gender and religion are also observed. interestingly, we observed the hate speech towards females the most when compared with males and the third gender. targets to hinduism, islam, christianity, and buddhism are the most common hate speech related to religions. furthermore, several cases of use of swear words, violent rhetoric, and personal attack towards individuals or organizations are also observed. we categorized them as other offensive. ## methodology in this section, we describe the data collection, data annotation, and our system to detect offensive lan-guages in nepali text. ## conclusion in this paper, we presented a systematic study of offensive language detection in nepali, a topic that has not been explored for this low resource language. we collected diverse social media posts and generated a labeled data set by manually annotating 7248 posts with fine-grained labels. the data set is available at https://github.com/ nowalab/offensive-nepali . we presented different challenges that need to be addressed to process noisy social media posts in nepali. we proposed three different preprocessing methods and provided detailed evaluations demonstrating their effectiveness on the model performance. we reported detailed experiments for coarse-grained detection of offensive languages using several conventional machine learning and recent deep learning models and features. we also provided a fine-grained classification of offensive comments using a two-step approach for nepali language. our data set and baseline algorithms provide foundation for future research in this area to fight against cyberbullying and hate speech, which has been widespread in recent days. we would like to caution to those who use our work (e.g. data sets and algorithms) to avoid over-reliance on keywords and machine learning models. we remind everyone to keep the context in the forefront, and encourage using human review to the ones flagged by the machine learning systems as offensive, especially in cases of false positives. future work includes detecting the targets of the offensive comments, which could be an individual organization/person or a group. leveraging offensive language data sets from other languages to nepali, e.g. by translation and transfer learning as done by @xcite , is another interesting future direction.