Leveraging time-dependent lexical features for offensive language detection (2022)

Abstract: We present a study on the integration of time-sensitive information in lexicon-based offensive language detection systems. Our focus is on Offenseval sub-task A, aimed at detecting offensive tweets. We apply a semantic change detection algorithm over a short time span of two years to detect words whose semantics has changed and we focus particularly on those words that acquired or lost an offensive meaning between 2019 and 2020. Using the output of this semantic change detection approach, we train an SVM classifier on the Offenseval 2019 training set. We build on the already competitive SINAI system submitted to Offenseval 2019 by adding new lexical features, including those that capture the change in usage of words and their association with emerging offensive usages. We discuss the challenges, opportunities and limitations of integrating semantic change detection in offensive language detection models. Our work draws attention to an often neglected aspect of offensive language, namely that the meanings of words are constantly evolving and that NLP systems that account for this change can achieve good performance even when not trained on the most recent training data.

## introduction the task of automatic detection of offensive language has attracted considerable attention in the natural language processing (nlp) community recently. policy makers and online platforms can leverage computational methods of offensive language detection to oppose online abuse and online harm at scale. these methods can also support computational social science and linguistics research in identifying innovative ways in which individuals and groups express offense online @xcite . the last two editions of the offenseval shared task, organised as part of the semeval competition, have offered a platform for assessing the state of the art in this area. existing methods for automatic offensive language detection have been tested on a different large-scale annotated datasets, most notably the offensive language identification dataset (olid) used in offenseval 2019 @xcite and the semi-supervised offensive language identification dataset (solid) from of-fenseval 2020 @xcite . the most effective methods proposed so far typically rely on ensembles of very large transformerbased language models such as bert @xcite and its successors roberta @xcite and albert @xcite . for example, @xcite , the top performing team for the offensive language detection task at offenseval 2020, use tweets from solid to finetune the masked language modeling objective of bert-like models before training them on the labeled olid data for the task of offensive language detection. other systems (e.g. @xcite for turkish) rely on more tailored sets of features such as existing lexicons of offensive words. in spite of the growing amount of work on this topic, little attention has been devoted to more sophisticated uses of lexical features and on the role of the time dimension in offensive language phenomena. languages are subject to constant change and their lexicons are no exception. over time, words can acquire new meanings, or change or lose existing ones @xcite . these changes in the semantic profile of a word can take various shapes. for example, they can widen or narrow its semantic scope or change its polarity. an example is sick, which gained a positive connotation of 'excellent, impressive; risky' (oed online) in slang contexts in the early 1980s. lexical semantic change is a highly complex phenomenon and its study helps us better understand the relation between language and social, cultural and historical factors, and how this relation changes over time. this has important consequences for all computational systems that rely on word lists as input, including those used in offensive language detection systems, as such lists tend to be static and therefore do not account for the changes that words are subject to. this paper focuses on the task of offensive language detection and follows the framework set up in the offenseval 2019 and 2020 competitions, particularly subtask a. we build on sinai @xcite , the only lexicon-based system submitted to offenseval 2019 for which we could access the code. our system relies on a set of refined lexical features which cover the surface-level spelling of offensive content as well as their semantic change over a short time period. our system is aware of the change in meaning of the word karen, for example, which, according to dictionary.com, in 2020 acquired an offensive meaning. 1 our work shows that accounting for language change and more sophisticated lexical features can help research in offensive language detection. at the same time, we show that detecting semantic changes that occurred in a very short time interval (one year in our case) presents challenges because this phenomenon affects a small number of words. focus-ing on offensive language (and therefore on words whose semantics changed towards or away from an offensive meaning) presents additional challenges, as this phenomenon affects an even smaller number of words. our results are promising, especially considering that they are obtained by drawing on lexical features from datasets covering only two consecutive years, the only years for which the offenseval training and test sets are available. during this period, only a small number of words changed their meaning or polarity. therefore, we expect our method to have a bigger impact when tested on a larger time span. we stress that one important methodological strength of our method is that it does not need an up-to-date training set. because it uses an older annotated dataset as its training set, it enables significant savings in the human effort and computational resources needed to create high-quality labelled data, while still being able to handle the ever-evolving lexical semantics of offensive language. in addition to presenting a manually curated list of words that acquired or lost an offensive meaning between 2019 and 2020, we perform an extensive error analysis to explore the categories of texts that are misclassified by our system. we find that further improvements will likely come from better contextual representations: these will help prevent cases in which models detect offense in any text that contains a word that might be offensive in certain contexts. we suggest expanding the current set of offensive words will help to correctly label cases in which rare but offensive words are used. ## data we rely on the olid training dataset, which includes 13,240 tweets from late 2018 and 2019 annotated according to a three-layer hierarchical annotation scheme. the first layer identifies a tweet as containing offensive language (off) or not (not). the second layer categorizes the offensive language in tweets as a targeted insult (tin) or an untargeted insult (unt). the third layer categorises the targets of insults as an individual (ind), a group (grp), or other (oth) @xcite . the olid test set includes tweets categorized according to the sub-tasks, along with their gold labels. the offensive language detection sysresources/ tem of our model uses the olid training set for sub-task a. solid contains tweet ids for over 9,000,000 tweets from early 2020, also annotated according to the three-level hierarchy of olid. we extract the content of over 6,000,000 tweets using the twitter api by matching the solid tweet ids. contrary to the olid dataset, solid does not contain gold standard labels for any of the sub-tasks. instead, solid uses a democratic cotraining method to provide the average confidence (avg_conf) and standard deviation from the avg_conf (conf_std) values of a particular tweet belonging to the positive class of that subtask. for sub-task a, a tweet belongs to the positive class if it is labelled as offensive, or off @xcite . we utilise a similar method as that used by plaza del @xcite to generate the tweet labels using the avg_conf and conf_std values. we take 0.5 to be the threshold value for a tweet to be labelled offensive. if, for a given tweet, the avg_conf + conf_std value is still below the threshold value of 0.5, we label the tweet as not. if the avg_conf -conf_std gives a value more than the threshold, we label the tweet as off. any tweets whose avg_conf + conf_std values were greater than 0.5, or avg_conf -conf_std values were less than 0.5 are discarded, as this indicates the off/not classification is not strongly established, and varies based on the standard deviation. ## experiments in this section, we present the experiments performed to find the best configuration of parameters for our system. ## error analysis to present the analysis of the distribution of the seven categories we identified in the list of errors, we focus on 178 errors whose classification the two annotators agreed on. for examples that were misclassifed as offensive, the most common feature was the presence of offense-related words that were not being used in an offensive way. models based solely on lexical features that do not account for the contextual meaning of words will naturally struggle with these cases, and the high number of these errors suggests that improving the semantic change detection may not have as large of an impact compared to including better contextual representations of potentially offensive words. the next most common category of misclassified offensive was self-deprecating statements: those that used statements that would be considered offensive had they been targeted at someone else, but they were instead directed at the author of the text (e.g., "i am ugly"). a few statements misclassified as offensive actually employed irony, in which the surface meaning of the text appears offensive, but the intended meaning of the text was not offensive. for texts misclassified as not offensive, the most commonly noticed feature was that an offensive word was present, but it was not included in the offensive word list that was used by the best performing model. some of these words acquired an offensive meaning over time. an example is "@user i thought you magas refused to use nike because they don't hate black people". in this tweet, the word magas is a case of a semantically-changed word which here is employed in an offensive way. in urban dictionary, this word is defined in november 2018 as "a word used in the campaign of trump, signals neo nazis and white supremacists". for these examples, we hypothesize that better expansion of the offensive word list may help with being able to correctly categorize these examples. for both types of misclassification, a handful of the instances contained more indirect examples of offense, which has been highlighted as an important category to focus on within the offense detection domain that may require multi-hop reasoning @xcite . a small number of other examples appear to have been incorrectly labeled in the original dataset, and a handful were difficult to categorize (other) or understand (unexplained). ## conclusion we have presented a study on combining lexical semantic change information into a new system that performs offensive language detection based on lexical features, and a curated gold standard list of english words that acquired or lost an offensive meaning between 2019 and 2020. from the point of view of the performance, our system trained on the much smaller and older olid data performs better than sinai trained on the same data. further, by including our time-dependent lexical features, our system, trained only on the older olid data, has performance on the newer solid test set that is comparable to a sinai model that was trained directly on the much larger and newer solid training set. this shows that it indeed language change affects offensive language and it is possible to perform offensive language detection by taking into account such change and without relying on large labelled datasets that have been produced around the same time as the texts on which it is applied. additionally, we discuss the challenges of performing short-term semantic change detection, especially for the rare words that acquired or lost an offensive meaning over a period of two years. future work will involve expanding our evaluation across other time periods and corpora.