Text sensitive word recognition method and related device
By constructing a memory structure of a double-array AC automaton during service initialization, the problem of low recognition efficiency for large-scale sensitive word databases is solved, achieving fast and accurate text sensitive word recognition.
Patent Information
- Application Number
- CN202511465349.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-14
- Publication Date
- 2025-11-28
Smart Images

Figure CN121031592A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software, in particular to a text sensitive word recognition method and related device. BACKGROUND
[0002] With the rapid development of the Internet, users can edit and upload text in forums, websites and applications, etc. Therefore, text sensitive word recognition is an important means to ensure the network environment.
[0003] At present, the text sensitive word recognition scheme usually recognizes sensitive words in the input text through a sensitive word library. However, since the sensitive word library is usually stored in the hard disk, it cannot quickly and accurately recognize sensitive words when the data volume of the sensitive word library is large. SUMMARY
[0004] In view of the above problems, the present application provides a text sensitive word recognition method and related device to quickly and accurately recognize sensitive words in the text. The specific scheme is as follows:
[0005] The first aspect of the present application provides a text sensitive word recognition method, which comprises:
[0006] obtaining the input text of the target service;
[0007] calling a double-array AC automaton, which is a memory structure for storing each sensitive word in the sensitive word library constructed when the target service is initialized;
[0008] matching the input text with the stored memory structure through the double-array AC automaton to obtain the sensitive word recognition result of the input text.
[0009] In a possible implementation, the memory structure includes the sensitive word, and the type and level of the sensitive word;
[0010] The matching of the input text with the stored memory structure through the double-array AC automaton to obtain the sensitive word recognition result of the input text comprises:
[0011] obtaining the target type corresponding to the input text;
[0012] matching the input text with at least one sensitive word belonging to the target type through the double-array AC automaton to obtain the target sensitive word hit by the input text;
[0013] disposing the input text according to the level of the target sensitive word.
[0014] In a possible implementation, the sensitive word library further contains the respective positive words of a plurality of sensitive words.
[0015] The processing of the input text according to the level of the target sensitive word includes:
[0016] If the positive word of the target sensitive word is contained in the sensitive word library, the positive word of the target sensitive word is used to replace the target sensitive word in the input text, and the target service responds to the replaced input text;
[0017] If the positive word of the target sensitive word is not contained in the sensitive word library, it is judged whether the level of the target sensitive word meets the ban condition;
[0018] If the level of the target sensitive word meets the ban condition, the target service is prohibited from responding to the input text;
[0019] If the level of the target sensitive word does not meet the ban condition, the audit result of the input text is obtained, and whether the target service responds to the input text is controlled according to the audit result.
[0020] In a possible implementation, the type of each sensitive word in the sensitive word library and the positive word of each sensitive word in the plurality of sensitive words are obtained by using a large model for analysis.
[0021] In a possible implementation, the text sensitive word identification method further includes:
[0022] In a case where it is determined that the sensitive word library is in an updating state, the memory structure stored by the double-array AC automaton is updated.
[0023] In a possible implementation, the determination that the sensitive word library is in an updating state includes:
[0024] The updating event of the sensitive word library is listened to through a kafka message, and in a case where the updating event is listened to, it is determined that the sensitive word library is in an updating state.
[0025] The second aspect of the present application provides a text sensitive word identification device, and the text sensitive word identification device includes:
[0026] A text acquisition module is configured to acquire the input text of a target service.
[0027] A text sensitive word identification module is configured to call a double-array AC automaton, the double-array AC automaton is a memory structure for storing each sensitive word in a sensitive word library, and is constructed when the target service is initialized; the input text is matched with the stored memory structure through the double-array AC automaton, so as to obtain the sensitive word identification result of the input text.
[0028] The third aspect of the present application provides a computer program product, comprising computer readable instructions, which, when executed on an electronic device, cause the electronic device to implement the text sensitive word recognition method of the first aspect or any implementation manner of the first aspect.
[0029] The fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0030] The memory is configured to store a computer program;
[0031] The processor is configured to execute the computer program, so that the electronic device can implement the text sensitive word recognition method of the first aspect or any implementation manner of the first aspect.
[0032] The fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs, which, when executed by an electronic device, can cause the electronic device to implement the text sensitive word recognition method of the first aspect or any implementation manner of the first aspect.
[0033] By the above technical solution, the text sensitive word recognition method and related device provided by the present application comprises: obtaining the input text of a target service; calling a double-array AC automaton, which is a memory structure for storing each sensitive word in the sensitive word library constructed when the target service is initialized; and matching the input text with the stored memory structure through the double-array AC automaton to obtain the sensitive word recognition result of the input text. The present application constructs a double-array AC automaton to store the memory structure of the sensitive words in the sensitive word library when the service is initialized, and further automatically matches the input text through the double-array AC automaton to obtain the sensitive word recognition result when the service is called. With the multi-mode matching mode of the double-array AC automaton, the service can be quickly responded when called, without considering the hardware influence of the sensitive word library, greatly improving the efficiency and quality of text sensitive word recognition. BRIEF DESCRIPTION OF DRAWINGS
[0034] The above and other features, advantages, and aspects of the present disclosure will become more apparent by describing in detail the embodiments thereof with reference to the attached drawings. Throughout the drawings, the same or similar reference numerals refer to the same or similar elements. It should be understood that the drawings are schematic, and the original and elements are not necessarily drawn according to the scale.
[0035] Figure 1 A flowchart of a text sensitive word recognition method provided by an embodiment of the present application;
[0036] Figure 2 A partial flowchart of a text sensitive word recognition method provided by an embodiment of the present application;
[0037] Figure 3 A structural schematic diagram of a text sensitive word recognition device provided by an embodiment of the present application is provided.
[0038] Figure 4 A structural schematic diagram of an electronic device provided by an embodiment of the present application is provided. DETAILED DESCRIPTION
[0039] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. The terms used in the embodiment part of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0040] The embodiments of the present application are described below in conjunction with the drawings. It is known to those of ordinary skill in the art that as technology develops and new scenarios appear, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0041] The terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged under appropriate circumstances, and this is only a distinguishing way used in the description of the embodiments of the present application to describe the objects with the same attributes. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, so that the processes, methods, systems, products or devices containing a series of units do not have to be limited to those units, but can include other units that are not clearly listed or inherent to these processes, methods, products or devices.
[0042] Reference is made to Figure 1 , Figure 1 A flowchart of a text sensitive word recognition method provided by an embodiment of the present application is provided. As shown in Figure 1 , the text sensitive word recognition method provided by an embodiment of the present application can include steps S101-S103, which are described in detail below.
[0043] S101, obtaining input text of a target service.
[0044] In the embodiments of the present application, the target service is a service to be executed for text sensitive word recognition. By monitoring the input operation of the user on the target service, the input text of the user can be obtained, which can be a comment to be published in the comment area, can also be a bullet screen to be displayed in the live room, and can also be a private message between users, which is not limited by the embodiments of the present application.
[0045] S102, call the double-array AC automaton, which is a memory structure for storing each sensitive word in the sensitive word library and is constructed when the target service is initialized.
[0046] In the embodiment of the present application, when the target service is initialized, the double-array AC automaton (the English full name of AC automaton is Aho-Corasick automaton) can be constructed by loading sensitive words from the sensitive word library. The traditional AC automaton uses a tree structure to store node information, while the double-array AC automaton compresses the node information stored in the tree structure into two arrays. When constructing the double-array AC automaton for text sensitive word recognition, first, read each sensitive word in the sensitive word library and store it in the respective memory structure in a word segmentation manner. For example, the memory structure can be <single sensitive word, sensitive word auxiliary class>, where the sensitive word auxiliary class is used to represent the attributes of the single sensitive word. Then, construct a binary Trie tree structure with the memory structure of each sensitive word in the sensitive word library, and then compress the binary Trie structure into a double-array structure. Finally, build the fail table and the output table, and finally store the double-array AC automaton in the memory of the target service. Based on this, after obtaining the input text, the above double-array AC automaton can be automatically called.
[0047] It should be noted that the sensitive word library can include a public sensitive word library and a single-class sensitive word library according to categories.
[0048] S103, match the input text with the stored memory structure by the double-array AC automaton to obtain the sensitive word recognition result of the input text.
[0049] In the embodiment of the present application, after the input text is transmitted to the double-array AC automaton, the double-array AC automaton can automatically match the input text with the memory structure stored therein in its multi-modal matching mode to determine the sensitive words hit by the input text. Specifically, the double-array AC automaton first runs the single word group hit logic to determine whether the input text hits the sensitive word composed of a single word group. If so, add a hit mark to the sensitive word hit by the input text and record the start subscript and the end subscript of the sensitive word in the input text. Then, run the multi-word group hit logic to determine whether the input text hits the sensitive word composed of multiple word groups. Only if all the multiple word groups are matched, the sensitive word is hit. If so, add a hit mark to the sensitive word hit by the input text and record the start subscript and the end subscript of the sensitive word in the input text. Finally, integrate all the sensitive words hit by the input text, remove the sensitive words according to the start subscript and the end subscript of the sensitive words, and sort and output the removed sensitive words according to the sensitive word auxiliary class, such as sorting and outputting the sensitive words according to the sensitive word level.
[0050] In one possible implementation, to improve the matching efficiency of the dual-array AC automaton and further increase the speed of sensitive word recognition, the sensitive word auxiliary class in this embodiment can be set as type and level. That is, the memory structure includes the associated sensitive word, as well as the type and level of the associated sensitive word. The type can represent the context of the associated sensitive word (e.g., comment section, bullet comments, private messages, etc.), and the level can represent the sensitivity level of the sensitive word. See also... Figure 2 , Figure 2 This is a partial flowchart illustrating a text-sensitive word recognition method provided in an embodiment of this application. Figure 2 As shown in the embodiment of this application, a text sensitive word recognition method is provided, wherein step S103, "matching the input text with the stored memory structure through a dual-array AC automaton to obtain the sensitive word recognition result of the input text", may include steps S201 to S203, which are described in detail below.
[0051] S201, Obtain the target type corresponding to the input text.
[0052] In this embodiment of the application, the input text can be type-identified to obtain its corresponding type (i.e., target type). For example, the target type corresponding to the input text is a comment, bullet screen, or private message.
[0053] S202, the input text is matched with at least one sensitive word belonging to the target type by a dual-array AC automaton to obtain the target sensitive words matched by the input text.
[0054] In this embodiment, after the input text and its corresponding target type are transmitted to a dual-array AC automaton, the dual-array AC automaton can automatically match the input text with a portion of the memory structure using its multimodal matching mode. The type of the sensitive words belonging to the matched portion of the memory structure is the target type. The dual-array AC automaton then runs its word group matching logic and multi-word group matching logic to determine whether the input text contains a sensitive word of the target type. If it does, a matching flag is added to the sensitive word (i.e., the target sensitive word) in the input text, and the start and end indices of the target sensitive word in the input text are recorded.
[0055] S203, process the input text according to the level of the target sensitive words.
[0056] In this embodiment, after determining the target sensitive word matched by the input text, its level can be obtained from the memory structure of the target sensitive word, and then the input text can be processed according to the level of the target sensitive word. For example, if the level of the target sensitive word is ordinary, the input text can be sent to the backend for manual review. Continuing as an example, if the level of the target sensitive word is prohibited, the user can be directly prompted that their input text does not meet the requirements.
[0057] In one possible implementation, by setting positive words for sensitive words in a sensitive word library, sensitive words in the input text can be automatically replaced with positive words without requiring manual adjustment by the user, thus improving the user experience. In this regard, an embodiment of this application provides a text sensitive word recognition method, wherein the sensitive word library also contains positive words for each of multiple sensitive words. Accordingly, step S203, "processing the input text according to the level of the target sensitive word," may include the following steps:
[0058] If the sensitive word library contains a positive term for the target sensitive word, use the positive term for the target sensitive word to replace the target sensitive word in the input text, and trigger the target service to respond with the replaced input text;
[0059] If the sensitive word database does not contain positive words of the target sensitive word, determine whether the level of the target sensitive word meets the conditions for prohibition.
[0060] If the level of the target sensitive words meets the conditions for blocking, the target service is prohibited from responding to input text;
[0061] If the level of the target sensitive words does not meet the conditions for prohibition, obtain the review result of the input text, and control whether the target service responds to the input text based on the review result.
[0062] In this embodiment of the application, after determining the target sensitive word hit in the input text, it is further determined whether the sensitive word library contains positive words of the target sensitive word.
[0063] If the sensitive word library contains positive words of the target sensitive word, then the target sensitive word will be replaced with the positive words of the target sensitive word in the input text, thereby triggering the target service to respond with the replaced input text. For example, if the input text is a comment, the target service can be triggered to display the replaced input text in the comment section.
[0064] If the sensitive word database does not contain positive terms for the target sensitive word, the system further determines whether the target sensitive word's level meets the prohibition criteria, such as whether the target sensitive word is at the prohibited level. If the target sensitive word's level meets the prohibition criteria, the target service is prohibited from responding to the input text, and the user may be prompted that their input text does not meet the specifications. If the target sensitive word's level does not meet the prohibition criteria, such as the target sensitive word being at the normal or severe level, the input text and its sensitive word identification results can be sent to the backend for manual review by auditors. After receiving the review results from the backend, the system can control the target service to selectively respond to the input text based on the review results. For example, the target service can be triggered to respond to the input text when the review is passed, or the target service can be prohibited from responding to the input text when the review is failed.
[0065] In one possible implementation, the types of each sensitive word in the sensitive word library, as well as the positive words for each of the multiple sensitive words in the library, can be obtained using a large model analysis, thereby improving the efficiency of sensitive word recognition. For example, a sensitive word from the sensitive word library can be input into a large model, which will perform sentiment recognition on the sensitive word and output its type. Of course, if the large model can simultaneously obtain the positive words for the sensitive word after analysis, it can output both the type and the positive words simultaneously. In addition, for sensitive words for which there are no positive words in the sensitive word library, their positive words can be obtained by manually adding them and setting an ignore period. After the ignore period, the positive words can be obtained again through the large model.
[0066] In one possible implementation, to ensure the synchronization between the memory structure stored in the dual-array AC automaton and the sensitive word database, the text sensitive word recognition method provided in this application embodiment further includes the following steps:
[0067] If the sensitive word database is confirmed to be updated, the memory structure stored in the dual-array AC automaton is updated.
[0068] In this embodiment, real-time Kafka can be used to monitor whether the sensitive word database is updated. If it is determined that the sensitive words are in an updated state, the memory results of each sensitive word in the sensitive word database are re-stored into the double-array AC automaton, thereby achieving synchronization between the memory structure of the double-array AC automaton and the sensitive word database.
[0069] In one possible implementation, different update events can be set for the sensitive word database. By monitoring these update events in real-time using Kafka, it can be determined promptly whether the sensitive word database has been updated, thereby reducing the sensitive word recognition time. In this regard, an embodiment of this application provides a text sensitive word recognition method, wherein determining that the sensitive word database is in an updated state includes:
[0070] The system listens for updates to the sensitive word database via Kafka messages and determines that the database is being updated upon receiving an update notification.
[0071] In this embodiment of the application, the update event of the sensitive word library may include events such as the addition or deletion of sensitive words by operators, the timed offline traversal of the sensitive word library, and the web crawling of new sensitive words. After listening to the update event of the sensitive word library, it can be determined that the sensitive word library is in an update state, and then the memory structure stored by the dual-array AC automaton is updated.
[0072] Specifically, when operators add or delete sensitive words in the sensitive word database, Kafka event listeners can determine the added or deleted sensitive words, thereby increasing the memory structure of added sensitive words and removing the memory structure of deleted sensitive words, causing the dual-array AC automaton to update its stored memory structure. The system automatically traverses the sensitive words in the database, using multiple platforms to determine whether a sensitive word still falls within the sensitive word range. Sensitive words that no longer fall within the range are deleted, while those that still fall within the range are retained. This process removes the memory structure of deleted sensitive words, causing the dual-array AC automaton to update its stored memory structure. Furthermore, by setting start and end times for the sensitive word capture system to perform full-network capture, and after regular expression filtering, the data is submitted to the backend for review. This filters out valid new sensitive words and adds them to the sensitive word database, adding the memory structure of new sensitive words, causing the dual-array AC automaton to update its stored memory structure.
[0073] Based on the above description, the text sensitive word recognition method provided in this application embodiment can quickly respond to service calls by using the multi-mode matching mode of the dual-array AC automaton, without considering the hardware impact of the sensitive word library, thus greatly improving the efficiency and quality of text sensitive word recognition.
[0074] The above describes a text sensitive word recognition method provided by the embodiments of this application. The following describes the apparatus for performing the above text sensitive word recognition method.
[0075] See Figure 3 , Figure 3 This is a schematic diagram of the structure of a text sensitive word recognition device provided in an embodiment of this application. Figure 3 As shown in the figure, an embodiment of this application provides a text sensitive word recognition device, comprising:
[0076] Text acquisition module 301 is used to acquire the input text of the target service;
[0077] The text sensitive word recognition module 302 is used to call the double-array AC automaton. The double-array AC automaton is a memory structure constructed during the initialization of the target service to store each sensitive word in the sensitive word library. The input text is matched with the stored memory structure through the double-array AC automaton to obtain the sensitive word recognition result of the input text.
[0078] In one possible implementation, the memory structure includes the associated sensitive word, as well as the type and level of the associated sensitive word;
[0079] The text sensitive word recognition module 302, used to match the input text with the stored memory structure using a dual-array AC automaton to obtain the sensitive word recognition result of the input text, is specifically used for:
[0080] Obtain the target type corresponding to the input text; use a double-array AC automaton to match the input text with at least one sensitive word belonging to the target type to obtain the target sensitive words matched by the input text; process the input text according to the level of the target sensitive words.
[0081] In one possible implementation, the sensitive word library also contains positive terms for each of the multiple sensitive words;
[0082] The text sensitive word recognition module 302, used to process input text according to the level of target sensitive words, is specifically used for:
[0083] If the sensitive word library contains a positive term for the target sensitive word, use the positive term to replace the target sensitive word in the input text, and trigger the target service to respond with the replaced input text. If the sensitive word library does not contain a positive term for the target sensitive word, determine whether the level of the target sensitive word meets the blocking conditions. If the level of the target sensitive word meets the blocking conditions, prohibit the target service from responding to the input text. If the level of the target sensitive word does not meet the blocking conditions, obtain the review result of the input text, and control whether the target service responds to the input text based on the review result.
[0084] In one possible implementation, the types of each sensitive word in the sensitive word library, as well as the positive words of each of the multiple sensitive words, are obtained using large model analysis.
[0085] In one possible implementation, the text sensitive word recognition module 302 is also used for:
[0086] If the sensitive word database is confirmed to be updated, the memory structure stored in the dual-array AC automaton is updated.
[0087] In one possible implementation, the text sensitive word recognition module 302, used to determine whether the sensitive word library is in an updated state, is specifically used for:
[0088] The system listens for updates to the sensitive word database via Kafka messages and determines that the database is being updated upon receiving an update notification.
[0089] It should be noted that the detailed functions of each module in the embodiments of this application can be found in the corresponding disclosure of the above-mentioned text sensitive word recognition method embodiments, and will not be repeated here.
[0090] This application also provides an electronic device in its embodiments. See also... Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device in this embodiment may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc.Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0091] like Figure 4 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. When the electronic device is powered on, the RAM 403 also stores various programs and data required for the operation of the electronic device. The processing unit 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0092] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, memory cards, hard drives, etc.; and communication devices 409. Communication device 409 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0093] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the text sensitive word recognition methods provided in this application.
[0094] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the text sensitive word recognition methods provided in this application.
[0095] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0096] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0097] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0098] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A method for identifying sensitive words in text, characterized in that, The text sensitive word recognition method includes: Obtain the input text of the target service; Invoke the double-array AC automaton, which is a memory structure constructed during the initialization of the target service to store each sensitive word in the sensitive word library; The input text is matched with the stored memory structure using the dual-array AC automaton to obtain the sensitive word recognition result of the input text.
2. The text sensitive word recognition method according to claim 1, characterized in that, The memory structure includes the associated sensitive word, as well as the type and level of the associated sensitive word; The step of matching the input text with the stored memory structure using the dual-array AC automaton to obtain the sensitive word recognition result of the input text includes: Obtain the target type corresponding to the input text; The input text is matched with at least one sensitive word belonging to the target type by the dual-array AC automaton to obtain the target sensitive words matched by the input text. The input text is processed according to the level of the target sensitive words.
3. The text sensitive word recognition method according to claim 2, characterized in that, The sensitive word database also contains positive terms for each of the multiple sensitive words; The processing of the input text according to the level of the target sensitive words includes: If the sensitive word library contains a positive term for the target sensitive word, the positive term for the target sensitive word is used to replace the target sensitive word in the input text, and the target service is triggered to respond with the replaced input text. If the sensitive word library does not contain a positive word of the target sensitive word, determine whether the level of the target sensitive word meets the conditions for prohibition. If the level of the target sensitive word meets the blocking condition, the target service is prohibited from responding to the input text; If the level of the target sensitive word does not meet the blocking condition, obtain the review result of the input text, and control whether the target service responds to the input text based on the review result.
4. The text sensitive word recognition method according to claim 3, characterized in that, The types of each sensitive word in the sensitive word library, as well as the positive words of each of the multiple sensitive words, are obtained using large model analysis.
5. The text sensitive word recognition method according to claim 1, characterized in that, The text sensitive word recognition method also includes: If it is determined that the sensitive word database is in an updated state, the memory structure stored in the dual-array AC automaton is updated.
6. The text sensitive word recognition method according to claim 5, characterized in that, Determining that the sensitive word database is in an updated state includes: The system listens for update events of the sensitive word database via Kafka message notifications, and determines that the sensitive word database is in an updated state when the update event is detected.
7. A text-sensitive word recognition device, characterized in that, The text sensitive word recognition device includes: The text acquisition module is used to acquire the input text of the target service; The text sensitive word recognition module is used to call a dual-array AC automaton, which is a memory structure constructed during the initialization of the target service to store each sensitive word in the sensitive word library; the input text is matched with the stored memory structure through the dual-array AC automaton to obtain the sensitive word recognition result of the input text.
8. A computer program product, characterized in that, It includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the text sensitive word recognition method as described in any one of claims 1 to 6.
9. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the text sensitive word recognition method as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the text sensitive word recognition method as described in any one of claims 1 to 6.
