A government document topic classification method based on Bert and residual self-attention mechanism

Through the government document subject classification method based on Bert and residual self-attention mechanisms, the problems of low efficiency and insufficient adaptive capabilities of traditional methods are solved, and efficient classification of government data is achieved with an accuracy of 96.72%.

CN114153802BActive Publication Date: 2024-09-06XI AN JIAOTONG UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111469862.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-03
Publication Date
2024-09-06
Estimated Expiration
2041-12-03

AI Technical Summary

Technical Problem

Traditional government document subject classification methods have low efficiency and high resource consumption. Due to the multi-source and heterogeneous characteristics of government data, they lack adaptive capabilities and are difficult to achieve accurate subject classification.

Method used

A government document topic classification method based on Bert and residual self-attention mechanisms is adopted. Features are selected through a multi-layer perceptron model, Bert is used for feature embedding, and a residual self-attention model is constructed for topic classification, combined with feature cleaning and optimization strategies. , reduce noise interference and enhance model robustness.

Benefits of technology

Efficient subject classification of government data is achieved, with a classification accuracy of 96.72%, meeting the adaptive needs of multi-source heterogeneous data, and reducing training costs and resource occupation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114153802B
    Figure CN114153802B
Patent Text Reader

Abstract

The present invention discloses a government document subject classification method based on Bert and residual self-attention mechanism, including original feature extraction and selection of government document, original feature cleaning and optimization of government document, text pre-training and subject label classification based on residual self-attention mechanism. Aiming at the multi-source heterogeneous characteristics of government data, the present invention proposes a unified feature extraction, exception processing and feature selection method, designs a targeted feature cleaning and optimization strategy, and constructs a document subject classification model based on Bert pre-training model and residual self-attention mechanism, which solves the problems of low efficiency and lack of adaptability of traditional document subject classification methods. The experiment is based on a public government document data set. In the actual application scenario of classifying up to 70 subject labels, the classification accuracy is as high as 96.72%.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology and relates to topic classification, and in particular to a government document topic classification method based on Bert and residual self-attention mechanism. Background Art

[0002] With the advent of the Internet age, various regions and departments have launched their own government data disclosure platforms to innovate regulatory methods and optimize government services, and have managed data by subject classification. The sharing and opening of government data resources has gradually become one of the ten key projects in the development of national big data.

[0003] However, the construction and management of government service platforms are decentralized, data sharing is not smooth, updates are slow, and business collaboration is insufficient. The reason is that the traditional document subject classification uses a combination of text rule matching and manual operations, which is inefficient and resource-intensive. In addition, due to the multi-source and heterogeneous characteristics of government data, traditional methods lack adaptive capabilities and often have poor results. Specifically, government data involves all aspects of people's lives, with a large number of subject tags and strong correlation between some topics. Tags cannot be determined by a single feature; file features often contain noise interference, making cleaning and embedding difficult; the importance of file features is inconsistent, and traditional machine learning models find it difficult to learn the importance distribution of features and to achieve the fusion of global feature information. Complex deep learning models are prone to overfitting and lack adaptive capabilities. Summary of the invention

[0004] In order to overcome the shortcomings of the above-mentioned prior art, the purpose of the present invention is to provide a government document subject classification method based on Bert and residual self-attention mechanism, to perform subject classification based on the government document data disclosed by various regions and their subject label system, so as to realize the intelligent and efficient archiving of government data.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is:

[0006] A government document subject classification method based on Bert and residual self-attention mechanism includes the following steps:

[0007] Step 1: Extraction and selection of original features of government documents;

[0008] The feature selection is to use a multi-layer perceptron model to test the correlation between each extracted feature and the topic label, determine the strength of the correlation between each feature and the topic label, and select the original feature text whose model prediction accuracy is higher than a set value (such as 30%) according to the test results;

[0009] Step 2: Cleaning and optimizing the original features of government documents;

[0010] The feature optimization is to extract the keywords of the file name and file header from the low-noise feature text obtained after the original feature is cleaned;

[0011] Step 3, text pre-training;

[0012] Based on the optimized feature text, the feature vector is embedded using the Bert pre-training model;

[0013] Step 4: Topic label classification based on residual self-attention mechanism;

[0014] Based on the feature vector, a residual self-attention model is constructed to train, tune, save and test the topic classification model to obtain the final document topic classification model, and the model is used to classify government documents by topic.

[0015] In one embodiment, the original feature extraction is to uniformly encode government documents of different encodings and formats, read the file name, file title, and file horizontal and vertical column header features according to the file format, and use the file name to replace abnormal value or null value features.

[0016] In one embodiment, the feature selection is implemented based on a multi-layer perceptron model.

[0017] In one embodiment, the original feature cleaning is to clean invalid information in the file name, file title and file header, including cleaning government document terms, geographical locations and agency names that are not related to the subject, and translating common non-Chinese words into Chinese and cleaning non-Chinese characters.

[0018] In one embodiment, the feature optimization is based on feature cleaning, which involves cleaning stop words, then using tf-iwf to extract file name keywords, and using a word frequency statistics strategy to extract file header keywords.

[0019] In one embodiment, the word frequency counting strategy is to extract key header names from the horizontal and vertical headers of the file respectively, reduce the noise impact of uncommon header names, and splice the key header names into horizontal and vertical header sentences.

[0020] In one embodiment, embedding the feature vector using the Bert pre-training model includes the following steps:

[0021] (1) Customize the loading of open source BERT pre-trained models in Chinese and English, and customize the tokenizer rules and training rate;

[0022] (2) Customize the [CLS] placeholder vector without obvious semantic information at the beginning of the sentence as the text sentence vector output, or select the average value of the feature vectors of the valid characters in the last encoding layer of the Encoder as the text sentence vector output.

[0023] In one embodiment, the construction of the residual self-attention model for training, tuning, saving and testing the topic classification model includes the following steps:

[0024] (1) All feature vectors are reduced in dimension and concatenated to form the final file feature vector.

[0025] (2) Generate a self-attention model sequence vector based on the file feature vector, and connect it to the Attention layer to calculate the attention value of the corresponding sequence. After obtaining the attention value of the corresponding sequence, add it to the original input and connect it to the Attention layer again to build a multi-layer residual self-attention neural network to obtain the final sequence attention value;

[0026] (3) The sequence attention value vectors are concatenated and the prediction results are obtained after multiple layers of fully connected layers and Softmax normalization. The global loss function uses the cross entropy loss function.

[0027] (4) After multiple parameter optimizations using the early stopping strategy and the decaying learning rate strategy, the optimal model is saved and tested and evaluated.

[0028] Compared with the prior art, the present invention has the following beneficial effects:

[0029] 1. Aiming at the multi-source and heterogeneous characteristics of government document data, the present invention designs targeted feature extraction and exception handling methods, and also designs a feature and label correlation testing method, which can realize the establishment of efficient feature engineering and meet the user's customized needs.

[0030] 2. Aiming at the task of subject classification of government documents, the present invention designs a targeted feature cleaning and optimization strategy, which effectively extracts document subject information, reduces noise interference, and supplements missing semantics.

[0031] 3. The present invention performs Fine-Tune based on the Bert model to avoid natural language processing from the text, effectively reducing the training cost. At the same time, the text pre-training module can adapt to the Bert Chinese and English open source pre-training model, and supports two sentence vector extraction strategies [CLS] symbol first vector and average pooling, which can meet different application scenarios.

[0032] 4. The present invention constructs a topic classification model based on the self-attention mechanism, efficiently integrates topic-related information from the perspective of file features, occupies less model training resources, and connects multiple layers of Attention layers based on the residual idea, which enhances the robustness of the model.

[0033] 5. The present invention is based on the government documents publicly released by various regions and departments, and is aimed at practical application scenarios with up to 70 types of subject label classifications, with a classification accuracy rate of up to 96.72%. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The drawings in the specification which constitute a part of this application are used to further explain the principles and processes of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention. In the drawings:

[0035] Figure 1 This is a framework diagram of a government document subject classification method based on a Bert pre-training model and a residual self-attention mechanism proposed in the present invention.

[0036] Figure 2 It is the workflow diagram of the original feature extraction module of government documents of the present invention.

[0037] Figure 3 It is a network structure diagram of a multi-layer perceptron model used in feature correlation experiments of the present invention.

[0038] Figure 4 It is the workflow diagram of the original feature cleaning and optimization module of government documents of the present invention.

[0039] Figure 5 This is an example diagram of text ID serialization of the text pre-training module of the present invention.

[0040] Figure 6 This is a network structure diagram of the document topic classification model based on the residual self-attention mechanism of the present invention. DETAILED DESCRIPTION

[0041] The present invention will be described in detail below with reference to the accompanying drawings and in combination with implementation examples. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0042] The following detailed description is an exemplary description, which is intended to provide further detailed description of the present invention. Unless otherwise specified, all technical terms used in the present invention have the same meaning as those generally understood by those skilled in the art to which the present application belongs. The terms used in the present invention are only for describing specific embodiments, and are not intended to limit exemplary embodiments according to the present invention.

[0043] The subject classification method of government documents based on residual self-attention mechanism proposed in this invention has a flowchart as shown in FIG. Figure 1 As shown, the following steps are included:

[0044] Step 1: Extraction and selection of original features of government documents;

[0045] After uniformly encoding the original government documents of different encodings and formats, a unified feature extraction method is designed for files of different formats to obtain features such as file name, file title, and file horizontal and vertical table headers, and the file name is used instead of abnormal value or null value features; then, based on a lightweight neural network-multilayer perceptron model, the correlation between the extracted government document name, file title, file table header and other features and the subject label is tested separately to determine the strength of the correlation between each feature and the subject label, and based on the test results, the original feature text with a model prediction accuracy higher than the set value (such as 30%) is selected to provide a reference for subsequent feature embedding methods and training parameters.

[0046] For example, see Figure 2 As shown, the present invention provides a specific original feature extraction and selection method, as follows:

[0047] (1) The original text corpus is uniformly encoded to ensure data standardization. The uniform encoding includes "GBK", "UTF-16" and "UTF-8". First, the texts with different encodings are decoded and converted into unicode encoding as an intermediate encoding. Then, the encoded string is encoded and finally converted into a uniform encoding format, such as UTF-8.

[0048] (2) We continuously try multiple file reading strategies for files of different formats. The order of reading file formats is "excel", "csv" and "txt", that is, we first try to read files in "excel" and "csv" formats. If this fails, we read files in "txt" format. The reading strategy is to read the file title and row header vertically, and read the file column header horizontally until valid Chinese characters are read. The judgment rule for the title and row header is whether there is an empty column character "Unnamed:1" in the data. For reading abnormalities and empty value features, the file name is used instead to ensure that the original feature text contains valid Chinese characters.

[0049] For example, for the file "Beijing Statistical Yearbook_2016_Per capita consumption expenditure composition of the city's resident households (2015).xls", the file name, file title, horizontal and vertical column headers extracted according to the above reading strategy are: "Beijing Statistical Yearbook_2016_Per capita consumption expenditure composition of the city's resident households (2015).xls", "8-6 Per capita consumption expenditure composition of the city's resident households (2015)", "Projects, city average, low-income households 20%, lower-middle-income households 20%, middle-income households 20%, middle-high-income households 20%, high-income households 20%" and "Per capita consumption expenditure, food, tobacco and alcohol expenditure (Engel coefficient), clothing expenditure, housing expenditure, daily necessities and service expenditure, transportation and communication expenditure, education, culture and entertainment expenditure, medical care expenditure, other supplies and service expenditure".

[0050] (3) A multi-layer perceptron model was used to conduct correlation experiments on the names, titles, and headers of government documents. The multi-layer perceptron is a lightweight neural network with the following model structure: Figure 3 As shown, the model requires low training resources and can be used for preliminary experiments before building complex models.

[0051] The Bert pre-trained model is used to embed the file name, file title, and document header to generate a 768-dimensional feature sentence vector. The 9-layer perceptron model is used for experiments. The activation function uses the Leaky_ReLU function, and the loss function uses the cross entropy loss function:

[0052]

[0053] After continuously optimizing and adjusting parameters such as Batch_size, Epoch, and Learning rate, the correlation results between each feature and topic label were measured. The experimental results are as follows:

[0054] feature Accuracy (number of correctly predicted files / total number of files) File name 82.36% Document Title 71.58% File header 41.79% File column header 36.44%

[0055] Based on the experimental results, feature engineering, feature embedding methods, and hyperparameters such as input weights can be preliminarily determined. At the same time, the activation function, loss function, and parameter optimization method used by the model can also be used as a reference for the subsequent self-attention model. Specifically, the file name, file title, and file header are all highly correlated with the file subject, and these four file features can be used as feature engineering to pass to the next link.

[0056] Step 2: Cleaning and optimizing the original features of government documents;

[0057] First, based on the original feature text selected in step 1, cleaning is performed to obtain low-noise feature text, that is, invalid information cleaning of file names, file titles, and file headers, including cleaning government document terms, geographic locations, agency name information, etc. that are not related to the subject, as well as translating common non-Chinese characters and removing non-Chinese characters;

[0058] Secondly, the semantic loss of the obtained low-noise feature text is optimized to extract the keywords of the file name and file header. Specifically, based on the cleaned file name, stop words are further cleaned, and the TF-IWF strategy is used to extract the file name keywords as feature supplements to compensate for the semantic loss of the sentence vector; the word frequency statistics strategy is used to extract the keywords of the file header, specifically, the key header names in the horizontal and vertical column headers of the file are extracted separately to reduce the noise impact of uncommon header names, and the key header names are spliced ​​into horizontal and vertical column header sentences.

[0059] For example, see Figure 4 As shown, the present invention provides a specific original feature cleaning and optimization method, as follows:

[0060] (1) Clean the file name, file title and file header, including custom stop word list, clean and optimize the file name, file title and file header. The specific steps are as follows:

[0061] Step 1: Clean the geographic location information. The geographic location information is cleaned to the prefecture-level administrative city level. The geographic information that has noise interference with the recognition of topic labels, such as "xx province, xx city", is cleaned, but the geographic information that is meaningful for the recognition of labels such as "xx street, xx village", etc., such as "people's livelihood services" and "rural development", is retained;

[0062] Step 2: Clean the names of administrative agencies. In the name of "xx Bureau's administrative penalty on xx", "xx Bureau" has prominent subject information, which is actually noise and is cleaned, leaving only relevant administrative measures information;

[0063] Step 3: Add stop words with characteristics of government data, such as "each region", "each quarter", etc.

[0064] Step 4: Translation: translate common non-Chinese words such as "GDP" into "gross domestic product";

[0065] Step 5: Clean non-Chinese characters, including spaces, numbers, letters, and garbled symbols.

[0066] (2) Based on the cleaned file names, extract the keyword features of the file names to supplement the ambiguity of the keyword meanings in the sentence vector. After further cleaning the stop words, use the TF-IWF strategy to extract the file name keywords to avoid the influence of uncommon words. The three words with the highest TF-IWF values ​​are taken as keywords. The TF-IWF calculation formula is as follows:

[0067]

[0068] Where tf is the word frequency, iwf is the inverse frequency of words, n d,t Indicates the frequency of word t appearing in document d, n d represents the frequency sum of all words in document d, w c represents the frequency sum of all words in the document set c, w c,t Indicates the frequency of word t appearing in document set c.

[0069] (3) Based on the word frequency statistics strategy of all file header names, the five most frequently appearing key header names in the horizontal and vertical column headers of the file are extracted respectively to reduce the impact of uncommon header words. For files with less than five headers, their headers are repeated to complete the sentences and then spliced ​​into horizontal and vertical column header sentences.

[0070] For example, for the file "Beijing Statistical Yearbook_2016_Composition of Per Capita Consumption Expenditure of Households in the City (2015).xls", after cleaning and optimization according to the above strategy, the file name, file name keywords, file title, horizontal and vertical column headings are: "Composition of Per Capita Consumption Expenditure of Households in the City", "Expenditure, Households, Consumption", "Composition of Per Capita Consumption Expenditure of Households in the City by Year", "Average low-income households, middle-low-income households, middle-income households, middle-high-income households in the city", and "Per Capita Consumption Expenditure Clothing Expenditure Transportation and Communication Expenditure Education Culture and Entertainment Expenditure Medical Care Expenditure".

[0071] Step 3, text pre-training;

[0072] Based on the optimized feature text, the feature vector is embedded using the Bert pre-training model. The text pre-training module can adapt to the Bert Chinese and English open source pre-training model and supports two sentence vector extraction strategies. One is the [CLS] sentence head vector, that is, the empty space vector at the beginning of the sentence without obvious semantic information; the other is the average pooling strategy, which uses the average value of the valid character vectors in the sentence as the text sentence vector. Based on this module, the feature text can be embedded to generate a feature vector.

[0073] Specifically, see Figure 5As shown, the open source Bert pre-trained model is customized and loaded, and all feature texts are integrated, including file name, file name keywords, file title, file horizontal header and file vertical header feature text. Sentence-level text is used as input, and the tokenizer rule and training rate are customized to segment the text, insert [CLS] space character at the beginning of the sentence, insert [SEP] terminator at the end of the sentence, and set the maximum sequence length, such as 128, fill 0 for sequences less than the maximum length, truncate for sequences exceeding the maximum length, convert the cleaned and optimized feature text into character id, load the Harbin Institute of Technology version Chinese Bert pre-trained model, and send the id serialized data into the pre-trained model in batches for vector embedding. In this embodiment, Batch_size is set to 768, and the data embedding speed can reach 100,000 / hour;

[0074] Model pre-training, using two pooling strategies to obtain pre-trained sentence vectors:

[0075] a) [CLS] token sentence start vector strategy, which selects the [CLS] token vector without obvious semantic information at the beginning of the sentence as the sentence vector for output;

[0076] b) Average pooling strategy: record the length of the input sentence, take the average value of the feature vector of the valid characters in the last encoding layer of the Encoder end as the text sentence vector for output.

[0077] In this embodiment, the [CLS] sentence first vector strategy and the average pooling strategy are used simultaneously to embed the feature vector of the file name, and the average pooling strategy is used to embed the feature vector of other features, and the embedding result is stored as a numpy format file.

[0078] [CLS] itself has no obvious semantic information, and will more "fairly" integrate the semantic information of each word in the text, making it easier to express the structural information and emotional tendency of the sentence. The average pooling strategy simply averages the semantic information of each word in the text, making it easier to express literal semantics. For features with excellent performance, two sentence vector acquisition strategies can be used at the same time to increase the weight. Based on this, a 768-dimensional feature sentence vector for each feature can be obtained.

[0079] Step 4: Topic label classification based on residual self-attention mechanism;

[0080] Based on the feature vector, a residual self-attention model is constructed to train, tune, save and test the topic classification model to obtain the final document topic classification model, and the model is used to classify government documents by topic.

[0081] Specifically, see Figure 6 As shown, the process includes:

[0082] (1) Use a single fully connected layer to reduce the dimension of each feature vector. The supervised dimension reduction measure can effectively reduce the training parameters and training costs while minimizing information loss. At the same time, it increases the dimension reduction of excellent features to improve their weight. In this embodiment, the dimension reduction ratio of the file name, file title, file name keyword, and file horizontal and vertical header feature vector is 2:2:1:1:1. The feature vectors after dimension reduction are concatenated to form a file feature vector. The dimension of the file feature vector must be consistent with the dimension of the attention sequence vector, so that the file feature vector can be used as the residual input of the second layer Attention layer.

[0083] (2) Using the self-attention mechanism, four self-attention model sequence vectors are generated for the file feature vector, namely, four same-dimensional Query, Key, and Value (Query, Key, and Value take the same value) vectors, and then sent to the Attention layer to calculate the corresponding attention value. The calculation formula is as follows. The similarity calculation adopts the dot product method:

[0084]

[0085] Similarity(Query i ,Key j )=Query i Key j (4)

[0086] Where, Attention_score i Represents the attention value of the i-th model sequence, Query i Represents the Query value of the i-th model sequence, Key j and Value j Represent the Key and Value of the j-th model sequence respectively.

[0087] The essence of its calculation is to perform a dot product operation on the query of a single sequence and the key of the remaining sequences to obtain the corresponding weight, perform Softmax normalization on the weight, multiply it by the corresponding value and add them together to obtain the attention value of the sequence.

[0088] (3) After obtaining the attention value of the corresponding sequence, a multi-layer residual self-attention neural network is constructed based on the residual idea. The output of the first Attention layer is added to the feature vector of the original file as the input of the second Attention layer. The second-layer attention value sequence is calculated according to step (2). The subsequent Attention layer can add the input and output sequences of the previous layer as input to increase the depth of the neural network while effectively avoiding overfitting. Based on this, the Attention layer is connected again to construct a multi-layer residual self-attention neural network to obtain the final sequence attention value. According to multiple experimental results, the model with two Attention layers has the best effect.

[0089] (4) After obtaining the final sequence attention value, the attention value vector is concatenated and the prediction result is obtained after passing through 7 layers of fully connected layers and Softmax normalization. The activation function of the fully connected layer in the model uses the Leaky_ReLU function, and the fully connected layer uses the Dropout strategy to avoid overfitting. The probability of each fully connected layer neuron being retained is 0.5, and the global loss function uses the cross entropy loss function:

[0090]

[0091] (5) Model training: After multiple parameter optimizations using the early stopping strategy and the decaying learning rate strategy, the model is solidified and saved, and then tested and evaluated. The specific parameter optimization measures are as follows:

[0092] a) Based on the model training time, resource usage, and stability of model convergence, after multiple experiments, the Batch_Size was determined to be 768.

[0093] b) Use the Early-stopping strategy to divide the validation set. If the validation set accuracy does not increase by more than 0.1% after 10 epochs, stop training to optimize the epoch parameters. Finally, the number of epochs is determined to be 205.

[0094] c) Use decaying learning rate. The initial learning rate lr is set to 0.01 to converge to the local optimum as quickly as possible. The decay rate decay is set to 0.00035. When the batch is more than halfway, the learning rate decays to about one-fourth of the original learning rate. The calculation formula is as follows:

[0095]

[0096] (6) After adjusting parameters and optimizing, the optimal performance model is obtained, and the model is solidified and saved as protocol_buffer model, and then tested and evaluated. For the topic classification accuracy calculation, the weight is determined according to the number of files of each topic label, and the weighted average Precision of each label recognition accuracy is taken:

[0097]

[0098] Among them, n is the total number of topic tags, Num i is the number of documents under the i-th topic label, Precision i is the recognition accuracy of the i-th topic tag, for a certain tag:

[0099]

[0100] Among them, Num correct The number of files identified correctly for this tag, Num all The total number of files for which this tag was identified.

[0101] Finally, based on the government data sets disclosed by various regions and departments, the classification accuracy of the topic model was 96.72%.

Claims

1. A government document subject classification method based on Bert and residual self-attention mechanism, characterized in that: The steps include: Step 1: Extraction and selection of original features of government documents; The feature selection is to use a multi-layer perceptron model to test the correlation between each extracted feature and the topic label, determine the strength of the correlation between each feature and the topic label, and select the original feature text whose model prediction accuracy is higher than the set value according to the test results; Step 2: Cleaning and optimizing the original features of government documents; The feature optimization is to extract the keywords of the file name and file header from the low-noise feature text obtained after the original feature is cleaned; Step 3, text pre-training; Based on the optimized feature text, the feature vector is embedded using the Bert pre-training model; Step 4: Topic label classification based on residual self-attention mechanism; Based on the feature vector, a residual self-attention model is constructed to train, tune, save and test the topic classification model, and the final document topic classification model is obtained. The final document topic classification model is used to classify government documents by topic. The embedding of feature vectors using the Bert pre-training model includes the following steps: (1) Customize the loading of open source BERT pre-trained models in Chinese and English, and customize the tokenizer rules and training rate; (2) Customize the [CLS] placeholder vector at the beginning of the sentence without obvious semantic information as the text sentence vector output, or select the average value of the feature vectors of the valid characters in the last encoding layer of the Encoder as the text sentence vector output; The construction of the residual self-attention model for training, tuning, saving and testing the topic classification model includes the following steps: (1) Reduce the dimension and concatenate all feature vectors to form the final file feature vector; (2) Generate a self-attention model sequence vector based on the file feature vector, and connect it to the Attention layer to calculate the attention value of the corresponding sequence. After obtaining the attention value of the corresponding sequence, add it to the original input and connect it to the Attention layer again to build a multi-layer residual self-attention neural network to obtain the final sequence attention value; (3) The sequence attention value vectors are concatenated and the prediction results are obtained after multiple layers of fully connected layers and Softmax normalization. The global loss function uses the cross entropy loss function. (4) After multiple parameter optimizations using the early stopping strategy and the decaying learning rate strategy, the optimal model is saved and tested and evaluated.

2. The government document subject classification method based on Bert and residual self-attention mechanism according to claim 1 is characterized in that: The original feature extraction is to uniformly encode government documents with different codes and formats, read the file name, file title and file horizontal and vertical column header features according to the file format, and use the file name to replace abnormal value or null value features.

3. The government document subject classification method based on Bert and residual self-attention mechanism according to claim 1 is characterized in that: The feature selection is implemented based on a multi-layer perceptron model.

4. The government document subject classification method based on Bert and residual self-attention mechanism according to claim 1 is characterized in that: The original feature cleaning is to clean invalid information in file names, file titles and file headers, including cleaning government document terms, geographical locations and agency names that are not related to the subject, and translating common non-Chinese words into Chinese and cleaning non-Chinese characters.

5. The government document subject classification method based on Bert and residual self-attention mechanism according to claim 1 is characterized in that: The feature optimization is based on feature cleaning, cleaning stop words, then using tf-iwf to extract file name keywords, and using word frequency statistics strategy to extract file header keywords.

6. The government document subject classification method based on Bert and residual self-attention mechanism according to claim 5 is characterized in that: The word frequency counting strategy is to extract key header names in the horizontal and vertical column headers of the file respectively, reduce the noise impact of uncommon header names, and splice the key header names into horizontal and vertical column header sentences.

Citation Information

Patent Citations

  • Multi-label text classification method based on statistics and pre-trained language model

    CN112214599A

  • Multi-label text classification method based on public opinion big data analysis

    CN112487143A

  • Track traffic specification entity recognition method based on directory theme classification

    CN113642330A

  • Address information feature extraction method based on deep neural network model

    US20210012199A1

  • Multi-granularity fusion model-based intelligent semantic chinese sentence matching method, and device

    WO2021164199A1