Method and system for improving text content recognition and classification and computer equipment
By integrating the hierarchical processing architecture of keyword matching and semantic detection models on edge devices, combined with data augmentation and lightweight deployment, the real-time and accuracy problems of text content recognition and classification are solved, efficient text review and sensitive information filtering are achieved, and it is suitable for a variety of application scenarios, improving the real-time and accuracy of text recognition.
Patent Information
- Application Number
- CN202510597193.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-08-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to take into account real-time and accuracy in text content recognition and classification. The keyword matching system is fast but has low accuracy, the semantic model has high accuracy but large latency, and the training relies on a large amount of labeled data to lead to high cold start cost, poor dynamic adaptability, and insufficient computing power of edge devices lead to difficult deployment.
The hierarchical processing architecture is adopted to integrate keyword matching and semantic detection models, combine data augmentation strategies and edge-end lightweight deployment, text segmentation is performed through Trie tree and maximum probability path model, keyword vocabulary and semantic model training data are expanded, and dynamic confidence thresholds and knowledge distillation compression models are used to realize lightweight deployment and encrypted storage transmission.
It realizes efficient, real-time and accurate text content recognition and classification on edge devices, and is suitable for social media review, intelligent customer service and other scenarios, improving its ability to combat text recognition and business attack resistance, and reducing the cost of computing resource occupation and privacy protection.
Smart Images

Figure CN120449878A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the cross - field of natural language processing and edge computing, and particularly to a method, system and computer device for improving text content recognition and classification. Background Art
[0002] The demand for real - time review and accurate classification of text content by social media platforms, financial institutions, government and enterprise units has increased exponentially. At the same time, the counter - measures of black and gray industries continue to upgrade, and the proportion of variant word avoidance detection has been increasing year by year. Traditional technical solutions are facing severe challenges. The current mainstream technologies in the industry show a polarization:
[0003] One is a rule - based keyword matching system, which uses a predefined static word library, such as a keyword table, for string matching. Although the response speed is fast, it has significant defects. That is, it cannot recognize semantic variants, such as using the pinyin abbreviation "VX" to replace "WeChat", and glyph variations, such as "micro - signal" and other adversarial expressions, resulting in a relatively high missed detection rate. Moreover, the false positive rate is also relatively high. For example, "chocolate" is misjudged as a keyword containing "keli", and the maintenance cost also increases exponentially with the expansion of the word library.
[0004] The other is to use language models such as BERT and GPT based on deep learning technologies such as RNN and Transformer for end - to - end semantic analysis. Although it has the ability of semantic understanding, there are still bottlenecks, that is, the inference latency is relatively high, the computing resources consumption is large, and the performance will drop sharply in the small - sample scenario with insufficient training samples.
[0005] In summary, the existing technologies are difficult to achieve both real - time and accuracy in text content recognition and classification. When the keyword matching system is fast, the accuracy is low; when the semantic model has high accuracy, the latency is large. Moreover, the training of the model depends on labeled data, and the labeled data requires a large number of manually labeled samples, resulting in high cold - start costs. The keyword matching scheme is difficult to cope with dynamic semantic changes, and the semantic model based on traditional supervised learning also requires a large amount of manpower to obtain labeled data for dynamic semantics, with poor dynamic adaptation ability. The deployment of large models does not match the computing power of edge devices, resulting in difficulties in end - side deployment. Summary of the Invention
[0006] The present invention aims to solve the problems that the existing technologies are difficult to achieve both real - time and accuracy in text content recognition and classification, high cold - start costs, and poor adaptation ability, and provides a method, system and computer device for improving text content recognition and classification. <00,00017>The present invention provides a method for improving text content recognition and classification, including the following steps:
[0008] S1, receiving the input text of the user;
[0009] S2, segmenting the input text using a preset word segmenter to obtain a text word segmentation set;
[0010] S3, based on a preset data augmentation strategy and the text segmentation set, expanding a preset keyword vocabulary and a preset semantic detection model to obtain an expanded keyword vocabulary and expanded semantic model training data; wherein the keyword vocabulary includes single keywords and combined keywords;
[0011] S4, determining whether the keywords in the text segmentation set match the expanded keyword vocabulary;
[0012] S5, if not, processing the input text into a model format to obtain a processed text;
[0013] S6, inputting the processed text into a preset pre-trained semantic detection model, and determining whether the processed text is non-compliant text or sensitive text through a set confidence threshold; wherein the confidence threshold is a dynamic threshold;
[0014] S7: If not, output the processed text.
[0015] Furthermore, the step of segmenting the input text by a preset word segmenter to obtain a text word segmentation set includes:
[0016] Generate a directed acyclic graph through the Trie tree structure;
[0017] Performing multi-granularity segmentation on the input text using a preset maximum probability path model;
[0018] Compress repeated input text.
[0019] Furthermore, the step of expanding a preset keyword vocabulary and a preset semantic detection model based on a preset data augmentation strategy and the text segmentation set to obtain expanded keyword vocabulary and expanded semantic model training data includes:
[0020] Generate semantically equivalent expressions of the text word set using a preset language model to obtain a vocabulary expansion corpus;
[0021] Performing cluster analysis on the text segmentation set to extract new keywords and new training data;
[0022] The new training data is incorporated into the original semantic model training data to obtain the expanded semantic model training data. At the same time, the new keywords are incorporated into the vocabulary expansion corpus.
[0023] Furthermore, the step of determining whether the keywords in the text segmentation set match the expanded keyword vocabulary further includes:
[0024] If so, the preset replacement operation or interception operation is executed and recorded in the preset log;
[0025] The keyword vocabulary is updated through differential updating to obtain the expanded keyword vocabulary; the single keyword includes basic words and extended words, the basic words are used to generate a static keyword vocabulary, and the extended words are dynamically generated variant words; the dynamic generation is expanded through glyph, pinyin, synonym conversion rules or semantic expansion based on a preset large language model; the combined keywords include combined words, and the combined words are used to generate a combined expression template library.
[0026] Furthermore, the step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text by a set confidence threshold includes:
[0027] If so, the replacement operation or the interception operation is performed through the semantic detection model and recorded in the log.
[0028] Furthermore, if so, performing the replacement operation or the interception operation through the semantic detection model and recording the result in the log includes:
[0029] When performing the replacement operation, the positions of sensitive characters in the sensitive text are identified according to the attention map of the previous output layer of the semantic detection model.
[0030] Furthermore, the step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text by a set confidence threshold further includes:
[0031] Collect training corpus to obtain search training corpus;
[0032] Generating negative training examples from the search training corpus and the vocabulary expansion corpus by replacing characters and changing word order to obtain adversarial training corpus;
[0033] The semantic detection model is trained according to the adversarial training corpus to obtain the pre-trained semantic detection model.
[0034] Furthermore, the step of training the semantic detection model according to the adversarial training corpus to obtain the pre-trained semantic detection model includes:
[0035] Fine-tuning the language model and the semantic detection model; wherein the fine-tuning includes a full fine-tuning mode, a classifier fine-tuning mode, a small sample mode, and an online learning mode;
[0036] When there is a lot of labeled data, the full fine-tuning mode is activated to fine-tune the entire language model; wherein the fine-tuning includes word vector freezing and network fine-tuning;
[0037] When the labeled data is less, starting the classifier fine-tuning mode, fine-tuning the classification layer of the language model, and freezing other parts;
[0038] When the amount of data is small, the small sample mode is activated, and the classification layer or parameters of the semantic detection model are fine-tuned;
[0039] When the online learning mode is started, the parameters of the language model or the semantic detection model are dynamically adjusted through an incremental update mechanism.
[0040] Furthermore, the pre-trained semantic detection model is converted into a lightweight model through knowledge distillation and quantization compression, and the lightweight model is deployed on the edge;
[0041] Steps S1-S7, the expanded keyword vocabulary and the pre-trained semantic detection model are encrypted for storage and encrypted transmission.
[0042] The present invention also provides a system for improving text content recognition and classification, which includes an edge end, an expansion module, a receiving module, a word segmenter, a keyword detection module, a processing module, a semantic detection module and an output module; the expansion module is used to expand the keyword vocabulary and the semantic detection model based on a preset data augmentation strategy to obtain an expanded keyword vocabulary and expanded semantic model training data; the receiving module is used to receive the user's input text; the word segmenter is used to segment the input text to obtain a text word segmentation set; the keyword detection module is used to determine whether the keywords in the text word segmentation set match the keywords in the expanded keyword vocabulary; the processing module is used to process the input text into a model format to obtain a processed text; the semantic detection module is deployed on the edge end and is used to determine whether the processed text is non-compliant text or sensitive text through a set confidence threshold; the output module is used to output the processed text.
[0043] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in any one of the above methods.
[0044] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above methods when the computer program is executed by a processor.
[0045] The present invention provides a method, system, and computer device for improving text content recognition and classification, which have the following beneficial effects:
[0046] This application uses a hierarchical processing architecture that integrates keyword matching and semantic detection models, and combines dynamic data augmentation with lightweight edge deployment to judge text categories in the case of keyword matching, balancing the needs of real-time processing and high accuracy, achieving real-time and efficient processing of text review, sensitive information filtering, and content classification scenarios, improving the real-time performance of text recognition and processing, and can be applied to application scenarios such as social media review, intelligent customer service, and data compliance checks that have strict requirements on corresponding speed and accuracy. The semantic detection model covers missed words and context-insecure semantic scenarios that cannot be resolved by the keyword matching module, improving accuracy, and the confidence threshold is a dynamic threshold that can be automatically adjusted according to the needs of the scenario to balance the false positive rate and missed detection rate.
[0047] This application sets up a data augmentation strategy, which can expand data under the condition of missing data samples, expand variant words through the rule engine and language model, so that the keyword matching module can cover more derivative words and adversarial words, improve the hit rate of keywords and improve the recall performance of the keyword matching module, thereby improving real-time performance. It enables the semantic detection model to generate more semantic detection model training data, improve the performance and robustness of the semantic detection model, improve the accuracy of adversarial text recognition such as glyph variation and word order permutation, and build a collaborative optimization mechanism for keyword word list expansion and semantic detection model expansion. It can also match different fine-tuning modes according to different data volumes to adapt to different application scenarios, ensure model performance while making full use of sample information, improve the detection performance and flexibility of the semantic detection model, and be able to efficiently train the model under small sample conditions.
[0048] This application uses knowledge distillation and model quantization compression to convert pre-trained semantic detection models into lightweight models and input text into a model format for edge devices, reducing the memory occupied by edge devices, achieving resource optimization for lightweight deployment on the edge, and improving inference speed. The expanded keyword vocabulary, pre-trained semantic detection models, and execution processes are encrypted for storage and transmission, ensuring the security of sensitive data during transmission and storage, protecting privacy, and effectively improving business anti-attack capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A schematic diagram of the steps of a method for improving text content recognition and classification in the present invention;
[0050] Figure 2 This is a structural diagram of a system for improving text content recognition and classification in the present invention;
[0051] Figure 3 A structural block diagram of a computer device of the present invention;
[0052] Figure 4A flowchart of an embodiment of a method for improving text content recognition and classification according to the present invention;
[0053] Figure 5 A schematic diagram of the workflow of a keyword detection module in a method for improving text content recognition and classification according to the present invention;
[0054] Figure 6 This is a flow chart of a data augmentation strategy and a training semantic detection model in a method for improving text content recognition and classification according to the present invention.
[0055] Description of the markings: edge end 10, semantic detection module 20, expansion module 30, receiving module 40, word segmenter 50, keyword detection module 60, processing module 70, output module 80. DETAILED DESCRIPTION
[0056] 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.
[0057] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0058] Existing technologies struggle to achieve both real-time and accurate text content recognition. Keyword matching systems offer high speed but low precision, while semantic models offer high precision but high latency. Furthermore, model training relies on labeled data, which requires a large number of manually annotated samples, resulting in high cold start costs. Keyword matching solutions struggle to adapt to dynamic semantic changes, and semantic models based on traditional supervised learning also require significant manpower to acquire dynamic semantically annotated data, resulting in poor dynamic adaptability. Large model deployments are not compatible with the computing power of edge devices, making on-device deployment difficult.
[0059] Reference Attachment Figure 1 , a method for improving text content recognition and classification in one embodiment of the present invention, comprising the following steps:
[0060] S1, receiving user input text;
[0061] S2, segment the input text using a preset word segmenter to obtain a text word set;
[0062] S3, based on a preset data augmentation strategy and a text segmentation set, expanding a preset keyword vocabulary and a preset semantic detection model to obtain an expanded keyword vocabulary and expanded semantic model training data; wherein the keyword vocabulary includes single keywords and combined keywords;
[0063] S4, determining whether the keywords in the text segmentation set match the expanded keyword vocabulary;
[0064] S5, if not, then process the input text into the model format to obtain the processed text;
[0065] S6, inputting the processed text into a preset pre-trained semantic detection model, and determining whether the processed text is non-compliant text or sensitive text based on a set confidence threshold; wherein the confidence threshold is a dynamic threshold;
[0066] S7, if not, output the processed text.
[0067] In the above steps, the user's input text is first received, and then the input text is segmented by a preset word segmenter to obtain a text segmentation set, which includes multiple text segmentations. Figure 4 As shown, in a specific embodiment, the input text includes sentences, and the word segmenter segments the sentences. Then, the keyword vocabulary and the semantic detection model are expanded through the data augmentation strategy and the text word segmentation set to obtain the expanded keyword vocabulary and the expanded semantic model training data. Among them, the keyword vocabulary includes single keywords and combined keywords. The present application sets a data augmentation strategy to expand variant words through the rule engine and the language model, so that the keyword matching module can cover more derivative words and adversarial words, improve the hit rate of keywords and improve the recall performance of the keyword matching module, thereby improving real-time performance. The semantic detection model can generate more semantic detection model training data, improve the performance and robustness of the semantic detection model, and improve the accuracy of adversarial text recognition such as glyph variation and word order substitution.
[0068] Furthermore, the keyword vocabulary is updated in a differential update manner, that is, only newly added or modified data is transmitted, and then the local keyword vocabulary is updated based on this data, thereby saving bandwidth and storage space and improving efficiency.
[0069] Next, a determination is made as to whether the text segmentation set matches the expanded keyword vocabulary. The matching method can be to match the text segmentations in the text segmentation set one by one or simultaneously. If not, the text segmentation set is processed into a model format to obtain processed text. The processed text is input into a preset pre-trained semantic detection model, and a set confidence threshold is used to determine whether the processed text is non-compliant or sensitive text; the confidence threshold is a dynamic threshold. If not, the processed text is output. This application adopts a two-stage decision-making mechanism. The first stage is primary filtering: after a text segmentation in the text segmentation set matches the expanded keyword vocabulary, a preset action is immediately executed, including replacement, blocking, and logging. The second stage is deep analysis: if there is no match with the expanded keyword vocabulary, the semantic detection model is triggered and a decision is made using a confidence threshold, with the confidence threshold being a dynamic range. This initial filtering followed by deep analysis establishes a hierarchical processing architecture and cascaded computing approach, which can balance the requirements of real-time processing and high accuracy. The cascaded computing involves feeding samples that have passed the previous stage into the next stage of processing, gradually improving accuracy through multiple classifiers.
[0070] In one specific embodiment, after receiving the user input text "Please add satellite number 123 to obtain resources," keyword matching is first performed. The input text is segmented by a tokenizer to obtain a text token set ["please," "add," "satellite number," "123," "obtain," "resources"]. Based on the data augmentation strategy and the text token set, a keyword vocabulary is expanded, and additional expanded semantic model training data is generated from the keyword vocabulary. Adversarial samples are then generated based on the expanded semantic model training data to train a semantic detection model. Next, a determination is made as to whether keywords in the text token set match the expanded keyword vocabulary. If a match is found for "satellite number," and the expanded word layer "satellite number" is a variant of "WeChat ID," a replacement or interception operation is performed, recorded in the log, and the process ends. If not, the program will continue to execute, that is, the input text "Please add satellite number 123 to obtain resources" will be processed into a specific format of the semantic detection model to obtain the processed text. The processed text will then be input into the pre-trained semantic detection model. The pre-trained semantic detection model will judge the processed text based on the set confidence threshold. If it is judged to be non-compliant or sensitive text, the predefined replacement operation will be performed, that is, "Please add ** number 123 to obtain resources" or an interception operation will be performed, and the entry log will be recorded to end the program. Furthermore, the problem sample after the sensitive information is replaced can be uploaded to the training pool of the model. If not, the processed text will be output, and then the program will end. During this period, the keyword matching process and the semantic detection model are updated online according to the set data augmentation strategy, and the semantic detection model can be updated locally according to the actual scenario and the training strategy based on the training of this application to ensure local data security and improve model performance.
[0071] Furthermore, the semantic detection model can capture missed data to ensure accuracy, where missed data refers to data that is not correctly identified, extracted or processed during data processing, recall or update, and is ultimately omitted from the target dataset.
[0072] This application uses a hierarchical processing architecture that integrates keyword matching and semantic detection models, and combines dynamic data augmentation with lightweight edge deployment to judge text categories in the case of keyword matching, thereby achieving real-time and efficient processing of text review, sensitive information filtering, and content classification scenarios, improving the real-time performance of text recognition and processing, and can be applied to application scenarios such as social media review, intelligent customer service, and data compliance checks that have strict requirements on corresponding speed and accuracy. The semantic detection model covers missed words and context-insecure semantic scenarios that cannot be resolved by the keyword matching module, thereby improving accuracy, and the confidence threshold is a dynamic threshold that can be automatically adjusted according to the needs of the scenario to balance the false positive rate and missed detection rate.
[0073] This application matches different fine-tuning modes according to different data volumes to adapt to different application scenarios, ensuring model performance while making full use of sample information, and improving the detection performance and flexibility of the semantic detection model. This application uses knowledge distillation and model quantization technology to compress the parameters of the semantic detection model, reduce the memory occupied by edge devices, and improve the reasoning speed. The parameters of the expanded keyword vocabulary and semantic detection model are encrypted for storage, encrypted for transmission, and differentially updated to ensure the security of sensitive data during transmission and storage, play a role in protecting privacy, and effectively improve the business's anti-attack capabilities.
[0074] Furthermore, this application has the ability to generalize to multiple scenarios, and can seamlessly adapt to scenarios such as social media review, financial risk control, and intelligent customer service. It supports customized action strategies such as blocking, replacement, and alarms, and significantly enhances business scalability.
[0075] In one embodiment, the step of segmenting the input text using a preset word segmenter to obtain a text word segmentation set includes:
[0076] Generate a directed acyclic graph through the Trie tree structure;
[0077] Perform multi-granularity segmentation on the input text using the preset maximum probability path model;
[0078] Compress repeated input text.
[0079] In this embodiment, a directed acyclic graph is generated by a Trie tree structure. The Trie tree is a tree structure used to process string matching. Each node of the Trie tree represents a character, and the path from the root node to a certain node represents a string. The Trie tree uses the common prefix of the string to reduce the query time and can improve the query efficiency. In a specific embodiment, the Trie tree is a suffix tree, and the root node connects multiple paths, each path represents a character, and finally reaches a leaf node. A directed acyclic graph (DAG) is a graph structure, that is, the edges in the graph are directed, each edge points from one node to another, and there are no loops in the graph. Specifically, it is impossible to return to a node along a directed edge starting from a node.
[0080] The input text is then segmented into multiple granularities using a maximum probability model. The input text includes sentences, i.e., the sentences are segmented into multiple granularities. The maximum probability model is used to select the path with the highest probability from multiple segmentation paths. Specifically, the maximum probability model calculates the probability of each segmentation path based on the training data, and then selects the path with the highest probability as the final text segmentation set. In a specific embodiment, if the input text is "I love Beijing Tiananmen", the model will generate the segmentation paths of "I / love / Beijing / Tiananmen; I / love / Beijing Tiananmen; I / love / Beijing / Tiananmen". The model calculates the probability of "I / love / Beijing / Tiananmen" as 0.8 based on the training data; the probability of "I / love / Beijing Tiananmen" is 0.2; and the probability of "I / love / Beijing / Tiananmen" is 0.1. The model will then select the path with the highest probability of "I / love / Beijing / Tiananmen" as the final text segmentation set. The maximum probability path model can achieve multi-granularity segmentation of sentences.
[0081] Then, the repeated keywords in the text segmentation set are compressed to improve real-time performance.
[0082] In one embodiment, based on a preset data augmentation strategy and a text segmentation set, the steps of expanding a preset keyword vocabulary and a preset semantic detection model to obtain expanded keyword vocabulary and expanded semantic model training data include:
[0083] Generate semantically equivalent expressions of the text word set through a preset language model to obtain the vocabulary expansion corpus;
[0084] Perform cluster analysis on the text segmentation set to extract new keywords and new training data;
[0085] The new training data is incorporated into the original semantic model training data to obtain the expanded semantic model training data. At the same time, the new keywords are incorporated into the vocabulary expansion corpus.
[0086] In this embodiment, to solve the problem of difficult data collection, the keyword vocabulary and the semantic detection model are expanded. Specifically, the existing keywords are rewritten and semi-automatically annotated to obtain an expanded keyword vocabulary. Then, semantic equivalent expressions are generated through a language model to obtain a vocabulary expansion corpus. The data augmentation strategy includes keyword amplification and semantic model training data expansion. Keyword amplification includes keyword rewriting and keyword semi-automatic annotation, and semantic model training data expansion includes generating adversarial samples for semantic model training data and keyword-based semantic model training data augmentation.
[0087] Specifically, keyword rewriting is to generate semantic equivalent expressions of the text token set through a pre-trained language model to obtain a vocabulary expansion corpus. For example, "transfer" is expanded to "fund transfer", "remittance operation", and "WeChat" is expanded to "WeiXin", "Wei-Xin", "Wei Xin". In a specific embodiment, the language model is GPT.
[0088] Keyword semi-automatic annotation is to perform clustering analysis on the text token set, that is, to perform clustering analysis on the unmatched text to extract potential new keywords and new training data. Among them, clustering analysis is Clustering Analysis, which is used to group a set of data according to its inherent similarity or features. The data within the same group has high similarity, and the data between different groups has large differences. In a specific embodiment, the algorithms for clustering analysis include K-Means, Hierarchical Clustering, DBSCAN, and Gaussian Mixture Models (GMM).
[0089] Specifically, there may be texts with similar semantics in the unmatched text, and these texts represent new keywords or new expressions. Then, through clustering analysis, the texts with similar semantics can be grouped into the same group, so as to extract potential new keywords. In a specific embodiment, the unmatched text contains expressions such as "fund transfer" and "transfer operation", and these expressions have similar semantics to "transfer", so they can be extracted through clustering analysis. At the same time, clustering analysis can extract hidden patterns or categories in the unlabeled data, thereby generating new training data, which can be used for model training or data augmentation.
[0090] Keyword-based semantic model training data augmentation: Generate additional new semantic model training data according to the pre-trained language model and the expanded keyword vocabulary, that is, generate context semantic model training data. Finally, the new semantic model training data is incorporated into the original semantic model training data to obtain augmented semantic model training data.
[0091] In one embodiment, the step of determining whether the keywords in the text segmentation set match the expanded keyword vocabulary further includes:
[0092] If so, the preset replacement operation or interception operation is executed and recorded in the preset log.
[0093] In this embodiment, if Figure 5 As shown in the figure, when the text segmentation set matches the expanded keyword vocabulary, a text replacement or interception operation is performed and recorded in the log. If it does not match, the subsequent process is executed, that is, the text segmentation set is processed into processed text and input into the pre-trained semantic detection model.
[0094] In one embodiment, the step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text based on a set confidence threshold includes:
[0095] If so, a replacement or interception operation is performed through the semantic detection model and recorded in the log.
[0096] In this embodiment, a judgment is made based on a confidence threshold. If the text is non-compliant or sensitive, a replacement operation or an interception operation is performed through a semantic detection model and recorded in a log.
[0097] In one embodiment, if so, performing a replacement operation or an interception operation through a semantic detection model and recording the steps in the log include:
[0098] When performing the replacement operation, the locations of sensitive characters in the sensitive text are identified based on the attention map of the previous output layer of the semantic detection model.
[0099] In this embodiment, when performing a replacement operation, the character positions of sensitive text in the text or the targets that need to be replaced can be identified based on the attention map of the previous output layer of the semantic detection model. The attention map can reflect the degree of attention the model pays to different positions when processing text. By analyzing the degree of attention, it is possible to locate sensitive parts of the text or parts that need to be replaced. In a specific embodiment, a higher attention weight is given to the "satellite" in "satellite number", and based on the weight, the two words "satellite" can be replaced with "**", thereby achieving more efficient text purification or content interception.
[0100] In one embodiment, the step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text based on a set confidence threshold includes:
[0101] Collect training corpus to obtain search training corpus;
[0102] By replacing characters and changing word order, the search training corpus and the vocabulary expansion corpus are used to generate negative training examples to obtain adversarial training corpus.
[0103] The semantic detection model is trained according to the adversarial training corpus to obtain a pre-trained semantic detection model.
[0104] In this embodiment, if Figure 6 As shown, the training corpus is searched to obtain the search training corpus. The search training corpus and the vocabulary expansion corpus are used to generate training negative examples by replacing characters and permuting word order to obtain the adversarial training corpus, that is, the training negative examples of the search training corpus and the vocabulary expansion corpus are generated by replacing characters and permuting word order. Among them, the training negative examples refer to the sample data that do not belong to the target category during the training of the learning model, which can distinguish the target category from other categories, thereby improving the accuracy of classification. For example, when identifying images of cats, the positive examples are pictures containing cats, and the negative examples are pictures that do not contain cats, such as dogs and birds. The model learns the features of non-cat objects through negative examples to accurately identify cats. The training negative examples can effectively improve the classification ability of the model. The semantic detection model is then trained based on the adversarial training corpus to obtain a pre-trained semantic detection model, wherein the semantic detection model includes a discriminant model and a generative model.
[0105] In one embodiment, the step of training a semantic detection model based on adversarial training corpus to obtain a pre-trained semantic detection model includes:
[0106] Fine-tune the language model and semantic detection model; fine-tuning includes full fine-tuning mode, classifier fine-tuning mode, small sample mode, and online learning mode;
[0107] When there is a lot of labeled data, start the full fine-tuning mode to fine-tune the entire language model. Fine-tuning includes freezing word vectors and fine-tuning the network.
[0108] When there is less labeled data, start the classifier fine-tuning mode, fine-tune the classification layer of the language model, and freeze other parts;
[0109] When the amount of data is small, start the small sample mode and fine-tune the classification layer or parameters of the semantic detection model;
[0110] When the online learning mode is started, the parameters of the language model or semantic detection model are dynamically adjusted through the incremental update mechanism.
[0111] In this embodiment, in addition to training the model from scratch using all the data, since labeled data for text content recognition is always relatively scarce, a fine-tuning mode is applied based on the trained language model. Training from scratch refers to training a model from scratch, without using any pre-trained weights, and using the dataset from scratch.
[0112] Fine-tuning modes include full fine-tuning mode, classifier fine-tuning mode, small sample mode, and online learning mode. When there is a large amount of annotated data, full fine-tuning mode is activated to fine-tune the entire model at a low learning rate, specifically freezing the word embedding layer and fine-tuning the network. When the amount of annotated data is small, classifier fine-tuning mode is activated to fine-tune the classification layer of the model at a low learning rate, freezing the rest of the model. When the amount of annotated data is small, for semantic classification models, small sample mode is activated and the classification layer is fine-tuned. For large language generation models, Prompt-Tune and LoRa are combined for fine-tuning. Prompt-Tune adds additional trainable tokens (a string of characters or symbols) to the input sequence of the pre-trained model to adapt it to downstream tasks. Instead of adjusting the parameters of the pre-trained model, it guides the model output by adding task-related prompts, thereby reducing computational cost and storage requirements. LoRa is a low-rank adaptation of large language models. LoRA fine-tunes the model by training a low-rank matrix and then injecting these parameters into the original model. It not only reduces computing requirements but also reduces training resources and can be used in resource-limited environments.
[0113] The online learning model dynamically adjusts model parameters through an incremental update mechanism. This mechanism gradually updates model parameters during model training or optimization. This mechanism is suitable for scenarios with large, constantly changing data volumes or those that require real-time adaptation to new data. Compared to training a model from scratch, incremental updates require fewer computing resources, as each update processes only the newly added data, rather than the entire dataset, reducing computer resource consumption.
[0114] In one embodiment, a pre-trained semantic detection model is converted into a lightweight model through knowledge distillation and quantization compression, and the lightweight model is deployed on the edge.
[0115] In this embodiment, knowledge distillation is machine learning, which can transfer the knowledge of complex models into simpler, more lightweight models, significantly reducing computing resource requirements while maintaining high performance. Quantization compression reduces the precision of model parameters, such as reducing 32-bit floating-point numbers to 8-bit integers, thereby reducing the memory space and computing resources occupied by each parameter.
[0116] In one embodiment, steps S1-S7, the expanded keyword vocabulary, and the pre-trained semantic detection model are encrypted for storage and encrypted transmission.
[0117] In this embodiment, the expanded keyword vocabulary, the execution processes of S1 - S7, and the pre - trained semantic detection model are encrypted for storage and transmission. Through encrypted storage and transmission, it can play a role in protecting privacy, ensure the security of sensitive data during transmission and storage, and effectively enhance the business's anti - attack ability.
[0118] In one embodiment, the keyword vocabulary is updated by difference to obtain the expanded keyword vocabulary; single keywords include base words and extended words. The base words are used to generate a static keyword vocabulary, and the extended words are variant words generated dynamically; dynamic generation is through expansion by glyph, pinyin, synonym conversion rules or semantic expansion based on a preset large - language model; combined keywords include combined words, and the combined words are used to generate a combined expression template library.
[0119] In this embodiment, differential update only transmits or stores the changed parts of the data rather than the complete data set, which can significantly reduce the data transmission volume and storage space occupation. The keyword vocabulary includes single keywords and combined keywords. Single keywords include base words and extended words. The base words can generate a static keyword vocabulary; the extended words can dynamically generate variant words. Specifically, they are automatically expanded through glyph, pinyin, and synonym conversion rules, or can also be expanded based on a large - language model. Combined keywords include combined words, and the combined words can generate a combined expression template library to identify combined variants such as "micro + letter", and finally compress the duplicate keywords.
[0120] Refer to Appendix Figure 2 , a system for improving text content recognition and classification, includes an edge device, an expansion module, a receiving module, a tokenizer, a keyword detection module, a processing module, a semantic detection module, and an output module; the expansion module is used to expand the keyword vocabulary and the semantic detection model based on a preset data augmentation strategy to obtain an expanded keyword vocabulary and an augmented semantic model training data set; the receiving module is used to receive the input text of the user; the tokenizer is used to segment the input text to obtain a text token set; the keyword detection module is used to determine whether the keywords in the text token set match the keywords in the expanded keyword vocabulary; the processing module is used to process the input text into a model format to obtain a processed text; the semantic detection module is deployed on the edge device and is used to determine whether the processed text is non - compliant text or sensitive text through a set confidence threshold; the output module is used to output the processed text.
[0121] In this embodiment, the receiving module first receives the user's input text, and then the word segmenter can segment the input text to obtain a text word set; then the expansion module expands the keyword word list based on the data augmentation strategy to obtain an expanded keyword word list; then the keyword detection module determines whether the keywords in the text word set match the expanded keyword word list. If not, the processing module processes the input text into a semantic detection model format to obtain a processed text. Then the semantic detection module determines whether the processed text is non-compliant text or sensitive text through a set confidence threshold and deploys it on the edge end; wherein the edge end is an edge device, such as a mobile phone, tablet, or computer; if not, the processed text is output through the output module.
[0122] Reference Attachment Figure 3 In the embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory is the operating system, computer program and database in the non-volatile storage medium. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data such as templates, tables, preset fields, etc. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a method for improving text content recognition and classification, including the following steps:
[0123] Receive user input text;
[0124] The input text is segmented by a preset word segmenter to obtain a text word segmentation set;
[0125] Based on a preset data augmentation strategy and a text segmentation set, a preset keyword vocabulary and a preset semantic detection model are expanded to obtain an expanded keyword vocabulary and expanded semantic model training data; wherein the keyword vocabulary includes single keywords and combined keywords;
[0126] Determine whether the keywords in the text segmentation set match the expanded keyword vocabulary;
[0127] If not, the input text is processed into the model format to obtain the processed text;
[0128] Input the processed text into a preset pre-trained semantic detection model and determine whether the processed text is non-compliant or sensitive text based on a set confidence threshold; the confidence threshold is a dynamic threshold;
[0129] If not, the processed text is output.
[0130] In one embodiment, the step of segmenting the input text using a preset word segmenter to obtain a text word segmentation set includes:
[0131] Generate a directed acyclic graph through the Trie tree structure;
[0132] Perform multi-granularity segmentation on the input text using the preset maximum probability path model;
[0133] Compress repeated input text.
[0134] In one embodiment, the step of expanding a preset keyword vocabulary and a preset semantic detection model based on a preset data augmentation strategy to obtain expanded keyword vocabulary and expanded semantic model training data includes:
[0135] Generate semantically equivalent expressions of the text word set through a preset language model to obtain the vocabulary expansion corpus;
[0136] Perform cluster analysis on the text segmentation set to extract new keywords and new training data;
[0137] Generate new keywords and new training data through character replacement and word order permutation to obtain adversarial samples;
[0138] Generate new semantic model training data based on the language model and the expanded keyword vocabulary;
[0139] The new semantic model training data is merged into the original semantic model training data to obtain the expanded semantic model training data.
[0140] In one embodiment, the step of determining whether the text segmentation set matches the expanded keyword vocabulary further includes:
[0141] If so, the preset replacement operation or interception operation is executed and recorded in the preset log; the keyword vocabulary is updated through differential update to obtain an expanded keyword vocabulary; single keywords include basic words and extended words, basic words are used to generate static keyword vocabulary, and extended words are dynamically generated variant words; dynamic generation is expansion through glyph, pinyin, synonym conversion rules or semantic expansion based on a preset large language model; combined keywords include combined words, and combined words are used to generate a combined expression template library.
[0142] In one embodiment, the step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text based on a set confidence threshold includes:
[0143] If so, a replacement or interception operation is performed through the semantic detection model and recorded in the log.
[0144] In one embodiment, if so, performing a replacement operation or an interception operation through a semantic detection model and recording the steps in the log include:
[0145] When performing the replacement operation, the locations of sensitive characters in the sensitive text are identified based on the attention map of the previous output layer of the semantic detection model.
[0146] In one embodiment, the step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text based on a set confidence threshold includes:
[0147] Collect training corpus to obtain search training corpus;
[0148] Generate adversarial training corpus based on search training corpus and vocabulary expansion corpus;
[0149] The semantic detection model is trained according to the adversarial training corpus to obtain a pre-trained semantic detection model.
[0150] In one embodiment, the step of training a semantic detection model based on adversarial training corpus to obtain a pre-trained semantic detection model includes:
[0151] Fine-tune the language model and semantic detection model; fine-tuning includes full fine-tuning mode, classifier fine-tuning mode, small sample mode, and online learning mode;
[0152] When there is a lot of labeled data, start the full fine-tuning mode to fine-tune the entire language model. Fine-tuning includes freezing word vectors and fine-tuning the network.
[0153] When there is less labeled data, start the classifier fine-tuning mode, fine-tune the classification layer of the language model, and freeze other parts;
[0154] When the amount of data is small, start the small sample mode and fine-tune the classification layer or parameters of the semantic detection model;
[0155] When the online learning mode is started, the parameters of the language model or semantic detection model are dynamically adjusted through the incremental update mechanism.
[0156] In one embodiment, a pre-trained semantic detection model is converted into a lightweight model through knowledge distillation and quantization compression, and the lightweight model is deployed on the edge; the execution steps, expanded keyword vocabulary and pre-trained semantic detection model are encrypted, stored and transmitted.
[0157] In one embodiment, a single keyword includes a basic word and an extended word. The basic word is used to generate a static keyword vocabulary, and the extended word is a dynamically generated variant word; the dynamic generation is an expansion through glyph, pinyin, synonym conversion rules or a semantic expansion based on a preset large language model; the combined keyword includes a combined word, and the combined word is used to generate a combined expression template library.
[0158] Those skilled in the art will understand that Figure 3 The structure shown in is merely a block diagram of a portion of the structure related to the present application solution and does not constitute a limitation on the computer device to which the present application solution is applied.
[0159] An embodiment of the present application further provides a computer storage medium having a computer program stored thereon. When the computer program is executed by a processor, a method for improving text content recognition and classification is implemented, comprising the following steps:
[0160] Receive user input text;
[0161] The input text is segmented by a preset word segmenter to obtain a text word segmentation set;
[0162] Based on a preset data augmentation strategy and a text segmentation set, a preset keyword vocabulary and a preset semantic detection model are expanded to obtain an expanded keyword vocabulary and expanded semantic model training data; wherein the keyword vocabulary includes single keywords and combined keywords;
[0163] Determine whether the keywords in the text segmentation set match the expanded keyword vocabulary;
[0164] If not, the input text is processed into the model format to obtain the processed text;
[0165] Input the processed text into a preset pre-trained semantic detection model and determine whether the processed text is non-compliant or sensitive text based on a set confidence threshold; the confidence threshold is a dynamic threshold;
[0166] If not, the processed text is output.
[0167] In one embodiment, the step of segmenting the input text using a preset word segmenter to obtain a text word segmentation set includes:
[0168] Generate a directed acyclic graph through the Trie tree structure;
[0169] Perform multi-granularity segmentation on the input text using the preset maximum probability path model;
[0170] Compress repeated input text.
[0171] In one embodiment, the step of expanding a preset keyword vocabulary and a preset semantic detection model based on a preset data augmentation strategy to obtain expanded keyword vocabulary and expanded semantic model training data includes:
[0172] Generate semantically equivalent expressions of the text word set through a preset language model to obtain the vocabulary expansion corpus;
[0173] Perform cluster analysis on the text segmentation set to extract new keywords and new training data;
[0174] Generate new keywords and new training data through character replacement and word order permutation to obtain adversarial samples;
[0175] Generate new semantic model training data based on the language model and the expanded keyword vocabulary;
[0176] The new semantic model training data is merged into the original semantic model training data to obtain the expanded semantic model training data.
[0177] In one embodiment, the step of determining whether the text segmentation set matches the expanded keyword vocabulary further includes:
[0178] If so, the preset replacement operation or interception operation is executed and recorded in the preset log; the keyword vocabulary is updated through differential update to obtain an expanded keyword vocabulary; single keywords include basic words and extended words, basic words are used to generate static keyword vocabulary, and extended words are dynamically generated variant words; dynamic generation is expansion through glyph, pinyin, synonym conversion rules or semantic expansion based on a preset large language model; combined keywords include combined words, and combined words are used to generate a combined expression template library.
[0179] In one embodiment, the step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text based on a set confidence threshold includes:
[0180] If so, a replacement or interception operation is performed through the semantic detection model and recorded in the log.
[0181] In one embodiment, if so, performing a replacement operation or an interception operation through a semantic detection model and recording the steps in the log include:
[0182] When performing the replacement operation, the locations of sensitive characters in the sensitive text are identified based on the attention map of the previous output layer of the semantic detection model.
[0183] In one embodiment, the step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text based on a set confidence threshold includes:
[0184] Collect training corpus to obtain search training corpus;
[0185] Generate adversarial training corpus based on search training corpus and vocabulary expansion corpus;
[0186] The semantic detection model is trained according to the adversarial training corpus to obtain a pre-trained semantic detection model.
[0187] In one embodiment, the step of training a semantic detection model based on adversarial training corpus to obtain a pre-trained semantic detection model includes:
[0188] Fine-tune the language model and semantic detection model; fine-tuning includes full fine-tuning mode, classifier fine-tuning mode, small sample mode, and online learning mode;
[0189] When there is a lot of labeled data, start the full fine-tuning mode to fine-tune the entire language model. Fine-tuning includes freezing word vectors and fine-tuning the network.
[0190] When there is less labeled data, start the classifier fine-tuning mode, fine-tune the classification layer of the language model, and freeze other parts;
[0191] When the amount of data is small, start the small sample mode and fine-tune the classification layer or parameters of the semantic detection model;
[0192] When the online learning mode is started, the parameters of the language model or semantic detection model are dynamically adjusted through the incremental update mechanism.
[0193] In one embodiment, a pre-trained semantic detection model is converted into a lightweight model through knowledge distillation and quantization compression, and the lightweight model is deployed on the edge; the execution steps, expanded keyword vocabulary and pre-trained semantic detection model are encrypted, stored and transmitted.
[0194] In one embodiment, a single keyword includes a basic word and an extended word. The basic word is used to generate a static keyword vocabulary, and the extended word is a dynamically generated variant word; the dynamic generation is an expansion through glyph, pinyin, synonym conversion rules or a semantic expansion based on a preset large language model; the combined keyword includes a combined word, and the combined word is used to generate a combined expression template library.
[0195] In summary, the present invention provides a method, system and computer device for improving text content recognition and classification. The present invention uses a hierarchical processing architecture that integrates keyword matching and semantic detection models, and combines the augmentation of dynamic data with lightweight edge deployment to judge text categories in the case of keyword matching, balance the needs of real-time processing and high accuracy, and realize real-time and efficient processing of text review, sensitive information filtering, and content classification scenarios, thereby improving the real-time performance of text recognition and processing. It can be applied to application scenarios such as social media review, intelligent customer service, and data compliance inspection that have strict requirements on corresponding speed and accuracy. The semantic detection model covers the context-unsafe semantic scenarios that missed words and keyword matching modules cannot solve, thereby improving accuracy, and the confidence threshold is a dynamic threshold that can be automatically adjusted according to the needs of the scenario, balancing the false positive rate and the missed detection rate. The present invention sets a data augmentation strategy that can expand data under the condition of missing data samples, expand variant words through the rule engine and language model, so that the keyword matching module can cover more derivative words and adversarial words, improve the hit rate of keywords, and improve the recall performance of the keyword matching module, thereby improving real-time performance. The semantic detection model is enabled to generate more semantic detection model training data, improve the performance and robustness of the semantic detection model, improve the accuracy of adversarial text recognition such as glyph variation and word order permutation, and build a collaborative optimization mechanism for keyword vocabulary expansion and semantic detection model expansion. It can also match different fine-tuning modes according to different data volumes to adapt to different application scenarios, while fully utilizing sample information to ensure model performance, improve the detection performance and flexibility of the semantic detection model, and be able to efficiently train the model under small sample conditions. This application uses knowledge distillation and model quantization compression to convert the pre-trained semantic detection model into a lightweight model and convert the input text into a model format for the edge end, reducing the memory occupied by the edge device, realizing resource optimization of lightweight deployment on the end side, and improving the inference speed. The expanded keyword vocabulary, pre-trained semantic detection model and execution process are encrypted for storage and encrypted transmission to ensure the security of sensitive data during transmission and storage, play a role in protecting privacy, and effectively improve the business's anti-attack capabilities.
[0196] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM).
[0197] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, apparatus, article, or method comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, apparatus, article, or method. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, apparatus, article, or method comprising the element.
[0198] The above description is only a preferred embodiment of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for improving text content recognition and classification, characterized in that: The following steps are involved: S1, receiving user input text; S2, segmenting the input text using a preset word segmenter to obtain a text word segmentation set; S3, based on a preset data augmentation strategy and the text segmentation set, expanding a preset keyword vocabulary and a preset semantic detection model to obtain an expanded keyword vocabulary and expanded semantic model training data; wherein the keyword vocabulary includes single keywords and combined keywords; S4, determining whether the keywords in the text segmentation set match the expanded keyword vocabulary; S5, if not, processing the input text into a model format to obtain a processed text; S6, inputting the processed text into a preset pre-trained semantic detection model, and determining whether the processed text is non-compliant text or sensitive text through a set confidence threshold; wherein the confidence threshold is a dynamic threshold; S7: If not, output the processed text.
2. The method for improving text content recognition and classification according to claim 1, characterized in that: The step of segmenting the input text by a preset word segmenter to obtain a text word segmentation set includes: Generate a directed acyclic graph through the Trie tree structure; Performing multi-granularity segmentation on the input text using a preset maximum probability path model; Compress repeated input text.
3. The method for improving text content recognition and classification according to claim 1, characterized in that: The step of expanding a preset keyword vocabulary and a preset semantic detection model based on a preset data augmentation strategy and the text segmentation set to obtain expanded keyword vocabulary and expanded semantic model training data includes: Generate semantically equivalent expressions of the text word set using a preset language model to obtain a vocabulary expansion corpus; Performing cluster analysis on the text segmentation set to extract new keywords and new training data; The new training data is incorporated into the original semantic model training data to obtain the expanded semantic model training data. At the same time, the new keywords are incorporated into the vocabulary expansion corpus.
4. The method for improving text content recognition and classification according to claim 1, characterized in that: The step of determining whether the keywords in the text segmentation set match the expanded keyword vocabulary also includes: If so, the preset replacement operation or interception operation is executed and recorded in the preset log; The keyword vocabulary is updated by differential to obtain the expanded keyword vocabulary; The single keyword includes a basic word and an extended word, wherein the basic word is used to generate a static keyword vocabulary, and the extended word is a dynamically generated variant word; The dynamic generation is through the expansion of glyph, pinyin, synonym conversion rules or semantic expansion based on a preset large language model; The combination keywords include combination words, and the combination words are used to generate a combination expression template library.
5. The method for improving text content recognition and classification according to claim 4, characterized in that: The step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text by using a set confidence threshold includes: If so, the replacement operation or the interception operation is performed through the semantic detection model and recorded in the log.
6. The method for improving text content recognition and classification according to claim 5, characterized in that: If so, performing the replacement operation or the interception operation through the semantic detection model and recording the result in the log includes: When performing the replacement operation, the positions of sensitive characters in the sensitive text are identified according to the attention map of the previous output layer of the semantic detection model.
7. The method for improving text content recognition and classification according to claim 3, characterized in that: The step of inputting the processed text into a preset pre-trained semantic detection model and determining whether the processed text is non-compliant text or sensitive text according to a set confidence threshold further includes: Collect training corpus to obtain search training corpus; Generating negative training examples from the search training corpus and the vocabulary expansion corpus by replacing characters and changing word order to obtain adversarial training corpus; The semantic detection model is trained according to the adversarial training corpus to obtain the pre-trained semantic detection model.
8. The method for improving text content recognition and classification according to claim 7, characterized in that: The step of training the semantic detection model according to the adversarial training corpus to obtain the pre-trained semantic detection model includes: Fine-tuning the language model and the semantic detection model; wherein the fine-tuning includes a full fine-tuning mode, a classifier fine-tuning mode, a small sample mode, and an online learning mode; When there is a lot of labeled data, the full fine-tuning mode is activated to fine-tune the entire language model; wherein the fine-tuning includes word vector freezing and network fine-tuning; When the labeled data is less, starting the classifier fine-tuning mode, fine-tuning the classification layer of the language model, and freezing other parts; When the amount of data is small, the small sample mode is activated, and the classification layer or parameters of the semantic detection model are fine-tuned; When the online learning mode is started, the parameters of the language model or the semantic detection model are dynamically adjusted through an incremental update mechanism.
9. The method for improving text content recognition and classification according to claim 1, wherein: Converting the pre-trained semantic detection model into a lightweight model through knowledge distillation and quantization compression, and deploying the lightweight model on the edge; Steps S1-S7, the expanded keyword vocabulary and the pre-trained semantic detection model are encrypted for storage and encrypted transmission.
10. A system for improving text content recognition and classification, characterized in that: It includes edge end, expansion module, receiving module, word segmenter, keyword detection module, processing module, semantic detection module and output module; The expansion module is used to expand the keyword vocabulary and the semantic detection model based on a preset data augmentation strategy to obtain an expanded keyword vocabulary and expanded semantic model training data; the receiving module is used to receive the user's input text; the word segmenter is used to segment the input text to obtain a text segmentation set; the keyword detection module is used to determine whether the keywords in the text segmentation set match the keywords in the expanded keyword vocabulary; the processing module is used to process the input text into a model format to obtain a processed text; the semantic detection module is deployed on the edge end and is used to determine whether the processed text is non-compliant text or sensitive text through a set confidence threshold; the output module is used to output the processed text.
11. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer storage medium storing a computer program, wherein: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Text content auditing method and device, computer equipment and storage medium
CN113688630A
Sensitive word auditing method based on large language model, storage medium and electronic equipment
CN116720515A
Cited By
Data processing method, model training method, system, device, equipment, storage medium and program product
CN121682541A