Venue: NAACL 2019

# Detecting Dergotatory Compounds - An Unsupervised Approach

Michael Wiegand\({}^{*0}\), Maximilian Wolf\({}^{*}\), Jose Ruppenhofer\({}^{\dagger\ddagger}\)

\({}^{*}\)Spoken Language Systems, Saarland University, Saarbrucken, Germany

\({}^{\dagger}\)Leibniz ScienceCampus, Heidelberg/Mannheim, Germany

\({}^{\ddagger}\)Institute for German Language, Mannheim, Germany

michael.wiegand@lsv.uni-saarland.de

maximilian.wolf@lsv.uni-saarland.de

ruppenhofer@ids-mannheim.de

###### Abstract

We examine the new task of detecting derogatory compounds (e.g. _curry__muncher_). Derogatory compounds are much more difficult to detect than derogatory unigrams (e.g. _idiot_) since they are more sparsely represented in lexical resources previously found effective for this task (e.g. Wiktionary). We propose an unsupervised classification approach that incorporates linguistic properties of compounds. It mostly depends on a simple distributional representation. We compare our approach against previously established methods proposed for extracting derogatory unigrams.

1
Footnote 1: [http://thelawictionary.org/](http://thelawictionary.org/)

2076

## 1 Introduction

Abusive or offensive language is commonly defined as hurtful, derogatory or obscene utterances made by one person to another person.1 Examples are (1)-(3). In the literature, closely related terms include _hate speech_Waseem and Hovy (2016) or _cyber bullying_Zhong et al. (2016). While there may be nuanced differences in meaning, they are all compatible with the general definition above.

Footnote 1: [https://en.wiktionary.org/](https://en.wiktionary.org/)

1. stop editing this, you **dumbass**.
2. Just want to slap the **stupid** out of these **bimboes!!**!
3. Go lick a pig you arab muslim piece of **scum**.

Due to the rise of user-generated web content, in particular on social media networks, the amount of abusive language is also steadily growing. NLP methods are required to focus human review efforts towards the most relevant microposts.

A substantial amount of abusive utterances comprises derogatory words (e.g. _bimbo_ or _scum_). Automatic extraction methods of such words are required since new derogatory words constantly enter language. Wiegand et al. (2018a) extracted a large list of such expressions and demonstrated its importance for text classification.

In this work, we focus on a subtype of derogatory terms, namely derogatory compounds (e.g. _booze__hound_, _curry__muncher_, _fault__finder_). Distinguishing such multi-word expressions from nonderogatory ones (e.g. _for__hound_, _mile__muncher_, _branch__finder_) is more difficult than classifying unigrams since they are only sparsely represented in general-purpose lexical resources which have previously been found an effective source from which to learn abusive language, such as Wiktionary.2 For example, while 97% of the derogatory unigrams of the gold standard lexicon in Wiegand et al. (2018a) are contained in Wiktionary, less than 17% of the derogatory compounds used as our gold standard in this work can be found.

Footnote 2: [https://en.wiktionary.org/](https://en.wiktionary.org/)

Despite their sparsity in lexical resources derogatory compounds are a frequent phenomenon, particularly in German data, which is why we study this task on that language. On the German benchmark corpus for abusive language detection, the _GermEval corpus_Wiegand et al. (2018b), we found that of the abusive microposts in the test set that include at least one derogatory expression, 39% contain a derogatory compound.

In our work, we focus on noun-noun compounds. Each compound (e.g. _curry__muncher_) comprises two constituents, a modifier (i.e. _curry_) and a head (i.e. _muncher_). On the GermEval corpus, 77% of the derogatory compounds are noun-noun compounds. We only consider compounds whose constituents are not derogatory. 58% of the derogatory compounds on the GermEval corpus fall under this category. Given publicly available lists of derogatory unigrams, the detection of derogatory compounds containing derogatory constituents (e.g. _motherfucker_) is rather trivial.



There even exist abusive word generators employing such compounds.3

Footnote 2: [https://github.com/tuds-lsv/](https://github.com/tuds-lsv/)

We present the first study to detect derogatory noun-noun compounds and propose an unsupervised classification approach based on distributional information that does not require any properly labeled training data. We demonstrate that linguistic features that have previously been found effective for the classification of derogatory unigrams are notably less effective for the detection of derogatory compounds. We created a new dataset of derogatory compounds which will be made **publicly available**.4

Footnote 5: www.hypernerhero.com/de/insults.htmwww.schimpfwerer.de

Our task is framed as a **binary classification problem**. Each given compound is to be classified out of context as either derogatory or not. For the sake of accessibility, we use English translations of our German compounds in this paper.

## 2 Related Work

Lexical knowledge for the detection of abusive language has only received little attention in previous work Schmidt and Wiegand (2017), the notable exceptions are Razavi et al. (2010) who present a manually-compiled lexicon Gitari et al. (2015) who bootstrap _hate verbs_ and Wiegand et al. (2018a) who induce a lexicon of derogatory words. In all these researches, however, derogatory compounds are not explicitly addressed.

## 3 Data

We built a **gold standard of derogatory compounds** to train and test classifiers. We inspected a range of websites containing derogatory word lists.6 Since ambiguity is a massive problem in these lists7 which makes them hardly usable for abusive language detection Wiegand et al. (2018a), we manually extracted noun-noun compounds which we considered **unambiguously** derogatory. In order to produce non-derogatory compounds, we randomly sampled from the COW16 corpus Schafer (2015) for each derogatory compound (e.g. _booze bound_) other compounds sharing the same head (e.g. _fox hound_, _stag hound_). Since among those putative non-derogatory instances, there could well be further derogatory compounds, we manually annotated them as well. We limited the set of compounds sharing the same head, which we henceforth call **head group**, to 20 compounds. Thus, we hope to avoid any biases towards particular heads.

Footnote 7: These lists contain many compounds commonly used in a non-offensive manner, e.g. _Colatrinker (coke drinker)_.

We also looked at the natural distribution of heads on derogatory compounds. As a proxy we considered the union of all derogatory compounds found on the above websites.8 Figure 1 plots the frequency rank of the heads against the relative frequency of a particular head. The plot suggests that the heads follow a power-law distribution Zipf (1965). As a consequence, one cannot assume that this task could be solved by looking up heads in a finite lexicon with words that often form derogatory compounds in combination with different modifiers.

On a sample of 600 compounds, we measured a substantial agreement of Cohen's \(\kappa=0.61\)Landis and Koch (1977) between 2 annotators. Our final dataset (Table 1) comprises 3,500 compounds with only 11% being derogatory.

We also created a **gold standard of derogatory uniform words** in order to examine in how far derogatory compounds can be detected by a classifier trained on derogatory unigrams. For this lexicon, we manually translated the _base lexicon_ from Wiegand et al. (2018a) to German.

Figure 1: Head distribution of derogatory compounds.

 

Method

Our method does not require any labeled training data. In the first step (SS4.1), we apply high-precision diagnostics for the detection of derogatory compounds. The output are rankings in which derogatory compounds should be ranked highest. In the second step (SS4.2), we combine and rerank the output of those diagnostics. Our method largely relies on a distributional representation of our compounds. We induced embeddings of our compounds using Word2Vec Mikolov et al. (2013) on the COW16 corpus, which with its 30B tokens is one of the largest German corpora. Since we exclusively work on German data and German compounds occur as closed compounds, e.g. _Milchbube (milk sop)_ or _Schnapsdrossel (booze hound)_, we can employ standard tokenization7 for inducing embeddings for our compounds.

Footnote 7: Any alphanumeric string separated by spaces is considered a token.

### Individual High-Precision Diagnostics

**Negative Polarity (NEG).** Derogatory words form a subset of negative polar expressions. Due to their sparsity, however, derogatory compounds are rarely part of any sentiment lexicon (containing polar expressions). We, therefore, rank all our compounds according to their cosine similarity to a centroid embedding-vector computed from all negative polar expressions from the German PolArt sentiment lexicon Klenner et al. (2009).

**Compound Occurrence vs. Constituent Occurrence (COMCON).** Derogatory compounds can be creative word constructions (e.g. _booze hound_, _oxygen thief_, _keyboard warrior_). Consequently, their constituents are often not semantically related. For instance, in _booze hound_, _booze_ bears no common semantic relation to _hound_. Therefore, the corpus frequency of a derogatory compound should be much higher than its constituents co-occurring in a sentence (i.e. with other words occurring in between). Such co-occurrences should be coincidental.

We capture this by the following formula (frequencies are computed on the COW16 corpus):

\[COMCON=\frac{\#\text{ compound mentions in corpus}}{\#\text{ constituents co-occurring in sentence}} \tag{1}\]

In prose, COMCON ranks all compounds by the ratio of observed compound mentions and constituent co-occurrences in a sentence. For derogatory compounds, there should be a high frequency of compound mentions but only a low frequency of the constituents co-occurring in a sentence. Therefore, COMCON will have a high score. While there is a similarly high frequency of compound mentions for non-derogatory compounds, there is also a high frequency of the constituents co-occurring in a sentence since these constituents are usually semantically related (e.g. _landowner_ or _circus clown_). This should result in COMCON producing comparably lower scores.

**Derogatory Compound Must Be Person (PERSON).** We rank our compounds with regard to how likely they represent a person since many non-derogatory compounds represent either objects or animals (e.g. _booze hound_ vs. _sight hand_, _for kound_, _stag hound_). We first compute a centroid vector representing persons. Then, we rank compounds by their similarity to that vector.

As a proxy for persons, we took embeddings of words representing professions, e.g. _banker_, _lawyer_, _salesman_. We also experimented with personal pronouns as a proxy for persons. However, we found them unsuitable since they are also often used as referring expressions to other entities, such as animals. Professions, on the other hand, can only refer to humans. The list of professions we used was created ad-hoc. It should be reproducible in any arbitrary language. _The full list is included in the supplementary notes.4_

Footnote 4: The homogeneity weight is the average pairwise similarity of all compounds belonging to the same head group.

**Outlier Compound(s) in Head Group (OUT).** In most head groups, derogatory compounds represent a clear minority with only 1 or 2 compounds. The derogatory compounds are also often semantically different from the non-derogatory compounds (_keyboard varrior_ vs. _rajput warrior_, _inija warrior_, _samurai warrior_). This is particularly true if the non-derogatory compounds are very homogeneous. From that observation we derive a diagnostic in which we determine the semantic outlier(s) for each head group. First, we compute for each compound the average pairwise similarity to all other compounds within its head group. The resulting score of a compound (converted to a dissimilarity score by taking its inverse) is then multiplied by a weight representing the homogeneity of all compounds within that head group.5 (_Pseudocode is provided in the supplementary notes._ 

groups that are heterogeneous (e.g. _legacy hunter_, _job hunter_, _autograph hunter_), there are less obvious outliers.

### Combination and Reranking

**Combination (COMB).** Negative polarity is a pre-requisite for being derogatory [16, 23]. Therefore, we base our combination on the ranking of NEG. From that ranking we remove all those compounds which have not co-occurred at the high ranks of at least one of the other diagnostics (COMCON, OUT, PERSON).9 Compounds that are highly ranked by several diagnostics should more likely represent derogatory compounds.

Footnote 9: We took top 350 from all these rankings which resembles the number of derogatory compounds on our dataset.

**Re-Ranking by PageRank (PRANK).** We observed that among the top ranks of COMB, the derogatory compounds are semantically similar (e.g. _dwarf tosser_, _mischief maker_, _slimeball_) while the non-derogatory compounds are semantically different from each other (e.g. _biker club_, _spirit bear_). Therefore, we run personalized PageRank [4] to further improve the ranking by enforcing the compounds on the high ranks to be distributionally similar. We build a word-similarity graph where our compounds are nodes and edges encode cosine-similarities of their embeddings. PageRank then produces a ranking of nodes where the highest ranked nodes are the ones most highly connected. In personalized PageRank prior information is added. A biased graph is constructed in which attention is drawn towards particular regions of interest. This is achieved by assigning re-entrance weights to the individual nodes. As prior information, we set the nodes representing the compounds returned by COMB with a uniform re-entrance weight (\(\alpha\))10 while all other nodes receive a weight of 0.

Footnote 10: Following Manning et al. (2008), we set \(\alpha=0.1\).

**Label Propagation (LP).** While previous diagnostics were designed to isolate a few derogatory compounds with a high precision, LP aims for increasing recall. We define some high-precision seeds for the two categories of our task and then propagate the labels to the unlabeled compounds by using label propagation [7]. The algorithm operates on the same word-similarity graph that we used for PRANK. We define highly ranked compounds from PRANK as derogatory seeds and lowly ranked compounds as non-derogatory seeds. Unlike the previous diagnostics, the output of LP is a binary categorization rather than a ranking. In order to make this output comparable to the other diagnostics, we converted the output of LP to a ranking. This is achieved by ranking the compounds predicted as derogatory according to the confidence score provided by the classifier.

## 5 Experiments

Table 2 shows the precision at rank \(n\) (P@\(n\)) of different rankings as measured on our compound gold standard. For LP, we consider the top 50 compounds from PRANK as derogatory seeds and the bottom 500 as non-derogatory seeds.11 As a baseline we add a randomized ranking (RAND).

Footnote 11: The ratio of derogatory and non-derogatory compounds should vaguely reflect the class distribution.

PRANK produces a very high precision on the high ranks, outperforming the individual rankings and COMB. We also tested a modification, PRANK\({}_{NEG}\), which applies personalized PageRank on the output of NEG, which is the strongest individual ranking. Since PRANK outperforms PRANK\({}_{NEG}\), we conclude that the high precision of PRANK also depends on the combination of the individual rankings. LP manages to notably raise scores on the lower ranks (e.g. P@300) which proves the advantage of LP over PRANK.

Table 3 compares our proposed method (LP) against supervised classifiers. We evaluate the entire classification output (with F1-measure) rather than a ranking. The classifiers are trained on our unigram or compound gold standard (SS3). For the latter case, we conducted 10-fold crossvalidation. 500 of the 3500 compounds were reserved as a development set on which we tuned hyperparameters of the supervised classifiers. (_The supplementary notes_4_ contain more details._) As features we consider word embeddings and the linguistic features from Wiegand et al. (2018a). They are based on knowledge that is expensive to produce, such as sentiment views, polar intensity, or information from Wiktionary.12

Footnote 12: The method WSUP from Wiegand et al. (2018a) was not considered because of its poor performance on compounds.

Table 3 shows that learning from the compound gold standard is more effective than learning from the existing unigram g



strong performance of embeddings, we also examined the performance of (publicly available) off-the-shelf embeddings13 and found that the high classification scores can be mainly ascribed to the large corpus on which we induced our embeddings (i.e. COW16).

Footnote 13: We took the publicly available embeddings induced on Twitter-data from: www.spinningbytes.com/resources/wordembeddings/

Our unsupervised approach (LP) is almost on a par with the most complex SVM. This is particularly appealing since we produced that classifier without manually labeled training data and those manually-created resources required for the linguistic features.

Compound embeddings are the most predictive information for our task, but even from the large COW16 corpus, we only obtained embeddings for 60% of our compounds.14 In Table 4, we evaluate compositional information, which can also be used for compounds that lack an embedding. We apply an SVM with the best previous feature set (of which embeddings are the main contributor) on the constituents of the compounds. Moreover, we train an LSTM on the sequence of characters of the compound. Table 4 shows that information drawn from units other than the compound itself is less effective. The feature combination of head, modifier and compound is not effective either.

Footnote 14: For the remaining compounds, we used dummy vectors.

Instead of applying embeddings on constituents and concatenating them, we also examine a sophisticated compositional model (_Wmask_) based on a masking process that takes into account the variation of a constituent depending on whether it is a head or a modifier [25]. Table 5 shows the performance of the two best previous classifiers where compounds lacking an embedding are represented by an embedding approximated by Wmask (rather than a dummy vector). The table shows that the two classifiers can be improved by adding the approximated embeddings.

## 6 Conclusion

We examined the new task of detecting derogatory compounds and proposed an unsupervised approach incorporating linguistic properties of compounds that mostly depend on a distributional representation. Our method outperforms linguistic features previously shown to be effective for the detection of derogatory unigrams and it is on a par with a far more expensive state-of-the-art supervised approach. Features defined on the constituents of a compound and training a classifier on derogatory unigrams are far less effective.

## Acknowledgements

The authors would like to thank Ines Rehbein for feedback on earlier drafts of this paper. We are also grateful to Corina Dima for helping us to run her semantic composition toolkit _wordcomp_ on our data. The authors were partially supported by the German Research Foundation (DFG) under grants RU 1873/2-1 and WI 4204/2-1.

\begin{table}
\begin{tabular}{|l|c|c|} \hline
**Classifier** & SVM (embeddings+linguistic) & LSTM \\ \hline
**Unit** & head modifier & compound & combined & characters \\ \hline
**FI** & 57.0 & 60.2 & **74.7** & 69.0 & 54.5 \\ \hline \end{tabular}
\end{table}
Table 4: Comparison of compositional approaches.

\begin{table}
\begin{tabular}{|l||c||c|c|c|c|c|c|c|c|} \hline
**P@n** & **RAND** & **COMCON** & **PERSON** & **OUT** & **Neg** & **COMB** & **PRANK\({}_{NEG}\)** & **PRANK** & **LP** \\ \hline P@25 & 12.0 & 19.2 & 50.0 & 60.0 & 72.0 & 80.0 & 96.0 & **100.0** & **100.0** \\ P@50 & 14.0 & 20.0 & 46.0 & 44.0 & 62.0 & 74.0 & 88.0 & **94.0** & **94.0** \\ P@100 & 10.0 & 26.0 & 40.0 & 38.0 & 58.0 & 68.0 & 68.0 & **52.0** & 77.0 \\ P@200 & 10.0 & 30.5 & 31.5 & 26.5 & 48.5 & 54.5 & 42.0 & 59.0 & **68.5** \\ P@300 & 12.3 & 27.3 & 27.7 & 21.7 & 39.3 & 44.0 & 29.3 & 44.3 & **60.3** \\ \hline \end{tabular}
\end{table}
Table 2: Comparison of different rankings, evaluated by precision at rank \(n\) (P@_n_). (_PRANK\({}_{NEG}\) is the ranking applied solely on the output of NEG; PRANK is the ranking applied on the output of COMB._)

\begin{table}
\begin{tabular}{|l|c|c|c|} \hline
**Training** & **Classifier** & **Features** & **FI** \\ \hline uniform & SVM & embeddings+linguistic & 63.3 \\ \hline compound & SVM & linguistic \\  & SVM & embeddings (_off-the-shelf_) & 68.5 \\  & SVM & embeddings & 72.4 \\  & SVM & embeddings+inguistic & 74.7 \\ \hline _none_ & LP & (embeddings) & 73.5 \\ \hline \end{tabular}
\end{table}
Table 3: Comparison of different classifiers.

 



## References

* Agirre and Soroa (2009) Eneko Agirre and Aitor Soroa. 2009. Personalizing PageRank for Word Sense Disambiguation. In _Proceedings of the Conference on European Chapter of the Association for Computational Linguistics (EACL)_, pages 33-41, Athens, Greece.
* Dima (2015) Corina Dima. 2015. Reverse-engineering Language: A Study on the Semantic Compositionality of German Compounds. In _Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP)_, pages 1637-1642, Lisbon, Portugal.
* Dinakar et al. (2012) Karthik Dinakar, Birago Jones, Catherine Havasi, Henry Lieberman, and Rosalind Picard. 2012. Common sense reasoning for detection, prevention, and mitigation of cyberbullying. _ACM Transactions on Interactive Intelligent Systems_, 2(3):18:1-18:30.
* Gitari et al. (2015) Njagi Dennis Gitari, Zhang Zuping, Hanyurwimfura Damien, and Jun Long. 2015. A Lexicon-based Approach for Hate Speech Detection. _International Journal of Multimedia and Ubiquitous Engineering_, 10(4):2015-230.
* Klenner et al. (2009) Manfred Klenner, Angela Fahrani, and Stefanos Petrakis. 2009. PolArt: A Robust Tool for Sentiment Analysis. In _Proceedings of the Nordic Conference on Computational Linguistics (NoDaLiDa)_, pages 235-238, Odense, Denmark.
* Landis and Koch (1977) J. Richard Landis and Gary G. Koch. 1977. The Measurement of Observer Agreement for Categorical Data. _Biometrics_, 33(1):159-174.
* Manning et al. (2008) Christopher D. Manning, Hinrich Schutze, and Prabhakar Raghavan. 2008. _Introduction to Information Retrieval_. Cambridge University Press.
* Mikolov et al. (2013) Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Efficient Estimation of Word Representations in Vector Space. In _Proceedings of Workshop at the International Conference on Learning Representations (ICLR)_, Scottsdale, AZ, USA.
* Razavi et al. (2010) Amir Hossein Razavi, Diana Irlbpen, Sasha Uritsky, and Stan Matwin. 2010. Offensive Language Detection Using Multi-level Classification. In _Proceedings of the Canadian Conference on Artificial Intelligence_, pages 16-27, Ottawa, Canada.
* Schafer (2015) Roland Schafer. 2015. Processing and querying large web corpora with the COW14 architecture. In _Proceedings of the Workshop on Challenges in the Management of Large Corpora (CMLC)_, pages 28-34, Lancaster, United Kingdom.
* Schmidt and Wiegand (2017) Anna Schmidt and Michael Wiegand. 2017. A Survey on Hate Speech Detection using Natural Language Processing. In _Proceedings of the EACL-Workshop on Natural Language Processing for Social Media (SocialNLP)_, pages 1-10, Valencia, Spain.
* Sood et al. (2012) Sara Owsley Sood, Elizabeth F. Churchill, and Judd Antin. 2012. Automatic identification of personal insults on social news sites. _Journal of the Association for Information Science and Technology_, 63(2):270-285.
* Talukdar et al. (2008) Partha Pratim Talukdar, Joseph Reisinger, Marius Pasca, Deepak Ravichandran, Rahul Bhagat, and Fernando Pereira. 2008. Weakly-Supervised Acquisition of Labeled Class Instances using Graph Random Walks. In _Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP)_, pages 582-590, Honolulu, HI, USA.
* Student Research Workshop_, pages 88-93, San Diego, CA, USA.
* A Feature-Based Approach. In _Proceedings of the Human Language Technology Conference of the North American Chapter of the ACL (HLT/NAACL)_, pages 1046-1056, New Orleans, LA, USA.
* Wiegand et al. (2018b) Michael Wiegand, Melanie Siegel, and Josef Ruppenhofer. 2018b. Overview of the GermEval 2018 Shared Task on the Identification of Offensive Language. In _Proceedings of the GermEval Workshop_, pages 1-10, Vienna, Austria.
* Zhong et al. (2016) Haoti Zhong, Hao Li, Anna Cinzia Squicciarini, Sarah Michele Rajtmajer, Christopher Griffin, David J. Miller, and Cornelia Caragea. 2016. Content-Driven Detection of Cyberbullying on the Instagram Social Network. In _Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI)_, pages 3952-3958, New York City, NY, USA.
* Zipf (1965) George K. Zipf. 1965. _The Psycho-Biology of Language_. MIT Press.