A method and system for generating original text summaries based on a given problem
By calculating the similarity between the original text and the given question and dividing the text into blocks, and combining the cross-attention weight matrix to generate a summary, the problem of low summary accuracy in the prior art is solved, and more accurate summary generation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-25
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies cannot accurately extract information from lengthy texts based on a given question when generating conference text summaries, resulting in low similarity between the summary and the question. Furthermore, the length limitations of pre-trained language models and the dilution of information by lengthy texts also contribute to the problem.
By calculating the similarity between each sentence in the original text and the given question, the text is divided into multiple text blocks, and sentence similarity and word granularity cross-attention weight matrices are incorporated into the summary generation model to generate more accurate summaries.
The generated summary better considers the global information of the original text, avoids information dilution, and improves the accuracy and coverage of the summary.
Smart Images

Figure CN116521854B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of abstract generation technology, and more specifically, to a method and system for generating original text summaries based on a given question. Background Technology
[0002] The transcripts of long meetings are often quite lengthy, making it very difficult for users to find the information they need in the original meeting transcript.
[0003] In existing technologies, the techniques for generating summaries from original conference texts in response to user-provided questions typically fall into two categories:
[0004] (1) Two-stage summary generation technology:
[0005] This technology involves an extractor and a generator. The extractor finds relevant parts of the text based on the user's question and sends them to the generator, which generates a summary based on the text blocks input by the extractor. However, the generator cannot obtain the text information filtered out by the extractor, so the accuracy of the generated summary is limited by the performance of the extractor. In practice, this can lead to information omissions and inconvenience.
[0006] (2) End-to-end generation technology:
[0007] This technique involves inputting a given question and text into a pre-trained natural language generation model, which then uses an attention mechanism to generate the text containing the user's question. However, because pre-trained language models have length limitations, excessively long texts cannot be input. Furthermore, if the input text is too lengthy and contains too many words, the effective information is diluted, and word-level co-occurrence relationships do not encompass the complete semantics of the entire sentence. Word-level attention mechanisms alone struggle to focus on the question-relevant parts of the original text, leading to poor extraction results.
[0008] Therefore, it is evident that in existing technologies, when extracting information from lengthy texts based on a given question to generate a summary, it is impossible to accurately generate a summary that is highly similar to the given question, resulting in a very inaccurate summary. Summary of the Invention
[0009] The summary section of this application is intended to provide a brief overview of the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.
[0010] As a first aspect of this application, in order to address the technical problems mentioned in the background section above, some embodiments of this application provide a method for generating original text summaries based on a given problem, including:
[0011] Step 1: Extract each sentence t from the original text U. i The given question q is sequentially input into the sentence similarity processing model to calculate the similarity t of each sentence in the original text U. i Similarity to a given problem q;
[0012] Step 2: Divide the original text U into multiple text blocks u1, u2, u3...u m ;
[0013] Step 3: Create all text blocks u1, u2, u3...u m The text is sequentially input into the encoder of the summary generation model for encoding, and all text blocks u1, u2, u3...u are encoded. m All the codes are concatenated to generate concatenated codes;
[0014] Step 4: Input the similarity calculated in Step 1 and the concatenation encoding into the decoder of the summary generation model. The decoder generates the probability of generating the next word in the summary. Then, according to the beam search algorithm, multiple candidate words are generated and retained at each step to generate multiple candidate summaries. Finally, the summary with the highest probability is selected from them.
[0015] This application calculates the similarity between each sentence in the original text and the given question, and incorporates this similarity into the summarization generation model. Therefore, the summarization generation model can filter and process information from the original text based on similarity during the summarization process, resulting in a more accurate summary. Compared to two-stage solutions, this approach uses a sentence similarity calculation model, calculating the similarity between each sentence and the given question without filtering sentences. This allows for full consideration of all content in the original text during summarization. Compared to end-to-end solutions, because the similarity between sentences and the given question is input, the summary generation process considers the overall problem, avoiding the problem of overly lengthy original text diluting effective information. Furthermore, this application segments lengthy original text into multiple text blocks before inputting them into the summarization generation model, giving the model a longer receptive field.
[0016] Furthermore, step 4 includes:
[0017] The decoder calculates the word-granularity cross-attention weight matrix between the original text and the generated summary;
[0018] The decoder computes the question-sentence cross-attention weight matrix between the original text U and the given question q;
[0019] The decoder calculates the joint attention weight matrix based on the word-level cross-attention weight matrix and the question-sentence cross-attention weight matrix;
[0020] The decoder generates the probability of generating the next word in the summary based on the joint attention weight matrix.
[0021] The word-granular cross-attention weight matrix is generated by the self-learned attention between the original text U and the generated summary. Therefore, the word-granular cross-attention weight matrix can take into account the interaction between the generated summary and the original text. Then, the question-sentence cross-attention weight matrix and the word-granular cross-attention weight are weighted and summed to ensure that the generated summary fully considers the generated summary, the original text, and the similarity between the given question and the original text.
[0022] Furthermore, the decoder calculates the word-granularity cross-attention weight matrix of the original text U and the generated summary by inputting the concatenated encoding and the first k-1 words of the currently generated summary into the decoder to generate the word-granularity cross-attention weight matrix.
[0023] Furthermore, in step 1: given the question q and each sentence t in the original text U. i The data is input into a sentence similarity processing model to obtain the t of each sentence. i The similarity s between the problem and the given problem q i , Where e q and Given a question q and a sentence t, respectively. i The vector representation obtained through SBERT. The sentence similarity processing model S is used to calculate similarity, so the sentence similarity input to the summarization generation model is calculated by an external module, reducing the processing load of the summarization generation model and improving the accuracy of the summarization.
[0024] Furthermore, the calculation of the problem-sentence cross-attention weight matrix includes:
[0025] The decoder decodes each sentence t in the original text U. i Similarity s to a given question q i Determine each text block u i The similarity of each word in the text block u to a given question q is calculated, and the text block u is then divided into blocks. i The similarity scores of each word in the text are concatenated with the similarity scores of the given question q to obtain each text block u. i The similarity vector g with a given question q i ;
[0026] Each text block u i The obtained length is g iThe vectors are concatenated to obtain a vector of length l, which is the sum of the number of words in the original text U. src ;
[0027] With length l src vector repetition l tgt This leads to the question-sentence cross-attention weight matrix; where l tgt This represents the number of words for which a summary has been generated so far.
[0028] Expanding similarity in this way allows the question-sentence cross-attention weights and word-level cross-attention weights to be aligned, so that different words in the same sentence have the same question-sentence cross-attention weights, but different word-level cross-attention weights. This can better combine locality and globality, and improve the accuracy of generating summaries based on questions.
[0029] Furthermore, in step 4:
[0030] The word-granularity cross-attention weight matrix and the question-sentence cross-attention weight matrix are weighted and summed to obtain a joint attention weight matrix that considers both word granularity and question-sentence relationship.
[0031] Furthermore, in step 2: the original text is divided into blocks so that adjacent text blocks u i with u i+1 The overlap is 50%. The overlapping parts between text blocks can increase the decoder's ability to focus on the entire original text. Therefore, it can extend the attention of the summarization model from local text to the whole text, enabling the summarization model to understand the interaction relationships between contexts.
[0032] As a second aspect of this application, in order to address the technical problems mentioned in the background section above, some embodiments of this application provide a system for generating original text summaries based on a given problem, including:
[0033] The segmentation module is used to divide the original text U into multiple text blocks u1, u2, u3...u m ;
[0034] The sentence similarity calculation module is used to calculate the similarity between each sentence in the original text U and a given question q;
[0035] Summary generation module: Based on the input text block u i Calculate the similarity between all sentences in the original text U and the given question q, and calculate the question-sentence cross-attention weight matrix and the word-granularity cross-attention weight matrix. Calculate the joint attention weight based on the question-sentence cross-attention weight matrix and the word-granularity cross-attention weight matrix, and generate the words for constructing the summary in sequence according to the joint attention weight.
[0036] The beneficial effect of this application is that it provides a method and system for generating original text summaries based on a given question with high similarity between the generated summary and the question. Attached Figure Description
[0037] The accompanying drawings, which form part of this application, are used to provide a further understanding of the application and to make other features, objects, and advantages of the application more apparent. The illustrative embodiments and descriptions of this application are used to explain the application and do not constitute an undue limitation of the application.
[0038] Furthermore, throughout the accompanying drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the elements are not necessarily drawn to scale.
[0039] In the attached diagram:
[0040] Figure 1 A flowchart illustrating a method for generating original text summaries based on a given question;
[0041] Figure 2 This is a flowchart illustrating the calculation of the similarity between sentences in the original text and a given question.
[0042] Figure 3 A model diagram for calculating the similarity between sentences in the original text and a given question;
[0043] Figure 4 A flowchart for generating candidate summaries based on the similarity between sentences in a given question and the original text;
[0044] Figure 5 The flowchart for generating the word-granular cross-attention matrix;
[0045] Figure 6 For existing Transformer-based decoders, please refer to the literature "Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need[J]. Advances in neural information processing systems, 2017, 30."
[0046] Figure 7 This is the improved Transformer-based decoder described in this application;
[0047] Figure 8 A structural diagram of a system for generating original text summaries based on a given question. Detailed Implementation
[0048] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0049] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.
[0050] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0051] Methods for generating original text summaries based on a given question, see [link to relevant documentation]. Figure 1 As shown, the specific steps include the following:
[0052] Step 100: Extract each sentence t from the original text U. i The given question q is sequentially input into the sentence similarity processing model to calculate the similarity t of each sentence in the original text U. i The similarity to a given problem q.
[0053] See Figures 2-3 As shown, the calculation of similarity specifically includes:
[0054] Step 101: Divide the original text U into multiple individual sentences.
[0055] The original text U is divided into several sentences t1, t2, ..., where the i-th sentence is t1. i .
[0056] Step 102: Calculate the similarity between each individual sentence and the given question q using the sentence similarity processing model.
[0057] Given the question q and each sentence t in the original text U. i The data is input into a sentence similarity processing model to obtain the t of each sentence. i The similarity s between the problem and the given problem q i , Where e q and Given a question q and a sentence t, respectively. i The vector representation obtained through SBERT.
[0058] The sentence similarity processing model SBERT uses a pre-trained BERT at the bottom layer and an average pooling layer at the top layer. The model is pre-trained using the supervised NLI (Natural Language Inference) dataset. Therefore, the language pre-trained model can determine whether two sentences are semantically consistent, contradictory, or unrelated, and provide corresponding values based on similarity.
[0059] For details on calculating the similarity between two sentences in this application, please refer to the literature Reimers N, Gurevych I. Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks[J]. In this way, the similarity between two sentences can be represented by vectors.
[0060] Step 200: Divide the original text U into multiple text blocks.
[0061] The original text U is divided into multiple text blocks u1, u2, u3...u m So that adjacent text blocks u i with u i+1 50% overlap.
[0062] The original text U is divided into text blocks u1, u2, u3...u according to a fixed size. m Where the i-th text block is text block u i When segmenting the original text U, it is necessary to ensure that adjacent text blocks u are... i and text block u i-1 There are overlapping parts, with the overlapping portion being 50%. For example, text block u. i If the number of words in the text block is 512, then the text block u i The first 256 words and text blocks u i-1 The last 256 words overlap and belong to the same part.
[0063] Step 300: Create all text blocks u1, u2, u3...u m The text is sequentially input into the encoder of the summary generation model for encoding, and all text blocks u1, u2, u3...u are encoded. m All the codes are concatenated to generate concatenated codes.
[0064] Step 400: Input the similarity calculated in step 100 and the concatenation encoding into the decoder of the summary generation model. The decoder generates the generation probability of the next word in the summary. Then, according to the beam search algorithm, multiple candidate words are generated and retained at each step to generate multiple candidate summaries. Finally, the summary with the highest probability is selected from them.
[0065] The input to a summarization model is often limited by the text size. For lengthy texts, it's impossible to directly use a summarization model to process the original text U. This application addresses this by dividing the original text U into multiple text blocks u1, u2, u3…u m This allows the original text U to be segmented and encoded uniformly, ensuring that the generated summary generation model can process all texts. Furthermore, this segmented encoding and uniform decoding approach also gives the summary generation model a longer receptive field, enabling it to consider a wider range of sentences when generating text.
[0066] Meanwhile, the computational cost and memory requirements of the attention mechanism within the summary generation model increase quadratically with the input length. Therefore, simply using segmented encoding and unified decoding still has limitations regarding the length of the original text. To address this, when dividing the text into blocks u1, u2, u3…u… m At that time, let the adjacent text block u i with u i+1 There is a 50% overlap between them, which allows the summarization model to extend its attention from local text to the entire text, enabling it to understand the interaction between contexts and thus solving the problem of the original text being limited in length.
[0067] Step 400 includes the following.
[0068] The decoder calculates the word-granularity cross-attention weight matrix between the original text and the generated summary.
[0069] The decoder computes the question-sentence cross-attention weight matrix between the original text U and the given question q.
[0070] The decoder calculates the joint attention weight matrix based on the word-granularity cross-attention weight matrix and the question-sentence cross-attention weight matrix.
[0071] The decoder generates the probability of generating the next word in the summary based on the joint attention weight matrix.
[0072] Thus, step 400 includes the following steps, see reference. Figure 4 , Figure 4 The specific steps of step 400 are shown.
[0073] Step 401: Calculate the word-granularity cross-attention weight matrix and the question-sentence cross-attention weight matrix, see [link / reference]. Figure 5 As shown, the specific calculation of the word-granularity cross-attention weight matrix includes:
[0074] Step 401a: Calculate the word-granularity cross-attention weight matrix.
[0075] The decoder takes the concatenated encoding and the first k-1 words of the currently generated summary as input to generate a word-granular cross-attention weight matrix.
[0076] Specifically, it includes:
[0077] The decoder's self-attention generation layer learns the first k-1 words of the generated summary to obtain self-attention weights. The decoder inputs the self-attention weights into the decoder's feedforward / normalization layer for processing to obtain a hidden state containing the self-attention of the generated summary. This hidden state is then input into the decoder's cross-attention layer.
[0078] At the same time, all text blocks u1, u2, u3...u m The encoded data input to the encoder is concatenated and then fed into the cross-attention layer of the decoder, containing all text blocks u1, u2, u3...u m The hidden state of the information is also input into the cross-attention layer of the decoder; thus, the cross-attention layer generates a word-granular cross-attention weight matrix based on the hidden state of the generated summary self-attention and the hidden state of the original text information.
[0079] Here, k is a positive integer greater than 1. The larger the value of k, the larger the range of already generated summaries needs to be considered when generating summaries. Conversely, the smaller the value of k, the fewer summary words are injected into the cross-attention layer, and the smaller the range of already generated summaries needs to be considered when generating the latest summaries.
[0080] For example, if k is equal to 5, and the current summary has already generated 4 words, then self-attention among these 4 generated words needs to be considered when generating the summary.
[0081] Step 401b: The decoder calculates the question-sentence cross-attention weight matrix for the similarity between a given question q and the original text U, including:
[0082] The decoder decodes each sentence t in the original text U. i Similarity s to a given question q i Determine each text block u i The similarity of each word in the text block u to a given question q is calculated, and the text block u is then divided into blocks. i The similarity scores of each word in the text are concatenated with the similarity scores of the given question q to obtain each text block u. i The similarity vector g with a given question q i .
[0083] For text block u i The word at position j in the middle ij Both can be found in the original text U, and the word u can be found in the original text U. ijThe sentence t i The corresponding word, therefore, for text block u i The word at position j in the middle ij The similarity s with the given question q is i ;Transfer text block u i The similarity s between each word and a given question q i Concatenate them together to make the text block u i Expanding it according to the number of its words into a length of g i A vector of length g. i The length of the vector is the length of the text block u. i The number of words within the vector represents the similarity between the sentence to which the word at this position in the block belongs and the given question q. Words belonging to the same block and the same sentence have the same value.
[0084] For each text block u i All of these can yield the length g mentioned above. i The vector, which represents all text blocks u1, u2, u3...u m The obtained length is g i The vectors are concatenated to obtain a vector of length l, which is the sum of the number of words in all text blocks. src .
[0085] Repeat the above-obtained vector l tgt Next, to obtain a shape of l tgt *l src Matrix A qu This matrix is the question-sentence cross-attention weight matrix; where l tgt This represents the number of words for which a summary has been generated so far.
[0086] Because of the same sentence t i Within the sentence level, the similarity between each word and a given question q is consistent; therefore, for text block u... i In other words, text block u i Each word in the text block U can be found at a corresponding position in the original text U. For example, text block U... i The word at position j in the middle ij , if u ij The sentence in the original text U is t i Then it is possible to find the sentence t in the original text U. i Find the word that corresponds to this word. And the word u ij The similarity between s and a given problem q is s i .
[0087] Therefore we can obtain the text block u iThe similarity of each word in the text block u to a given question q is calculated, and then the text block u is processed. i Expanding the block based on the number of words in it yields a length of g. i The vector.
[0088] Finally, put all the text blocks u i The resulting vector g i Concatenate them into a single block of text with a length equal to the total number of words in the block. src The vector represents the similarity between each word in all text blocks and the sentence granularity of the question. Then l src Repeat l tgt After this, the shape obtained is l tgt *l src The question-sentence cross-attention weights have the same size as the word-granularity cross-attention weight matrix. Where, l tgt This represents the length of the currently generated summary.
[0089] Thus, after expanding the similarity between the given question q and each sentence in the original text U in the above manner, we can obtain a question-sentence cross-attention weight matrix that can be aligned with the word-granular attention weights, which facilitates the subsequent weighted summation of these two matrices.
[0090] Step 402: Calculate the joint attention weight matrix;
[0091] The word-granularity cross-attention weight matrix and the question-sentence cross-attention weight matrix are weighted and summed to obtain a joint attention weight matrix that considers both word granularity and question-sentence relationship.
[0092] Specifically, let the word-granularity cross-attention weight matrix be A. att The question-sentence cross-attention weight matrix is A. qu The joint attention weight matrix is A mix A mix =(1-α)A att +αA qu .
[0093] Step 403: Calculate the probability of generating the next word in the summary.
[0094] The decoder inputs the joint attention weights into the feedforward layer and the normalization layer for linear processing, and then inputs them into the softmax layer to obtain a probability of generating the k-th word (the k-th word is the probability of each word in the vocabulary), and determines the word generated in this step based on this probability.
[0095] Step 404: Generate candidate summaries.
[0096] The decoder obtains the probability of each word in the generated summary based on the joint attention weights, then uses the beamsearch strategy to generate multiple candidate summaries, and selects the summary with the highest generation probability as the final result.
[0097] Specifically, during decoding, the decoder uses the joint attention weights. After normalizing the joint attention weights, it multiplies them by a value vector and passes them through a feedforward layer and a normalization layer. This process is repeated 12 times, with each layer following the same architecture. Finally, a softmax layer is used to obtain the probability of generating each word. Then, a beam search strategy is employed to generate multiple candidate summaries, and the summary with the highest generation probability is selected as the final result.
[0098] refer to Figures 6-7 The decoder used in this application is based on the existing Transformer decoder, and after the similarity is extended, it is incorporated into the summary generation model. Therefore, the specific methods of how to use the joint weight matrix to generate the generation probability of candidate words and how to process the generated summary into a word-granular cross-attention weight matrix are not disclosed.
[0099] Figure 8 A schematic diagram of the system architecture for generating original text summaries based on a given question is provided.
[0100] refer to Figure 8 Systems that generate original text summaries based on a given question include:
[0101] The segmentation module is used to divide the original text U into multiple text blocks u1, u2, u3...u m .
[0102] The segmentation module can divide the original text U into text blocks u1, u2, u3...u according to a fixed size. m Where the i-th text block is text block u i .
[0103] The sentence similarity calculation module is used to calculate the similarity between each sentence in the text block and a given question q.
[0104] Summary generation module: Based on the input text block u i and text block u i Calculate the similarity between all sentences in the text and the given question q, and then calculate the question-sentence cross-attention weight matrix and the word-granularity cross-attention weight matrix.
[0105] The joint attention weights are calculated based on the question-sentence cross-attention weight matrix and the word-granularity cross-attention weight matrix, and the words for constructing the summary are generated sequentially based on the joint attention weights.
[0106] The summary generation module includes an encoder and a decoder;
[0107] The encoder receives all text blocks u1, u2, u3...u from the segmentation module. m And encode it; and assign all text blocks u1, u2, u3...u m The encodings of the text blocks are concatenated together to obtain the encoding of the concatenated text blocks; the encoding of the concatenated text blocks and the first k-1 words of the currently generated summary are input into the decoder, and the cross-attention layer of the decoder will generate a word-granular cross-attention weight matrix; the encoding of all the text blocks concatenated together is processed to obtain the word-granular cross-attention weights.
[0108] All text blocks u1, u2, u3...u m The text blocks u1, u2, u3...u are input sequentially into the encoder for encoding, and then all text blocks u1, u2, u3...u are encoded. m The encoded results are concatenated together and input into the decoder, entering the cross-attention layer. The decoder's self-attention generation layer learns the first K-1 words of the generated summary to obtain self-attention weights. The decoder processes the self-attention weights in the decoder's feedforward / normalization layer and inputs them into the decoder's cross-attention layer. The decoder obtains word-granular cross-attention weights in the cross-attention layer.
[0109] text block u i The similarity score to a given question q is directly input into the decoder. After dimensionality expansion, the decoder's cross-attention layer obtains the question-sentence cross-attention weights. The method for dimensionality expansion can be found in methods for generating original text summaries based on a given question.
[0110] The decoder calculates a joint attention weight by weighting the word-level cross-attention weights and the question-sentence cross-attention weights. Based on the joint attention weights, the decoder uses a beam search decoding strategy to decode multiple candidate summaries and selects the summary with the highest generation probability as the final result.
[0111] In the process of generating the summary, this invention considers the similarity between different sentences in the given question q and the original text U, as well as the similarity between the original text U and the generated summary, and constructs a multi-granularity cross-attention model. Therefore, in the process of generating the summary, it can generate a text summary that is more relevant to the given question q.
[0112] In the process of generating the summary, segmented encoding and centralized decoding are used to avoid the problem that the original text U is too long to be input into the processing model.
[0113] The following example is based on the original text U and the given question q:
[0114] The following is the original text U:
[0115] Project Manager: Today's meeting is mainly to discuss the new product that our department will be starting to develop. We hope everyone can brainstorm and talk about the progress in various aspects, such as functional design, appearance design, and product marketing.
[0116] ······
[0117] Project Manager: Next, let's talk about the product's appearance design. What are everyone's thoughts?
[0118] Product Design Department: I prefer to make the voice function button more prominent to highlight the difference between our product and others.
[0119] The overall appearance of the remote control should ideally follow current popular design trends, with a more user-friendly button layout.
[0120] Technical Department: I believe that integrating the voice module button into the remote control is essential, as it highlights the difference and innovation between our product and others.
[0121] Market research department: Market analysis reports show that most users are more interested in functionality than appearance, and users' specific preferences change frequently with trends. If we have to keep up with the latest trends, it will lead to increased costs due to continuous iteration.
[0122] ······
[0123] Project Manager: Okay, we will carefully evaluate the opinions of each department to design our new product. Thank you for the discussion, meeting adjourned.
[0124] The following is a given question q:
[0125] What are the market research department's opinions on the product's appearance design?
[0126] The following method describes how to generate a summary of the original text U based on a given question q. The steps for generating the summary are as follows:
[0127] Step 1: Extract each sentence t from the original text U. i Given a question q, input it into the sentence similarity processing model to calculate the similarity t of each sentence in the original text U. i The similarity to a given problem q.
[0128] Step 2: Divide the original text U into multiple text blocks u i Each text block is 512 words in size, and each adjacent text block u i It has a 50% overlap, as detailed below:
[0129] Text block u1: Words 1-512 in the original text
[0130] Text block u2: Words 257-768 in the original text
[0131] Text block u3: Words 513-1024 in the original text
[0132] ...
[0133] And so on.
[0134] Step 3: Input the above-described text blocks into the encoder of the summary generation model for encoding; then concatenate the encoded results obtained by the encoder and input them into the decoder of the summary generation model.
[0135] Steps 3-4: For text block u i Its internal contents are:
[0136] ······
[0137] Project Manager: Next, let's talk about the product's appearance design. What are everyone's thoughts?
[0138] Product Design Department: I prefer to make the voice function button more prominent to highlight the difference between our product and others.
[0139] The overall appearance of the remote control should ideally follow current popular design trends, with a more user-friendly button layout.
[0140] Technical Department: I believe that integrating the voice module button into the remote control is essential, as it highlights the difference and innovation between our product and others.
[0141] Market research department: Market analysis reports show that most users are more interested in functionality than appearance, and users' specific preferences change frequently with trends. If we have to keep up with the latest trends, it will lead to increased costs due to continuous iteration.
[0142] ······
[0143] The speakers of sentences j to j+3 are: project manager, product design department, technology department, and market research department, respectively.
[0144]
[0145]
[0146] With sentence u ijFor example, each word in this sentence can find its corresponding word in the corresponding sentence in the original text U, such as sentence u ij The second word "item" in it must be able to find the corresponding "item" word in the sentence of the original text U: "Project manager: Next, let's talk about the appearance design of the product. What do you all think?" So u ij The similarity between the second word "item" in it and the given question q is 0.841. And so on, for the text block u i The similarity of each word in it to the given question q can be determined by this method.
[0147] Among the four sentences listed above, these sentences contain 31, 80, 50, and 84 words respectively. Therefore, the similarity of each word in these sentences to the given question q is determined, and then after expanding these adjacent sentences, the following vectors can be obtained. According to this method, the vectors of all sentences in the text block u i After expansion, they are concatenated to obtain the text block concatenation vector.
[0148] In this way, for each text block u i We can all obtain this text block concatenation vector by the above method, and concatenate the text block concatenation vectors obtained from all text blocks in the way of the adjacent sentence vectors above. For example, for the text block u i And u i+1 , the obtained vector lengths are both 512. Concatenate them in the length direction to obtain a vector with a length of 1024, and concatenate the vectors obtained from all text blocks in the above way. Furthermore, a vector with a length equal to the sum of the lengths of all text blocks is obtained, and its length is l src .
[0149] When the length generated is 1 (each abstract starts after a special character, so it is at least 1), repeat the vector with the length of l src obtained above once in the vertical dimension to obtain a matrix with a shape of (1, l src ). When the length generated is 2, repeat the vector with the length of l src obtained above twice in the vertical dimension to obtain a matrix with a shape of (2, l src ). And so on, when generating the kth word, the length generated is k - 1. Repeat the vector with the length of l src obtained above k - 1 times in the vertical dimension to obtain a matrix with a shape of (k - 1, l src ). We call this matrix the question-sentence attention matrix.
[0150] Step 5: As Figure 7When generating the k-th word, the decoder processes the self-attention weights of the first k-1 words that have already generated the summary, and combines them with the concatenated text block u from the encoder input to the decoder. i The encoding is used to generate a word-granular cross-attention weight matrix, which has a shape of (k-1, l). src Step 4 yields the question-sentence attention matrix, which has the shape (k-1, l). src The joint attention weight matrix is obtained by weighted summing of the question-sentence cross-attention weight matrix and the word-granularity cross-attention matrix. Let A be the word-granularity cross-attention weight matrix. att The question-sentence cross-attention weight matrix is A. qu The joint attention weight matrix is A mix A mix =(1-α)A att +αA qu .
[0151] Step 6: As Figure 7 The joint attention weights obtained in step 5 are multiplied by a value vector from the encoder, and this value is then passed through a normalization layer, a feedforward layer, and another normalization layer before being input into the next layer of the decoder. The decoder has a total of 12 transformer layers. After passing through the last transformer layer, a linear layer and a softmax layer are used to obtain the probability of generating the k-th word. Then, multiple candidate words are generated and retained at each step according to the beam search algorithm, and finally, k candidate summaries are retained. The summary with the highest probability is selected from the finally generated candidate summaries.
[0152] The following are candidate abstracts:
[0153] 1. The market research department believes that specific dimensions are not important; users value functionality more than appearance, and any changes to the appearance will lead to increased costs.
[0154] 2. The market research department believes that the specific appearance is not important; users value functionality over appearance, and any changes to the appearance will increase costs.
[0155] 3. The market research department believes that appearance is not important; users prefer functionality, and changes to appearance will increase costs.
[0156] 4. The market research department believes that the specific shape is not important; users care more about functionality than appearance, and changes in appearance will lead to increased costs.
[0157] When obtaining the probability of words generated at each position, the beam search algorithm does not only select the word with the highest probability, but also retains the top k words with the highest probabilities, depending on the settings.
[0158] For example, when generating the third word, the probabilities of the two words "研" and "调" are very high. Therefore, both words are retained. Then, when these two characters are selected, the probability of the next word is recalculated. So, in the abstract generation sequence where "研" is selected, the next word is "究"; in the abstract generation sequence where "调" is selected, the next word is "研". And so on, k abstracts can be obtained.
[0159] The following is the abstract with the highest probability of generation:
[0160] The market research department believes that the specific shape is not important, and users care more about functions rather than appearance, and changes in appearance will lead to an increase in costs.
[0161] The above description is only some preferred embodiments of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) disclosed in the embodiments of the present disclosure that have similar functions.
Claims
1. A method for generating original text summaries based on a given question, characterized in that, include: Step 1: Extract each sentence t from the original text U. i The given question q is sequentially input into the sentence similarity processing model to calculate the similarity t of each sentence in the original text U. i Similarity to a given problem q; Step 2: Divide the original text U into multiple text blocks u1, u2, u3...u m ; Step 3: Create all text blocks u1, u2, u3...u m The text is sequentially input into the encoder of the summary generation model for encoding, and all text blocks u1, u2, u3...u are encoded. m All the codes are concatenated to generate concatenated codes; Step 4: Input the similarity calculated in Step 1 and the concatenation encoding into the decoder of the summary generation model. The decoder generates the probability of generating the next word in the summary. Then, according to the beam search algorithm, multiple candidate words are generated and retained at each step to generate multiple candidate summaries. Finally, the summary with the highest probability is selected from them. Step 4 includes: The decoder calculates the word-granularity cross-attention weight matrix between the original text U and the generated summary; The decoder computes the question-sentence cross-attention weight matrix between the original text U and the given question q; The decoder calculates the joint attention weight matrix based on the word-level cross-attention weight matrix and the question-sentence cross-attention weight matrix; The decoder generates the probability of generating the next word in the summary based on the joint attention weight matrix; The decoder calculates the word-granularity cross-attention weight matrix of the original text U and the generated summary by inputting the concatenated encoding and the first k-1 words of the currently generated summary into the decoder to generate the word-granularity cross-attention weight matrix. The calculation problem—the cross-attention weight matrix—includes: The decoder decodes each sentence t in the original text U. i Similarity s to a given question q i Determine each text block u i The similarity of each word in the text block u to a given question q is calculated, and the text block u is then divided into blocks. i The similarity scores of each word in the text are concatenated with the similarity scores of the given question q to obtain each text block u. i The similarity vector g with a given question q i ; Each text block u i The obtained length is g i The vectors are concatenated to obtain a vector of length l, which is the sum of the number of words in the original text U. src ; with a length of l src vector repetition l tgt This leads to the question-sentence cross-attention weight matrix; where l tgt This represents the number of words for which a summary has been generated so far.
2. The method for generating original text summaries based on a given question according to claim 1, characterized in that, In step 1: Given the question q and each sentence t in the original text U. i The data is input into a sentence similarity processing model to obtain the t of each sentence. i The similarity s between the problem and the given problem q i , ; in and Given a question q and a sentence t, respectively. i The vector representation obtained through SBERT.
3. The method for generating original text summaries based on a given question according to claim 1, characterized in that, In step 4: the word granularity cross-attention weight matrix and the question-sentence cross-attention weight are weighted and summed to obtain a joint attention weight matrix that considers both word granularity and question-sentence relationship.
4. The method for generating original text summaries based on a given question according to claim 1, characterized in that, In step 2: the original text U is divided into blocks so that adjacent text blocks u i with u i+1 50% overlap.
5. A system for generating original text summaries based on a given question, used to implement the method for generating original text summaries based on a given question as described in any one of claims 1-4, characterized in that, include: The segmentation module is used to divide the original text U into multiple text blocks u1, u2, u3...u m ; The sentence similarity calculation module is used to calculate the similarity of each sentence t in the original text U. i Similarity to a given problem q; Summary generation module: Based on the input text block u i Calculate the similarity between all sentences in the original text U and the given question q, and calculate the question-sentence cross-attention weight matrix and the word-granularity cross-attention weight matrix. Calculate the joint attention weight based on the question-sentence cross-attention weight matrix and the word-granularity cross-attention weight matrix, and generate the words for constructing the summary in sequence according to the joint attention weight.
Citation Information
Patent Citations
Robustness code summary generation method based on self-attention mechanism
CN108519890A
A text summarization model generation algorithm that fuses information selection and semantic association
CN109145105A