Sensitive word filtering method, system and device, computer equipment and readable storage medium
By using multi-pattern matching algorithm on the server and real-time detection of sensitive words on the client, and building a sensitive lexicon library with compressed prefix tree algorithm and sensitive word hit frequency, the problem of inefficiency of traditional sensitive word filtering methods is solved, and efficient and accurate sensitive word filtering is achieved.
Patent Information
- Application Number
- CN202411708809.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-11
AI Technical Summary
Traditional sensitive word filtering methods are inefficient, especially during text transfer and processing between clients and servers.
A multi-pattern matching algorithm is used to detect sensitive words on the text sent by the client on the server, and the text is detected in real time through the client. A sensitive word library is built in combination with the compressed prefix tree algorithm and sensitive word hit frequency to realize text filtering processing.
It improves the efficiency and accuracy of sensitive word filtering, ensuring that sensitive words can be effectively identified and filtered during text transmission and processing between the client and the server, and avoids missed testing.
Smart Images

Figure CN119598022A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text processing technology, and in particular to a sensitive word filtering method, system, device, computer equipment, computer-readable storage medium and computer program product. Background Art
[0002] With the widespread use of the Internet in our lives, we live in an era of information explosion. In order to protect users from harmful, offensive or inappropriate content and effectively improve user experience, the sensitive word filtering system is of great significance. By filtering sensitive words, the platform can create a safer and more friendly environment.
[0003] The traditional sensitive word filtering method usually sends the text from the client to the server, and performs sensitive word filtering on the server, which has the problem of low sensitive word filtering efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a sensitive word filtering method, system, device, computer equipment, computer-readable storage medium and computer program product that can improve efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a sensitive word filtering method, which is applied to a server, and the method includes:
[0006] Acquire a first text sent by a client; the first text is sent by the client to the server when the first text has not been updated for a preset time period;
[0007] A multi-pattern matching algorithm is used to detect sensitive words in the first text to obtain a second sensitive word, and the second sensitive word is returned to the client to instruct the client to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text. The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time.
[0008] In one embodiment, the step of performing sensitive word detection on the first text using a multi-pattern matching algorithm to obtain a second sensitive word includes:
[0009] In the first thread, the first text is converted into a two-dimensional pinyin array, a depth-first traversal is performed on the two-dimensional pinyin array, and a pinyin multi-pattern matching algorithm is used to perform sensitive word detection on the two-dimensional pinyin array during the depth-first traversal to obtain pinyin sensitive words;
[0010] In the second thread, the first text is sequentially traversed, and during the sequential traversal, a text multi-pattern matching algorithm is used to detect sensitive words in the first text to obtain text sensitive words; the pinyin sensitive words and the text sensitive words both belong to second sensitive words.
[0011] In one embodiment, the method further comprises:
[0012] Acquire a first historical sensitive word from a sensitive word database, construct a first text sensitive word library based on the first historical sensitive word by using a compressed prefix tree algorithm and a sensitive word hit frequency, and send the first text sensitive word library to the client to instruct the client to perform high-frequency sensitive word detection on the first text in real time by using the first text sensitive word library;
[0013] Acquire a second historical sensitive word from the sensitive word database, and construct a second text sensitive word library based on the second historical sensitive word using a multi-pattern matching algorithm; the sensitive word hit frequency of the first historical sensitive word is higher than the sensitive word hit frequency of the second historical sensitive word;
[0014] Acquire a third historical sensitive word from the sensitive word database, convert the third historical sensitive word into a sensitive word in pinyin form, and construct a pinyin sensitive word database based on the sensitive words in pinyin form using a multi-pattern matching algorithm;
[0015] The second text sensitive word library and the pinyin sensitive word library are used to detect sensitive words on the first text using a multi-mode matching algorithm to obtain second sensitive words.
[0016] In one embodiment, the method further comprises:
[0017] If an update instruction for the sensitive word database is received, or it is detected that the sensitive word database is updated, the second text sensitive word database and the pinyin sensitive word database are updated;
[0018] If the first sensitive word sent by the client is received, the first text sensitive word library is updated according to the sensitive word hit rate of the first sensitive word, and the second text sensitive word library is updated based on the updated first text sensitive word library.
[0019] In a second aspect, the present application also provides a sensitive word filtering method, which is applied to a client, and the method includes:
[0020] Get the first text;
[0021] Performing high-frequency sensitive word detection on the first text in real time to obtain a first sensitive word in the first text;
[0022] When the first text has not been updated for a preset period of time, the first text is sent to the server to instruct the server to perform sensitive word detection on the first text using a multi-mode matching algorithm to obtain a second sensitive word;
[0023] Obtaining the second sensitive word returned by the server;
[0024] The first text is filtered based on the first sensitive word and the second sensitive word to obtain a target text.
[0025] In a third aspect, the present application also provides a sensitive word filtering system, the system comprising a client and a server;
[0026] The client is used to obtain a first text, perform high-frequency sensitive word detection on the first text in real time, obtain a first sensitive word in the first text, and send the first text to the server when the first text has not been updated for a preset time.
[0027] The server is used to detect sensitive words on the first text using a multi-mode matching algorithm to obtain a second sensitive word, and return the second sensitive word to the client;
[0028] The client is also used to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text.
[0029] In a fourth aspect, the present application further provides a sensitive word filtering device, which is applied to a server, and the device includes:
[0030] A text acquisition module, used for acquiring a first text sent by a client; the first text is sent by the client to the server when the first text has not been updated for a preset time period;
[0031] A sensitive word detection module is used to use a multi-mode matching algorithm to perform sensitive word detection on the first text to obtain a second sensitive word, and return the second sensitive word to the client to instruct the client to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text. The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time.
[0032] In a fifth aspect, the present application further provides a sensitive word filtering device, which is applied to a client, and the device includes:
[0033] A text acquisition module, used for acquiring a first text;
[0034] A sensitive word detection module, used to perform high-frequency sensitive word detection on the first text in real time to obtain a first sensitive word in the first text;
[0035] A text sending module, configured to send the first text to a server when the first text has not been updated for a preset period of time, so as to instruct the server to perform sensitive word detection on the first text using a multi-mode matching algorithm to obtain a second sensitive word;
[0036] A second sensitive word acquisition module, used to acquire the second sensitive word returned by the server;
[0037] A filtering processing module is used to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text.
[0038] In a sixth aspect, the present application further 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 sensitive word filtering method when executing the computer program.
[0039] In a seventh aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the sensitive word filtering method are implemented.
[0040] In an eighth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the sensitive word filtering method when executed by a processor.
[0041] The above-mentioned sensitive word filtering method, system, device, computer equipment, computer-readable storage medium and computer program product obtain a first text sent by a client, and the first text is sent by the client to a server when the length of time that the first text has not been updated reaches a preset length of time; a multi-mode matching algorithm is used to detect sensitive words in the first text to obtain a second sensitive word, and the second sensitive word is returned to the client to instruct the client to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text. The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time, and real-time filtering of sensitive words can be realized in the client, thereby improving the efficiency of sensitive word filtering. At the same time, a more comprehensive sensitive word filtering detection is performed on the server to avoid missed detection and improve the accuracy of sensitive word filtering. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 This is an application environment diagram of a sensitive word filtering method in an embodiment;
[0044] Figure 2 The figure is a flowchart of a sensitive word filtering method in one embodiment;
[0045] Figure 3 A schematic diagram of a sensitive word filtering method in another embodiment;
[0046] Figure 4 A schematic diagram of a data structure of a prefix tree in one embodiment;
[0047] Figure 5 A schematic diagram of a data structure of a compressed prefix tree in one embodiment;
[0048] Figure 6 is a schematic diagram of an AC automaton algorithm in one embodiment;
[0049] Figure 7 A schematic diagram of updating a sensitive word library in one embodiment;
[0050] Figure 8 A schematic diagram of a sensitive word filtering method in another embodiment;
[0051] Fig. 9 is a structural block diagram of a sensitive word filtering device in an embodiment;
[0052] Fig.10 is a structural block diagram of a sensitive word filtering device in another embodiment;
[0053] Fig.11 This is an internal structure diagram of a server in one embodiment;
[0054] Fig.12 FIG. 4 is a diagram showing the internal structure of a client in one embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] The sensitive word filtering method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the client 102 communicates with the server 104 through the network. The data storage system can store the data that the service client 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the client 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0057] In an exemplary embodiment, Figure 2 As shown, a sensitive word filtering method is provided, which is applied to Figure 1 The client in the example is used to illustrate, including the following steps 202 to 210. Among them:
[0058] Step 202, obtaining a first text.
[0059] The first text is the text input by the user in real time in the client, and the first text may include at least one of characters, pinyin, letters, etc.
[0060] Optionally, the client obtains the first text in real time.
[0061] Step 204: Perform high-frequency sensitive word detection on the first text in real time to obtain the first sensitive word in the first text.
[0062] The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time.
[0063] Optionally, the first sensitive word in the first text is detected for high-frequency sensitive words in real time through a first text sensitive word library, where the server obtains the first historical sensitive word from a sensitive word database, constructs the first text sensitive word library based on the first historical sensitive word using a compressed prefix tree algorithm and the hit frequency of the sensitive word, and sends the first text sensitive word library to the client.
[0064] It is understandable that the client has very little memory resources available. If the prefix tree is directly used to construct the prefix tree, it will occupy too much memory, or the constructed sensitive word library will contain too few sensitive words, resulting in poor results. Therefore, the first text sensitive word library constructed occupies less memory and contains a large number of sensitive words.
[0065] Optionally, the client performs regular filtering on the first text to obtain a second text; performs high-frequency sensitive word detection on the second text in real time to obtain a first sensitive word in the second text; when the length of time that the second text has not been updated reaches a preset length of time, the second text is sent to the server to instruct the server to perform sensitive word detection on the second text using a multi-mode matching algorithm to obtain a second sensitive word; obtains the second sensitive word returned by the server, and filters the second text based on the first sensitive word and the second sensitive word to obtain a target text.
[0066] It is understandable that the main purpose of the client performing regular filtering on the first text is to filter out some special symbols. For example, in order to avoid sensitive word detection, some texts mix special symbols between sensitive words to interfere with the detection of sensitive words. Therefore, performing regular filtering on the first text and then performing sensitive word filtering can improve the accuracy of sensitive word filtering.
[0067] Step 206: When the time period during which the first text has not been updated reaches a preset time period, the first text is sent to the server to instruct the server to perform sensitive word detection on the first text using a multi-mode matching algorithm to obtain a second sensitive word.
[0068] The preset duration can be set as needed, such as 1 second or more than 1 second. The multi-pattern matching can be an AC automaton algorithm, a Wu-Manber algorithm, a Set Horspool algorithm, or a Multi-BNDM algorithm (Multiple BackwardNondeterministic DAWG Matching). The AC automaton (Aho-Corasick Automaton) algorithm is a multi-pattern string matching algorithm used to quickly find multiple pattern strings in a text. It constructs a finite automaton and uses a failure pointer to efficiently handle string matching problems. It is suitable for handling a large number of patterns and is widely used in scenarios such as text search and data filtering.
[0069] Optionally, when the first text is not updated, the client counts the time period during which the first text is not updated, and sends the first text to the server when the time period reaches a preset time period.
[0070] Optionally, the first text is sent to the server via a persistent connection between the client and the server. A persistent connection means that multiple data packets can be sent continuously on a connection, and if no data packet is sent during the connection, both parties need to send a link detection packet to maintain the connection.
[0071] Step 208, obtaining the second sensitive word returned by the server.
[0072] The second sensitive word is obtained by the server performing sensitive word detection on the first text. The client can perform sensitive word detection on the first text in real time, and the server can perform comprehensive sensitive word detection on the first text.
[0073] Optionally, the second sensitive word returned by the server is obtained through a long connection between the client and the server.
[0074] Step 210: filter the first text based on the first sensitive word and the second sensitive word to obtain a target text.
[0075] Optionally, the client performs filtering processing on the first sensitive word and the second sensitive word in the first text to obtain the target text, wherein the filtering processing may be a deletion processing, a prompt processing, a text replacement processing, etc., but is not limited thereto.
[0076] In this embodiment, a first text is obtained, and a high-frequency sensitive word detection is performed on the first text in real time to obtain a first sensitive word in the first text; when the length of time during which the first text has not been updated reaches a preset length of time, the first text is sent to the server to instruct the server to perform sensitive word detection on the first text using a multi-mode matching algorithm to obtain a second sensitive word; the second sensitive word returned by the server is obtained, and then, based on the first sensitive word and the second sensitive word, the first text is filtered to obtain a target text, which can realize real-time filtering of sensitive words in the client, thereby improving the efficiency of sensitive word filtering, and at the same time, performing more comprehensive sensitive word filtering detection on the server to avoid missed detection and improve the accuracy of sensitive word filtering.
[0077] In an exemplary embodiment, Figure 3 As shown, a sensitive word filtering method is provided, which is applied to Figure 1 The server in the example is used to illustrate, including the following steps 302 to 304. Among them:
[0078] Step 302, obtaining a first text sent by the client; the first text is sent by the client to the server when the time period during which the first text has not been updated reaches a preset time period.
[0079] Optionally, the server obtains the first text sent by the client through a long connection.
[0080] Step 304: Use a multi-pattern matching algorithm to detect sensitive words in the first text, obtain second sensitive words, and return the second sensitive words to the client to instruct the client to filter the first text based on the first sensitive words and the second sensitive words to obtain a target text. The first sensitive words are obtained by the client's real-time high-frequency sensitive word detection of the first text.
[0081] Among them, in computer science, the multi-pattern matching algorithm is a string search algorithm used to match substrings in a finite set of dictionaries within a string of input. The difference between it and ordinary string matching is that it matches all dictionary strings simultaneously. The algorithm has an approximately linear time complexity in the average case, approximately the length of the string plus the number of all matches. However, since all matches need to be found, if each substring matches each other (such as the dictionary being a, aa, aaa, aaaa, and the input string being aaaa), the time complexity of the algorithm will be approximately quadratic to the number of matches.
[0082] Optionally, using a multi-pattern matching algorithm to detect sensitive words in the first text and obtain second sensitive words includes: in the first thread, convert the first text into a two-dimensional pinyin array, perform a depth-first traversal on the two-dimensional pinyin array, and use a pinyin multi-pattern matching algorithm to detect sensitive words in the two-dimensional pinyin array during the depth-first traversal to obtain pinyin sensitive words; in the second thread, perform a sequential traversal on the first text, and use a character multi-pattern matching algorithm to detect sensitive words in the first text during the sequential traversal to obtain character sensitive words; both the pinyin sensitive words and the character sensitive words belong to the second sensitive words.
[0083] The server starts two threads for parallel processing. The two threads include the first thread and the second thread.
[0084] It can be understood that the types of sensitive words mainly include Chinese sensitive words, pinyin sensitive words, Chinese-pinyin mixed sensitive words, similar-shaped character sensitive words, and homophonic different-character sensitive words. Among them, Chinese sensitive words and similar-shaped character sensitive words can be solved by constructing a Chinese sensitive word library, but for those related to pinyin, a pinyin sensitive word library needs to be constructed.
[0085] It is necessary to first convert the first text into pinyin and then filter it through the pinyin sensitive word library. Since many Chinese characters are polyphonic, it is very likely that the conversion of Chinese into pinyin is inaccurate. To avoid this situation, the server converts the first text into a two-dimensional pinyin array, that is, lists all the pronunciations of the first text, and then the first text is converted from a one-dimensional array into a two-dimensional array. For example, [着火了] becomes [[zhao,zhe,zhuo],[huo],[le]]. At the same time, because there is an associated relationship between the characters before and after, a depth-first traversal is adopted.
[0086] To further optimize the algorithm performance, the rule of depth-first traversal is to traverse each value, [[zhao,zhe,zhuo],[huo],[le]] The depth-first traversal order is zhao huo le—>zhe—>zhuo, but the matching problem of the AC automaton algorithm must also be considered. If there is a sensitive word zhe huo le, it will be missed. Therefore, it is necessary to consider the matching of depth-first traversal and AC automaton algorithm at the same time. At this time, the traversal becomes zhao huo le—>zhe huo le—>zhuo huo le, so that all sensitive words can be guaranteed not to be missed.
[0087] Furthermore, if the current value in the two-dimensional pinyin array does not exist in the AC automaton algorithm, and the next value has been traversed, then stop the depth-first traversal to obtain all the pinyin sensitive words. For example, if the value zhe does not exist in the AC automaton algorithm, and huo and le have been traversed, then stop the depth-first traversal. This strategy can reduce a lot of repeated traversals and save a lot of resources for larger first texts.
[0088] In this embodiment, a first text sent by a client is obtained, and the first text is sent by the client to a server when the length of time that the first text has not been updated reaches a preset length of time; a multi-mode matching algorithm is used to detect sensitive words in the first text to obtain a second sensitive word, and the second sensitive word is returned to the client to instruct the client to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text. The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time, and real-time filtering of sensitive words can be achieved in the client, thereby improving the efficiency of sensitive word filtering. At the same time, a more comprehensive sensitive word filtering detection is performed on the server to avoid missed detections and improve the accuracy of sensitive word filtering.
[0089] In one embodiment, the method further includes: obtaining a first historical sensitive word from a sensitive word database, constructing a first text sensitive word library based on the first historical sensitive word using a compressed prefix tree algorithm and a sensitive word hit frequency, and sending the first text sensitive word library to a client to instruct the client to perform high-frequency sensitive word detection on the first text in real time through the first text sensitive word library; obtaining a second historical sensitive word from a sensitive word database, and constructing a second text sensitive word library based on the second historical sensitive word using a multi-mode matching algorithm; the sensitive word hit frequency of the first historical sensitive word is higher than the sensitive word hit frequency of the second historical sensitive word; obtaining a third historical sensitive word from a sensitive word database, converting the third historical sensitive word into a sensitive word in pinyin form, and constructing a pinyin sensitive word library based on the sensitive word in pinyin form using a multi-mode matching algorithm; performing sensitive word detection on the first text using a multi-mode matching algorithm through the second text sensitive word library and the pinyin sensitive word library to obtain a second sensitive word.
[0090] Among them, the sensitive word database is a database for storing sensitive words, the first text sensitive word library is a sensitive word set used by the client to detect high-frequency sensitive words, the second text sensitive word library is a sensitive word set used by the server to detect sensitive words, and the second text sensitive word library and the first sensitive word library do not overlap, and the pinyin sensitive word library is a set containing pinyin sensitive words. The pinyin sensitive word library is a complete pinyin sensitive word library, and the second text sensitive word library is a word library excluding the first text sensitive word library, which is complementary to the first text sensitive word library. The first text sensitive word library is a high-frequency sensitive word library required by the client, the second text sensitive word library is a complete high-frequency sensitive word library required by the server (excluding the high-frequency sensitive word library), and the pinyin sensitive word library is a complete pinyin sensitive word library required by the server (including the pinyin part converted from the first text sensitive word library and the second text sensitive word library). The first historical sensitive word and the second historical sensitive word do not overlap.
[0091] The original data of sensitive words are all stored in the sensitive word database. The administrator has the authority to add and delete it. Changes in the sensitive word database will trigger the server to update the sensitive word database. The server reads data from the database to build a sensitive word database and stores it in the server's memory or redis cache. The client initiates a request to the server to obtain the first text sensitive word database. If the real-time requirements for the sensitive word database are relatively high, the client and the server establish a long connection. When the first text sensitive word database on the server is updated, it is actively pushed to the client.
[0092] Optionally, the server processes the first historical sensitive word using a compressed prefix tree algorithm to obtain the processed first historical sensitive word, and sorts the processed first historical sensitive word according to the sensitive word hit frequency to obtain the sorted first text sensitive word library. The server can sort the sensitive word hit frequency from high to low. The compressed prefix tree algorithm compresses the common prefixes of sensitive words in the prefix tree to the same node.
[0093] It is understandable that on the client side, because the client has very little memory resources, directly using the prefix tree to build the prefix tree will cause too much memory to be occupied, or the constructed sensitive word library contains too few sensitive words, resulting in poor results. On the client side, it is necessary to build a sensitive word library that takes up the least memory and contains the largest number of sensitive words. The compressed prefix tree is a data structure that optimizes the prefix tree. When a parent node has only one child node, the child node will be merged into the parent node, saving space by reducing unnecessary nodes and paths.
[0094] Prefix Tree (Prefix Tree), a data structure used to store string collections, is particularly suitable for efficient string prefix matching operations. It is a tree structure in which each node represents a character and the root node represents an empty character. Each path in the tree represents a string, and each node in the tree stores the character corresponding to the path from the root node to the node. The data structure of the prefix tree is as follows Figure 4 As shown, the data structure of the compressed prefix tree is as follows Figure 5 As shown in the figure, assuming that abcd, abcf, and axyz are sensitive words, you can see that the compressed prefix tree compresses bc into one node. Because sensitive words have many common prefixes, when the number of sensitive words is large, it can save a lot of memory. The construction of the first text sensitive word library is carried out on the server side, and the client can obtain it from the server side at startup or at a fixed time every day, or it can be pushed to the client by the server side through a long connection. There is no need to worry about the complexity of the construction of the first text sensitive word library, and it will not consume the CPU resources of the user where the client is located.
[0095] Optionally, the second historical sensitive word is processed using a multi-pattern matching algorithm to obtain a processed second text sensitive word library.
[0096] On the server side, because the client has already filtered the first text for high-frequency sensitive words, the server side mainly filters other sensitive words on the first text. The server side's filtering is a supplement to the client side. The server side uses the AC automaton algorithm to build the second text sensitive word library. The AC automaton algorithm is also an optimization of the prefix tree. Compared with the prefix tree, the biggest advantage is that a failure pointer is added to each node. Figure 6 As shown. Figure 6In the figure, the dotted line indicates the node's failure pointer. The node without the dotted line has a failure pointer pointing to the root node. When the AC automaton algorithm fails to match a node, it can transfer to other branches containing the same prefix through the failure pointer to continue matching. Assuming that the sensitive words are abdg, def, and bcd, the first text entered by the user is abdef. After traversing the first text entered by the user, abd will match Figure 6 The leftmost node is d, but the next character of the leftmost pattern string is g, which does not match the text entered by the user. The failure pointer of d is transferred to the middle pattern string to continue matching, and finally matches the sensitive word def. The failure pointer greatly reduces the number of matches and improves the matching efficiency.
[0097] A sensitive word database is maintained in the server memory, and the sensitive word database contains historical sensitive words and the sensitive word hit frequencies corresponding to the historical sensitive words. When the first text sensitive word library needs to be updated, the sensitive words in the sensitive word database are sorted according to the sensitive word hit frequencies.
[0098] Optionally, the server will use a multi-pattern matching algorithm to build a pinyin sensitive word library based on sensitive words in pinyin form, and maintain a key-value pair hash table between pinyin and text in the server's memory.
[0099] Using a second text sensitive word library, a multi-mode matching algorithm is used to detect sensitive words on the first text to obtain text sensitive words corresponding to the second text sensitive word library; using a pinyin sensitive word library, a multi-mode matching algorithm is used to detect sensitive words on the first text to obtain pinyin sensitive words; matching the pinyin sensitive words with the key-value pair hash table to determine the text sensitive words corresponding to the pinyin sensitive words; the text sensitive words corresponding to the second text sensitive word library and the text sensitive words corresponding to the pinyin sensitive words both belong to the second sensitive words.
[0100] Optionally, the above method also includes: if an update instruction for the sensitive word library is received, or an update of the sensitive word database is detected, the second text sensitive word library and the pinyin sensitive word library are updated; if a first sensitive word sent by the client is received, the first text sensitive word library is updated according to the sensitive word hit rate of the first sensitive word, and the second text sensitive word library is updated based on the updated first text sensitive word library.
[0101] like Figure 7As shown, the server memory stores three kinds of sensitive word databases in total. There are two main update strategies for the pinyin sensitive word database and the second text sensitive word database constructed by the AC automaton algorithm. One is that the administrator actively triggers the server to re-read the sensitive word data in the sensitive word database and uses the AC automaton algorithm to update the pinyin sensitive word database and the second text sensitive word database. The other is to monitor the sensitive word database. If the sensitive word database is updated, the server is triggered to update the pinyin sensitive word database and the second text sensitive word database according to the algorithm.
[0102] The first text sensitive word library is updated according to the sensitive word hit frequency. The client and the server establish a long connection. If the sensitive word hit rate of the first historical sensitive word changes, the first text sensitive word library is updated according to the sensitive word hit frequency, and then the server pushes the updated first text sensitive word library to the client. At the same time, the second text sensitive word library also needs to be added or deleted, because the second text sensitive word library and the first text sensitive word library are complementary.
[0103] Optionally, the sensitive words are sorted by hit rate, and the second historical sensitive words are screened out based on the sorted sensitive words. For example, the top sensitive words are transferred to the first text sensitive word library (if they did not exist before), and some sensitive words with low hit rates are removed from the first text sensitive word library.
[0104] Optionally, when sending the first text to the server, the client sends the first sensitive word to the server together. The server counts the sensitive word hit frequency of the first sensitive word and constructs a first text sensitive word library according to the sensitive word hit frequency.
[0105] The update frequency of the first text sensitive word library can be set according to the business. For example, the first text sensitive word library can be updated every 24 hours according to the frequency of sensitive word hits, and the client can be set to obtain the first text sensitive word library from the server at a scheduled time. To further improve performance, the server can compress the first text sensitive word library and send it to the client. The client decompresses it after receiving it, which can greatly reduce the space occupied by the first text sensitive word library during network transmission.
[0106] In this embodiment, the problem of polyphones being difficult to filter in pinyin-sensitive words is solved by converting polyphones into pinyin arrays, traversing them using a deep traversal method, and proposing conditions for stopping the traversal in combination with a multi-pattern matching algorithm, thereby minimizing repeated traversal of the text.
[0107] Dynamically update the sensitive word library strategy, count the hit frequency of sensitive words, dynamically update the high-frequency sensitive word library and the text sensitive word library according to the hit frequency of sensitive words, and monitor the database that stores the original data of sensitive words at the same time. When the database is updated, it triggers the update of the pinyin sensitive word library and the text sensitive word library, which can update the sensitive word library more quickly and conveniently.
[0108] In one embodiment, Figure 8 As shown, the client performs regular filtering on the first text to obtain the second text, and then uses the compressed prefix tree to detect high-frequency sensitive words in the second text in real time to obtain the first sensitive word in the second text; when the time when the second text has not been updated reaches a preset time, the second text and the first sensitive word are sent to the server.
[0109] In the first thread, the server converts the second text into a two-dimensional pinyin array, performs a depth-first traversal on the two-dimensional pinyin array, and uses the pinyin AC automaton algorithm to detect sensitive words on the two-dimensional pinyin array during the depth-first traversal to obtain pinyin sensitive words; in the second thread, the server performs a sequential traversal on the second text, and uses the text AC automaton algorithm to detect sensitive words on the second text during the sequential traversal to obtain text sensitive words, both pinyin sensitive words and text sensitive words belong to the second sensitive words; and returns the second sensitive words to the client.
[0110] The client performs filtering processing on the first text based on the first sensitive word and the second sensitive word to obtain a target text.
[0111] The server counts the sensitive word hit frequency of each sensitive word in the first sensitive word and the second sensitive word, and dynamically updates the sensitive word library according to the sensitive word hit frequency of each sensitive word; the administrator can also update the sensitive word library; when the sensitive word database is updated, the sensitive word library can also be updated.
[0112] In this embodiment, regular filtering and compressed prefix tree algorithm are used as the filtering algorithm of the first text. The prefix tree is a tree data structure for storing and retrieving character strings. The time complexity of its search and insertion is o(m), where m is the length of the character string to be queried or inserted. The query and insertion efficiency are very high. Different prefix tree variant algorithms are used to build sensitive word libraries on the client and server. The client mainly builds a high-frequency and memory-saving sensitive word library (first text sensitive word library) to achieve real-time filtering of user input text. The server mainly builds a sensitive word library that can cover all sensitive words (second text sensitive word library and pinyin sensitive word library) to achieve complete filtering of user input text and avoid omissions. Since the service is mainly deployed on the server, the memory resources are relatively abundant. The filtering algorithm on the server mainly considers the factors of completeness and speed, and does not need to save memory excessively.
[0113] In one embodiment, a sensitive word filtering system is provided, and the system includes a client and a server; the client is used to obtain a first text, perform high-frequency sensitive word detection on the first text in real time, obtain a first sensitive word in the first text, and when the length of time that the first text has not been updated reaches a preset length of time, the first text is sent to the server; the server is used to perform sensitive word detection on the first text using a multi-mode matching algorithm, obtain a second sensitive word, and return the second sensitive word to the client; the client is also used to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text.
[0114] Optionally, the server is also used to, in the first thread, convert the first text into a two-dimensional Pinyin array, perform a depth-first traversal on the two-dimensional Pinyin array, and use a Pinyin multi-pattern matching algorithm to perform sensitive word detection on the two-dimensional Pinyin array during the depth-first traversal to obtain Pinyin sensitive words; in the second thread, perform a sequential traversal on the first text, and use a multi-pattern matching algorithm to perform sensitive word detection on the first text during the sequential traversal to obtain text sensitive words; both Pinyin sensitive words and text sensitive words belong to the second sensitive words.
[0115] Optionally, the server is also used to obtain a first historical sensitive word from the sensitive word database, construct a first text sensitive word library based on the first historical sensitive word using a compressed prefix tree algorithm and a sensitive word hit frequency, and send the first text sensitive word library to the client to instruct the client to perform high-frequency sensitive word detection on the first text in real time through the first text sensitive word library; obtain a second historical sensitive word from the sensitive word database, and construct a second text sensitive word library based on the second historical sensitive word using a multi-mode matching algorithm; the sensitive word hit frequency of the first historical sensitive word is higher than the sensitive word hit frequency of the second historical sensitive word; obtain a third historical sensitive word from the sensitive word database, convert the third historical sensitive word into a sensitive word in pinyin form, and construct a pinyin sensitive word library based on the sensitive word in pinyin form using a multi-mode matching algorithm; perform sensitive word detection on the first text using the second text sensitive word library and the pinyin sensitive word library using a multi-mode matching algorithm to obtain a second sensitive word.
[0116] Optionally, if the server receives an update instruction for the sensitive word library, or detects that the sensitive word database is updated, the second text sensitive word library and the pinyin sensitive word library are updated; if the server receives the first sensitive word sent by the client, the first text sensitive word library is updated according to the sensitive word hit rate of the first sensitive word, and the second text sensitive word library is updated based on the updated first text sensitive word library.
[0117] The sensitive word filtering system uses a compressed prefix tree and a multi-mode matching algorithm on the client and server to filter the text input by the user. The client uses the compressed prefix tree to build a high-frequency sensitive word library (first text sensitive word library) that occupies very little memory, and filters the text input by the user in real time, and prompts the user in real time whether there are sensitive words. A complete sensitive word library (second text sensitive word library) is built on the server through a multi-mode matching algorithm. When the user pauses for 1 second or more when entering text, the client sends the text to the server for filtering. The client and the server use different schemes to filter the text, which can greatly improve the efficiency of sensitive word filtering for the text. A pinyin sensitive word library is built, and the target string with polyphonic characters is traversed through depth-first traversal. The traversal stop condition is proposed in combination with the multi-mode matching algorithm, which minimizes the problem of repeated traversal and filters the sensitive words mixed with Chinese and pinyin efficiently and accurately. The sensitive words are persisted to the database, and the sensitive word library is dynamically updated according to the hit frequency of the sensitive words to ensure that the sensitive word library loaded into the memory is always the high-frequency sensitive words. It realizes filtering of multiple types of sensitive words, including Chinese sensitive words, Pinyin sensitive words, Chinese Pinyin mixed sensitive words, sensitive words with similar characters, and sensitive words with the same pronunciation but different characters.
[0118] The sensitive word filtering system solves the problem that sensitive word filtering algorithms are all implemented on the server side, resulting in poor real-time filtering effect or slow filtering speed; it solves the problem that texts with polyphones are difficult to filter accurately in scenarios where Chinese and pinyin are mixed; it dynamically updates the sensitive word library based on the frequency of occurrence of sensitive words, solving the problem that the sensitive word library cannot be updated in time and improving the efficiency of sensitive word filtering.
[0119] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0120] Based on the same inventive concept, the embodiment of the present application also provides a sensitive word filtering device for implementing the sensitive word filtering method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more sensitive word filtering device embodiments provided below can refer to the limitations of the sensitive word filtering method above, and will not be repeated here.
[0121] In an exemplary embodiment, Fig. 9 As shown, a sensitive word filtering device is provided, which is applied to a server. The sensitive word filtering device includes: a text acquisition module 902 and a sensitive word detection module 904, wherein:
[0122] The text acquisition module 902 is used to acquire a first text sent by the client; the first text is sent by the client to the server when the time period during which the first text has not been updated reaches a preset time period;
[0123] The sensitive word detection module 904 is used to use a multi-mode matching algorithm to perform sensitive word detection on the first text, obtain a second sensitive word, and return the second sensitive word to the client to instruct the client to filter the first text based on the first sensitive word and the second sensitive word to obtain the target text. The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time.
[0124] The above-mentioned sensitive word filtering device obtains a first text sent by a client, and the first text is sent by the client to a server when the length of time that the first text has not been updated reaches a preset length of time; uses a multi-mode matching algorithm to perform sensitive word detection on the first text to obtain a second sensitive word, and returns the second sensitive word to the client to instruct the client to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text. The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time, and real-time filtering of sensitive words can be achieved in the client, thereby improving the efficiency of sensitive word filtering. At the same time, a more comprehensive sensitive word filtering detection is performed on the server to avoid missed detection and improve the accuracy of sensitive word filtering.
[0125] In one embodiment, the sensitive word detection module 904 is also used to convert the first text into a two-dimensional pinyin array in the first thread, perform a depth-first traversal on the two-dimensional pinyin array, and use a pinyin multi-pattern matching algorithm to perform sensitive word detection on the two-dimensional pinyin array during the depth-first traversal to obtain pinyin sensitive words; in the second thread, perform a sequential traversal on the first text, and use a multi-pattern matching algorithm to perform sensitive word detection on the first text during the sequential traversal to obtain text sensitive words; both pinyin sensitive words and text sensitive words belong to the second sensitive words.
[0126] In one embodiment, the device further includes a sensitive word library construction module, which is used to obtain a first historical sensitive word from a sensitive word database, construct a first text sensitive word library based on the first historical sensitive word using a compressed prefix tree algorithm and a sensitive word hit frequency, and send the first text sensitive word library to a client to instruct the client to perform high-frequency sensitive word detection on the first text in real time through the first text sensitive word library; obtain a second historical sensitive word from the sensitive word database, and construct a second text sensitive word library based on the second historical sensitive word using a multi-mode matching algorithm; the sensitive word hit frequency of the first historical sensitive word is higher than the sensitive word hit frequency of the second historical sensitive word; obtain a third historical sensitive word from the sensitive word database, convert the third historical sensitive word into a sensitive word in pinyin form, and construct a pinyin sensitive word library based on the sensitive word in pinyin form using a multi-mode matching algorithm; the sensitive word detection module 904 is also used to perform sensitive word detection on the first text using a second text sensitive word library and a pinyin sensitive word library using a multi-mode matching algorithm to obtain a second sensitive word.
[0127] In one embodiment, the above-mentioned device also includes a sensitive word library update module, which is used to update the second text sensitive word library and the pinyin sensitive word library if an update instruction for the sensitive word library is received or an update of the sensitive word database is detected; if a first sensitive word sent by the client is received, the first text sensitive word library is updated according to the sensitive word hit rate of the first sensitive word, and the second text sensitive word library is updated based on the updated first text sensitive word library.
[0128] In an exemplary embodiment, Fig.10 As shown, a sensitive word filtering device is provided, which is applied to a client. The sensitive word filtering device includes: a text acquisition module 1002, a sensitive word detection module 1004, a text sending module 1006, a second sensitive word acquisition module 1008 and a filtering processing module 1010, wherein:
[0129] The text acquisition module 1002 is used to acquire a first text;
[0130] The sensitive word detection module 1004 is used to perform high-frequency sensitive word detection on the first text in real time to obtain a first sensitive word in the first text;
[0131] The text sending module 1006 is used to send the first text to the server when the time period during which the first text has not been updated reaches a preset time period, so as to instruct the server to perform sensitive word detection on the first text using a multi-mode matching algorithm to obtain a second sensitive word;
[0132] The second sensitive word acquisition module 1008 is used to acquire the second sensitive word returned by the server;
[0133] The filtering processing module 1010 is used to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text.
[0134] The above-mentioned sensitive word filtering device obtains a first text, performs high-frequency sensitive word detection on the first text in real time, and obtains a first sensitive word in the first text; when the length of time that the first text has not been updated reaches a preset length of time, the first text is sent to the server to instruct the server to use a multi-mode matching algorithm to perform sensitive word detection on the first text to obtain a second sensitive word; the second sensitive word returned by the server is obtained, and then, based on the first sensitive word and the second sensitive word, the first text is filtered and processed to obtain a target text, which can realize real-time filtering of sensitive words in the client, thereby improving the efficiency of sensitive word filtering, and at the same time, a more comprehensive sensitive word filtering detection is performed on the server to avoid missed detection and improve the accuracy of sensitive word filtering.
[0135] Each module in the above sensitive word filtering device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0136] In an exemplary embodiment, a computer device is provided. The computer device may be a server. The internal structure diagram thereof may be as shown in FIG. Fig.11 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store sensitive word data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, a sensitive word filtering method is implemented.
[0137] In an exemplary embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Fig.12As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external client in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a sensitive word filtering method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0138] Those skilled in the art will understand that Fig.11 and Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0139] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0140] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0141] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0142] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0143] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0145] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A sensitive word filtering method, characterized in that: Applied to the server, the method includes: Acquire a first text sent by a client; the first text is sent by the client to the server when the first text has not been updated for a preset time period; A multi-pattern matching algorithm is used to detect sensitive words in the first text to obtain a second sensitive word, and the second sensitive word is returned to the client to instruct the client to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text. The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time.
2. The method according to claim 1, characterized in that The step of detecting sensitive words on the first text using a multi-pattern matching algorithm to obtain a second sensitive word includes: In the first thread, the first text is converted into a two-dimensional pinyin array, a depth-first traversal is performed on the two-dimensional pinyin array, and a pinyin multi-pattern matching algorithm is used to perform sensitive word detection on the two-dimensional pinyin array during the depth-first traversal to obtain pinyin sensitive words; In the second thread, the first text is sequentially traversed, and during the sequential traversal, a text multi-pattern matching algorithm is used to detect sensitive words in the first text to obtain text sensitive words; the pinyin sensitive words and the text sensitive words both belong to second sensitive words.
3. The method according to claim 1, characterized in that The method further comprises: Acquire a first historical sensitive word from a sensitive word database, construct a first text sensitive word library based on the first historical sensitive word by using a compressed prefix tree algorithm and a sensitive word hit frequency, and send the first text sensitive word library to the client to instruct the client to perform high-frequency sensitive word detection on the first text in real time by using the first text sensitive word library; Acquire a second historical sensitive word from the sensitive word database, and construct a second text sensitive word library based on the second historical sensitive word using a multi-pattern matching algorithm; the sensitive word hit frequency of the first historical sensitive word is higher than the sensitive word hit frequency of the second historical sensitive word; Acquire a third historical sensitive word from the sensitive word database, convert the third historical sensitive word into a sensitive word in pinyin form, and construct a pinyin sensitive word database based on the sensitive words in pinyin form using a multi-pattern matching algorithm; The second text sensitive word library and the pinyin sensitive word library are used to detect sensitive words on the first text using a multi-mode matching algorithm to obtain second sensitive words.
4. The method according to claim 3, characterized in that The method further comprises: If an update instruction for the sensitive word database is received, or it is detected that the sensitive word database is updated, the second text sensitive word database and the pinyin sensitive word database are updated; If the first sensitive word sent by the client is received, the first text sensitive word library is updated according to the sensitive word hit rate of the first sensitive word, and the second text sensitive word library is updated based on the updated first text sensitive word library.
5. A sensitive word filtering method, characterized in that: Applied to a client, the method comprises: Get the first text; Performing high-frequency sensitive word detection on the first text in real time to obtain a first sensitive word in the first text; When the first text has not been updated for a preset period of time, the first text is sent to the server to instruct the server to perform sensitive word detection on the first text using a multi-mode matching algorithm to obtain a second sensitive word; Obtaining the second sensitive word returned by the server; The first text is filtered based on the first sensitive word and the second sensitive word to obtain a target text.
6. A sensitive word filtering system, characterized in that: The system includes a client and a server; The client is used to obtain a first text, perform high-frequency sensitive word detection on the first text in real time, obtain a first sensitive word in the first text, and send the first text to the server when the first text has not been updated for a preset time. The server is used to detect sensitive words on the first text using a multi-mode matching algorithm to obtain a second sensitive word, and return the second sensitive word to the client; The client is also used to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text.
7. A sensitive word filtering device, characterized in that: Applied to the server, the device comprises: A text acquisition module, used for acquiring a first text sent by a client; the first text is sent by the client to the server when the first text has not been updated for a preset time period; A sensitive word detection module is used to use a multi-mode matching algorithm to perform sensitive word detection on the first text to obtain a second sensitive word, and return the second sensitive word to the client to instruct the client to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text. The first sensitive word is obtained by the client performing high-frequency sensitive word detection on the first text in real time.
8. A sensitive word filtering device, characterized in that: Applied to a client, the device comprises: A text acquisition module, used for acquiring a first text; A sensitive word detection module, used to perform high-frequency sensitive word detection on the first text in real time to obtain a first sensitive word in the first text; A text sending module, configured to send the first text to a server when the first text has not been updated for a preset period of time, so as to instruct the server to perform sensitive word detection on the first text using a multi-mode matching algorithm to obtain a second sensitive word; A second sensitive word acquisition module, used to acquire the second sensitive word returned by the server; A filtering processing module is used to filter the first text based on the first sensitive word and the second sensitive word to obtain a target text.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Cited By
Instant secret-related information detection method and system based on IM software multi-modal feature fusion
CN120180435A