Government affair data resource classification method and system based on NLP

Through the NLP-based government data resource classification method, the pre-trained language model is used to perform feature extraction and semantic representation learning, and a dynamic classification model is constructed, which solves the problem that traditional methods are difficult to deal with semantic complex data, and improves the accuracy and adaptability of classification.

CN119917670AInactive Publication Date: 2025-05-02SICHUAN ELECTRONIC INFORMATION IND TECH RES INST CO LTD +1

Patent Information

Application Number
CN202510405180.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-02
Publication Date
2025-05-02
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional government data resource classification methods are difficult to accurately process data with complex semantics and implicit correlation, resulting in low classification accuracy and inability to adapt to dynamically changing government business scenarios.

Method used

The NLP-based government data resource classification method is adopted, and historical government data are obtained for grammatical analysis and data cleaning, and feature extraction and semantic representation learning are used to build a dynamic classification model to adapt to newly generated government data.

Benefits of technology

It improves the accuracy and timeliness of government data classification, can capture data characteristics more comprehensively, adapt to the dynamic changes of data in real time, and reduces the workload and error of manual classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917670A_ABST
    Figure CN119917670A_ABST
Patent Text Reader

Abstract

The invention relates to an NLP-based government affair data resource classification method and system, and relates to the technical field of government affair data resource classification, and the method comprises the steps: obtaining a plurality of historical government affair data, carrying out the grammar analysis and statement analysis, and carrying out the data cleaning of the historical government affair data; performing feature extraction on the cleaned historical government affair data based on a pre-training language model to perform semantic representation learning and obtain a semantic vector; constructing a dynamic classification model based on the obtained semantic vector; and obtaining newly generated government affair data, and inputting the newly generated government affair data into the dynamic classification model to obtain a corresponding classification result. According to the method, the dynamic classification model constructed based on the semantic vector is provided, the method can be continuously optimized according to newly generated government affair data, the dynamic change of the data is adapted in real time, and the accuracy and timeliness of classification are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of government data resource classification, and in particular, to a government data resource classification method and system based on NLP. Background Art

[0002] There is a problem that is not easily discovered in the existing government data resource classification technology: with the rapid growth of government data scale and the diversification of data types, the traditional classification method based on fixed rules and simple keyword matching is difficult to accurately process semantically complex and implicitly associated data, resulting in low classification accuracy and inability to adapt to dynamically changing government business scenarios.

[0003] How to solve this technical problem is a technical difficulty that technicians in this field need to overcome. Summary of the invention

[0004] In order to at least partially solve the above technical problems, the present application provides a government data resource classification method and system based on NLP.

[0005] On the first aspect, the NLP-based government data resource classification method provided in this application adopts the following technical solution.

[0006] The classification method of government data resources based on NLP includes: Acquire some historical government data and perform grammatical analysis and sentence analysis to clean the historical government data; Based on the pre-trained language model, the cleaned historical government data is subjected to feature extraction to learn semantic representation and obtain semantic vectors; Building a dynamic classification model based on the obtained semantic vector; Newly generated government affairs data is acquired and input into the dynamic classification model to obtain corresponding classification results.

[0007] By adopting the above technical solutions, compared with traditional feature extraction methods, data features can be captured more comprehensively and deeply; the dynamic classification model built based on semantic vectors can continuously optimize itself according to the newly generated government data, adapt to the dynamic changes of data in real time, and improve the accuracy and timeliness of classification.

[0008] Optionally, feature extraction is performed on the cleaned historical government data based on a pre-trained language model to perform semantic representation learning and obtain a semantic vector, including: Based on the word segmenter corresponding to the pre-trained language model, the cleaned historical government data is segmented to split the text corresponding to the historical government data into a plurality of word units; A first marker is added to the starting position of each word unit after word segmentation of each historical government data, and a second marker is added to the ending position of the word unit; the first marker is used as an aggregate representation of the semantics of the entire sentence; the second marker is used to distinguish different sentences or text paragraphs; Generate a corresponding word-gram type embedding and position embedding for each word-gram; the word-gram type embedding is used to distinguish different text paragraphs or sentences; the position embedding is used to represent the position information of the word-gram in the sequence; the word-gram type embedding, the position embedding and the word embedding of the word-gram are added to obtain a final input representation; the obtained input representation is input into the pre-trained language model; the pre-trained language model processes the input data through a multi-layer encoder to perform feature extraction.

[0009] Optionally, the pre-trained language model processes the input data through a multi-layer encoder to extract features, including: S301, for each word in the word-word sequence input to each layer of encoder, the corresponding input representation is With three learnable weight matrices , , Multiply to generate query vector Q, key vector K and value vector V; S302, calculating the dot product of each query vector Q and all key vectors K to obtain an original attention score and obtaining an attention weight based on the original attention score; S303: Perform weighted summation on the value vector based on the attention weight to obtain the updated word unit representation of each word unit ; S304: Update the word element representation Input into a feedforward neural network; the feedforward neural network includes two linear layers and a nonlinear activation function; the updated word unit representation The weight matrix of the first linear layer Multiply and add the first bias vector And obtain an intermediate result through the nonlinear activation function; and combine the intermediate result with the weight matrix of the second linear layer. Multiply and add the second bias vector Get the output of the feedforward neural network ; S305: the input representation With the word element representation Add and combine with the output of the feedforward neural network Add the residual connection output And used as the output vector of the current layer encoder; Each layer of the multi-layer encoder performs steps S301-S305 on the input data in turn; the output of the previous layer of encoder is used as the input of the next layer of encoder; after each layer of encoder processing is completed, the output vector of each word in that layer is recorded. ; Output vector is the hidden state vector of the word at this layer; after processing all encoding layers, the pre-trained language model outputs the set of hidden state vectors of each word in all layers; The hidden state vector corresponding to the first tag is located from the hidden state vectors of each word unit output by the pre-trained language model; during the pre-training process, the vector corresponding to the first tag will continuously aggregate the semantic information of the entire sentence; the hidden state vector corresponding to the first tag is selected as the semantic representation of the entire government data text.

[0010] Optionally, constructing a dynamic classification model based on the obtained semantic vector includes: The obtained semantic vectors and the corresponding true classification labels are organized into a training data set; the data set is divided into a training set, a validation set, and a test set; Setting hyperparameters for initial dynamic classification model training; the hyperparameters include learning rate, number of iterations, and batch size; During the training process, the training set is input into the initial dynamic classification model according to the batch size. The initial dynamic classification model calculates the prediction result based on the current parameters and calculates the difference between the prediction result and the true label through the loss function; Update the parameters of the initial dynamic classification model according to the gradient back propagation of the loss function so that the loss gradually decreases; When the initial dynamic classification model training is completed, the semantic vectors in the test set are input into the trained model to obtain the predicted classification results, which are compared with the true labels of the test set to calculate the confidence; when the confidence is greater than the preset value, the trained dynamic classification model is obtained.

[0011] Optionally, a number of historical government data are obtained and syntax analysis and sentence analysis are performed to clean the historical government data, including: Initialize the lexical analysis tool and load the built-in vocabulary and stop word list; Scan the text content in the historical government data word by word based on the lexical analysis tool; during the scanning process, identify and correct the words with spelling errors through the built-in word library and spelling check algorithm; Identifying and removing stop words in the scanned text based on the stop word list; Based on syntactic analysis technology, the syntactic structure of the text after lexical analysis is parsed to build a syntax tree; The grammatical relationship between each word in the sentence is clarified by the grammatical tree; Discover and correct semantic ambiguity caused by grammatical errors based on grammatical relations.

[0012] Optionally, the method further includes: Input the cleaned historical government data into the word segmenter corresponding to the pre-trained language model, and load the pre-built professional vocabulary at the same time; When the word segmenter scans the government data text word by word, it first checks whether the currently scanned text segment matches the vocabulary in the professional vocabulary. If the match is successful, the vocabulary is segmented as a complete word unit. If the current text segment does not match the vocabulary in the professional vocabulary, it is processed according to the original word segmentation rules of the word segmenter. Collect error information and newly appeared words in the word segmentation process; analyze the collected feedback data, and trigger the word library update operation when the number of newly discovered words reaches a preset value or the word segmentation error rate exceeds a preset ratio; the update operation includes: adding newly discovered professional terms and high-frequency words to the professional word library and classifying and annotating them and establishing indexes; for words involved in word segmentation errors, check whether there are errors or incomplete information in the word library, and if so, correct and supplement them.

[0013] Optionally, the method further includes: deploying a data encryption transmission protocol when acquiring newly generated government data, and encrypting the data in transmission.

[0014] On the second aspect, the NLP-based government data resource classification system provided in this application adopts the following technical solution.

[0015] A government data resource classification system based on NLP, comprising: The first processing module is used to: obtain a number of historical government data and perform grammatical analysis and sentence analysis to clean the historical government data; The second processing module is used to: extract features from the cleaned historical government data based on the pre-trained language model to perform semantic representation learning and obtain a semantic vector; A third processing module is used to: construct a dynamic classification model based on the obtained semantic vector; The fourth processing module is used to obtain newly generated government affairs data and input the newly generated government affairs data into the dynamic classification model to obtain corresponding classification results.

[0016] Compared with the prior art, the beneficial effects of the present invention include: the dynamic classification model constructed based on semantic vectors can continuously optimize itself according to the newly generated government data, adapt to the dynamic changes of data in real time, and improve the accuracy and timeliness of classification. In practical applications, when new policy documents and business data are generated, the model can quickly and accurately classify them. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flowchart of the NLP-based government data resource classification method of the embodiment of the present application; Figure 2 It is a system block diagram of the NLP-based government data resource classification method of the embodiment of the present application; In the figure, 201 is a first processing module; 202 is a second processing module; 203 is a third processing module; 204 is a fourth processing module. DETAILED DESCRIPTION

[0018] The following is combined with Figure 1-2 The present application is further described with specific embodiments: The embodiment of the present application discloses a method for classifying government data resources based on NLP, comprising the following steps: Step 101: Acquire some historical government data and perform grammatical analysis and sentence analysis to clean the historical government data. Specifically, NLP (natural language processing) converts human language into a form that can be processed by computers. In this application, NLP technology is used to process government data to achieve the classification of government data resources.

[0019] Step 102: Extract features from the cleaned historical government data based on the pre-trained language model to learn semantic representations and obtain semantic vectors. Specifically, the pre-trained language model can use the BERT model, which is a deep neural network based on the Transformer architecture and can understand data context information; for example, for a complex text about environmental government affairs, the BERT model can integrate the context, understand the implicit connections between different words and sentences, and generate vectors that more accurately reflect the semantics of the text. The text data is converted into a vector form. The value of each dimension in the vector reflects the semantic features of the text. The semantic vector can quantify the semantic information of the text, which is convenient for computer processing and analysis.

[0020] Step 103: construct a dynamic classification model based on the obtained semantic vector.

[0021] Step 104: Acquire newly generated government affairs data and input the newly generated government affairs data into the dynamic classification model to obtain corresponding classification results.

[0022] Specifically, in today's digital government environment, the scale of government data is huge and continues to grow, and its types are complex and diverse. Traditional government data processing methods are difficult to efficiently and accurately classify and manage these data. After acquiring historical government data, the NLP-based government data resource classification method proposed in the embodiment of the present application performs data cleaning through grammatical analysis and sentence analysis, which can remove noise in the data, correct incorrect grammar and semantic ambiguity. Feature extraction and semantic representation learning based on pre-trained language models can mine the hidden semantic information in government data, convert text into semantic vectors, and use the general language knowledge learned by pre-trained models on large-scale data to adapt to the language characteristics of the government field. Compared with traditional feature extraction methods, it can capture data features more comprehensively and deeply; the dynamic classification model constructed based on semantic vectors can continuously optimize itself according to the newly generated government data, adapt to the dynamic changes of data in real time, and improve the accuracy and timeliness of classification. In practical applications, when new policy documents and business data are generated, the model can quickly and accurately classify them, provide strong support for the efficient development of government work, improve government processing efficiency, reduce the workload and errors of manual classification, and realize the intelligence and automation of government data management.

[0023] As a specific implementation of the NLP-based government data resource classification method, feature extraction is performed on the cleaned historical government data based on a pre-trained language model to perform semantic representation learning and obtain a semantic vector, including: Based on the word segmenter corresponding to the pre-trained language model, the cleaned historical government data is segmented to split the text corresponding to the historical government data into a plurality of word units; A first marker is added to the starting position of each word unit after word segmentation of each historical government data, and a second marker is added to the ending position of the word unit; the first marker is used as an aggregate representation of the semantics of the entire sentence; the second marker is used to distinguish different sentences or text paragraphs; Generate a corresponding word-gram type embedding and position embedding for each word-gram; the word-gram type embedding is used to distinguish different text paragraphs or sentences; the position embedding is used to represent the position information of the word-gram in the sequence; the word-gram type embedding, the position embedding and the word embedding of the word-gram are added to obtain a final input representation; the obtained input representation is input into the pre-trained language model; the pre-trained language model processes the input data through a multi-layer encoder to perform feature extraction.

[0024] Specifically, the word segmenter corresponding to the pre-trained language model is used for word segmentation, and the complex government text is accurately divided into word units, so that the model can better understand the text details and avoid ignoring key information due to the integrity of the text. The first tag and the second tag are added. The first tag can effectively aggregate the semantics of the entire sentence, making it convenient for the model to quickly grasp the core meaning, just like attaching a key label to the sentence; the second tag distinguishes different sentences or text paragraphs, helps the model to sort out the data structure, prevent information confusion, and improve the accuracy of understanding complex government texts. The word unit type embedding and position embedding are generated and added to the word embedding to obtain the final input representation. The word unit type embedding allows the model to distinguish different text paragraphs or sentences and understand the semantic environment of the word unit; the position embedding clarifies the position of the word unit in the sequence, so that the model knows the order and logical relationship between the word units. When the input representation is input into the pre-trained language model and processed by the multi-layer encoder, the model can mine the semantic information in the government data, extract comprehensive and representative features, obtain high-quality semantic vectors, improve the accuracy and reliability of the model's classification of government data, and help the government work to be carried out efficiently.

[0025] As a specific implementation of the NLP-based government data resource classification method, the pre-trained language model processes the input data through a multi-layer encoder to extract features, including: S301, for each word in the word-word sequence input to each layer of encoder, the corresponding input representation is With three learnable weight matrices , , Multiply to generate query vector Q, key vector K and value vector V; S302, calculating the dot product of each query vector Q and all key vectors K to obtain an original attention score and obtaining an attention weight based on the original attention score; S303: Perform weighted summation on the value vector based on the attention weight to obtain the updated word unit representation of each word unit ; S304: Update the word element representation Input into a feedforward neural network; the feedforward neural network includes two linear layers and a nonlinear activation function; the updated word unit representation The weight matrix of the first linear layer Multiply and add the first bias vector And obtain an intermediate result through the nonlinear activation function; and combine the intermediate result with the weight matrix of the second linear layer. Multiply and add the second bias vector Get the output of the feedforward neural network ; S305: the input representation With the word element representation Add and combine with the output of the feedforward neural network Add the residual connection output And used as the output vector of the current layer encoder; Each layer of the multi-layer encoder performs steps S301-S305 on the input data in turn; the output of the previous layer of encoder is used as the input of the next layer of encoder; after each layer of encoder processing is completed, the output vector of each word in that layer is recorded. ; Output vector is the hidden state vector of the word at this layer; after processing all encoding layers, the pre-trained language model outputs the set of hidden state vectors of each word in all layers; The hidden state vector corresponding to the first tag is located from the hidden state vectors of each word unit output by the pre-trained language model; during the pre-training process, the vector corresponding to the first tag will continuously aggregate the semantic information of the entire sentence; the hidden state vector corresponding to the first tag is selected as the semantic representation of the entire government data text.

[0026] Specifically, the input representation of the word unit is multiplied by the learnable weight matrix to generate the query vector Q, the key vector K and the value vector V; by calculating the attention score and weight, and weighted summing the value vector to obtain the updated word unit representation, the model can focus on important word unit information and automatically allocate the attention of different word units, especially when processing a large amount of text information in government data, it can highlight key concepts and entities and ignore relatively minor content; the use of feedforward neural network further processes the word unit representation, and through two linear layers and nonlinear activation functions, the nonlinear expression ability of the model is increased, and more complex semantic patterns and feature combinations in the word unit representation can be learned, which enables the model to handle the diverse language expressions and semantic structures in government data and improve its adaptability to different types of government texts. The residual connection effectively solves the problem of gradient disappearance and difficulty in training models in deep neural networks, allowing the model to build a deeper structure and learn more advanced and abstract semantic features. The multi-layer encoder processes the input data in sequence, and the output of the previous layer is used as the input of the next layer, forming a hierarchical feature extraction process, gradually transitioning from the local features of the word unit to the global semantic features of the entire sentence or even the text. The hidden state vector corresponding to the first tag is located from the set of hidden state vectors output by the pre-trained language model, and is used as the semantic representation of the entire government data text, ensuring that the model can accurately aggregate the semantic information of the sentence and obtain a representative semantic vector. Furthermore, the pre-trained language model can extract high-quality, multi-level semantic features from complex government data, significantly improving the accuracy and efficiency of government data classification, and helping government departments to manage and utilize government data resources more efficiently.

[0027] As a specific implementation of the NLP-based government data resource classification method, a dynamic classification model is constructed based on the obtained semantic vector, including: The obtained semantic vectors and the corresponding true classification labels are organized into a training data set; the data set is divided into a training set, a validation set, and a test set; Setting hyperparameters for initial dynamic classification model training; the hyperparameters include learning rate, number of iterations, and batch size; During the training process, the training set is input into the initial dynamic classification model according to the batch size. The initial dynamic classification model calculates the prediction result based on the current parameters and calculates the difference between the prediction result and the true label through the loss function; Update the parameters of the initial dynamic classification model according to the gradient back propagation of the loss function so that the loss gradually decreases; When the initial dynamic classification model training is completed, the semantic vectors in the test set are input into the trained model to obtain the predicted classification results, which are compared with the true labels of the test set to calculate the confidence; when the confidence is greater than the preset value, the trained dynamic classification model is obtained.

[0028] As one implementation of the NLP-based government data resource classification method, a number of historical government data are obtained and grammatical analysis and sentence analysis are performed to clean the historical government data, including: Initialize the lexical analysis tool and load the built-in vocabulary and stop word list; Scan the text content in the historical government data word by word based on the lexical analysis tool; during the scanning process, identify and correct the words with spelling errors through the built-in word library and spelling check algorithm; Identifying and removing stop words in the scanned text based on the stop word list; Based on syntactic analysis technology, the syntactic structure of the text after lexical analysis is parsed to build a syntax tree; The grammatical relationship between each word in the sentence is clarified by the grammatical tree; Discover and correct semantic ambiguity caused by grammatical errors based on grammatical relations.

[0029] Specifically, the built-in vocabulary can be understood as a standard vocabulary reference table, while the stop word list is used to screen out words that have no actual semantic contribution. In the word-by-word scanning process, the built-in vocabulary and spelling check algorithm are used to identify and correct misspelled words. Stop words often appear in large numbers in texts, but contribute little to semantic understanding. Removing them can reduce data redundancy and reduce the amount of computation for subsequent processing. Syntactic analysis technology constructs a syntax tree to show the grammatical relationship between each word in a sentence. By clarifying these relationships, the system can discover and correct semantic ambiguities caused by grammatical errors, ensuring the semantic clarity of government data.

[0030] As one implementation of the NLP-based government data resource classification method, the method further includes: Input the cleaned historical government data into the word segmenter corresponding to the pre-trained language model, and load the pre-built professional vocabulary at the same time; When the word segmenter scans the government data text word by word, it first checks whether the currently scanned text segment matches the vocabulary in the professional vocabulary. If the match is successful, the vocabulary is segmented as a complete word unit. If the current text segment does not match the vocabulary in the professional vocabulary, it is processed according to the original word segmentation rules of the word segmenter. Collect error information and newly appeared words in the word segmentation process; analyze the collected feedback data, and trigger the word library update operation when the number of newly discovered words reaches a preset value or the word segmentation error rate exceeds a preset ratio; the update operation includes: adding newly discovered professional terms and high-frequency words to the professional word library and classifying and annotating them and establishing indexes; for words involved in word segmentation errors, check whether there are errors or incomplete information in the word library, and if so, correct and supplement them.

[0031] Specifically, the cleaned historical government data is input into the word segmenter corresponding to the pre-trained language model, and the pre-built professional word library is loaded. The text segment is checked for vocabulary matching with the professional word library first. If the match is successful, it is segmented as a complete word element, which can accurately identify professional terms and high-frequency vocabulary in the government field and avoid the situation of incorrect segmentation of professional vocabulary. For text segments that do not match the professional word library, they are processed according to the original rules of the word segmenter, which ensures the integrity and versatility of the word segmentation process and can handle various types of text content. Error information and newly emerged vocabulary in the word segmentation process are collected, and feedback analysis is performed. When the preset conditions are met, the word library update operation is triggered, so that the professional word library has the ability to update dynamically. With the development and changes of government business, new professional terms and high-frequency vocabulary continue to emerge. Timely adding these new vocabulary to the word library and classifying and marking and indexing them can enable the word segmenter to adapt to new language changes and improve the accuracy and coverage of word segmentation. Checking, correcting and supplementing the vocabulary involved in the word segmentation errors can continuously improve the quality of the word library and reduce the word segmentation errors caused by inaccurate word library information.

[0032] As one implementation method of the NLP-based government data resource classification method, the method also includes: deploying a data encryption transmission protocol when acquiring newly generated government data, and encrypting the data in transmission.

[0033] This application also provides a method for classifying government data resources based on NLP, including: The first processing module 201 is used to: obtain some historical government data and perform grammar analysis and sentence analysis to clean the historical government data; The second processing module 202 is used to: extract features from the cleaned historical government data based on the pre-trained language model to perform semantic representation learning and obtain a semantic vector; The third processing module 203 is used to: construct a dynamic classification model based on the obtained semantic vector; The fourth processing module 204 is used to obtain newly generated government affairs data and input the newly generated government affairs data into the dynamic classification model to obtain corresponding classification results.

[0034] It should be noted that the above embodiments are only used to illustrate the present application and are not intended to limit the technical solutions described in the present application. Although the present application has been described in detail in this specification with reference to the above embodiments, a person of ordinary skill in the art should understand that a person of ordinary skill in the art can still modify or make equivalent substitutions to the present application, and all technical solutions and improvements thereof that do not depart from the spirit and scope of the present application should be included in the scope of the claims of the present application.

Claims

1. A classification method of government data resources based on NLP, characterized in that: include: Acquire some historical government data and perform grammatical analysis and sentence analysis to clean the historical government data; Based on the pre-trained language model, the cleaned historical government data is subjected to feature extraction to learn semantic representation and obtain semantic vectors; Building a dynamic classification model based on the obtained semantic vector; Newly generated government affairs data is acquired and input into the dynamic classification model to obtain corresponding classification results.

2. The NLP-based government data resource classification method according to claim 1 is characterized in that: Based on the pre-trained language model, the cleaned historical government data is subjected to feature extraction to learn semantic representation and obtain semantic vectors, including: Based on the word segmenter corresponding to the pre-trained language model, the cleaned historical government data is segmented to split the text corresponding to the historical government data into a plurality of word units; A first marker is added to the starting position of each word unit after word segmentation of each historical government data, and a second marker is added to the ending position of the word unit; the first marker is used as an aggregate representation of the semantics of the entire sentence; the second marker is used to distinguish different sentences or text paragraphs; Generate a corresponding word-gram type embedding and position embedding for each word-gram; the word-gram type embedding is used to distinguish different text paragraphs or sentences; the position embedding is used to represent the position information of the word-gram in the sequence; the word-gram type embedding, the position embedding and the word embedding of the word-gram are added to obtain a final input representation; the obtained input representation is input into the pre-trained language model; the pre-trained language model processes the input data through a multi-layer encoder to perform feature extraction.

3. The NLP-based government data resource classification method according to claim 2 is characterized in that: The pre-trained language model processes the input data through a multi-layer encoder to extract features, including: S301, for each word in the word-word sequence input to each layer of encoder, the corresponding input representation is With three learnable weight matrices , , Multiply to generate query vector Q, key vector K and value vector V; S302, calculating the dot product of each query vector Q and all key vectors K to obtain an original attention score and obtaining an attention weight based on the original attention score; S303: Perform weighted summation on the value vector based on the attention weight to obtain the updated word unit representation of each word unit ; S304: Update the word element representation Input into a feedforward neural network; the feedforward neural network includes two linear layers and a nonlinear activation function; the updated word unit representation The weight matrix of the first linear layer Multiply and add the first bias vector And obtain an intermediate result through the nonlinear activation function; and combine the intermediate result with the weight matrix of the second linear layer. Multiply and add the second bias vector Get the output of the feedforward neural network ; S305: the input representation With the word element representation Add and combine with the output of the feedforward neural network Add the residual connection output And used as the output vector of the current layer encoder; Each layer of the multi-layer encoder performs steps S301-S305 on the input data in turn; the output of the previous layer of encoder is used as the input of the next layer of encoder; after each layer of encoder processing is completed, the output vector of each word in that layer is recorded. ; Output vector is the hidden state vector of the word at this layer; after processing all encoding layers, the pre-trained language model outputs the set of hidden state vectors of each word in all layers; The hidden state vector corresponding to the first tag is located from the hidden state vectors of each word unit output by the pre-trained language model; during the pre-training process, the vector corresponding to the first tag will continuously aggregate the semantic information of the entire sentence; the hidden state vector corresponding to the first tag is selected as the semantic representation of the entire government data text.

4. The NLP-based government data resource classification method according to claim 3 is characterized in that: Building a dynamic classification model based on the obtained semantic vector includes: The obtained semantic vectors and the corresponding true classification labels are organized into a training data set; the data set is divided into a training set, a validation set, and a test set; Setting hyperparameters for initial dynamic classification model training; the hyperparameters include learning rate, number of iterations, and batch size; During the training process, the training set is input into the initial dynamic classification model according to the batch size. The initial dynamic classification model calculates the prediction result based on the current parameters and calculates the difference between the prediction result and the true label through the loss function; Update the parameters of the initial dynamic classification model according to the gradient back propagation of the loss function so that the loss gradually decreases; When the initial dynamic classification model training is completed, the semantic vectors in the test set are input into the trained model to obtain the predicted classification results, which are compared with the true labels of the test set to calculate the confidence; when the confidence is greater than the preset value, the trained dynamic classification model is obtained.

5. The NLP-based government data resource classification method according to claim 4 is characterized in that: Acquire some historical government data and perform grammatical analysis and sentence analysis to clean the historical government data, including: Initialize the lexical analysis tool and load the built-in lexicon and stop word list; Scan the text content in the historical government data word by word based on the lexical analysis tool; during the scanning process, identify and correct the words with spelling errors through the built-in word library and spelling check algorithm; Identifying and removing stop words in the scanned text based on the stop word list; Based on syntactic analysis technology, the syntactic structure of the text after lexical analysis is parsed to build a syntax tree; The grammatical relationship between each word in the sentence is clarified by the grammatical tree; Discover and correct semantic ambiguity caused by grammatical errors based on grammatical relations.

6. The NLP-based government data resource classification method according to claim 2 is characterized in that: The method further comprises: Input the cleaned historical government data into the word segmenter corresponding to the pre-trained language model, and load the pre-built professional vocabulary at the same time; When the word segmenter scans the government data text word by word, it first checks whether the currently scanned text segment matches the vocabulary in the professional vocabulary. If the match is successful, the vocabulary is segmented as a complete word unit. If the current text segment does not match the vocabulary in the professional vocabulary, it is processed according to the original word segmentation rules of the word segmenter. Collect error information and newly appeared words in the word segmentation process; analyze the collected feedback data, and trigger the word library update operation when the number of newly discovered words reaches a preset value or the word segmentation error rate exceeds a preset ratio; the update operation includes: adding newly discovered professional terms and high-frequency words to the professional word library and classifying and annotating them and establishing indexes; for words involved in word segmentation errors, check whether there are errors or incomplete information in the word library, and if so, correct and supplement them.

7. The NLP-based government data resource classification method according to claim 6 is characterized in that: The method also includes: deploying a data encryption transmission protocol when acquiring newly generated government data, and encrypting the data in transmission.

8. A government data resource classification system based on NLP, characterized in that: include: The first processing module is used to: obtain a number of historical government data and perform grammatical analysis and sentence analysis to clean the historical government data; The second processing module is used to: extract features from the cleaned historical government data based on the pre-trained language model to perform semantic representation learning and obtain a semantic vector; A third processing module is used to: construct a dynamic classification model based on the obtained semantic vector; The fourth processing module is used to obtain newly generated government affairs data and input the newly generated government affairs data into the dynamic classification model to obtain corresponding classification results.

Citation Information

Patent Citations

  • Internet government affair information processing system

    CN115510225A

  • LDA topic model identification method

    CN119149733A

  • Government affair business data management method and system

    CN119441725A

Cited By

  • Urban construction archive intelligent paper creation and classification method based on natural language processing

    CN121479460A