Text abstract generation method based on pre-training model
By using the BERT pre-trained language model for topic classification and distribution strategy optimization in text summary generation, the problems of low text summary generation efficiency and insufficient accuracy in the existing technology are solved, and efficient and accurate text summary generation is achieved.
Patent Information
- Application Number
- CN202410624437.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-09-03
AI Technical Summary
Existing pre-training models have problems in text summary generation, such as long extraction time and inconsistency between summary content and sentence key information, making it difficult to achieve efficient and accurate extraction in long text summary tasks.
By randomly extracting text sentences for preprocessing and topic classification, the BERT pre-trained language model is used to determine the topic category, generate a target task sequence, and input it into the pre-trained summary extraction model for training to generate text summaries, combining distribution strategies and weighted attention. mechanism to optimize summary generation strategies to improve efficiency and accuracy.
The summary generation steps are simplified, the efficiency and accuracy of text summary generation are improved, and the accurate extraction and generation efficiency of summary information are ensured.
Smart Images

Figure CN118585641A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a text summary generation method based on a pre-training model. Background Art
[0002] The current methods of generating text summaries are mainly divided into extractive and distributed methods. The extractive method mainly selects several parts from the source sentence to form a summary. The extraction method is relatively simple, but it has the disadvantage of not being able to form paragraphs. The generative method uses a language model to generate text. The generated content is more vivid and the generated text is more like what people write. However, the language model will completely rely on the generative method, which will consume a large amount of training corpus and depend on the operating quality of the training equipment, which is time-consuming and labor-intensive.
[0003] With the rapid development of artificial intelligence and machine learning, the BERT pre-trained language model can be used as the basis for the automatic generation of text summaries, which can accurately understand natural language and further express human language, thereby realizing the generation of text characters. With the further development of deep learning, deep neural network models are applied to text summaries, and can learn text semantic information and map it to the same vector space for feature calculation, thereby greatly reducing the reliance of summary models on manually designed text features.
[0004] However, the existing pre-trained models are prone to long summary extraction time during summary extraction or distribution processing, which is limited by the efficiency of text sentence recognition. In addition, the existing pre-trained models cannot be directly transplanted to long text summary tasks, and it is easy for the summary extraction content to be seriously inconsistent with the actual key information of the sentence. This paper designs and analyzes the advantages of pre-trained language models in text summary generation and the potential of adaptive multi-objective reinforcement learning in optimizing generation strategies. Summary of the invention
[0005] The purpose of the present invention is to provide a text summary generation method based on a pre-trained model to solve the following technical problems:
[0006] How to improve the efficiency of short-time text summary generation and achieve accurate extraction of text summary information.
[0007] The purpose of the present invention can be achieved through the following technical solutions:
[0008] A method for generating a text summary based on a pre-trained model, the method comprising:
[0009] S1, randomly extracting sentences from the text of the preset interval database for preprocessing;
[0010] S2. Obtain the preprocessed sentence type and input it into the preset BERT pre-trained language model for training, and perform topic classification on the sentence to determine the topic category;
[0011] S3, taking the sentences of the same topic after classification as a topic set, counting the matches of multiple topic sets to generate multiple target task sequences and marking them as X;
[0012] S4. Set the summary generation strategy to input the labeled target task sequence X into the pre-trained summary extraction model for training output and generate the target text summary.
[0013] Preferably, the method for subject classification of sentences by the BERT pre-trained language model is specifically as follows:
[0014] Split the sentences in the text to obtain a set A of n sentences;
[0015] Perform word segmentation on each sentence in set A to obtain a set B consisting of m words in n sentences {N 1 , ..., N m};
[0016] Model training is performed on different words in different sentences in set B to output distribution vectors of different sentences.
[0017] Preferably, it also includes:
[0018] By setting the distribution strategy, we analyze the topic probability distribution of the distribution vector and determine whether it falls within the preset topic probability threshold range:
[0019] If so, it is determined to be consistent with the topic and the current topic distribution vector is obtained;
[0020] If not, it is judged as not in line with the topic, and a weighted attention mechanism based on the preset topic vector is added.
[0021] Preferably, the distribution strategy includes:
[0022] Input the distribution vector and position encoding vector into the encoder of the pre-trained Transformer for normalization training and output prediction value D;
[0023] Design a topic encoder based on the predicted value D, input the media user summary keywords crawled and parsed by the crawler as the topic vector training set, and input the topic encoder for training to output the topic probability coefficient;
[0024] The distribution vector and topic probability coefficient are input into the topic encoder as a validation set to verify the output topic probability distribution coefficient.
[0025] Preferably, the summary generation strategy includes:
[0026] Set the target task sequence X = {x 1 , x 2 , ..., x n} Input into the task encoder for encoding to obtain the target task vector;
[0027] Input the target task vector into the recurrent neural network model for decoding;
[0028] The topic distribution vector and the decoded target task vector are input into the current recurrent neural network, and the decoded target text summary is obtained cyclically.
[0029] Preferably, the summary generation strategy is also dynamically adjusted:
[0030] Construct an evaluation index system to obtain standard quality evaluation parameter thresholds;
[0031] Determine the relevance between the reference summary and the sentence based on the sentence probabilities output by the network:
[0032] Select the sentences with greater correlation with the documents as the learning parameter input of the pre-trained summary extraction model, and evaluate the parameter results based on the quality of their output;
[0033] The quality evaluation parameters that meet the standard quality evaluation parameter threshold range are input to update the pre-trained summary extraction model.
[0034] Preferably, the updated summary extraction model further includes a visualization function, allowing visualization of the prediction of the abstract feature decomposition by position features, significance and novelty.
[0035] Beneficial effects of the present invention:
[0036] (1) The present invention determines the topic category classification by inputting sentence types into a preset BERT pre-trained language model for training, and regards the sentences of the same topic after classification as a topic set, and statistically matches multiple topic sets to generate multiple target task sequences and mark them as X; by marking multiple topic sets, the influence of the length of multi-topic sentences on the calculation accuracy of the preset preprocessing model is eliminated, and they are presented in the form of a digital sequence, thereby simplifying the summary generation step and improving the summary generation efficiency.
[0037] (2) The present invention inputs the labeled target task sequence X into the pre-trained summary extraction model for training output, and uses the summary generation strategy to directly quickly locate and decode the decoded target task vector and the topic distribution vector to generate the final target text summary, and finally completes the automatic generation process of the text summary, thereby greatly improving the decoding efficiency and accuracy; simplifying the generation steps of the text summary, and improving the accuracy of the text summary generation.
[0038] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0040] Figure 1 This is a step diagram of a method for generating a text summary based on a pre-trained model according to the present invention. DETAILED DESCRIPTION
[0041] 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.
[0042] See also Figure 1 As shown, the present invention is a method for generating a text summary based on a pre-training model, and the method includes:
[0043] S1, randomly extracting sentences from the text of the preset interval database for preprocessing;
[0044] S2. Obtain the preprocessed sentence type and input it into the preset BERT pre-trained language model for training, and perform topic classification on the sentence to determine the topic category;
[0045] S3, taking the sentences of the same topic after classification as a topic set, counting the matches of multiple topic sets to generate multiple target task sequences and marking them as X;
[0046] S4. Set the summary generation strategy to input the labeled target task sequence X into the pre-trained summary extraction model for training output and generate the target text summary.
[0047] Through the above technical scheme, this embodiment realizes accurate extraction of text summary information, and sets a text summary generation method based on a pre-trained model by intelligent optimization based on a pre-trained language model and combined with an extractive summary generation method. The specific method is as follows: first, randomly extract sentences from the text of a preset interval database for pre-processing, where the preset interval is processed according to a limited range in actual operation to ensure that the amount of selected text data meets the current model processing needs; and the recognition of sentences in the text is based on punctuation marks "?.!" for division; data cleaning is performed on the text data, grammatical structures and conventional separation punctuation marks ",;,", etc. are deleted to achieve preliminary splitting processing of each sentence; and pre-training the language model on a large-scale corpus can enable the model to acquire powerful text representation capabilities, provide better model initialization, and accelerate the convergence of the model to the target task to avoid overfitting on small data.
[0048] Then, the preprocessed sentence types are obtained and input into the preset BERT pre-trained language model for training, and the sentences are subject-classified to determine the subject categories. Subject classification is to obtain the words most relevant to the current sentence distribution through text summary generation, and then determine the subject and divide the specific sentence subject categories.
[0049] Next, the sentences of the same topic category after classification are taken as a topic set, and multiple topic set matches are counted to generate multiple target task sequences and marked as X; because there are many sentences in a topic category and the diverse topic sets are difficult to be processed in a unified way, it is necessary to mark multiple topic sets to eliminate the influence of the length of multi-topic sentences on the calculation accuracy of the preset preprocessing model, and present them in the form of a digital sequence.
[0050] Finally, by setting the summary generation strategy, the labeled target task sequence X is input into the pre-trained summary extraction model for training output, and the final target text summary is generated, thus completing the automatic generation process of the text summary, simplifying the generation steps of the text summary, and improving the accuracy of the text summary generation.
[0051] Among them, the pre-trained summary extraction model uses the powerful representation learning ability of the pre-trained model to encode the document; the classification of sentences in the document is completed through different types of classification networks, and finally the summary is constructed for the selected combination.
[0052] As an embodiment of the present invention, the method for subject classification of sentences by the BERT pre-trained language model is specifically as follows:
[0053] Split the sentences in the text to obtain a set A of n sentences;
[0054] Perform word segmentation on each sentence in set A to obtain a set B consisting of m words in n sentences {N 1 , ..., N m};
[0055] Model training is performed on different words in different sentences in set B to output distribution vectors of different sentences.
[0056] Through the above technical solution, the method for subject classification of sentences by the BERT pre-trained language model in this embodiment is specifically as follows: first, the sentences in the text are split to obtain a set A of n sentences; then, each sentence in the set A is segmented to obtain a set B consisting of m words of each of the n sentences {N 1 , ..., N m}; Finally, the model is trained on different words in different sentences in set B to output the distribution vectors of different sentences.
[0057] In the process of identifying and training the number of words in each sentence in set B, the word features of each sentence are obtained, and this is achieved by repeating the previous steps to obtain all the word feature vectors, adding them up and taking the average, and obtaining the average vector of the entire text as the distribution vector; of course, the feature vector is determined based on the similarity of the feature words that meet the current settings.
[0058] In addition, different words of the same type in the text are distributed in different positions in sentences, resulting in different sentence similarities, which in turn leads to differences in sentences. Generally, the similarity between sentences involves the relationship between the text contexts. By analyzing the distribution vector, the theme of the entire article can also be reflected, thereby selecting words and short sentences that reflect the theme of the text to form a summary.
[0059] The type of the distribution vector is digital: Since computers cannot directly understand the text features of the input, when studying the generation of summaries, it is necessary to first semantically represent the input text, usually by converting the language text into a computable digital vector representation.
[0060] As an embodiment of the present invention, it also includes:
[0061] By setting the distribution strategy, we analyze the topic probability distribution of the distribution vector and determine whether it falls within the preset topic probability threshold range:
[0062] If so, it is determined to be consistent with the topic and the current topic distribution vector is obtained;
[0063] If not, it is judged as not in line with the topic, and a weighted attention mechanism based on the preset topic vector is added.
[0064] Through the above technical scheme, a distribution strategy is also set in this embodiment to reflect the size of the topic probability distribution of the distribution vector; since the relationship between a single digital type vector and the topic cannot be directly determined, the topic probability distribution size of the distribution vector is analyzed by setting a distribution strategy, and then it is determined whether its size falls within the preset topic probability threshold interval. If so, it is determined to be in line with the topic and the current topic distribution vector is obtained; if not, it is determined to be not in line with the topic, and a weighted attention mechanism based on the preset topic vector is added; the weighted attention mechanism in this embodiment is used to guide the decoder to generate a summary that falls within the topic probability threshold range; the topic encoder is integrated on the basis of the original document encoder, and the weighted attention mechanism is used to ensure that the word representation in the document sequence can be updated according to the document topic.
[0065] As an implementation mode of the present invention, the distribution strategy includes:
[0066] Input the distribution vector and position encoding vector into the encoder of the pre-trained Transformer for normalization training and output prediction value D;
[0067] Design a topic encoder based on the predicted value D, input the media user summary keywords crawled and parsed by the crawler as the topic vector training set, and input the topic encoder for training to output the topic probability coefficient;
[0068] The distribution vector and topic probability coefficient are input into the topic encoder as a validation set to verify the output topic probability distribution coefficient.
[0069] Through the above technical scheme, the distribution strategy in this embodiment obtains the topic probability size of the distribution vector in the following manner: first, the distribution vector and the position encoding vector are input into the encoder of the pre-trained Transformer for normalized training to output the predicted value D; then, the topic encoder is designed according to the predicted value D, and the media user summary keywords crawled and parsed by the crawler are input as the topic vector training set and input into the topic encoder for training to output the topic probability coefficient; finally, the distribution vector and the topic probability coefficient are input into the topic encoder as the verification set for verification to output the topic probability distribution coefficient.
[0070] Among them, Transformer is based on the self-attention mechanism. By capturing the internal relationships of sentences, it enables the pre-trained model to generate coherent text sentences. The self-attention mechanism can be calculated in parallel, which greatly improves the computational efficiency of the pre-trained model. The maximum likelihood estimation is used as the loss function for back-propagation to update the various parameters in the model, so that the result is finally perfect.
[0071] Transformer is mainly composed of an encoder and a decoder. Under normal circumstances, the encoder is usually composed of 6 stacked encoding layers, and the encoding layer is composed of multiple layers of multi-head self-attention mechanisms and feedforward neural networks (FNNs). Residual connections are added to solve the problem of gradient disappearance or explosion during the training process, and the network convergence is accelerated through normalization operations; the multi-head self-attention mechanism is composed of multiple groups of self-attention mechanisms with different weights to prevent the self-attention mechanism from focusing too much on its own encoding, which in turn leads to insufficient learning.
[0072] As an implementation mode of the present invention, the summary generation strategy includes:
[0073] Set the target task sequence X = {x 1 , x 2 , ..., x n} Input into the task encoder for encoding to obtain the target task vector;
[0074] Input the target task vector into the recurrent neural network model for decoding;
[0075] The topic distribution vector and the decoded target task vector are input into the current recurrent neural network, and the decoded target text summary is obtained cyclically.
[0076] Through the above technical solution, the main content implementation steps of the summary generation strategy in this embodiment include: first, the target task sequence X = {x 1 , x 2 , ..., x n} is input into the task encoder for encoding to obtain the target task vector; then, the target task vector is input into the recurrent neural network model for decoding; finally, the topic distribution vector and the decoded target task vector are input into the current recurrent neural network to cyclically obtain the decoded target text summary; the summary generation strategy is used to directly locate and decode the decoded target task vector and topic distribution vector, which greatly improves the decoding efficiency and accuracy.
[0077] It should be noted that the network structure of the pre-trained summary extraction model in this embodiment is implemented based on the network structure of the summary extraction model of the hierarchical recurrent neural network (RNN); the task encoder here refers to the encoder of the pre-trained Transformer; and the decoding process is implemented by the decoder of the hierarchical recurrent neural network model.
[0078] As an implementation mode of the present invention, the summary generation strategy is also dynamically adjusted:
[0079] Construct an evaluation index system to obtain standard quality evaluation parameter thresholds;
[0080] Determine the relevance between the reference summary and the sentence based on the sentence probability output by the network;
[0081] Select the sentences with greater correlation with the documents as the learning parameter input of the pre-trained summary extraction model, and evaluate the parameter results based on the quality of their output;
[0082] The quality evaluation parameters that meet the standard quality evaluation parameter threshold range are input to update the pre-trained summary extraction model.
[0083] Through the above technical solution, the evaluation index Rouge in this embodiment is obtained by using a large number of validation sets and test sets of summaries, evaluating the summaries based on the co-occurrence information of n-grams in the summaries through an automatic summary evaluation method, and evaluating the quality of the summaries by calculating the recall rate of the n-grams; the Rouge index is composed of a series of evaluation methods, including Rouge-1, Rouge-2, Rouge-3, Rouge-4, Rouge-L and Rouge-Skipped-N-Gram.
[0084] In this embodiment, the process of dynamically adjusting the summary generation strategy is to use the mechanism of reinforcement learning. The summary extraction algorithm based on reinforcement learning is based on a general neural network and integrates training indicators (usually Rouge-related indicators in summary tasks) as reinforcement learning rewards through policy gradient (PolicyGradient) to achieve global optimization. Specifically, first, a standard quality evaluation parameter threshold is obtained by constructing an evaluation indicator system. Then, the correlation between the reference summary and the sentence is determined according to the sentence probability output by the network. Then, the sentences with greater correlation with the document are selected as the learning parameter input of the pre-trained summary extraction model, and the quality evaluation parameter results are output according to them. Finally, the quality evaluation parameter input that meets the standard quality evaluation parameter threshold range is used to implement the update of the pre-trained summary extraction model.
[0085] The summary extraction model can dynamically adjust the reward mechanism indicators according to environmental feedback, that is, the relationship between the generated summary and the source text and its quality evaluation index parameters, so as to optimize the current model. On the one hand, it can directly optimize the evaluation index instead of maximizing the likelihood of the ground-truth label; on the other hand, it can enable the model to better distinguish sentences. That is, if a sentence appears more frequently in high-scoring summaries, the sentence will be ranked higher.
[0086] As an embodiment of the present invention, the updated summary extraction model also includes a visualization function, allowing visualization of the prediction of abstract feature decomposition by position features, significance and novelty.
[0087] Through the above technical solution, the abstract vector feature summary extraction can be analyzed and predicted intuitively by visually presenting images and charts, thereby improving the generation efficiency of the summary extraction operation.
[0088] The above contents are merely examples and explanations of the concept of the present invention. The technicians in this technical field may make various modifications or additions to the specific embodiments described or replace them in a similar manner. As long as they do not deviate from the concept of the invention or exceed the scope defined by the claims, they should all fall within the protection scope of the present invention.
Claims
1. A text summary generation method based on a pre-trained model, characterized in that: The method comprises: S1, randomly extracting sentences from the text of the preset interval database for preprocessing; S2. Obtain the preprocessed sentence type and input it into the preset BERT pre-trained language model for training, and perform topic classification on the sentence to determine the topic category; S3, taking the sentences of the same topic after classification as a topic set, counting the matches of multiple topic sets to generate multiple target task sequences and marking them as X; S4. Set the summary generation strategy to input the labeled target task sequence X into the pre-trained summary extraction model for training output and generate the target text summary.
2. According to the method for generating text summarization based on a pre-training model according to claim 1, it is characterized in that: The method for the BERT pre-trained language model to classify sentences by topic is specifically as follows: Split the sentences in the text to obtain a set A of n sentences; Perform word segmentation on each sentence in set A to obtain a set B consisting of m words in n sentences {N1,...,N m }; Model training is performed on different words in different sentences in set B to output distribution vectors of different sentences.
3. The method for generating a text summary based on a pre-training model according to claim 2, characterized in that: Also includes: By setting the distribution strategy, we analyze the topic probability distribution of the distribution vector and determine whether it falls within the preset topic probability threshold range: If so, it is determined to be consistent with the topic and the current topic distribution vector is obtained; If not, it is judged as not in line with the topic, and a weighted attention mechanism based on the preset topic vector is added.
4. The method for generating a text summary based on a pre-training model according to claim 3, characterized in that: The distribution strategy includes: Input the distribution vector and position encoding vector into the encoder of the pre-trained Transformer for normalization training and output prediction value D; Design a topic encoder based on the predicted value D, input the media user summary keywords crawled and parsed by the crawler as the topic vector training set, and input the topic encoder for training to output the topic probability coefficient; The distribution vector and topic probability coefficient are input into the topic encoder as a validation set to verify the output topic probability distribution coefficient.
5. The method for generating a text summary based on a pre-training model according to claim 1, characterized in that: The summary generation strategy includes: The target task sequence X = {x1, x2, ..., x n } Input into the task encoder for encoding to obtain the target task vector; Input the target task vector into the recurrent neural network model for decoding; The topic distribution vector and the decoded target task vector are input into the current recurrent neural network, and the decoded target text summary is obtained cyclically.
6. The method for generating a text summary based on a pre-training model according to claim 5, characterized in that: It also includes dynamic adjustment of summary generation strategy: Construct an evaluation index system to obtain standard quality evaluation parameter thresholds; Determine the relevance between the reference summary and the sentence based on the sentence probabilities output by the network: Select the sentences with greater correlation with the documents as the learning parameter input of the pre-trained summary extraction model, and evaluate the parameter results based on the quality of their output; The quality evaluation parameters that meet the standard quality evaluation parameter threshold range are input to update the pre-trained summary extraction model.
7. The method for generating a text summary based on a pre-training model according to claim 6, characterized in that: The updated abstraction model also includes visualization capabilities that allow visualization of predictions broken down by abstract features, position features, saliency, and novelty.
Citation Information
Cited By
Automatic text summarization method and system oriented to online psychological support
CN118939796A
Watermark generation method and system based on large language model
CN119577707A
