# A BTM-Based Adaptive Objectionable Short Text Filtering Framework

Authors: Dong Cui; Qiaoyan Wen; Hua Zhang; Wenmin Li; Yijie Shi; Yingyu Zhou; Lei Zhang
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

Many methods are available for objectionable text filtering, such as URL-based filtering, keyword-based filtering, and intelligence-based analysis filtering approaches. URL-based filtering cannot filter the contents of objectionable short text. Keyword-based filtering faces the overblocking issue. Intelligence-based analysis filtering is inefficient and ineffective when filtering objectionable short text. In this paper, a biterm topic modelling- (BTM-) based adaptive objectionable short text filtering framework is proposed. We propose a feature extraction algorithm for objectionable short text and establish a sensitive word feature dataset using the descriptions of applications on the Internet. Then, we construct a judgment standard to automatically select theK value of the BTM topic model that can induce self-adaptation. The feature dataset constructed in this paper can effectively reflect the characteristics of objectionable short text. The proposed filtering framework can effectively identify objectionable short text and has a higher filtering rate than other approaches.


---

## Body

## 1. Introduction

Objectionable short text contains information such as pornography, violence, and murder. Moreover, such texts are abundant in web applications and mobile apps. This information is harmful to the health and growth of teenagers. Since the passage of the Communications Decency Act (CDA) [1] in 1995, a consortium including the Microsoft Corporation, Netscape Communications, and Progressive Networks has established standards that empower parents to block inappropriate web content. Some countries and international organisations, such as the United Kingdom, the European Commission, the Netherlands, China, and the Family Online Safety Institute (FOSI, have performed many similar actions to protect children and the general public from harmful content. An important part of the FOSI’s work is the classification of applications and user-generated content.There are currently four main types of research on objectionable text filtering: studies based on uniform resource locator (URL) filtering, keyword-based filtering, intelligence-based filtering, and topic-based filtering.URL-based filtering methods [2–4] provide excellent manual control modes to filter unwanted websites with the correct metadata settings. The URL, as a filter unit, filters out standard text.Keyword-based filtering [5–8] applies to fine-grained text filtering especially at the word level and such a method requires a list of keywords. A keyword filtering method easily misses objectionable text [8]. If filtering is performed by augmenting sensitive words, overblocking problems occur and the accuracy is significantly reduced [9].Intelligence-based analysis filtering [10, 11] has difficulty fine-tuning sentences or paragraphs because such methods use web pages as the basic units to infer a filtering model, and the detection performance depends mostly on the quality of the given training set [12].Topic-based filtering [13–15] enables the filtering of sentences or paragraphs by analysing the possible topics contained in the input text. Traditional topic models, such as latent Dirichlet allocation (LDA), do not work well for shot text because these models implicitly capture document-level cooccurrence patterns to reveal text themes; thus, such approaches encounter data sparsity problems in short texts [16].In summary, the four above types of filtering methods are not suitable for the filtering of objectionable short text for these reasons. To better solve the data sparsity problem of objectionable short text filtering and improve the accuracy of filtering, this paper proposes a new filtering framework.


### 1.1. Contributions

To solve the problem of semantically filtering objectionable short text on the Internet and to realize automatic and rapid filtering, this paper proposes a biterm topic modelling- (BTM-) based adaptive objectionable short text filtering framework. The main contributions of this paper are as follows:An extraction method for sets of text features is proposed based on the term frequency-inverse document frequency (TF-IDF) algorithm. The extraction method divides the observed text features into general feature words and sensitive feature words and constructs a word weight table based on word frequency and word cooccurrence relationships.An adaptive topic model is proposed based on a BTM. By using the topic model to capture the potential relationships between words, a filtering model for objectionable short text is assembled. Unlike traditional BTMs that do not consider choosing the number of topics, we propose a method to evaluate the number of topics in the BTM to achieve model adaptation.An experimental model efficiency verification is provided. By collecting the short text information of objectionable applications in mobile application stores, such as wood ant, application treasure, and the Baidu mobile assistant application store, we establish a feature dataset, extract feature words, and train the developed model. The obtained results show that the combination of objectionable text feature selection and BTM-based adaptive topic model construction is superior to previously proposed methods in terms of detecting objectionable short text.We produce an objectionable short text dataset and a standard short text dataset.


## 1.1. Contributions

To solve the problem of semantically filtering objectionable short text on the Internet and to realize automatic and rapid filtering, this paper proposes a biterm topic modelling- (BTM-) based adaptive objectionable short text filtering framework. The main contributions of this paper are as follows:An extraction method for sets of text features is proposed based on the term frequency-inverse document frequency (TF-IDF) algorithm. The extraction method divides the observed text features into general feature words and sensitive feature words and constructs a word weight table based on word frequency and word cooccurrence relationships.An adaptive topic model is proposed based on a BTM. By using the topic model to capture the potential relationships between words, a filtering model for objectionable short text is assembled. Unlike traditional BTMs that do not consider choosing the number of topics, we propose a method to evaluate the number of topics in the BTM to achieve model adaptation.An experimental model efficiency verification is provided. By collecting the short text information of objectionable applications in mobile application stores, such as wood ant, application treasure, and the Baidu mobile assistant application store, we establish a feature dataset, extract feature words, and train the developed model. The obtained results show that the combination of objectionable text feature selection and BTM-based adaptive topic model construction is superior to previously proposed methods in terms of detecting objectionable short text.We produce an objectionable short text dataset and a standard short text dataset.


## 2. Related Work

To effectively filter objectionable text, researchers have done much work, which mainly includes studies on URL-based filtering, keyword-based filtering, intelligence-based analysis filtering, and topic-based filtering. URL-based filtering cannot filter objectionable short text, so we do not discuss it here. Furthermore, at the end of this section, we introduce the BTM-based topic model used in this paper.


### 2.1. Keyword-Based Filtering

Keyword-based filtering [5–7] methods find suspicious objectionable text based on the words appearing in the input text content. Each word is compared to a word in a keyword dictionary which consists of disallowed words and phrases. Once the number of matches reaches a predefined threshold, the text is determined to be objectionable text. The resource consumption of this method is low so it is widely used to filter web content. However, this method is prone to a well-known “overblocking” phenomenon. Therefore, a method based on intelligent analysis filtering is later used to solve this problem.


### 2.2. Intelligence-Based Analysis Filtering

Filtering objectionable text can be considered a two-category problem dividing the input text into standard text and objectionable text.K-nearest neighbors (KNN) algorithms, logistic regression algorithms, neural networks, naive Bayes classifiers, and support vector machines (SVMs) are all used in this case.An SVM-based classifier can classify a web page as a node in a sensitive content category. Du et al. [17] used a classifier obtained by SVM training to filter sensitive text on the web and tested their approach on an adult text dataset collected from Yahoo’s adult category pages. Jin et al. [18] used a text pattern similar to the concept of a “regular expression” in the Perl language as one of their model features. A classifier typically also uses several additional functions to improve its classification accuracy. For example, URLs, stitching features, and some structural features can be integrated into a learning algorithm to improve its classification performance [19, 20]. Later, Lee et al. [21] proposed a new detection framework to find target web pages by mining user search behaviours. The intelligent aspect of this framework involves utilizing a user intent model to learn how to capture new and objectionable web content. Ali et al. [22] used a supervised learning method with a naive Bayes classification algorithm and an SVM and found that the best model for detecting pornographic content on Twitter is an SVM with unigram and bigram combinations using the TF-IDF algorithm and the most common words; this approach achieved an F1-score of 91.14%.


### 2.3. Topic-Based Filtering

Filtering frameworks based on the topic models [9, 12, 13, 16] exhibit improved objectionable text detection ability by analysing the semantic content of the input text. To achieve fine-grained detection, such a framework uses sentences as the basic units for identification and filtering; that is, when filtering web content, each sentence is detected and judged to determine whether it constitutes objectionable text. A topic model analyses the semantics of the given sentence, and by building an internal semantic space and calculating relevant probabilities, the sensitivity of the sentence is measured. To avoid the use of complex model parameters, Blei et al. [13] used a potential Dirichlet distribution (via LDA). This distribution provides a better generation mechanism than other approaches.


### 2.4. BTM-Based Topic Models

Finding hidden topics from short texts such as tweets or instant messages has become an essential task for many content analysis applications. However, applying traditional topic models (such as LDA and probabilistic latent semantic analysis (PLSA)) directly to such short texts does not achieve the desired results. The underlying reason for this is that traditional topic models implicitly capture document-level cooccurrence patterns to reveal topics, thus encountering the problem of severe data sparsity in short documents.To solve the problems encountered by the traditional thematic model, Yan et al. proposed a BTM, which utilizes a disordered cooccurrence word pair in a short text window [16] to learn topics by directly modelling the generation of word cooccurrence patterns in the whole input corpus. A BTM explicitly models word cooccurrence patterns to enhance the topic of learning and uses the aggregated patterns in the whole corpus to learn topics and solve the problem of word cooccurrence pattern scarcity at the document level.A BTM is a topic model that is ideal for short text scenes. Different from the traditional LDA-based topic model, a BTM not only maintains the correlations between words but can also infer the topic probability of a document, and compared with the individual LDA approach, it can better reveal the topics in text. A BTM uses biterms, which consist of two words each, to enhance the learning of the topic model. It uses the entire input corpus to sample topics and infers the global distribution of topics across the corpus. In a BTM, the given document is considered a random mix of possible topics. Each topic is thought to be a probability distribution. In a BTM, thebiterm-topic distribution, the document-biterm distribution, and the document-topic distribution in the corpus can be represented by Formulas (1), (2), and (3), respectively [16]. The word vector space of a short text can be mapped to the topic vector space of the short text.However, the traditional BTM does not provide a way to determine the number of topicsK, which can only be resolved with specific data. Although the value of K can sometimes be estimated, this method does not meet the requirements of adaptively detecting objectionable text and is not suitable for this purpose. Moreover, traditional BTMs cannot be used to directly filter objectionable short texts.
(1)Pz∣b=pzpwi∣zpwj∣z∑zpzpwi∣zpwj∣z,(2)Pb∣d=ndb∑bndb,(3)Pz∣d=∑bPz∣bPb∣d.


## 2.1. Keyword-Based Filtering

Keyword-based filtering [5–7] methods find suspicious objectionable text based on the words appearing in the input text content. Each word is compared to a word in a keyword dictionary which consists of disallowed words and phrases. Once the number of matches reaches a predefined threshold, the text is determined to be objectionable text. The resource consumption of this method is low so it is widely used to filter web content. However, this method is prone to a well-known “overblocking” phenomenon. Therefore, a method based on intelligent analysis filtering is later used to solve this problem.


## 2.2. Intelligence-Based Analysis Filtering

Filtering objectionable text can be considered a two-category problem dividing the input text into standard text and objectionable text.K-nearest neighbors (KNN) algorithms, logistic regression algorithms, neural networks, naive Bayes classifiers, and support vector machines (SVMs) are all used in this case.An SVM-based classifier can classify a web page as a node in a sensitive content category. Du et al. [17] used a classifier obtained by SVM training to filter sensitive text on the web and tested their approach on an adult text dataset collected from Yahoo’s adult category pages. Jin et al. [18] used a text pattern similar to the concept of a “regular expression” in the Perl language as one of their model features. A classifier typically also uses several additional functions to improve its classification accuracy. For example, URLs, stitching features, and some structural features can be integrated into a learning algorithm to improve its classification performance [19, 20]. Later, Lee et al. [21] proposed a new detection framework to find target web pages by mining user search behaviours. The intelligent aspect of this framework involves utilizing a user intent model to learn how to capture new and objectionable web content. Ali et al. [22] used a supervised learning method with a naive Bayes classification algorithm and an SVM and found that the best model for detecting pornographic content on Twitter is an SVM with unigram and bigram combinations using the TF-IDF algorithm and the most common words; this approach achieved an F1-score of 91.14%.


## 2.3. Topic-Based Filtering

Filtering frameworks based on the topic models [9, 12, 13, 16] exhibit improved objectionable text detection ability by analysing the semantic content of the input text. To achieve fine-grained detection, such a framework uses sentences as the basic units for identification and filtering; that is, when filtering web content, each sentence is detected and judged to determine whether it constitutes objectionable text. A topic model analyses the semantics of the given sentence, and by building an internal semantic space and calculating relevant probabilities, the sensitivity of the sentence is measured. To avoid the use of complex model parameters, Blei et al. [13] used a potential Dirichlet distribution (via LDA). This distribution provides a better generation mechanism than other approaches.


## 2.4. BTM-Based Topic Models

Finding hidden topics from short texts such as tweets or instant messages has become an essential task for many content analysis applications. However, applying traditional topic models (such as LDA and probabilistic latent semantic analysis (PLSA)) directly to such short texts does not achieve the desired results. The underlying reason for this is that traditional topic models implicitly capture document-level cooccurrence patterns to reveal topics, thus encountering the problem of severe data sparsity in short documents.To solve the problems encountered by the traditional thematic model, Yan et al. proposed a BTM, which utilizes a disordered cooccurrence word pair in a short text window [16] to learn topics by directly modelling the generation of word cooccurrence patterns in the whole input corpus. A BTM explicitly models word cooccurrence patterns to enhance the topic of learning and uses the aggregated patterns in the whole corpus to learn topics and solve the problem of word cooccurrence pattern scarcity at the document level.A BTM is a topic model that is ideal for short text scenes. Different from the traditional LDA-based topic model, a BTM not only maintains the correlations between words but can also infer the topic probability of a document, and compared with the individual LDA approach, it can better reveal the topics in text. A BTM uses biterms, which consist of two words each, to enhance the learning of the topic model. It uses the entire input corpus to sample topics and infers the global distribution of topics across the corpus. In a BTM, the given document is considered a random mix of possible topics. Each topic is thought to be a probability distribution. In a BTM, thebiterm-topic distribution, the document-biterm distribution, and the document-topic distribution in the corpus can be represented by Formulas (1), (2), and (3), respectively [16]. The word vector space of a short text can be mapped to the topic vector space of the short text.However, the traditional BTM does not provide a way to determine the number of topicsK, which can only be resolved with specific data. Although the value of K can sometimes be estimated, this method does not meet the requirements of adaptively detecting objectionable text and is not suitable for this purpose. Moreover, traditional BTMs cannot be used to directly filter objectionable short texts.
(1)Pz∣b=pzpwi∣zpwj∣z∑zpzpwi∣zpwj∣z,(2)Pb∣d=ndb∑bndb,(3)Pz∣d=∑bPz∣bPb∣d.


## 3. BTM-Based Filtering Framework for Objectionable Short Text

This paper proposes a new filtering framework with an adaptive topic model based on a BTM. We build a sensitive feature dataset by quantifying the importance and sensitivity levels of feature words. We build an adaptive BTM detection model (aBTMd) based on a sensitivity feature dataset. The BTM-based adaptive filtering framework can adapt to different datasets without requiring theK value of the topic model to be set in advance.The objectionable short text filtering framework proposed in this paper is shown in Figure1, and it includes two parts: a training phase and a detection phase. The training phase is divided into three steps: extracting feature words from the corpus (step I), calculating the weight table (step II), and building an adaptive topic model (step III). The detection phase is divided into two steps: converting the target short text to a biterm (step IV) and conducting detection with the aBTMd (step V).
(i)
First, we extract general feature words from corpusD to obtain Wgf=w1,w2,⋯,wn. Then, we extract words from the list of sensitive feature words S to obtain Wsf=w1,w2,⋯,wn. Finally, we can obtain the biterm list through Wgf and Wsf(ii)
To obtain the feature weight table, we need to first calculate theImp and Obj of each feature word and then combine the seed word list S and biterm list to perform calculations through an algorithm(iii)
In this step, we build an aBTMd through the adaptive algorithm proposed in this paper(iv)
To detect the target short text, we need to convert it into biterms; this process includes the extraction of feature words and the calculation of biterms to obtainTb=b1,b2,⋯,bn(v)
We inputTb into the trained aBTMd for detection to identify whether the text is objectionable short text through the score obtained by the detectorFigure 1
Overview of the BTM-based adaptive objectionable short text filtering framework: the training phase generates an adaptive BTM-based detection model (aBTMd), and the detection phase uses the aBTMd to determine whether a target short text is objectionable.
(a)
Training phase(b)
Detection phaseThe new method does not require a complete keyword list, which makes the proposed approach different from traditional keyword-based filtering methods. By setting the seed words in advance, based on calculation, the framework can obtain an objectionable feature dataset, which can effectively reflect the sensitivity of the corpus. Different from current classification-based detection methods, we use the aBTMd to build a one-class classification model for detecting objectionable short text. This approach is helpful for constructing an adaptive topic model with a combination of objectionable feature selection abilities.Detailed information about the proposed framework will be introduced in subsequent sections. Table1 shows some symbols used in the following sections.Table 1
Symbol description.
SymbolDescriptionD=d1,d2,⋯,dmCorpusW=w1,w2,⋯,wnList of feature wordsOCwi,wjThe number of simultaneous occurrences of each pair of words in each document in corpusDMFeature word relationship matrixnNumber of feature words in the feature vocabularydDamping factor between 0 and 1; usually 0.85ImpiWord importance vector; each element represents the importance of the corresponding feature wordwi in the sequence (recorded as impi)ObjiThe sensitivity of a feature wordwiWgiThe weight value of wordwiS=s1,s2,⋯,snList of sensitive feature wordsSW=sw1,sw2,⋯,swnWeight list of sensitive feature wordsdiCorpus documentiZTopic implied in the documentbiterm={wi,wj}Word pairs consisting of wordi and word jnzNumber of word pairs under topicZnwizNumber of times topicZ is assigned to word wiSTCSensitive topic criterionSTCVtThe sensitivity of topictKThe topic number


## 4. Building a Sensitive Word Dataset

This paper proposes an improved method for constructing a feature dataset by referencing feature word frequencies and word cooccurrence relationships based on the feature word extraction method proposed by Zeng et al. [9].Because feature words have different effects on objectionable short text detection depending on their sensitivities, it is necessary to set different weights. This paper classifies sensitive words as general feature words and sensitive feature words. General feature words refer to relatively concealed words that express objectionable intentions. A sensitive feature word is a word with a clear indication of objectionable information that is determined manually in advance.The weight of a feature word is determined by two aspects. One is the frequency at which the feature word appears in the corpus, and the other is the sensitivity of the feature word itself. To better distinguish the weights of general feature words and sensitive feature words during filtering, based on the existing research, this paper divides the weight of each feature word into an importance degree (Imp) and objectionable degree (Obj). Imp refers to the importance of the feature word in the corpus. Obj refers to the degree of the feature word as a basis for objectionable text judgment.First, the feature matrix consists of the relationships between feature words, and then, the importance levels of feature words in the training set are calculated by the PageRank algorithm. To better distinguish between the sensitivities of different sensitive feature words and general feature words, this paper utilizes the TF-IDF algorithm and introduces statistical word frequencies to the training set, and the sensitivities are divided into different levels for calculation purposes. Finally, the weightWg of the corresponding feature word is obtained by multiplying its Imp and Obj values.


### 4.1. Calculation of the Imp of a Feature Word

Imp refers to the importance of a feature word in the input corpus. To obtain the Imp of a feature word in the corpus, this paper uses the PageRank algorithm for calculation. Algorithm 1 shows how to calculate this value. Firstly, we need to create an undirected graph. The nodes of the graph are feature words, and the edges of two nodes describe the word cooccurrence relationship between the two feature words. Then, the undirected graph is transformed into a matrix by using the PageRank random browsing model. Finally, we calculate the convergence matrix after the graph matrix reaches a steady state.Algorithm 1: Feature word Imp calculation algorithm.
Input: W=w1,w2,⋯,wn, D=d1,d2,⋯,dm.Output: Impw1: init matrixImpw=1/n,1/n,⋯,1/n2:fori in 1,2,⋯,n−1do3:forj in i+1,i+2,⋯,ndo4:fork in 1,2,⋯,kdo5:ifwi∈dk∧wj∈dkthen6:OCwi,wj ++;7:end if8:end for9:end for10:end for11: Calculated with the following formula:Mi,j=OCwi,wj/∑j=1,j≠inOCwi,wj12:whileImpwp−Impwq>Δdo13:Impwp=dMi,jImpwq+1−dImpwq14:end while15: returnImpw


### 4.2. Calculation of the Obj of a Feature Word

Obj refers to the importance of feature words while judging objectionable text. The obj of feature words is divided into the obj of sensitive feature words and the obj of general feature words.Sensitive feature words have different levels of semantics, especially in Chinese. Different sensitive feature words have different tones, and their occurrence frequencies in the training set are also different. Words with high sensitivity and low frequency have good text discrimination. For those words with a high frequency of occurrence, it is clear that they do not have such good text discrimination as the former.Therefore, to better reflect the weights of feature words in the corpus and better distinguish objectionable text, this paper introduces the TF-IDF algorithm to calculate theobj values of feature words in the training set according to the frequencies of sensitive feature words appearing in the corpus.Algorithm2 shows how to calculate the obj values of feature words. Based on the idea of the TF-IDF algorithm, if the TF of a sensitive feature word appearing in a document is very high but the feature word does not appear in other documents, then the word can distinguish this document from other documents very well. If the number of documents containing sensitive feature words is smaller than the number of other documents, the IDF value is higher, and the ability to differentiate between sensitive feature words is stronger. By calculating the TF-IDF value of each sensitive feature word in the corpus, the degree of the model to distinguish objectionable text for each feature word can be measured. On this basis, the obj values of the features of sensitive words are set in the interval of (0.5, 1).Algorithm 2: Feature word Obj calculation algorithm.
Input: W=w1,w2,⋯,wn, S=s1,s2,⋯,sm, OCwi,wj, C=cobj,c1,c2,⋯,cp.Output: Objw1:fori in 1,2,⋯,ndo2:ifwi∈Sthen3:calculatetf−idfiofwiinC4:swi=tf−idfi/2+0.55:elsepwi=∑j=1,j∈SnswjOCwi,wj/∑j=1,j≠inOCwi,wj6:end if7:end for8: calculateObji:Obji=swiifwiinSpwiifwinotinS9:returnObjwTheobj calculations of general feature words depend on the cooccurrence relationships between the sensitive feature words and general feature words in the given corpus. Based on the OCwi,wj calculated in section A, which is the number of times word wi and word wj appear in the corpus document simultaneously, the sensitivity of the general feature word can be calculated by Formula (4). S represents the list of sensitive feature words, and pwi represents the calculated sensitivity of the ith feature word.
(4)pwi=∑j=1,j∈SnswjOCwi,wj∑j=1,j≠inOCwi,wj.Finally, this paper obtains the sensitivity of each feature word (Obj) through
(5)Obji=swiifwiinS.pwiifwinotinS.


### 4.3. Sensitive Word Feature Dataset

After calculating theImp and Obj of each feature word, the weight of every feature word is obtained by multiplying the two values. The weight of a feature word can be obtained by
(6)Wgi=Impi∗Obji.By sorting the weights of the feature words, the firstT nodes are selected as the feature words for model training.


## 4.1. Calculation of the Imp of a Feature Word

Imp refers to the importance of a feature word in the input corpus. To obtain the Imp of a feature word in the corpus, this paper uses the PageRank algorithm for calculation. Algorithm 1 shows how to calculate this value. Firstly, we need to create an undirected graph. The nodes of the graph are feature words, and the edges of two nodes describe the word cooccurrence relationship between the two feature words. Then, the undirected graph is transformed into a matrix by using the PageRank random browsing model. Finally, we calculate the convergence matrix after the graph matrix reaches a steady state.Algorithm 1: Feature word Imp calculation algorithm.
Input: W=w1,w2,⋯,wn, D=d1,d2,⋯,dm.Output: Impw1: init matrixImpw=1/n,1/n,⋯,1/n2:fori in 1,2,⋯,n−1do3:forj in i+1,i+2,⋯,ndo4:fork in 1,2,⋯,kdo5:ifwi∈dk∧wj∈dkthen6:OCwi,wj ++;7:end if8:end for9:end for10:end for11: Calculated with the following formula:Mi,j=OCwi,wj/∑j=1,j≠inOCwi,wj12:whileImpwp−Impwq>Δdo13:Impwp=dMi,jImpwq+1−dImpwq14:end while15: returnImpw


## 4.2. Calculation of the Obj of a Feature Word

Obj refers to the importance of feature words while judging objectionable text. The obj of feature words is divided into the obj of sensitive feature words and the obj of general feature words.Sensitive feature words have different levels of semantics, especially in Chinese. Different sensitive feature words have different tones, and their occurrence frequencies in the training set are also different. Words with high sensitivity and low frequency have good text discrimination. For those words with a high frequency of occurrence, it is clear that they do not have such good text discrimination as the former.Therefore, to better reflect the weights of feature words in the corpus and better distinguish objectionable text, this paper introduces the TF-IDF algorithm to calculate theobj values of feature words in the training set according to the frequencies of sensitive feature words appearing in the corpus.Algorithm2 shows how to calculate the obj values of feature words. Based on the idea of the TF-IDF algorithm, if the TF of a sensitive feature word appearing in a document is very high but the feature word does not appear in other documents, then the word can distinguish this document from other documents very well. If the number of documents containing sensitive feature words is smaller than the number of other documents, the IDF value is higher, and the ability to differentiate between sensitive feature words is stronger. By calculating the TF-IDF value of each sensitive feature word in the corpus, the degree of the model to distinguish objectionable text for each feature word can be measured. On this basis, the obj values of the features of sensitive words are set in the interval of (0.5, 1).Algorithm 2: Feature word Obj calculation algorithm.
Input: W=w1,w2,⋯,wn, S=s1,s2,⋯,sm, OCwi,wj, C=cobj,c1,c2,⋯,cp.Output: Objw1:fori in 1,2,⋯,ndo2:ifwi∈Sthen3:calculatetf−idfiofwiinC4:swi=tf−idfi/2+0.55:elsepwi=∑j=1,j∈SnswjOCwi,wj/∑j=1,j≠inOCwi,wj6:end if7:end for8: calculateObji:Obji=swiifwiinSpwiifwinotinS9:returnObjwTheobj calculations of general feature words depend on the cooccurrence relationships between the sensitive feature words and general feature words in the given corpus. Based on the OCwi,wj calculated in section A, which is the number of times word wi and word wj appear in the corpus document simultaneously, the sensitivity of the general feature word can be calculated by Formula (4). S represents the list of sensitive feature words, and pwi represents the calculated sensitivity of the ith feature word.
(4)pwi=∑j=1,j∈SnswjOCwi,wj∑j=1,j≠inOCwi,wj.Finally, this paper obtains the sensitivity of each feature word (Obj) through
(5)Obji=swiifwiinS.pwiifwinotinS.


## 4.3. Sensitive Word Feature Dataset

After calculating theImp and Obj of each feature word, the weight of every feature word is obtained by multiplying the two values. The weight of a feature word can be obtained by
(6)Wgi=Impi∗Obji.By sorting the weights of the feature words, the firstT nodes are selected as the feature words for model training.


## 5. Adaptive BTM-Based Topic Model

In this paper, we present an adaptive BTM topic model for quickly and automatically detecting objectionable short text.


### 5.1. Establishment of the Adaptive BTM Topic Model

A BTM does not provide a way to determine the value ofK. Based on the idea regarding the sensitivity of objectionable short text, this section proposes an adaptive modelling method based on a BTM to determine the optimal value of K. This paper designs a standard to measure whether a topic is sensitive and defines it as a sensitive topic criterion (STC). Algorithm 3 shows the process of building the adaptive BTM.First, we need to derive the weight of each biterm. As shown in Formula (7), bitermi is composed of the word pair wp,wq. The weight of bitermi is the product of the weights of words wp and wq. We use bi to represent the weight value of bitermi and wgi to represent the weight value of word wi.
(7)bi=wgp∗wgq.STCVt indicates the sensitivity of topic t, which is calculated by the sensitivity of bitermi and the probability of bitermi under topic t. The calculation is as shown in Formula (8). T represents the number of feature words, and pbi∣zt represents the probability of bitermi under sensitive topic t.
(8)STCVt=∑i=1Tbipbi∣zt.Finally, the calculation process for obtainingSTCK is shown in Formula (9). STCK can reflect the sensitivity of the topic model obtained through BTM training when the number of topics is set as K. If those word group terms, which have high sensitivity levels, also have substantial probabilities when the topic has been given, then the model tends to reflect the sensitivities of the topics very well. Therefore, the peak value of STCK reflects the optimal parameter value K of the BTM that is suitable for the training text corpus, and the value of K is obtained by using
(9)STCK=∑i=1KSTCVi,(10)K=argminkSTCK.Algorithm 3: Adaptive BTM algorithm.
Input: corpus DOutput: K1: Set the maximumK value: K=Kmax.2: Train the BTM model using corpusD; generate biterm−topic distribution, document−biterm distribution, etc.3: CalculateSTCK using Formula (7).4:K= K-1.5: Repeat steps (2)-(5) untilK=2.6: Select theK value that makes STCK reach its peak value as the final result.7:returnK


### 5.2. Objectionable Short Text Filtering

This paper judges an unknown text by calculating its similarity to the adaptive topic model generated above. If the similarity is more significant than a particular value, it can be judged as a black sample. Otherwise, it is determined as a white sample. In the BTM, Formula (11) can be used as a basis for determining whether the input sample is an objectionable text.
(11)pd∣M=∫pθ∣α∏j=1K∑zjpzj∣θpb∣zj,βdθ.The final resultpd∣M represents the probability that the unknown text is generated by the topic model.Whenpd∣M is more significant than a manually set threshold r, this indicates that the sample has a high degree of similarity to the topic model and can be judged as objectionable text.


### 5.3. Example

In order to better understand the proposed BTM-based adaptive objectionable short text filtering framework in this paper, we take a text datasetD containing pornography as an example to illustrate. As the first step, we extract all the feature words in dataset D, filter the words with obvious pornographic meanings as a list of sensitive feature words Wsf, and the rest as a list of general feature words Wgf. We can obtain the biterm list through Wgf and Wsf. In the second step, we can calculate the obj and imp of each feature word by the method proposed in this paper and then calculate the Wg of each word. We can get the feature weight table as shown in Table 2. In the third step, we use the feature weight table to determine the K values of the BTM model and construct aBTMd. Finally, we can use aBTMd to detect whether the unknown text is pornography.Table 2
Feature weight table.
S/NFeature wordWeightSensitive word1Otaku0.048195False2Game0.043909False3Welfare0.038411False4Feature0.034741False5Video0.031397False6Adult0.025781True7Beauty0.019537False8Play0.019114False9Watch0.01832False10Adult movie artifact0.017636True11Broadcast0.017163False12Resource0.017132False13Picture0.013816False14Necessary0.012849False15Veteran playboy0.01241False16HD0.011707False17Film0.011647False18Artifact0.011508False19Player0.011375False20Leisure0.010474False21Enjoy0.010227False…………


## 5.1. Establishment of the Adaptive BTM Topic Model

A BTM does not provide a way to determine the value ofK. Based on the idea regarding the sensitivity of objectionable short text, this section proposes an adaptive modelling method based on a BTM to determine the optimal value of K. This paper designs a standard to measure whether a topic is sensitive and defines it as a sensitive topic criterion (STC). Algorithm 3 shows the process of building the adaptive BTM.First, we need to derive the weight of each biterm. As shown in Formula (7), bitermi is composed of the word pair wp,wq. The weight of bitermi is the product of the weights of words wp and wq. We use bi to represent the weight value of bitermi and wgi to represent the weight value of word wi.
(7)bi=wgp∗wgq.STCVt indicates the sensitivity of topic t, which is calculated by the sensitivity of bitermi and the probability of bitermi under topic t. The calculation is as shown in Formula (8). T represents the number of feature words, and pbi∣zt represents the probability of bitermi under sensitive topic t.
(8)STCVt=∑i=1Tbipbi∣zt.Finally, the calculation process for obtainingSTCK is shown in Formula (9). STCK can reflect the sensitivity of the topic model obtained through BTM training when the number of topics is set as K. If those word group terms, which have high sensitivity levels, also have substantial probabilities when the topic has been given, then the model tends to reflect the sensitivities of the topics very well. Therefore, the peak value of STCK reflects the optimal parameter value K of the BTM that is suitable for the training text corpus, and the value of K is obtained by using
(9)STCK=∑i=1KSTCVi,(10)K=argminkSTCK.Algorithm 3: Adaptive BTM algorithm.
Input: corpus DOutput: K1: Set the maximumK value: K=Kmax.2: Train the BTM model using corpusD; generate biterm−topic distribution, document−biterm distribution, etc.3: CalculateSTCK using Formula (7).4:K= K-1.5: Repeat steps (2)-(5) untilK=2.6: Select theK value that makes STCK reach its peak value as the final result.7:returnK


## 5.2. Objectionable Short Text Filtering

This paper judges an unknown text by calculating its similarity to the adaptive topic model generated above. If the similarity is more significant than a particular value, it can be judged as a black sample. Otherwise, it is determined as a white sample. In the BTM, Formula (11) can be used as a basis for determining whether the input sample is an objectionable text.
(11)pd∣M=∫pθ∣α∏j=1K∑zjpzj∣θpb∣zj,βdθ.The final resultpd∣M represents the probability that the unknown text is generated by the topic model.Whenpd∣M is more significant than a manually set threshold r, this indicates that the sample has a high degree of similarity to the topic model and can be judged as objectionable text.


## 5.3. Example

In order to better understand the proposed BTM-based adaptive objectionable short text filtering framework in this paper, we take a text datasetD containing pornography as an example to illustrate. As the first step, we extract all the feature words in dataset D, filter the words with obvious pornographic meanings as a list of sensitive feature words Wsf, and the rest as a list of general feature words Wgf. We can obtain the biterm list through Wgf and Wsf. In the second step, we can calculate the obj and imp of each feature word by the method proposed in this paper and then calculate the Wg of each word. We can get the feature weight table as shown in Table 2. In the third step, we use the feature weight table to determine the K values of the BTM model and construct aBTMd. Finally, we can use aBTMd to detect whether the unknown text is pornography.Table 2
Feature weight table.
S/NFeature wordWeightSensitive word1Otaku0.048195False2Game0.043909False3Welfare0.038411False4Feature0.034741False5Video0.031397False6Adult0.025781True7Beauty0.019537False8Play0.019114False9Watch0.01832False10Adult movie artifact0.017636True11Broadcast0.017163False12Resource0.017132False13Picture0.013816False14Necessary0.012849False15Veteran playboy0.01241False16HD0.011707False17Film0.011647False18Artifact0.011508False19Player0.011375False20Leisure0.010474False21Enjoy0.010227False…………


## 6. Evaluation

The experiments follow the steps described below. First, we collect application description information on web pages and construct a dataset for modelling and evaluation. Then, feature words are extracted, and the model is trained based on the constructed dataset. The effectiveness of the method proposed in this paper is evaluated through the following experiments.


### 6.1. Dataset Creation

Due to the lack of public objectionable short text datasets for the semantic detection of objectionable content, we must manually create a dataset. The application descriptions with pornographic information are designated as references for creating a dataset. We collect application descriptions from the Internet and select 1200 objectionable application descriptions and 5000 normal application descriptions through keyword filtering and manual checking.We construct a text dataset (DS1, 1200 messages) with objectionable application description information and another text dataset (DS2, 5000 messages) with normal application description information. The dataset is publicly available athttps://github.com/buptnsrc/chinese_objectionable_short_corpus.We split the text dataset DS1 into 10 folds, nine of which are used as the training set, and the remaining data are mixed with the DS2 dataset to generate several new datasets for testing.Finally, we obtain the dataset DS2_DS1_i (i=1,2,⋯,10), as shown in Table 3. Each dataset contains two parts: one part contains 9 folds of DS1 as the training dataset, and the other part contains DS2 and the ith-fold of DS1 as the testing dataset.Table 3
Datasets.
Dataset nameTraining datasetTesting datasetDS2_DS1_1DS_i, i=2,3,4,5,6,7,8,9,10DS_1, DS2DS2_DS1_2DS_i, i=1,3,4,5,6,7,8,9,10DS_2, DS2DS2_DS1_3DS_i, i=1,2,4,5,6,7,8,9,10DS_3, DS2DS2_DS1_4DS_i, i=1,2,3,5,6,7,8,9,10DS_4, DS2DS2_DS1_5DS_i, i=1,2,3,4,6,7,8,9,10DS_5, DS2DS2_DS1_6DS_i, i=1,2,3,4,5,7,8,9,10DS_6, DS2DS2_DS1_7DS_i, i=1,2,3,4,5,6,8,9,10DS_7, DS2DS2_DS1_8DS_i, i=1,2,3,4,5,6,7,9,10DS_8, DS2DS2_DS1_9DS_i, i=1,2,3,4,5,6,7,8,10DS_9, DS2DS2_DS1_10DS_i, i=1,2,3,4,5,6,7,8,9DS_10, DS2


### 6.2. Experimental Settings and Method

#### 6.2.1. Feature Dataset Evaluation Method

In this paper, we build a feature dataset based on word frequencies and word cooccurrence relationships. Then, we build the aBTMd proposed in this paper based on the constructed feature dataset. To verify that the feature dataset constructed in this paper has a good effect on the detection of objectionable short text, we build 5 feature datasets with and without semantic features. We use a keyword-based filtering method to test the objectionable short text detection effect of the model on these 5 feature datasets.The first method is a traditional feature word extraction method that does not consider semantics. Taking DS2_DS1_2 as an example, the construction method is as follows. We select all common words in DS1 and DS2. Then, the word frequencies of the words appearing in DS1 are sorted. We select the words that appear in the top R rankings of DS1 to create a listR_list. R is an adjustable parameter. By setting R=100, 150, and 200, we can obtain the lists R1, R2, and R3, respectively.The second method is based on semantic feature word extraction. The keyword list contains three types of keywords: obvious keywords with objectionable meanings, hidden keywords with objectionable meanings, and logical keywords with objectionable meanings combined with other words. The feature dataset constructed by the feature word extraction method developed in Reference [9] is named Ra, and the feature dataset constructed using the method proposed in this paper to extract feature words is named Rb, which contains sensitive word values and weights.The criteria for objectionable short text judgment with the keyword-based filtering method are defined as follows: we consider a sentence objectionable if the ratio of the number of keywords (T1) in the document to the total number of words (T2) is above a threshold value rd.
(12)r=T1T2>rd.


#### 6.2.2. aBTMd Evaluation Method

To evaluate our self-adaptive algorithm, comparative experiments are performed with the aBTMd and an LDA-based detection model (LDAd) [12]. Based on the feature datasets Ra and Rb, we use BTM version v0.5 (Available from https://github.com/xiaohuiyan/BTM.) to build the adaptive detection model proposed in this paper. We utilize two detection models: aBTMd-Ra and aBTMd-Rb. We also build the LDA-based detection model utilized in Reference [12] on feature datasets Ra and Rb and obtain detection models LDAd-Ra and LDAd-Rb, respectively. Intelligence-based analysis filtering methods, such as an SVM, KNN, and logistic regression algorithms, are not suitable for the detection of objectionable short text, so we do not compare our aBTMd with these approaches.The criteria for objectionable short text judgement with the aBTMd and LDAd refer to Formula (12).


#### 6.2.3. Evaluation Indices

An evaluation index is used to illustrate the ability of the constructed feature dataset and detection model to detect objectionable short text. We use the receiver operating characteristic (ROC) curve and area under the ROC curve (AUC) for evaluation. Regarding the ROC curve, the ordinate represents the detection rate (DR), and the abscissa represents the false alarm rate (FR). They also represent detection precision (true positive rate) and false positive rate, respectively. The AUC refers to the size of the area under the ROC curve in the coordinate system. The larger the AUC value is, the better the detection effect.We conduct a detection test on each dataset in DS2_DS1_i (i=1,2,⋯,10) using different detection models. For the test involving each dataset, we calculate the DR and FR by changing the thresholds rd in Formula (12) and r in Formula (13). And we then record the average value as the performance index of the entire dataset. The process is as follows.For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain five feature datasets, including R1_i (R=100), R2_i (R=150), R3_i (R=200), Ra_i, and Rb_i. Ra_i and Rb_i are sensitive feature datasets containing 200 keywords with weights.During the training phase, we train the detection model to obtain a detectorDji based on the dataset DS2_DS1_i and the feature dataset Rj_i (i=1,2,⋯,10, j=1,2,3,a,b).During the detection phase, by adjusting the thresholdrd_ji_mrd_ji_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each dataset DS2_DS1_i, we can obtain a pair (FRji_m, DRji_m) via Formulas (14) and (15) according to Dji (DS2_DS1_i, rd_ji_m).Then, we can calculate the average (FRj_m, DRj_m) of the detection model Dj(rd_j_m) on the entire dataset with Formulas (16) and (17).
(13)FRji_m=TPji_mTPji_m+FNji_m,(14)DRji_m=FPji_mFPji_m+TNji_m,(15)FRj_m=∑i=1nFRij_mn,(16)DRj_m=∑i=1nDRij_mn.In the above formulas, TPji_m represents the true positive count obtained when detector Dji is used for detection on dataset DS2_DS1_i and feature dataset Rj_i, and the threshold is set to rd_ji_m. Similarly, TNji_m represents the true negative count, FNji_m represents the false negative count, and FPji_m represents the false positive count in the same situation. In this paper, the value of n is 10.


### 6.3. Detection Performance

We use the training dataset in DS2_DS1_i (i=1,2,⋯,10) to generate feature datasets R1, R2, R3, Ra, and Rb. Based on these feature datasets, we build a keyword-based filtering model (Kbf), the aBTMd, and the LDAd, and we use the test dataset in DS2_DS1_i for testing purposes.Our experiments are divided into three parts: verifying the validity of the sensitive feature dataset, verifying the effectiveness of the adaptive BTM, and evaluating the aBTMd at a global scale.


#### 6.3.1. Validation of the Sensitive Feature Dataset

To show that the sensitive feature word extraction method proposed in this paper can extract the feature words in objectionable short text more accurately than other approaches, we use the keyword-based filtering method to construct a detection model (Kbf) on the feature datasets and verify it on the test dataset.We follow the steps in the following to perform our experiment:(i)
For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain five feature datasets, including R1_i (R=100), R2_i (R=150), R3_i (R=200), Ra_i, and Rb_i(ii)
We use a keyword-based filtering method to build the detector Kbf_Rj_i based on the dataset DS2_DS1_i and the feature dataset Rj_i (i=1,2,⋯,10, j=1,2,3,a,b)(iii)
By adjusting the thresholdrd_ji_mrd_ji_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each Kbf_Rj_i, we can obtain a series of (FRji_m, DRji_m) according to Formulas (14) and (15)(iv)
Then, we can refer to Formulas (16) and (17) to calculate the average (FRj_m, DRj_m) according to the detection model Kbf_Rj(rd_j_m) over the entire dataset DS2_DS1_i (i=1,2,⋯,10)(v)
Finally, we can draw the ROC curves of the detection models Kbf_R1, Kbf_R2, Kbf_R3, Kbf_Ra, and Kbf_Rb, as shown in Figure2Figure 2
ROC graphs of the Kbf_Ri detection models.From Figure2, it can be seen that the detection results obtained with different feature datasets vary greatly. By comparing the AUCs of Kbf_R1, Kbf_R2, and Kbf_R3, the Kbf_R3 model has the best detection effect. By comparing the AUCs of Kbf_R3, Kbf_Ra, and Kbf_Rb, the Kbf_Rb model has the best detection effect.As we can see, when the number of selected feature words is increased, the effect of the keyword filtering algorithm is improved. The feature datasetsR1, R2, and R3 are generated according to the word frequencies, and Ra and Rb are generated according to the word frequencies and semantics, so they contain sensitive word weights. We know that Ra and Rb can better preserve corpus features, and the detection models built on them can filter objectionable short text effectively. At the same time, the detection effect of the keyword-based filtering model generated by the feature dataset Rb extracted in this paper is better than that of the model generated by the feature dataset Ra extracted in [9].


#### 6.3.2. The Effectiveness of the Adaptive BTM

For a comparison with the traditional BTM-based detection method, we set the number of topics in the BTM toK=2,3,4,8 to evaluate the impact of this parameter on the detection performance. When constructing the BTM-based detection model, we perform the following operations for K=2,3,4,8 and the adaptive values (aBTMd):
(i)
For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain feature datasets Rb_i(ii)
We use the BTM to build detectors BTMd_Rb_i (K=2), BTMd_Rb_i (K=3), BTMd_Rb_i (K=4), BTMd_Rb_i (K=8), and aBTMd_Rb based on the dataset DS2_DS1_i and feature dataset Rb_i (i=1,2,⋯,10)(iii)
By adjusting the thresholdrd_i_mrd_i_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each detection model, we can obtain a series of (FRi_m, DRi_m)(iv)
Then, we can refer to Formulas (16) and (17) to calculate the average (FR_m, DR_m) according to the detection model BTMd_Rb (K, rd_m) over the entire dataset DS2_DS1_i (i=1,2,⋯,10)(v)
Finally, we can draw the ROC curves of the detection models BTMd_Rb (K=2), BTMd_Rb (K=3), BTMd_Rb (K=4), BTMd_Rb (K=8), and aBTMd_Rb, as shown in Figure 3Figure 3
ROC graphs of the BTMd and aBTMd.It should be noted that theK value (number of topics) selected by the BTM-based adaptive model is 6. We can see that when the K value is closer to 6, the larger the AUC value is, the better the detection effect. Therefore, the K value selected by the aBTMd can more effectively filter objectionable short text.In this paper, the BTM-based adaptive filtering framework generates a weighted sensitive feature dataset based on seed words and the original input dataset and automatically calculates the appropriateK value. This process retains the sensitive word meanings of the original dataset to a certain extent and is completed automatically. Therefore, the aBTMd is applicable to other similar datasets.


#### 6.3.3. Global Evaluation of aBTMd

We experimentally compare the detection effects of the aBTMd and LDAd with respect to objectionable short text. On the basis of experiment B, we use feature datasetsRa and Rb to train the LDA-based topic model [12] to obtain LDAd_Ra and LDAd_Rb, respectively, and we use feature dataset Rb to train the adaptive BTM model to obtain aBTMd_Rb. We use the method in Experiment B to obtain the ROC curves for the three detection models, as shown in Figure 4.Figure 4
ROC graphs of the LDAd and aBTMd.As we can see from Figure4, aBTMb_Rb has the largest AUC value, so its detection effect is the best.The LDA model encounters the data sparsity problem in short documents. The BTM learns the topics by directly modelling the generation of word cooccurrence patterns in the whole corpus. The BTM uses biterms to represent documents instead of words, which are used in the LDA model. The proposed method can solve the data sparsity problem. When the FR falls in the interval [0.1, 0.4], the detection results of the aBTMd are significantly better than those of the LDAd.


### 6.4. Complexity Analysis and Discussion

To further evaluate the performance of the proposed method, we check its time complexity. The experiment is conducted on a personal computer configured with an Intel Core i5 7500 CPU @ 3.4 GHz and 8 GB of memory. We test three models: Kbf, the traditional BTM (K=4) tBTMd, and the aBTMd. The evaluation is based on all datasets DS2_DS1_i (i=1,2,⋯10) and calculates the average elapsed time required for each model. The results are shown in Table 4.Table 4
Performance.
Detection methodFeature selection (ms)Model inference (ms)Test (ms)tBTMd—82387440aBTMd51687394236667Kbf——6123The aBTMd proposed in this paper must find a suitableK value during the model derivation process, so it requires a long running time. The aBTMd consumes more time than the tBTMd. In addition, the feature selection process requires additional calculation time. However, from the perspective of the detection process, because the feature space is relatively small, the detection time is faster than that of the tBTMd. Because model training can be performed offline, the complexity of the model training process is acceptable.


## 6.1. Dataset Creation

Due to the lack of public objectionable short text datasets for the semantic detection of objectionable content, we must manually create a dataset. The application descriptions with pornographic information are designated as references for creating a dataset. We collect application descriptions from the Internet and select 1200 objectionable application descriptions and 5000 normal application descriptions through keyword filtering and manual checking.We construct a text dataset (DS1, 1200 messages) with objectionable application description information and another text dataset (DS2, 5000 messages) with normal application description information. The dataset is publicly available athttps://github.com/buptnsrc/chinese_objectionable_short_corpus.We split the text dataset DS1 into 10 folds, nine of which are used as the training set, and the remaining data are mixed with the DS2 dataset to generate several new datasets for testing.Finally, we obtain the dataset DS2_DS1_i (i=1,2,⋯,10), as shown in Table 3. Each dataset contains two parts: one part contains 9 folds of DS1 as the training dataset, and the other part contains DS2 and the ith-fold of DS1 as the testing dataset.Table 3
Datasets.
Dataset nameTraining datasetTesting datasetDS2_DS1_1DS_i, i=2,3,4,5,6,7,8,9,10DS_1, DS2DS2_DS1_2DS_i, i=1,3,4,5,6,7,8,9,10DS_2, DS2DS2_DS1_3DS_i, i=1,2,4,5,6,7,8,9,10DS_3, DS2DS2_DS1_4DS_i, i=1,2,3,5,6,7,8,9,10DS_4, DS2DS2_DS1_5DS_i, i=1,2,3,4,6,7,8,9,10DS_5, DS2DS2_DS1_6DS_i, i=1,2,3,4,5,7,8,9,10DS_6, DS2DS2_DS1_7DS_i, i=1,2,3,4,5,6,8,9,10DS_7, DS2DS2_DS1_8DS_i, i=1,2,3,4,5,6,7,9,10DS_8, DS2DS2_DS1_9DS_i, i=1,2,3,4,5,6,7,8,10DS_9, DS2DS2_DS1_10DS_i, i=1,2,3,4,5,6,7,8,9DS_10, DS2


## 6.2. Experimental Settings and Method

### 6.2.1. Feature Dataset Evaluation Method

In this paper, we build a feature dataset based on word frequencies and word cooccurrence relationships. Then, we build the aBTMd proposed in this paper based on the constructed feature dataset. To verify that the feature dataset constructed in this paper has a good effect on the detection of objectionable short text, we build 5 feature datasets with and without semantic features. We use a keyword-based filtering method to test the objectionable short text detection effect of the model on these 5 feature datasets.The first method is a traditional feature word extraction method that does not consider semantics. Taking DS2_DS1_2 as an example, the construction method is as follows. We select all common words in DS1 and DS2. Then, the word frequencies of the words appearing in DS1 are sorted. We select the words that appear in the top R rankings of DS1 to create a listR_list. R is an adjustable parameter. By setting R=100, 150, and 200, we can obtain the lists R1, R2, and R3, respectively.The second method is based on semantic feature word extraction. The keyword list contains three types of keywords: obvious keywords with objectionable meanings, hidden keywords with objectionable meanings, and logical keywords with objectionable meanings combined with other words. The feature dataset constructed by the feature word extraction method developed in Reference [9] is named Ra, and the feature dataset constructed using the method proposed in this paper to extract feature words is named Rb, which contains sensitive word values and weights.The criteria for objectionable short text judgment with the keyword-based filtering method are defined as follows: we consider a sentence objectionable if the ratio of the number of keywords (T1) in the document to the total number of words (T2) is above a threshold value rd.
(12)r=T1T2>rd.


### 6.2.2. aBTMd Evaluation Method

To evaluate our self-adaptive algorithm, comparative experiments are performed with the aBTMd and an LDA-based detection model (LDAd) [12]. Based on the feature datasets Ra and Rb, we use BTM version v0.5 (Available from https://github.com/xiaohuiyan/BTM.) to build the adaptive detection model proposed in this paper. We utilize two detection models: aBTMd-Ra and aBTMd-Rb. We also build the LDA-based detection model utilized in Reference [12] on feature datasets Ra and Rb and obtain detection models LDAd-Ra and LDAd-Rb, respectively. Intelligence-based analysis filtering methods, such as an SVM, KNN, and logistic regression algorithms, are not suitable for the detection of objectionable short text, so we do not compare our aBTMd with these approaches.The criteria for objectionable short text judgement with the aBTMd and LDAd refer to Formula (12).


### 6.2.3. Evaluation Indices

An evaluation index is used to illustrate the ability of the constructed feature dataset and detection model to detect objectionable short text. We use the receiver operating characteristic (ROC) curve and area under the ROC curve (AUC) for evaluation. Regarding the ROC curve, the ordinate represents the detection rate (DR), and the abscissa represents the false alarm rate (FR). They also represent detection precision (true positive rate) and false positive rate, respectively. The AUC refers to the size of the area under the ROC curve in the coordinate system. The larger the AUC value is, the better the detection effect.We conduct a detection test on each dataset in DS2_DS1_i (i=1,2,⋯,10) using different detection models. For the test involving each dataset, we calculate the DR and FR by changing the thresholds rd in Formula (12) and r in Formula (13). And we then record the average value as the performance index of the entire dataset. The process is as follows.For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain five feature datasets, including R1_i (R=100), R2_i (R=150), R3_i (R=200), Ra_i, and Rb_i. Ra_i and Rb_i are sensitive feature datasets containing 200 keywords with weights.During the training phase, we train the detection model to obtain a detectorDji based on the dataset DS2_DS1_i and the feature dataset Rj_i (i=1,2,⋯,10, j=1,2,3,a,b).During the detection phase, by adjusting the thresholdrd_ji_mrd_ji_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each dataset DS2_DS1_i, we can obtain a pair (FRji_m, DRji_m) via Formulas (14) and (15) according to Dji (DS2_DS1_i, rd_ji_m).Then, we can calculate the average (FRj_m, DRj_m) of the detection model Dj(rd_j_m) on the entire dataset with Formulas (16) and (17).
(13)FRji_m=TPji_mTPji_m+FNji_m,(14)DRji_m=FPji_mFPji_m+TNji_m,(15)FRj_m=∑i=1nFRij_mn,(16)DRj_m=∑i=1nDRij_mn.In the above formulas, TPji_m represents the true positive count obtained when detector Dji is used for detection on dataset DS2_DS1_i and feature dataset Rj_i, and the threshold is set to rd_ji_m. Similarly, TNji_m represents the true negative count, FNji_m represents the false negative count, and FPji_m represents the false positive count in the same situation. In this paper, the value of n is 10.


## 6.2.1. Feature Dataset Evaluation Method

In this paper, we build a feature dataset based on word frequencies and word cooccurrence relationships. Then, we build the aBTMd proposed in this paper based on the constructed feature dataset. To verify that the feature dataset constructed in this paper has a good effect on the detection of objectionable short text, we build 5 feature datasets with and without semantic features. We use a keyword-based filtering method to test the objectionable short text detection effect of the model on these 5 feature datasets.The first method is a traditional feature word extraction method that does not consider semantics. Taking DS2_DS1_2 as an example, the construction method is as follows. We select all common words in DS1 and DS2. Then, the word frequencies of the words appearing in DS1 are sorted. We select the words that appear in the top R rankings of DS1 to create a listR_list. R is an adjustable parameter. By setting R=100, 150, and 200, we can obtain the lists R1, R2, and R3, respectively.The second method is based on semantic feature word extraction. The keyword list contains three types of keywords: obvious keywords with objectionable meanings, hidden keywords with objectionable meanings, and logical keywords with objectionable meanings combined with other words. The feature dataset constructed by the feature word extraction method developed in Reference [9] is named Ra, and the feature dataset constructed using the method proposed in this paper to extract feature words is named Rb, which contains sensitive word values and weights.The criteria for objectionable short text judgment with the keyword-based filtering method are defined as follows: we consider a sentence objectionable if the ratio of the number of keywords (T1) in the document to the total number of words (T2) is above a threshold value rd.
(12)r=T1T2>rd.


## 6.2.2. aBTMd Evaluation Method

To evaluate our self-adaptive algorithm, comparative experiments are performed with the aBTMd and an LDA-based detection model (LDAd) [12]. Based on the feature datasets Ra and Rb, we use BTM version v0.5 (Available from https://github.com/xiaohuiyan/BTM.) to build the adaptive detection model proposed in this paper. We utilize two detection models: aBTMd-Ra and aBTMd-Rb. We also build the LDA-based detection model utilized in Reference [12] on feature datasets Ra and Rb and obtain detection models LDAd-Ra and LDAd-Rb, respectively. Intelligence-based analysis filtering methods, such as an SVM, KNN, and logistic regression algorithms, are not suitable for the detection of objectionable short text, so we do not compare our aBTMd with these approaches.The criteria for objectionable short text judgement with the aBTMd and LDAd refer to Formula (12).


## 6.2.3. Evaluation Indices

An evaluation index is used to illustrate the ability of the constructed feature dataset and detection model to detect objectionable short text. We use the receiver operating characteristic (ROC) curve and area under the ROC curve (AUC) for evaluation. Regarding the ROC curve, the ordinate represents the detection rate (DR), and the abscissa represents the false alarm rate (FR). They also represent detection precision (true positive rate) and false positive rate, respectively. The AUC refers to the size of the area under the ROC curve in the coordinate system. The larger the AUC value is, the better the detection effect.We conduct a detection test on each dataset in DS2_DS1_i (i=1,2,⋯,10) using different detection models. For the test involving each dataset, we calculate the DR and FR by changing the thresholds rd in Formula (12) and r in Formula (13). And we then record the average value as the performance index of the entire dataset. The process is as follows.For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain five feature datasets, including R1_i (R=100), R2_i (R=150), R3_i (R=200), Ra_i, and Rb_i. Ra_i and Rb_i are sensitive feature datasets containing 200 keywords with weights.During the training phase, we train the detection model to obtain a detectorDji based on the dataset DS2_DS1_i and the feature dataset Rj_i (i=1,2,⋯,10, j=1,2,3,a,b).During the detection phase, by adjusting the thresholdrd_ji_mrd_ji_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each dataset DS2_DS1_i, we can obtain a pair (FRji_m, DRji_m) via Formulas (14) and (15) according to Dji (DS2_DS1_i, rd_ji_m).Then, we can calculate the average (FRj_m, DRj_m) of the detection model Dj(rd_j_m) on the entire dataset with Formulas (16) and (17).
(13)FRji_m=TPji_mTPji_m+FNji_m,(14)DRji_m=FPji_mFPji_m+TNji_m,(15)FRj_m=∑i=1nFRij_mn,(16)DRj_m=∑i=1nDRij_mn.In the above formulas, TPji_m represents the true positive count obtained when detector Dji is used for detection on dataset DS2_DS1_i and feature dataset Rj_i, and the threshold is set to rd_ji_m. Similarly, TNji_m represents the true negative count, FNji_m represents the false negative count, and FPji_m represents the false positive count in the same situation. In this paper, the value of n is 10.


## 6.3. Detection Performance

We use the training dataset in DS2_DS1_i (i=1,2,⋯,10) to generate feature datasets R1, R2, R3, Ra, and Rb. Based on these feature datasets, we build a keyword-based filtering model (Kbf), the aBTMd, and the LDAd, and we use the test dataset in DS2_DS1_i for testing purposes.Our experiments are divided into three parts: verifying the validity of the sensitive feature dataset, verifying the effectiveness of the adaptive BTM, and evaluating the aBTMd at a global scale.


### 6.3.1. Validation of the Sensitive Feature Dataset

To show that the sensitive feature word extraction method proposed in this paper can extract the feature words in objectionable short text more accurately than other approaches, we use the keyword-based filtering method to construct a detection model (Kbf) on the feature datasets and verify it on the test dataset.We follow the steps in the following to perform our experiment:(i)
For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain five feature datasets, including R1_i (R=100), R2_i (R=150), R3_i (R=200), Ra_i, and Rb_i(ii)
We use a keyword-based filtering method to build the detector Kbf_Rj_i based on the dataset DS2_DS1_i and the feature dataset Rj_i (i=1,2,⋯,10, j=1,2,3,a,b)(iii)
By adjusting the thresholdrd_ji_mrd_ji_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each Kbf_Rj_i, we can obtain a series of (FRji_m, DRji_m) according to Formulas (14) and (15)(iv)
Then, we can refer to Formulas (16) and (17) to calculate the average (FRj_m, DRj_m) according to the detection model Kbf_Rj(rd_j_m) over the entire dataset DS2_DS1_i (i=1,2,⋯,10)(v)
Finally, we can draw the ROC curves of the detection models Kbf_R1, Kbf_R2, Kbf_R3, Kbf_Ra, and Kbf_Rb, as shown in Figure2Figure 2
ROC graphs of the Kbf_Ri detection models.From Figure2, it can be seen that the detection results obtained with different feature datasets vary greatly. By comparing the AUCs of Kbf_R1, Kbf_R2, and Kbf_R3, the Kbf_R3 model has the best detection effect. By comparing the AUCs of Kbf_R3, Kbf_Ra, and Kbf_Rb, the Kbf_Rb model has the best detection effect.As we can see, when the number of selected feature words is increased, the effect of the keyword filtering algorithm is improved. The feature datasetsR1, R2, and R3 are generated according to the word frequencies, and Ra and Rb are generated according to the word frequencies and semantics, so they contain sensitive word weights. We know that Ra and Rb can better preserve corpus features, and the detection models built on them can filter objectionable short text effectively. At the same time, the detection effect of the keyword-based filtering model generated by the feature dataset Rb extracted in this paper is better than that of the model generated by the feature dataset Ra extracted in [9].


### 6.3.2. The Effectiveness of the Adaptive BTM

For a comparison with the traditional BTM-based detection method, we set the number of topics in the BTM toK=2,3,4,8 to evaluate the impact of this parameter on the detection performance. When constructing the BTM-based detection model, we perform the following operations for K=2,3,4,8 and the adaptive values (aBTMd):
(i)
For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain feature datasets Rb_i(ii)
We use the BTM to build detectors BTMd_Rb_i (K=2), BTMd_Rb_i (K=3), BTMd_Rb_i (K=4), BTMd_Rb_i (K=8), and aBTMd_Rb based on the dataset DS2_DS1_i and feature dataset Rb_i (i=1,2,⋯,10)(iii)
By adjusting the thresholdrd_i_mrd_i_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each detection model, we can obtain a series of (FRi_m, DRi_m)(iv)
Then, we can refer to Formulas (16) and (17) to calculate the average (FR_m, DR_m) according to the detection model BTMd_Rb (K, rd_m) over the entire dataset DS2_DS1_i (i=1,2,⋯,10)(v)
Finally, we can draw the ROC curves of the detection models BTMd_Rb (K=2), BTMd_Rb (K=3), BTMd_Rb (K=4), BTMd_Rb (K=8), and aBTMd_Rb, as shown in Figure 3Figure 3
ROC graphs of the BTMd and aBTMd.It should be noted that theK value (number of topics) selected by the BTM-based adaptive model is 6. We can see that when the K value is closer to 6, the larger the AUC value is, the better the detection effect. Therefore, the K value selected by the aBTMd can more effectively filter objectionable short text.In this paper, the BTM-based adaptive filtering framework generates a weighted sensitive feature dataset based on seed words and the original input dataset and automatically calculates the appropriateK value. This process retains the sensitive word meanings of the original dataset to a certain extent and is completed automatically. Therefore, the aBTMd is applicable to other similar datasets.


### 6.3.3. Global Evaluation of aBTMd

We experimentally compare the detection effects of the aBTMd and LDAd with respect to objectionable short text. On the basis of experiment B, we use feature datasetsRa and Rb to train the LDA-based topic model [12] to obtain LDAd_Ra and LDAd_Rb, respectively, and we use feature dataset Rb to train the adaptive BTM model to obtain aBTMd_Rb. We use the method in Experiment B to obtain the ROC curves for the three detection models, as shown in Figure 4.Figure 4
ROC graphs of the LDAd and aBTMd.As we can see from Figure4, aBTMb_Rb has the largest AUC value, so its detection effect is the best.The LDA model encounters the data sparsity problem in short documents. The BTM learns the topics by directly modelling the generation of word cooccurrence patterns in the whole corpus. The BTM uses biterms to represent documents instead of words, which are used in the LDA model. The proposed method can solve the data sparsity problem. When the FR falls in the interval [0.1, 0.4], the detection results of the aBTMd are significantly better than those of the LDAd.


## 6.3.1. Validation of the Sensitive Feature Dataset

To show that the sensitive feature word extraction method proposed in this paper can extract the feature words in objectionable short text more accurately than other approaches, we use the keyword-based filtering method to construct a detection model (Kbf) on the feature datasets and verify it on the test dataset.We follow the steps in the following to perform our experiment:(i)
For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain five feature datasets, including R1_i (R=100), R2_i (R=150), R3_i (R=200), Ra_i, and Rb_i(ii)
We use a keyword-based filtering method to build the detector Kbf_Rj_i based on the dataset DS2_DS1_i and the feature dataset Rj_i (i=1,2,⋯,10, j=1,2,3,a,b)(iii)
By adjusting the thresholdrd_ji_mrd_ji_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each Kbf_Rj_i, we can obtain a series of (FRji_m, DRji_m) according to Formulas (14) and (15)(iv)
Then, we can refer to Formulas (16) and (17) to calculate the average (FRj_m, DRj_m) according to the detection model Kbf_Rj(rd_j_m) over the entire dataset DS2_DS1_i (i=1,2,⋯,10)(v)
Finally, we can draw the ROC curves of the detection models Kbf_R1, Kbf_R2, Kbf_R3, Kbf_Ra, and Kbf_Rb, as shown in Figure2Figure 2
ROC graphs of the Kbf_Ri detection models.From Figure2, it can be seen that the detection results obtained with different feature datasets vary greatly. By comparing the AUCs of Kbf_R1, Kbf_R2, and Kbf_R3, the Kbf_R3 model has the best detection effect. By comparing the AUCs of Kbf_R3, Kbf_Ra, and Kbf_Rb, the Kbf_Rb model has the best detection effect.As we can see, when the number of selected feature words is increased, the effect of the keyword filtering algorithm is improved. The feature datasetsR1, R2, and R3 are generated according to the word frequencies, and Ra and Rb are generated according to the word frequencies and semantics, so they contain sensitive word weights. We know that Ra and Rb can better preserve corpus features, and the detection models built on them can filter objectionable short text effectively. At the same time, the detection effect of the keyword-based filtering model generated by the feature dataset Rb extracted in this paper is better than that of the model generated by the feature dataset Ra extracted in [9].


## 6.3.2. The Effectiveness of the Adaptive BTM

For a comparison with the traditional BTM-based detection method, we set the number of topics in the BTM toK=2,3,4,8 to evaluate the impact of this parameter on the detection performance. When constructing the BTM-based detection model, we perform the following operations for K=2,3,4,8 and the adaptive values (aBTMd):
(i)
For each dataset in DS2_DS1_i (i=1,2,⋯,10), we can obtain feature datasets Rb_i(ii)
We use the BTM to build detectors BTMd_Rb_i (K=2), BTMd_Rb_i (K=3), BTMd_Rb_i (K=4), BTMd_Rb_i (K=8), and aBTMd_Rb based on the dataset DS2_DS1_i and feature dataset Rb_i (i=1,2,⋯,10)(iii)
By adjusting the thresholdrd_i_mrd_i_m=0.1,0.2,0.3⋯,1∣m=1,2,3⋯,10, for each detection model, we can obtain a series of (FRi_m, DRi_m)(iv)
Then, we can refer to Formulas (16) and (17) to calculate the average (FR_m, DR_m) according to the detection model BTMd_Rb (K, rd_m) over the entire dataset DS2_DS1_i (i=1,2,⋯,10)(v)
Finally, we can draw the ROC curves of the detection models BTMd_Rb (K=2), BTMd_Rb (K=3), BTMd_Rb (K=4), BTMd_Rb (K=8), and aBTMd_Rb, as shown in Figure 3Figure 3
ROC graphs of the BTMd and aBTMd.It should be noted that theK value (number of topics) selected by the BTM-based adaptive model is 6. We can see that when the K value is closer to 6, the larger the AUC value is, the better the detection effect. Therefore, the K value selected by the aBTMd can more effectively filter objectionable short text.In this paper, the BTM-based adaptive filtering framework generates a weighted sensitive feature dataset based on seed words and the original input dataset and automatically calculates the appropriateK value. This process retains the sensitive word meanings of the original dataset to a certain extent and is completed automatically. Therefore, the aBTMd is applicable to other similar datasets.


## 6.3.3. Global Evaluation of aBTMd

We experimentally compare the detection effects of the aBTMd and LDAd with respect to objectionable short text. On the basis of experiment B, we use feature datasetsRa and Rb to train the LDA-based topic model [12] to obtain LDAd_Ra and LDAd_Rb, respectively, and we use feature dataset Rb to train the adaptive BTM model to obtain aBTMd_Rb. We use the method in Experiment B to obtain the ROC curves for the three detection models, as shown in Figure 4.Figure 4
ROC graphs of the LDAd and aBTMd.As we can see from Figure4, aBTMb_Rb has the largest AUC value, so its detection effect is the best.The LDA model encounters the data sparsity problem in short documents. The BTM learns the topics by directly modelling the generation of word cooccurrence patterns in the whole corpus. The BTM uses biterms to represent documents instead of words, which are used in the LDA model. The proposed method can solve the data sparsity problem. When the FR falls in the interval [0.1, 0.4], the detection results of the aBTMd are significantly better than those of the LDAd.


## 6.4. Complexity Analysis and Discussion

To further evaluate the performance of the proposed method, we check its time complexity. The experiment is conducted on a personal computer configured with an Intel Core i5 7500 CPU @ 3.4 GHz and 8 GB of memory. We test three models: Kbf, the traditional BTM (K=4) tBTMd, and the aBTMd. The evaluation is based on all datasets DS2_DS1_i (i=1,2,⋯10) and calculates the average elapsed time required for each model. The results are shown in Table 4.Table 4
Performance.
Detection methodFeature selection (ms)Model inference (ms)Test (ms)tBTMd—82387440aBTMd51687394236667Kbf——6123The aBTMd proposed in this paper must find a suitableK value during the model derivation process, so it requires a long running time. The aBTMd consumes more time than the tBTMd. In addition, the feature selection process requires additional calculation time. However, from the perspective of the detection process, because the feature space is relatively small, the detection time is faster than that of the tBTMd. Because model training can be performed offline, the complexity of the model training process is acceptable.


## 7. Conclusions

In this paper, we provide an adaptive method for calculating the number of topics in a BTM model without setting it in advance for different datasets. By introducing the sensitivities of feature words, the importance levels of words are quantified. Then, we develop an aBTMd that can effectively detect objectionable short text with a high detection rate and a low false detection rate. How to include synonyms in the feature dataset and combine the dataset with the topic model will be the focuses of future work. The dataset used in this paper can be obtained throughhttps://github.com/buptnsrc/chinese_objectionable_short_corpus.



---

*Source: 6668344-2022-01-22.xml*