CN114817523A - Abstract generation method and device, computer equipment and storage medium - Google Patents

Abstract generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114817523A
CN114817523A CN202210374056.8A CN202210374056A CN114817523A CN 114817523 A CN114817523 A CN 114817523A CN 202210374056 A CN202210374056 A CN 202210374056A CN 114817523 A CN114817523 A CN 114817523A
Authority
CN
China
Prior art keywords
sentence
text
statement
abstract
key
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210374056.8A
Other languages
Chinese (zh)
Inventor
杜江楠
李剑锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210374056.8A priority Critical patent/CN114817523A/en
Publication of CN114817523A publication Critical patent/CN114817523A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/34Browsing; Visualisation therefor
    • G06F16/345Summarisation for human users
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The method and the device for generating the abstract have the advantages that the key sentences are obtained by sentence extraction according to the headline text and the text sentence set, the abstract generation is carried out according to the key sentences and the headline text input abstract generation model, not only can the sentences of the input abstract generation model be reduced, but also the abstract generation of the headline text is increased, and the accuracy of abstract generation is improved. A method, an apparatus, a computer device and a storage medium for generating a summary are provided, the method includes: acquiring a target text of the abstract to be generated, wherein the target text comprises a title text and a text sentence set comprising at least one sentence; extracting sentences according to the header text and the text sentence set to obtain key sentences corresponding to the text sentence set; and performing abstract generation according to the key sentences and the title text based on the abstract generation model to obtain target abstract information corresponding to the target text. In addition, the application also relates to a block chain technology, and the abstract generation model can be stored in the block chain.

Description

Abstract generation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence and word processing, and in particular, to a method and an apparatus for generating an abstract, a computer device, and a storage medium.
Background
Because the length of the long text is long, the user usually needs to summarize the long text for reading. With the explosive growth of information, the number of long texts is continuously increased and needs to be updated in real time, and manual summarization cannot be performed in real time, so that how to automatically generate the summarization of the long texts is particularly important.
In the prior art, important sentences in long texts are extracted as a summary through a neural network model. However, the neural network model has a requirement on the length of an input text, and the neural network model cannot well process a text exceeding the maximum processing length and cannot accurately generate a summary. If the maximum processing length of the neural network model is extended, the problem of long-distance dependency exists, and the accuracy of generating the abstract of the neural network model is low.
Therefore, how to improve the accuracy of summary generation becomes an urgent problem to be solved.
Disclosure of Invention
The invention provides a method and a device for generating an abstract, computer equipment and a storage medium.
In a first aspect, the present application provides a method for generating a summary, where the method includes:
acquiring a target text of a summary to be generated, wherein the target text comprises a title text and a body sentence set comprising at least one sentence;
performing statement extraction according to the header text and the text statement set to obtain key statements corresponding to the text statement set;
and performing abstract generation according to the key sentences and the title texts based on an abstract generation model to obtain target abstract information corresponding to the target texts.
In a second aspect, the present application further provides a summary generation apparatus, including:
the text acquisition module is used for acquiring a target text of the abstract to be generated, wherein the target text comprises a title text and a text sentence set containing at least one sentence;
the sentence extraction module is used for performing sentence extraction according to the title text and the body sentence set to obtain a key sentence corresponding to the body sentence set;
and the abstract generating module is used for generating an abstract according to the key sentence and the title text based on an abstract generating model to obtain target abstract information corresponding to the target text.
In a third aspect, the present application further provides a computer device comprising a memory and a processor;
the memory for storing a computer program;
the processor is configured to execute the computer program and implement the digest generation method when executing the computer program.
In a fourth aspect, the present application also provides a computer-readable storage medium storing a computer program, which when executed by a processor causes the processor to implement the digest generation method as described above.
The application discloses a method and a device for generating an abstract, computer equipment and a storage medium, wherein a title text and a text sentence set comprising at least one sentence can be obtained by obtaining a target text of the abstract to be generated; the key sentences in the body sentence set are obtained by performing sentence extraction according to the title text and the body sentence set, and the title text has a strong generalization effect on the central idea of the whole target text and can influence the importance of the sentences, so that the title text is added during sentence extraction, and the extracted key sentences are more accurate; by carrying out abstract generation according to the key sentences and the title text based on the abstract generation model, the number of the sentences input into the abstract generation model can be greatly reduced, the abstract generation of the title text is increased, and the accuracy of generating the abstract is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flow chart of a summary generation method provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart diagram of a sub-step of sentence extraction provided by an embodiment of the present application;
FIG. 3 is a schematic flow chart diagram of a sub-step of determining a second importance score provided by an embodiment of the present application;
FIG. 4 is a schematic flow chart diagram of sub-steps of performing summary generation provided by an embodiment of the present application;
fig. 5 is a schematic block diagram of a summary generation apparatus provided in an embodiment of the present application;
fig. 6 is a schematic block diagram of a structure of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
The embodiment of the application provides a summary generation method and device, computer equipment and a storage medium. The abstract generation method can be applied to a server or a terminal, the key sentences are obtained by sentence extraction according to the header text and the text sentence set, and the abstract generation is performed according to the key sentences and the header text input abstract generation model, so that not only can the sentences of the input abstract generation model be reduced, but also the abstract generation of the header text is increased, and the accuracy of generating the abstract is improved.
The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like. The terminal can be an electronic device such as a smart phone, a tablet computer, a notebook computer, a desktop computer and the like.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
As shown in fig. 1, the digest generation method includes steps S10 through S30.
Step S10, obtaining a target text of the abstract to be generated, wherein the target text comprises a title text and a text sentence set containing at least one sentence.
It should be noted that the embodiment of the application can be applied to a scenario of generating an abstract of a long text, and the method and the system can be used for extracting sentences according to a header text and a text sentence set to obtain key sentences and inputting an abstract generation model according to the key sentences and the header text to generate the abstract, so that not only can the sentences of the abstract generation model be reduced, but also the abstract generation of the header text is increased, and the accuracy of generating the abstract is improved.
In the embodiment of the present application, the target text may include, but is not limited to, a news text, a microblog text, a patent text, and other long texts. Of course, the target text may also be a text of smaller size. In the embodiment of the present application, a target text is taken as an example of a news text.
For example, when a text selection operation of a user is detected, a target text of the abstract to be generated can be determined according to the text selection operation. The target text may be stored in a local database or a local disk in advance.
For example, when a text uploading operation of a user is detected, a target text of the summary to be generated may be determined according to the text uploading operation.
The target text may include a header text and a body sentence set including at least one sentence. For example, when the target text is news text, the headline text is a news headline in the news text, and the body sentence set is a body in the news text.
By obtaining the target text of the abstract to be generated, the title text and a body sentence set comprising at least one sentence can be obtained.
And step S20, performing sentence extraction according to the title text and the text sentence set to obtain a key sentence corresponding to the text sentence set.
The term extraction means extracting a term with a high degree of importance in the body term set as a key term. Therefore, when the abstract is generated, the whole text sentence set does not need to be input into the abstract generation model, sentences input into the abstract generation model can be greatly reduced, the processing speed of the abstract generation model is increased, and the accuracy of the generated abstract is improved.
In the embodiment of the application, when extracting sentences, not only the importance of each sentence in the whole text sentence set is considered, but also the fact that the header text has a strong generalization effect on the central idea of the whole target text is considered, and the header text also influences the importance of the sentences. Therefore, the title text is added during sentence extraction, so that the extracted key sentences are more accurate.
By extracting sentences according to the header text and the text sentence set, the accuracy of the key sentences can be improved.
Referring to fig. 2, fig. 2 is a schematic flowchart of a sub-step of sentence extraction according to an embodiment of the present application, and specifically includes the following steps S201 to S203.
Step S201, determining a first importance score corresponding to each sentence in the body sentence set, where the first importance score is an importance score between each sentence and the caption text.
In some embodiments, determining the first importance score for each sentence in the set of textual sentences may include: inputting each statement into a vectorization model for vectorization to obtain a statement vector corresponding to each statement; inputting the title text into a vectorization model for vectorization to obtain a title text vector corresponding to the title text; and calculating the similarity between the sentence vector corresponding to each sentence and the title text vector, and determining the obtained similarity as a first importance score corresponding to each sentence.
Exemplary vectorization models may include, but are not limited to, bert (bidirectional Encoder expressions from transform) models, word2vec models, glove models, and ELMo models, among others. In the embodiments of the present application, a vectorization model is taken as a BERT model for example.
It should be noted that, in the embodiment of the present application, the vectorization model may be a pre-trained model.
In some embodiments, before inputting each statement into the vectorization model for vectorization and obtaining a statement vector corresponding to each statement, the method may further include: acquiring first sample data, and training an initial vectorization model according to the first sample data until the vectorization model converges to obtain a trained first vectorization model; and obtaining second sample data, and training the first vector quantization model according to the second sample data until the first vector quantization model converges to obtain a trained second vector quantization model.
The first sample data comprises a sample title text and a sample sentence set, and the sample sentence set comprises a plurality of sentences; the second sample data includes a plurality of similar sample statements. When the digest generation method in the embodiment of the present application is applied to a scene in which a digest of a news text is generated, the first sample data may be the news text.
Illustratively, the cross-entropy cost function may be used to calculate the loss function value during the training process, but of course, other types of loss functions may be used, such as an absolute value loss function, a logarithmic loss function, a quadratic loss function, an exponential loss function, and so on. And is not limited herein. The parameters of the vectorization model may be adjusted by a gradient descent algorithm, and may also be adjusted by a back propagation algorithm, which is not limited herein.
It should be noted that, by pre-training the initial vectorization model according to the sample title text and the sample sentence set, the capability of the first vectorization model for representing the semantic information of the title and the text can be improved, and the accuracy of the importance score between the subsequent calculation sentence and the title text can be further improved; by training the first vector quantization model according to the similar sample sentences, the capability of the second vector quantization model for representing the semantic information of the similar sentences can be improved, and the accuracy of abstract extraction of the key sentences in the follow-up process can be improved.
Exemplarily, after the trained second directional quantization model is obtained, each statement may be input into the second directional quantization model for vectorization, so as to obtain a statement vector corresponding to each statement; and inputting the title text into a second vector quantization model for vectorization to obtain a title text vector corresponding to the title text. The specific vectorization process is not limited herein.
For example, when calculating the similarity between the sentence vector and the title text vector corresponding to each sentence, the similarity between the sentence vector and the title text vector corresponding to each sentence may be calculated by using a cosine similarity algorithm. Of course, similarity algorithms such as the euclidean distance, the Jaccard similarity coefficient, and the Pearson correlation coefficient may also be used to calculate the similarity between the sentence vector corresponding to each sentence and the heading text vector. Then, the obtained similarity is determined as a first importance score corresponding to each sentence. Thus, an importance score between each sentence and the caption text is obtained.
By calculating the similarity between the sentence vector corresponding to each sentence and the heading text vector by adopting a similarity algorithm, the substantial similarity between each sentence and the heading text can be reflected more accurately.
Step S202, determining a second importance score corresponding to each sentence, wherein the second importance score is the importance score of each sentence in the text sentence set.
Referring to fig. 3, fig. 3 is a schematic flowchart of a sub-step of determining a second importance score according to an embodiment of the present application, which may specifically include the following steps S2021 to S2023.
Step S2021, determining a sentence vector corresponding to each sentence.
For example, a sentence vector corresponding to each sentence generated when calculating the first importance score corresponding to each sentence may be directly obtained. Of course, each sentence may be input into the vectorization model again for vectorization, so as to obtain a sentence vector corresponding to each sentence.
Step S2022, calculating a similarity between each statement and another statement according to the statement vector corresponding to the different statements, and obtaining a similarity matrix corresponding to each statement.
For example, a similarity algorithm may be used to calculate the similarity between each statement and other statements, and obtain a similarity matrix corresponding to each statement. The similarity algorithm may include, but is not limited to, euclidean distance, cosine similarity, Jaccard similarity coefficient, Pearson correlation coefficient, and the like.
For example, for statements A, B, C and D, a similarity matrix between statement A and other statements may be calculated as [ A [ ] B ,A C ,A D ]Wherein A is B Representing the degree of similarity between statement A and statement B, A C Representing the similarity between statement A and statement C, A D Representing the similarity between statement a and statement D. The similarity matrix between statement B and other statements is [ B A ,B C ,B D ]The similarity matrix between statement C and other statements is [ C ] A ,C B ,C D ]The similarity matrix between statement D and other statements is [ D ] A ,D B ,D C ]. Therefore, a similarity matrix corresponding to the text statement set can be obtained:
Figure BDA0003590075240000071
step S2023, determining a second importance score corresponding to each sentence according to the similarity matrix corresponding to each sentence.
In some embodiments, determining the second importance score corresponding to each sentence according to the similarity matrix corresponding to each sentence may include: constructing a sentence subgraph of a text sentence set, wherein each node in the sentence subgraph corresponds to one sentence in the text sentence set, and edges are arranged between different nodes; determining the weight value of an edge in a sentence graph according to the similarity matrix corresponding to each sentence; iteratively updating the weighted values of the nodes in the sentence subgraph according to the weighted values of the edges in the sentence subgraph on the basis of a text sequencing algorithm until a preset convergence condition is met; and determining a second importance score corresponding to each sentence according to the weight value of each node in the sentence graph.
Illustratively, a sentence subgraph of the text sentence set can be constructed according to the similarity matrix corresponding to the text sentence set, and the similarity matrix corresponding to each sentence is determined as a weight value of an edge in the sentence subgraph.
For example, degree of similarity A B Or degree of similarity B A And the weighted value is used as the edge between the node a and the node B, wherein the node a corresponds to the statement A, and the node B corresponds to the statement B. It is understood that the similarity A B Similarity to B A Are equal.
For example, after determining the weight values of the edges in the sentence sub-graph according to the similarity matrix corresponding to each sentence, iteratively updating the weight values of the nodes in the sentence sub-graph according to the weight values of the edges in the sentence sub-graph based on a text sorting algorithm until a preset convergence condition is met.
The Text sorting algorithm may be a Text Rank algorithm. The Text Rank algorithm is a graph-based ranking algorithm for texts, and by dividing a Text into a plurality of constituent units (words and sentences) and establishing a graph model, important components in the Text are ranked by using a voting mechanism.
In the embodiment of the present application, a text ordering algorithm may be adopted to order the importance of each sentence in the body sentence set. For example, a weight value of each node in the sentence sub-graph is calculated through an update formula of the text sorting algorithm, and the weight value of each node is determined as a second importance score of the sentence corresponding to each node. The specific update process is not limited herein.
By adopting a text sorting algorithm, the weight values of the nodes are iteratively updated according to the weight values of the edges in the sentence subgraph, and the second importance score corresponding to each sentence is determined according to the weight value of each node in the sentence subgraph, so that the importance program of the sentence in the text sentence set can be more accurately evaluated, and the accuracy of extracting the key sentence from the text sentence set can be further improved.
Step S203, determining the key sentence according to the first importance score and the second importance score of each sentence.
In some embodiments, determining the key sentences from the first importance score and the second importance score of each sentence may include: carrying out weighted calculation on the first importance score and the second importance score of each statement to obtain an importance total score of each statement; and determining the sentences with the total importance scores larger than a first preset score threshold value as key sentences. Wherein at least one key sentence is obtained.
Illustratively, the total importance score for each statement may be calculated by the following formula.
score=ka+(1-k)b
In the formula (I), the compound is shown in the specification, a the first importance score is represented, b represents the second importance score, k is a preset weighting factor, and the value of k can be set according to specific situations, and specific numerical values are not limited herein.
For example, after obtaining the total importance score of each sentence, the sentences with the total importance scores larger than the first preset score threshold may be determined as the key sentences. The first preset score threshold may be set according to actual conditions, and specific numerical values are not limited herein.
By determining the key sentences according to the first importance scores and the second importance scores of each sentence, the factors that the headline texts also influence the importance of the sentences are fully considered, and the accuracy of the key sentences is improved.
And step S30, performing abstract generation according to the key sentences and the title texts based on an abstract generation model, and obtaining target abstract information corresponding to the target texts.
In the embodiment of the application, the abstract generation is carried out according to the key sentences and the title text based on the abstract generation model, so that the number of the sentences input into the abstract generation model can be greatly reduced, the abstract generation of the title text is increased, and the accuracy of generating the abstract is improved. Therefore, the problem that the existing neural network model cannot well process the text exceeding the maximum processing length is solved, the generated abstract is more accurate, and the reading experience of a user is improved.
It should be noted that the summary generation model may include a vectorization model and a summary extraction layer. The vectorization model may be a BERT model, and is configured to output a key statement vector corresponding to each key statement. The abstract extraction layer can comprise a full connection layer and a normalization layer and is used for performing full connection processing and normalization on the key statement vectors and outputting the prediction probability of each key statement extracted as the abstract.
In the embodiment of the present application, the summary generation model may be a trained model. Illustratively, the abstract generating model may be trained in advance by using sample data to obtain a trained abstract generating model. The training process of the abstract generation model comprises the following steps: acquiring sample data of a preset number, wherein the sample data comprises a sample title text and a plurality of sample sentences; splicing the sample title text, each sample sentence and the context sentence of each sample sentence, determining training sample data of each round of training, and labeling a category label for the training sample data of each round; inputting the current round of training sample data into a BERT model for vectorization, and outputting a statement vector corresponding to the current round of training sample data; inputting the key sentence vector into a abstract extraction layer to obtain an abstract extraction training result corresponding to the training sample data of the current round; based on a preset loss function, calculating a loss function value according to a category label corresponding to the current round of training sample data; when the loss function value is larger than the loss function threshold value, adjusting parameters in the abstract generation model, carrying out next round of training and calculating the loss function value of each round; and when the calculated loss function threshold is smaller than the preset loss value or is not smaller, finishing the training to obtain the trained abstract generation model.
Illustratively, sample statements may include both key sample statements and non-key sample statements. The category labels may include summary labels to indicate that the sample statement is a summary and non-summary labels to indicate that the sample statement is not a summary. The predetermined loss function may include, but is not limited to, an absolute loss function, a logarithmic loss function, a quadratic loss function, an exponential loss function, and the like. The preset loss function threshold may be set according to actual conditions, and the specific value is not limited herein.
Illustratively, when the sample title text, each sample statement and the context statement of each sample statement are spliced, the sample title text, each key sample statement and the context statement of each key sample statement are spliced to obtain a sample statement set; and when the text length of the sample sentence set is less than the maximum text length of the abstract generation model, adding non-key sample sentences into the sample sentence set so that the text length of the sample sentence set is close to or equal to the maximum text length.
It can be understood that, because the text length of the sample data is relatively large, the whole sample data cannot be input into the abstract generating model for training, the more important key sample sentences need to be preferentially selected for training, and when the text length of the obtained sample sentence set is not greater than the maximum text length, part of the non-key sample sentences are selected for training.
For example, when adjusting the parameters in the digest generation model, the parameters of the digest generation model may be adjusted through a gradient descent algorithm, and the parameters of the digest generation model may also be adjusted through a back propagation algorithm, which is not limited herein.
To further ensure the privacy and security of the summary generation model, the summary generation model may be stored in a node of a blockchain.
By training the initial abstract generating model to be convergent according to the sample data, the accuracy of the abstract generating of the trained abstract generating model can be improved.
Referring to fig. 4, fig. 4 is a schematic flowchart of sub-steps of performing summary generation according to an embodiment of the present application, and specifically includes the following steps S301 to S304.
Step S301, splicing the title text, each key sentence, and the context sentence of each key sentence, to obtain a target sentence set corresponding to each key sentence.
It should be noted that, in order to solve the problem that the key sentences extracted from the sentences have faults, when the abstract is generated, the context sentences of the key sentences need to be added to improve the integrity and accuracy of the generated abstract. M sentences before and after the key sentence can be added, the value of m can be set according to the actual situation, and the specific numerical value is not limited here. For example, m is 1 to 5.
Illustratively, when splicing, a [ SEP ] [ CLS ] symbolic connection can be used between every two sentences. The [ SEP ] symbol is used to segment the statements, and the [ CLS ] symbol is used to indicate the beginning of each statement.
For example, when 1 sentence before and after the key sentence is added, the target sentence set corresponding to the obtained key sentence is: [ CLS ] [ title text ] [ SEP ] [ CLS ] [ statement 1] [ SEP ] [ CLS ] [ Key statement ] [ SEP ] [ CLS ] [ statement 2 ].
In some embodiments, after obtaining the target sentence set corresponding to each key sentence, the method may further include: and when the text length of the target sentence set is smaller than the maximum text length of the abstract generation model, adding a candidate sentence into the target sentence set, wherein the candidate sentence is a sentence of which the total importance score in the text sentence set is smaller than a first preset score threshold value but larger than a second preset score threshold value.
For example, the second preset score threshold is smaller than the first preset score threshold, and the second preset score threshold may be set according to an actual situation, and a specific numerical value is not limited herein.
It should be noted that the maximum text length refers to the maximum length of text that can be processed by the digest generation model.
When the text length of the target sentence set is smaller than the maximum text length of the abstract generating model, the candidate sentences are added to enable the text length of the target sentence set to be close to the maximum text length, and therefore the predicted scene of the abstract generating model is ensured to be consistent with the training scene.
Step S302, inputting the target sentence set corresponding to each key sentence into the vectorization model for vectorization, and obtaining a key sentence vector corresponding to each key sentence.
Illustratively, when the vectorization model is a BERT model, the target statement set corresponding to each key statement may be input into the BERT model for vectorization, so as to obtain a key statement vector corresponding to each key statement.
Step S303, inputting the key sentence vector corresponding to each key sentence into the abstraction layer to perform abstraction extraction, and obtaining an abstraction extraction result corresponding to each key sentence.
Illustratively, after the key statement vector corresponding to each key statement is obtained, the key statement vector corresponding to each key statement is input into a summarization extraction layer for summarization, and a summarization extraction result corresponding to each key statement is obtained. Wherein, the abstract extraction result comprises the prediction probability of each key statement extracted as the abstract.
Step S304, determining the target abstract information according to the abstract extraction result corresponding to each key statement.
Illustratively, when the target summary information is determined according to the summary extraction result corresponding to each key statement, the key statement with the prediction probability greater than the preset probability threshold may be determined as the target statement; and sequencing all the target sentences according to the position of each target sentence in the text sentence set, and determining the sequenced target sentences as target abstract information. The preset probability threshold may be set according to actual conditions, and the specific numerical value is not limited herein.
In the abstract generating method provided by the embodiment, the header text and the text sentence set including at least one sentence can be obtained by obtaining the target text of the abstract to be generated; by extracting sentences according to the header text and the text sentence set, the accuracy of the key sentences can be improved; iteratively updating the weight values of the nodes according to the weight values of the edges in the sentence subgraph by adopting a text sequencing algorithm, and determining a second importance score corresponding to each sentence according to the weight value of each node in the sentence subgraph, so that the importance program of the sentence in the text sentence set can be more accurately evaluated, and the accuracy of extracting the key sentence from the text sentence set can be further improved; by carrying out abstract generation according to the key sentences and the title text based on the abstract generation model, the quantity of the sentences input into the abstract generation model can be greatly reduced, the title text is added for abstract generation, and the accuracy of abstract generation is improved.
Referring to fig. 5, fig. 5 is a schematic block diagram of a summary generation apparatus 1000 for performing the foregoing summary generation method according to an embodiment of the present application. The digest generation apparatus may be configured in a server or a terminal.
As shown in fig. 5, the digest generation apparatus 1000 includes: a text acquisition module 1001, a sentence extraction module 1002, and a summary generation module 1003.
The text obtaining module 1001 is configured to obtain a target text of the abstract to be generated, where the target text includes a title text and a text sentence set including at least one sentence.
And the sentence extraction module 1002 is configured to perform sentence extraction according to the header text and the body sentence set, and obtain a key sentence corresponding to the body sentence set.
The abstract generating module 1003 is configured to perform abstract generation according to the key sentence and the title text based on an abstract generating model, and obtain target abstract information corresponding to the target text.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working processes of the apparatus and the modules described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The apparatus described above may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 6.
Referring to fig. 6, fig. 6 is a schematic block diagram of a computer device according to an embodiment of the present disclosure.
Referring to fig. 6, the computer device includes a processor and a memory connected by a system bus, wherein the memory may include a storage medium and an internal memory. The storage medium may be a nonvolatile storage medium or a volatile storage medium.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for the execution of a computer program on a non-volatile storage medium, which, when executed by a processor, causes the processor to perform any of the digest generation methods.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
acquiring a target text of a summary to be generated, wherein the target text comprises a title text and a body sentence set comprising at least one sentence; performing statement extraction according to the header text and the text statement set to obtain key statements corresponding to the text statement set; and performing abstract generation according to the key sentences and the title texts based on an abstract generation model to obtain target abstract information corresponding to the target texts.
In one embodiment, when implementing sentence extraction according to the header text and the body sentence set to obtain a key sentence corresponding to the body sentence set, the processor is configured to implement:
determining a first importance score corresponding to each sentence in the body sentence set, wherein the first importance score is an importance score between each sentence and the caption text; determining a second importance score corresponding to each statement, wherein the second importance score is the importance score of each statement in the text statement set; determining the key sentences according to the first importance score and the second importance score of each sentence.
In one embodiment, the processor, in effecting determining the first importance score corresponding to each sentence in the set of textual sentences, is operative to effect:
inputting each statement into a vectorization model for vectorization to obtain a statement vector corresponding to each statement; inputting the title text into the vectorization model for vectorization to obtain a title text vector corresponding to the title text; and calculating the similarity between the sentence vector corresponding to each sentence and the title text vector, and determining the obtained similarity as a first importance score corresponding to each sentence.
In one embodiment, the processor, in performing determining the second importance score corresponding to each of the statements, is configured to perform:
determining a statement vector corresponding to each statement; calculating the similarity between each statement and other statements according to statement vectors corresponding to different statements to obtain a similarity matrix corresponding to each statement; and determining a second importance score corresponding to each statement according to the similarity matrix corresponding to each statement.
In one embodiment, when the processor determines the second importance score corresponding to each statement according to the similarity matrix corresponding to each statement, the processor is configured to:
constructing a sentence graph of the text sentence set, wherein each node in the sentence graph corresponds to one sentence in the text sentence set, and edges are arranged between different nodes; determining the weight value of an edge in the sentence graph according to the similarity matrix corresponding to each sentence; iteratively updating the weight values of the nodes in the sentence sub-graph according to the weight values of the edges in the sentence sub-graph on the basis of a text sorting algorithm until a preset convergence condition is met; and determining a second importance score corresponding to each sentence according to the weight value of each node in the sentence graph.
In one embodiment, the processor, in effecting determining the key sentences from the first and second importance scores of each of the sentences, is adapted to effect:
carrying out weighted calculation on the first importance score and the second importance score of each statement to obtain an importance total score of each statement; and determining the sentences with the total importance scores larger than a first preset score threshold value as the key sentences.
In one embodiment, the abstract generation model comprises a vectorization model and an abstract extraction layer, and the key sentences comprise at least one; when the processor implements abstract generation according to the key sentence and the title text based on an abstract generation model and obtains target abstract information corresponding to the target text, the processor is used for implementing:
splicing the title text, each key statement and the context statement of each key statement to obtain a target statement set corresponding to each key statement; inputting the target statement set corresponding to each key statement into the vectorization model for vectorization to obtain a key statement vector corresponding to each key statement; inputting the key statement vector corresponding to each key statement into the abstract extraction layer for abstract extraction to obtain an abstract extraction result corresponding to each key statement; and determining the target abstract information according to the abstract extraction result corresponding to each key statement.
The embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, where the computer program includes program instructions, and the processor executes the program instructions to implement any one of the digest generation methods provided in the embodiments of the present application.
For example, the program is loaded by a processor and may perform the following steps:
acquiring a target text of a summary to be generated, wherein the target text comprises a title text and a body sentence set comprising at least one sentence; performing statement extraction according to the header text and the text statement set to obtain key statements corresponding to the text statement set; and performing abstract generation according to the key sentences and the title texts based on an abstract generation model to obtain target abstract information corresponding to the target texts.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital Card (SD Card), a Flash memory Card (Flash Card), and the like provided on the computer device.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for generating a summary, comprising:
acquiring a target text of a summary to be generated, wherein the target text comprises a title text and a body sentence set comprising at least one sentence;
performing statement extraction according to the header text and the text statement set to obtain key statements corresponding to the text statement set;
and performing abstract generation according to the key sentences and the title texts based on an abstract generation model to obtain target abstract information corresponding to the target texts.
2. The abstract generating method of claim 1, wherein the obtaining of the key sentences corresponding to the body sentence set by performing sentence extraction according to the caption text and the body sentence set comprises:
determining a first importance score corresponding to each sentence in the body sentence set, wherein the first importance score is an importance score between each sentence and the caption text;
determining a second importance score corresponding to each statement, wherein the second importance score is the importance score of each statement in the text statement set;
determining the key sentences according to the first importance score and the second importance score of each sentence.
3. The method of generating a summary according to claim 2, wherein the determining a first importance score corresponding to each sentence in the set of textual sentences comprises:
inputting each statement into a vectorization model for vectorization to obtain a statement vector corresponding to each statement;
inputting the title text into the vectorization model for vectorization to obtain a title text vector corresponding to the title text;
and calculating the similarity between the sentence vector corresponding to each sentence and the title text vector, and determining the obtained similarity as a first importance score corresponding to each sentence.
4. The method of generating a summary according to claim 2, wherein the determining the second importance score corresponding to each of the sentences comprises:
determining a statement vector corresponding to each statement;
calculating the similarity between each statement and other statements according to statement vectors corresponding to different statements to obtain a similarity matrix corresponding to each statement;
and determining a second importance score corresponding to each statement according to the similarity matrix corresponding to each statement.
5. The method for generating the abstract according to claim 4, wherein the determining the second importance score corresponding to each sentence according to the similarity matrix corresponding to each sentence comprises:
constructing a sentence graph of the text sentence set, wherein each node in the sentence graph corresponds to one sentence in the text sentence set, and edges are formed among different nodes;
determining the weight value of an edge in the sentence graph according to the similarity matrix corresponding to each sentence;
iteratively updating the weight values of the nodes in the sentence sub-graph according to the weight values of the edges in the sentence sub-graph on the basis of a text sorting algorithm until a preset convergence condition is met;
and determining a second importance score corresponding to each sentence according to the weight value of each node in the sentence graph.
6. The method for generating a summary according to claim 2, wherein the determining the key sentences according to the first importance score and the second importance score of each sentence comprises:
carrying out weighted calculation on the first importance score and the second importance score of each statement to obtain an importance total score of each statement;
and determining the sentences with the total importance scores larger than a first preset score threshold value as the key sentences.
7. The abstract generating method of claim 1, wherein the abstract generating model comprises a vectorization model and an abstract extracting layer, and the key sentences have at least one; the abstract generation is performed according to the key sentence and the title text based on the abstract generation model to obtain target abstract information corresponding to the target text, and the abstract generation comprises the following steps:
splicing the title text, each key statement and the context statement of each key statement to obtain a target statement set corresponding to each key statement;
inputting the target statement set corresponding to each key statement into the vectorization model for vectorization to obtain a key statement vector corresponding to each key statement;
inputting the key statement vector corresponding to each key statement into the abstract extraction layer for abstract extraction to obtain an abstract extraction result corresponding to each key statement;
and determining the target abstract information according to the abstract extraction result corresponding to each key statement.
8. An apparatus for generating a summary, comprising:
the text acquisition module is used for acquiring a target text of the abstract to be generated, wherein the target text comprises a title text and a text sentence set containing at least one sentence;
the sentence extraction module is used for performing sentence extraction according to the title text and the body sentence set to obtain a key sentence corresponding to the body sentence set;
and the abstract generating module is used for generating an abstract according to the key sentence and the title text based on an abstract generating model to obtain target abstract information corresponding to the target text.
9. A computer device, wherein the computer device comprises a memory and a processor;
the memory for storing a computer program;
the processor for executing the computer program and implementing the summary generation method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to implement the digest generation method according to any one of claims 1 to 7.
CN202210374056.8A 2022-04-11 2022-04-11 Abstract generation method and device, computer equipment and storage medium Pending CN114817523A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210374056.8A CN114817523A (en) 2022-04-11 2022-04-11 Abstract generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210374056.8A CN114817523A (en) 2022-04-11 2022-04-11 Abstract generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114817523A true CN114817523A (en) 2022-07-29

Family

ID=82534900

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210374056.8A Pending CN114817523A (en) 2022-04-11 2022-04-11 Abstract generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114817523A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115809329A (en) * 2023-01-30 2023-03-17 医智生命科技(天津)有限公司 Method for generating abstract of long text

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115809329A (en) * 2023-01-30 2023-03-17 医智生命科技(天津)有限公司 Method for generating abstract of long text
CN115809329B (en) * 2023-01-30 2023-05-16 医智生命科技(天津)有限公司 Method for generating abstract of long text

Similar Documents

Publication Publication Date Title
CN110598206B (en) Text semantic recognition method and device, computer equipment and storage medium
CN111444320B (en) Text retrieval method and device, computer equipment and storage medium
CN111859960B (en) Semantic matching method, device, computer equipment and medium based on knowledge distillation
CN106874441B (en) Intelligent question-answering method and device
US20170193086A1 (en) Methods, devices, and systems for constructing intelligent knowledge base
CN110750965B (en) English text sequence labeling method, english text sequence labeling system and computer equipment
US11232263B2 (en) Generating summary content using supervised sentential extractive summarization
CN112256822A (en) Text search method and device, computer equipment and storage medium
CN114417865B (en) Description text processing method, device and equipment for disaster event and storage medium
WO2022174496A1 (en) Data annotation method and apparatus based on generative model, and device and storage medium
CN112395875A (en) Keyword extraction method, device, terminal and storage medium
CN112686049A (en) Text auditing method, device, equipment and storage medium
CN113836303A (en) Text type identification method and device, computer equipment and medium
CN113159013A (en) Paragraph identification method and device based on machine learning, computer equipment and medium
CN111178082A (en) Sentence vector generation method and device and electronic equipment
CN114817523A (en) Abstract generation method and device, computer equipment and storage medium
CN112765357A (en) Text classification method and device and electronic equipment
CN112307738A (en) Method and device for processing text
CN113011153B (en) Text correlation detection method, device, equipment and storage medium
CN115391490A (en) Data searching method, device, equipment and storage medium
CN113962221A (en) Text abstract extraction method and device, terminal equipment and storage medium
CN113535965A (en) Method and system for large-scale classification of texts
CN111967253A (en) Entity disambiguation method and device, computer equipment and storage medium
CN112149389A (en) Resume information structured processing method and device, computer equipment and storage medium
CN113515598B (en) Method and device for extracting entity relationship of network threat intelligence document

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination