Text summary generation method and system based on heterogeneous graph neural network
In text summary generation through heterogeneous graph neural networks, the graph attention network is used to iteratively update information between words, sentences and document nodes, which solves the problem of difficulty in capturing long-distance sentence dependencies in the existing technology and improves the accuracy of the summary. Generality and importance improve the accuracy of summary extraction.
Patent Information
- Application Number
- CN202111203728.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-15
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-10-15
AI Technical Summary
Existing automatic text summarization technologies are difficult to fully capture the dependencies between long-distance sentences, resulting in generated summaries that are insufficient in generality and importance.
Using a method based on heterogeneous graph neural networks, information is iteratively updated between word nodes, sentence nodes and document nodes through the graph attention network, and rich inter-sentence relationships are constructed to generate summaries.
It improves the generality and importance of the summary, solves the problem that traditional models are difficult to capture long-distance sentence dependencies, and improves the accuracy of summary extraction.
Smart Images

Figure CN114091429B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automatic text summarization, and in particular to a text summary generation method and system based on heterogeneous graph neural network. Background Art
[0002] The statements in this section merely mention background art related to the present invention and do not necessarily constitute prior art.
[0003] With the development of society, people are overwhelmed by all kinds of information. In particular, most of the information often exists in the form of text. For example, articles of public accounts pushed in WeChat, hot search information in Weibo, and news in major news websites. Faced with such a huge amount of text information on the Internet, it is unrealistic to rely solely on manual processing. Therefore, this application requires a technology to automatically extract an important part of these text information as a summary to save people's precious time. In order to help people save time and no longer spend precious time reading lengthy articles, automated text summarization technology came into being.
[0004] Obviously, the goal of automatic text summarization is to generate concise sentences to replace lengthy original texts. At present, automatic text summarization can be divided into two types, one is extractive summarization and the other is generative summarization. Extractive summarization refers to selecting original sentences that are considered important from the original article and combining these original sentences to generate the final summary. In contrast, the sentences in the summary generated by the generative summary method are not simply selected from the original text, but are regenerated from scratch after learning the original text through the model. These two methods each have their own advantages and disadvantages. The advantage of generative summarization is that the generated sentences are reorganized and can be combined with various information in the original text to construct new sentences; and its disadvantage is that the generated sentences will face grammatical problems and even authenticity problems. The advantage of extractive summarization is that the generated sentences are extracted from the original text, so there will be no grammatical problems and authenticity problems; but its disadvantages are also very obvious, because the final summaries are all original sentences selected from the original text, so these sentences are often not very general and are relatively rigid.
[0005] Due to the rapid development of deep learning, many models adopt the structure of deep neural networks, such as long short-term memory (LSTM), Transformer, etc. Despite their success, there is a significant limitation that it is difficult for them to fully capture the dependencies of long-distance sentences. They simply load sentences into the model for training according to the order of sentences in the original text. Therefore, they cannot fully understand the meaning of this long article. Their performance in automatic indicators (such as ROUGE) has reached a certain level, and it seems difficult to improve further. To solve this problem, many researchers have conducted a large number of experiments, among which the method of extractive summarization using graph neural networks has made great progress. However, choosing a suitable graph structure for extractive summarization is also a challenging task. Summary of the invention
[0006] In order to address the deficiencies of the prior art, the present invention provides a text summary generation method and system based on a heterogeneous graph neural network; a heterogeneous graph network is selected to model inter-sentence relationships, and a graph attention network is selected to update the information of nodes of different granularities in terms of node update method. Secondly, the present application no longer only uses sentences as objects to model inter-sentence relationships, but also treats the entire document as a node type. In this way, there are three types of nodes in the heterogeneous graph network of the present application: word nodes, sentence nodes, and document nodes. These three types of nodes are continuously iterated and updated through the graph attention mechanism, and finally the present application selects sentence nodes that incorporate rich information to generate the final document summary.
[0007] In a first aspect, the present invention provides a text summary generation method based on a heterogeneous graph neural network;
[0008] The text summary generation method based on heterogeneous graph neural network includes:
[0009] Get the document to be processed; convert the document to be processed into corresponding document tensor, sentence tensor and word tensor;
[0010] Using document tensors, sentence tensors, and word tensors, the nodes of the heterogeneous graph network are initialized; wherein the heterogeneous graph network includes document nodes, sentence nodes, and word nodes;
[0011] Iteratively update the nodes of heterogeneous graph networks;
[0012] Extract the sentence nodes of the iteratively updated heterogeneous graph network, and make up for the inter-sentence relationship of the extracted sentence nodes;
[0013] The final summary sentence is obtained based on the sentences that make up for the relationship between sentences.
[0014] In a second aspect, the present invention provides a text summary generation system based on a heterogeneous graph neural network;
[0015] The text summary generation system based on heterogeneous graph neural network includes:
[0016] A conversion module is configured to: obtain a document to be processed; convert the document to be processed into corresponding document tensors, sentence tensors and word tensors;
[0017] An initialization module, configured to: initialize nodes of a heterogeneous graph network using a document tensor, a sentence tensor, and a word tensor; wherein the heterogeneous graph network includes document nodes, sentence nodes, and word nodes;
[0018] An update module, configured to: iteratively update nodes of the heterogeneous graph network;
[0019] A compensation module is configured to: extract sentence nodes from the iteratively updated heterogeneous graph network, and perform inter-sentence relationship compensation on the extracted sentence nodes;
[0020] The generation module is configured to obtain a final summary sentence according to the sentences that make up for the relationship between sentences.
[0021] In a third aspect, the present invention further provides an electronic device, comprising:
[0022] a memory for non-transitory storage of computer-readable instructions; and
[0023] a processor for executing the computer readable instructions,
[0024] When the computer-readable instructions are executed by the processor, the method described in the first aspect is executed.
[0025] In a fourth aspect, the present invention further provides a storage medium that non-temporarily stores computer-readable instructions, wherein when the non-temporary computer-readable instructions are executed by a computer, the instructions of the method described in the first aspect are executed.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] The model of this application uses information transmission between nodes of different granularities and graph attention networks to solve the problem that traditional models are difficult to capture the dependency relationship between long-distance sentences. This plays a key role in selecting sentences with greater generalization and importance as summary sentences. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0029] Figure 1A model diagram of an embodiment of the present invention;
[0030] Figure 2 It is a schematic diagram of the update method of nodes of different granularities in a heterogeneous graph;
[0031] Among them, ① means using sentence nodes to update document nodes. ② means using document nodes to update sentence nodes. ③ means using sentence nodes to update word nodes. ④ means using word nodes to update sentence nodes. DETAILED DESCRIPTION
[0032] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0033] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0034] In this embodiment, all data is obtained in compliance with laws and regulations and based on the user's consent, and is used legally.
[0035] In recent years, graph neural networks have achieved good results in many tasks. Graph Convolutional Networks (GCN) and Graph Attention Networks (GAT) have performed particularly well. However, GCN has certain shortcomings when processing dynamic graphs, and it is not convenient to assign different weights to adjacent nodes. GAT is more flexible in dealing with these problems.
[0036] Embodiment 1
[0037] This embodiment provides a text summary generation method based on heterogeneous graph neural network;
[0038] The text summary generation method based on heterogeneous graph neural network includes:
[0039] S101: Obtain a document to be processed; convert the document to be processed into corresponding document tensors, sentence tensors and word tensors;
[0040] S102: Initialize the nodes of the heterogeneous graph network using the document tensor, the sentence tensor and the word tensor; wherein the heterogeneous graph network includes document nodes, sentence nodes and word nodes;
[0041] S103: Iteratively update the nodes of the heterogeneous graph network;
[0042] S104: extracting sentence nodes from the iteratively updated heterogeneous graph network, and performing inter-sentence relationship compensation on the extracted sentence nodes;
[0043] S105: Obtain a final summary sentence based on the sentences that make up for the relationship between sentences.
[0044] Furthermore, the S101: converting the document to be processed into corresponding document tensors, sentence tensors and word tensors; specifically includes:
[0045] The encoder is used to convert the document to be processed into corresponding document tensors, sentence tensors, and word tensors.
[0046] Wherein, the encoder adopts Xlnet encoder.
[0047] Obviously, text summarization is a task of processing long documents. Therefore, in order to better obtain more information representation of long documents, Xlnet is selected to encode documents, sentences, and words. This is because when selecting the encoder, it is known that Xlnet is more suitable for encoding long document inputs than pre-trained models such as Glove and Bert. After Xlnet embedding representation, the document, sentence, and word representations used for graph node initialization are obtained.
[0048] Further, the S102: heterogeneous graph network includes document nodes, sentence nodes and word nodes; wherein a graph G is used to represent a document, where G = {V, E}. Wherein V represents a node in the graph, and E represents an edge. In addition, the node set V = {Vw, Vs, Vd}, where Vw represents a word node set, Vs represents a sentence node set, and Vd represents a document set.
[0049] In a graph structure, if a document has n different words, then there are n word nodes in the graph.
[0050] Just like word nodes, create sentence nodes for the graph. There will be as many sentence nodes as there are sentences.
[0051] Document node, of which there is obviously only one.
[0052] Another element in the set E={Eds,Esw}, where Eds represents the edge between the document node and the sentence node, and Esw represents the edge between the sentence node and the word node.
[0053] If sentence si contains wj, an undirected edge will be added to connect si and wj.
[0054] It is precisely because of this that more connections can be established between sentences compared to traditional recurrent neural network models. After traversing all word nodes, each word node is connected to one or several sentence nodes.
[0055] Use the obtained representations of documents, sentences, and words to initialize the heterogeneous graph network. Here, Wd, Ws, and Ww represent the feature representations of documents, sentences, and words, respectively. Document, sentence, and word nodes will be initialized using Wd, Ws, and Ww.
[0056] Furthermore, the S103: iteratively updating the nodes of the heterogeneous graph network specifically includes:
[0057] S1031: Use sentence nodes to update document nodes;
[0058] S1032: Use the document node to update the sentence node;
[0059] S1033: Use sentence nodes to update word nodes;
[0060] S1034: Use word nodes to update sentence nodes;
[0061] S1035: Repeat S1031 to S1034.
[0062] S1031 to S1034 are one round of updates, and the above updating process is repeated twice after completion, in order to fully model the relationship between sentences.
[0063] The updating of document nodes using sentence nodes, the updating of sentence nodes using document nodes, the updating of word nodes using sentence nodes, or the updating of sentence nodes using word nodes are all implemented using a graph attention network.
[0064] The Graph Attention Network (GAT) will be used to update the information in the nodes. In each round of iterative updates, the nodes will be updated using the neighboring nodes of the updated node. This means that the i-th node h i Update h by using the representation of all neighbor nodes i .
[0065] Use document nodes to update sentence nodes. The reason for this is that during the update process of the graph attention network GAT, the attention mechanism will better transfer the information in the document node to the sentence node, and the sentence node can be better used to predict the label.
[0066] The second reason for using document nodes is that when constructing the loss function, the cosine similarity between the representation of the document node and the representation of each sentence node is used to make an important reference standard for the model to update the parameters.
[0067] The update formula of the graph attention network is as follows:
[0068] e ij=a([Wh i ||Wh j ]),j∈N i (1)
[0069]
[0070]
[0071] Among them, i and j represent the i-th and j-th nodes respectively, α ij is the attention weight coefficient between two connected nodes, and W is a trainable weight. In formula (1), [·||·] is the concatenation operation and a is the mapping operation.
[0072] Then use SoftMax to calculate the correlation coefficient e ij Normalize as shown in formula (2).
[0073] The attention coefficient is obtained by formula (1) and formula (2). Now the weighted sum of the attention coefficients of all neighbor nodes is added, as shown in formula (3), where σ is the sigmoid function and Ni is the set node of the i-th neighbor node.
[0074] Although I got h i However, in order to better capture information, the graph attention network uses a multi-head attention network to enhance the ability of the model of this application to extract important information, as shown below:
[0075]
[0076] K represents the number of heads of multi-head attention, σ is the sigmoid function, and α ij is the attention weight coefficient between two connected nodes, W is the trainable weight, i and j are the i-th and j-th nodes, h j Represents the hidden state of the jth node. In the GAT layer, the detailed update process is as follows Figure 2 shown.
[0077] First, since the attention mechanism is used, it is better to use the attention mechanism to interact between the part and the whole. Obviously, the whole here represents the entire document, and the part represents a sentence. Therefore, the document node will be updated by each sentence node connected to it. Conversely, Figure 2As shown by the dotted line ② in the middle, the document node is then used to update the sentence node. Obviously, in one graph, there is only one document node connected to the sentence node. In this way, after each sentence node is updated by the document node, a global representation and a local representation are obtained. Experimental results show that this updating method does improve the accuracy of summary extraction. Next, the word node Wi will be updated by the sentence node Sn. Of course, the word node Wi may not only be updated by Sn, but other sentence nodes connected to Wi will also participate in this process. Here, this application only uses one node to illustrate the update process. Finally, the sentence node S1 will be updated by the word node Wi containing other sentence node information.
[0078] The above process not only illustrates how information is transmitted in the graph, but also how two sentence nodes without edges transmit information. Note that the arrows in the graph only indicate the direction of information transmission at a certain moment, and do not mean that the graph of this application is a directed graph.
[0079] Furthermore, the S104: extracting sentence nodes from the iteratively updated heterogeneous graph network, and performing inter-sentence relationship compensation on the extracted sentence nodes;
[0080] The bidirectional gate recurrent unit (Bi-GRU) is used to supplement the inter-sentence relationship of the extracted sentence nodes.
[0081] Since the sentence nodes mentioned above are updated indirectly through word nodes as intermediaries, and the purpose of this application is to use these sentence nodes to select the final summary sentence, this application takes out these sentence nodes and uses Bi-GRU to model their inter-sentence relationship to make up for the lack of indirect information transmission.
[0082] After iteratively updating the representation of documents, sentences, and words in GAT, each node contains more information than the node information when it was just initialized. The sentence node can be directly taken out for prediction. However, considering that the information of the Sn node is not directly transmitted to S1, but passes through the intermediate node Wi. The present application believes that this indirect transmission method may cause some important information between the two sentence nodes to be lost. Therefore, GRU is used to further process the representation of the sentence node. Then, the sentence representation processed by GRU is used as the final output of the prediction.
[0083] Furthermore, the S105: obtaining a final summary sentence according to the sentences that make up for the relationship between sentences.
[0084] According to the sentences that make up for the relationship between sentences, a linear transformation layer is used to process to obtain a two-dimensional tensor, which represents the probability of a sentence being selected as a summary. One or more sentences with a probability greater than a set threshold are selected to obtain a final summary sentence.
[0085] When multiple sentences are selected based on probability, the multiple sentences are sorted according to the order in which they appear in the document to obtain the final summary sentence.
[0086] Furthermore, the methods S101 to S104 are implemented using a trained model.
[0087] Among them, the model,its structure includes: an encoder, a graph attention network, a Bi-GRU layer, a linear transformation layer, and an output layer connected in sequence.
[0088] Among them, the training steps of the trained model include:
[0089] Constructing a training set; the training set is a document with a known summary;
[0090] The training set is input into the model for training. When the total loss function no longer decreases, the training is stopped to obtain the trained model.
[0091] The total loss function is the sum of the first loss function and the second loss function;
[0092] Among them, the first loss function is the cross entropy loss function;
[0093] Among them, the second loss function is:
[0094] L=max(0,f(d,s)) (5)
[0095] Where f(d,s)=cosine(d,s), d and s represent the embedding of documents and sentences respectively.
[0096] After the representations of the sentence nodes are processed by the GRU, these representations are used to make predictions.
[0097] Embodiment 2
[0098] This embodiment provides a text summary generation system based on heterogeneous graph neural network;
[0099] The text summary generation system based on heterogeneous graph neural network includes:
[0100] A conversion module is configured to: obtain a document to be processed; convert the document to be processed into corresponding document tensors, sentence tensors and word tensors;
[0101] An initialization module, configured to: initialize nodes of a heterogeneous graph network using a document tensor, a sentence tensor, and a word tensor; wherein the heterogeneous graph network includes document nodes, sentence nodes, and word nodes;
[0102] An update module, configured to: iteratively update nodes of the heterogeneous graph network;
[0103] A compensation module is configured to: extract sentence nodes from the iteratively updated heterogeneous graph network, and perform inter-sentence relationship compensation on the extracted sentence nodes;
[0104] The generation module is configured to obtain a final summary sentence according to the sentences that make up for the relationship between sentences.
[0105] It should be noted that the above-mentioned conversion module, initialization module, update module, compensation module and generation module correspond to steps S101 to S105 in Embodiment 1, and the examples and application scenarios implemented by the above-mentioned modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Embodiment 1. It should be noted that the above-mentioned modules as part of the system can be executed in a computer system such as a set of computer executable instructions.
[0106] The description of each embodiment in the above embodiments has different emphases. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0107] The proposed system can be implemented in other ways. For example, the system embodiment described above is only illustrative, and the division of the modules is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0108] Embodiment 3
[0109] This embodiment also provides an electronic device, including: one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are stored in the memory. When the electronic device is running, the processor executes the one or more computer programs stored in the memory so that the electronic device executes the method described in the above embodiment one.
[0110] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0111] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0112] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.
[0113] The method in the first embodiment can be directly embodied as a hardware processor, or a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
[0114] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with this embodiment can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0115] Embodiment 4
[0116] This embodiment further provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the method described in the first embodiment is completed.
[0117] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A text summary generation method based on heterogeneous graph neural network, characterized by: include: Get the documents to be processed; Convert the document to be processed into corresponding document tensors, sentence tensors and word tensors; Using document tensors, sentence tensors, and word tensors, the nodes of the heterogeneous graph network are initialized; wherein the heterogeneous graph network includes document nodes, sentence nodes, and word nodes; Iteratively update the nodes of heterogeneous graph networks; Extract the sentence nodes of the iteratively updated heterogeneous graph network, and use the bidirectional gated recurrent unit to make up for the inter-sentence relationship of the extracted sentence nodes. Use the bidirectional gated recurrent unit to model their inter-sentence relationship to make up for the lack of indirect information transmission; According to the sentences that make up for the relationship between sentences, a linear transformation layer is used to process to obtain a two-dimensional tensor, which represents the probability of a sentence being selected as a summary. One or more sentences with a probability greater than a set threshold are selected to obtain a final summary sentence.
2. The method for generating text summarization based on heterogeneous graph neural network according to claim 1, characterized in that: Convert the document to be processed into corresponding document tensors, sentence tensors and word tensors; specifically including: The encoder is used to convert the document to be processed into corresponding document tensors, sentence tensors, and word tensors.
3. The method for generating text summarization based on heterogeneous graph neural network according to claim 1, characterized in that: Iteratively update the nodes of the heterogeneous graph network; specifically including: Use sentence nodes to update document nodes; Use the document node to update the sentence node; Use sentence nodes to update word nodes; Use word nodes to update sentence nodes; Repeat the above steps.
4. The method for generating text summarization based on heterogeneous graph neural network as claimed in claim 3, characterized in that: Using sentence nodes to update document nodes, using document nodes to update sentence nodes, using sentence nodes to update word nodes, or using word nodes to update sentence nodes are all implemented using graph attention networks.
5. The method for generating text summarization based on heterogeneous graph neural network according to claim 1, characterized in that: Extract the sentence nodes of the iteratively updated heterogeneous graph network, and make up for the inter-sentence relationship of the extracted sentence nodes; Use bidirectional gated recurrent units to supplement the inter-sentence relations of the extracted sentence nodes.
6. The method for generating text summarization based on heterogeneous graph neural network according to claim 1, characterized in that: The method is implemented using a trained model; wherein the model comprises: an encoder, a graph attention network, a Bi-GRU layer, a linear transformation layer and an output layer connected in sequence; Among them, the training steps of the trained model include: Constructing a training set; the training set is a document with a known summary; The training set is input into the model for training. When the total loss function no longer decreases, the training is stopped to obtain the trained model.
7. A text summary generation system based on heterogeneous graph neural network, characterized by: include: The conversion module is configured to: obtain a document to be processed; Convert the document to be processed into corresponding document tensors, sentence tensors and word tensors; An initialization module, configured to: initialize nodes of a heterogeneous graph network using a document tensor, a sentence tensor, and a word tensor; wherein the heterogeneous graph network includes document nodes, sentence nodes, and word nodes; An update module, configured to: iteratively update nodes of the heterogeneous graph network; A compensation module is configured to: extract sentence nodes from the iteratively updated heterogeneous graph network, and perform inter-sentence relationship compensation on the extracted sentence nodes; The generation module is configured to: process the sentences that make up for the relationship between sentences with a linear transformation layer to obtain a two-dimensional tensor, wherein the two-dimensional tensor represents the probability of a sentence being selected as a summary, select one or more sentences whose probability is greater than a set threshold, and obtain a final summary sentence.
8. An electronic device, comprising: a memory for non-transitory storage of computer readable instructions; as well as a processor for executing the computer readable instructions, Wherein, when the computer-readable instructions are executed by the processor, the method described in any one of claims 1 to 6 is executed.
9. A storage medium, characterized in that it non-temporarily stores computer-readable instructions, wherein: When the non-transitory computer-readable instructions are executed by a computer, the instructions of the method according to any one of claims 1 to 6 are executed.
