A generative automatic summarization method based on BERT and external knowledge
By combining BERT and external knowledge in the generative automatic summarization method, and using the TextRank and Transformer models, we solve the problem that existing technology cannot accurately express the main purpose of the document and ensure the coherence of the summary, achieve higher-quality summary generation, and improve the summary completeness and fluency.
Patent Information
- Application Number
- CN202210047258.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-17
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2042-01-17
AI Technical Summary
Existing generative automatic summarization methods cannot accurately express the main purpose of the document, and the generated summaries cannot ensure coherence and consistency, and fail to make full use of external prior knowledge.
Adopt a generative automatic summarization method based on BERT and external knowledge, obtain keywords through the TextRank module, combine it with the BERT model for encoding, use the external knowledge module to retrieve relevant knowledge, and integrate knowledge information through the gating mechanism, input the Transformer model for decoding, and finally Generate summary.
It improves the semantic richness and quality of the summary, improves the completeness and fluency of the summary, captures more contextual information through BERT, obtains keywords through TextRank, enriches semantics with external knowledge, and captures internal information with Transformer to generate more accurate and coherent summaries. .
Smart Images

Figure CN114398478B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of natural language processing, and in particular relates to a generative automatic summarization method based on BERT and external knowledge. Background Art
[0002] With the advancement of technology and the booming development of the mobile Internet industry, every Internet user and even every terminal has become a producer of Internet information. Faced with a massive amount of information, the phenomenon of information overload is becoming increasingly serious. How to enable people to efficiently obtain the information they need has become a huge challenge in today's era. In order to obtain the required information more efficiently, automatic text summarization has gradually become an indispensable technology.
[0003] Automatic text summarization can be divided into extractive automatic text summarization and generative automatic text summarization. Extractive summarization generates a summary by selecting some relevant sentences from the original document. The length of the summary depends on the compression rate. This is a simple and effective text summarization method. Generative summarization generates a summary through abstract generalization. Its basic idea is to condense the ideas and concepts of the original document on the basis of understanding the semantics of the original text to achieve semantic reconstruction. Mihalcea et al. proposed the TextRank method for text summarization. Erkan et al. proposed the LexRank method for text summarization. TextRank calculates sentence similarity by the number of co-occurrences of words in a sentence. It is mainly used in single-document automatic summary generation, while LexRank is based on the cosine similarity of the statistical word frequency TF-IDF vector. It is mainly used in multi-document automatic summary generation. Mehdad et al. proposed the best path ranking strategy based on the graph ranking algorithm based on the generative method based on graph ranking and applied it to generative text summarization. Wu Renshou et al. introduced a global self-matching mechanism on the encoder side for global optimization, and used a global gating unit to extract the core content of the text. The model can effectively integrate global information and mine the core content of the original text. Experiments on the LCSTS dataset show that the performance of the model has been significantly improved. Li et al. proposed a dual attention pointer network for text summarization. This method introduces a self-attention mechanism to obtain key information of the source text, and combines the gating mechanism to control the selection of information. On the basis of the existing coverage mechanism, a truncation parameter is added to prevent the mechanism from interfering with the generation of other targets.
[0004] The above technologies all generate summaries directly based on the original document. Compared with manually written summaries, they do not take into account external prior knowledge, resulting in the generated summaries being unable to accurately express the main points of the document, and it is difficult to ensure the coherence and consistency of the generated summaries. Summary of the invention
[0005] To solve the above problems, the present invention provides a generative automatic summarization method based on BERT and external knowledge, which obtains document data and performs preprocessing; inputs the preprocessed document data into a trained generative automatic summarization model to generate a summary corresponding to the document; the generative automatic summarization model includes a TextRank module, a BERT module, an external knowledge module and a Transformer model;
[0006] The training process of the generative automatic summarization model includes:
[0007] S1. Obtaining original abstract data and preprocessing the original abstract data;
[0008] S2. The preprocessed raw abstract data is sent to the TextRank module to obtain keywords, and the preprocessed raw abstract data is input into the BERT module for encoding to obtain encoded data;
[0009] S3. Retrieve relevant knowledge information from the external knowledge module based on keywords, and fuse the knowledge information with the encoded data through a gating mechanism;
[0010] S4. Input the fused data into the Transformer model for decoding to obtain decoded data, input the decoded data into the fully connected layer, and input the output result of the fully connected layer into the softmax layer to generate a summary; set the initial number of iterations;
[0011] S5. Use the cross entropy loss function to train the generative automatic summarization model, and use the Adam algorithm to optimize the generative automatic summarization model, that is, adjust the parameters of the BERT module and the Transformer model; determine whether the calculation result of the cross entropy loss function reaches the minimum value, if so, end the training, otherwise proceed to step S6;
[0012] S6. Determine whether the number of iterations reaches the maximum number of iterations. If so, the training of the generative automatic summarization model is completed. Otherwise, return to step S5, and the number of iterations is increased by 1.
[0013] Furthermore, the process of preprocessing the original abstract data is as follows:
[0014] S11. Perform word segmentation on the original abstract data, and use the BERT vocabulary to convert the original abstract data after word segmentation into an ID file;
[0015] S12. Set the maximum length of the sequence, and pad the ID file according to the maximum length of the sequence.
[0016] Furthermore, the process of obtaining the encoded data includes:
[0017] S21. Mark the preprocessed original abstract data to obtain a marked document, which is represented by:
[0018] S=[CLS],D 11 ,…,D 1m ,[SEP],…D ij …,[CLS],D n1 ,…,D nx ,[SEP];
[0019] S22. Embed the marked document to obtain the document word embedding of the marked document. The document word embedding is expressed as:
[0020] h = BERT.embedding(S);
[0021] S23. Input the document word embedding into the BERT model to obtain the encoded data, which is represented as:
[0022] T d =BERT(h);
[0023] Where D represents the original abstract data after preprocessing, S represents the marked document, and D i represents the i-th sentence in the original abstract data after preprocessing, D ij represents the jth word in the i-th sentence in the preprocessed raw abstract data, [CLS] and [SEP] are the delimiters of each sentence; h represents document word embedding, BERT.embedding(·) represents embedding operation; BERT(·) represents BERT model, T d =T [CLS] ,T 11 ,…,T 1m ,T [SEP] ,…T ij …,T [CLS] ,T n1 ,…,T nx ,T [SEP] Represents the coded data, T [SEP] and T [CLS] Indicates the delimiter of each sentence in the encoded data, T ij Represents the jth word in the i-th sentence in the encoded data.
[0024] Furthermore, the multi-head attention mechanism is adopted in the BERT model, which is expressed as:
[0025]
[0026] head i =Attention(QW iQ ,KW i K ,VW i V );
[0027] MultHead(Q,K,V)=Concat(head1,…,head h )W O ;
[0028] Among them, Attention(·) represents the attention mechanism; Q represents the query vector, K represents the key vector, and V represents the value vector; softmax(·) represents the normalization function, T is the symbol of matrix transposition, and d k Indicates the dimension of the key vector, head i is the Attention value obtained from the h-th projection, i is the number of projections, W i Q The weight matrix W is trained for the Q vector i K is the K vector training weight matrix, W i V is the weight matrix for training the V vector, MultHead(·) represents the final output of the multi-head attention mechanism, and W O is the additional weight matrix, and Concat(·) is vector concatenation.
[0029] Further, step S3 includes:
[0030] S31. Obtain keyword embedding corresponding to the keyword, and retrieve relevant external knowledge in the external knowledge module according to the keyword embedding;
[0031] S32. Fusing external knowledge and keywords through linear operations to obtain a knowledge vector;
[0032] S33. Filter the knowledge vector through the gating mechanism to obtain knowledge information, and fuse the knowledge information with the encoded data to obtain T′ d .
[0033] Furthermore, the formula for generating the summary is expressed as:
[0034] out = Transformer(T′ d );
[0035] P vocab =softmax(g[out]);
[0036] Where Transformer(·) represents the Transformer decoder, T′ drepresents the fused data, g(·) represents the fully connected layer, out represents the output result of the Transformer decoder, P vocab Indicates the probability of a word in the vocabulary becoming a summary.
[0037] Furthermore, the cross entropy loss function is expressed as:
[0038]
[0039] Among them, y <t ={y1,y2,y3,…,y t-2 ,y t-1};y t represents the tth word in the summary; x represents the document information in the input original abstract data; θ represents the trained model parameters; n represents the nth document in the input original abstract data, T represents the length of the summary, and N represents the total number of documents in the original abstract data.
[0040] Furthermore, the Adam algorithm is used to calculate the optimization result of the generative automatic summarization model, and its calculation formula is:
[0041]
[0042] in, represents the corrected first-order moment estimate, represents the corrected second-order moment estimate; μ represents the step size, δ is a constant added to maintain numerical stability, and θ represents the parameter to be updated.
[0043] Beneficial effects of the present invention:
[0044] The present invention adopts the BERT model to encode document data, captures more contextual information of the document data, improves the encoding quality, obtains the keywords corresponding to the document data through TextRank, obtains relevant knowledge information in the external knowledge base according to the keywords, and adopts a gating mechanism to fuse the knowledge information with the encoded document data, enriches the semantics of the generated abstract, and improves the quality of the abstract. The use of the Transformer model can capture more internal information, so that the generated abstract has a certain improvement in completeness and fluency. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is a diagram of the model training process of the present invention;
[0046] Figure 2 This is a model structure diagram of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] A generative automatic summarization method based on BERT and external knowledge, such as Figure 2 As shown, a generative automatic summarization model is constructed, and the generative automatic summarization model includes a TextRank module, a BERT model, an external knowledge module and a Transformer model. The method includes the following steps:
[0049] 101. Obtain document data, and obtain keywords corresponding to the document data through the TextRank module;
[0050] 102. Input the document data into the BERT model for encoding to obtain the encoded document information;
[0051] 103. Retrieve external knowledge from the external knowledge module through keywords and integrate external knowledge with document information through the gating mechanism;
[0052] 104. Input the fused information into the Transformer model for decoding to generate a summary.
[0053] In one embodiment, the training process of the generative automatic summarization model is as follows: Figure 1 As shown, including:
[0054] S1. Obtain the original data set, divide the original data set into a training set, a validation set, and a test set, and preprocess the data in the training set;
[0055] Specifically, the same preprocessing operations are performed on the data in the validation set and the test set;
[0056] S2. Send the preprocessed data of the training set to the TextRank module to obtain keywords, and send the preprocessed data to the BERT module for encoding to obtain encoded data;
[0057] S3. Retrieve relevant knowledge information in the external knowledge module according to the keywords, fuse the knowledge information with the coded data, and obtain fused data;
[0058] S4. Send the fused data to the Transformer model for decoding to obtain decoded data, input the decoded data into the fully connected layer, and input the output result of the fully connected layer into the softmax layer to generate a summary;
[0059] S5. Use the cross entropy loss function to train the generative automatic summarization model, and use the Adam algorithm to optimize the generative automatic summarization model, that is, adjust the parameters of the BERT module and the Transformer model; determine whether the calculation result of the cross entropy loss function reaches the minimum value, if so, end the training, otherwise proceed to step S6;
[0060] S6. Determine whether the number of iterations reaches the maximum number of iterations. If so, the training of the generative automatic summarization model is completed. Otherwise, return to step S5, and the number of iterations is increased by 1.
[0061] After the training is completed, the test set is used to evaluate the performance of the trained extractive reading comprehension model.
[0062] Preferably, ROUGE-1, ROUGE-2 and ROUGE-L among the ROUGE evaluation indicators are used to evaluate the model performance.
[0063] ROUGE is an automatic text summarization evaluation method proposed in 2004. It is a set of indicators for evaluating automatic text summarization. The core is to judge the quality of the summary by counting the overlapping units n-gram of the machine candidate summary sentence and the standard summary sentence. ROUGE is mainly based on recall for evaluation. Its basic idea is: multiple experts write manual summaries separately to form a standard summary set. The automatic summary generated by the system is compared with the standard summary written by humans, and the quality of the summary is evaluated by counting the number of basic units (n-grams, word sequences and word pairs) that overlap between the two. By comparing the manual summaries of multiple experts, the stability and robustness of the evaluation system are improved. This method has now become one of the common standards for summary evaluation technology. The calculation method of ROUGE-N is as follows:
[0064]
[0065] Among them, n represents the length of n-gram, Count match (gram n ) represents the number of n-grams shared by the reference summary and the generated summary, Count(gram n ) represents the number of n-grams in the reference summary.
[0066] The calculation formula of ROUGE-L is:
[0067]
[0068]
[0069]
[0070] Where LCS(X,Y) is the length of the longest common subsequence of X and Y, X is the generated summary, Y is the reference summary, m and n represent the length of the reference summary and the generated summary respectively (generally refers to the number of words contained), R lcs , P lcs Represents recall and precision respectively, and the final F lcs That is Rouge-L.
[0071] In one embodiment, the original data set uses the CNN / Daily Mail data set from Cable News Network and the Daily Mail. The data set contains about 300,000 news corpora from Cable News Network and the Daily Mail. Each source text contains an average of 766 words and 29.74 sentences, and the corresponding standard summary contains an average of 53 words and 3.72 sentences. The data set is divided into three parts: the training set contains 196,961 documents, the validation set contains 12,148 documents, and the test set contains 10,397 documents.
[0072] The data in the training set is preprocessed as follows:
[0073] S11. Perform word segmentation on the data in the training set and convert the word segmentation data into an ID file using the BERT vocabulary.
[0074] S12. Set the maximum sequence length according to the requirements of the BERT model, and pad the ID file according to the maximum sequence length; if the ID file exceeds the maximum sequence length, truncate the excess data and only input the previous data.
[0075] The preprocessed data is sent to the TextRank module, and the TextRank module is used to obtain the keywords corresponding to each document in the preprocessed data, which is expressed as:
[0076] Key1,…,Key i ,…,Key n =TextRank(D);
[0077] Among them, TextRank(·) represents the keyword extraction algorithm, Key i Represents the i-th keyword extracted from the document, and uses [CLS] and [SEP] to mark each keyword, thereby segmenting multiple keywords in a document.
[0078] At the same time, the preprocessed data is input into the BERT module for encoding to obtain encoded data, including:
[0079] S21. Label the preprocessed data to obtain a labeled document, which is represented by:
[0080] S=[CLS],D 11 ,…,D 1m ,[SEP],…D ij …,[CLS],D n1 ,…,D nx ,[SEP];
[0081] Among them, D represents a document in the preprocessed data, S represents the marked document, and D i represents the i-th sentence in the document, D ij Represents the jth word in the i-th sentence in the document, [CLS] and [SEP] are the delimiters of each sentence;
[0082] S22. Embed the marked document to obtain the document word embedding of the marked document. The document word embedding is expressed as:
[0083] h = BERT.embedding(S);
[0084] h represents document word embedding, and BERT.embedding(·) represents the embedding operation;
[0085] S23. Input the document word embedding into the BERT model to obtain the encoded document, which is represented as:
[0086] T d =BERT(h);
[0087] T d =T [CLS] ,T 11 ,…,T 1m ,T [SEP] ,…T ij …,T [CLS] ,T n1 ,…,T nx ,T [SEP] represents the encoded document, BERT(·) represents the BERT model, T [SEP] and T [CLS] Indicates the delimiter of each sentence in the encoded data, T ij Represents the jth word in the i-th sentence in the encoded data.
[0088] BERT can obtain high-quality encoding mainly because of its multi-head attention mechanism. The specific formula of the multi-head attention mechanism is as follows:
[0089]
[0090] head i =Attention(QW i Q ,KW i K ,VW i V );
[0091] MultHead(Q,K,V)=Concat(head1,…,head h )W O ;
[0092] Among them, Attention(·) represents the attention mechanism; Q represents the query vector, K represents the key vector, and V represents the value vector; softmax(·) represents the normalization function, T is the symbol of matrix transposition, and d k Indicates the dimension of the key vector, head i is the Attention value obtained from the h-th projection, i is the number of projections, W i Q The weight matrix W is trained for the Q vector i K is the K vector training weight matrix, W i V is the weight matrix for training the V vector, MultHead(·) represents the final output of the multi-head attention mechanism, and W O is the additional weight matrix, and Concat(·) is vector concatenation.
[0093] In one embodiment, after encoding using BERT, in order to enrich the semantics of the document, keywords are used to retrieve corresponding external knowledge from an external knowledge base, and the external knowledge is spliced and fused with the encoded document through a gating mechanism to obtain a fused document with richer semantics. The specific process is as follows:
[0094] The knowledge information in the external knowledge base is composed of and stored in triples. The triples are represented as follows:
[0095] (e; r; o)
[0096] Among them, e represents subject, r represents relationship, and o represents object.
[0097] For each keyword Key in the document obtained by TextRank i , get the corresponding keyword word embedding h in the document word embedding h i, and retrieve the corresponding knowledge information from the external knowledge base. The specific retrieval process is: obtain synonyms in the external knowledge base according to keywords or obtain related relationships and objects in the external knowledge base as external knowledge through string matching.
[0098] After retrieving external knowledge, linear operations are used to measure the fusion of external knowledge and keywords to obtain the knowledge vector. The specific formula is as follows:
[0099]
[0100] c=[c1;···;c i ;···;c n ];
[0101] Where f(·) represents a linear function, e represents the subject entity vector, i.e., the keyword, o represents the object entity vector, i.e., the external knowledge obtained based on the keyword, r represents the relationship between e and o, and M r represents the embedding matrix of the relationship, n represents the number of keywords, [;] represents the vector concatenation operation, c i represents the i-th knowledge vector, and n is the total number of keywords.
[0102] The gating mechanism is used to remove redundant information from the knowledge vector and filter out important information. In this embodiment, the knowledge vector is filtered by the gating mechanism to obtain knowledge information, and the knowledge information is fused with the encoded document. The specific fusion process is as follows:
[0103] key=[h1;···;h i ;···;h n ]
[0104] c′=c⊙σ(key)
[0105] T′ d =[T d ; c′]
[0106] Among them, h i represents the keyword embedding obtained by document word embedding for the ith keyword, n represents the number of keywords, σ(·) represents the sigmoid function, ⊙ represents the dot product of the matrix, T d is the document encoded by BERT, W is a trainable matrix, T′ d It is the output after the fusion of external knowledge and document information, [;] represents the vector concatenation operation, and c′ represents the knowledge information obtained after filtering through the gating mechanism.
[0107] The data after the fusion of knowledge information and encoded documents is input into the Transformer decoder for decoding. The output of the decoder is input into a fully connected layer and then passed through a softmax layer to generate a summary. The specific formula is as follows:
[0108] out = Transformer(T′ d );
[0109] P vocab =softmax(g[out]);
[0110] Where Transformer(·) represents the Transformer decoder, T′ d represents the output after the fusion of knowledge information and encoded documents, g(·) represents the fully connected layer, out represents the output result of the Transformer decoder, and P vocab Represents the vocabulary in the vocabulary, that is, the probability that the words in the document become the summary after the knowledge information and the encoded document are fused.
[0111] After obtaining the final generated summary, the loss function is calculated between the summary and the reference summary to judge the quality of model training. The loss function calculation formula is:
[0112]
[0113] Among them, y <t ={y1,y2,y3,…,y t-2 ,y t-1};y t represents the tth word in the summary; x represents the input document information; θ represents the trainable model parameters; n represents the nth input document, T represents the length of the summary, and N represents the number of documents.
[0114] According to the calculation of the loss function, the model parameters need to be optimized, and the Adam optimization algorithm is used. Adam is a first-order optimization algorithm that can replace the traditional stochastic gradient descent process. It can iteratively update the weights of the neural network based on the training data. Compared with the commonly used SGD algorithm, Adam has the advantages of high computational efficiency, low memory usage, and fast parameter adjustment. Adam can design independent adaptive learning rates for different parameters by calculating the first-order moment estimate and second-order moment estimate of the gradient. The main calculation formula is as follows:
[0115]
[0116] in, represents the corrected first-order moment estimate, represents the corrected second-order moment estimate; μ represents the step size, δ is a constant added to maintain numerical stability, and θ represents the parameter to be updated.
[0117] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A generative automatic summarization method based on BERT and external knowledge, characterized in that: Obtain document data and preprocess it; input the preprocessed document data into the trained generative automatic summarization model to generate a summary corresponding to the document; the generative automatic summarization model includes the TextRank module, the BERT module, the external knowledge module and the Transformer model; The training process of the generative automatic summarization model includes: S1. Obtaining original abstract data and preprocessing the original abstract data; The process of preprocessing the original abstract data is as follows: S11. Perform word segmentation on the original abstract data, and use the BERT vocabulary to convert the original abstract data after word segmentation into an ID file; S12. Set the maximum length of the sequence, and pad the ID file according to the maximum length of the sequence; S2. The preprocessed raw abstract data is sent to the TextRank module to obtain keywords, and the preprocessed raw abstract data is input into the BERT module for encoding to obtain encoded data; The process of obtaining the encoded data includes: S21. Mark the preprocessed original abstract data to obtain a marked document, which is represented by: S=[CLS],D 11 ,...,D 1m ,[SEP],...D ij ...,[CLS],D n1 ,...,D nx ,[SEP]; S22. Embed the marked document to obtain the document word embedding of the marked document. The document word embedding is expressed as: h = BERT.embedding(S); S23. Input the document word embedding into the BERT model to obtain the encoded data, which is represented as: T d =BERT(h); Where D represents the original abstract data after preprocessing, S represents the marked document, and D i represents the i-th sentence in the original abstract data after preprocessing, D ij represents the jth word in the i-th sentence in the preprocessed original abstract data, [CLS] and [SEP] are the separators of each sentence; h represents document word embedding, BERT.embeddin(·) represents the embedding operation; BERT(·) represents the BERT model, T d =T [CLS] , T 11 , ..., T 1m , T [SEP] , ...T ij ..., T [CLS] , T n1 , ..., T nx , T [SEP] Represents the coded data, T [SEP] and T [CLS] Indicates the delimiter of each sentence in the encoded data, T ij Represents the jth word in the i-th sentence in the encoded data; The multi-head attention mechanism is used in the BERT model, which is expressed as: head i =Attention(QW i Q ,KW i K ,VW i V ); MultHead(Q,K,V)=Concat(head1,...,head h )W O ; Among them, Attention(·) represents the attention mechanism; Q represents the query vector, K represents the key vector, and V represents the value vector; softmax(·) represents the normalization function, T is the symbol of matrix transposition, and d k Indicates the dimension of the key vector, head i is the Attention value obtained from the h-th projection, i is the number of projections, W i Q The weight matrix W is trained for the Q vector i K is the K vector training weight matrix, W i V is the weight matrix for V vector training, MultHead(·) represents the final output of the multi-head attention mechanism, and W O is the additional weight matrix, Concat(·) is vector concatenation; S3. Retrieve relevant knowledge information from the external knowledge module based on keywords, and fuse the knowledge information with the encoded data through a gating mechanism; Step S3 includes: S31. Obtain keyword embedding corresponding to the keyword, and retrieve relevant external knowledge in the external knowledge module according to the keyword embedding; S32. Fusing external knowledge and keywords through linear operations to obtain a knowledge vector; S33. Filter the knowledge vector through the gating mechanism to obtain knowledge information, and fuse the knowledge information with the encoded data to obtain the fused data T′ d ; S4. Input the fused data into the Transformer model for decoding to obtain decoded data, input the decoded data into the fully connected layer, and input the output result of the fully connected layer into the softmax layer to generate a summary; set the initial number of iterations; The formula for generating the summary is expressed as: out=Transformer(T′ d ); P vocab =softmax(g[out]); Where Transformer(·) represents the Transformer decoder, T′ d represents the fused data, g(·) represents the fully connected layer, out represents the output result of the Transformer decoder, P vocab Indicates the probability of a word in the vocabulary becoming a summary; S5. Use the cross entropy loss function to train the generative automatic summarization model, and use the Adam algorithm to optimize the generative automatic summarization model, that is, adjust the parameters of the BERT module and the Transformer model; determine whether the calculation result of the cross entropy loss function reaches the minimum value, if so, end the training, otherwise proceed to step S6; S6. Determine whether the number of iterations reaches the maximum number of iterations. If so, the training of the generative automatic summarization model is completed. Otherwise, return to step S5, and the number of iterations is increased by 1.
2. The generative automatic summarization method based on BERT and external knowledge according to claim 1, characterized in that: The cross entropy loss function is expressed as: Among them, y <t={y1,y2,y3,…,y t-2 ,y t-1 };y t represents the tth word in the summary; x represents the document information in the input original abstract data; θ represents the trained model parameters; n represents the nth document in the input original abstract data, T represents the length of the summary, and N represents the total number of documents in the original abstract data.
3. The generative automatic summarization method based on BERT and external knowledge according to claim 1, characterized in that: The Adam algorithm is used to calculate the optimization result of the generative automatic summarization model, and its calculation formula is: in, represents the corrected first-order moment estimate, represents the corrected second-order moment estimate; μ represents the step size, δ is a constant added to maintain numerical stability, and θ represents the parameter to be updated.
