Text abstract generation method, device and equipment and computer storage medium
By extracting the semantic features and full-text features of the text to be extracted, and combining the intra-sentence importance and full-text importance features, a pre-set summary generation model is used to generate a summary, which solves the problem of low summary accuracy in the existing technology and achieves more accurate summary generation.
Patent Information
- Application Number
- CN202110961365.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-20
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-08-20
AI Technical Summary
Existing methods for extracting summaries are not precise enough to accurately extract valuable text summaries.
By processing the extracted text, the semantic features and full-text features of the target sentence are extracted. Combining the intra-sentence importance features and full-text importance features, a summary is generated using the refined self-matching layer and pointer network decoding layer in the preset summary generation model.
The generated summary takes into account both the context of the target sentence in the whole text and the local features within the sentence, thus improving the accuracy and representational ability of the summary.
Smart Images

Figure CN115712697B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of natural language processing, and in particular to a text abstract generation method and device, equipment and computer storage medium. BACKGROUND
[0002] With the rapid development of science and technology, various articles on the network dazzle people, and the value of these disordered articles is not great many times, and many attractive titles do not match the reality, which leads to being easily deceived by "title party", especially after reading some data with effort, it is found that it is not what you want, which not only wastes a lot of time, but also greatly reduces work efficiency. In order to determine whether the current data mastered is what you really want, and find the content you are satisfied with more quickly, it is necessary to quickly browse the unknown data and distinguish it, so as to obtain valuable data that you really need. The existing relatively mature abstract generation method generally adopts an extraction method, and the core idea is to find some keywords and sentences in the original text to form an abstract.
[0003] The traditional abstract acquisition method generally uses a variant of recurrent neural network (RNN), such as gated recurrent unit (GRU) and long short-term memory (LSTM), but the accuracy of the abstract obtained by these methods is not high. SUMMARY
[0004] The present application provides a text abstract generation method, device, equipment and computer storage medium, which aims to solve the problem of low accuracy of the abstract obtained by the existing abstract acquisition method.
[0005] In a first aspect, the present application provides a text abstract generation method, which comprises:
[0006] processing the text to be extracted to obtain the sentence meaning features of the target sentence in the text to be extracted, and the full-text features of the text to be extracted;
[0007] matching each word feature in the sentence meaning feature to obtain the intra-sentence importance feature of the target sentence;
[0008] matching the sentence meaning feature and the full-text feature to obtain the full-text importance feature of the target sentence in the text to be extracted;
[0009] generating an abstract of the text to be extracted according to the intra-sentence importance feature and the full-text importance feature.
[0010] In a possible implementation manner of the application, the matching of the word features in the sentence meaning features to obtain the intra-sentence importance features of the target sentence comprises:
[0011] The word features in the sentence meaning features are matched by a refinement self-matching layer in the preset abstract generation model to calculate semantic center information and attention distribution information of the target sentence.
[0012] The intra-sentence importance features of the target sentence are extracted according to the semantic center information and the attention distribution information by the refinement self-matching layer and a pointer network decoding layer in the preset abstract generation model.
[0013] In a possible implementation manner of the application, the generating of the abstract of the text to be extracted according to the intra-sentence importance features and the full-text importance features comprises:
[0014] The sentence meaning features are processed by a refinement self-matching layer in the preset abstract generation model according to the intra-sentence importance features and the full-text importance features to obtain a first context vector of the target sentence.
[0015] The candidate sentence features corresponding to the target sentence are extracted by the refinement self-matching layer according to the first context vector and the sentence meaning features, wherein the candidate sentence features are features of sentences in the text to be extracted except the target sentence.
[0016] The abstract of the text to be extracted is generated according to the candidate sentence features and the sentence meaning features by the refinement self-matching layer and a pointer network decoding layer in the preset abstract generation model.
[0017] In a possible implementation manner of the application, the generating of the abstract of the text to be extracted according to the candidate sentence features and the sentence meaning features comprises:
[0018] The important information proportion of the target sentence is calculated by the refinement self-matching layer according to the candidate sentence features and the sentence meaning features.
[0019] The abstract of the text to be extracted is generated according to the important information proportion, the sentence meaning features and the candidate sentence features by the refinement self-matching layer and a pointer network decoding layer in the preset abstract generation model.
[0020] In a possible implementation manner of the application, the generating of the abstract of the text to be extracted according to the intra-sentence importance features and the full-text importance features comprises:
[0021] The refining self-matching layer in the preset abstract generation model corrects the sentence meaning feature according to the intra-sentence importance feature and the full-text importance feature, to obtain a corrected sentence meaning feature containing context information.
[0022] The pointer network decoding layer in the preset abstract generation model decodes the corrected sentence meaning feature to generate an abstract of the text to be extracted.
[0023] In a possible implementation of the present application, the decoding processing of the corrected sentence meaning feature by the pointer network decoding layer in the preset abstract generation model to generate an abstract of the text to be extracted includes:
[0024] The pointer network decoding layer in the preset abstract generation model extracts the importance feature of the target sentence according to the corrected sentence meaning feature and the full-text feature.
[0025] The pointer network decoding layer predicts the importance score of the target sentence according to the importance feature.
[0026] The pointer network decoding layer generates an abstract of the text to be extracted according to the importance score.
[0027] In a possible implementation of the present application, the extraction of the importance feature of the target sentence by the pointer network decoding layer in the preset abstract generation model according to the corrected sentence meaning feature and the full-text feature includes:
[0028] The pointer network decoding layer in the preset abstract generation model calculates the similarity between the corrected sentence meaning feature and the full-text feature according to the corrected sentence meaning feature and the full-text feature.
[0029] The pointer network decoding layer determines a second context vector of the target sentence according to the similarity and the full-text feature.
[0030] The pointer network decoding layer extracts the importance feature of the target sentence according to the second context vector and the full-text feature.
[0031] In a second aspect, the present application provides a text abstract generation device, which includes:
[0032] A processing unit is configured to process a text to be extracted to obtain a sentence meaning feature of a target sentence in the text to be extracted and a full-text feature of the text to be extracted.
[0033] A self-matching unit is configured to match each word feature in the sentence meaning feature to obtain an intra-sentence importance feature of the target sentence.
[0034] a global matching unit, configured to match the sentence meaning feature and the global feature to obtain a global importance feature of the target sentence in the text to be extracted;
[0035] a generating unit, configured to generate a summary of the text to be extracted according to the intra-sentence importance feature and the global importance feature.
[0036] In a possible implementation of the present application, the self-matching unit is further configured to:
[0037] match each word feature in the sentence meaning feature through a refinement self-matching layer in a preset summary generation model, and calculate semantic center information and attention distribution information of the target sentence;
[0038] extract an intra-sentence importance feature of the target sentence according to the semantic center information and the attention distribution information.
[0039] In a possible implementation of the present application, the generating unit is further configured to:
[0040] process the sentence meaning feature according to the intra-sentence importance feature and the global importance feature through a refinement self-matching layer in a preset summary generation model, to obtain a first context vector of the target sentence;
[0041] extract a candidate sentence feature corresponding to the target sentence according to the first context vector and the sentence meaning feature through the refinement self-matching layer, wherein the candidate sentence feature is a feature of a sentence in the text to be extracted except the target sentence;
[0042] generate a summary of the text to be extracted according to the candidate sentence feature and the sentence meaning feature through the refinement self-matching layer and a pointer network decoding layer in the preset summary generation model.
[0043] In a possible implementation of the present application, the generating unit is further configured to:
[0044] calculate an importance information proportion of the target sentence according to the candidate sentence feature and the sentence meaning feature through the refinement self-matching layer;
[0045] generate a summary of the text to be extracted according to the importance information proportion, the sentence meaning feature and the candidate sentence feature through the refinement self-matching layer and a pointer network decoding layer in the preset summary generation model.
[0046] In a possible implementation of the present application, the generating unit is further configured to:
[0047] The sentence meaning feature is corrected according to the intra-sentence importance feature and the full-text importance feature through a refinement self-matching layer in the preset abstract generation model, to obtain a corrected sentence meaning feature containing context information.
[0048] The corrected sentence meaning feature is decoded through a pointer network decoding layer in the preset abstract generation model, to generate an abstract of the text to be extracted.
[0049] In a possible implementation of the present application, the generation unit is further configured to:
[0050] The importance feature of the target sentence is extracted according to the corrected sentence meaning feature and the full-text feature through a pointer network decoding layer in the preset abstract generation model.
[0051] The importance score of the target sentence is predicted according to the importance feature through the pointer network decoding layer.
[0052] The abstract of the text to be extracted is generated according to the importance score through the pointer network decoding layer.
[0053] In a possible implementation of the present application, the generation unit is further configured to:
[0054] The similarity between the corrected sentence meaning feature and the full-text feature is calculated according to the corrected sentence meaning feature and the full-text feature through a pointer network decoding layer in the preset abstract generation model.
[0055] The second context vector of the target sentence is determined according to the similarity and the full-text feature through the pointer network decoding layer.
[0056] The importance feature of the target sentence is extracted according to the second context vector and the full-text feature through the pointer network decoding layer.
[0057] In a third aspect, the present application further provides a text abstract generation device, which comprises a processor and a memory, the memory stores a computer program, and the processor invokes the computer program in the memory to execute the steps in any of the text abstract generation methods provided by the present application.
[0058] In a fourth aspect, the present application further provides a computer storage medium, which stores a computer program, and the computer program is loaded by a processor to execute the steps in the text abstract generation method.
[0059] In summary, the text abstract generation method provided in the application comprises: processing a to-be-extracted text to obtain sentence meaning features of a target sentence in the to-be-extracted text and full-text features of the to-be-extracted text; matching each word feature in the sentence meaning features to obtain intra-sentence importance features of the target sentence; matching the sentence meaning features and the full-text features to obtain full-text importance features of the target sentence in the to-be-extracted text; and generating an abstract of the to-be-extracted text according to the intra-sentence importance features and the full-text importance features. Since the full-text importance features represent the semantic matching degree of the target sentence and the to-be-extracted text, and the intra-sentence importance features represent the importance distribution of words in the target sentence, the abstract generated according to the full-text importance features and the intra-sentence importance features at the same time considers the context of the target sentence in the full text and the local features of the target sentence, so as to ensure that the abstract can accurately represent the full-text semantics of the to-be-extracted text. BRIEF DESCRIPTION OF DRAWINGS
[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0061] Figure 1 is an application scenario diagram of the text abstract generation method provided in the embodiments of the present application;
[0062] Figure 2 is a flowchart of the text abstract generation method provided in the embodiments of the present application;
[0063] Figure 3 is a diagram of attention distribution provided in the embodiments of the present application
[0064] Figure 4 is a flowchart of obtaining revised sentence meaning features provided in the embodiments of the present application;
[0065] Figure 5 is a flowchart of generating an abstract provided in the embodiments of the present application;
[0066] Figure 6 is a flowchart of extracting importance features provided in the embodiments of the present application;
[0067] Figure 7 is a structural diagram of an embodiment of the text abstract generation device provided in the embodiments of the present application;
[0068] Figure 8is an embodiment structure schematic diagram of a text abstract generation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0070] In the description of the embodiments of the present application, it should be understood that the terms "first", "second" are used only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise specifically limited.
[0071] The following description is presented to enable any person skilled in the art to practice the present application. In the following description, for purposes of explanation, specific details are set forth. It will be apparent to those skilled in the art that the present application can be practiced without using these specific details. In other instances, well-known processes have not been described in detail in order to avoid obscuring the description of the embodiments of the present application. Therefore, the present application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
[0072] The embodiments of the present application provide a text abstract generation method, device, equipment and computer storage medium. Wherein, the text abstract generation device can be integrated in the text abstract generation device, which can be a server, a terminal or other equipment.
[0073] First, before introducing the embodiments of the present application, the related content about the application background of the embodiments of the present application is introduced.
[0074] The current text summary acquisition method mainly includes two methods of summary generation and summary extraction. Compared with summary generation, summary extraction can avoid most OOV (out of vocabulary) problems because it directly extracts a whole sentence from the text as a summary. The method, device, equipment and computer storage medium in the embodiments of the present application are mainly applied in the field of summary extraction, so the summary generation described in the embodiments of the present application can be understood as another expression of summary extraction. However, it should be noted that part of the technical features in the embodiments of the present application can still be applied in the field of summary generation, and summary generation or summary extraction should not be regarded as a limitation of the embodiments of the present application.
[0075] In the embodiments of the present application, a trained preset summary generation model can be used to process the text for which a summary needs to be acquired to generate a summary. The preset summary generation model can specifically include the following levels:
[0076] The word embedding layer can specifically include a word2vec, a bidirectional training language (Bidirectional Encoder Representations from Transformers) and the like, and is used to convert words in the input text into word embeddings and input the word embeddings into the hierarchical encoding layer.
[0077] The hierarchical encoding layer can specifically include a convolutional neural network and a bidirectional LSTM (Long Short-Term Memory), and is used to encode the word embeddings to obtain sentence representations of the encoded words, and perform preliminary context information feature extraction on the sentence representations through the bidirectional LSTM, and finally input the hidden state vector obtained after extraction into the refinement self-matching layer.
[0078] The refinement self-matching layer can specifically include an LSTM, which is used to correct the received hidden state vector to obtain a corrected hidden state vector, and input the corrected hidden state vector into the subsequent decoding layer.
[0079] The above levels are all on the encoding side, and when the method of the embodiments of the present application is performed in the above levels, the time step and the time point refer to the time step and the time point on the encoding side.
[0080] The pointer network decoding layer is on the decoding side, and can specifically include an LSTM network as a decoder, which is used to decode the corrected hidden state vector and predict the decoded result to determine whether to take a sentence as a summary of the input text.
[0081] In the embodiments of the present application, the terms such as time step, time, attention allocation, and context vector are common terms in NLP (Natural Language Processing), and are not specifically explained.
[0082] The execution subject of the text abstract generation method provided in the embodiments of the present application can be a text abstract generation apparatus provided in the embodiments of the present application, or a server device, a physical host, or a user equipment (UE) and other types of text abstract generation devices integrated with the text abstract generation apparatus. The text abstract generation apparatus can be implemented in hardware or software. The UE can be a terminal device such as a smart phone, a tablet computer, a notebook computer, a palm computer, a desktop computer, or a personal digital assistant (PDA).
[0083] The text abstract generation device can be operated in a single mode or in a device cluster mode.
[0084] Referring to Figure 1 , Figure 1 is a scenario diagram of a text abstract generation system provided in the embodiments of the present application. The text abstract generation system can include a text abstract generation device 100, and the text abstract generation device 100 is integrated with a text abstract generation apparatus.
[0085] In addition, as Figure 1 indicated, the text abstract generation system can further include a memory 200 for storing data, such as text data.
[0086] It should be noted that Figure 1 the scenario diagram of the text abstract generation system shown is only an example. The text abstract generation system and the scenario described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not limit the technical solutions provided in the embodiments of the present application. It is known to those skilled in the art that, as the text abstract generation system evolves and new business scenarios appear, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0087] Next, the text abstract generation method provided in the embodiments of the present application will be introduced. In the embodiments of the present application, a text abstract generation device is used as an execution subject. In order to simplify and facilitate the description, the execution subject will be omitted in the subsequent method embodiments.
[0088] Referring to Figure 2 , Figure 2is a flowchart of a text abstract generation method provided by an embodiment of the present application. It should be noted that although a logical sequence is shown in the flowchart, in some cases, the steps shown or described can be performed in an order different from that shown. The text abstract generation method can specifically include the following steps 201 to 204, wherein:
[0089] 201. The text to be extracted is processed to obtain the sentence meaning feature of the target sentence in the text to be extracted, and the full-text feature of the text to be extracted.
[0090] The text to be extracted refers to the text to be extracted for the abstract. The text properties of the text to be extracted, such as the text type, text language, and text word count, are not limited by the embodiments of the present application. For example, the text to be extracted can be a Chinese legal document text to be extracted for the abstract, a Tibetan novel text to be extracted for the abstract, or a news text to be extracted for the abstract containing numbers and multiple languages. The word count of the text can be 1000 words, 2000 words, etc. Similarly, the method of obtaining the text to be extracted is not limited by the embodiments of the present application. For example, the text to be extracted can be obtained from the Internet by a crawler (Python) algorithm, or the text can be input to the text abstract generation device by a user through a copier, a keyboard, or other peripherals with input functions. The target sentence is any sentence in the text to be extracted, which can be understood as the current sentence that the text abstract generation model is predicting whether to extract as an abstract.
[0091] The sentence meaning feature refers to a feature vector containing the sentence meaning information in the target sentence. In the preset abstract generation model provided by the embodiments of the present application, it can be understood as the hidden state vector obtained after processing the target sentence in the hierarchical encoding layer.
[0092] The full-text feature is a feature vector obtained by combining the sentence features of each sentence in the text to be extracted in the order of the text. For example, if the text to be extracted contains three sentences A, B, and C arranged in order, and the sentence features corresponding to A, B, and C are a, b, and c respectively, then the full-text feature refers to (a, b, c). In the preset abstract generation model provided by the embodiments of the present application, it can be understood as the hidden state vector obtained by processing and combining each sentence in the text to be extracted in the hierarchical encoding layer.
[0093] The text abstract generation device can extract the sentence meaning feature of the target sentence through the preset abstract generation model.
[0094] In some embodiments, the text summary generation apparatus can convert the target sentence into a sentence vector through a word embedding layer in the preset summary generation model, and then extract features of the sentence vector through a hierarchical encoding layer in the preset summary generation model to obtain sentence meaning features. For example, the text summary generation device can first convert the words in the target sentence into respective corresponding word embeddings through a word2vec sub-layer or a bidirectional language sub-layer in the word embedding layer, and then extract features of the obtained word vectors through a one-dimensional convolution operation by a convolutional neural network in the hierarchical encoding layer to encode the word embeddings, to obtain sentence representations of the words, which contain local context information of the corresponding words in the target sentence. For example, the convolutional neural network can extract features of the obtained word embeddings according to formula (1) through a fixed-size window to obtain sentence representations:
[0095]
[0096] wherein x dt is the sentence representation of the dt-th word in the target sentence, fconv refers to a function used when performing the one-dimensional convolution operation, Wc is a parameter trained in the convolutional neural network, w is the word embedding, t refers to the time step t, and k is the window size. After arranging the sentence representations of each word in the target sentence in order, the sentence vector of the target sentence can be obtained, as shown in formula (2):
[0097] s = (x1, x2, …, x dt ) formula (2)
[0098] wherein s is the sentence vector of the target sentence.
[0099] It should be noted that when obtaining the full-text features, the above method can also be used to obtain the sentence vector s i of the i-th sentence in the text to be extracted, and details are not repeated.
[0100] The text summary generation apparatus further extracts information from the sentence vector, that is, the sentence meaning features of the target sentence are obtained.
[0101] In some embodiments, the sentence vector obtained in formula (2) can be processed through a bidirectional LSTM in the hierarchical encoding layer to obtain the sentence meaning features of the target sentence, so as to increase the context information contained in the sentence meaning features and improve the accuracy of the summary generation. The bidirectional LSTM contains a forward RNN (Recurrent Neural Network) and a reverse RNN, so the bidirectional LSTM can utilize information at past time and future time simultaneously, and the obtained sentence meaning features will be more accurate than those obtained by a unidirectional LSTM.
[0102] Specifically, the sentence vector can be processed by formula (3)-formula (5) to obtain the sentence meaning feature of the target sentence.
[0103]
[0104]
[0105]
[0106] wherein, is a forward sentence meaning feature obtained by processing the sentence vector of the target sentence by the forward LSTM in the bidirectional LSTM at the time step t. t is the input of the target sentence at the time step t. is a backward sentence meaning feature obtained by processing the sentence vector of the target sentence by the backward LSTM in the bidirectional LSTM at the time step t. t is a sentence meaning feature of the target sentence at the time step t, which can be understood as the hidden state vector output by the bidirectional LSTM at the time step t.
[0107] It should be noted that when obtaining the full-text feature, the above method can also be used to obtain the sentence feature h i of the i-th sentence in the text to be extracted.
[0108] 202、Match the word features in the sentence meaning feature to obtain the intra-sentence importance feature of the target sentence.
[0109] The intra-sentence importance feature refers to the importance distribution feature of each word in the target sentence for expressing the sentence meaning, without considering the relationship between the target sentence and other sentences in the text to be extracted. For example, for the sentence “children make a pray at Nandi’s feet”, the words “make”, “a”, and “pray” can better express the sentence meaning of the target sentence, so the intra-sentence importance feature of the sentence refers to the distribution information that can highlight the importance of the words “make”, “a”, and “pray”. In NLP, or in the preset abstract generation model provided in the embodiments of the present application, it can be understood that more attention is paid to the words “make”, “a”, and “pray”, that is, the attention weight allocated to the words “make”, “a”, and “pray” is larger during calculation. Therefore, the intra-sentence importance feature can represent the context situation of each word in the target sentence.
[0110] In some embodiments, the intra-sentence importance feature can be determined according to the semantic center information and the attention distribution information of the target sentence. In the refinement self-matching layer, the text summary generation apparatus can model by Gaussian distribution, and extract the intra-sentence importance feature of the target sentence by the following steps (1) and (2). At this time, the matching of each word feature in the sentence meaning feature to obtain the intra-sentence importance feature of the target sentence comprises:
[0111] (1) matching each word feature in the sentence meaning feature by the refinement self-matching layer in the preset summary generation model, and calculating the semantic center information and the attention distribution information of the target sentence.
[0112] The semantic center information refers to the information of the most important word in the target sentence. Taking the sentence "children make a pray at Nandi's feet" as an example, the word "pray" best expresses the meaning of the entire sentence, so the semantic center information can include the position of the word "pray" in the target sentence, the meaning of the word "pray", and the like. Specifically, the semantic center information can be calculated by formula (6):
[0113]
[0114] wherein μ t is the semantic center information of the target sentence at time step t, U p is a trained linear mapping vector, W p is a trained shared parameter, tanh is an activation function, and h t refers to the sentence meaning feature of the target sentence at time step t, which can be equivalent to the word feature of the input word in the target sentence at time step t.
[0115] The attention distribution information refers to the distribution scope of the importance of the words in the target sentence. In NLP, or in the preset summary generation model provided in the embodiments of the present application, it can be understood as the Gaussian distribution scope of the attention in the target sentence. Specifically, the attention distribution information can be calculated by formula (7):
[0116]
[0117] wherein δ t is the attention distribution information of the target sentence at time step t, U C is another trained linear mapping vector, W p is a trained shared parameter, tanh is an activation function, and h tis the semantic feature of the target sentence at time step t, which can be understood as the semantic feature obtained by matching the word vector of the input word at time step t with the semantic feature at time step t-1.
[0118] (2) Extracting the intra-sentence importance feature of the target sentence according to the semantic center information and the attention distribution information through the pointer network decoding layer in the refined self-matching layer and the preset abstract generation model.
[0119] In the embodiments of the present application, the semantic center information and the attention distribution information can be combined to determine the attention allocated to each word in the target sentence when only the target sentence is considered, i.e., the intra-sentence importance feature. For example, for the sentence "children make a pray at Nandi's feet", assuming that the semantic center information is the information of the word "pray", the attention allocated to each word in the target sentence will be centered on the word "pray" and distributed in a Gaussian distribution with the attention distribution information as the scope when only the target sentence is considered. It can be seen from Figure 3 It can be more conveniently understood that Figure 3 the horizontal coordinate in the graph is the word in the target sentence, and the vertical coordinate is the attention. It can be seen that when understanding the semantic of the target sentence, the text abstract generation device will allocate more attention to the words close to "pray". Specifically, the intra-sentence importance feature can be calculated by using formula (7) and formula (8):
[0120]
[0121]
[0122] wherein, μ t is the semantic center information of the target sentence at time step t, δ t is the attention distribution information of the target sentence at time step t, is the normalized semantic center information, is the normalized attention distribution information, i is the number of sentences in the text to be extracted, sigmoid is an activation function, and G t is the intra-sentence importance feature at time step t, and M is the position of the target sentence in the document to be extracted. For example, if the target sentence is the second sentence in the document to be extracted, i is 2.
[0123] 203、Matching the semantic feature and the full-text feature to obtain the full-text importance feature of the target sentence in the text to be extracted.
[0124] The full-text importance feature refers to a feature vector representing the matching degree between the sentence meaning of the target sentence and the full-text semantics of the text to be extracted. It can be understood as a feature vector obtained by self-matching the target sentence in the text to be extracted. In NLP, or in the preset abstract generation model provided in the embodiments of the present application, it can be understood as an attention vector when calculating the attention weight. The higher the matching degree between the sentence meaning of the target sentence and the full-text semantics of the text to be extracted, the more the target sentence can express the full-text semantics of the text to be extracted, that is, as the abstract of the text to be extracted. Illustratively, the full-text importance feature can be calculated by a refinement self-matching layer in the preset abstract generation model. Specifically, the full-text importance feature can be calculated by formula (9):
[0125]
[0126] wherein q t,i is the full-text importance feature when the target sentence is matched with the feature of the i th sentence in the full-text feature at time step t, h t is the sentence meaning feature of the target sentence at time step t, h is the feature of the i th sentence in the full-text feature.
[0127] It should be noted that formula (9) is only one method of obtaining the full-text importance feature, and cannot be understood as a limitation of the embodiments of the present application. For example, the general, concat, etc. method can also be used to calculate the full-text importance feature. When the general method is used, the full-text importance feature can be calculated by formula (10):
[0128]
[0129] wherein q t,i is the full-text importance feature when the target sentence is matched with the feature of the i th sentence in the full-text feature at time step t, h t is the sentence meaning feature of the target sentence at time step t, h i c is the feature of the i th sentence in the full-text feature.
[0130] When the concat method is used, the full-text importance feature can be calculated by formula (11):
[0131]
[0132] wherein q t,i is the full-text importance feature when the target sentence is matched with the feature of the i th sentence in the full-text feature at time step t, U a is another linear mapping vector trained, W a is a trained parameter, ht is a semantic feature of a target sentence at time step t, is a feature of an i-th sentence in the full-text feature.
[0133] 204. generating the summary of the text to be extracted according to the intra-sentence importance feature and the full-text importance feature.
[0134] In some embodiments, the semantic feature of the target sentence can be revised according to the intra-sentence importance feature and the full-text importance feature to obtain a revised semantic feature containing full-text context information, and then a summary is generated according to the revised semantic feature. At this time, the generating the summary of the text to be extracted according to the intra-sentence importance feature and the full-text importance feature includes:
[0135] (1) revising the semantic feature according to the intra-sentence importance feature and the full-text importance feature to obtain a revised semantic feature containing context information through a refinement self-matching layer in a preset summary generation model.
[0136] (2) decoding and processing the revised semantic feature to generate the summary of the text to be extracted through a pointer network decoding layer in the preset summary generation model.
[0137] Wherein, the revised semantic feature is a feature vector containing more context information than the semantic feature. In the embodiments of the present application, the matching attention weight when each sentence feature in the full-text feature and the semantic feature are matched can be calculated according to the intra-sentence importance feature and the full-text importance feature, and the context of the semantic feature can be improved according to the matching attention weight to obtain the revised semantic feature. Exemplarily, the revised semantic feature can be understood as the final output on the encoding side, and the hidden state vector input to the pointer network decoding layer.
[0138] For the convenience of understanding, reference can be made to Figure 4 (a)- Figure 4 (c), Figure 4 (a)- Figure 4 (c) are the same as Figure 3 , the horizontal coordinate is the word in the target sentence, and the vertical coordinate is the attention. Figure 4 (a) is the attention distribution of each word contained in the target sentence in the full-text importance feature, Figure 4 (b) is the attention distribution of each word contained in the target sentence in the intra-sentence importance feature, Figure 4 (c) is the distribution of the matching attention. It can be seen that the matching attention weight can increase the attention allocated to the important words in the target sentence, for example Figure 4The words “make”, “a”, and “pray” in (c) are included. Therefore, the modified semantic features calculated based on the matching attention weights and semantic features contain more accurate contextual information, and the generated summary can accurately express the main idea of the text to be extracted.
[0139] For example, the modified semantic features can be obtained using the following method, and a summary can be generated based on the modified semantic features:
[0140] (A) The sentence meaning features are processed by the refined self-matching layer in the preset summary generation model according to the intra-sentence importance features and the full-text importance features to obtain the first context vector of the target sentence.
[0141] The first context vector is a feature vector used to characterize the importance distribution of the target sentence in the text to be extracted. Specifically, the first context vector can be obtained through equations (12)-(13):
[0142] α t,i =softmax(q) t,i G t Equation (12)
[0143]
[0144] Where, α t,i It represents the matching attention weights between the target sentence and the i-th sentence in the text to be extracted at time step t, where softmax is the activation function and q is the value of the target sentence. t,i G is the full-text importance feature when the target sentence is matched with the features of the i-th sentence in the full-text features at time step t. t It is the intra-sentence importance feature at time step t, c t It is the first context vector at time step t, and I is the number of sentences in the text to be extracted.
[0145] Due to α t,i The first context vector contains the context of the target sentence within the entire text, as well as the importance information of each word in the target sentence. Therefore, when calculating the first context vector, more attention is paid to the important words in the target sentence, and less attention is paid to irrelevant words, thereby improving the accuracy of the context information in the first context vector.
[0146] (B) The refined self-matching layer extracts the sentence features corresponding to the target sentence based on the first context vector and the sentence meaning features, wherein the sentence features to be selected are the features of sentences other than the target sentence in the text to be extracted.
[0147] The to-be-selected sentence feature refers to the semantic feature of a sentence in the to-be-extracted text other than the target sentence. For example, for a to-be-extracted text containing sentences A, B, and C, if the target sentence is B, the to-be-selected sentence feature is the semantic feature of sentence A and sentence C. Illustratively, the to-be-selected sentence feature can be calculated by formula (14):
[0148]
[0149] wherein, m t is the to-be-selected sentence feature corresponding to the target sentence at time step t, U g is another linear mapping vector trained, W m is a trained parameter, c t is the first context vector at time step t, h t is the semantic feature of the target sentence at time step t.
[0150] (C) generating the summary of the to-be-extracted text according to the to-be-selected sentence feature and the semantic feature through the pointer network decoding layer in the refined self-matching layer and the preset summary generation model
[0151] The text summary generation apparatus can calculate the revised semantic feature according to the to-be-selected sentence feature and the semantic feature through the refined self-matching layer in the preset summary generation model, and then generate the summary according to the revised semantic feature through the pointer network coding layer in the preset summary generation model. Illustratively, the text summary generation apparatus can assign different weights to the to-be-selected sentence feature and the semantic feature, and then calculate the revised semantic feature according to the to-be-selected sentence feature, the semantic feature, and the respective weights.
[0152] In some embodiments, the respective weights can be calculated according to the to-be-selected sentence feature and the semantic feature to increase the adaptability of the weights. At this time, the generating the summary of the to-be-extracted text according to the to-be-selected sentence feature and the semantic feature comprises:
[0153] (I) calculating the important information weight of the target sentence according to the to-be-selected sentence feature and the semantic feature through the refined self-matching layer.
[0154] The proportion of important information refers to the proportion of the target sentence containing the full text information of the text to be extracted, which can also be understood as the degree of relevance between the target sentence and the text to be extracted. The greater the proportion of important information, the more relevant the target sentence is to the text to be extracted. For example, news text usually contains a news summary, detailed description of the news, and sources of information. If the target sentence is a sentence in the news summary, it is easy to understand that the calculated proportion of important information will be larger. If the target sentence is a sentence unrelated to the news content, such as a source of information, it is easy to understand that the calculated proportion of important information will be smaller. For example, the proportion of important information can be understood as the parameter of the gating unit in the model. Specifically, the proportion of important information can be calculated by equation (15):
[0155] λ t =sigmoid(W g [h t c t Formula (15)
[0156] Where, λ t It represents the proportion of important information at time step t, where sigmoid is the activation function, and W... g These are the trained parameters, c t It is the first context vector at time step t, h t This represents the semantic features of the target sentence at time step t. Since the sigmoid function can map the input to the interval [0, 1], therefore λ... t It belongs to the interval [0, 1].
[0157] (ii) Through the refined self-matching layer and the pointer network decoding layer in the preset summary generation model, a summary of the text to be extracted is generated based on the weight of important information, the semantic features, and the features of the sentence to be selected.
[0158] Due to λ t It belongs to the interval [0, 1], therefore it can be determined according to λ. t The weights corresponding to the features of the sentences to be selected are calculated; for example, 1-λ can be used. t As the proportion corresponding to the sentence features to be selected.
[0159] The text summarization generation device can calculate the full-text information of the target sentence based on the semantic features, the features of the sentence to be selected, and their respective weights through the refined self-matching layer in the preset summarization generation model. It then calculates the corrected semantic features based on the full-text information and the semantic features. Finally, it decodes the corrected semantic features through the pointer network decoding layer in the preset summarization generation model, thereby generating a summary of the text to be extracted. Specifically, the corrected semantic features can be calculated using equations (16) and (17):
[0160] glo t = λ t * h t + (1 - λ t ) * m t Equation (16)
[0161] h t ' = LSTM(h t-1 , [h t ; glo t ]) Equation (17)
[0162] wherein, glo t is the full-text information at time step t, λ t is the proportion of important information at time step t, m t is the candidate sentence feature corresponding to the target sentence at time step t, h t ' is the modified sentence meaning feature at time step t, h t is the sentence meaning feature of the target sentence at time step t, and LSTM refers to calculation and processing through an LSTM network.
[0163] It should be noted that the time steps in steps 201-204 are all time steps on the encoding side.
[0164] In summary, the text summary generation method provided by the embodiments of the present application comprises: processing a to-be-extracted text to obtain a sentence meaning feature of a target sentence in the to-be-extracted text and a full-text feature of the to-be-extracted text; matching each word feature in the sentence meaning feature to obtain an intra-sentence importance feature of the target sentence; matching the sentence meaning feature and the full-text feature to obtain a full-text importance feature of the target sentence in the to-be-extracted text; and generating a summary of the to-be-extracted text according to the intra-sentence importance feature and the full-text importance feature. Since the full-text importance feature represents the semantic matching degree of the target sentence and the to-be-extracted text, and the intra-sentence importance feature represents the importance distribution of the words in the target sentence, the summary generated according to the full-text importance feature and the intra-sentence importance feature at the same time considers the context of the target sentence in the full text and the local features of the target sentence, so as to ensure that the summary can accurately represent the full-text semantics of the to-be-extracted text.
[0165] The text abstract generation apparatus can decode the modified sentence meaning feature by using a common decoder to generate an abstract of the text to be extracted. For example, the text abstract generation apparatus can decode the modified sentence meaning feature by a SeqLab method. However, if the text length of the text to be extracted is long, the calculation speed will be slow. Based on this, the text abstract generation apparatus can decode the modified sentence meaning feature by a pointer network decoding layer in a preset abstract generation model. It is referred to Figure 5 At this time, the decoding of the modified sentence meaning feature by the pointer network decoding layer in the preset abstract generation model to generate the abstract of the text to be extracted includes:
[0166] 301. Extracting, by the pointer network decoding layer in the preset abstract generation model, an importance feature of the target sentence according to the modified sentence meaning feature and the full-text feature.
[0167] The importance feature refers to an attention vector calculated according to the modified sentence meaning feature and the full-text feature in the pointer network decoding layer. Exemplarily, the modified sentence meaning feature at the last encoding time step can be first input into the pointer network decoding layer as an LSTM network of the decoder to obtain a decoded sentence meaning feature, and then the importance feature can be calculated according to the decoded sentence meaning feature and the sentence features of each sentence in the full-text feature. For example, the importance feature can be calculated by formula (18):
[0168]
[0169] wherein, is the importance feature calculated according to the sentence feature of the i th sentence in the full-text feature at time step t, tanh is an activation function, v p , W e and W d are trained parameters, h t is the sentence feature of the i th sentence in the full-text feature, d t is the decoded sentence meaning feature at time step t.
[0170] In some embodiments, the sentence features of each sentence in the full-text feature can also be calculated to obtain the corresponding reference modified sentence meaning feature of each sentence by the method for calculating the modified sentence meaning feature described above, and then the reference modified sentence meaning feature corresponding to each sentence is used to replace the sentence feature in formula (18) to improve the accuracy of the importance feature. Specifically, the importance feature can be calculated by formula (19):
[0171]
[0172] wherein, is the importance feature when matching the reference revised sentence meaning feature of the i th sentence in the full-text feature at time step t, tanh is an activation function, v p e d are trained parameters, h t is the reference revised sentence meaning feature of the i th sentence in the full-text feature, d t is the decoded sentence meaning feature at time step t.
[0173] It should be noted that the reference revised sentence meaning feature and the revised sentence meaning feature appearing in steps 301-303 refer to the reference revised sentence meaning feature or the revised sentence meaning feature at the last encoding time step, and the time step refers to the decoding side time step.
[0174] 302. The pointer network decoding layer predicts the importance score of the target sentence according to the importance feature.
[0175] The importance score refers to a score calculated according to the case that the target sentence contains the full-text semantics in the text to be extracted. Illustratively, the importance score can be understood as the probability of the target sentence as an abstract. The higher the importance score, the more full-text semantics the target sentence contains, and thus the higher the probability of the target sentence as an abstract. Specifically, the importance score can be calculated by formula (20):
[0176]
[0177] where p t is the importance score at time step t, and I is the number of sentences in the text to be extracted.
[0178] 303. The pointer network decoding layer generates the abstract of the text to be extracted according to the importance score.
[0179] The text abstract generation device can take p t calculated according to the last d t at the time step as the importance score of the target sentence, and then sort the importance scores of the target sentence and other sentences in the text to be extracted, and select the sentences in the front as the abstract of the text. For example, the text abstract generation device can select the top 3 sentences as the abstract of the text.
[0180] In some embodiments, p t calculated at all time steps can also be subjected to operations such as weighting and averaging, and then the result obtained after the operation is taken as the importance score of the target sentence.
[0181] Through steps 301-303, the text summarization generation device can directly predict the importance score based on the importance feature, i.e., the attention vector of the target sentence. In contrast, traditional summarization methods require generating a new text sequence based on the attention vector and then predicting the new text sequence. Therefore, the method in this embodiment is faster.
[0182] In some embodiments, d can also be re-applied to... t Perform an attention calculation to increase the contextual information contained in the importance features and reduce repetitive semantics in the summary. (Reference) Figure 6 At this point, the pointer network decoding layer in the preset summary generation model calculates the importance features of the target sentence based on the corrected semantic features, including:
[0183] 401. Through the pointer network decoding layer in the preset summary generation model, the similarity between the modified sentence meaning features and the full text features is calculated based on the modified sentence meaning features and the full text features.
[0184] Similarity can be understood as the attention weight in step (A). Specifically, similarity can be calculated using equations (21) and (22):
[0185]
[0186]
[0187] in, It is the attention vector obtained after matching and calculating the reference corrected semantic features of the i-th sentence in the full text features at time step t. g W e and W d These are the trained parameters, tanh is the activation function, and h is the value of the parameter. t It is the sentence feature of the i-th sentence in the full text features, d t It is the semantic feature of the decoded sentence at time step t. t It represents the similarity at time step t, and I represents the number of sentences in the text to be extracted.
[0188] It should be noted that, when performing step 401, the sentence features of each sentence in the full text features can be calculated using the method described above for calculating the modified sentence meaning features, and then the sentence features in formula (18) can be replaced with the modified sentence meaning features of each sentence to improve the accuracy of the importance features.
[0189] 402. Determine a second context vector of the target sentence according to the similarity and the full-text feature through the pointer network decoding layer.
[0190] The interpretation of the second context vector can refer to the interpretation of the first context vector, specifically, the second context vector can be determined by formula (23):
[0191]
[0192] Wherein, z t is the second context vector at time step t, att t is the similarity at time step t, W g is the trained parameter, h t is the sentence feature of the i-th sentence in the full-text feature.
[0193] It should be noted that when performing step 402, the sentence features of the sentences in the full-text feature can be calculated by the method of calculating the modified sentence meaning feature as described above, to obtain the reference modified sentence meaning feature corresponding to each sentence, and then the reference modified sentence meaning feature corresponding to each sentence is used to replace the sentence feature in formula (23), so as to improve the accuracy of the importance feature.
[0194] 403. Extract the importance feature of the target sentence according to the second context vector and the full-text feature through the pointer network decoding layer.
[0195] It can be seen that since the second context vector contains more context information, the summary generated by the decoding result according to the second context vector is more accurate than the summary generated by the decoding result according to the modified sentence meaning feature, and the extracted summary can avoid semantic repetition and other problems based on the context information. In addition, the sentence features of other sentences in the text to be extracted are also considered when calculating the second context vector, and these sentence features include the sentence features of the sentences that have been selected as the target sentences, so when extracting the importance feature according to the second context vector and the full-text feature, the importance gain of the previously selected sentences is also combined, further improving the accuracy of the summary extraction.
[0196] Next, taking a news text as an example, a specific process of extracting a summary is described, and it should be noted that the description in the following cannot be understood as a limitation of the embodiments of the present application.
[0197] (1) Obtain the news text, and convert each sentence in the news text into a sentence vector through the word embedding layer in the preset summary generation model.
[0198] (2) For each sentence in the news text, the bidirectional LSTM in the word embedding layer is used to process the sentence to obtain the full-text feature and the sentence meaning feature.
[0199] (3A) The semantic center information and attention distribution information in the target sentence are obtained by processing the sentence meaning feature through the refinement self-matching layer in the preset abstract generation model, and the intra-sentence importance feature is extracted according to the semantic center information and attention distribution information.
[0200] (3B) At the same time as (3A), the similarity between the sentence meaning feature and the full-text feature is matched through the refinement self-matching layer in the preset abstract generation model to obtain the full-text importance feature.
[0201] (4) The intra-sentence importance feature and the full-text importance feature are used as parameters to calculate the matching attention weight of the target sentence through the refinement self-matching layer in the preset abstract generation model, and the first context vector representing the importance distribution of the target sentence in the full text is calculated according to the matching attention weight and the sentence meaning feature.
[0202] (5) The refinement self-matching layer in the preset abstract generation model is used to calculate the selected sentence feature according to the first context vector and the sentence meaning feature, and then the gate unit in the refinement self-matching layer is used to adjust the proportion of important information according to the selected sentence feature and the sentence meaning feature.
[0203] (6) The refinement self-matching layer in the preset abstract generation model is used to correct the sentence meaning feature according to the proportion of important information and the selected sentence feature to obtain the corrected sentence meaning feature, which is the final output hidden state vector of the encoding side, and the corrected sentence meaning feature is used as the input of the pointer network decoding layer in the preset abstract generation model. At this time, the text abstract generation method enters the decoding side.
[0204] (7) The attention vector of the target sentence is extracted according to the input corrected sentence meaning feature and full-text feature through the pointer network decoding layer, and the similarity between each sentence vector in the corrected sentence meaning feature and the full-text feature is calculated according to the attention vector, or the similarity between the corrected sentence meaning feature and the reference corrected sentence meaning feature of each sentence in the corrected sentence meaning feature and the full-text feature is obtained, i.e. attention weight. The reference corrected sentence meaning feature can be referred to in the above explanation and will not be repeated here.
[0205] (8) The second context vector of the encoding side is calculated according to the similarity and the full-text feature to improve the context information contained in the parameters during decoding.
[0206] (9) The importance feature is extracted according to the second context vector and the full-text feature, i.e. the attention vector of the target sentence is extracted again according to the second context vector and the full-text feature.
[0207] (10) Predicting the importance features to obtain an importance score, which can be understood as the probability of the target sentence as a summary.
[0208] (11) Generating a summary of the news text according to the importance score.
[0209] In order to better implement the text summary generation method in the embodiments of the present application, on the basis of the text summary generation method, a text summary generation device is further provided in the embodiments of the present application, as shown in FIG. 5, which is a structural schematic diagram of an embodiment of the text summary generation device in the embodiments of the present application. The text summary generation device 500 comprises: Figure 7
[0210] The processing unit 501 is configured to process the text to be extracted to obtain sentence meaning features of a target sentence in the text to be extracted and full-text features of the text to be extracted.
[0211] The self-matching unit 502 is configured to match each word feature in the sentence meaning features to obtain intra-sentence importance features of the target sentence.
[0212] The global matching unit 503 is configured to match the sentence meaning features and the full-text features to obtain full-text importance features of the target sentence in the text to be extracted.
[0213] The generating unit 504 is configured to generate a summary of the text to be extracted according to the intra-sentence importance features and the full-text importance features.
[0214] In a possible implementation manner of the present application, the self-matching unit 502 is further configured to:
[0215] match each word feature in the sentence meaning features by a refined self-matching layer in a preset summary generation model to calculate semantic center information and attention distribution information of the target sentence;
[0216] extract the intra-sentence importance features of the target sentence according to the semantic center information and the attention distribution information by the refined self-matching layer and a pointer network decoding layer in the preset summary generation model.
[0217] In a possible implementation manner of the present application, the generating unit 504 is further configured to:
[0218] process the sentence meaning features according to the intra-sentence importance features and the full-text importance features by a refined self-matching layer in a preset summary generation model to obtain a first context vector of the target sentence;
[0219] extract a candidate sentence feature corresponding to the target sentence from the first context vector and the sentence meaning feature according to the refinement self-matching layer, wherein the candidate sentence feature is a feature of a sentence in the text to be extracted except the target sentence;
[0220] generate the summary of the text to be extracted according to the candidate sentence feature and the sentence meaning feature through the pointer network decoding layer in the preset summary generation model and the refinement self-matching layer.
[0221] In a possible implementation of the present application, the generation unit 504 is further configured to:
[0222] calculate the important information proportion of the target sentence according to the candidate sentence feature and the sentence meaning feature through the refinement self-matching layer;
[0223] generate the summary of the text to be extracted according to the important information proportion, the sentence meaning feature and the candidate sentence feature through the pointer network decoding layer in the preset summary generation model and the refinement self-matching layer.
[0224] In a possible implementation of the present application, the generation unit 504 is further configured to:
[0225] correct the sentence meaning feature according to the intra-sentence importance feature and the full-text importance feature to obtain a corrected sentence meaning feature containing context information through the refinement self-matching layer in the preset summary generation model;
[0226] decode and process the corrected sentence meaning feature to generate the summary of the text to be extracted through the pointer network decoding layer in the preset summary generation model.
[0227] In a possible implementation of the present application, the generation unit 504 is further configured to:
[0228] extract the importance feature of the target sentence according to the corrected sentence meaning feature and the full-text feature through the pointer network decoding layer in the preset summary generation model;
[0229] predict the importance score of the target sentence according to the importance feature through the pointer network decoding layer;
[0230] generate the summary of the text to be extracted according to the importance score through the pointer network decoding layer.
[0231] In a possible implementation of the present application, the generation unit 504 is further configured to:
[0232] The pointer network decoding layer in the preset abstract generation model calculates a similarity between the modified semantic feature and the full-text feature according to the modified semantic feature and the full-text feature;
[0233] The pointer network decoding layer determines a second context vector of the target sentence according to the similarity and the full-text feature.
[0234] The pointer network decoding layer extracts an importance feature of the target sentence according to the second context vector and the full-text feature.
[0235] In a specific implementation, the units can be implemented as independent entities, or combined as one or more entities, and the specific implementation of the units can refer to the method embodiments.
[0236] The text abstract generation apparatus can perform the method embodiments of the present application. Figures 1 to 6 According to the steps in the text abstract generation method, the method embodiments of the present application can be implemented. Figures 1 to 6 The beneficial effects of the text abstract generation method can be achieved, and the details are described above.
[0237] In addition, in order to better implement the text abstract generation method, the text abstract generation device is further provided based on the text abstract generation method. Figure 8 , Figure 8 A structural schematic diagram of the text abstract generation device is shown, and specifically, the text abstract generation device provided by the embodiment of the present application includes a processor 601, which is used to execute the computer program stored in the memory 602 to realize the functions of the method embodiments of the present application. Figures 1 to 6 According to the steps in the text abstract generation method; or the processor 601 is used to execute the computer program stored in the memory 602 to realize the functions of the units in the embodiment. Figure 7 According to the steps in the text abstract generation method; or the processor 601 is used to execute the computer program stored in the memory 602 to realize the functions of the units in the embodiment.
[0238] For example, the computer program can be divided into one or more modules / units, and the one or more modules / units are stored in the memory 602 and executed by the processor 601 to complete the embodiments of the present application. One or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program in the computer device.
[0239] The text summarization device may include, but is not limited to, processor 601 and memory 602. Those skilled in the art will understand that the illustrations are merely examples of a text summarization device and do not constitute a limitation on the device. It may include more or fewer components than illustrated, or combine certain components, or different components, such as electronic devices. It may also include input / output devices, network access devices, buses, etc., with processor 601, memory 602, input / output devices, and network access devices connected via a bus.
[0240] The processor 601 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the text summarization generation device, connecting all parts of the device through various interfaces and routes.
[0241] The memory 602 can be used to store computer programs and / or modules. The processor 601 implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory 602 and by calling data stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created based on the use of the text digest generation device (such as audio data, video data, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0242] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the text summarizing device, text summarizing equipment, and their corresponding units described above can be found in the following references: Figures 1 to 6Corresponding to the description of the text abstract generation method of any embodiment, details are not repeated here.
[0243] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by related hardware controlled by the instructions, which can be stored in a computer storage medium and loaded and executed by a processor.
[0244] To this end, the embodiment of the present application provides a computer storage medium, which stores a plurality of instructions capable of being loaded by a processor to execute the method of the present application as Figures 1 to 6 Corresponding to the steps in the text abstract generation method of any embodiment, the specific operation can be referred to the description of the text abstract generation method of any embodiment as Figures 1 to 6 Corresponding to the description of the text abstract generation method of any embodiment, details are not repeated here.
[0245] The computer storage medium can include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0246] Due to the instructions stored in the computer storage medium, the method of the present application as Figures 1 to 6 Corresponding to the steps in the text abstract generation method of any embodiment, the specific operation can be referred to the description of the text abstract generation method of any embodiment as Figures 1 to 6 Corresponding to the beneficial effects of the text abstract generation method of any embodiment, details are described above, and details are not repeated here.
[0247] The text abstract generation method, device, equipment and computer storage medium provided by the embodiment of the present application are described in detail above, and the principle and implementation manner of the present application are described by applying specific examples; the above embodiment is only used to help understand the method and core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range will be changed; in conclusion, the content of the specification should not be understood as the limitation of the present application.
Claims
1. A method for generating a text summary, characterized by, The method comprises: processing the text to be extracted to obtain a sentence meaning feature of a target sentence in the text to be extracted and a full-text feature of the text to be extracted; matching each word feature in the sentence meaning feature to obtain an intra-sentence importance feature of the target sentence; the intra-sentence importance feature refers to the importance distribution feature of each word in the target sentence for expressing the sentence meaning without using the relationship between the target sentence and other sentences in the text to be extracted; matching the sentence meaning feature and the full-text feature to obtain a full-text importance feature of the target sentence in the text to be extracted; generating a summary of the text to be extracted according to the intra-sentence importance feature and the full-text importance feature; the matching each word feature in the sentence meaning feature to obtain the intra-sentence importance feature of the target sentence comprises: matching each word feature in the sentence meaning feature to calculate semantic center information and attention distribution information of the target sentence; the semantic center information refers to the information of the most important word in the target sentence; the attention distribution information refers to the distribution scope of the importance of the words in the target sentence; extracting the intra-sentence importance feature of the target sentence according to the semantic center information and the attention distribution information.
2. The text summarization generation method of claim 1, wherein, the matching each word feature in the sentence meaning feature to calculate the semantic center information and the attention distribution information of the target sentence comprises: matching each word feature in the sentence meaning feature to calculate the semantic center information and the attention distribution information of the target sentence through a refinement self-matching layer in a preset summary generation model; the extracting the intra-sentence importance feature of the target sentence according to the semantic center information and the attention distribution information comprises: extracting the intra-sentence importance feature of the target sentence according to the semantic center information and the attention distribution information through the refinement self-matching layer and a pointer network decoding layer in the preset summary generation model.
3. The text summarization generation method of claim 1, wherein, the generating the summary of the text to be extracted according to the intra-sentence importance feature and the full-text importance feature comprises: processing the sentence meaning feature according to the intra-sentence importance feature and the full-text importance feature through a refinement self-matching layer in a preset summary generation model to obtain a first context vector of the target sentence; extracting a candidate sentence feature corresponding to the target sentence according to the first context vector and the sentence meaning feature through the refinement self-matching layer, wherein the candidate sentence feature is a feature of a sentence in the text to be extracted except the target sentence; generating the summary of the text to be extracted according to the candidate sentence feature and the sentence meaning feature through the refinement self-matching layer and a pointer network decoding layer in the preset summary generation model.
4. The text summarization generation method of claim 3, wherein, the generating the summary of the text to be extracted according to the candidate sentence feature and the sentence meaning feature comprises: calculating an important information proportion of the target sentence according to the candidate sentence feature and the sentence meaning feature through the refinement self-matching layer. The summary of the text to be extracted is generated by using the refined self-matching layer and the pointer network decoding layer in the preset summary generation model, based on the weight of important information, the semantic features, and the features of the sentence to be selected.
5. The text summarization generation method of claim 1, wherein, The step of generating a summary of the text to be extracted based on the intra-sentence importance features and the full-text importance features includes: By using a refined self-matching layer in a pre-defined summary generation model, the sentence meaning features are modified based on the intra-sentence importance features and the full-text importance features to obtain modified sentence meaning features that include contextual information. The pointer network decoding layer in the preset summary generation model decodes the modified semantic features to generate a summary of the text to be extracted.
6. The text summarization generation method of claim 5, wherein, The step of decoding the modified semantic features through the pointer network decoding layer in the preset summary generation model to generate a summary of the text to be extracted includes: The importance features of the target sentence are extracted through the pointer network decoding layer in the preset summary generation model, based on the corrected semantic features and the full-text features. The importance score of the target sentence is predicted based on the importance features through the pointer network decoding layer. The pointer network decoding layer generates a summary of the text to be extracted based on the importance score.
7. The text summarization generation method of claim 6, wherein, The step of extracting importance features of the target sentence through the pointer network decoding layer in the preset summary generation model, based on the corrected semantic features and the full-text features, includes: The similarity between the modified sentence meaning features and the full text features is calculated by using the pointer network decoding layer in the preset summary generation model, based on the modified sentence meaning features and the full text features. The second context vector of the target sentence is determined by the pointer network decoding layer based on the similarity and the full-text features. The importance features of the target sentence are extracted through the pointer network decoding layer based on the second context vector and the full-text features.
8. A text abstract generation apparatus characterized by comprising: include: The processing unit is used to process the text to be extracted to obtain the semantic features of the target sentence in the text to be extracted, as well as the full-text features of the text to be extracted. The self-matching unit is used to match the word features in the semantic features to obtain the intra-sentence importance features of the target sentence; The intra-sentence importance feature refers to the distribution of the importance of each word in the target sentence in expressing the meaning of the sentence, using only the target sentence and without utilizing the relationship between the target sentence and other sentences in the text to be extracted. A global matching unit is used to match the semantic features and the full-text features to obtain the full-text importance features of the target sentence in the text to be extracted. A generation unit is used to generate a summary of the text to be extracted based on the intra-sentence importance features and the full-text importance features; The self-matching unit is specifically used for: The semantic features of each word in the sentence meaning features are matched to calculate the semantic center information and attention distribution information of the target sentence; the semantic center information refers to the information of the most important word in the target sentence. The attention distribution information refers to a distribution scope of importance of words in the target sentence. According to the semantic center information and the attention distribution information, an intra-sentence importance feature of the target sentence is extracted.
9. A text abstract generation device characterized by comprising: The method comprises a processor and a memory, wherein the memory stores a computer program, and the processor invokes the computer program in the memory to execute the text summary generation method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that, A computer program is stored on the memory, and the computer program is loaded by the processor to execute the steps in the text summary generation method according to any one of claims 1 to 7.