Text summary generation method based on knowledge graph

By performing information extraction and encoding processing on text data, and combining the word list and copy distribution to generate text summaries, the problem of insufficient accuracy in generating summaries in the existing technology is solved, and higher accuracy and smoothness are achieved.

CN115129812BActive Publication Date: 2024-10-29SHANGHAI INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210712887.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-22
Publication Date
2024-10-29
Estimated Expiration
2042-06-22

AI Technical Summary

Technical Problem

In the existing technology, when a text summary is generated based on a fixed vocabulary, the generated text summary is not accurate enough and cannot effectively extract and express the meaning of the text, resulting in insufficient expression accuracy and smoothness.

Method used

A data set is formed by extracting information from the original data, including titles and knowledge graphs, using encoding processing to generate context vectors, performing weighted calculations based on vocabulary probability distributions and copy distributions, and generating final probability distributions to select candidate outputs, using coverage mechanisms to avoid words Repeat and, if necessary, copy words from the dataset to improve the accuracy of the resulting text summaries.

Benefits of technology

It improves the accuracy of text summary generation. It can judge the vocabulary deficiencies based on context vectors and generate summaries by copying the words in the data set, thereby improving the accuracy and smoothness of the generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115129812B_ABST
    Figure CN115129812B_ABST
Patent Text Reader

Abstract

The present invention provides a method for generating a text summary based on a knowledge graph, comprising the following steps: extracting information from raw data to form a data set, encoding the title and knowledge graph of a data in the data set respectively to obtain a first encoding vector and a second encoding vector; splicing the first encoding vector and the second encoding vector to obtain a context vector; combining the context vector and the output of each time step to calculate the vocabulary probability distribution, the replication probability and the replication distribution; performing weighted calculation on the vocabulary probability distribution and the replication distribution to obtain the final probability distribution. The present invention can generate a corresponding text summary based on the title and the knowledge graph, and can also determine whether there are enough words in the fixed vocabulary to generate the corresponding text summary based on the context vector. When the fixed vocabulary is insufficient, the words in the dataset can also be copied to generate the text summary, thereby improving the accuracy of text summary generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to a text summary generation method based on a knowledge graph. Background Art

[0002] In the field of text summarization, the model's understanding of the text is crucial, which is supported by the amount of training data and the complexity of the deep model. It can better guarantee the fluency of the generated language and the accuracy of the semantics, and is a key factor affecting the usability of the generative model.

[0003] The emergence of graph neural networks has provided a huge space for processing graph-structured data such as knowledge graphs. Previous data forms (such as plain text data, tabular data, etc.) have shortcomings such as difficulty in extracting effective information and difficulty in expressing it. Sometimes a lot of operations are required, which is time-consuming and labor-intensive, and it is often impossible to accurately extract the meaning of the text, which has defects in practical applications.

[0004] With the rapid development of graph neural networks and attention mechanisms, they can better solve the problems of information extraction and representation difficulties in the past, provide effective technical support for model updates, and improve the accuracy and fluency of the generated text. However, the current graph neural networks and attention mechanisms have the following problems:

[0005] Generating text summaries based solely on a fixed vocabulary results in inaccurate text summaries. Summary of the invention

[0006] In view of the defects in the prior art, the purpose of the present invention is to provide a text summary generation method and method based on knowledge graph.

[0007] The present invention provides a text summary generation method based on knowledge graph, comprising the following steps:

[0008] Extracting information from the original data to form a data set, wherein each piece of data in the data set contains the title and knowledge graph of the same article;

[0009] Encode the title and the knowledge graph of a piece of data in the data set respectively to obtain a first encoding vector and a second encoding vector;

[0010] The first encoding vector and the second encoding vector are concatenated to obtain a context vector;

[0011] Combine the context vector and the output of each time step to calculate the vocabulary probability distribution, replication probability and replication distribution;

[0012] Performing weighted calculation on the word list probability distribution and the copy distribution to obtain a final probability distribution;

[0013] According to the final probability distribution, the corresponding candidate output for each time step is selected, and the text summary is generated through the candidate output.

[0014] Optionally, when encoding the knowledge graph, the information of each previous node of the knowledge graph is calculated, and the information of the adjacent nodes is calculated, and the calculation formula is:

[0015]

[0016] in, is a vector encoding the neighbor node information of the Vi node, i is the current node number for calculating information, j is the neighbor node number of the current node, V is the node symbol, Vi is the vector of node i, its dimension is d, N represents the total number of neighbor nodes of the current node, n is the number of the attention head, H is the total number of attention heads in the model, is the attention value of node i to node j in the nth attention head, It is the parameter matrix of the nth attention head in the multi-head attention mechanism. Its dimension is d×d. Its value is obtained with model training, and the initial value is randomly generated.

[0017] Optionally, the output of each time step is processed using a coverage mechanism, and the calculation formula of the coverage mechanism is:

[0018]

[0019] Among them, N i represents the set of neighbor nodes of the i-th node, i, j, and z are the node numbers, k and q are vectors with the same dimension as the node vector, W K and W Q They are all parameter matrices of dimension d×d. Their initial values ​​are randomly generated and updated as the model learns during training. k is the node vector multiplied by W on the left. K q is obtained by multiplying the node vector by W on the left. Q And get, ω c is a parameter vector of dimension d, with initial values ​​randomly generated and updated as the model learns. i t is the coverage vector of node i at the tth time step, b attn The initial value is randomly generated and the bias value is updated as the model learns.

[0020] Optionally, the coverage vector c t It is obtained by summing the attention probability distribution of all time steps, and its calculation formula is:

[0021]

[0022] Where t represents the tth time step, t' is the number of the summation mark, t' starts from the 0th time step and continues to the t-1th time step, summing up all the attention distributions of the time steps.

[0023] Optionally, the coverage vector c t It is obtained by summing the attention probability distribution of all time steps, and its calculation formula is:

[0024]

[0025] Where t represents the tth time step, t' is the number of the summation mark, t' starts from the 0th time step and continues to the t-1th time step, summing up all the attention distributions of the time steps.

[0026] Optionally, the coverage mechanism uses coverage loss to penalize repeated attention to the same word, and its calculation formula is:

[0027]

[0028]

[0029] in, is the attention distribution of the ith node, ω t * is the target word, -logP is the negative logarithmic maximum likelihood formula, and λ is a parameter whose initial value is randomly generated and updated as the model learns.

[0030] Optionally, the calculation formula of the context vector of the knowledge graph is:

[0031]

[0032] Among them, h t is the hidden vector of the decoder, N is the total number of attention heads, V is the set of all nodes in the knowledge graph, is the attention distribution of node j in the nth attention head, is the jth column in the encoding matrix of the graph.

[0033] Optionally, the calculation formula of the replication probability is:

[0034] p=σ(W copy [h t ||c t ]+b copy )

[0035] Where σ is the sigmoid function, W copy is the parameter matrix, the value is obtained by training, ht is the hidden layer vector of the decoder, c tis the overlay vector and bcopy is the offset vector.

[0036] Optionally, the calculation formula of the final probability distribution is:

[0037] P 最终 =p*α copy +(1-p)*α vocab

[0038] Among them, p is the weight coefficient, α copy is the probability distribution of vocabulary, α vocab For replication distribution.

[0039] Optionally, the title and the knowledge graph are respectively input into a feedforward neural network and a graph attention layer to obtain a first encoding vector and a second encoding vector, and the feedforward neural network and the graph attention layer use a mish function, and the calculation formula of the mish function is:

[0040] mish=x*tanh(ln(1+e x ))

[0041] Where x is the input data and tanh is the hyperbolic tangent function.

[0042] Compared with the prior art, the present invention has the following beneficial effects:

[0043] The knowledge graph-based text summary generation method provided by the present invention can generate a corresponding text summary based on the title and the knowledge graph, and can also judge whether there are enough words in the fixed vocabulary to generate the corresponding text summary based on the context vector. When the vocabulary in the fixed vocabulary is insufficient, the words in the data set can be copied to generate the text summary, thereby improving the accuracy of text summary generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0045] Figure 1 A flowchart of a method for generating a text summary based on a knowledge graph provided in an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of a method for generating a text summary based on a knowledge graph provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0048] See also Figure 1 and Figure 2 , the method in this embodiment may include the following steps:

[0049] Information extraction is performed on the original data to form a data set, in which each piece of data in the data set contains the title and knowledge graph of the same article.

[0050] In this embodiment, the original data can generally be scientific papers, wherein the scientific papers can be derived from the public Abstract GENeration Dataset. The knowledge graph can be understood as: in the library and information industry, it is called knowledge domain visualization or knowledge domain mapping map, which is a series of various graphics that show the knowledge development process and structural relationship. It uses visualization technology to describe knowledge resources and their carriers, and mine, analyze, construct, draw and display knowledge and their mutual connections.

[0051] The title and knowledge graph of a piece of data in the data set are encoded respectively to obtain a first encoding vector and a second encoding vector.

[0052] In practical applications, the title and the knowledge graph are respectively input into the feedforward neural network and the graph attention layer to obtain the first encoding vector and the second encoding vector. In this embodiment, the first encoding vector and the second encoding vector are respectively represented by c s and c g To represent, where the first encoding vector and the second encoding can be understood as the digital representation of the title and the knowledge graph, where the calculation formula of the second encoding vector is;

[0053]

[0054] Among them, ht is the hidden layer vector of the decoder, N is the total number of attention heads, V is the set of all nodes in the knowledge graph, is the attention distribution of node j in the nth attention head, is the jth column in the encoding matrix of the graph.

[0055] In order to enhance the model effect, the title and knowledge graph are respectively input into the feedforward neural network and the graph attention layer to obtain the first encoding vector and the second encoding vector. The feedforward neural network and the graph attention layer use the mish function. The calculation formula of the mish function is:

[0056] mish=x*tanh(ln(1+e x ))

[0057] Where x is the input data and tanh is the hyperbolic tangent function.

[0058] When encoding the knowledge graph, the information of each previous node in the knowledge graph is calculated, and the information of the adjacent nodes is calculated. The calculation formula is:

[0059]

[0060] in, is a vector encoding the neighbor node information of the Vi node, i is the current node number for calculating information, j is the neighbor node number of the current node, V is the node symbol, Vi is the vector of node i, its dimension is d, N represents the total number of neighbor nodes of the current node, n is the number of the attention head, H is the total number of attention heads in the model, is the attention value of node i to node j in the nth attention head, is the parameter matrix of the nth attention head in the multi-head attention mechanism, with a dimension of d×d. Its value is obtained during model training, and the initial value is randomly generated.

[0061] Cover vector c t It is obtained by summing the attention probability distribution of all time steps, and its calculation formula is:

[0062]

[0063] Where t represents the tth time step, t′ is the number of the summation mark, t′ starts from the 0th time step and continues to the t-1th time step, summing up all the attention distributions of the time steps.

[0064] The first encoding vector and the second encoding vector are concatenated to obtain a context vector;

[0065] In this embodiment, it can be understood that obtaining the context vector is actually a digital representation of the context semantics of the article.

[0066] The word list probability distribution, copy probability and copy distribution are calculated by combining the context vector and the output of each time step. The copy probability is the probability of judging whether the text needs to be copied from the original data based on the context vector. When it is higher than the set value, it can be understood that the text needs to be copied from the original data. The calculation formula of the copy probability is:

[0067] p=σ(W copy [h t ||c t ]+b copy )

[0068] Where σ is the sigmoid function, W copy is the parameter matrix, the value is obtained by training, h t is the hidden vector of the decoder, c t is the coverage vector, bcopy is the offset vector;

[0069] When it is necessary to copy text, the copy probability of the words in the original data is determined, and the words with a higher probability than the set probability are selected and copied to the fixed vocabulary; then the words in the fixed vocabulary are output at each time step, and the starting output of the words in the fixed vocabulary uses special symbols. In this embodiment, the starting output can use special symbols <sos>, input the words and context vectors in the fixed vocabulary into the attention layer. First, according to the context semantics and order, divide the summary to be generated into several positions. When it is necessary to select the words in the first position, the words in the fixed vocabulary are input into the attention layer in turn, and the three words with the highest probability in the position are selected. It can be understood that the fixed vocabulary with copied text contains both the original fixed words and the copied words. When selecting the words in each position, the words in the original vocabulary are generally given a vocabulary probability distribution, that is, the probability of the original words appearing in the position, and the corresponding copied text will be represented by the copy distribution, that is, the probability of the copied text appearing in the position, and the three words with the highest probability are selected. At the second position, the three words selected in the first position are combined to select the words corresponding to the second position. Each word in the first position corresponds to a word in the second position, and so on. Finally, three preliminary text summaries are generated;

[0070] In order to solve the possibility of repeated generation due to excessive attention to some words, the output of each time step above is processed using a coverage mechanism. The calculation formula of the coverage mechanism is:

[0071]

[0072] Among them, N i represents the set of neighbor nodes of the i-th node, i, j, and z are the node numbers, k and q are vectors with the same dimension as the node vector, W K and W Q They are all parameter matrices of dimension d×d. Their initial values ​​are randomly generated and updated as the model learns during training. k is the node vector multiplied by W on the left. K q is obtained by multiplying the node vector by W on the left. Q And get, ω c is a parameter vector of dimension d, with initial values ​​randomly generated and updated as the model learns. i t is the coverage vector of node i at the tth time step, b attn The initial value is randomly generated and the bias value is updated as the model learns.

[0073] The coverage mechanism uses coverage loss to penalize repeated attention to the same word, and its calculation formula is:

[0074]

[0075]

[0076] in, is the attention distribution of the ith node, ωt* is the target word, -logP is the negative logarithmic maximum likelihood formula, and λ is a parameter whose initial value is randomly generated and updated as the model learns;

[0077] Perform weighted calculation on the word list probability distribution and the copy distribution to obtain the final probability distribution, where the calculation formula for the final probability distribution is: P 最终 =p* copy +(1-p)*α vocab , p is the weight coefficient, α copy is the probability distribution of vocabulary, α vocab For replication distribution.

[0078] In practical applications, each word in the three generated text summaries has a corresponding probability, which is the sum of the probability of the original word multiplied by the corresponding weight plus the probability of the copied word multiplied by the corresponding weight. The text summary with the largest result is the text summary we need to output.

[0079] According to the final probability distribution, the corresponding candidate output for each time step is selected, and the text summary is generated through the candidate output.

[0080] In this embodiment, the candidate output for each time step is selected using a beam search strategy, where the beam width parameter is 3.

[0081] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.< / sos>

Claims

1. A text summary generation method based on knowledge graph, It is characterized in that The steps include: Extracting information from the original data to form a data set, wherein each piece of data in the data set contains the title and knowledge graph of the same article; Encode the title and the knowledge graph of a piece of data in the data set respectively to obtain a first encoding vector and a second encoding vector; The first encoding vector and the second encoding vector are concatenated to obtain a context vector; Combine the context vector and the output of each time step to calculate the vocabulary probability distribution, replication probability and replication distribution; Performing weighted calculation on the word list probability distribution and the copy distribution to obtain a final probability distribution; Select the candidate output for each time step according to the final probability distribution, and generate a text summary through the candidate output; When encoding the knowledge graph, the information of each previous node of the knowledge graph is calculated, and the information of the adjacent nodes is calculated. The calculation formula is: in, V i The node is encoded into a vector of neighbor node information, i is the current node number for calculating information, j is the neighbor node number of the current node, V is the node symbol, V i is a vector of node i, whose dimension is d, N represents the total number of neighbor nodes of the current node, n is the number of attention heads, H is the total number of attention heads in the model, is the attention value of node i to node j in the nth attention head, is the parameter matrix of the nth attention head in the multi-head attention mechanism, with a dimension of d×d. Its value is obtained during model training, and the initial value is randomly generated. The output of each time step is processed using a coverage mechanism, and the calculation formula of the coverage mechanism is: Among them, N i represents the set of neighbor nodes of the i-th node, i, j, and z are the node numbers, k and q are vectors with the same dimension as the node vector, W K and W Q They are all parameter matrices of dimension d×d. Their initial values ​​are randomly generated and updated as the model learns during training. k is the node vector multiplied by W on the left. K q is obtained by multiplying the node vector by W on the left. Q And get, ω c is a parameter vector of dimension d, with initial values ​​randomly generated and updated as the model learns. i t is the coverage vector of node i at the tth time step, b attn The initial value is randomly generated and the bias value is updated as the model learns; Among them, the coverage vector c t It is obtained by summing the attention probability distribution of all time steps, and its calculation formula is: Where t represents the tth time step, t' is the number of the summation mark, t' starts from the 0th time step and continues to the t-1th time step, summing up all the attention distributions of the time steps; The coverage mechanism uses coverage loss to penalize repeated attention to the same word, and its calculation formula is: in, is the attention distribution of the ith node, ω t * is the target word, -logP is the negative logarithmic maximum likelihood formula, and λ is a parameter whose initial value is randomly generated and updated as the model learns; Among them, the calculation formula of the context vector of the knowledge graph is: Among them, h t is the hidden vector of the decoder, N is the total number of attention heads, V is the set of all nodes in the knowledge graph, is the attention distribution of node j in the nth attention head, v L j is the jth column in the encoding matrix of the graph.

2. According to the text summary generation method based on knowledge graph according to claim 1, It is characterized in that The calculation formula of the replication probability is: p=σ(W copy [h t ||c t ]+b copy ) Where σ is the sigmoid function, W copy is the parameter matrix, the value is obtained by training, h t is the hidden vector of the decoder, c t is the overlay vector and bcopy is the offset vector.

3. According to the text summary generation method based on knowledge graph according to claim 1, It is characterized in that The calculation formula of the final probability distribution is: P 最终 =p*α copy +(1-p)*α vocab Among them, p is the weight coefficient, α copy is the probability distribution of vocabulary, α vocab For replication distribution.

4. The text summary generation method based on knowledge graph according to claim 1, It is characterized in that The title and the knowledge graph are respectively input into a feedforward neural network and a graph attention layer to obtain a first encoding vector and a second encoding vector. The feedforward neural network and the graph attention layer use a mish function, and the calculation formula of the mish function is: mish=x*tanh(ln(1+e x )) Where x is the input data and tanh is the hyperbolic tangent function.

Citation Information

Patent Citations

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

    CN111324728A

  • Abstract generation method based on planning mechanism and knowledge graph guidance

    CN112597296A