Sensitive word online detection method, device, electronic device and storage medium

By dividing the text to be detected into sub-texts and dynamically generating stateless computing nodes, and using a shared online database to load the latest model for sensitive word detection, the problems of update delay and unavailability under high concurrent requests in existing technologies are solved, and real-time performance and accuracy are improved.

CN119443092BActive Publication Date: 2025-09-23CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411512367.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-09-23
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

Existing sensitive word detection systems are unavailable under update delays and high concurrent requests, and it is difficult to achieve real-time and accuracy. In particular, there are problems of false alarms and delays in sensitive word monitoring in the financial field.

Method used

By dividing the text to be detected into multiple sub-texts and dynamically generating stateless computing nodes, the latest sensitive word detection model is loaded from the shared online database, and the parallel processing mechanism is used for detection to ensure that all nodes use the same latest version of the model.

Benefits of technology

It achieves real-time, accurate and scalable detection of sensitive words, reduces false positives and missed negatives, improves the system's processing capabilities and detection consistency, and solves the delay problem under high concurrent requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443092B_ABST
    Figure CN119443092B_ABST
Patent Text Reader

Abstract

The present invention relates to the fields of data processing technology and financial technology, and discloses a method for online detection of sensitive words, comprising obtaining a text to be detected according to a request, dividing the text to be detected to obtain a first preset number of subtexts; storing each subtext in a detection queue, dynamically generating a second preset number of computing nodes according to the first preset number of subtexts; establishing a connection between the second preset number of computing nodes and a preset shared online database, and loading a sensitive word online detection model in the preset shared online database into each computing node; calling the corresponding sensitive word online detection model according to each computing node, sequentially obtaining subtexts from the detection queue for detection, obtaining a detection result of each computing node for at least one subtext, and fusing the detection results corresponding to each subtext to obtain a detection report of the text to be detected. The present invention can provide real-time, accurate, and scalable detection of sensitive words.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of data processing technology and financial technology, and in particular to a method, device, electronic device and storage medium for online detection of sensitive words. Background Art

[0002] In the financial sector, the rapid development of internet finance, mobile payments, and social media marketing has led to a dramatic increase in user-generated content, posing unprecedented challenges to content management and regulation. Monitoring sensitive keywords is particularly crucial in the financial industry, as such content may involve fraud, illegal fundraising, and other illegal activities. It may also leak customer privacy information, impacting market order and the reputation of financial institutions.

[0003] To meet the growing demand for data processing, existing sensitive word detection systems in financial institutions primarily rely on static rule matching or machine learning-based approaches. While static rule matching is simple to implement, it struggles to adapt to the ever-changing landscape of new vocabulary and is prone to false positives. While machine learning-based approaches can improve accuracy, they require extensive data and time to train. Sensitive word detection often relies on offline detection models, which fail to reflect the latest language usage and lag behind actual needs.

[0004] Furthermore, as the volume of text to be processed increases, traditional sensitive word detection systems with fixed single-node or multi-node configurations face performance bottlenecks. These systems experience increased latency and even service unavailability under high concurrent requests. Furthermore, because computing nodes are typically stateful, when the system needs to be expanded, newly added nodes must synchronize their state information with existing nodes, increasing system complexity and maintenance costs.

[0005] Therefore, solving the delay in sensitive word detection updates and the problem of unavailability under high concurrent requests is a technical problem that needs to be solved urgently. Summary of the Invention

[0006] In view of the above, it is necessary to provide an online sensitive word detection method. Its purpose is to provide real-time, accurate and scalable detection of sensitive words by dynamically generating stateless computing nodes and loading the latest sensitive word online detection model from a shared online database, so as to solve the problems of delay in sensitive word detection updates and unavailability under high concurrent requests.

[0007] In a first aspect, a method for online sensitive word detection is provided, comprising:

[0008] receiving a request for sensitive word detection on a text to be detected, obtaining the text to be detected according to the request, and dividing the text to be detected into a first preset number of subtexts;

[0009] Storing each subtext in a detection queue, dynamically generating a second preset number of computing nodes based on the first preset number of subtexts, wherein the computing nodes are stateless computing nodes that do not store any persistent information, and the second preset number is equal to or less than the first preset number;

[0010] Establishing connections between the second preset number of computing nodes and a preset shared online database, and loading the sensitive word online detection model in the preset shared online database into each computing node;

[0011] The sensitive word online detection model of each computing node is called, and sub-texts are read from the detection queue in turn for detection, so as to obtain the detection result of each computing node for at least one sub-text, and the detection results corresponding to each sub-text are integrated to obtain the detection report of the text to be detected.

[0012] In a second aspect, a device for online sensitive word detection is provided, comprising:

[0013] a segmentation module, configured to receive a request for sensitive word detection on a text to be detected, obtain the text to be detected according to the request, and segment the text to be detected to obtain a first preset number of subtexts;

[0014] a generation module, configured to store each subtext in a detection queue, dynamically generate a second preset number of computing nodes based on a first preset number of subtexts, the computing nodes being stateless computing nodes that do not store any persistent information, the second preset number being equal to or less than the first preset number;

[0015] A loading module, configured to establish a connection between the second preset number of computing nodes and a preset shared online database, and load the sensitive word online detection model in the preset shared online database into each computing node;

[0016] The merging module is used to call the online sensitive word detection model of each computing node, read the sub-texts from the detection queue in turn for detection, obtain the detection results of each computing node for at least one sub-text, and fuse the detection results corresponding to each sub-text to obtain the detection report of the text to be detected.

[0017] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned sensitive word online detection method are implemented.

[0018] In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the above-mentioned sensitive word online detection method are implemented.

[0019] Compared to existing technologies, this invention reduces the burden on individual computing nodes by segmenting the text to be tested into multiple subtexts, enabling the system to process larger datasets. The segmented subtexts are placed in a detection queue, and the number of stateless computing nodes is dynamically adjusted based on the number of subtexts. Computing resources are dynamically adjusted to match the actual workload, ensuring efficient utilization of computing power. The design of stateless computing nodes simplifies system expansion and maintenance.

[0020] All computing nodes are connected to a shared online database and the latest sensitive word detection model is loaded from it, ensuring that all computing nodes use the same latest version of the model for detection, improving detection consistency and accuracy. Furthermore, models trained on real-time data are better able to respond to newly emerging sensitive words, reducing the risk of false positives and missed detections. Each computing node calls the online sensitive word detection model to detect subtexts in the detection queue and aggregates the detection results into a final report. The parallel processing mechanism accelerates overall detection speed while ensuring that the entire text to be detected is thoroughly examined. This effectively addresses the issues of delays in sensitive word detection updates and unavailability under high concurrency requests that plague existing technologies. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is a schematic diagram of an application environment of a sensitive word online detection method according to an embodiment of the present invention;

[0022] Figure 2 A schematic diagram of a process flow of an online sensitive word detection method provided by an embodiment of the present invention;

[0023] Figure 3 A schematic diagram of modules of an online sensitive word detection device provided by an embodiment of the present invention;

[0024] Figure 4 A schematic structural diagram of an electronic device for implementing an online sensitive word detection method provided by an embodiment of the present invention;

[0025] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0027] It should be noted that the descriptions of "first", "second", etc. in the present invention are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0028] The sensitive word online detection method provided by the embodiment of the present invention can be applied in the following situations: Figure 1 In an application environment, wherein the client communicates with the server through a network. The server can receive a request from the client to perform sensitive word detection on the text to be detected, obtain the text to be detected according to the request, divide the text to be detected into a first preset number of sub-texts; store each sub-text in a detection queue, dynamically generate a second preset number of computing nodes according to the first preset number of sub-texts, and the computing nodes are stateless computing nodes that do not store any persistent information; establish a connection between the second preset number of computing nodes and a preset shared online database, and load the sensitive word online detection model in the preset shared online database to each computing node; call the sensitive word online detection model of each computing node, read the sub-texts from the detection queue in turn for detection, obtain the detection result of each computing node on at least one sub-text, and fuse the detection results corresponding to each sub-text to obtain a detection report for the text to be detected. The present invention is aimed at financial service enterprises, social media and network platforms, e-commerce, government and public sectors, etc., by dynamically generating stateless computing nodes and loading the latest sensitive word online detection model from a shared online database, providing real-time, accurate and scalable detection of sensitive words, so as to solve the problems of delay in sensitive word detection update and unavailability under high concurrent requests. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablet computers, and portable wearable devices. The server can be implemented as an independent server or a server cluster consisting of multiple servers. The present invention is described in detail below through specific embodiments.

[0029] Reference Figure 2 FIG. 1 is a flow chart of a method for online sensitive word detection according to an embodiment of the present invention. The method is executed by an electronic device.

[0030] In this embodiment, the online sensitive word detection method includes:

[0031] S1. Receive a request for sensitive word detection on a text to be detected, obtain the text to be detected according to the request, and divide the text to be detected into a first preset number of subtexts.

[0032] In this embodiment, the server or system receives a request for sensitive word detection, which includes the text to be detected, or obtains the text to be detected from a preset database based on the identifier of the text to be detected in the request. The text to be detected can be text data or various media types such as images and videos.

[0033] The text to be detected may be segmented into multiple subtexts based on segmentation strategies such as paragraphs, sentences, and fixed lengths. The first preset number of subtexts is determined according to the paragraphs, sentences, and fixed lengths of the text to be detected.

[0034] For example, a financial institution needs to perform sensitive word detection on the loan application document submitted by customer A to ensure that the document does not contain any illegal or sensitive information.

[0035] The loan application documents are as follows:

[0036] Applicant: Customer A, ID number: 123456789012345678, Loan amount: RMB 100,000, Loan purpose: Purchase of real estate, Remarks: I plan to use this money to invest in the stock market and participate in some high-risk speculative activities.

[0037] Split the loan application document into three sub-files according to the split points (the split points can be blank lines or specific formatting marks).

[0038] Segmentation results:

[0039] Applicant: Zhang San ID number: 123456789012345678

[0040] Loan amount: 100,000 yuan Loan purpose: Purchase of real estate

[0041] Note: I plan to use this money to invest in the stock market and participate in some high-risk speculative activities.

[0042] In one embodiment, segmenting the to-be-detected text to obtain a first preset number of subtexts includes:

[0043] Segmenting the text to be detected according to punctuation marks in the text to be detected to obtain at least one initial clause;

[0044] Each initial clause is segmented according to a preset dependency syntax to obtain a first preset number of subtexts.

[0045] Identify punctuation marks in the text to be tested and segment the text into multiple initial clauses based on the identified punctuation marks (such as periods, question marks, exclamation marks, etc.). By identifying punctuation marks, we ensure that each initial clause is part of a complete sentence or paragraph.

[0046] Perform dependency syntactic analysis on each initial clause to identify its subject, predicate, object, and other components. Based on pre-defined dependency rules, the initial clause is further subdivided into smaller subtexts, ensuring that each subdivided subtext has a certain degree of semantic integrity.

[0047] The preset dependency rules are used to further segment sentences based on the dependency relationships between various components (such as subject, predicate, object, etc.) during dependency syntactic analysis. These rules can be customized based on specific application requirements and the purpose of sensitive word detection.

[0048] In one embodiment, segmenting the to-be-detected text to obtain a first preset number of subtexts includes:

[0049] Segmenting the text to be detected to obtain multiple phrases, and marking the part of speech for each phrase;

[0050] Using a preset segmentation point prediction model to analyze the position and context of each phrase in the text to be tested after the part of speech is marked, the probability of each phrase being a segmentation point is obtained, and the end position of the phrase with a probability greater than a threshold is selected as the segmentation point;

[0051] The text to be detected is segmented based on the segmentation points to obtain a first preset number of sub-texts.

[0052] Use the preset word segmentation tool (such as Jieba, HanLP, etc.) to perform word segmentation on the text to be detected, and cut the continuous text to be detected into multiple separate phrases.

[0053] Use a part-of-speech tagging tool (such as Stanford NLP, spaCy, or the part-of-speech tagger in NLTK) to tag each phrase in the text to be tested with a part-of-speech tag, such as noun (NN), verb (VB), or adjective (JJ).

[0054] The preset segmentation point prediction model is used to analyze the position and contextual relationship of each phrase after part-of-speech tagging in the text to be detected. The preset segmentation point prediction model predicts whether the phrase should be regarded as a segmentation point based on the position and contextual relationship of the phrase, and obtains the probability of each phrase being a segmentation point. The probability of the segmentation point reflects the possibility of ending a subtext at the current position and starting the next subtext.

[0055] The sentence ends of all phrases with probabilities greater than a threshold are selected as segmentation points, and the text to be detected is segmented based on the segmentation points to obtain a first preset number of subtexts.

[0056] The preset segmentation point prediction models include but are not limited to sequence-to-sequence (Seq2Seq) models, recurrent neural networks (RNNs), and long short-term memory networks (LSTM). The model structure of the preset text segmentation model includes: word encoding layer, attention layer, fusion layer, sentence encoding layer, and output layer.

[0057] The word encoding layer is used to convert each word group after the input part-of-speech tagging into a vector representation. When processing the current word, the attention layer is used to focus more on the key parts of the input sequence, which is very useful for capturing long-distance dependencies and important information.

[0058] The fusion layer is used to fuse the outputs of the word encoding layer and the attention layer to generate a richer feature representation. The sentence encoding layer is used to further encode the fused features to capture the semantic information of the entire sentence or clause. The output layer is responsible for generating the final segmentation point prediction.

[0059] In step S1, the text to be inspected is divided into a first predetermined number of subtexts. Multithreading or multi-processing can be used for parallel processing, allowing each computing node to independently process one or more subtexts, significantly improving overall processing speed. Evenly distributing tasks across multiple computing nodes prevents overloading of individual nodes and ensures more balanced resource utilization.

[0060] S2. Store each subtext into a detection queue, and dynamically generate a second preset number of computing nodes based on the first preset number of subtexts, where the computing nodes are stateless computing nodes that do not store any persistent information, and the second preset number is equal to or less than the first preset number.

[0061] In this embodiment, a detection queue of a data structure is pre-built, and each segmented sub-text is placed in the detection queue in turn. Multi-threading or multi-computing nodes can be used to process these sub-texts in parallel, which can significantly improve the processing speed, especially when processing large amounts of data.

[0062] The number of compute nodes can be dynamically adjusted based on the number of subtext detection tasks in the queue. If there are many tasks, more compute nodes can be added; if there are fewer, fewer can be used to conserve resources. The queue mechanism ensures that each compute node receives tasks evenly, preventing some nodes from being overloaded while others remain idle.

[0063] Compute nodes are the computing resources that perform the actual processing tasks and can be physical servers, virtual machines, containers, or other computing units. Each compute node does not store any persistent information while processing a task. In other words, each time a subtext is processed, the compute node starts from scratch, without relying on previous state. This makes stateless nodes easier to scale horizontally, without having to worry about state synchronization. For example, if a node fails, it can be easily replaced with another one without losing any important information.

[0064] If the number of computing nodes is less than or equal to the number of sub-texts, it can ensure that each node has enough work to process, which can better balance the load and avoid situations where some nodes are overloaded while others are idle.

[0065] S3. Establish connections between the second preset number of computing nodes and a preset shared online database, and load the sensitive word online detection model in the preset shared online database to each computing node.

[0066] In this embodiment, the preset shared online database is a centralized data storage system for storing sensitive word detection models and their related data. All computing nodes can access and connect to the preset shared online database via the network. Each computing node loads the latest sensitive word detection model from the shared online database at startup or periodically. This ensures that each computing node uses the latest version of the model, thereby improving detection accuracy and consistency.

[0067] The online sensitive word detection model is trained and regularly updated based on the latest real-time data, ensuring that all computing nodes use the latest model version. Real-time data refers to the latest, continuously updated data sources, such as new user-submitted text, new online information, and new laws and regulations. Using this up-to-date real-time data to train the sensitive word detection model ensures that it can identify the latest sensitive words and patterns.

[0068] By loading the latest model from the shared online database in each computing node of the present invention, all computing nodes can use the same, latest model version for processing, ensuring that the model versions of all computing nodes are consistent, avoiding inconsistent detection or omissions caused by using old models.

[0069] In one embodiment, before establishing the connection between the second preset number of computing nodes and the preset shared online database, the method further includes:

[0070] Constructing an initial database of a network attached storage type, and setting a directory structure and file naming rules for the initial database;

[0071] According to the directory structure and the file naming rules, the relevant data of the sensitive word online detection model is stored in the initial database to obtain the preset shared online database, wherein the relevant data includes the sensitive word list, the training data set and the model file.

[0072] Build an initial database of network attached storage type, such as NAS storage database, to centrally manage and store various data required for sensitive word detection.

[0073] Set up the directory structure and file naming conventions for the initial database. For example, define a clear folder hierarchy through the directory structure to facilitate the organization and management of different types of data. For example, you can have separate folders for sensitive word lists, training datasets, and model files. Develop a unified file naming convention to ensure consistent and readable file naming. This helps quickly locate and manage files.

[0074] The relevant data of the sensitive word online detection model is stored in the initial database, which becomes a preset shared online database. All computing nodes can access the shared online database through the network and obtain the latest sensitive word detection model and its related data from it.

[0075] Relevant data includes a sensitive word list, a training dataset, and a model file. The sensitive word list contains all sensitive words to be detected. The training dataset is used to train the sensitive word detection model, typically consisting of a large number of text samples and their labels. The model file is a pre-trained sensitive word detection model file that can be loaded into a compute node for actual detection.

[0076] In one embodiment, the step of loading the sensitive word online detection model in the preset shared online database to each computing node includes:

[0077] Querying the timestamps of the online detection models of each sensitive word in the preset shared online database;

[0078] The online sensitive word detection model with the latest version of the timestamp is loaded into each computing node. The online sensitive word detection model is a detection model that is trained based on real-time sensitive word data and updated in real time.

[0079] Configure network settings for each computing node so that it can access the preset shared online database. Network settings include setting IP addresses, port numbers, authentication information, etc.

[0080] Use the network libraries in the pre-defined programming languages ​​(such as Python and Java) on the computing nodes to establish connections to the shared online database. These network libraries can be standard libraries or third-party libraries that handle network communication.

[0081] A stable network connection can be established between the computing nodes and the shared online database using TCP / IP or other network protocols. The timestamps of all online sensitive word detection models are queried from the shared online database. The timestamp records the last update time of each model file.

[0082] By comparing the timestamps of different versions of model files, we can determine which model is the latest version. Based on the timestamp, we select the latest online sensitive word detection model, download this latest version of the model from the shared online database, and load it into the memory of each computing node to perform the sensitive word detection task.

[0083] In one embodiment, the sensitive word online detection model is obtained according to the following method, including:

[0084] Collecting text data sets from a preset data source in real time, annotating and recording sensitive words in the text data sets to obtain a training data set, wherein the records include the data sequence number of the sensitive words, the sensitive words included, and the number of sensitive words included;

[0085] Dividing the training data set into a training set and a test set, and using the training set to train the initial detection model;

[0086] The test set is used to adjust the hyperparameters of the trained initial detection model. When the preset indicators of the trained initial detection model meet the preset requirements, the training is terminated to obtain the sensitive word online detection model.

[0087] A large amount of text data is collected from pre-defined data sources (such as the internet, social media, news articles, user-submitted documents, etc.) to obtain a text dataset. This text dataset is then annotated (e.g., manually or automatically) and recorded to obtain a training dataset. For example, for each text sample containing sensitive words, the sensitive words contained therein are marked.

[0088] Record the following information for each text sample containing sensitive words: Data serial number: The unique identifier of each text sample. Sensitive words included: All sensitive words that appear in the text. Number of sensitive words included: The number of sensitive words in the text.

[0089] The annotated and transcribed text dataset is divided into two parts: a training set: a dataset used to train the initial detection model; and a test set: a dataset used to evaluate and adjust model performance.

[0090] Select a suitable machine learning algorithm (such as logistic regression, support vector machine, neural network, etc.) as the initial detection model, use the training set to train the initial detection model and optimize the model parameters. Through training, the model can identify and classify sensitive words in the text.

[0091] Use the test set to evaluate the performance of the initial detection model after training, including adjusting hyperparameters and evaluation metrics. Adjusting hyperparameters: Based on the evaluation results on the test set, adjust the model's hyperparameters (such as the learning rate, regularization parameter, and number of network layers) to further optimize model performance. Evaluation metrics: Commonly used evaluation metrics include accuracy, precision, recall, and F1 score.

[0092] When the preset indicators of the trained initial detection model on the test set meet the preset requirements, it is considered that the trained initial detection model has reached the expected performance level, and the training is ended, that is, the final sensitive word online detection model is obtained, which can be stored in the shared online database for practical application by computing nodes.

[0093] In one embodiment, the method further comprises:

[0094] When it is detected that the training of the online sensitive word detection model has been completed, a version number and a timestamp of the online sensitive word detection model are generated according to the time when the training has been completed;

[0095] The sensitive word online detection model, the version number and the timestamp of the sensitive word online detection model are packaged and stored in the preset shared online database.

[0096] Generate a unique version number for the online sensitive word detection model based on the time or identification information of the model. The version number helps track and manage different versions of the model. Record the specific time the online sensitive word detection model was generated and generate a timestamp for the model. The timestamp indicates the time when the model was created or updated.

[0097] Package the sensitive word online detection model, version number, and timestamp together and store the packaged file in the preset shared online database. According to the previously set directory structure and file naming rules, store the file in the corresponding folder and use a file name that includes the version number and timestamp.

[0098] The trained sensitive word online detection model, version number and timestamp are packaged and stored in a preset shared online database, so that all computing nodes can obtain the latest model file from the same shared online database, ensuring that all nodes use the same version of the model, thereby ensuring the consistency of processing results.

[0099] By centrally storing and managing model files, data inconsistency problems caused by using different versions of models can be avoided. There is no need to update each computing node one by one. The computing nodes can regularly check the latest version in the shared online database and automatically download and load new model files, thereby achieving seamless updates.

[0100] In step S3, by loading the latest online sensitive word detection model from the shared online database, it can be ensured that all computing nodes use the latest version of the model, which helps to improve the accuracy and consistency of detection. Because the online sensitive word detection model is regularly updated to include the latest sensitive words and variants, all computing nodes use the same model version, avoiding the problem of inconsistent detection results caused by using different versions of the model.

[0101] S4. Call the sensitive word online detection model of each computing node, read the sub-texts from the detection queue in turn for detection, obtain the detection result of each computing node for at least one sub-text, and fuse the detection results corresponding to each sub-text to obtain the detection report of the text to be detected.

[0102] In this embodiment, according to the first-in-first-out processing rule, each computing node reads the sub-text from the detection queue in turn, uses the loaded sensitive word online detection model to detect sensitive words in each sub-text, summarizes the detection results of all sub-texts, and obtains a detection report for the text to be detected.

[0103] The detection report includes the overall situation of the text to be tested, such as the total number of words, the number of sub-texts, the detection results of each sub-text, lists specific sensitive words and their locations, the number of sensitive words, type distribution, and suggestions or handling measures based on the detection results.

[0104] For example, a financial institution needs to perform sensitive word detection on the loan application document submitted by customer A to ensure that the document does not contain any illegal or sensitive information.

[0105] The loan application documents are as follows:

[0106] Applicant: Customer A, ID number: 123456789012345678, Loan amount: RMB 100,000, Loan purpose: Purchase of real estate, Remarks: I plan to use this money to invest in the stock market and participate in some high-risk speculative activities.

[0107] The loan application document is split into three sub-files according to paragraph boundaries (paragraph boundaries can be blank lines or special formatting marks).

[0108] Segmentation results:

[0109] Applicant: Zhang San ID number: 123456789012345678

[0110] Loan amount: 100,000 yuan Loan purpose: Purchase of real estate

[0111] Note: I plan to use this money to invest in the stock market and participate in some high-risk speculative activities.

[0112] Put these three subtexts into the detection queue. Assuming that each subtext requires a computing node to process, the system will dynamically create three stateless computing nodes. These nodes will not store any persistent information.

[0113] Each computing node establishes a connection to the shared online database and loads the latest online sensitive word detection model. This online sensitive word detection model is trained based on real-time data and is regularly updated to identify the latest sensitive words.

[0114] Each computing node takes out a subtext from the detection queue in turn and uses the loaded sensitive word online detection model for detection.

[0115] Computing node 1 processes subtext 1 and may detect the ID number as sensitive information.

[0116] Computing node 2 processes subtext 2 and finds no sensitive information.

[0117] Computing node 3 processes subtext 3 and detects that "investing in the stock market" and "high-risk speculative activities" are sensitive content.

[0118] The detection results of all subtexts are combined to form the final report.

[0119] In one embodiment, calling the sensitive word online detection model of each computing node, sequentially reading subtexts from the detection queue for detection, and obtaining the detection result of each computing node for at least one subtext includes:

[0120] performing sensitive word matching on each subtext according to a first sensitive word library of the online sensitive word detection model, and determining sensitive word sentences in each subtext according to the sensitive word matching results, wherein the sensitive word library includes at least one sensitive word list group;

[0121] performing sensitive word variant detection on each subtext according to a second sensitive word library of the online sensitive word detection model, and determining sensitive word variant sentences in each subtext according to the sensitive word variant detection results, wherein the sensitive word library includes at least one sensitive word variant list group;

[0122] According to the sensitive word sentences and sensitive word variant sentences in each sub-text, the detection result of each computing node for at least one sub-text is obtained.

[0123] The first sensitive word library contains a list of standard sensitive words, including directly listed sensitive words. The computing node uses the first sensitive word library to perform a word-by-word match on each subtext, checking whether the subtext contains these standard sensitive words. If the subtext contains a standard sensitive word, the sensitive word and the sentence or fragment in which it appears are marked as sensitive words.

[0124] The second sensitive word library contains a list of sensitive word variants, including various inflections, synonyms, and near-synonyms of sensitive words. The computing node uses the second sensitive word library to check each subtext to see if the subtext contains variant forms of these sensitive words. If the subtext contains a variant form of a sensitive word, the variant and the sentence or fragment in which it appears are marked as sensitive word variant sentences.

[0125] The results of sensitive word sentences and sensitive word variant sentences are combined to generate the final detection results for each subtext.

[0126] In step S4, all computing nodes use the same, up-to-date online sensitive word detection model, ensuring consistent and accurate detection and avoiding inconsistent results caused by using different model versions. By testing each subtext individually, we ensure that all parts of the entire document to be tested are checked, ensuring that no sensitive content is missed.

[0127] The present invention targets financial services companies, social media and online platforms, e-commerce, government and public sectors, and other fields. By dynamically generating stateless computing nodes and loading the latest online sensitive word detection model from a shared online database, it provides real-time, accurate, and scalable detection of sensitive words. For example, banks and financial institutions can use the present invention to monitor documents and application forms submitted by customers to ensure that they do not contain fraudulent or illegal information. Social media and online platforms can use the present invention to monitor user-posted content in real time to prevent the emergence of illegal and other negative information. E-commerce can use the present invention to check product descriptions and user reviews to avoid false advertising, infringing content, or illegal product information, etc.

[0128] In steps S1-S4, segmenting the text to be detected into multiple subtexts reduces the burden on individual computing nodes, enabling the system to process larger datasets. The segmented subtexts are placed in the detection queue, and the number of stateless computing nodes is dynamically adjusted based on the number of subtexts. Dynamically adjusting computing resources to match the actual workload ensures efficient utilization of computing power. The design of stateless computing nodes simplifies system expansion and maintenance.

[0129] All computing nodes are connected to a shared online database and the latest sensitive word detection model is loaded from it, ensuring that all computing nodes use the same latest version of the model for detection, improving detection consistency and accuracy. Furthermore, models trained on real-time data are better able to respond to newly emerging sensitive words, reducing the risk of false positives and missed detections. Each computing node calls the online sensitive word detection model to detect subtexts in the detection queue and aggregates the detection results into a final report. The parallel processing mechanism accelerates overall detection speed while ensuring that the entire text to be detected is thoroughly examined. This effectively addresses the issues of delays in sensitive word detection updates and unavailability under high concurrency requests that plague existing technologies.

[0130] like Figure 3 FIG. 1 is a schematic diagram of a module of an online sensitive word detection device provided by an embodiment of the present invention.

[0131] The online sensitive word detection device 100 of the present invention can be installed in an electronic device. Depending on the functionality to be implemented, the online sensitive word detection device 100 may include a segmentation module 110, a generation module 120, a loading module 130, and a merging module 140. A module, also referred to as a unit, is a series of computer program segments that can be executed by an electronic device processor and perform a fixed function, and is stored in the memory of the electronic device.

[0132] In this embodiment, the functions of each module / unit are as follows:

[0133] The segmentation module 110 is configured to receive a request for sensitive word detection on a text to be detected, obtain the text to be detected according to the request, and segment the text to be detected to obtain a first preset number of subtexts;

[0134] A generation module 120 is configured to store each subtext in a detection queue, dynamically generate a second preset number of computing nodes based on a first preset number of subtexts, wherein the computing nodes are stateless computing nodes that do not store any persistent information, and the second preset number is equal to or less than the first preset number;

[0135] A loading module 130 is configured to establish a connection between the second preset number of computing nodes and a preset shared online database, and load the sensitive word online detection model in the preset shared online database to each computing node;

[0136] The merging module 140 is used to call the online sensitive word detection model of each computing node, read the sub-texts from the detection queue in turn for detection, obtain the detection results of each computing node for at least one sub-text, and fuse the detection results corresponding to each sub-text to obtain the detection report of the text to be detected.

[0137] In one embodiment, the segmentation module 110 is specifically configured to:

[0138] Segmenting the text to be detected according to punctuation marks in the text to be detected to obtain at least one initial clause;

[0139] Each initial clause is segmented according to a preset dependency syntax to obtain a first preset number of subtexts.

[0140] In one embodiment, the segmentation module 110 is specifically configured to:

[0141] Segmenting the text to be detected to obtain multiple phrases, and marking the part of speech for each phrase;

[0142] Using a preset segmentation point prediction model to analyze the position and context of each phrase in the text to be tested after the part of speech is marked, the probability of each phrase being a segmentation point is obtained, and the end position of the phrase with a probability greater than a threshold is selected as the segmentation point;

[0143] The text to be detected is segmented based on the segmentation points to obtain a first preset number of sub-texts.

[0144] In one embodiment, the loading module 130 is specifically configured to:

[0145] Constructing an initial database of a network attached storage type, and setting a directory structure and file naming rules for the initial database;

[0146] According to the directory structure and the file naming rules, the relevant data of the sensitive word online detection model is stored in the initial database to obtain the preset shared online database, wherein the relevant data includes the sensitive word list, the training data set and the model file.

[0147] In one embodiment, the loading module 130 is specifically configured to:

[0148] Querying the timestamps of the online detection models of each sensitive word in the preset shared online database;

[0149] The online sensitive word detection model with the latest version of the timestamp is loaded into each computing node. The online sensitive word detection model is a detection model that is trained based on real-time sensitive word data and updated in real time.

[0150] In one embodiment, the loading module 130 is specifically configured to:

[0151] Collecting text data sets from a preset data source in real time, annotating and recording sensitive words in the text data sets to obtain a training data set, wherein the records include the data sequence number of the sensitive words, the sensitive words included, and the number of sensitive words included;

[0152] Dividing the training data set into a training set and a test set, and using the training set to train the initial detection model;

[0153] The test set is used to adjust the hyperparameters of the trained initial detection model. When the preset indicators of the trained initial detection model meet the preset requirements, the training is terminated to obtain the sensitive word online detection model.

[0154] In one embodiment, the loading module 130 is specifically configured to:

[0155] When it is detected that the training of the online sensitive word detection model has been completed, a version number and a timestamp of the online sensitive word detection model are generated according to the time when the training has been completed;

[0156] The sensitive word online detection model, the version number and the timestamp of the sensitive word online detection model are packaged and stored in the preset shared online database.

[0157] like Figure 4 , which is a structural diagram of an electronic device for implementing an online sensitive word detection method provided by an embodiment of the present invention.

[0158] In this embodiment, the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13, which can be interconnected through a system bus. The memory 11 stores a sensitive word online detection program 10, and the sensitive word online detection program 10 can be executed by the processor 12. Figure 4 Only the electronic device 1 having components 11-13 and the sensitive word online detection program 10 is shown. It can be understood by those skilled in the art that Figure 4 The structure shown does not constitute a limitation on the electronic device 1 , and the electronic device 1 may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0159] The memory 11 includes internal memory and at least one type of readable storage medium. The memory provides a cache for the operation of the electronic device 1; the readable storage medium can be a non-volatile storage medium such as flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the readable storage medium can be an internal storage unit of the electronic device 1; in other embodiments, the non-volatile storage medium can also be an external storage device of the electronic device 1, such as a plug-in hard disk equipped on the electronic device 1, a smart memory card (SmartMediaCard, SMC), a secure digital (SD) card, a flash memory card, etc. In this embodiment, the readable storage medium of the memory 11 is generally used to store the operating system and various application software installed on the electronic device 1, such as storing the code of the sensitive word online detection program 10 in one embodiment of the present invention. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or are about to be output.

[0160] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, the processor 12 is used to run program code stored in the memory 11 or process data, such as running the sensitive word online detection program 10.

[0161] The network interface 13 may include a wireless network interface or a wired network interface, and the network interface 13 is used to establish a communication connection between the electronic device 1 and a terminal (not shown in the figure).

[0162] Optionally, the electronic device 1 may further include a user interface, which may include a display and an input unit such as a keyboard. The optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.

[0163] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0164] The sensitive word online detection program 10 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 12, it can achieve the following:

[0165] receiving a request for sensitive word detection on a text to be detected, obtaining the text to be detected according to the request, and dividing the text to be detected into a first preset number of subtexts;

[0166] Storing each subtext in a detection queue, dynamically generating a second preset number of computing nodes based on the first preset number of subtexts, wherein the computing nodes are stateless computing nodes that do not store any persistent information, and the second preset number is equal to or less than the first preset number;

[0167] Establishing connections between the second preset number of computing nodes and a preset shared online database, and loading the sensitive word online detection model in the preset shared online database into each computing node;

[0168] The sensitive word online detection model of each computing node is called, and sub-texts are read from the detection queue in turn for detection, so as to obtain the detection result of each computing node for at least one sub-text, and the detection results corresponding to each sub-text are integrated to obtain the detection report of the text to be detected.

[0169] Specifically, the specific implementation method of the processor 12 for the above-mentioned sensitive word online detection program 10 can be referred to Figure 2 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0170] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable medium can be non-volatile or non-volatile. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).

[0171] The computer-readable storage medium stores a sensitive word online detection program 10, which can be executed by one or more processors. The specific implementation of the computer-readable storage medium of the present invention is basically the same as the various embodiments of the above-mentioned sensitive word online detection method, and will not be repeated here.

[0172] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and other division methods may be used in actual implementation.

[0173] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of the solution of this embodiment according to actual needs.

[0174] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional modules.

[0175] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0176] Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims rather than the foregoing description, and all changes that come within the meaning and range of equivalents of the claims are intended to be embraced therein. Any reference to a figure in a claim should not be construed as limiting the claim to which it relates.

[0177] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. Second-order terms are used to indicate names and do not imply any particular order.

[0178] Finally, it should be noted that the above embodiments are intended only to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention. If software tools or components other than those of our company appear in the embodiments of this application, they are merely for illustration and do not represent actual use.

Claims

1. A sensitive word online detection method, characterized in that: The method comprises: receiving a request for sensitive word detection on a text to be detected, obtaining the text to be detected according to the request, and dividing the text to be detected into a first preset number of subtexts; Storing each subtext in a detection queue, dynamically generating a second preset number of computing nodes based on the first preset number of subtexts, wherein the computing nodes are stateless computing nodes that do not store any persistent information, and the second preset number is equal to or less than the first preset number; Establishing connections between the second preset number of computing nodes and a preset shared online database, and loading the sensitive word online detection model in the preset shared online database into each computing node; Calling the sensitive word online detection model of each computing node, reading subtexts from the detection queue in turn for detection, obtaining the detection result of each computing node for at least one subtext, and fusing the detection results corresponding to each subtext to obtain a detection report for the text to be detected; Among them, the sensitive word online detection model is obtained according to the following method, including: collecting a text data set from a preset data source in real time, annotating and recording the text data set with sensitive words to obtain a training data set, wherein the record contains the data sequence number of the sensitive word, the sensitive words included and the number of sensitive words included; dividing the training data set into a training set and a test set, and using the training set to train the initial detection model; using the test set to adjust the hyperparameters of the trained initial detection model, and when the preset indicators of the trained initial detection model meet the preset requirements, ending the training to obtain the sensitive word online detection model.

2. The method for online sensitive word detection according to claim 1, wherein: The step of dividing the to-be-detected text to obtain a first preset number of subtexts includes: Segmenting the text to be detected according to punctuation marks in the text to be detected to obtain at least one initial clause; Each initial clause is segmented according to a preset dependency syntax to obtain a first preset number of subtexts.

3. The method for online sensitive word detection according to claim 1, wherein: The step of segmenting the to-be-detected text to obtain a first preset number of subtexts includes: Segmenting the text to be detected to obtain multiple phrases, and marking the part of speech for each phrase; Using a preset segmentation point prediction model to analyze the position and context of each phrase in the text to be tested after the part of speech is marked, the probability of each phrase being a segmentation point is obtained, and the end position of the phrase with a probability greater than a threshold is selected as the segmentation point; The text to be detected is segmented based on the segmentation points to obtain a first preset number of sub-texts.

4. The method for online sensitive word detection according to claim 1, wherein: Before establishing the connections between the second preset number of computing nodes and the preset shared online database, the method further includes: Constructing an initial database of a network attached storage type, and setting a directory structure and file naming rules for the initial database; According to the directory structure and the file naming rules, the relevant data of the sensitive word online detection model is stored in the initial database to obtain the preset shared online database, wherein the relevant data includes the sensitive word list, the training data set and the model file.

5. The method for online sensitive word detection according to claim 1, wherein: The step of loading the sensitive word online detection model in the preset shared online database to each computing node includes: Querying the timestamps of the online detection models of each sensitive word in the preset shared online database; The online sensitive word detection model with the latest version of the timestamp is loaded into each computing node. The online sensitive word detection model is a detection model that is trained based on real-time sensitive word data and updated in real time.

6. The method for online sensitive word detection according to claim 1, wherein: The method further comprises: When it is detected that the training of the online sensitive word detection model has been completed, a version number and a timestamp of the online sensitive word detection model are generated according to the time when the training has been completed; The sensitive word online detection model, the version number and the timestamp of the sensitive word online detection model are packaged and stored in the preset shared online database.

7. A sensitive word online detection device, used to implement the sensitive word online detection method according to any one of claims 1 to 6, characterized in that: The device comprises: a segmentation module, configured to receive a request for sensitive word detection on a text to be detected, obtain the text to be detected according to the request, and segment the text to be detected to obtain a first preset number of subtexts; a generation module, configured to store each subtext in a detection queue, dynamically generate a second preset number of computing nodes based on a first preset number of subtexts, the computing nodes being stateless computing nodes that do not store any persistent information, the second preset number being equal to or less than the first preset number; A loading module, configured to establish a connection between the second preset number of computing nodes and a preset shared online database, and load the sensitive word online detection model in the preset shared online database into each computing node; The merging module is used to call the online sensitive word detection model of each computing node, read the sub-texts from the detection queue in turn for detection, obtain the detection results of each computing node for at least one sub-text, and fuse the detection results corresponding to each sub-text to obtain the detection report of the text to be detected.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a sensitive word online detection program that can be executed by the at least one processor, and the sensitive word online detection program is executed by the at least one processor so that the at least one processor can execute the sensitive word online detection method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a sensitive word online detection program, which can be executed by one or more processors to implement the sensitive word online detection method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Sensitive word recognition method and device, equipment and medium

    CN117077678A

  • Text analysis method and device, electronic equipment and storage medium

    CN117332774A