Document abstract generation method, device, computer equipment and storage medium

By using the abstract keyword query database in the literature abstract generation method to obtain the original literature, and using the extracted literature abstract model to generate target sentences and directed acyclic maps, the problem of low accuracy in the generation of literature abstracts in the prior art is solved, and efficient and accurate literature abstract generation is achieved.

CN112732898BActive Publication Date: 2025-03-28PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011623844.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-30
Publication Date
2025-03-28
Estimated Expiration
2040-12-30

AI Technical Summary

Technical Problem

In the prior art, the accuracy of the literature abstract generation method is low, resulting in users spending a lot of time to extract key information from a large amount of literature data, and their reading efficiency is low.

Method used

By obtaining the abstract keywords in the abstract generation request, querying the database to obtain the original literature corresponding to the keywords, using the pre-trained extracted literature abstract model to process the original literature, generate target sentences, and determine the order of the front and back between the target sentences through directed acyclic graphs, and finally generate the target summary.

Benefits of technology

The accuracy of document abstract generation is improved, ensuring that the generated abstract records important information from the original document, and the generated abstract is better coherent, reducing labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112732898B_ABST
    Figure CN112732898B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and discloses a document abstract generation method, device, computer equipment and storage medium. The method comprises the following steps: obtaining an abstract generation request, wherein the abstract generation request comprises abstract keywords; querying a database based on the abstract keywords, and obtaining N original documents corresponding to the abstract keywords from initial documents stored in the database; processing the original documents using a pre-trained extractive document abstract model to obtain M target sentences; inputting the M target sentences into a trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences; and obtaining a target abstract based on the M*(M-1) / 2 directed acyclic graphs. The present invention utilizes the target model combination to determine the front-to-back order between any two target sentences, thereby improving the accuracy of generating a target abstract and ensuring that the generated target abstract has better coherence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a document abstract generation method, device, computer equipment and storage medium. Background Art

[0002] As more and more literature data is generated on the Internet, the problem of literature information overload is becoming increasingly serious. Users need to spend a lot of time to obtain key information from a large amount of literature data, and their reading efficiency is low. Currently, a single model is used to extract sentences from the literature to obtain a summary, but the accuracy of the current method of obtaining the summary is low. Summary of the invention

[0003] The embodiments of the present invention provide a document abstract generation method, device, computer equipment and storage medium to solve the problem that the method for obtaining the abstract has low accuracy.

[0004] A method for generating a document abstract, comprising:

[0005] Obtaining a summary generation request, wherein the summary generation request includes summary keywords;

[0006] Based on the abstract keyword, a database is searched to obtain N original documents corresponding to the abstract keyword from the initial documents stored in the database;

[0007] Using a pre-trained extractive document summarization model to process the original document to obtain M target sentences;

[0008] Input the M target sentences into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences;

[0009] Based on the M*(M-1) / 2 directed acyclic graphs, a target summary is obtained.

[0010] A document abstract generating device, comprising:

[0011] A summary generation request acquisition module, used to acquire a summary generation request, wherein the summary generation request includes summary keywords;

[0012] An original document acquisition module, used to query a database based on the abstract keyword, and acquire N original documents corresponding to the abstract keyword from the initial documents stored in the database;

[0013] A target sentence acquisition module is used to process the original document using a pre-trained extractive document summary model to obtain M target sentences;

[0014] A directed acyclic graph acquisition module is used to input the M target sentences into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences;

[0015] The target summary acquisition module is used to acquire the target summary based on M*(M-1) / 2 directed acyclic graphs.

[0016] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned document abstract generation method when executing the computer program.

[0017] A computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned document abstract generation method when executed by a processor.

[0018] The above-mentioned document abstract generation method, device, computer equipment and storage medium query the database based on the abstract keyword, obtain N original documents corresponding to the abstract keyword from the initial documents stored in the database, realize automatic determination of original documents of the same abstract type, ensure the accuracy of subsequent target abstracts, and reduce labor costs. The original document is processed by a pre-trained extractive document abstract model to quickly obtain M target sentences, so that the target sentences have a strong connection, ensuring that the target abstract generated subsequently records the important information of the original document. The M target sentences are input into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences. By determining the order between any two target sentences, it is ensured that the subsequent sorting process of the target sentences is simple, the accuracy is effectively improved, and the coherence of the generated target abstract is better. Based on the M*(M-1) / 2 directed acyclic graphs, a coherent target abstract can be quickly obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0020] Figure 1 is a schematic diagram of an application environment of a method for generating a document abstract in one embodiment of the present invention;

[0021] Figure 2 is a flow chart of a method for generating a document abstract in one embodiment of the present invention;

[0022] Figure 3 is another flow chart of a method for generating a document abstract in one embodiment of the present invention;

[0023] Figure 4 is another flow chart of a method for generating a document abstract in one embodiment of the present invention;

[0024] Figure 5 is another flow chart of a method for generating a document abstract in one embodiment of the present invention;

[0025] Figure 6 is another flow chart of a method for generating a document abstract in one embodiment of the present invention;

[0026] Figure 7 is another flow chart of a method for generating a document abstract in one embodiment of the present invention;

[0027] Figure 8 is a principle block diagram of a document abstract generating device in one embodiment of the present invention;

[0028] Fig. 9 is a topological diagram in one embodiment of the present invention;

[0029] Fig.10 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0031] The document abstract generation method provided by the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the document abstract generation method is applied in an abstract generation system, and the abstract generation system includes: Figure 1 The client and server shown in the figure communicate with each other through the network, and are used to determine the order between any two target sentences through the target model combination, improve the accuracy of generating the target summary, and ensure that the generated target summary has better coherence. Among them, the client, also known as the user end, refers to a program corresponding to the server that provides local services to customers. The client can be installed on, but not limited to, various personal computers, laptops, smart phones, tablets, and portable wearable devices. The server can be implemented as an independent server or a server cluster consisting of multiple servers.

[0032] In one embodiment, if Figure 2 As shown, a method for generating a document abstract is provided, and the method is applied in Figure 1 The server in the example is used as an example to illustrate the process, including the following steps:

[0033] S201: Obtain a summary generation request, where the summary generation request includes summary keywords.

[0034] The summary generation request is a request for generating a target summary. The summary keyword is a keyword for generating the target summary required by the user, so that the corresponding original document can be obtained according to the summary keyword. For example, the summary keyword can be xx disease, xx medical treatment or xx financial product, etc. The summary is also called summary and abstract. The purpose of the abstract is to provide an outline of the content of the document, and it is a short article that concisely and accurately records the important content of the document.

[0035] Specifically, an original display interface for generating a target summary is displayed in the client, and the user clicks on the original display interface to send a summary keyword filling instruction to the server. After the server obtains the summary keyword filling instruction, it controls the client to enter a summary keyword generation interface, and the user fills in at least one summary keyword in the summary keyword generation interface. It can be understood that in order to ensure that the generated target summary meets the user's requirements, when the number of summary keywords filled in by the user is less than the preset number of keywords, more similar keywords are recommended to the user based on the summary keywords filled in by the user. When the user fills in a number of summary keywords that is not less than the preset number of keywords, the client is controlled to display a confirmation button. The user clicks the confirmation button to form a summary request and send it to the server. When the server receives the summary generation request, it parses the summary generation request to obtain the summary keywords, thereby realizing automatic generation of the target summary.

[0036] S202: Based on the abstract keywords, a database is searched to obtain N original documents corresponding to the abstract keywords from the initial documents stored in the database.

[0037] The database is a library for storing initial documents. The initial documents are documents pre-stored in the database. It can be understood that the initial documents include abstracts of various abstract types, and the initial documents include documents corresponding to abstract keywords and documents not corresponding to abstract keywords. For example, the initial documents can be documents corresponding to the medical direction, documents corresponding to the food direction, or documents corresponding to the financial direction, etc. The original document refers to the abstract corresponding to the abstract keyword.

[0038] Specifically, the document abstracts in the database are classified in advance, and abstract documents of the same abstract type are obtained, and each abstract document carries at least one abstract type, providing technical support for obtaining the corresponding abstract type according to the abstract keywords in the subsequent process. When the server obtains the abstract keywords, a matching algorithm is used to query the database according to the abstract keywords, so as to obtain the original documents corresponding to the abstract keywords from the document abstracts, realize automatic determination of the original documents of the same abstract type, ensure the accuracy of the subsequent target abstracts, and reduce labor costs. Among them, the abstract type refers to the type corresponding to the document abstract.

[0039] S203: Use the pre-trained extractive document summarization model to process the original document to obtain M target sentences.

[0040] Among them, the extractive document summary model refers to a model that directly extracts the required target sentences from N original documents. The extractive document summary model can better retain the information of the original documents, can effectively improve the accuracy of the target summary, and reduce the grammatical and syntactic error rate of the target summary generated subsequently. In this embodiment, the extractive document summary model is a NeuSUM model, which automatically extracts sentences with higher scores from the original documents as target sentences to reduce labor costs. The NeuSUM model uses sentence benefits as a scoring method, taking into account the relationship between sentences, ensuring that the target sentences obtained are highly correlated, and the target summary generated subsequently is more coherent. The target sentence refers to the sentence used to form the target summary.

[0041] Specifically, the original document is input into a pre-trained extractive document summarization model. First, the original document is segmented so that the original document is divided into multiple summary sentences. The summary sentences are converted into sentence vectors in the embedding layer to convert them into a computer-recognizable format; the sentence vectors are encoded in the target encoding layer to obtain a target encoding vector containing semantic information to retain more information of the summary sentence; the target encoding vector is scored in the scoring encoding layer according to the sentence benefit to obtain the score corresponding to each summary sentence, and the sentence benefit is used as the scoring method, that is, the ROUGE evaluation index is used as the index for scoring the summary sentences to consider the relationship between the summary sentences, and the top M summary sentences with higher scores are used as target sentences, so that the target sentences have a strong connection and the target sentences are obtained quickly.

[0042] In this embodiment, the training of the extractive document summary model is to use the back propagation algorithm to continuously adjust the weights of the initial model until the weights of the initial model converge, thereby obtaining the extractive document summary model.

[0043] S204: Input the M target sentences into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences.

[0044] Among them, the target model combination is a model for sorting any two target sentences. The target combination model includes a BERT model and an MLP model. In this embodiment, the BERT model and the MLP model can accurately determine the front-to-back order of the target sentences, providing technical support for the subsequent generation of the target summary. Among them, the BERT model is used to process any two target sentences. The transformer structure is used in the encoding layer and the decoding layer of the BERT model to ensure that the BERT model outputs a semantic information vector with semantic information. For example, any two target sentences are input into the BERT model in the form of target sentence 1; target sentence 2 to obtain the corresponding output vector with semantic information. The output vector is input into the MLP model to obtain the front-to-back order between any two target sentences. Before using the BERT model, the BERT model is trained. The training process is as follows: 1. Obtain training corpus samples. The training expected samples include positive sample sentence pairs and negative sample sentence pairs. It can be understood that there is a contextual relationship between sentences in positive sample sentence pairs, and there is no contextual relationship between sentences in negative sample sentence pairs; 2. Use the [SEP] label to connect sentence pairs, for example, sentence 1 [SEP] sentence 2; use [CLS] as the label in the connected sentence, and use [SEP] as the label at the end of the sentence, so as to use these labels to mark the position of the sentence itself and the relationship between sentences, which can help the initial Bert model learn these features when training the initial Bert model; 3. Randomly mask the connected sentences to obtain training expectations; 4. Input the training corpus into the initial Bert model for training to obtain the Bert model.

[0045] The MLP model is a multi-layer perceptron model, which is used to perform binary classification on any two sentences to obtain the order of any two target sentences. In this embodiment, the MLP model is trained before using the MLP model. The training process includes: obtaining training samples and sequence labels corresponding to the training samples, wherein the training samples are original sentence pairs; inputting the training samples into the initial model to obtain the predicted sentence sequence results; and calculating the classification accuracy based on the sequence labels and the sentence sequence results. When the classification accuracy is greater than a preset value, the MLP model is obtained.

[0046] A directed acyclic graph is a directed graph without loops. Assume that the directed acyclic graph is S1→S2→S3, where S1, S2 and S3 are target sentences.

[0047] In the process of sorting target sentences to form target summaries in the prior art, it is necessary to predict the sentence in the previous position first to determine the sentence in the current sorting position. This method is relatively complex in the model training process, with large amount of calculation, long training time and low accuracy, and the target summary obtained. In this embodiment, M target sentences are combined in pairs to obtain M*(M-1) / 2 sentence combinations, each sentence combination is input into the BERT model to obtain a semantic information vector, and the semantic information vector is input into the MLP model to obtain the front-to-back order of any two target sentences, and a directed acyclic graph is formed based on the front-to-back order. In this embodiment, by determining the front-to-back order between any two target sentences, the subsequent sorting process of the target sentences is ensured to be simple, the accuracy is effectively improved, and the coherence of the generated target summary is ensured to be better. As an example, when M is equal to 3, that is, the target sentences are S1, S2 and S3, these three sentences are combined in pairs to obtain three sentence combinations, namely S1 and S3, S1 and S2, S2 and S3, and each sentence combination is input into the target model combination to obtain the order of any two target sentences, so as to ensure that the subsequent sorting process of the target sentences is simple, effectively improve the accuracy, and ensure that the generated target summary has better coherence.

[0048] S205: Based on M*(M-1) / 2 directed acyclic graphs, obtain a target summary.

[0049] The target summary refers to the summary required by the user.

[0050] In this embodiment, M*(M-1) / 2 directed acyclic graphs are processed to obtain a topological graph, and the breadth-first algorithm is used to process the topological graph to obtain the current in-degree of each target sentence. The target sentences are sorted according to the current in-degree to obtain the target summary. The process is relatively simple and a coherent target summary can be obtained quickly. As an example, assuming that the target sentences are S1, S2 and S3, the directed acyclic graph is S1→S2; S1→S3; S2→S3; the directed acyclic graph is processed to obtain the following: Fig. 9 The topology diagram shown, Fig. 9 The current in-degree of S1 is 0; the current in-degree of S2 is 1; the current in-degree of S3 is 2; the target sentence with the current in-degree of 0, that is, S1, is pushed into the stack queue as the bottom element of the stack, and the in-degree of other target sentences pointed to by the target sentence S1 is subtracted by 1, then the current in-degree of S2 is 1-1=0; the current in-degree of S3 is 2-1=1; then the target sentence S2 is pushed into the stack queue as the bottom element of the stack, and this process is repeated until all target sentences are pushed into the stack queue. The stack queue output by this process is the target summary. The process is relatively simple and a coherent target summary can be quickly obtained. Among them, the in-degree, derived from the graph theory algorithm, usually refers to the sum of the number of times a point in a directed graph is the end point of the edge in the graph. The current in-degree refers to the in-degree corresponding to each target sentence.

[0051] The document abstract generation method provided in this embodiment is based on the abstract keyword query database, and obtains N original documents corresponding to the abstract keywords from the initial documents stored in the database, so as to realize the automatic determination of the original documents of the same abstract type, ensure the accuracy of the subsequent target abstract, and reduce labor costs. The original document is processed by a pre-trained extractive document abstract model to quickly obtain M target sentences, so that the target sentences have a strong connection, ensuring that the target abstract generated subsequently records the important information of the original document. The M target sentences are input into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences. By determining the order between any two target sentences, it is ensured that the subsequent sorting process of the target sentences is simple, the accuracy is effectively improved, and the coherence of the generated target abstract is better. Based on M*(M-1) / 2 directed acyclic graphs, a coherent target abstract can be quickly obtained.

[0052] In one embodiment, if Figure 3 As shown, step S202, that is, querying the database based on the abstract keywords, obtaining N original documents corresponding to the abstract keywords from the initial documents stored in the database, includes:

[0053] S301: querying a classification table in a database based on abstract keywords to obtain abstract types corresponding to the abstract keywords.

[0054] The classification table is a pre-set table, which is used to indicate the association between the preset keywords and the abstract type. The preset keywords are words corresponding to the abstract keywords. The abstract type refers to the type of the abstract, for example, the abstract type can be medical type, financial type, mechanical type, etc. As an example, if the preset keyword is xx disease, the corresponding abstract type is medical type.

[0055] In this embodiment, a matching algorithm is used to match the abstract keywords with the preset keywords in the classification table. If the match is successful, it means that there are preset keywords corresponding to the abstract keywords. Therefore, the abstract type corresponding to the abstract keyword can be obtained according to the corresponding preset keywords, providing technical support for the subsequent determination of the original document.

[0056] S302: querying the initial documents in the database based on the abstract type, and determining N initial documents containing abstract keywords as N original documents.

[0057] In this embodiment, the initial documents in the database are classified in advance. After the abstract type is determined, the abstract keywords are matched with the initial documents in the abstract type to obtain the initial documents containing the abstract keywords, which is fast.

[0058] The document abstract generation method provided in this embodiment obtains the abstract type corresponding to the abstract keyword based on the abstract keyword query database classification table, and provides technical support for the subsequent determination of the original document. Based on the abstract type query database initial document, N initial documents containing abstract keywords are determined as N original documents, which is fast.

[0059] In one embodiment, if Figure 4 As shown, step S203, that is, using the pre-trained extractive document summary model to process the original document, obtain M target sentences, including:

[0060] S401: Segment the original document to obtain at least two summary sentences.

[0061] The segmentation process refers to the process of segmenting the original document into multiple sentences so that the computer can process the summary sentence. The summary sentence is a single sentence obtained by segmenting the original document.

[0062] As an example, the original document is segmented according to commas and periods in the original document. For example, if the original document is xxxx, yyyyy; zzz, the original document is divided into xxxx, yyyyy and zzz as three sentences by searching for commas and periods.

[0063] S402: Input all summary sentences into the word embedding layer of the extractive document summary model to obtain the sentence vector corresponding to each summary sentence.

[0064] Among them, the sentence vector refers to the vector obtained after the summary sentence is processed by the word embedding layer. The summary sentence can be converted into a corresponding vector through the word embedding layer, which is convenient for computer recognition. The word embedding layer is a layer used to convert the summary sentence into a sentence vector that can be recognized by the computer.

[0065] S403: Input each sentence vector into the target coding layer of the extractive document summarization model to obtain the target coding vector corresponding to each sentence vector.

[0066] The target encoding layer is used to encode the sentence vector at the sentence level and the document level. Specifically, the sentence vector is first input into the sentence encoding layer to obtain the original encoding vector represented by the sentence vector, and the original encoding vector is input into the document encoding layer to obtain the target encoding vector.

[0067] S404: Input the target coding vector into the scoring coding layer of the extractive document summary model to obtain the scoring result corresponding to each summary sentence.

[0068] Among them, the scoring result refers to the result of scoring the target coding vector corresponding to each summary sentence using the scoring coding layer. It can be understood that the summary sentence with a higher score is determined as the target sentence, so that the target sentence is a sentence containing important information, ensuring that the subsequently generated target summary records the important sentences of the original document.

[0069] S405: Select the first M summary sentences from the scoring results of the multiple target encoding vectors in descending order according to the numerical values, and determine them as the M target sentences.

[0070] In this embodiment, the extractive document summary model is used to combine sentence scoring and sentence selection to associate the information of the sentences and ensure that the target sentences have important information.

[0071] The document summary generation method provided in this embodiment performs segmentation processing on the original document to obtain at least two summary sentences so that the computer can process the summary sentences. All summary sentences are input into the word embedding layer of the extractive document summary model to obtain the sentence vector corresponding to each summary sentence for computer recognition. Each sentence vector is input into the target coding layer of the extractive document summary model to obtain the target coding vector corresponding to each sentence vector; the target coding vector is input into the scoring coding layer of the extractive document summary model to obtain the scoring result corresponding to each summary sentence; the scoring results of multiple target coding vectors are selected in order from high to low according to the numerical value, and the first M summary sentences are determined as M target sentences, and the sentence scoring and sentence selection are combined by using the extractive document summary model to associate the information of the sentences and ensure that the target sentences have important information.

[0072] In one embodiment, if Figure 5 , step S403, that is, inputting each sentence vector into the target coding layer of the extractive document summarization model to obtain the target coding vector corresponding to each sentence vector, including:

[0073] S501: Input each sentence vector into the sentence encoding layer of the extractive document summary model for encoding, and obtain the original encoding vector corresponding to the sentence vector;

[0074] S502: Input the original coding vector into the document coding layer of the extractive document summarization model for re-encoding to obtain a target coding vector.

[0075] The sentence encoding layer is a bidirectional GRU sentence encoding layer, and the sentence level encoding is obtained by using the bidirectional GRU sentence encoding layer. The document encoding layer refers to a bidirectional GRU document encoding layer, and the document level encoding is obtained by using the bidirectional GRU document encoding layer.

[0076] In one embodiment, the target model combination includes a pre-trained BERT model and an MLP model; Figure 6 As shown, step S204 is to input M target sentences into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences, including:

[0077] S601: Combine target sentences in pairs to obtain M*(M-1) / 2 sentence combinations;

[0078] The sentence combination refers to a combination of any two target sentences, so that the context relationship between the two target sentences can be obtained later.

[0079] In this embodiment, the target sentences are combined in pairs to obtain M*(M-1) / 2 sentence combinations, which is conducive to simplifying the subsequent steps of determining the context relationship between any two target sentences and ensuring the accuracy of determining the context relationship between any two target sentences, thereby ensuring a coherent target summary. As an example, when the number of target sentences is 3, assuming that the target sentences are S1, S2, and S3, the target sentences are combined in pairs, and the sentence combinations obtained are S1 and S2, S1 and S3, and S2 and S3.

[0080] S602: Input each sentence combination into the BERT model to obtain the semantic information vector corresponding to each sentence combination.

[0081] In this embodiment, the role of BERT is to obtain a vector representation of sentence combinations. BERT mainly includes a word embedding layer, an encoding layer, and a decoding layer. The role of the word embedding layer is to map documents to vectors, with the input being the document and the output being the vector. Both the encoding layer and the decoding layer use the transformer structure to obtain a semantic information vector with semantic information.

[0082] S603: Input the semantic information vector into the MLP model to obtain a directed acyclic graph of any two target sentences.

[0083] In this embodiment, the Bert model plus the MLP model are used to extract and classify summary sentences to obtain target sentences, and the front-to-back dependencies between the target sentences are determined to solve the problem of low classification accuracy when only the Bert model is used in the prior art.

[0084] The document summary generation method provided in this embodiment combines the target sentences in pairs to obtain M*(M-1) / 2 sentence combinations, which is conducive to simplifying the subsequent steps of determining the context relationship between any two target sentences and ensuring the accuracy of determining the context relationship between any two target sentences, thereby ensuring a coherent target summary. Each sentence combination is input into the BERT model to obtain the semantic information vector corresponding to each sentence combination; the semantic information vector is input into the MLP model to obtain the directed acyclic graph of any two target sentences to obtain the target sentence, and the context dependency relationship between the target sentences is determined to solve the problem of low classification accuracy using only the Bert model in the prior art.

[0085] In one embodiment, if Figure 7 As shown, step S205, i.e., obtaining a target summary based on M*(M-1) / 2 directed acyclic graphs, includes:

[0086] S701: Process M*(M-1) / 2 directed acyclic graphs to obtain a topological graph.

[0087] The topological graph refers to a graph formed by collecting all directed acyclic graphs, so as to perform breadth-first traversal later to obtain the current in-degree of each target sentence.

[0088] S702: Using a breadth-first algorithm to traverse the topological graph, obtain the current in-degree of each target sentence.

[0089] Among them, the breadth-first algorithm, also known as breadth-first search, width-first search and lateral-first search, is a graph search algorithm; the so-called breadth means traversing downward layer by layer.

[0090] In this implementation, the breadth-first algorithm is used to process the topological graph to obtain the current in-degree of each target sentence, and the target sentences are sorted according to the current in-degree to obtain the target summary. The process is relatively simple and a coherent target summary can be obtained quickly. Assume that the target sentence S1 is before the target sentence S2, and the target sentence S2 is before the target sentence S3; then S1 points to S2 and S3 respectively, and S2 points to S3. Therefore, the current in-degree of S1 is 0; the current in-degree of S2 is 1; and the current in-degree of S3 is 2.

[0091] S703: Push all target sentences into a stack according to the current in-degree to obtain a stack queue.

[0092] Specifically, the first target sentence with an in-degree of 0 is pushed into the stack queue as the bottom element of the stack, and the in-degree of other target sentences pointed to by the target sentence is subtracted by 1. The target sentence with an in-degree of 1 becomes 0, and then the target sentence 2 is pushed into the stack queue as the bottom element of the stack. This process is repeated until all target sentences are pushed into the stack queue. The stack queue formed by this process is the target summary. The process is relatively simple and a coherent target summary can be quickly obtained.

[0093] Assume that the target sentence S1 is before the target sentence S2, and the target sentence S2 is before the target sentence S3; then S1 points to S2 and S3 respectively, and S2 points to S3, so the current in-degree of S1 is 0; the current in-degree of S2 is 1; the current in-degree of S3 is 2. First, S1 is pushed into the stack queue as the bottom element, and the current in-degree of S2 becomes 0; the current in-degree of S3 is 1, and S2 is pushed into the stack queue as the bottom element, ..., and the stack queue is S1→S2→S3.

[0094] S704: Obtain a target summary based on the stack queue.

[0095] In this embodiment, the target summary is obtained according to the order of each target sentence in the stack queue, ensuring that the generated target summary is coherent and smooth.

[0096] The document summary generation method provided in this embodiment processes M*(M-1) / 2 directed acyclic graphs to obtain a topological graph, so as to perform a breadth-first traversal subsequently to obtain the current in-degree of each target sentence. The breadth-first algorithm is used to traverse the topological graph to obtain the current in-degree of each target sentence; all target sentences are stacked according to the current in-degree to obtain a stack queue; based on the stack queue, the target summary is obtained to ensure that the generated target summary is coherent and smooth.

[0097] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0098] In one embodiment, a document abstract generation device is provided, which corresponds one-to-one to the document abstract generation method in the above embodiment. Figure 8 As shown, the document abstract generation device includes an abstract generation request acquisition module 801, an original document acquisition module 802, a target sentence acquisition module 803, a directed acyclic graph acquisition module 804 and a target abstract acquisition module 805. The functional modules are described in detail as follows:

[0099] The summary generation request acquisition module 801 is used to acquire a summary generation request, where the summary generation request includes summary keywords.

[0100] The original document acquisition module 802 is used to query the database based on the abstract keywords and acquire N original documents corresponding to the abstract keywords from the initial documents stored in the database.

[0101] The target sentence acquisition module 803 is used to process the original document using a pre-trained extractive document summary model to obtain M target sentences.

[0102] The directed acyclic graph acquisition module 804 is used to input M target sentences into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences.

[0103] The target summary acquisition module 805 is used to acquire the target summary based on M*(M-1) / 2 directed acyclic graphs.

[0104] Preferably, the original document acquisition module 802 includes: an abstract type acquisition unit and an original document acquisition unit.

[0105] The abstract type acquisition unit is used to query the classification table in the database based on the abstract keyword to obtain the abstract type corresponding to the abstract keyword.

[0106] The original document acquisition unit is used to query the document abstracts in the database according to the abstract type, and determine N document abstracts containing abstract keywords as N original documents.

[0107] Preferably, the target sentence acquisition module 803 includes: a segmentation processing unit, a sentence vector acquisition unit, a target encoding vector acquisition unit and a scoring result acquisition unit.

[0108] The segmentation processing unit is used to segment the original document to obtain at least two summary sentences.

[0109] The sentence vector acquisition unit is used to input all summary sentences into the word embedding layer of the extractive document summary model to obtain the sentence vector corresponding to each summary sentence.

[0110] The target coding vector acquisition unit is used to input each sentence vector into the target coding layer of the extractive document summary model to obtain the target coding vector corresponding to each sentence vector.

[0111] The scoring result acquisition unit is used to input the target coding vector into the scoring coding layer of the extractive document summary model to obtain the scoring result corresponding to each summary sentence.

[0112] The target sentence acquisition unit is used to select the first M summary sentences from the scoring results of the multiple target encoding vectors in descending order according to the numerical values, and determine them as the M target sentences.

[0113] Preferably, the target encoding vector acquisition unit includes: a first encoding subunit and a second encoding subunit.

[0114] The first encoding subunit is used to input each sentence vector into the sentence encoding layer of the extractive document summary model for encoding, and obtain the original encoding vector corresponding to the sentence vector.

[0115] The second encoding subunit is used to input the original encoding vector into the document encoding layer of the extractive document summary model for re-encoding to obtain the target encoding vector.

[0116] Preferably, the target model combination includes a BERT model and an MLP model. The directed acyclic graph acquisition module 804 includes: a sentence combination acquisition unit, a semantic information vector acquisition unit and a directed acyclic graph acquisition unit.

[0117] The sentence combination acquisition unit is used to combine the target sentences in pairs to obtain M*(M-1) / 2 sentence combinations.

[0118] The semantic information vector acquisition unit is used to input each sentence combination into the BERT model to obtain the semantic information vector corresponding to each sentence combination.

[0119] The directed acyclic graph acquisition unit is used to input the semantic information vector into the MLP model to obtain the directed acyclic graph of any two target sentences.

[0120] Preferably, the target summary acquisition module 805 includes: a topology map acquisition unit, an in-degree acquisition unit, a stack queue acquisition unit and a target summary acquisition unit.

[0121] The topology map acquisition unit is used to process M*(M-1) / 2 directed acyclic graphs to obtain a topology map.

[0122] The in-degree acquisition unit is used to traverse the topological graph using a breadth-first algorithm to acquire the current in-degree of each target sentence.

[0123] The stack queue acquisition unit is used to stack all target sentences according to the current in-degree to obtain the stack queue.

[0124] The target summary acquisition unit is used to acquire the target summary based on the stack queue.

[0125] For the specific definition of the document abstract generation device, please refer to the definition of the document abstract generation method above, which will not be repeated here. Each module in the above document abstract generation device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0126] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store a directed acyclic graph. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for generating a document abstract is implemented.

[0127] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for generating a document abstract in the above embodiment are implemented, such as Figure 2 Steps S201-S205 shown, or Figures 3 to 7 To avoid repetition, the steps shown in are not described here. Alternatively, when the processor executes the computer program, the functions of each module / unit in the embodiment of the document abstract generation device are realized, for example Figure 8 The functions of the summary generation request acquisition module 801, the original document acquisition module 802, the target sentence acquisition module 803, the directed acyclic graph acquisition module 804 and the target summary acquisition module 805 are not described here in detail to avoid repetition.

[0128] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for generating a document abstract in the above embodiment are implemented, for example: Figure 2 Steps S201-S205 shown, or Figures 3 to 7 To avoid repetition, the steps shown in are not described here. Alternatively, when the processor executes the computer program, the functions of each module / unit in the embodiment of the document abstract generation device are realized, for example Figure 8 The functions of the summary generation request acquisition module 801, the original document acquisition module 802, the target sentence acquisition module 803, the directed acyclic graph acquisition module 804 and the target summary acquisition module 805 are not described here in detail to avoid repetition.

[0129] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (MRAM), synchronous MRAM (SMRAM), double data rate SMRAM (MMRSMRAM), enhanced SMRAM (ESMRAM), synchronous link (Synchlink) MRAM (SLMRAM), memory bus (Rambus) direct RAM (RMRAM), direct memory bus dynamic RAM (MRMRAM), and memory bus dynamic RAM (RMRAM).

[0130] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0131] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for generating a document abstract, characterized in that: include: Obtaining a summary generation request, wherein the summary generation request includes summary keywords; Based on the abstract keyword, a database is searched to obtain N original documents corresponding to the abstract keyword from the initial documents stored in the database; Using a pre-trained extractive document summarization model to process the original document to obtain M target sentences; The pre-trained extractive document summary model is used to process the original document to obtain M target sentences, including: Segmenting the original document to obtain at least two abstract sentences; Input all the summary sentences into the word embedding layer of the extractive document summary model to obtain the sentence vector corresponding to each summary sentence; Input each of the sentence vectors into the target coding layer of the extractive document summarization model to obtain a target coding vector corresponding to each of the sentence vectors; Input the target coding vector into the scoring coding layer of the extractive document summary model to obtain the scoring result corresponding to each of the summary sentences; The first M summary sentences are selected from the scoring results of the plurality of target encoding vectors in descending order according to the numerical values, and are determined as the M target sentences; Input the M target sentences into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences; The target model combination includes a BERT model and an MLP model; The M target sentences are input into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs of any two target sentences, including: Combining the target sentences in pairs to obtain M*(M-1) / 2 sentence combinations; Input each of the sentence combinations into the BERT model to obtain a semantic information vector corresponding to each of the sentence combinations; Inputting the semantic information vector into the MLP model to obtain a directed acyclic graph of any two target sentences; Based on the M*(M-1) / 2 directed acyclic graphs, obtaining a target summary; The target summary is obtained based on the M*(M-1) / 2 directed acyclic graphs, including: Processing M*(M-1) / 2 directed acyclic graphs to obtain a topological graph; Using a breadth-first algorithm to traverse the topological graph, obtaining the current in-degree of each target sentence; Pushing all target sentences into a stack according to the current in-degree to obtain a stack queue; Based on the stack queue, a target summary is obtained.

2. The method for generating a document abstract as claimed in claim 1, wherein: The querying of a database based on the abstract keyword to obtain N original documents corresponding to the abstract keyword from the initial documents stored in the database includes: Based on the abstract keyword, a classification table in a query database is obtained to obtain an abstract type corresponding to the abstract keyword; The document abstracts in the database are queried according to the abstract type, and N document abstracts containing the abstract keywords are determined as N original documents.

3. The method for generating a document abstract as claimed in claim 1, characterized in that: The step of inputting each of the sentence vectors into the target coding layer of the extractive document summary model to obtain a target coding vector corresponding to each of the sentence vectors comprises: Input each of the sentence vectors into the sentence encoding layer of the extractive document summary model for encoding, and obtain the original encoding vector corresponding to the sentence vector; The original coding vector is input into the document coding layer of the extractive document summary model for re-encoding to obtain the target coding vector.

4. A document abstract generation device, characterized in that: include: A summary generation request acquisition module, used to acquire a summary generation request, wherein the summary generation request includes summary keywords; An original document acquisition module, used to query a database based on the abstract keyword, and acquire N original documents corresponding to the abstract keyword from the initial documents stored in the database; A target sentence acquisition module is used to process the original document using a pre-trained extractive document summary model to obtain M target sentences; The target sentence acquisition module includes: a segmentation processing unit, a sentence vector acquisition unit, a target encoding vector acquisition unit and a scoring result acquisition unit; A segmentation processing unit, used to segment the original document to obtain at least two abstract sentences; A sentence vector acquisition unit is used to input all summary sentences into the word embedding layer of the extractive document summary model to obtain the sentence vector corresponding to each summary sentence; A target coding vector acquisition unit is used to input each sentence vector into the target coding layer of the extractive document summarization model to obtain a target coding vector corresponding to each sentence vector; A scoring result acquisition unit, used to input the target coding vector into the scoring coding layer of the extractive document summary model to obtain the scoring result corresponding to each summary sentence; A target sentence acquisition unit is used to select the first M summary sentences from the scoring results of the multiple target encoding vectors in descending order according to the numerical values, and determine them as the M target sentences; A directed acyclic graph acquisition module is used to input the M target sentences into the trained target model combination to obtain M*(M-1) / 2 directed acyclic graphs corresponding to the target sentences; The target model combination includes a BERT model and an MLP model; A directed acyclic graph acquisition module, comprising: a sentence combination acquisition unit, a semantic information vector acquisition unit and a directed acyclic graph acquisition unit; A sentence combination acquisition unit is used to combine target sentences in pairs to obtain M*(M-1) / 2 sentence combinations; A semantic information vector acquisition unit, used to input each sentence combination into the BERT model to obtain a semantic information vector corresponding to each sentence combination; A directed acyclic graph acquisition unit is used to input the semantic information vector into the MLP model to obtain a directed acyclic graph of any two target sentences; A target summary acquisition module, used for acquiring a target summary based on M*(M-1) / 2 directed acyclic graphs; The target summary acquisition module includes: a topology acquisition unit, an in-degree acquisition unit, a stack queue acquisition unit and a target summary acquisition unit; A topology map acquisition unit is used to process M*(M-1) / 2 directed acyclic graphs to obtain a topology map; An in-degree acquisition unit, used to traverse the topological graph using a breadth-first algorithm to acquire the current in-degree of each target sentence; A stack queue acquisition unit is used to stack all target sentences according to the current in-degree to obtain a stack queue; The target summary acquisition unit is used to acquire the target summary based on the stack queue.

5. The document abstract generating device according to claim 4, characterized in that: The original document acquisition module includes: An abstract type acquisition unit, configured to query a classification table in a database based on the abstract keyword to acquire an abstract type corresponding to the abstract keyword; The original document acquisition unit is used to query the document abstracts in the database according to the abstract type, and determine N document abstracts containing the abstract keywords as N original documents.

6. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the document abstract generation method according to any one of claims 1 to 3 are implemented.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the document abstract generation method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Text abstract generation method based on sentence association attention mechanism

    CN110348016A

  • Abstraction generation method and device, terminal equipment and storage medium

    CN110837556A