Sensitive text classification method based on self-supervised enhanced graph learning
By constructing a global document graph and a text graph through a self-supervised reinforcement graph learning method, and combining it with group-relative strategy optimization, the problem of performance degradation in sensitive text classification in small sample scenarios is solved, and efficient and accurate sensitive text classification is achieved.
Patent Information
- Application Number
- CN202511464670.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-14
- Publication Date
- 2026-01-16
AI Technical Summary
Existing sensitive text classification methods struggle to fully learn the features of sensitive texts in small sample scenarios, resulting in a significant drop in classification performance. Furthermore, existing technologies are unable to effectively distinguish between texts with similar content but inconsistent sensitivity levels, leading to a high false positive rate.
A self-supervised reinforcement graph learning method is adopted. By initializing the classification model and policy model to filter the vocabulary, a global document graph and text graph are constructed. Heterogeneous graph learning is used to extract global semantic features. The policy model is iteratively updated by combining group relative policy optimization to optimize the vocabulary filtering strategy and achieve the optimal document graph configuration.
It improves the accuracy and speed of sensitive text classification, reduces computational cost, effectively distinguishes confusing sensitive types, and is suitable for sensitive text classification tasks in scenarios with small sample sizes.
Smart Images

Figure CN121350877A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural language processing technology, specifically, it relates to a sensitive text classification method based on self-supervised reinforcement graph learning. Background Technology
[0002] As countries tighten their censorship and control over sensitive content, the accurate classification of sensitive texts using natural language processing technology has become a crucial need. Sensitive texts encompass a variety of types, including violence and terrorism, political sensitivities, military secrets, hate speech, and cyberbullying. Related classification research has been conducted in areas such as personal sensitive information identification, social media sensitive speech detection, and pornography identification. However, due to limitations imposed by relevant laws, professionally labeled sensitive text data is difficult to obtain, severely hindering the progress of sensitive text classification research.
[0003] Existing methods for classifying sensitive text have many limitations and are difficult to meet the needs of practical applications: Traditional sensitive text classification relies on human judgment criteria. For confusing texts with similar content but inconsistent sensitivity levels, semantic understanding or context alone cannot effectively distinguish them. Early methods were mostly based on pattern matching using a pre-set sensitive word list, or combined with rule functions and relevance thresholds for screening, supplemented by traditional machine learning to complete the classification. Such methods have a high false positive rate and are difficult to accurately determine the degree of sensitivity.
[0004] While pre-training and large language models have improved text classification capabilities to some extent, large language models have a high deployment threshold. At the same time, the special nature of sensitive texts, which are difficult to disseminate, makes it difficult to use online interfaces to assist in classification. The classification results of simply fine-tuning pre-trained models or large models with small parameters are not satisfactory.
[0005] Graph neural network (GNN) methods often rely on other methods, such as named entity recognition, for the extraction of heterogeneous features, introducing additional computational overhead. Furthermore, most document graphs select nodes by word frequency, rarely delving into the dependencies between key nodes to optimize the construction of the original document graph.
[0006] The effectiveness of reinforcement learning methods depends on the prediction quality of the base model and does not fundamentally improve the network's classification ability.
[0007] In summary, when sensitive text annotation data is scarce, existing methods struggle to fully learn sensitive text features in small sample scenarios, resulting in a significant drop in classification performance. Summary of the Invention
[0008] To address the aforementioned issues, this invention proposes a sensitive text classification method based on self-supervised reinforcement graph learning. This method utilizes only a small amount of labeled data for training and achieves optimal document graph configuration through iterative reinforcement learning network iteration.
[0009] This invention is achieved through the following technical solution: a sensitive text classification method based on self-supervised reinforcement graph learning; the method specifically includes the following steps: S1. Prepare a sensitive text dataset, which includes labeled sensitive text data and publicly available sensitive text data; S2. Initialize the classification model for sensitive text classification and the strategy model for filtering the vocabulary; S3. The policy model filters words from the original text, inputs the pre-trained word vectors of the words into the policy model, outputs the selection probability of each word, and obtains a global vocabulary based on the selection probability; and constructs a global document graph and a text graph based on the global vocabulary. S4. Input the global document graph and text graph into the classification model, extract the global semantic features and structural features of the text through heterogeneous graph learning, and output the classification prediction results of the text after processing by graph convolutional network and fully connected layer; S5. Construct a reward function based on the classification prediction results output by the classification model, and calculate the reward value for the current strategy model to select the vocabulary; use the group relative strategy optimization method to iteratively update the parameters of the strategy model using the reward value to optimize the vocabulary selection strategy; S6. Iterate through steps S3-S5 until the preset training rounds. After each iteration, evaluate the performance of the policy model and select the policy model with the best performance. Use the best policy model to construct a document graph and input it into the classification model to complete the final classification of sensitive text.
[0010] Furthermore, S1 includes: S1.1. Obtain publicly available scanned copies or electronic documents of sensitive text, convert non-text format sensitive text into plain text using OCR, and verify the integrity of the text structure and content; S1.2. Divide the text into paragraphs according to the original sensitive text document. Each paragraph is treated as an independent sample. The sensitive text is labeled with a preset sensitivity level category according to the original security level of the document and page to obtain the basic sensitive text dataset. S1.3. Add a preset number of non-sensitive texts to the sensitive text base dataset and label them as non-sensitive categories to obtain a sensitive-non-sensitive mixed dataset; S1.4. Divide the dataset into a training set and a test set. Use only a preset proportion of the data in the training set for model training, and use the remaining training set as a validation set.
[0011] Furthermore, S2 includes, The classification model uses the AdamW optimizer with a learning rate of 0.0005, a dropout rate of 0.9, and a hidden layer dimension of 256. The policy model is a two-layer MLP structure with a hidden layer dimension of 128, using the AdamW optimizer and a learning rate of 0.0002.
[0012] Furthermore, S3 includes: S3.1. Perform word segmentation and filtering on the original text, retaining the features of all words; S3.2. Input the pre-trained word vectors into the policy model, output the selection probability of each word, and sample according to the selection probability to obtain a new global vocabulary; S3.3. Calculate the pointwise mutual information (PMI) of words in the global vocabulary, take the larger value between the PMI and 0 as the adjacency matrix of the relationships between nodes, and construct the global document graph; S3.4. Calculate the text graph matrix based on the global vocabulary and the TF-IDF algorithm, ignoring words not in the global vocabulary, and construct the text graph.
[0013] Furthermore, S4 includes: S4.1. Input the adjacency matrix of the global document graph into a two-layer graph convolutional network to calculate the global feature encoding; S4.2. Concatenate the global feature code with the pre-trained word vectors to obtain the final global feature code; S4.3. Aggregate the final global features with the text graph matrix to calculate the document graph fusion features; S4.4. Construct document encoding and adjacency matrix based on document graph fusion features, wherein the adjacency matrix is obtained by calculating the cosine similarity of document graph fusion features, setting a threshold for filtering, and normalization. S4.5. Input the document encoding and adjacency matrix into the two-layer GCN, output the text classification prediction score through the fully connected layer and the Softmax function, and select the category corresponding to the highest score as the predicted label of the text; S4.6. Construct an auxiliary matrix, concatenate the adjacency matrix and the auxiliary matrix and normalize them, calculate the document feature score and the training feature score respectively, sum them and output the final prediction score.
[0014] Furthermore, S5 includes: S5.1. Construct a global document graph and train a classification model using a word frequency filtering method; S5.2. For each sampling strategy, calculate the accuracy and F1 score of the corresponding classification model to obtain the reward for that group; S5.3. Normalize the rewards for each group and calculate the group advantage value; S5.4. Based on group relative policy optimization, calculate the loss using the objective function, and update the policy model using the loss.
[0015] Furthermore, in S5.4.1, during each update, a set of corresponding actions is extracted from the strategy model before the update and evaluated, and the sampling importance ratio and the pruned importance ratio are calculated. S5.4.2. Calculate the KL penalty. Based on the importance ratio and the KL penalty term, calculate the objective function loss: S5.4.3. Update strategy model based on objective function loss.
[0016] A sensitive text classification system based on self-supervised reinforcement graph learning; The system includes a preprocessing module, an initialization module, a filtering module, a classification module, a reward optimization module, and an iterative classification module. The preprocessing module is used to prepare a sensitive text dataset, which includes labeled sensitive text data and publicly available sensitive text data. The initialization module is used to initialize the classification model and the strategy model, wherein the classification model is used for sensitive text classification and the strategy model is used for filtering the vocabulary. The filtering module filters words in the original text using a strategy model. It inputs the pre-trained word vectors of the words into the strategy model, outputs the selection probability of each word, and obtains a global vocabulary based on the selection probability. A global document graph and a text graph are then constructed based on the global vocabulary. The classification module inputs the global document graph and text graph into the classification model, extracts the global semantic features and structural features of the text through heterogeneous graph learning, and outputs the classification prediction results of the text after processing by graph convolutional network and fully connected layer. The reward optimization module constructs a reward function based on the classification prediction results output by the classification model, calculates the reward value for the current strategy model to screen the vocabulary, and optimizes the vocabulary screening strategy by iteratively updating the parameters of the strategy model using the reward value through a group-based strategy optimization method. The iterative classification module iterates through the preprocessing module, initialization module, filtering module, classification module, and reward optimization module up to a preset training round. After each iteration, the performance of the strategy model is evaluated, and the strategy model with the best performance is selected. The optimal strategy model is then used to construct a document graph, which is input into the classification model to complete the final classification of sensitive text.
[0017] An electronic device includes a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the above method.
[0018] A computer-readable storage medium for storing computer instructions that, when executed by a processor, implement the steps of the above-described method.
[0019] Compared to existing technologies, the sensitive text classification method (SSRGL) based on self-supervised reinforcement graph learning proposed in this invention has at least the following beneficial effects: This invention organically combines heterogeneous document graph learning (SSRGL) and reinforcement learning algorithms: First, a policy network is directly used to select original text nodes to construct a heterogeneous document graph. Then, a hierarchical graph convolutional network updates features, fully representing global semantic and structural information and optimizing few-shot learning. Simultaneously, an adaptive reward function is designed based on the output classification metric. Iterative optimization based on group-relative policies is performed, and self-supervised training learns the optimal document graph construction strategy for the current sensitive text corpus, reducing resource consumption and further distinguishing between confusing sensitive types. Furthermore, to address the lack of real sensitive data, real text and labels are collected to construct a text classification dataset. Experimental results on various sensitive text classification datasets demonstrate that the SSRGL method can effectively improve the classification speed and accuracy of sensitive texts.
[0020] This invention proposes the SSRGL framework, which organically combines reinforcement learning and classification networks. It rapidly iterates the optimal document graph configuration through self-supervision with fewer training samples, without relying on the initial classification accuracy, effectively improving the ability to classify sensitive content.
[0021] This invention improves the group-relative strategy optimization, reducing document consumption while making full use of global semantic and structural features.
[0022] This invention demonstrates the leading performance and adaptability of the SSRGL method in sensitive text classification tasks through cross-experiments on a publicly available dataset based on a real-label sensitive text classification dataset. Attached Figure Description
[0023] Figure 1 This is the overall architecture of SSRGL in this invention; Figure 2 This is a comparison of the f1 values of the SSRGL method ablation experiment and the baseline method of the present invention; Figure 3 This is the confusion matrix of the classification results of the SSRGL method in the sensitive information classification dataset; Figure 4 The confusion matrix represents the classification results of the SSRGL method in the sensitive information detection dataset. Figure 5 This represents the verification accuracy of each sampling group in the iteration round of the SSRGL of this invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] Unless otherwise specified, the experimental methods used in the following examples are conventional methods. Unless otherwise specified, the materials, reagents, methods, and instruments used are all conventional materials, reagents, methods, and instruments in the art, and can be obtained commercially by those skilled in the art.
[0026] Combination Figures 1-5 This invention proposes a self-supervised reinforcement heterogeneous graph learning network (SSRGL) for sensitive text classification. It is trained using only a small amount of labeled data and achieves optimal document graph configuration through iterative reinforcement learning. First, a basic classification network based on the global document graph is constructed, enriching semantic information with original document content and enhancing few-shot learning capabilities using graph structure. Next, a group-relative policy optimization is introduced to perform self-supervised selection and updating of the global document graph, continuously improving the classification network's ability to distinguish sensitivity levels. SSRGL can effectively detect and classify sensitive content, achieving a 2% accuracy improvement compared to existing state-of-the-art (SOTA) baselines.
[0027] Specifically, the method includes the following steps: S1. Prepare a sensitive text dataset, which includes labeled sensitive text data and publicly available sensitive text data; S1.1. Obtain publicly available scanned copies or electronic documents of sensitive text, convert non-text format sensitive text into plain text using OCR, and verify the integrity of the text structure and content; S1.2. Divide the text into paragraphs according to the original sensitive text document. Each paragraph is treated as an independent sample. The sensitive text is labeled with a preset sensitivity level category according to the original security level of the document and page to obtain the basic sensitive text dataset. S1.3. Add a preset number of non-sensitive texts to the sensitive text base dataset and label them as non-sensitive categories to obtain a sensitive-non-sensitive mixed dataset; S1.4. Use publicly available sensitive text classification datasets. For publicly available datasets with imbalanced data volume, sample data evenly by category. Divide all datasets into training and test sets according to a preset ratio. Only a preset ratio of data is taken from the training set for model training, and the remaining training set is used as the validation set.
[0028] S2. Initialize the classification model for sensitive text classification and the strategy model for filtering the vocabulary; The classification model adopts an architecture of a two-layer graph convolutional network (GCN) and a fully connected layer; The input layer receives the global document graph adjacency matrix. P w and text graph matrix T m The first-layer GCN and the second-layer GCN are respectively and The output layer uses the Softmax function; the AdamW optimizer is used, with a learning rate of 0.0005, a dropout rate of 0.9, and a hidden layer dimension of 256. The policy model is a two-layer MLP structure used to output word selection probabilities. The input layer receives pre-trained word vectors. E w The parameters for the first and second layers are respectively and The output layer uses the Softmax function; the hidden layer has a dimension of 128, uses the AdamW optimizer, and has a learning rate of 0.0002. The sampling group size is 8, the number of policy update rounds is 25, the reward discount factor γ=0.6, the hyperparameters μ=0.01 and ε=0.1, and the total number of model training rounds is 60. After each round of training, the current policy model is evaluated, and the policy model with the best performance on the validation set is retained as the optimal policy model.
[0029] S3. The policy model filters words from the original text (sensitive text dataset), inputs the pre-trained word vectors of the words into the policy model, outputs the selection probability of each word, and obtains a global vocabulary based on the selection probability; and constructs a global document graph and text graph based on the global vocabulary. S3.1. Perform word segmentation and filtering on the original text (remove meaningless words and punctuation marks, etc.) while retaining the features of all words; S3.2. Transfer the pre-trained word vectors E w Input the policy model (deep neural network), and output the selection probability of each word. ap ,
[0030] , and b 1. b 2 is a trainable parameter. S and LThis represents the Softmax function and the LeakyReLU activation function. Sampling is performed based on the selection probability to obtain a new global vocabulary. V n ; S3.3. Calculate the global vocabulary V n Pointwise mutual information (PMI) of words is used, and the larger of the PMI value and 0 is taken as the adjacency matrix of the relationships between nodes. P w ,
[0031] in express V n Different words in the adjacency matrix P w Building a global document graph G w ={ P w}; S3.4. Based on a global vocabulary V n Calculate the text graph matrix using the TF-IDF algorithm T m , , in v n for V n The words in x k For each word node in the text, ignore those not present. V n Construct a text graph from the words in the text. G t ={ T m}
[0032] S4. Input the global document graph and text graph into the classification model, extract the global semantic features and structural features of the text through heterogeneous graph learning, and output the classification prediction results of the text after processing by graph convolutional network and fully connected layer; S4.1. The adjacency matrix of the global document graph. P w Inputting a two-layer graph convolutional network (GCN) yields global feature encodings. E w ;
[0033] in , , and Here are the parameters of the GCN network, and ReLU is the activation function; S4.2. Concatenating Global Feature Encodings E w With pre-trained word vectors E pre The final global feature encoding is obtained. ; S4.3. Final global features E g Text graph matrix T m Aggregation and calculation yield document graph fusion features. H ; Π represents , κ It is a constant; S4.4. Based on document graph fusion features H Building document encoding F and adjacency matrix , Document Encoding F The calculation formula is: ,in and c These are the network parameters for the classification model; Adjacency matrix The calculation formula is:
[0034] in Represents normalized calculation, For the threshold, This forms the basis for calculating cosine similarity of fused features; S4.5. Encode the document F and adjacency matrix Input a two-layer GCN, pass through a fully connected layer and a Softmax function, and output a text classification prediction score. s ,
[0035] s For the Softmax function, , , and d The network parameters for the classification model are defined; the category corresponding to the highest score is selected as the predicted label for the text. S4.6. In the evaluation phase, the classification model follows the method proposed in SimpleSTC to optimize the fusion feature learning; Constructing auxiliary matrix splice the original adjacency matrix A With auxiliary matrix And normalize to obtain a new feature matrix;
[0036] And split it into training parts and document section Simultaneous acquisition of document feature encoding based on graph convolutional networks and additional training feature encoding ;
[0037] The final text representation is the sum of the two features, and the predicted score is also output: .
[0038] S5. Construct a reward function based on the classification prediction results output by the classification model on the validation set, and calculate the reward value of the current strategy model for selecting the vocabulary; use the group relative strategy optimization method to iteratively update the parameters of the strategy model using the reward value to optimize the vocabulary selection strategy; S5.1. Construct a global document graph using the term frequency filtering method and train a classification model to obtain the classification accuracy on the validation set. U 0 and F1 value F 0, Calculate the baseline reward ; S5.2. A new training process is optimized using a policy network. For each sampling policy, the reward value is calculated as follows: ; S5.3. Rewards for each group r i Normalization was performed, and the group dominance value was calculated. a i
[0039] in mean This is the average value. std Standard deviation; S5.4. Calculate the loss using the objective function based on Group Relative Policy Optimization (GRPO). Update the policy model π through loss θ Simultaneously, based on the classification index and reward discount factor γ of the classification model within this round on the validation set, the baseline reward is adaptively updated to improve the timeliness of the reward and avoid getting trapped in local maxima. .
[0040] The specific calculation process of the target loss function is as follows: S5.4.1. During each update, extract a corresponding set of actions from the old strategy and evaluate them, calculating the sampling importance ratio. r p The ratio of importance to the importance after cutting r c : , ; S5.4.2. Calculate KL penalty: ; Calculate the objective function loss based on the importance ratio and the KL penalty term:
[0041] S5.4.3. Update strategy model based on objective function loss.
[0042] S6. Iterate through steps S3-S5 until the preset training rounds. After each iteration, evaluate the performance of the policy model and select the policy model with the best performance. Use the best policy model to construct a document graph and input it into the classification model to complete the final classification of sensitive text.
[0043] A sensitive text classification system based on self-supervised reinforcement graph learning; The system includes a preprocessing module, an initialization module, a filtering module, a classification module, a reward optimization module, and an iterative classification module. The preprocessing module is used to prepare a sensitive text dataset, which includes labeled sensitive text data and publicly available sensitive text data. The initialization module is used to initialize the classification model and the strategy model, wherein the classification model is used for sensitive text classification and the strategy model is used for filtering the vocabulary. The filtering module filters words in the original text using a strategy model. It inputs the pre-trained word vectors of the words into the strategy model, outputs the selection probability of each word, and obtains a global vocabulary based on the selection probability. A global document graph and a text graph are then constructed based on the global vocabulary. The classification module inputs the global document graph and text graph into the classification model, extracts the global semantic features and structural features of the text through heterogeneous graph learning, and outputs the classification prediction results of the text after processing by graph convolutional network and fully connected layer. The reward optimization module constructs a reward function based on the classification prediction results output by the classification model, calculates the reward value for the current strategy model to screen the vocabulary, and optimizes the vocabulary screening strategy by iteratively updating the parameters of the strategy model using the reward value through a group-based strategy optimization method. The iterative classification module iterates through the preprocessing module, initialization module, filtering module, classification module, and reward optimization module up to a preset training round. After each iteration, the performance of the strategy model is evaluated, and the strategy model with the best performance is selected. The optimal strategy model is then used to construct a document graph, which is input into the classification model to complete the final classification of sensitive text.
[0044] An electronic device includes a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the above method.
[0045] A computer-readable storage medium for storing computer instructions that, when executed by a processor, implement the steps of the above-described method.
[0046] The memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory of the methods described in this invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0047] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired means such as coaxial cable, optical fiber, digital subscriber line, DSL, or wireless means such as infrared, wireless, microwave, etc. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium such as a floppy disk, hard disk, magnetic tape; an optical medium such as a high-density digital video disc, DVD; or a semiconductor medium such as a solid-state disk, SSD, etc.
[0048] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.
[0049] It should be noted that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiments can be completed by the integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied as execution by a hardware decoding processor, or as execution by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above methods.
[0050] The above provides a detailed description of the sensitive text classification method based on self-supervised reinforcement graph learning proposed in this invention, and elucidates the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
Claims
1. A sensitive text classification method based on self-supervised reinforcement graph learning, characterized in that: The method specifically comprises the following steps: S1. Prepare a sensitive text data set, which includes labeled sensitive text data and public sensitive text data; S2. Initialize a classification model and a strategy model, the classification model is used for sensitive text classification, and the strategy model is used for screening a vocabulary table; S3. Screen the words of the sensitive text data set through the strategy model, input the pre-training word vector of the word into the strategy model, output the selection probability of each word, and sample to obtain a global vocabulary table; and a global document graph and a text graph are constructed based on the global vocabulary table; S4. Input the global document graph and the text graph into the classification model, extract the global semantic features and structural features of the text through heterogeneous graph learning, process through a graph convolution network and a full connection layer, and output the classification prediction result of the text; S5. Construct a reward function based on the classification prediction result output by the classification model, calculate the reward value of the strategy model screening the vocabulary table, and update the parameters of the strategy model through a group relative strategy optimization method and the reward value to optimize the vocabulary table screening strategy; S6. Iteratively execute steps S3-S5, evaluate the performance of the strategy model after each iteration, and screen the optimal strategy model; and the optimal strategy model is used to construct a document graph, which is input into the classification model to complete the final classification of the sensitive text.
2. The method of claim 1, wherein: In S1, it includes: S1.
1. Obtain a public sensitive text scan or an electronic document, convert the non-text format sensitive text into pure text through OCR, and correct the integrity of the text structure and content; S1.
2. Divide the text according to the paragraphs of the original document of the sensitive text, take each paragraph as an independent sample, mark the preset sensitive level category according to the original secret level of the document and page, and obtain a sensitive text basic data set; S1.
3. Add a preset number of non-sensitive texts to the sensitive text basic data set and mark them as non-sensitive categories to obtain a sensitive-non-sensitive mixed data set; S1.
4. Divide the data set into a training set and a test set, take only a preset proportion of data in the training set for model training, and take the remaining training set as a validation set.
3. The method of claim 2, wherein: In S2, the classification model uses an AdamW optimizer, the learning rate is set to 0.0005, the dropout rate is set to 0.9, and the hidden layer dimension is 256; The strategy model is a double-layer MLP structure, the hidden layer dimension is 128, an AdamW optimizer is used, and the learning rate is set to 0.0002. In S3, it includes:
4. The method of claim 3, wherein: S3.
1. Perform word segmentation and filtering processing on the original text to retain the features of all words; S3.
2. Input the pre-training word vector into the strategy model, output the selection probability of each word, sample according to the selection probability, and obtain a new global vocabulary table; S3.
3. Calculate the point-wise mutual information PMI of the words in the global vocabulary table, take the greater value of the PMI value and 0 as the adjacency matrix of the relationship between nodes, and construct a global document graph; S3.
4. Calculate the text graph matrix based on the global vocabulary and TF-IDF algorithm, ignore the words not in the global vocabulary, and construct the text graph.
5. The method of claim 4, wherein: In S4, it includes: S4.
1. Input the adjacency matrix of the global document graph into the double-layer graph convolution network to calculate the global feature encoding; S4.
2. Concatenate the global feature encoding and the pre-trained word vector to obtain the final global feature encoding; S4.
3. Aggregate the final global feature and the text graph matrix to calculate the document graph fusion feature; S4.
4. Construct the document encoding and adjacency matrix based on the document graph fusion feature, wherein the adjacency matrix is obtained by calculating the cosine similarity of the document graph fusion feature, setting the threshold value, and normalizing the processing; S4.
5. Input the document encoding and adjacency matrix into the double-layer GCN, and output the text classification prediction score through the full connection layer and the Softmax function, select the category corresponding to the highest score as the prediction label of the text; S4.
6. Construct an auxiliary matrix, concatenate the adjacency matrix and the auxiliary matrix and normalize, respectively calculate the document feature score and the training feature score, and output the final prediction score after summation.
6. The method of claim 5, wherein: In S5, it includes: S5.
1. Construct the global document graph and train the classification model using the word frequency screening method; S5.
2. Calculate the accuracy and F1 value of each classification model corresponding to each group of sampling strategies to obtain the reward of the group; S5.
3. Normalize the rewards of each group to calculate the group advantage value; S5.
4. Based on the relative strategy optimization of the group, calculate the loss using the objective function, and update the strategy model through the loss.
7. The method of claim 6, wherein: S5.4.
1. At each update, extract a corresponding group of actions from the strategy model before updating and evaluate them to calculate the sampling importance ratio and the clipped importance ratio; S5.4.
2. Calculate the KL penalty, and based on the importance ratio and the KL penalty term, calculate the objective function loss: S5.4.
3. Update the strategy model based on the objective function loss.
8. A sensitive text classification system based on self-supervised reinforcement graph learning, characterized in that: The system is used to perform the steps of the method of any one of claims 1 to 7; The system includes a preprocessing module, an initialization module, a screening module, a classification module, a reward optimization module, and an iterative classification module: The preprocessing module is used to prepare the sensitive text data set, which includes labeled sensitive text data and public sensitive text data; The initialization module is used to initialize the classification model and the strategy model, wherein the classification model is used for sensitive text classification, and the strategy model is used for screening the vocabulary; The screening module screens the words of the original text through the strategy model, inputs the pre-trained word vector of the word into the strategy model, outputs the selection probability of each word, and samples the global vocabulary according to the selection probability; Based on the global vocabulary, construct the global document graph and the text graph; The classification module inputs the global document graph and the text graph into the classification model, extracts the global semantic features and structural features of the text through heterogeneous graph learning, processes them through the graph convolution network and the full connection layer, and outputs the classification prediction result of the text; The reward optimization module constructs a reward function based on the classification prediction result output by the classification model, calculates the reward value of the current policy model screening vocabulary table, and iteratively updates the parameters of the policy model using the reward value by a group relative policy optimization method to optimize the vocabulary table screening policy. The iterative classification module iterates the preprocessing module, the initialization module, the screening module, the classification module and the reward optimization module to a preset training round, evaluates the performance of the policy model after each iteration, and screens out the policy model with the optimal performance; the optimal policy model is used to construct a document graph, which is input into the classification model to complete the final classification of the sensitive text.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to realize the steps of the method in any one of claims 1 to 7.
10. A computer readable storage medium for storing computer instructions, characterized in that, The computer instructions are executed by the processor to realize the steps of the method in any one of claims 1 to 7.