Text abstract generation method and device, electronic equipment and storage medium

By encoding and decoding multiple dialogue role texts, the reference error and personal confusion of the text summary generation model in the prior art in the case of multiple dialogue roles is solved, and the accuracy of text summary generation is achieved .

CN119415660APending Publication Date: 2025-02-11PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411677842.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The existing text summary generation model is difficult to accurately judge the dialogue subject when dealing with multiple dialogue roles, resulting in reference errors and personal confusion in the generated text summary, which reduces the accuracy of generating text summary.

Method used

By obtaining sample dialogue text data, the sample dialogue text and dialogue roles are encoded using the encoder of the preset neural network, combined with the decoder to decode the encoding results, generate a predicted text summary, and optimize the model parameters through loss calculation to improve text Accuracy of the abstract.

Benefits of technology

This method can more accurately identify key information and dialogue roles in conversation text, reduce reference errors and personal confusion, and improve the accuracy of generating text summary.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415660A_ABST
    Figure CN119415660A_ABST
Patent Text Reader

Abstract

The invention provides a text abstract generation method and device, electronic equipment and a storage medium, and belongs to the technical field of artificial intelligence, a sample dialogue text is encoded through an encoder of a preset neural network to obtain a first code, and the sample dialogue text and a sample dialogue role are encoded through the encoder to obtain a second code; decoding the first code and the sample text abstract through a decoder of a preset neural network to obtain a predicted text abstract, performing dialogue role prediction according to the second code to obtain a predicted dialogue role, and performing loss calculation according to the predicted text abstract, the predicted dialogue role, the sample dialogue role and the sample text abstract to obtain target loss data, and performing parameter optimization on the preset neural network according to the target loss data to obtain the text abstract generation model, and performing text abstract generation on the target dialogue text through the text abstract generation model to obtain the target text abstract, so that the accuracy of generating the text abstract is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a text summary generation method and device, electronic device and storage medium. Background Art

[0002] A text summary is a concise and accurate summary of the key information in a conversation text. Conversation texts are often informal and lengthy, with natural language phenomena such as repetition, interruption, and hesitation. At the same time, there are multiple dialogue characters in a conversation text. When there are multiple dialogue characters in a conversation text, the existing text summary generation model often has difficulty determining which dialogue character is the subject of the conversation, which will cause the generated text summary to have problems such as reference errors and confusion of person names, resulting in poor accuracy of the generated text summary. Summary of the invention

[0003] The main purpose of the embodiments of the present application is to propose a text summary generation method and its device, electronic device and storage medium, aiming to solve the problems of reference errors and person confusion in text summaries and improve the accuracy of generated text summaries.

[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a text summary generation method, the text summary generation method comprising:

[0005] Acquire sample dialogue text data; the sample dialogue text data includes sample dialogue text, sample dialogue roles and sample text summary;

[0006] The sample dialogue text is encoded by a preset neural network encoder to obtain a first code, and the sample dialogue text and the sample dialogue role are encoded by the preset neural network encoder to obtain a second code;

[0007] Decoding the first code and the sample text summary by a decoder of a preset neural network to obtain a predicted text summary;

[0008] Predicting a dialogue role according to the second encoding to obtain a predicted dialogue role;

[0009] Calculate the loss based on the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data;

[0010] Optimizing parameters of the preset neural network according to the target loss data to train the preset neural network and obtain a text summary generation model;

[0011] Obtain a target conversation text, and generate a text summary for the target conversation text using the text summary generation model to obtain a target text summary.

[0012] In some embodiments, the performing loss calculation according to the predicted text summary, the predicted dialogue role, the sample dialogue role, and the sample text summary to obtain target loss data includes:

[0013] Encoding the sample text summary to obtain a third code;

[0014] A loss calculation is performed based on the first code, the third code, the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data.

[0015] In some embodiments, the performing loss calculation according to the first code, the third code, the predicted text summary, the predicted dialogue role, the sample dialogue role, and the sample text summary to obtain target loss data includes:

[0016] Calculating similarity data between the first code and the third code;

[0017] Calculate summary loss based on the predicted text summary and the sample text summary to obtain summary loss data;

[0018] Calculate the dialogue role loss according to the predicted dialogue role and the sample dialogue role to obtain dialogue role loss data;

[0019] The similarity data, the summary loss data and the dialogue role loss data are summed to obtain the target loss data.

[0020] In some embodiments, the encoder includes a first encoding block and a second encoding block, and encoding the sample conversation text by the encoder of the preset neural network to obtain the first encoding includes:

[0021] Vectorize the sample conversation text to obtain an initial conversation text vector;

[0022] Performing position encoding on the sample conversation text to obtain a position encoding vector;

[0023] Performing feature fusion on the initial dialogue text vector and the position encoding vector to obtain a target dialogue text vector;

[0024] Performing a first encoding on the target dialogue text vector by using the first encoding block to obtain an initial encoding;

[0025] The initial code is subjected to a second encoding by using the second encoding block to obtain the first code.

[0026] In some embodiments, the first encoding block includes a first multi-head self-attention layer and a first feed-forward layer, and performing a first encoding on the target dialogue text vector by the first encoding block to obtain an initial encoding includes:

[0027] Performing attention feature extraction on the target dialogue text vector through the first multi-head self-attention layer to obtain a first attention feature vector;

[0028] Performing feature fusion on the first attention feature vector and the target dialogue text vector to obtain a first dialogue text feature;

[0029] Extracting the first dialogue text feature through the first feed-forward layer to obtain a second dialogue text feature;

[0030] The first dialogue text feature and the second dialogue text feature are subjected to feature fusion to obtain the initial code.

[0031] In some embodiments, the decoder includes a first decoding block and a second decoding block, and the decoder using a preset neural network decodes the first code and the sample text summary to obtain a predicted text summary, including:

[0032] Decoding the first code and the sample text summary by the first decoding block to obtain target text summary features;

[0033] The target text summary feature and the first code are decoded by the second decoding block to obtain the predicted text summary.

[0034] In some embodiments, the first decoding block includes a second multi-head self-attention layer, an encoding-decoding attention layer, and a second feed-forward layer, and the first decoding block decodes the first encoding and the sample text summary to obtain the target text summary feature, including:

[0035] Performing attention feature extraction on the sample text summary through the second multi-head self-attention layer to obtain a second attention feature vector;

[0036] Performing feature fusion on the second attention feature vector and the sample text summary to obtain initial text summary features;

[0037] Performing attention feature extraction on the first encoding and initial text summary features through the encoding and decoding attention layer to obtain a third attention feature vector;

[0038] Performing feature fusion on the third attention feature vector and the initial text summary feature to obtain a first text summary feature;

[0039] Extracting the first text summary feature through the second feed-forward layer to obtain a second text summary feature;

[0040] The first text summary feature and the second text summary feature are fused to obtain the target text summary feature.

[0041] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a text summary generation device, the text summary generation device comprising:

[0042] A sample acquisition module, used to acquire sample dialogue text data; the sample dialogue text data includes sample dialogue text, sample dialogue roles and sample text summary;

[0043] An encoding module, configured to encode the sample dialogue text by using an encoder of a preset neural network to obtain a first code, and to encode the sample dialogue text and the sample dialogue role by using an encoder of the preset neural network to obtain a second code;

[0044] A decoding module, used for decoding the first code and the sample text summary through a decoder of a preset neural network to obtain a predicted text summary;

[0045] A dialogue role prediction module, used for predicting the dialogue role according to the second code to obtain a predicted dialogue role;

[0046] A loss calculation module, used to perform loss calculation according to the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data;

[0047] A training module, used for optimizing parameters of the preset neural network according to the target loss data, so as to train the preset neural network and obtain a text summary generation model;

[0048] The text summary generation module is used to obtain the target dialogue text, generate a text summary for the target dialogue text through the text summary generation model, and obtain a target text summary.

[0049] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and the processor implements the text summary generation method described in the first aspect when executing the computer program.

[0050] To achieve the above-mentioned purpose, the fourth aspect of the embodiments of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the text summary generation method described in the first aspect is implemented.

[0051] The text summary generation method, text summary generation device, electronic device and computer-readable storage medium proposed in the present application can enable the encoder to locate key information in the sample conversation text by encoding the sample conversation text through an encoder. The sample conversation text and the sample conversation role are encoded by the encoder, so that the encoder can identify the conversation role of the conversation text. The first encoding and the sample text summary are decoded by the decoder to guide the decoder to generate a predicted text summary according to the sample text summary. Through this teacher forcing training strategy, the text summary model can identify key sentences in the conversation text and improve the accuracy of text summary generation. The preset neural network is optimized according to the target loss data to train the preset neural network to obtain a text summary generation model, so that the text summary generation model can not only locate key information but also identify conversation roles. The text summary is generated by the text summary generation model, which improves the accuracy of the generated text summary. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 is a flowchart of a text summary generation method provided in an embodiment of the present application;

[0053] Figure 2 yes Figure 1 Flow chart of step S120 in FIG.

[0054] Figure 3 yes Figure 2 Flow chart of step S240 in FIG.

[0055] Figure 4 yes Figure 1 Flow chart of step S130 in FIG.

[0056] Figure 5 yes Figure 4 Flow chart of step S410 in FIG.

[0057] Figure 6 yes Figure 1 Flow chart of step S150 in FIG.

[0058] Figure 7 yes Figure 6 Flowchart of step S620 in FIG.

[0059] Figure 8 It is a structural schematic diagram of a text summary generating device provided in an embodiment of the present application;

[0060] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0062] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0063] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0064] First, some nouns involved in this application are analyzed:

[0065] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0066] Self-attention mechanism: The attention mechanism enables the neural network to focus on a subset of its input (or features), select specific inputs, and can be applied to any type of input regardless of its shape. In the case of limited computing power, the attention mechanism is a resource allocation solution that is the main means to solve the problem of information overload, allocating computing resources to more important tasks.

[0067] Encoder: Converts the input sequence into a vector of fixed length.

[0068] Decoder: Convert the previously generated fixed vector into an output sequence; the input sequence can be text, voice, image, or video; the output sequence can be text or image.

[0069] A text summary is a concise and accurate text summary generated based on the key information in a conversation text. Standard documents generally adopt a regular writing format such as general-specific-summary. The text summary generation model can quickly locate the key sentences in the document. Conversation texts are often informal texts. Conversation texts are usually lengthy and contain natural language phenomena such as repetition, interruption, and hesitation. Key information is usually scattered in each conversation sentence. At the same time, there will be multiple conversation characters in the conversation text. When there are multiple conversation characters in a conversation text, the existing text summary generation model often finds it difficult to determine which conversation character is the subject of the conversation, which will cause the generated text summary to have problems such as reference errors and confusion of persons, making the accuracy of the generated text summary poor.

[0070] Based on this, the embodiments of the present application provide a text summary generation method, a text summary generation device, an electronic device and a computer-readable storage medium, aiming to improve the accuracy of generating text summaries.

[0071] The text summary generation method, text summary generation device, electronic device and computer-readable storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the text summary generation method in the embodiments of the present application is described.

[0072] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0073] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0074] The text summary generation method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The text summary generation method provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the text summary generation method, etc., but is not limited to the above forms.

[0075] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0076] Figure 1 is an optional flowchart of the text summary generation method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S110 to S170.

[0077] Step S110, obtaining sample dialogue text data; the sample dialogue text data includes sample dialogue text, sample dialogue roles and sample text summary;

[0078] Step S120, encoding the sample dialogue text by a preset neural network encoder to obtain a first code, and encoding the sample dialogue text and the sample dialogue role by a preset neural network encoder to obtain a second code;

[0079] Step S130, decoding the first code and the sample text summary by a preset neural network decoder to obtain a predicted text summary;

[0080] Step S140, predicting the dialogue role according to the second code to obtain a predicted dialogue role;

[0081] Step S150, performing loss calculation according to the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data;

[0082] Step S160, optimizing parameters of a preset neural network according to the target loss data to train the preset neural network and obtain a text summary generation model;

[0083] Step S170, obtaining the target conversation text, and generating a text summary for the target conversation text through a text summary generation model to obtain a target text summary.

[0084] In steps S110 to S170 shown in the embodiment of the present application, the sample dialogue text is encoded by an encoder, so that the encoder can extract key sentence features in the sample dialogue text. The sample dialogue text and the sample dialogue roles are encoded by the encoder, so that the encoder can identify the dialogue roles of the dialogue text. The first encoding and the sample text summary are decoded according to the decoder, and the decoder can be guided to generate a predicted text summary according to the sample text summary to improve the accuracy of the generated text summary. The text summary generation model is obtained by training according to the target loss data, so that the text summary generation model can not only locate the key sentences in the dialogue text, but also identify the dialogue roles of the key sentences, avoid confusion of the content and person of the generated text summary, and improve the accuracy of the generated text summary.

[0085] In step S110 of some embodiments, sample dialogue text data is obtained from a corpus database, and the sample dialogue text data includes sample dialogue text, sample dialogue roles, and a sample text summary, wherein the sample dialogue text is a plurality of dialogue sentences, the sample dialogue roles are speakers of the dialogue sentences, and the sample text summary is a brief summary of the sample dialogue text generated based on key information in the dialogue sentences and the speakers.

[0086] The sample conversation text includes N conversation sentences, which are u1, u2, ..., uN. The speakers of these N conversation sentences are z1, z2, ..., zN. The speakers of adjacent conversation sentences can be the same or different. Based on these N conversation sentences and N speakers, a conversation sample D = {(u1, z1), (u2, z2), ..., (uN, zN)} is determined, and the sample text summary of the conversation sample is y.

[0087] See also Figure 2 In some embodiments, the encoder includes a first encoding block and a second encoding block, and step S120 may include but is not limited to steps S210 to S250:

[0088] Step S210, vectorizing the sample conversation text to obtain an initial conversation text vector;

[0089] Step S220, position encoding the sample conversation text to obtain a position encoding vector;

[0090] Step S230, performing feature fusion on the initial dialogue text vector and the position encoding vector to obtain a target dialogue text vector;

[0091] Step S240, performing a first encoding on the target dialogue text vector through a first encoding block to obtain an initial encoding;

[0092] Step S250: performing a second encoding on the initial code by using a second encoding block to obtain a first code.

[0093] In step S210 of some embodiments, the sample conversation text data is input into a preset neural network, which is based on a transformer architecture and can be a translation model based on T5, such as T5base. The preset neural network includes an encoder and a decoder, the encoder is used to encode the data input into the encoder, and the decoder is used to decode the data input into the decoder. All the conversation sentences of the sample conversation text are spliced ​​using the [SEP] separator and input into the encoder of T5 for encoding to obtain a first encoding. When the sample conversation text is encoded using the encoder, the sample conversation text can be vectorized using one-hot encoding or word embedding to convert the text data into a digital vector to obtain an initial conversation text vector.

[0094] In step S220 of some embodiments, the relative position of the sample dialogue text is encoded by the sine function and the cosine function to obtain a position encoding vector. Specifically, the absolute position of each character or word in the dialogue sentence is obtained, the absolute position is encoded in an even dimension by the sine function to obtain a first encoding value of the feature dimension in the even dimension, the absolute position is encoded in an odd dimension by the cosine function to obtain a second encoding value of the feature dimension in the odd dimension, and the position encoding vector of the character or word is obtained according to the first encoding value and the second encoding value. The calculation method of the first encoding value is shown in formula (1), and the calculation method of the second encoding value is shown in formula (2).

[0095]

[0096] Where PE(pos,2i) represents the first encoding value, pos represents the absolute position, 2i represents the even bits of the position encoding vector, PE(pos,2i+1) represents the second encoding value, 2i+1 represents the odd bits of the position encoding vector, and dmodel is the feature dimension of the position encoding vector.

[0097] The position encoding vectors of each character and word in the sample dialogue text are concatenated according to the absolute positions of the characters and words to obtain the position encoding vector of the sample dialogue text.

[0098] In step S230 of some embodiments, since the words or characters in the dialogue sentence are input into the preset neural network at the same time, the position order information of the words or characters will be lost during input, so additional processing is required to enable the preset neural network to know the position and order of the words or characters. By adding the initial dialogue text vector and the position encoding vector in a symmetrical manner, the sample dialogue text carries the position order information, thereby enhancing the preset neural network's perception of position information.

[0099] In step S240 of some embodiments, the first encoding block uses a multi-head self-attention mechanism to enable the encoder to focus on multiple parts of the dialogue sentence at the same time and ignore information that is irrelevant to understanding the dialogue sentence, so as to effectively extract key information in the sample dialogue text and obtain the initial encoding.

[0100] In step S250 of some embodiments, the structure of the first coding block is the same as the structure of the first coding block, and the method of performing the second encoding on the initial encoding by the second coding block refers to step S240, which is not repeated here.

[0101] In order to increase the speaker recognition capability of the preset neural network, two consecutive dialogue sentences are randomly selected from the dialogue sample D, and the two consecutive dialogue sentences are spliced ​​by the [SEP] separator, and the two dialogue sentences and the speakers corresponding to the dialogue sentences are input as a whole to the encoder, and the encoder jointly encodes the sample dialogue text and the sample dialogue role to obtain a second encoding, which is the [CLS] vector obtained by the encoder. The encoding method of the sample dialogue text and the sample dialogue role by the encoder is the same as the encoding method of the sample dialogue text by the encoder, which can refer to steps S210 to S250, and will not be repeated here.

[0102] Through the above steps S210 to S250, key information in the sample conversation text can be extracted so as to generate a text summary based on the key information, thereby improving the accuracy of generating the text summary by improving the accuracy of feature extraction.

[0103] See also Figure 3 In some embodiments, the first encoding block includes a first multi-head self-attention layer and a first feed-forward layer, and step S240 may include but is not limited to steps S310 to S340:

[0104] Step S310, extracting attention features from the target dialogue text vector through a first multi-head self-attention layer to obtain a first attention feature vector;

[0105] Step S320, performing feature fusion on the first attention feature vector and the target dialogue text vector to obtain a first dialogue text feature;

[0106] Step S330, extracting the first dialogue text feature through the first feed-forward layer to obtain the second dialogue text feature;

[0107] Step S340: performing feature fusion on the first dialogue text feature and the second dialogue text feature to obtain an initial code.

[0108] In step S310 of some embodiments, when performing attention feature extraction, a preset first weight matrix is ​​multiplied by the target conversation text vector to obtain a query vector Q, a preset second weight matrix is ​​multiplied by the target conversation text vector to obtain a key vector K, a preset third weight matrix is ​​multiplied by the target conversation text vector to obtain a value vector V, the similarity between the query vector Q and the key vector K of each head is calculated, the similarity of each head is multiplied by the value vector V corresponding to the head to obtain multiple attention vectors, and the multiple attention vectors are concatenated to obtain a first attention feature vector.

[0109] In step S320 of some embodiments, in order to alleviate the gradient vanishing problem and enrich the hierarchy of the dialogue text features, a residual connection is introduced between the input of the first coding block and the output of the first multi-head self-attention layer. Through the residual connection, the first attention feature vector output by the first multi-head self-attention layer and the target dialogue text vector input to the first coding block are feature fused to obtain the first dialogue text feature.

[0110] In step S330 of some embodiments, the first encoding block further includes a first normalization layer, which performs layer normalization processing on the first dialogue text features, and performs feature extraction on the first dialogue text features after the layer normalization processing through the first feed-forward layer to obtain second dialogue text features, wherein the first feed-forward layer is a fully connected network with two linear layers.

[0111] In step S340 of some embodiments, a residual connection exists between the input of the first feedforward layer and the output of the first feedforward layer, and the first dialogue text features input to the first feedforward layer and the second dialogue text features output by the first feedforward layer are feature fused. The first encoding block further includes a second normalization layer, and the fused features are layer normalized by the second normalization layer to obtain an initial encoding.

[0112] Through the above steps S310 to S340, the fusion of deep features and shallow features is promoted, so that the first encoding block can focus on the dialogue text features in the sample dialogue text, thereby improving the accuracy of feature extraction.

[0113] See also Figure 4 In some embodiments, the decoder includes a first decoding block and a second decoding block, and step S130 may include but is not limited to steps S410 to S420:

[0114] Step S410, decoding the first code and the sample text summary by a first decoding block to obtain target text summary features;

[0115] Step S420: decoding the target text summary feature and the first code by a second decoding block to obtain a predicted text summary.

[0116] In step S410 of some embodiments, the sample conversation text is input into the encoder for encoding, and the sample text summary is input into the decoder for decoding. At the same time, the output of the encoder acts on each decoding block of the decoder to guide the decoder to generate a predicted text summary through the sample text summary, thereby improving the accuracy of the generated predicted text summary. The decoder includes a first decoding block and a second decoding block, which are cascaded, and the structures of the two decoding blocks are the same. The first decoding block extracts the summary features of the sample text summary through a multi-head masked self-attention mechanism, and decodes the summary features and the first code output by the encoder through the encoding-decoding attention mechanism to obtain the target text summary features.

[0117] In step S420 of some embodiments, the target text summary feature and the first code are decoded by the second decoding block to obtain a decoded feature, the decoded feature is linearly mapped by a linear layer, and the decoded feature after linear mapping is calculated using a softmax function to obtain a predicted text summary. The decoding method of the second decoding block refers to step S410 and is not repeated here.

[0118] Through the above steps S410 to S420, the decoder can generate a predicted text summary, so as to train a preset neural network according to the predicted text summary, thereby improving the accuracy of generating the text summary.

[0119] See also Figure 5 In some embodiments, the first decoding block includes a second multi-head self-attention layer, an encoding-decoding attention layer, and a second feed-forward layer. Step S410 may also include, but is not limited to, steps S510 to S560:

[0120] Step S510, extracting attention features from the sample text summary through a second multi-head self-attention layer to obtain a second attention feature vector;

[0121] Step S520, performing feature fusion on the second attention feature vector and the sample text summary to obtain initial text summary features;

[0122] Step S530, extracting attention features from the first code and the initial text summary features through the encoding and decoding attention layer to obtain a third attention feature vector;

[0123] Step S540, performing feature fusion on the third attention feature vector and the initial text summary feature to obtain a first text summary feature;

[0124] Step S550, extracting the first text summary feature through the second feed-forward layer to obtain a second text summary feature;

[0125] Step S560: Fusing the first text summary feature and the second text summary feature to obtain a target text summary feature.

[0126] In step S510 of some embodiments, the sample text summary is subjected to text vectorization processing to obtain a sample text summary vector, the sample text summary is subjected to relative position encoding to obtain a summary position encoding vector, and the sample text summary vector and the summary position encoding vector are vector-aligned and added to obtain an initial summary vector. The method of text vectorization processing refers to step S210, and the method of relative position encoding refers to step S220, which will not be repeated here. The initial summary vector is subjected to attention feature extraction through the second multi-head self-attention layer to obtain a third attention feature vector, and the second multi-head self-attention layer is a multi-head attention layer with a mask. Specifically, the preset first weight matrix is ​​multiplied with the initial summary vector to obtain a query vector Q, the preset second weight matrix is ​​multiplied with the initial summary vector to obtain a key vector K, the preset third weight matrix is ​​multiplied with the initial summary vector to obtain a value vector V, the similarity between each head query vector Q and the key vector K is calculated, and the similarity of each head is added to the preset mask of the head, and then multiplied with the value vector V corresponding to the head to obtain multiple attention vectors, and the multiple attention vectors are spliced ​​to obtain a second attention feature vector. The preset mask is a matrix with the upper triangular area (excluding the diagonal) being 0 and the lower triangular area (including the diagonal) being -∞, and the similarity is the same as the matrix size of the preset mask. The preset mask allows the decoder to focus only on information before the current moment, and cannot know future information.

[0127] In step S520 of some embodiments, there is a residual connection between the output and input of the second multi-head self-attention layer, and the second attention feature vector and the initial summary vector are vector-added by the residual connection to perform feature fusion. The first decoding block also includes a third normalization layer, and the fused features are layer-normalized by the third normalization layer to obtain the initial text summary features.

[0128] In step S530 of some embodiments, in the encoding and decoding attention layer, the first encoding is used as the K vector and the V vector respectively, and the initial text summary feature is used as the Q vector to perform attention feature calculation to obtain a third attention feature vector. The method of calculating the attention feature is referred to step S310 and will not be repeated here.

[0129] In step S540 of some embodiments, there is a residual connection between the input and output of the encoding and decoding attention layer, and the third attention feature vector and the initial text summary feature are feature fused through the residual connection. The first decoding block also includes a fourth normalization layer, and the fused features are layer-normalized through the fourth normalization layer to obtain the first text summary feature.

[0130] In step S550 of some embodiments, the first text summary feature is extracted by a second feed-forward layer to obtain a second text summary feature. The second feed-forward layer is a fully connected network with two linear layers.

[0131] In step S560 of some embodiments, there is a residual connection between the input and output of the second feed-forward layer, and the first text summary feature and the second text summary feature are feature fused through the residual connection. The first decoding block also includes a fifth normalization layer, and the fused features are layer normalized through the fifth normalization layer to obtain the target text summary feature.

[0132] The above steps S510 to S560, by fusing the summary features and the attention features, can guide the generator to generate a predictive text summary through the summary prior knowledge of the sample text summary, so as to improve the accuracy of summary generation.

[0133] In step S140 of some embodiments, the second code is input to a multilayer perceptron (MLP), and the MLP determines whether the two sentences belong to the same dialogue role according to the second code. When the two sentences belong to the same dialogue role, the MLP output is 1, and when the two sentences do not belong to the same dialogue role, the MLP output is 0, and the output of the MLP is used as the predicted dialogue role. The MLP includes an input layer, two hidden layers, and an output layer, and different layers of the MLP are fully connected.

[0134] See also Figure 6In some embodiments, step S150 may include but is not limited to steps S610 to S620:

[0135] Step S610, encoding the sample text summary to obtain a third code;

[0136] Step S620, performing loss calculation based on the first code, the third code, the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data.

[0137] In step S610 of some embodiments, since the key information of the conversation is usually scattered in each conversation sentence, it is difficult for the text summary generation model to locate the accurate key information. The embodiment of the present application allows the model to learn long text conversations and conversation summaries at the same time through consistency learning. Specifically, all the conversation sentences (sample conversation text) in the conversation sample D are spliced ​​using the [SEP] delimiter, and the sample conversation text and the sample text summary are respectively encoded by the encoder of the preset neural network to obtain the first code corresponding to the sample conversation text and the third code corresponding to the sample text summary, wherein the first code and the third code are both vectors of the [CLS] label obtained by encoding. The encoding method of the encoder for the sample text summary refers to steps S210 to S250, which will not be repeated here.

[0138] In step S620 of some embodiments, consistency loss data is calculated based on the first encoding and the third encoding, so that the first encoding and the third encoding are aligned in the vector space through the consistency loss data, so that the text summary generation model pays more attention to the key sentences in the dialogue sample. Summary loss data is calculated based on the predicted text summary and the sample text summary, and dialogue role loss data is calculated based on the predicted dialogue role and the sample dialogue role. Target loss data is obtained based on the consistency loss data, summary loss data, and dialogue role loss data.

[0139] Through the above steps S610 to S620, the target loss data can be obtained, so as to adjust the network parameters of the preset neural network according to the target loss data, generate a text summary generation model with higher accuracy, and improve the accuracy of generating text summaries.

[0140] See also Figure 7 In some embodiments, step S620 may include but is not limited to steps S710 to S740:

[0141] Step S710, calculating similarity data between the first code and the third code;

[0142] Step S720, calculating summary loss according to the predicted text summary and the sample text summary to obtain summary loss data;

[0143] Step S730, calculating the dialogue role loss according to the predicted dialogue role and the sample dialogue role to obtain dialogue role loss data;

[0144] Step S740, summing up the similarity data, summary loss data and dialogue role loss data to obtain target loss data.

[0145] In step S710 of some embodiments, a dot product operation is performed on the first code and the third code to obtain similarity data. When the similarity data is larger, it means that the first code and the third code are more similar, and when the similarity data is smaller, it means that the similarity between the first code and the third code is smaller. The similarity data is negatively valued to obtain consistency loss data. By making the first code of the dialogue sample D more similar to the third code of the sample text summary, it can help the preset neural network to identify the key sentences in the dialogue sample.

[0146] In step S720 of some embodiments, a cross entropy loss function is used to calculate summary loss, and a method for calculating summary loss data is shown in formula (3).

[0147]

[0148] Among them, L1 is the summary loss data, y is the sample text summary, To predict text summaries.

[0149] In step S730 of some embodiments, sample dialogue roles of two dialogue sentences are obtained, and dialogue role labels are determined according to the two sample dialogue roles. If the two sample dialogue roles are the same, the dialogue role label is determined to be 1, and if the two sample dialogue roles are different, the dialogue role label is determined to be 0. The dialogue role loss is calculated using the cross entropy loss function, and the calculation method of the dialogue role loss data is shown in formula (4).

[0150]

[0151] Among them, L2 is the dialogue role loss data, z is the dialogue role label, To predict dialogue roles.

[0152] In step S740 of some embodiments, the embodiments of the present application adopt a multi-loss training method to sum the consistency loss data, summary loss data and dialogue role loss data to obtain target loss data.

[0153] The above steps S710 to S740 can ensure the similarity between the first encoding and the third encoding through consistency loss data, ensure the similarity between the predicted text summary and the sample text summary through summary loss data, and enhance the model's recognition ability of speaker changes through dialogue role loss data, thereby improving the accuracy of text summary generated by the text summary generation model.

[0154] In step S160 of some embodiments, the network parameters of the encoder and the decoder are adjusted according to the target loss data to train a preset neural network, and the preset neural network when the target loss data is minimized is used as a text summary generation model.

[0155] In step S170 of some embodiments, a target dialogue text is obtained, the target dialogue text includes dialogue sentences and dialogue roles, the target dialogue text is input into a text summary generation model, the target dialogue text is encoded by an encoder to obtain a text code, and the text code is decoded by a decoder to obtain a target text summary. It should be noted that when the target dialogue text is initially decoded, the multi-head masked self-attention layer of the decoder does not participate in the decoding operation, but directly inputs the text code into the encoding and decoding attention layer of the first decoding block for decoding. When it is not the first decoding, the multi-head masked self-attention layer of the decoder participates in the decoding calculation, and the input of the multi-head masked self-attention layer is the output of the previous decoder.

[0156] The embodiment of the present application adopts T5 as the benchmark translation model, and regards the text summarization task as a text-to-text generation task, wherein T5 includes 6 encoders and 6 decoders, and the 6 encoders and 6 decoders are connected in a cascade manner, and the output of the 6th encoder will act on the input of each decoder. The text summary generation method of the embodiment of the present application includes: obtaining a dialogue sample and a sample dialogue summary, and the dialogue sample includes a plurality of dialogue sentences and the speaker of each dialogue sentence. All dialogue sentences are spliced ​​and input to the encoder for encoding using [SEP], and the output of the previous encoder is used as the input of the next encoder until the 6th encoder outputs the first code corresponding to the dialogue sentence. The decoder generates a predicted dialogue summary through the first code and the sample dialogue summary. Under the teacher forcing strategy, the decoder performs model training based on cross entropy with the goal of minimizing summary loss data.

[0157] In order to increase the model's ability to identify the speaker corresponding to the sentence, a speaker-related self-supervised training loss function is introduced on the basis of the normal summary loss function. Two consecutive dialogue sentences and the speakers of the dialogue sentences are randomly selected from the dialogue sample, and are input into the encoder through [SEP] concatenation for encoding. The [CLS] vector obtained by the encoder is taken out and input into an MLP layer to determine whether the two sentences belong to the same speaker, and the dialogue role loss data is obtained. The dialogue role loss is used as an additional auxiliary loss and accumulated on the summary loss data.

[0158] In order to make the model pay more attention to sentences containing key semantic information, consistency training is introduced. Through consistency constraints, the model automatically focuses on key sentences in the vector space. All dialogue sentences are concatenated using [SEP], and the dialogue sentences and sample dialogue summaries are respectively input into the encoder for contextual semantic feature learning. The [CLS] vectors obtained by encoding the dialogue sentences and the dialogue summaries are taken out, and the similarity between the [CLS] vectors is obtained through dot product. The negative value of the similarity is accumulated as loss data to the existing loss data, so that the higher the similarity between the dialogue sentence encoding and the dialogue summary encoding, the better the model can identify the key sentences of the dialogue sample.

[0159] It is understandable that the encoders for text summarization training, self-supervision training, and consistency training share parameter weights.

[0160] The text summary generation of the embodiment of the present application utilizes the speaker annotations in the dialogue sample, introduces a new self-supervised task to model the speakers belonging to different sentences, and helps the model better track and distinguish the changes of different speakers in the dialogue flow through the speaker judgment task of continuous speech, and helps the model better generate summary sentences with correct person names. By introducing a training method based on consistency loss, using a shared encoder to encode the dialogue text and dialogue summary separately, and using similarity to shorten the distance between the dialogue text and the dialogue summary in the vector space, the model is prompted to pay more attention to the characteristics of key sentences in the dialogue sample, thereby generating more appropriate and accurate summary sentences.

[0161] See also Figure 8 The embodiment of the present application also provides a text summary generation device, which can implement the above-mentioned text summary generation method, and the text summary generation device includes:

[0162] The sample acquisition module 810 is used to acquire sample dialogue text data; the sample dialogue text data includes sample dialogue text, sample dialogue roles and sample text summary;

[0163] An encoding module 820, configured to encode the sample dialogue text by using a preset neural network encoder to obtain a first code, and to encode the sample dialogue text and the sample dialogue role by using a preset neural network encoder to obtain a second code;

[0164] A decoding module 830 is used to decode the first code and the sample text summary through a decoder of a preset neural network to obtain a predicted text summary;

[0165] A dialogue role prediction module 840 is used to predict the dialogue role according to the second code to obtain a predicted dialogue role;

[0166] A loss calculation module 850 is used to calculate the loss according to the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data;

[0167] A training module 860 is used to optimize the parameters of a preset neural network according to the target loss data to train the preset neural network and obtain a text summary generation model;

[0168] The text summary generation module 870 is used to obtain the target dialogue text, generate a text summary for the target dialogue text through the text summary generation model, and obtain a target text summary.

[0169] The specific implementation of the text summary generation device is basically the same as the specific implementation of the above-mentioned text summary generation method, and will not be repeated here.

[0170] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above text summary generation method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0171] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0172] The processor 910 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0173] The memory 920 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 920 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 920, and the processor 910 calls and executes the text summary generation method of the embodiment of this application;

[0174] Input / output interface 930, used to implement information input and output;

[0175] Communication interface 940, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0176] bus 950 , which transmits information between the various components of the device (e.g., processor 910 , memory 920 , input / output interface 930 , and communication interface 940 );

[0177] The processor 910 , the memory 920 , the input / output interface 930 , and the communication interface 940 are connected to each other in communication within the device via a bus 950 .

[0178] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned text summary generation method is implemented.

[0179] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0180] The text summary generation method, text summary generation device, electronic device and computer-readable storage medium provided by the embodiments of the present application can enable the encoder to locate key information in the sample conversation text by encoding the sample conversation text through the encoder. The sample conversation text and the sample conversation role are encoded by the encoder, so that the encoder can identify the conversation role of the conversation text. The first encoding and the sample text summary are decoded by the decoder to guide the decoder to generate a predicted text summary according to the sample text summary. Through this teacher forcing training strategy, the text summary model can identify key sentences in the conversation text, thereby improving the accuracy of text summary generation. The preset neural network is optimized according to the target loss data to train the preset neural network to obtain a text summary generation model, so that the text summary generation model can not only locate key information, but also identify conversation roles. The text summary is generated by the text summary generation model, thereby improving the accuracy of the generated text summary.

[0181] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0182] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0183] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0184] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0185] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0186] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0187] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0188] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0189] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0190] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0191] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A text summary generation method, characterized in that: The method comprises: Acquire sample dialogue text data; the sample dialogue text data includes sample dialogue text, sample dialogue roles and sample text summary; The sample dialogue text is encoded by a preset neural network encoder to obtain a first code, and the sample dialogue text and the sample dialogue role are encoded by the preset neural network encoder to obtain a second code; Decoding the first code and the sample text summary by a decoder of a preset neural network to obtain a predicted text summary; Predicting a dialogue role according to the second encoding to obtain a predicted dialogue role; Calculate the loss based on the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data; Optimizing parameters of the preset neural network according to the target loss data to train the preset neural network and obtain a text summary generation model; Obtain a target conversation text, and generate a text summary for the target conversation text using the text summary generation model to obtain a target text summary.

2. The text summary generation method according to claim 1, characterized in that: The performing loss calculation according to the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data includes: Encoding the sample text summary to obtain a third code; A loss calculation is performed based on the first code, the third code, the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data.

3. The text summary generation method according to claim 2, characterized in that: The step of performing loss calculation according to the first code, the third code, the predicted text summary, the predicted dialogue role, the sample dialogue role, and the sample text summary to obtain target loss data includes: Calculating similarity data between the first code and the third code; Calculate summary loss based on the predicted text summary and the sample text summary to obtain summary loss data; Calculate the dialogue role loss according to the predicted dialogue role and the sample dialogue role to obtain dialogue role loss data; The similarity data, the summary loss data and the dialogue role loss data are summed to obtain the target loss data.

4. The text summary generation method according to claim 1, characterized in that: The encoder includes a first encoding block and a second encoding block, and the encoder using a preset neural network encodes the sample conversation text to obtain a first encoding, including: Vectorize the sample conversation text to obtain an initial conversation text vector; Performing position encoding on the sample conversation text to obtain a position encoding vector; Performing feature fusion on the initial dialogue text vector and the position encoding vector to obtain a target dialogue text vector; Performing a first encoding on the target dialogue text vector by using the first encoding block to obtain an initial encoding; The initial code is subjected to a second encoding by using the second encoding block to obtain the first code.

5. The text summary generation method according to claim 4, characterized in that: The first encoding block includes a first multi-head self-attention layer and a first feedforward layer, and the first encoding is performed on the target dialogue text vector by the first encoding block to obtain an initial encoding, including: Performing attention feature extraction on the target dialogue text vector through the first multi-head self-attention layer to obtain a first attention feature vector; Performing feature fusion on the first attention feature vector and the target dialogue text vector to obtain a first dialogue text feature; Extracting the first dialogue text feature through the first feed-forward layer to obtain a second dialogue text feature; The first dialogue text feature and the second dialogue text feature are subjected to feature fusion to obtain the initial code.

6. The text summary generation method according to any one of claims 1 to 5, characterized in that: The decoder includes a first decoding block and a second decoding block, and the decoder using a preset neural network decodes the first code and the sample text summary to obtain a predicted text summary, including: Decoding the first code and the sample text summary by the first decoding block to obtain target text summary features; The target text summary feature and the first code are decoded by the second decoding block to obtain the predicted text summary.

7. The text summary generation method according to claim 6, characterized in that: The first decoding block includes a second multi-head self-attention layer, an encoding-decoding attention layer, and a second feed-forward layer. The first decoding block decodes the first encoding and the sample text summary to obtain target text summary features, including: Performing attention feature extraction on the sample text summary through the second multi-head self-attention layer to obtain a second attention feature vector; Performing feature fusion on the second attention feature vector and the sample text summary to obtain initial text summary features; Performing attention feature extraction on the first encoding and initial text summary features through the encoding and decoding attention layer to obtain a third attention feature vector; Performing feature fusion on the third attention feature vector and the initial text summary feature to obtain a first text summary feature; Extracting the first text summary feature through the second feed-forward layer to obtain a second text summary feature; The first text summary feature and the second text summary feature are fused to obtain the target text summary feature.

8. A text summary generating device, characterized in that: The device comprises: A sample acquisition module, used to acquire sample dialogue text data; the sample dialogue text data includes sample dialogue text, sample dialogue roles and sample text summary; An encoding module, configured to encode the sample dialogue text by using an encoder of a preset neural network to obtain a first code, and to encode the sample dialogue text and the sample dialogue role by using an encoder of the preset neural network to obtain a second code; A decoding module, used for decoding the first code and the sample text summary through a decoder of a preset neural network to obtain a predicted text summary; A dialogue role prediction module, used for predicting the dialogue role according to the second code to obtain a predicted dialogue role; A loss calculation module, used to perform loss calculation according to the predicted text summary, the predicted dialogue role, the sample dialogue role and the sample text summary to obtain target loss data; A training module, used for optimizing parameters of the preset neural network according to the target loss data, so as to train the preset neural network and obtain a text summary generation model; The text summary generation module is used to obtain the target dialogue text, generate a text summary for the target dialogue text through the text summary generation model, and obtain a target text summary.

9. An electronic device, characterized in that The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the text summary generation method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the text summary generating method according to any one of claims 1 to 7 is implemented.