Euphemistic Phrase Detection by Masked Language Model (2021)

Abstract: It is a well-known approach for fringe groups and organizations to use euphemisms—ordinary-sounding and innocent-looking words with a secret meaning—to conceal what they are discussing. For instance, drug dealers often use “pot” for marijuana and “avocado” for heroin. From a social media content moderation perspective, though recent advances in NLP have enabled the automatic detection of such single-word euphemisms, no existing work is capable of automatically detecting multi-word euphemisms, such as “blue dream” (marijuana) and “black tar” (heroin). Our paper tackles the problem of euphemistic phrase detection without human effort for the first time, as far as we are aware. We first perform phrase mining on a raw text corpus (e.g., social media posts) to extract quality phrases. Then, we utilize word embedding similarities to select a set of euphemistic phrase candidates. Finally, we rank those candidates by a masked language model—SpanBERT. Compared to strong baselines, we report 20-50% higher detection accuracies using our algorithm for detecting euphemistic phrases.

## introduction euphemisms-ordinary-sounding and innocentlooking words-have long been used in human communication as an instrument to conceal secret information @xcite . a primary motive of their use on social media is to evade automatic content moderation efforts enforced by such platforms @xcite . for example, a rich lexicon of drug euphemisms has evolved over time, with entire communities subscribing to benign sounding words that allude to drug names (e.g., {"popcorn", "blueberry", "green crack", "blue dream"} -→ "marijuana", {"coke", "white horse", "happy powder"} -→ "cocaine"). research on automatic euphemism detection has recently received increased attention in the natural language processing communities @xcite @xcite , and the security and privacy communities @xcite @xcite @xcite . however, existing approaches can only detect single-word euphemisms (e.g., "popcorn", "coke"), and fail to detect multi-word euphemisms (e.g., "black tar", "cbd oil") automatically. therefore, offenders can simply invent euphemistic phrases to evade content moderation and thwart censorship. our paper focuses on the task of euphemistic phrase detection-detecting phrases that are used as euphemisms for a list of target keywords-by extending the state-of-the-art single-word euphemism detection algorithm proposed by @xcite . our proposed approach first mines quality phrases from the text corpus using autophrase @xcite , a data-driven phrase mining tool. then, it filters noisy candidates that are not semantically related to any of the target keywords (e.g., heroin, marijuana in the drug category). this serves as a pre-selection step to construct a euphemistic phrase candidate pool. finally, we rank the pre-selected candidates using spanbert @xcite , a pre-training masked language model (mlm) that is designed to better predict the span of tokens (i.e., phrases) in text. evaluating on the benchmark drug dataset in @xcite , we find that our proposed approach yields euphemistic phrase detection results that are 20-50% higher than a set of strong baseline methods. a qualitative analysis reveals that our approach also discovers correct euphemisms that were not on our ground truth list, i.e., it can detect previously unknown euphemisms and even new types of drugs. this is of significant utility in the context of internet communities, where euphemisms evolve rapidly and new types of drugs may be invented. text corpus hash oil street drugs louis vuitton barack obama xtc pills sugar cubes street meth black tar credit card … quality phrases pre-selection phrase mining phrase ranking hash oil street drugs xtc pills sugar cubes street meth black tar … relevant phrases black tar sugar cubes hash oil … xtc pills … street meth street drugs … ranked phrases 2 proposed model in this study, we assume access to a raw text corpus (e.g., a set of posts from an online forum). in practice, forum users may use euphemisms-words that are used as substitutes for one of the target keywords (e.g., heroin, marijuana). we aim to learn which multi-word phrases are being used as euphemisms for the target keywords. the euphemism detection task takes as input (1) the raw text corpus and (2) a list of target keywords. the output is an ordered ranked list of euphemistic phrase candidates, sorted by model confidence. our proposed approach for euphemistic phrase detection has three stages (shown in figure 1 ): 1) mining quality phrases, 2) pre-selecting euphemistic phrase candidates using cosine similarities of word2vec embeddings @xcite , and 3) ranking euphemistic phrases with a masked language model. ## empirical evaluation we evaluate our proposed model (denoted as "epd") and the following baselines on the benchmark drug dataset in @xcite , and compare it with the following baseline models: following @xcite , we use the evaluation metric precision at k (p @k) to compare the generated candidates of each method with the ground ## related work euphemism detection and its related work has recently received increased attention from the natural language processing and security and privacy communities @xcite @xcite @xcite @xcite @xcite @xcite . existing euphemism detection work have established a number of models by supervised @xcite , semi-supervised @xcite and unsupervised learning schemes @xcite , on diverse categories and platforms @xcite , with and without distantsupervision @xcite . without requiring any online search services, one major line of existing work have relied on static word embeddings (e.g., word2vec) in combination with network analysis @xcite , sentiment analysis @xcite , and semantic comparison across corpora @xcite . however, the use of static word embeddings provides a single representation for a given word without accounting for its polysemy, and yields limited benefits. therefore, @xcite propose to explicitly harness the contextual information, formulate the problem as an unsupervised fill-in-the-mask problem @xcite , and solve it by a masked language model with state-of-the-art results. though prior studies report excellent results, to the best of our knowledge, none of the available approaches is capable of detecting euphemistic phrases without human effort. 7 therefore, policy evaders could simply invent euphemistic phrases to escape from the censorship. our work bridges this gap by extending the state-of-the-art euphemism detection approach proposed by @xcite and achieves holistic euphemism detection by enabling the detection of euphemistic phrases. ## conclusion we have proposed a solution to address the problem of euphemistic phrase detection. by mining quality phrases from the text corpus, pre-selecting euphemistic phrase candidates, and ranking phrases by a masked language model, we, for the first time, achieve euphemistic phrase detection automatically. 8 moreover, we discover new euphemisms that are not even on the ground truth list, which is valuable for content moderation on social media platforms.