A multi-feature fusion offensive text detection method and device

This method for detecting offensive text by multi-feature fusion utilizes ALBERT and Wobert pre-trained models combined with an offensive lexicon to perform word fusion and contextual feature extraction. This solves the problem of insufficient multi-dimensional feature fusion in existing technologies and achieves efficient recognition and detection of offensive text.

CN118069785BActive Publication Date: 2025-12-16ZHENGZHOU UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410210265.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-26
Publication Date
2025-12-16
Estimated Expiration
2044-02-26

AI Technical Summary

Technical Problem

Existing technologies lack multi-dimensional feature fusion in offensive text detection, ignore the semantic relationship between character vectors and word vectors, and lack relevant knowledge in the offensive domain, resulting in poor detection performance, especially in the case of offensive texts with veiled expressions.

Method used

The Wobert model is enhanced by using an ALBERT pre-trained model to obtain character vector features and an offensive lexicon is introduced in conjunction with SoftLexicon. The Wobert model is enhanced by word-to-word fusion vectors and attention mechanisms, and the BILSTM model is used for context feature extraction. Graph convolutional networks and interpretation expert systems are introduced to enhance syntactic dependency relations, and the lexicon is dynamically updated to improve the applicability of the model.

Benefits of technology

It improves the accuracy and robustness of offensive text detection, better identifies offensive texts with veiled expressions, is applicable to professional fields, solves the problem of insufficient semantic extraction, and improves detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118069785B_ABST
    Figure CN118069785B_ABST
Patent Text Reader

Abstract

The application provides a multi-feature fusion offensive text detection method and device, including the following steps: processing the to-be-detected text information through an ALBERT pre-training model to obtain word vector features; introducing the word information in an offensive word library into a Wobert pre-training model through a SoftLexicon to obtain an improved Wobert pre-training model, processing the to-be-detected text information through the improved Wobert pre-training model to obtain enhanced word vector features; splicing and fusing the word vector features and the enhanced word vector features to obtain word fusion vectors, and distributing weights to the word fusion vectors by using an attention mechanism; sending the word fusion vectors after weight distribution to a BILSTM model for context feature extraction, sending the extracted context features to a full connection layer for comprehensive processing, and finally obtaining the offensive probability of the to-be-detected text information through an output layer classification.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a text detection method, in particular to a multi-feature fusion offensive text detection method and device. BACKGROUND

[0002] In order to purify the network environment, it is necessary to detect offensive text and other bad information. Offensive text detection is a typical binary classification problem, and the mainstream text classification model is usually used to realize it. The traditional text classification method based on machine learning mainly classifies the text through a machine learning model and algorithm, but these methods have the disadvantage that the learned text features are relatively single, and the robustness and robustness of the model are low.

[0003] In recent years, with the development of deep learning technology, more and more researchers use deep learning methods to classify text, and gradually become the mainstream method for solving offensive text and other bad text detection.

[0004] K Machova et al. conducted a study on the detection of hate tweets, and focused on classifying tweets into three categories of hatred, offensiveness and neutrality according to the characteristics of the data set. By adjusting the number of hidden layer neurons of the LSTM model and using the optimizer SGDM, the best classification effect is achieved. Xu Yang et al. proposed a discrimination text detection model that combines bidirectional gated recurrent unit (BIGRU) and multivariate convolutional neural network. Through this model, multi-dimensional features of discrimination text are extracted to improve the classification effect.

[0005] With the development of pre-training models such as Bert, Tang Yingjie et al. proposed a deep neural network model based on pre-training model (Roberta) fusion deep feature word vector, which achieved good results in Chinese text classification. Zhang Xiaoyan et al. proposed a model based on text sentiment value weighted fusion word vector representation-SVW-BERT model. First, the text vector is represented based on the word and word level vector fusion to maximize the semantic representation, and the influence of adverbs, negative words, exclamatory sentences and interrogative sentences on the text sentiment is considered. The sentiment value of the text is calculated through the weight value to construct a Chinese short text sentiment analysis model of emotion value weighted fusion word vector.

[0006] Jia Hongjian et al. proposed a new Chinese short text classification model based on external knowledge attention. By multiplying the word and character features with a trainable matrix, a two-level alignment feature matrix is generated to capture deep semantic information to solve the problem of insufficient context information; and knowledge is retrieved from an external knowledge base to enhance the semantic representation of short text, while introducing two attention mechanisms of concept attention for short text and concept attention for concept set.

[0007] Although the above research results prove that sufficient information can be obtained after feature extraction and fusion of the text, they do not well integrate multi-dimensional features, ignore the semantic correlation between word vectors and word vectors, and lack relevant knowledge of offensive fields, ignoring the appearance of offensive words. If the model cannot correctly segment offensive words, it will affect subsequent processing, such as feature extraction, which will affect the effect of the entire offensive text detection model.

[0008] In practice, some offensive text expressions are more implicit, and the literal features are not obvious. Some people may use euphemistic or alternative language to express offensive and biased views, and the extraction of text context semantics is required to be higher.

[0009] In order to solve the above problems, people have been seeking an ideal technical solution. SUMMARY

[0010] The purpose of the present application is to overcome the shortcomings of the prior art and provide a multi-feature fusion offensive text detection method and device.

[0011] In order to achieve the above purpose, the technical scheme adopted by the present application is as follows: a multi-feature fusion offensive text detection method, comprising the following steps:

[0012] The ALBERT pre-training model is used to process the text information to be detected to obtain word vector features;

[0013] The word information in the offensive word library is introduced into the Wobert pre-training model through SoftLexicon to obtain an improved Wobert pre-training model, and the text information to be detected is processed through the improved Wobert pre-training model to obtain enhanced word vector features;

[0014] The word vector features and the enhanced word vector features are spliced and fused to obtain word fusion vectors, and the attention mechanism is used to allocate weights to the word fusion vectors;

[0015] The word fusion vectors after weight allocation are sent to the BILSTM model for context feature extraction, and the extracted context features are sent to the full connection layer for comprehensive processing, and finally the offensive probability of the text information to be detected is obtained through the output layer classification.

[0016] In a possible embodiment, the specific steps of processing the text information to be detected by the improved Wobert pre-training model to obtain enhanced word vector features include:

[0017] After the Wobert pre-training model is used for word segmentation, the initial word vector is obtained by performing vectorization processing on the word segmentation result; meanwhile, each word segmentation result is searched and matched in the offensive word library to obtain four word sets related to the word segmentation result; after obtaining the four word sets of each word segmentation result, each word set is compressed into a fixed-dimensional vector, and the vectors of the four word sets are combined into a fixed-dimensional dictionary vector;

[0018] Each dictionary vector is added to the initial word vector formed by the corresponding word segmentation result to obtain an enhanced word vector feature.

[0019] In a possible embodiment, after the enhanced word vector feature is obtained, a text co-occurrence graph and a syntax dependency graph are constructed based on the co-occurrence relationship and the syntax dependency relationship between the enhanced word vector features, and the adjacent word relationship and the syntax dependency relationship of the text co-occurrence graph and the syntax dependency graph are learned based on a graph convolution network to obtain corresponding word embedding vectors, and the word embedding vectors are fused by splicing to form a fused embedding vector;

[0020] The fused embedding vector and the word fusion vector after weight allocation are spliced and fused to obtain a multi-feature vector, and the multi-feature vector is input into a BILSTM model for context feature extraction.

[0021] In a possible embodiment, when the syntax dependency relationship of the syntax dependency graph is learned based on the graph convolution network, the syntax knowledge is processed by using the explanation expert system embedded expert system knowledge base.

[0022] In a possible embodiment, new words are added to the offensive word library and the frequency information of the words is updated by using reinforcement learning.

[0023] The application also provides a multi-feature fusion offensive text detection device, which comprises an input layer, a word vector feature acquisition module, an offensive word library, a word vector feature acquisition module, a feature fusion layer, an attention mechanism layer, a BiLSTM layer, a full connection layer and an output layer.

[0024] The input layer is used to acquire text information to be detected.

[0025] The word vector feature acquisition module is used to acquire an enhanced word vector feature by processing the text information to be detected through an improved Wobert pre-training model, wherein the improved Wobert pre-training model introduces the word information in the offensive word library through SoftLexicon in the word vector representation layer.

[0026] The feature fusion layer is used to splice and fuse the word vector feature and the enhanced word vector feature to obtain a word fusion vector.

[0027] The attention mechanism layer is used to allocate weights to the word fusion vector by using an attention mechanism.

[0028] The BiLSTM layer is used for context feature extraction.

[0029] The full connection layer is used for comprehensive processing of the extracted context features.

[0030] The output layer is used for classifying the output of the full connection layer to obtain the offensiveness probability of the to-be-detected text information.

[0031] The application also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the foregoing method when executing the computer program.

[0032] The application also provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the foregoing method when executed by a processor.

[0033] The application also provides a computer program product comprising a computer program, and the computer program implements the steps of the foregoing method when executed by a processor.

[0034] The application has outstanding substantial features and significant progress compared with the prior art, and specifically,

[0035] 1. The application uses a multi-feature fusion offensive text detection model to perform offensive text classification. The Wobert pre-training model is improved, and the SoftLexicon is used to introduce an offensive word library. The word vector features obtained by the Wobert pre-training model are fused with the word information in the offensive word library, solving the problem that the Wobert pre-training model cannot accurately tokenize due to the lack of offensive professional vocabulary. Not only the boundary information of the word is used, but also the semantic information of the word is used. The knowledge in the offensive field is enhanced, so that the offensive text detection model is more targeted, and the detection ability of the model is improved. At the same time, based on the fusion of words, words and external words, the features of offensive text are more comprehensively represented, solving the problem of insufficient semantic extraction of offensive text, and improving the effect of offensive text detection. The word-level representation is more fine-grained, and the word-level information fully fuses the context information of the word itself and its left and right adjacent words, which can better express the semantic information of the word and the meaning of the sentence. The external word reflects the knowledge in the offensive field, such as the semantic information of the main components in the field knowledge.

[0036] 2. The application dynamically updates the offensive word library through the reward mechanism of reinforcement learning to solve the problem that the model cannot correctly recognize offensive new words in the case of unregistered words, so that the model can correctly tokenize.

[0037] 3. The present application uses a multi-feature fusion offensive text detection model for offensive text classification. By fusing word-level text information, word-level text information, and text syntax information, the features of offensive text are more comprehensively represented, the problem of insufficient semantic extraction of offensive text is solved, and the effect of offensive text detection is improved. Among them, the single word co-occurrence method and the syntax dependency relationship method are used to determine the connection between word nodes, which further effectively enriches the structure and semantics in the feature vector and improves the embedding effect.

[0038] 4. The present application makes the model more suitable for professional fields and correctly processes noisy syntax knowledge. In the syntax analysis of the text, there are cases of inaccurate syntax analysis, especially in non-general fields such as offensive fields. The present application uses an explanation expert system to embed an expert system knowledge base to specifically solve the problem of inaccurate syntax knowledge in offensive fields, thereby improving the model accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0039] Figure 1 is a principle block diagram of embodiment 1 of the present application.

[0040] Figure 2 is a principle block diagram of embodiment 2 of the present application. DETAILED DESCRIPTION

[0041] SoftLexicon is a simple and effective method of incorporating lexical information into character representation. This method avoids designing complex sequence modeling structures, and for any NER model, it only needs to slightly adjust the character representation layer to introduce dictionary information.

[0042] Out-of-vocabulary words are words that are not included in the existing word list, or words that have never appeared in the training corpus. Out-of-vocabulary words can be roughly divided into the following four types: newly emerging general vocabulary, such as the new words frequently seen in network language; proper nouns, such as names, place names, and organization names; professional terms and research field names; and other special terms, including other newly generated product names, movies, books, etc.

[0043] The explanation expert system can obtain explanations from incomplete information and make certain assumptions about the data, thereby identifying different context features and syntax knowledge in a specific context.

[0044] The technical solutions of the present application will be further described in detail through specific embodiments.

[0045] Embodiment 1

[0046] The present embodiment provides a multi-feature fusion offensive text detection method, as shown in Figure 1 The method comprises the following steps:

[0047] Step 11, processing the text information to be detected by the ALBERT pre-training model to obtain word vector features.

[0048] In specific implementation, the basic version of the ALBERT model is used to process the text information to be detected, which has 12 layers of Transformer and a hidden layer size of 384. Assuming that the offensive text set is S ={ s 1, s 2,… s N}, the offensive text s j ∈ S { j =1, 2, 3, …, N} is vectorized to obtain a two-dimensional matrix char sj .

[0049] Since it is text, the length of the text after vectorization is set to 128 in the data preprocessing stage, so the number of tokens after segmentation is 128, and the two-dimensional matrix char sj of has 128 rows and 384 columns. L

[0050] Step 12, introducing the word information in the offensive word library into the Wobert pre-training model through SoftLexicon to obtain an improved Wobert pre-training model, and processing the text information to be detected through the improved Wobert pre-training model to obtain enhanced word vector features.

[0051] Specifically, the specific steps of processing the text information to be detected through the improved Wobert pre-training model to obtain enhanced word vector features include:

[0052] After the Wobert pre-training model is segmented, the segmentation result is vectorized to obtain an initial word vector; referring to the ALBERT model in step 11, after the Wobert pre-training model is used to train the word vector for the offensive text, the obtained initial word vector is a two-dimensional matrix word sj , which has 128 rows and 768 columns. L

[0053] ​​While performing vectorization processing, each segmented result is searched and matched in the offensive word library to obtain four word sets {B, M, E, S} related to the segmented result; after obtaining the four word sets of each segmented result, each word set is compressed into a fixed-dimension vector, and the four word set vectors are combined into a fixed-dimension dictionary vector; the word weighting method is used for compression in this paper.

[0054] Assuming that the dimension of each word set in this step is set to 50 dimensions, the obtained dictionary vector is 200 dimensions;

[0055] Each dictionary vector is added to the initial word vector formed by the corresponding segmented result to obtain an enhanced word vector feature. It can be understood that the enhanced word vector feature not only includes the vector feature of the traditional Wobert pre-training model, but also includes the external vocabulary feature added later, that is, the dimension of the enhanced word vector feature is the sum of the dimension of the initial word vector and the dimension of the dictionary vector, which is 768+200=968.

[0056] Unlike general field Chinese segmentation, in offensive text detection, there are many offensive words in the network, most of which are out-of-vocabulary words in the existing segmenter vocabulary, so they cannot be accurately segmented by the Wobert pre-training model; and the Wobert pre-training model does not provide the function of adding external word library to the Wobert word table, and if the external word library is added to the Wobert word table, when the external word library is large, it will affect the accuracy of the Wobert pre-training model.

[0057] Therefore, this step fuses offensive word information into the Wobert word vector representation layer through SoftLexicon, not only using the boundary information of external vocabulary, but also using the semantic information of external vocabulary, realizing the vocabulary enhancement of Wobert word vector, making the model more targeted, and thus improving the accuracy of the model. At the same time, compared with the traditional SoftLexicon in the character representation layer, since the Wobert word table has been segmented once, that is, a screening has been performed, so the number of matches required for vocabulary enhancement in the word vector representation layer is less, so the matching efficiency is higher; and each word vector is closer to the words in the offensive word library, so the probability of matching the correct related words is higher and faster in a single match, and the targeting is stronger, which improves the detection ability of the model.

[0058] In one embodiment, the offensive word library needs to be updated constantly, specifically, reinforcement learning can be used to add new words to the offensive word library and update the frequency information of the words.

[0059] Reinforcement learning is a method that encourages the model to take actions with higher rewards. Typical reinforcement learning algorithms include three parts: action, policy, and reward.

[0060] When using reinforcement learning to dynamically update the vocabulary, two aspects are mainly considered: vocabulary expansion and error correction. Vocabulary expansion uses reinforcement learning to automatically expand the vocabulary to cover newly emerging words. The agent can learn new words and add them to the vocabulary by interacting with the changing context. Error correction uses reinforcement learning to identify and correct errors in the vocabulary. By observing the user's feedback and the context in the text data, the agent can learn to identify and update the wrong words. Here, the reward function is defined according to the contribution of the new words discovered by the agent in subsequent text processing, and the reinforcement learning algorithm uses a deep Q network.

[0061] Step 13: Concatenate the word vector features and enhanced word vector features to obtain word fusion vectors, and use attention mechanism to assign weights to the word fusion vectors.

[0062] It can be understood that the number of rows of the fused word fusion vectors is still L =128, and the number of columns is the sum of the dimensions of the word vector and the enhanced word vector features, which is 384+968=1352 dimensions.

[0063] Since the importance of different features in each layer of the network is different, the later layers should pay more attention to important information and suppress unimportant information, so this embodiment further uses an attention mechanism model to assign higher weights to important features in the word fusion vectors.

[0064] Specifically, the principle of the attention mechanism model is:

[0065] In order to select the information related to the task from N input vectors, a representation related to the task, called query vector q ∈ R D , q is introduced, and a scoring function is used to calculate the relevance between each input vector and the query vector.

[0066] For the input sequence F ∈ R B×L×D , where B is the batch size, L is the sequence length, D is the feature dimension. First, calculate the attention distribution, that is, the probability of selecting the j input vector a jHere, the attention scoring function f( x , q The attention distribution is calculated using a weighted average of the input vectors. Common attention scoring functions include addition and dot product functions. After obtaining the attention distribution, the input vectors can be weighted to obtain the final representation of the entire sequence.

[0067] Based on the above principles, this embodiment uses the vector representation obtained by fusing word vectors. F j The input is fed into an attention mechanism, where a dot product attention model assigns higher weights to important features in the word fusion vector, ultimately yielding the final representation of the entire sequence. h j ,in, h j The format is ( b, n ), b Where batch_size is the batch size. n The output vector dimension is given; compared to the additive model, the dot product model can better utilize matrix multiplication in its implementation, thus achieving higher computational efficiency.

[0068] Step 14: The word fusion vector after weight allocation is fed into the BILSTM model for context feature extraction, and the extracted context features are fed into the fully connected layer for comprehensive processing. Finally, the offensive probability of the text information to be detected is obtained by classification through the output layer.

[0069] It is understandable that the last fully connected layer acts as a classifier. Preferably, the output layer is a softmax output layer.

[0070] After compressing the dimension of the context features to 2D through a fully connected layer, the input is then... Softmax The layers are categorized. Specifically, Softmax The activation function of the layer is used Softmax This function uses the binomial distribution calculation method when performing binary classification tasks, relative to... Sigmoid A single modeling method for the function, which can model two categories and obtain two probability predictions that add up to 1.

[0071] The embodiment introduces an offensive word library, and fuses the word vector features obtained by the Wobert pre-training model with the word information in the offensive word library by using SoftLexicon. Not only the convenient information of the word is used, but also the semantic information of the word is used, the knowledge in the offensive field is enhanced, and the detection capability of the model is improved. Meanwhile, based on the multi-feature fusion of words, words and external words, the features of offensive texts are more comprehensively represented, the problem of insufficient semantic extraction of offensive texts is solved, and the effect of offensive text detection is improved. The word-level representation is more fine-grained, and the word-level information fully fuses the context information of the word itself and its left and right adjacent words, so that the semantic information of the word and the meaning of the sentence can be better expressed. The external words reflect the knowledge in the offensive field, such as the semantic information of the main components in the field knowledge.

[0072] Embodiment 2

[0073] The embodiment provides another multi-feature fusion offensive text detection method, as shown in Figure 2 , which comprises:

[0074] In step 21, text information is obtained, and the ALBERT pre-training model and the Wobert pre-training model are used to process the text information to obtain word vector features and word vector features.

[0075] In step 22, based on the offensive word library, the SoftLexicon is used to perform dictionary embedding on each word vector feature to obtain enhanced word vector features.

[0076] In step 23, the word vector features and the enhanced word vector features are spliced and fused to obtain word fusion vectors, and the attention mechanism is used to distribute weights to the word fusion vectors.

[0077] In step 24, a text co-occurrence graph and a syntax dependency graph are constructed based on the co-occurrence relationship and the syntax dependency relationship between the enhanced word vector features. The adjacent word relationship and the syntax dependency relationship of the text co-occurrence graph and the syntax dependency graph are learned based on the graph convolution network to obtain corresponding word embedding vectors, and the fusion embedding vectors are formed by splicing and fusing.

[0078] The construction process of the graph is to regard each word as a node, and to determine whether there is an edge between two word nodes according to a certain rule or relationship between the words. In the embodiment, the co-occurrence of the text and the syntax dependency relationship are used to determine the edges between the word nodes, and two text graph networks are constructed: one is a text co-occurrence graph constructed according to the co-occurrence relationship of the adjacent words of the text, which is considered from the co-occurrence angle of the adjacent words; the other is a syntax dependency graph constructed according to the syntax dependency relationship of the text itself, which is analyzed from the syntax characteristics of the text itself; the text feature information is enriched by the two text graph networks, and the embedding effect is improved.

[0079] Then the graph convolution network is used to learn the adjacent word relationship and the syntactic dependency relationship of the text co-occurrence graph and the syntactic dependency graph respectively, to obtain the word embedding representation of the two graphs, and then to splice and fuse to obtain the fusion embedding vector.

[0080] In step 25, the fusion embedding vector and the word fusion vector after weight allocation are spliced and fused to obtain a multi-feature vector, the multi-feature vector is sent to a BILSTM model for context feature extraction, the extracted context features are sent to a full connection layer for comprehensive processing, and finally the offensive probability of the to-be-detected text information is obtained through the output layer classification.

[0081] The embodiment simultaneously considers the adjacent relationship and the syntactic relationship between words, and can capture more text feature information. Compared with using a single text representation method, the fusion of the multi-dynamic word embedding text representation feature vector can learn more comprehensive text semantic feature information.

[0082] Further, when performing dependency syntax analysis on offensive text, a large amount of time and labor cost is required for syntax annotation. In previous annotation work, using external automatic tools to obtain syntax knowledge is the mainstream method. In this case, if the model cannot identify and correctly process the noisy syntax knowledge, it is likely to be misled by inaccurate syntax knowledge and make wrong predictions.

[0083] The embodiment introduces an explanation expert system to embed an expert system knowledge base to process the syntax knowledge, correctly process the noisy syntax knowledge, specifically solve the problem of inaccurate syntax knowledge in the offensive field, and further improve the model accuracy.

[0084] Embodiment 3

[0085] The embodiment also provides a multi-feature fusion offensive text detection device, which comprises an input layer, a word vector feature acquisition module, an offensive word library, a word vector feature acquisition module, a feature fusion layer, an attention mechanism layer, a BiLSTM layer, a full connection layer and an output layer.

[0086] The input layer is used to acquire to-be-detected text information.

[0087] The word vector feature acquisition module is used to process the to-be-detected text information by using an improved Wobert pre-training model to obtain enhanced word vector features, wherein the improved Wobert pre-training model introduces the word information in the offensive word library through SoftLexicon in the word vector representation layer; wherein the specific steps of processing the to-be-detected text information by using the improved Wobert pre-training model to obtain the enhanced word vector features comprise:

[0088] After the Wobert pre-training model is used for word segmentation, the initial word vector is obtained by performing vectorization processing on the word segmentation result; meanwhile, each word segmentation result is searched and matched in the offensive word library to obtain four word sets related to the word segmentation result; after obtaining the four word sets of each word segmentation result, each word set is compressed into a fixed-dimensional vector, and the four word set vectors are combined into a fixed-dimensional dictionary vector;

[0089] Each dictionary vector is added to the initial word vector formed by the corresponding word segmentation result to obtain an enhanced word vector feature.

[0090] The feature fusion layer is configured to splice and fuse the character vector feature and the enhanced word vector feature to obtain a character-word fusion vector.

[0091] The attention mechanism layer is configured to perform weight distribution on the character-word fusion vector by using an attention mechanism.

[0092] The BiLSTM layer is configured to perform context feature extraction.

[0093] The full connection layer is configured to comprehensively process the extracted context features.

[0094] The output layer is configured to classify the output of the full connection layer to obtain an offensive probability of the to-be-detected text information.

[0095] In a possible implementation, the multi-feature fusion offensive text detection apparatus further includes a fusion embedding vector acquisition module and a syntax dependency fusion layer.

[0096] The fusion embedding vector acquisition module is configured to construct a text co-occurrence graph and a syntax dependency graph based on the co-occurrence relationship and the syntax dependency relationship between the enhanced word vector features, learn the adjacent word relationship and the syntax dependency relationship of the text co-occurrence graph and the syntax dependency graph based on a graph convolution network respectively, and obtain a fusion embedding vector.

[0097] The syntax dependency fusion layer is configured to fuse the fusion embedding vector and the character-word fusion vector.

[0098] In a possible implementation, the multi-feature fusion offensive text detection apparatus further includes an explanation expert system of an embedding expert system knowledge base and a reinforcement learning vocabulary updating module; the explanation expert system is configured to process syntax knowledge when learning the syntax dependency relationship of the syntax dependency graph based on the graph convolution network; and the reinforcement learning vocabulary updating module is configured to add new words to the offensive word library and update the frequency information of the vocabulary by using reinforcement learning.

[0099] Embodiment 4

[0100] The embodiment further provides a computer device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method in the embodiment 1 or the embodiment 2 when executing the computer program.

[0101] Embodiment 5

[0102] The embodiment further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of the embodiment 1 or the embodiment 2.

[0103] Embodiment 6

[0104] The embodiment further provides a computer program product, comprising a computer program, and the computer program is executed by a processor to implement the steps of the embodiment 1 or the embodiment 2.

[0105] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application rather than limiting them; although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the specific embodiments of the present application can be modified or some technical features can be replaced by equivalent ones; without departing from the spirit of the technical scheme of the present application, all of them should be covered in the technical scheme range of the present application claimed by the present application.

Claims

1. A multi-feature fusion offensive text detection method, characterized in that, Includes the following steps: The text information to be detected is processed by the ALBERT pre-trained model to obtain character vector features; By introducing lexical information from the offensive vocabulary lexicon into the Wobert pre-trained model using SoftLexicon, an improved Wobert pre-trained model is obtained. This improved Wobert pre-trained model is then used to process the text information to be detected and obtain enhanced word vector features. The specific steps for improving the Wobert pre-trained model to process the text information to be detected and obtaining enhanced word vector features include: After the Wobert pre-trained model performs word segmentation, the segmentation results are vectorized to obtain initial word vectors. At the same time, each segmentation result is searched and matched in an offensive word library to obtain four word sets related to the segmentation result. After obtaining the four word sets for each segmentation result, each word set is compressed into a fixed-dimensional vector, and the vectors of the four word sets are combined into a fixed-dimensional dictionary vector. Each dictionary vector is added to the initial word vector formed by the corresponding word segmentation result to obtain enhanced word vector features; Based on the co-occurrence relationship and syntactic dependency relationship between enhanced word vector features, a text co-occurrence graph and a syntactic dependency graph are constructed. Then, based on the graph convolutional network, the neighbor word relationship and syntactic dependency relationship of the text co-occurrence graph and the syntactic dependency graph are learned respectively to obtain the corresponding word embedding vectors. Finally, the fused embedding vectors are formed by concatenating and fusing them. The character vector features and enhanced word vector features are concatenated and fused to obtain the character-word fusion vector, and an attention mechanism is used to assign weights to the character-word fusion vector; The fused embedding vector is concatenated with the word fusion vector after weight allocation to obtain a multi-feature vector. The multi-feature vector is then fed into the BILSTM model for context feature extraction. The extracted context features are then fed into a fully connected layer for comprehensive processing. Finally, the output layer classifies the text to be detected to obtain the offensive probability.

2. The multi-feature fusion offensive text detection method according to claim 1, characterized in that: When learning syntactic dependency relations of syntactic dependency graphs based on graph convolutional networks, the syntactic knowledge is processed by embedding an expert system knowledge base into the interpretation expert system. And it utilizes reinforcement learning to add new words to the offensive vocabulary corpus and update the frequency information of the vocabulary.

3. A multi-feature fusion offensive text detection device, characterized in that: It includes an input layer, a word vector feature acquisition module, an offensive lexicon, a word vector feature acquisition module, a feature fusion layer, an attention mechanism layer, a BiLSTM layer, a fully connected layer, and an output layer. It also includes a fusion embedding vector acquisition module and a syntactic dependency fusion layer. The input layer is used to obtain the text information to be detected; The word vector feature acquisition module is used to process the text information to be detected by improving the Wobert pre-trained model and obtain enhanced word vector features. The improved Wobert pre-trained model introduces lexical information from the offensive lexicon through SoftLexicon in the word vector representation layer. The specific steps for improving the Wobert pre-trained model to process the text information to be detected and obtaining enhanced word vector features include: After the Wobert pre-trained model performs word segmentation, the segmentation results are vectorized to obtain initial word vectors. At the same time, each segmentation result is searched and matched in an offensive word library to obtain four word sets related to the segmentation result. After obtaining the four word sets for each segmentation result, each word set is compressed into a fixed-dimensional vector, and the vectors of the four word sets are combined into a fixed-dimensional dictionary vector. Each dictionary vector is added to the initial word vector formed by the corresponding word segmentation result to obtain enhanced word vector features; The feature fusion layer is used to concatenate and fuse character vector features and enhanced word vector features to obtain a character-word fusion vector; The attention mechanism layer is used to assign weights to the word fusion vector using the attention mechanism; The fusion embedding vector acquisition module is used to construct a text co-occurrence graph and a syntactic dependency graph based on the co-occurrence relationship and syntactic dependency relationship between the enhanced word vector features, and to learn the neighboring word relationship and syntactic dependency relationship of the text co-occurrence graph and the syntactic dependency graph respectively based on the graph convolutional network to obtain the fusion embedding vector; The syntactic dependency fusion layer is used to fuse the fusion embedding vector with the word fusion vector; The BiLSTM layer is used for context feature extraction; The fully connected layer is used to comprehensively process the extracted context features; The output layer is used to classify the output of the fully connected layer to obtain the offensive probability of the text information to be detected.

4. The multi-feature fusion offensive text detection device according to claim 3, characterized in that: It also includes an explanation expert system embedded in the expert system knowledge base and a reinforcement learning lexicon update module; the explanation expert system is used to process syntactic knowledge when learning syntactic dependency relations of syntactic dependency graphs based on graph convolutional networks; The reinforcement learning vocabulary update module is used to add new words to the offensive vocabulary and update the frequency information of the vocabulary using reinforcement learning.

5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 2.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 2.

7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Regional entity identification method and device

    CN113935327A

  • Named entity recognition method based on multi-granularity word formation features

    CN117172252A