Sensitive text monitoring method and device
By combining the dual monitoring mechanism of the forbidden word dictionary and the Bert recognition model, sensitive text is identified, which solves the problem of high missed detection rate in sensitive text monitoring in the existing technology, improves the monitoring success rate, and ensures the environmental quality of the network platform.
Patent Information
- Application Number
- CN202210749936.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-06-29
AI Technical Summary
In the existing technology, the neural network model is easy to miss detection when used for sensitive text monitoring, the monitoring success rate is low, and it is unable to effectively create a clean and harmonious network platform environment.
It adopts a dual monitoring mechanism of pre-built banned word dictionary and Bert recognition model, and identifies semantically sensitive texts that contain banned words and do not contain banned words through banned word matching and semantic information analysis, thereby reducing the missed detection rate and improving the monitoring success rate.
It achieves accurate identification of sensitive text, reduces the missed detection rate, improves the monitoring success rate, and ensures a clean and harmonious environment on the network platform.
Smart Images

Figure CN115048929B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a sensitive text monitoring method and device. It should be noted that the sensitive text monitoring method and device of the present invention can be used in the field of artificial intelligence technology, and can also be used in any field other than the field of artificial intelligence technology, and the application field of the sensitive text monitoring method and device of the present invention is not limited. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the invention recited in the claims. No admission is made that the description herein is prior art by inclusion in this section.
[0003] With the rapid development of Internet technology, people have more channels and types of information, and are easily misled or influenced by sensitive, erroneous, and unhealthy remarks published by certain organizations and individuals. Therefore, it is necessary to monitor the content published on the platform in real time, screen and block sensitive content accordingly, and create a clean and harmonious network platform environment. At present, there are schemes in the prior art that use neural network models to monitor sensitive texts, but these schemes are prone to missed detection, have a low monitoring success rate, and are not very effective in practical applications. Summary of the invention
[0004] The embodiment of the present invention provides a sensitive text monitoring method for accurately identifying sensitive text, reducing the missed detection rate of sensitive text, and improving the success rate of sensitive text monitoring. The method includes:
[0005] According to the pre-built banned word dictionary, banned word matching is performed on the monitored text;
[0006] When the matched text to be monitored contains banned words, the text to be monitored is determined to be sensitive text;
[0007] When the text to be monitored does not contain banned words, the text to be monitored is input into a Bert recognition model, and the text category of the text to be monitored determined according to the semantic information of the text to be monitored is output; the Bert recognition model is trained based on historical texts and text categories of historical texts;
[0008] According to the text category of the text to be monitored, determine whether the text to be monitored is sensitive text.
[0009] The embodiment of the present invention further provides a sensitive text monitoring device for accurately identifying sensitive texts, reducing the missed detection rate of sensitive texts, and improving the success rate of sensitive text monitoring. The device includes:
[0010] A stopword matching module is used to match the text to be monitored with stopwords according to a pre-built stopword dictionary;
[0011] A first sensitive text determination module, configured to determine that the text to be monitored is sensitive text when the banned word matching module matches that the text to be monitored contains banned words;
[0012] A Bert recognition model processing module is used to input the text to be monitored into a Bert recognition model when the banned word matching module does not match the banned words contained in the text to be monitored, and output the text category of the text to be monitored determined according to the semantic information of the text to be monitored; the Bert recognition model is trained based on historical texts and text categories of historical texts;
[0013] The second sensitive text determination module is used to determine whether the text to be monitored is sensitive text according to the text category of the text to be monitored.
[0014] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned sensitive text monitoring method when executing the computer program.
[0015] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned sensitive text monitoring method is implemented.
[0016] An embodiment of the present invention further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the above-mentioned sensitive text monitoring method is implemented.
[0017] In an embodiment of the present invention, banned words are matched on the text to be monitored according to a pre-constructed banned word dictionary; when the text to be monitored is matched to contain banned words, the text to be monitored is determined to be sensitive text; when the text to be monitored is not matched to contain banned words, the text to be monitored is input into a Bert recognition model, and the text category of the text to be monitored determined according to the semantic information of the text to be monitored is output; the Bert recognition model is trained based on historical texts and text categories of historical texts; and whether the text to be monitored is sensitive text is determined based on the text category of the text to be monitored. The embodiment of the present invention utilizes a dual monitoring mechanism of a banned word dictionary and a Bert recognition model, which can identify sensitive texts that contain banned words and those that do not contain banned words but are semantically sensitive, can accurately identify sensitive texts, reduce the missed detection rate in the sensitive text monitoring process, and improve the monitoring success rate of sensitive texts. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0019] Figure 1 Schematic diagram of a sensitive text monitoring method according to an embodiment of the present invention;
[0020] Figure 2 A diagram showing a specific example of a sensitive text monitoring method according to an embodiment of the present invention;
[0021] Figure 3 is a schematic diagram of a sensitive text monitoring device in an embodiment of the present invention;
[0022] Figure 4 A diagram showing a specific example of a sensitive text monitoring device in an embodiment of the present invention;
[0023] Figure 5 FIG. 4 is a diagram showing a specific example of a sensitive text monitoring device in an embodiment of the present invention. DETAILED DESCRIPTION
[0024] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0025] First, the technical terms involved in the embodiments of the present invention are introduced:
[0026] Natural Language Processing (NLP): It mainly studies various theories and methods of using computers to understand and generate natural languages, with the purpose of reducing user workload and satisfying the desire to use natural language for human-computer interaction. It is a core branch of artificial intelligence.
[0027] Word2vec (Word to Vector) model: Word2vec is a word vector embedding technology that vectorizes words and assumes that each word in a sentence has the closest relationship with its adjacent words. It quantitatively measures the relationship between words through training with a large amount of corpus.
[0028] Self-attention model: When representing the state at a certain moment in a sequence, the correlation between this state and the states at other moments can be used to calculate the attention value. The greater the correlation, the greater the contribution of the state at other moments to the state at this moment.
[0029] Transformer model: Transformer is a "sequence-to-sequence" deep learning model based on the self-attention mechanism, which can be used for tasks such as sequence translation in the field of natural language processing. It consists of two parts: an encoder and a decoder. The implementation of the decoder and the encoder is basically the same, but the last layer output of the encoder is used as input, and the partially decoded output result is also used as input. Different from sequence models such as LSTM (Long-Short Term Memory, long short-term memory recurrent neural network), it considers the position information of the text and uses three different parameter matrices to map the input vector into a query vector Q, a key vector K, and a value vector V, so that the input vector can better play the three roles; secondly, a multi-head self-attention mechanism is used to focus the model's attention on different positions in the sentence; thirdly, after each layer of self-attention calculation, a nonlinear perceptron model is added, and residual connections and layer normalization are used to enhance the learning effect of the model.
[0030] Bert (Bidirectional encoder representations from transformer) model: Based on the improvement of the Transformer model, the Bert model can be regarded as the encoder part of the Transformer. The Bert model is a pre-trained language model based on the deep Transformer.
[0031] The inventors found that with the rapid development of Internet technology, people have more channels and types of information to obtain, and are easily misled or influenced by sensitive, erroneous, and unhealthy remarks published by certain organizations and individuals. Therefore, it is necessary to monitor the content published on the platform in real time, screen and block sensitive content accordingly, and create a clean and harmonious network platform environment. In the prior art, there are schemes that use neural network models to monitor sensitive texts, but these schemes are prone to missed detection, have a low monitoring success rate, and are not very effective in practical applications. To this end, the inventors propose a sensitive text monitoring method.
[0032] Figure 1 FIG. 1 is a flow chart of a sensitive text monitoring method according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0033] Step 101: Match the banned words on the text to be monitored according to the pre-built banned word dictionary;
[0034] Step 102: when it is matched that the text to be monitored contains a banned word, determine that the text to be monitored is a sensitive text;
[0035] Step 103: when no banned words are found in the text to be monitored, the text to be monitored is input into a Bert recognition model, and the text category of the text to be monitored determined according to the semantic information of the text to be monitored is output; the Bert recognition model is trained based on historical texts and text categories of historical texts;
[0036] Step 104: Determine whether the text to be monitored is sensitive text according to the text category of the text to be monitored.
[0037] Depend on Figure 1 It can be seen from the process shown that in the embodiment of the present invention, the text to be monitored is matched with banned words according to the pre-constructed banned word dictionary; when the text to be monitored contains banned words, the text to be monitored is determined to be sensitive text; when the text to be monitored does not contain banned words, the text to be monitored is input into the Bert recognition model, and the text category of the text to be monitored determined according to the semantic information of the text to be monitored is output; the Bert recognition model is trained based on historical texts and text categories of historical texts; according to the text category of the text to be monitored, it is determined whether the text to be monitored is sensitive text. The embodiment of the present invention utilizes the dual monitoring mechanism of the banned word dictionary and the Bert recognition model, which can identify sensitive texts that contain banned words and those that do not contain banned words but are semantically sensitive, can accurately identify sensitive texts, reduce the missed detection rate in the sensitive text monitoring process, and improve the monitoring success rate of sensitive texts.
[0038] It should be noted that in the embodiments of the present invention, all acquisition, storage, use, and processing of data comply with relevant provisions of national laws and regulations.
[0039] In the embodiment, according to the pre-built banned word dictionary, before matching banned words to the monitored text, preliminary preparation work can be performed, such as building a banned word dictionary and training a Bert recognition model. Among them, the banned word dictionary is used to monitor texts containing banned words, and the Bert recognition model is used to monitor texts that do not contain banned words but are semantically sensitive. Such texts generally do not directly contain banned words but the overall semantics involve sensitive information, and the sensitive information is highly hidden. Therefore, after the banned word dictionary is used to determine and process the monitored text to confirm that the text does not contain banned words, the Bert recognition model will make further judgments. Such a dual monitoring mechanism can effectively ensure that sensitive texts are accurately identified.
[0040] In an embodiment, before matching the monitored text with banned words, the monitored text may be preprocessed after obtaining the monitored text, based on a pre-built banned word dictionary, so as to further improve the success rate of monitoring sensitive files and avoid missed detection. The preprocessing may include: removing noise data, and / or segmenting the monitored text and removing specified characters.
[0041] During the preprocessing process, since sensitive texts are often interspersed with interference items such as emoticons, symbols, and numbers, this type of noise data must be removed; when the monitored text is segmented, the HanLP word segmenter tool can be used for word segmentation, and unqualified characters, control characters, extra spaces and other specified characters can be removed. The HanLP word segmenter can customize the dictionary. In addition to adding standard words, banned words can be added to the dictionary customized using the HanLP word segmenter. Those skilled in the art should know that the preprocessing process method of sensitive text in the embodiment of the present invention is not limited to the above content, and is only used as an example here.
[0042] After the text to be monitored is preprocessed, the text to be monitored is matched with banned words according to a pre-built banned word dictionary in step 101. Prior to this, a banned word dictionary needs to be built in advance.
[0043] In one embodiment, the sensitive text monitoring method in the embodiment of the present invention may further include: collecting banned words; and constructing a banned word dictionary based on the banned words and words related to the banned words.
[0044] Specifically, you can use crawlers or collect banned words based on platform business data. In addition, since some banned words are circumvented, such as using synonyms, pinyin, decomposed characters, homophones, and similar characters as replacements, it is necessary to take related words of the banned words into consideration.
[0045] In one embodiment, related words of the banned words include:
[0046] One or any combination of synonyms, similar words, homophones, and split words of banned words.
[0047] For example, commonly used synonyms, near-words, homophones, split words, pinyin, etc. of banned words are obtained. Since such banned words are highly concealed, related words of banned words can also be obtained by comprehensive methods such as Chinese character structure, text image angle, and similarity between Chinese characters. The forms of banned words vary and can be processed according to actual conditions. The embodiments of the present invention are only used as examples here and will not be listed one by one.
[0048] Once banned words appear, they need to be blocked. After collecting enough banned words and their related words, you can build a banned word dictionary.
[0049] In one embodiment, a banned word dictionary is constructed based on banned words and related words of banned words, including:
[0050] According to the banned words and their related words, a banned word dictionary is constructed in a DFA (Deterministic Finite Automation) manner;
[0051] According to the pre-built banned word dictionary, the banned word matching is performed on the monitored text, including:
[0052] Traverse the banned word dictionary constructed in DFA mode and match banned words on the monitored text.
[0053] In one embodiment, a banned word dictionary is constructed based on banned words and related words of banned words, including:
[0054] According to the banned words and their related words, a banned word dictionary is constructed in a trie format;
[0055] According to the pre-built banned word dictionary, the banned word matching is performed on the monitored text, including:
[0056] Traverse the banned word dictionary constructed in a dictionary tree manner and match the banned words on the monitored text.
[0057] Specifically, a banned word dictionary is constructed in a DFA manner or a dictionary tree manner, and then the idea of traversal is adopted to determine whether the text to be monitored contains text and Chinese characters that can be recognized by the banned word dictionary. Those skilled in the art should know that the construction method of the banned word dictionary is not limited to the above content, and the embodiments of the present invention are only used as examples here. Constructing a banned word dictionary in a variety of ways can effectively ensure that sensitive text containing banned words is accurately identified. The present invention also provides an embodiment, in which banned words are matched on the text to be monitored according to a pre-constructed banned word dictionary, including:
[0058] According to a pre-constructed banned word dictionary, a Word2vec recognition model is used to match banned words on the monitored text; the Word2vec recognition model is trained based on historical texts and banned words in the historical texts.
[0059] In the embodiment, an initial Word2vec recognition model can be built, historical texts and banned words in the historical texts are collected and a banned word sequence is constructed, and the banned words are sent to the initial Word2vec recognition model after One-hot encoding, and the classification training and testing are performed using the Soft-max classification function. After the Word2vec recognition model training is completed, the embedded features of the middle hidden layer are taken to represent the feature vector of the banned words and saved. After the text to be monitored is preprocessed, the One-hot encoding is sent to the trained Word2vec recognition model to obtain the embedded features of its hidden layer, and the cosine similarity is calculated with the feature vector of the banned words saved in advance. If it is greater than a certain threshold, it indicates that the text to be monitored contains banned words, otherwise it does not contain banned words, and the threshold can be set according to the actual situation.
[0060] In step 102, when it is matched that the text to be monitored contains a banned word, it is determined that the text to be monitored is sensitive text, and the text to be monitored can be shielded.
[0061] If the text to be monitored does not contain banned words, step 103 is executed. When no banned words are found in the text to be monitored, the text to be monitored is input into the Bert recognition model, and the text category of the text to be monitored determined according to the semantic information of the text to be monitored is output; the Bert recognition model is trained based on historical texts and text categories of historical texts. Prior to this, the Bert recognition model needs to be trained in advance.
[0062] In one embodiment, the Bert recognition model is obtained as follows:
[0063] Taking historical texts and text categories of historical texts as sample data, a training set and a test set are obtained;
[0064] Using a training set to train the Bert recognition model;
[0065] Testing the Bert recognition model using a test set;
[0066] Among them, when historical texts and text categories of historical texts are used as sample data to obtain training sets and test sets, the sample data are subjected to text category balancing processing in a data enhancement manner.
[0067] As mentioned above, the Bert recognition model is used to monitor texts that do not contain banned words but have sensitive semantics. Such texts generally have a high degree of hidden sensitive semantics, and the overall semantics involve some sensitive information. The Bert recognition model can deeply mine the rich semantic information of such texts and identify the text category of such texts.
[0068] In an embodiment, a crawler or platform business data can be used to collect historical texts containing banned words, and the historical texts containing banned words are classified according to the category of information as sample data for training sets and test sets; each category of sample data is preliminarily preprocessed, One-hot encoded and a word vector matrix is generated, which is further converted into a real-valued vector matrix. Generally speaking, the dimension of the word vector will be reduced after the conversion, and the representation vector has semantic information, which is convenient for input into the Bert recognition model; a trained Bert recognition model is obtained after coarse training and fine training of the model using the training set and the test set.
[0069] In the embodiment, considering the self-attention mechanism of the Bert recognition model, each word in the text contains information about all other words. For each sample data, a [CLS] (Class) mark is added at the first position for subsequent classification processing, and a [SEP] (Separation) mark is added at the end to mark the end of the sample data. Therefore, the information of all words in the sample data is summarized by using the first character [CLS] and the last character [SEP] of the sample data; after the preprocessed sample data is input into the Bert recognition model, the word vector V i (Vocable, word) and position vector L i After the features of (Location) are superimposed, they are sent to the Bert recognition model-encoder module; the Bert recognition model-encoder module outputs a semantic latent vector h i (Hide, hide), h CLS and h SEP ; The latent vector h i 、h CLS and h SEP It is sent to the fully connected layer, and after multi-classification cross entropy loss supervised training, the normalized exponential function Softmax classification is used to output the text category of the sample data; in this embodiment, i = 1, 2, 3, ..., N, where N is the length of the sample data. Figure 2 is a specific example diagram of a sensitive text monitoring method in an embodiment of the present invention, Figure 2 A schematic diagram of the Bert recognition model is shown.
[0070] In step 104, it is determined whether the text to be monitored is sensitive text according to the text category of the text to be monitored. In this step, the text category of the text to be monitored is output according to the pre-trained Bert recognition model, and then it is determined whether the text to be monitored is sensitive text.
[0071] In one embodiment, the banned word dictionary is updated regularly;
[0072] And / or, the text to be monitored and the text category of the text to be monitored determined according to the semantic information of the text to be monitored output by the Bert recognition model are used as historical data to continue training the Bert recognition model.
[0073] As the business continues to develop and business data continues to be enriched, new banned words will continue to be generated. The banned word dictionary needs to be updated regularly to improve the monitoring scope and accuracy of sensitive texts. The Bert recognition model can also be trained and updated continuously. On the basis of the original training weights, the text to be monitored and the text category of the text to be monitored determined by the output of the Bert recognition model based on the semantic information of the text to be monitored are used as historical data to continue training the Bert recognition model, thereby realizing rapid updating and improvement of the Bert recognition model.
[0074] The technical solution in the embodiments of the present invention can be used for social media platforms, and can also be used for relevant text review in various financial apps, including live broadcast room barrages, comments, intelligent customer service, etc., which can efficiently, timely and accurately prevent the spread of sensitive texts and related sensitive information, and purify the platform network environment.
[0075] The present invention also provides a sensitive text monitoring device, as described in the following embodiments. Since the principle of solving the problem by the device is similar to that of the sensitive text monitoring method, the implementation of the device can refer to the implementation of the sensitive text monitoring method, and the repeated parts will not be repeated.
[0076] Figure 3 FIG. 1 is a schematic diagram of a sensitive text monitoring device according to an embodiment of the present invention. Figure 3 As shown, the device comprises:
[0077] A stopword matching module 301 is used to match the text to be monitored with stopwords according to a pre-built stopword dictionary;
[0078] A first sensitive text determination module 302, configured to determine that the text to be monitored is a sensitive text when the banned word matching module 301 matches that the text to be monitored contains banned words;
[0079] The Bert recognition model processing module 303 is used to input the text to be monitored into the Bert recognition model when the stopword matching module 301 does not match the text to be monitored that contains the stopword, and output the text category of the text to be monitored determined according to the semantic information of the text to be monitored; the Bert recognition model is trained based on historical texts and the text categories of historical texts;
[0080] The second sensitive text determination module 304 is used to determine whether the text to be monitored is a sensitive text according to the text category of the text to be monitored.
[0081] In one embodiment, the sensitive text monitoring device in the embodiment of the present invention further includes:
[0082] The preprocessing module is used to preprocess the monitored text before the stopword matching module 301 performs stopword matching on the monitored text, and the preprocessing includes:
[0083] Remove noise data, and / or segment the text to be monitored and remove specified characters.
[0084] Figure 4 FIG. 1 is a specific example diagram of a sensitive text monitoring device in an embodiment of the present invention. Figure 4 As shown, in one embodiment, in the embodiment of the present invention Figure 3 The device shown also includes:
[0085] A stopword collection module 401 is used to collect stopwords;
[0086] The stop word dictionary building module 402 is used to build a stop word dictionary based on the stop words and the related words of the stop words.
[0087] In one embodiment, the related words of the banned words of the sensitive text monitoring device in the embodiment of the present invention include:
[0088] One or any combination of synonyms, similar words, homophones, and split words of banned words.
[0089] In one embodiment, the stopword dictionary building module 402 is specifically used to:
[0090] Based on the banned words and their related words, a banned word dictionary is constructed in a DFA manner;
[0091] The stopword matching module 301 is specifically used for:
[0092] Traverse the banned word dictionary constructed in DFA mode and match banned words on the monitored text.
[0093] In one embodiment, the stopword dictionary building module 402 is specifically used to:
[0094] According to the banned words and their related words, a banned word dictionary is constructed in a dictionary tree manner;
[0095] The stopword matching module 301 is specifically used for:
[0096] Traverse the banned word dictionary constructed in a dictionary tree manner and match the banned words on the monitored text.
[0097] In one embodiment, the stopword matching module 301 is specifically used to:
[0098] According to a pre-constructed banned word dictionary, a Word2vec recognition model is used to match banned words on the monitored text; the Word2vec recognition model is trained based on historical texts and banned words in the historical texts.
[0099] In one embodiment, the Bert recognition model of the sensitive text monitoring device in the embodiment of the present invention is obtained as follows:
[0100] Taking historical texts and text categories of historical texts as sample data, a training set and a test set are obtained;
[0101] Using a training set to train the Bert recognition model;
[0102] Testing the Bert recognition model using a test set;
[0103] Among them, when historical texts and text categories of historical texts are used as sample data to obtain training sets and test sets, the sample data are subjected to text category balancing processing in a data enhancement manner.
[0104] Figure 5 FIG. 1 is a specific example diagram of a sensitive text monitoring device in an embodiment of the present invention. Figure 5 As shown, in the embodiment of the present invention Figure 3 The device may also include:
[0105] A stop word dictionary updating module 501 is used to regularly update the stop word dictionary;
[0106] And / or, the Bert recognition model updating module 502 is used to use the text to be monitored and the text category of the text to be monitored determined according to the semantic information of the text to be monitored output by the Bert recognition model as historical data to continue training the Bert recognition model.
[0107] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned sensitive text monitoring method when executing the computer program.
[0108] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned sensitive text monitoring method is implemented.
[0109] An embodiment of the present invention further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the above-mentioned sensitive text monitoring method is implemented.
[0110] In an embodiment of the present invention, banned words are matched on the text to be monitored according to a pre-constructed banned word dictionary; when the text to be monitored is matched to contain banned words, the text to be monitored is determined to be sensitive text; when the text to be monitored is not matched to contain banned words, the text to be monitored is input into a Bert recognition model, and the text category of the text to be monitored determined according to the semantic information of the text to be monitored is output; the Bert recognition model is trained based on historical texts and text categories of historical texts; and whether the text to be monitored is sensitive text is determined based on the text category of the text to be monitored. The embodiment of the present invention utilizes a dual monitoring mechanism of a banned word dictionary and a Bert recognition model, which can identify sensitive texts that contain banned words and those that do not contain banned words but are semantically sensitive, can accurately identify sensitive texts, reduce the missed detection rate in the sensitive text monitoring process, and improve the monitoring success rate of sensitive texts.
[0111] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0112] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0113] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0114] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0115] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A sensitive text monitoring method, It is characterized in that include: According to the pre-built banned word dictionary, banned word matching is performed on the monitored text; When the matched text to be monitored contains banned words, the text to be monitored is determined to be sensitive text; When the text to be monitored does not contain banned words, the text to be monitored is input into a Bert recognition model, and the text category of the text to be monitored determined according to the semantic information of the text to be monitored is output; the Bert recognition model is trained based on historical texts and text categories of historical texts; Determine whether the text to be monitored is sensitive text according to the text category of the text to be monitored; Among them, according to the pre-built banned word dictionary, banned word matching is performed on the monitored text, including: According to the pre-built banned word dictionary, the Word2vec recognition model is used to match banned words to the monitored text; the Word2vec recognition model is trained based on historical texts and banned words in the historical texts; wherein, an initial Word2vec recognition model is built, the banned words in the historical texts and the historical texts are collected and a banned word sequence is constructed, and the banned words are sent to the initial Word2vec recognition model after One-hot encoding, and the classification training and testing are performed using the Soft-max classification function. After the Word2vec recognition model training is completed, the embedded features of the middle hidden layer are taken to represent the feature vector of the banned words and saved. After the monitored text is pre-processed, the One-hot encoding is sent to the trained Word2vec recognition model to obtain the embedded features of its hidden layer, and the cosine similarity is calculated with the feature vector of the banned words saved in advance. If it is greater than a threshold, it indicates that the monitored text contains banned words, otherwise it does not contain banned words; The Bert recognition model is obtained as follows: Historical texts and text categories of historical texts are used as sample data to obtain a training set and a test set; the Bert recognition model is trained using the training set; and the Bert recognition model is tested using the test set; wherein, when historical texts and text categories of historical texts are used as sample data to obtain a training set and a test set, the sample data is subjected to text category balancing processing in a data enhancement manner.
2. The method according to claim 1, It is characterized in that Also includes: Before matching the banned words on the monitored text, the monitored text is preprocessed, and the preprocessing includes: Remove noise data, and / or segment the text to be monitored and remove specified characters.
3. The method according to claim 1, It is characterized in that Also includes: Collect banned words; A banned word dictionary is constructed based on banned words and their related words.
4. The method according to claim 3, It is characterized in that Related words for banned words include: One or any combination of synonyms, similar words, homophones, and split words of banned words.
5. The method according to claim 3, It is characterized in that Construct a banned word dictionary based on banned words and their related words, including: According to the banned words and the related words of the banned words, a finite automaton DFA method is determined to construct a banned word dictionary.
6. The method according to claim 3, It is characterized in that Construct a banned word dictionary based on banned words and their related words, including: A banned word dictionary is constructed in a dictionary tree manner based on banned words and their related words.
7. The method according to any one of claims 1 to 6, It is characterized in that Also includes: Regularly update the banned word dictionary; And / or, the text to be monitored and the text category of the text to be monitored determined according to the semantic information of the text to be monitored output by the Bert recognition model are used as historical data to continue training the Bert recognition model.
8. A sensitive text monitoring device, It is characterized in that include: A stopword matching module is used to match the text to be monitored with stopwords according to a pre-built stopword dictionary; A first sensitive text determination module, configured to determine that the text to be monitored is sensitive text when the banned word matching module matches that the text to be monitored contains banned words; A Bert recognition model processing module is used to input the text to be monitored into a Bert recognition model when the banned word matching module does not match the banned words contained in the text to be monitored, and output the text category of the text to be monitored determined according to the semantic information of the text to be monitored; the Bert recognition model is trained based on historical texts and text categories of historical texts; A second sensitive text determination module, used to determine whether the text to be monitored is a sensitive text according to the text category of the text to be monitored; Stopword matching module, specifically used for: According to the pre-built banned word dictionary, the Word2vec recognition model is used to match banned words to the monitored text; the Word2vec recognition model is trained based on historical texts and banned words in the historical texts; wherein, an initial Word2vec recognition model is built, the banned words in the historical texts and the historical texts are collected and a banned word sequence is constructed, and the banned words are sent to the initial Word2vec recognition model after One-hot encoding, and the classification training and testing are performed using the Soft-max classification function. After the Word2vec recognition model training is completed, the embedded features of the middle hidden layer are taken to represent the feature vector of the banned words and saved. After the monitored text is pre-processed, the One-hot encoding is sent to the trained Word2vec recognition model to obtain the embedded features of its hidden layer, and the cosine similarity is calculated with the feature vector of the banned words saved in advance. If it is greater than a threshold, it indicates that the monitored text contains banned words, otherwise it does not contain banned words; The Bert recognition model is obtained as follows: Historical texts and text categories of historical texts are used as sample data to obtain a training set and a test set; the Bert recognition model is trained using the training set; and the Bert recognition model is tested using the test set; wherein, when historical texts and text categories of historical texts are used as sample data to obtain a training set and a test set, the sample data is subjected to text category balancing processing in a data enhancement manner.
9. The device as claimed in claim 8, It is characterized in that Also includes: The preprocessing module is used to preprocess the monitored text before the stopword matching module matches the monitored text with the stopwords, and the preprocessing includes: Remove noise data, and / or segment the text to be monitored and remove specified characters.
10. The device according to claim 8, It is characterized in that Also includes: A banned word collection module, used to collect banned words; The banned word dictionary building module is used to build a banned word dictionary based on banned words and related words of the banned words.
11. The device according to claim 10, It is characterized in that Related words for banned words include: One or any combination of synonyms, similar words, homophones, and split words of banned words.
12. The device according to claim 10, It is characterized in that Stopword dictionary building module, specifically used for: A banned word dictionary is constructed in a DFA manner based on banned words and their related words.
13. The device according to claim 10, It is characterized in that Stopword dictionary building module, specifically used for: A banned word dictionary is constructed in a dictionary tree manner based on banned words and their related words.
14. The device according to any one of claims 8 to 13, It is characterized in that Also includes: A banned word dictionary update module, used to regularly update the banned word dictionary; And / or, a Bert recognition model updating module is used to use the text to be monitored and the text category of the text to be monitored determined according to the semantic information of the text to be monitored output by the Bert recognition model as historical data to continue training the Bert recognition model.
15. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
16. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
17. A computer program product, It is characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Detection method and detection system for webpage text bad information
CN112131352A
Weighted negative supervision text sentiment analysis method based on BERT model
CN113723083A
