Abstract generation method and device, equipment and storage medium
Through the combination of natural language processing and GPT-3 model, the lack of coherence and readability of automatic text summary is solved, and accurate and coherent abstracts are generated, combining the advantages of extracted and generated abstracts, improving text Quality of the abstract.
Patent Information
- Application Number
- CN202411151328.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-17
AI Technical Summary
The existing automatic text summary method has shortcomings in coherence and readability. Extracted abstracts can only directly extract the original text content. Generative abstracts require key information points as input to ensure accuracy. It is difficult to combine the advantages of both to generate accuracy. A coherent and easy-to-understand summary.
The text cut and graph model is constructed for text processing using preset natural language processing methods, the sentence weight is calculated using TextRank algorithm and Word2Vec, and the vector transformation and multi-head attention mechanism processing are combined with the GPT-3 model to generate coherence and readability. Summary of .
By extracting key information points and using powerful language models to generate coherent and meaningful abstracts, the readability and coherence of the abstract are improved.
Smart Images

Figure CN119150808A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a summary generation method, device, equipment and storage medium. Background Art
[0002] Automatic text summarization technology is an important research direction in the field of natural language processing (NLP, i.e. Neuro-Linguistic Programming). It can help users obtain the core content of a large amount of text in a short time. Existing automatic text summarization methods are mainly divided into two categories: extractive summarization and generative summarization. The extractive summarization method generates a summary by selecting key sentences or words from the source text. Since this method can only directly extract the content of the original text, the generated summary may have certain problems in coherence and readability. The generative summarization method learns the information of the source text and generates new sentences as summaries, but it requires appropriate key information points as input to ensure the accuracy of the summary.
[0003] Therefore, how to combine the advantages of extractive and generative methods to accurately extract key information and generate coherent and easy-to-understand summaries is an important challenge facing the current field of automatic text summarization. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a summary generation method, device, equipment and storage medium, which can generate a summary with coherence and readability. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a method for generating a summary, comprising:
[0006] Using a preset natural language processing method to perform text segmentation processing on the acquired text to be processed to obtain segmented text, and constructing a target graph model of the text to be processed based on the segmented text;
[0007] Determine a weight array of each of the segmented texts in the target graph model based on a preset weight calculation formula in the preset natural language processing method, and determine a target segmented text from each of the segmented texts based on the weight array;
[0008] The target segmented text is subjected to corresponding vector transformation to obtain an input vector, and the input vector is input into a preset language model for training to generate a summary of the text to be processed.
[0009] Optionally, the step of performing text segmentation processing on the acquired text to be processed by using a preset natural language processing method to obtain segmented text, and constructing a target graph model of the text to be processed based on the segmented text includes:
[0010] The acquired text to be processed is segmented by using the TextRank algorithm to obtain segmented text, and the segmented text is sentence-processed to construct a TextRank graph model to obtain a processing graph model;
[0011] Each sentence in the graph model being processed is segmented to obtain each target word, and stop words and sensitive words in each target word are filtered to obtain a target graph model of the text to be processed.
[0012] Optionally, before determining the weight array of each segmented text in the target graph model based on the preset weight calculation formula in the preset natural language processing method, the method further includes:
[0013] Based on a preset cosine similarity calculation method, each of the segmented texts in the target graph model is converted into a corresponding processing vector, and the semantic similarity between each of the segmented texts in the target graph model is determined based on the processing vector.
[0014] Optionally, the step of determining a weight array of each segmented text in the target graph model based on a preset weight calculation formula in the preset natural language processing method, and determining a target segmented text from each segmented text based on the weight array, comprises:
[0015] Iteratively training the weights of each of the segmented texts in the target graph model based on a preset weight calculation formula in the preset natural language processing method and the semantic similarity to obtain a corresponding weight array;
[0016] A target segmented text is determined from each of the segmented texts, wherein the weight of the weight array corresponding to the target segmented text is greater than that of other segmented texts in each of the segmented texts.
[0017] Optionally, performing corresponding vector conversion on the target segmented text to obtain an input vector includes:
[0018] Using a hidden Markov model to perform word segmentation on the target segmented text and convert it into corresponding tokens;
[0019] The token is mapped to a preset high-dimensional vector space to form an embedding vector to obtain an input vector corresponding to the target segmented text.
[0020] Optionally, inputting the input vector into a preset language model for training to generate a summary of the text to be processed includes:
[0021] Input the input vector into the GPT-3 model, and transform the input vector through the multi-head attention mechanism and transformation layer in the GPT-3 model to obtain an output vector;
[0022] The output vector is decoded using a linear transformation layer and a softmax function in the GPT-3 model to generate a summary of the text to be processed.
[0023] Optionally, the converting the input vector through the multi-head attention mechanism and the transformation layer in the GPT-3 model to obtain the output vector includes:
[0024] Linearly transform the input vector through the multi-head attention mechanism in the GPT-3 model to obtain a query vector, a key vector, and a value vector;
[0025] Performing a dot product calculation on the query vector and the key vector, and normalizing the result of the dot product calculation using a preset normalization function to obtain a first output value;
[0026] The first output value is used to perform weighted summation on the value vector to obtain a second output value, and the second output value is input into the change layer in the GPT-3 model for processing to obtain an output vector.
[0027] In a second aspect, the present application discloses a summary generation device, comprising:
[0028] A model building module, used to perform text segmentation processing on the acquired text to be processed using a preset natural language processing method to obtain segmented text, and to build a target graph model of the text to be processed based on the segmented text;
[0029] A target text determination module, used to determine a weight array of each of the segmented texts in the target graph model based on a preset weight calculation formula in the preset natural language processing method, and determine a target segmented text from each of the segmented texts based on the weight array;
[0030] The summary generation module is used to perform corresponding vector conversion on the target segmented text to obtain an input vector, and input the input vector into a preset language model for training to generate a summary of the text to be processed.
[0031] In a third aspect, the present application discloses an electronic device, comprising:
[0032] Memory, used to store computer programs;
[0033] A processor is used to execute the computer program to implement the aforementioned summary generation method.
[0034] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned summary generation method when executed by a processor.
[0035] In this embodiment, a preset natural language processing method is used to perform text segmentation processing on the acquired text to be processed to obtain a segmented text, and a target graph model of the text to be processed is constructed based on the segmented text; a weight array of each segmented text in the target graph model is determined based on a preset weight calculation formula in the preset natural language processing method, and a target segmented text is determined from each segmented text based on the weight array; a corresponding vector transformation is performed on the target segmented text to obtain an input vector, and the input vector is input into a preset language model for training to generate a summary of the text to be processed. That is, the key information points are extracted from the text to be processed by the preset natural language processing method, and a coherent and meaningful summary of the key information points is formed using the preset language model. In this way, the advantages of extractive summarization and generative summarization are fully considered, so that the generated text summary has good readability and coherence. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0037] Figure 1 A flowchart of a method for generating an abstract disclosed in this application;
[0038] Figure 2 A flowchart of a specific abstract generation method disclosed in this application;
[0039] Figure 3 This is a schematic diagram of the structure of a summary generation device disclosed in this application;
[0040] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0042] Existing automatic text summarization methods are mainly divided into two categories: extractive summarization and generative summarization. The extractive summarization method generates a summary by selecting key sentences or words from the source text. Since this method can only directly extract the content of the original text, the generated summary may have certain problems in coherence and readability. The generative summarization method learns the information of the source text and generates new sentences as the summary, but appropriate key information points are required as input to ensure the accuracy of the summary. Therefore, this application will specifically introduce a summary generation method that can generate an accurate, coherent, and highly readable summary.
[0043] See Figure 1 As shown, an embodiment of this application discloses a summary generation method, including:
[0044] Step S11: Use a preset natural language processing method to perform text cutting processing on the obtained text to be processed to obtain segmented text, and construct a target graph model of the text to be processed based on the segmented text.
[0045] In this embodiment, the use of a preset natural language processing method to perform text cutting processing on the obtained text to be processed to obtain segmented text, and construct a target graph model of the text to be processed based on the segmented text includes: using the TextRank algorithm to perform paragraphing processing on the obtained text to be processed to obtain segmented text, and performing sentence splitting processing on the segmented text and then constructing a TextRank graph model to obtain an intermediate graph model during processing; performing word segmentation processing on each sentence in the intermediate graph model during processing to obtain each target word, and filtering out stop words and sensitive words in each target word to obtain the target graph model of the text to be processed. First, it should be noted that TextRank (an unsupervised natural language processing algorithm) is widely used in text processing tasks. By cutting the text into individual components (such as words or sentences), a graph model is established, and the important parts of the text are voted and ranked in the graph. That is, the document is regarded as a network of words or sentences, and the links in the network represent the semantic relationships between words (sentences and sentences). Specifically, first perform paragraphing processing on the text to be processed; then perform sentence splitting processing on the paragraphs and construct a TextRank graph model; after completing the construction of the graph model, perform word segmentation processing on the sentences in the graph model to obtain different words; then filter the obtained words for stop words and sensitive words. Stop words in natural language processing refer to those words that frequently appear in the text but contribute little to the actual meaning of the text, such as words like "le", "de", "zai", etc. These words are usually filtered out or ignored in the text preprocessing stage to reduce the data dimension and improve the analysis efficiency.
[0046] Step S12: Determine a weight array of each segmented text in the target graph model based on a preset weight calculation formula in the preset natural language processing method, and determine a target segmented text from each segmented text based on the weight array.
[0047] In this embodiment, before determining the weight array of each segmented text in the target graph model based on the preset weight calculation formula in the preset natural language processing method, it also includes:
[0048] Based on the preset cosine similarity calculation method, each of the segmented texts in the target graph model is converted into a corresponding processing vector, and the semantic similarity between each of the segmented texts in the target graph model is determined based on the processing vector. Specifically, that is, after preprocessing the input text, the edge set in the graph model is constructed, and the construction principle of the edge set is mainly based on the similarity between sentences. The similarity of sentences in this application will adopt the cosine similarity method of Word2vec (word tovector, a group of related models used to generate word vectors). By converting each word into a vector, it is possible to measure the relationship between words in a quantitative way and to explore the connection between words. In this way, semantic characteristics such as part of speech, synonyms, and antonyms can be fully considered, thereby improving the accuracy of automatic summarization.
[0049] In this embodiment, the weight array of each segmented text in the target graph model is determined based on the preset weight calculation formula in the preset natural language processing method, and the target segmented text is determined from each segmented text based on the weight array, including: iteratively training the weights of each segmented text in the target graph model based on the preset weight calculation formula in the preset natural language processing method and the semantic similarity to obtain a corresponding weight array; determining the target segmented text from each segmented text, wherein the weight of the weight array corresponding to the target segmented text is greater than that of other segmented texts in each segmented text. Specifically, after obtaining the similarity of the sentences, the weights of each sentence can be iteratively calculated according to the following formula:
[0050] ;
[0051] Where, where, where V is the set of vertices. For vertex V i ,ln(V i ) is linked to vertex V i The vertex set, out(V j ) is the value from vertex V i The set of vertices pointed to by the link, WS(V i) represents the weight of sentence i, and the sum on the right represents the contribution of each adjacent sentence to the sentence, that is, the score of each vertex. In a single document, we can roughly assume that all sentences are adjacent, and there is no need to generate and extract multiple windows like in multiple documents. Only a single document window is needed, W ji Indicates the similarity between two sentences. WS(V j ) represents the weight of sentence j from the last iteration. d is the damping coefficient, which is generally 0.85. Through continuous iterative calculation, until the absolute value of the difference between the value of any point in the graph and the result of the last iteration is less than 0.0001, the weight array is finally output. Then, the obtained weight array is sorted in reverse order, and M sentences with the largest weights are selected as candidate abstracts. It should be noted that the value of M can be set according to actual conditions.
[0052] Step S13: performing corresponding vector conversion on the target segmented text to obtain an input vector, and inputting the input vector into a preset language model for training to generate a summary of the text to be processed.
[0053] In this embodiment, the target segmented text is subjected to corresponding vector conversion to obtain an input vector, including: using a hidden Markov model to perform word segmentation on the target segmented text and convert it into a corresponding token; mapping the token to a preset high-dimensional vector space to form an embedding vector to obtain an input vector corresponding to the target segmented text. That is, the obtained candidate abstract sentence is segmented, and based on the statistical machine learning model HMM (Hidden Markov Model, i.e., hidden Markov model) algorithm, the abstract sentence is finally converted into a series of units called tokens. The word segmentation process enables the model to better understand and process natural language. Each token carries a certain specific semantic information, for example: a verb may represent an action, and a noun may represent an object. Through tokenization, in this embodiment, each part with independent meaning in the text is extracted and provided to the model for subsequent learning and understanding in a structured manner. Then, the sequence after word segmentation is stemmed, such as normalizing "driving" and "driving" to "driving". Then, each token is mapped to a high-dimensional vector space to form a so-called embedding vector. This vector represents the semantic information learned about the token in the training data, helping the model understand the complexity and diversity of language.
[0054] In this embodiment, the input vector is input into a preset language model for training to generate a summary of the text to be processed, including: inputting the input vector into a GPT-3 model, and transforming the input vector through a multi-head attention mechanism and a transformation layer in the GPT-3 model to obtain an output vector; decoding the output vector using a linear transformation layer and a softmax function in the GPT-3 model to generate a summary of the text to be processed. Specifically, the input vector is transformed through a multi-head attention mechanism and a transformation layer in the GPT-3 model to obtain an output vector, including: linearly changing the input vector through a multi-head attention mechanism in the GPT-3 model to obtain a query vector, a key vector, and a value vector; performing a dot product calculation on the query vector and the key vector, and normalizing the result of the dot product calculation using a preset normalization function to obtain a first output value; performing a weighted summation on the value vector using the first output value to obtain a second output value, and inputting the second output value into the change layer in the GPT-3 model for processing to obtain an output vector.
[0055] The core function of GPT-3 (artificial intelligence language model, used for language translation and text generation for chatbots, etc.) is to model the input text through self-attention mechanism and feedforward neural network and generate the corresponding summary. That is, for each input (i.e. input vector), the model generates three new vectors: Query, Key and Value. These vectors are not generated directly from the original input vector, but are obtained by linear transformation of the input vector. Then in the multi-head mechanism, each Query vector, Key vector and Value vector are cut into h parts, where h is the number of heads. This allows the model to capture different representations of the input at the same time. Then dot product is done for each Query vector and all Key vectors, and the calculation result can get the original attention score, and then, in order to ensure stability and interpretability, it is solved here by dividing by the scaling factor. In Decoder (computer language function, which means converting a sequence of encoded bytes into a set of characters), masking also needs to be applied to prevent the leakage of future information on the right. Masking here is an important technique to prevent the model from "peeking" at future information when generating sequences. The above dot product result is then passed to the softmax function for normalization so that the sum of all scores is 1. The specific calculation formula is as follows:
[0056] ;
[0057] in, z iis the output value of the ith node, C is the number of output nodes, and this formula can be used to output a new vector of the same length as the original vector, and all elements of the new vector satisfy the following conditions: all node values are between (0,1); the sum of all elements is 1. Use the above softmax output to perform weighted summation on the value vector. The output of each token is the weighted sum of its corresponding value vector and the attention score of the token. The weighted summation formula is:
[0058] ;
[0059] Among them, d k is the dimension size of Q and K, mainly to maintain the stability and interpretability of the original attention score. Then according to the following formula:
[0060] ;
[0061] The output vectors of all heads are concatenated and linearly transformed to obtain the final output. is the input vector, , , are the learned d-dimensional Query (query vector), Key (key vector) and Value (value vector), h is the number of heads, head i represents the i-th attention head, W o is the weight parameter of the linear projection. Each attention head is obtained by performing self-attention calculation on Q, K, and V. i The calculation formulas for Q are as follows:
[0062] ;
[0063] ;
[0064] In the above formula, , , , are the learned projection matrices, q, k, v are the dimensions of the query, key, and value vectors, respectively.
[0065] In this embodiment, the second output value is input into the change layer in the GPT-3 model for processing to obtain an output vector. Specifically, the second output value is first used as the input of the forward feed network. The forward feed network is a simple fully connected neural network, which includes two layers of linear transformations and an activation function in the middle, such as ReLU (Adaptively Parametric Rectifier Linear Unit, a nonlinear activation function), where the specific formula of ReLU is as follows:
[0066] ;
[0067] Where x is the input signal. The advantage of the ReLU function is that it is very fast to calculate and does not have the problem of gradient disappearance. Then, a residual connection is added to the output of each sublayer (i.e., the self-attention sublayer and the forward feed network sublayer) and layer normalization is performed. Residual connections can help information flow more smoothly between layers, while layer normalization can stabilize the training process of the model. The token vector after the above deep transformation is converted into output. In generation tasks (such as text summarization), the output is usually a coherent natural language text, which is generated by the model based on its current understanding of the context. The process passes the output of the last encoder layer to a linear transformation layer, and then uses the softmax function to obtain the probability distribution of each possible token. Finally, the token with the highest probability is selected as the output of this step, which forms the automatic summary content of the input text.
[0068] It can be seen that in this application, the candidate text summary is obtained by the TextRank method, and key information points are extracted from the given source text. These information points include the most important sentences or phrases, which provide the basis for understanding the text content; and the Word2Vec method is used to calculate the similarity between sentences, which fully considers the semantic characteristics such as word parts, synonyms, and antonyms of words, rather than simple physical similarity; based on TextRank, automatic summary is generated based on GPT-3, which fully considers the coherence and readability of the generated summary sentences.
[0069] See also Figure 2As shown, the embodiment of the present application discloses a specific summary generation method, firstly, the input text is preliminarily processed based on TextRank, during which the Word2Vec method is used to calculate the similarity between sentences, fully considering the semantic characteristics of the word's part of speech, synonyms, antonyms, etc., and finally obtaining the candidate abstract sentence; then through the various processing processes of the GPT-3 model, including: tokenization, embedding vector, multi-head attention mechanism, hierarchical change, decoding and generation, finally outputting a text summary that takes into account accuracy, readability and coherence. In other words, the summary is generated by selecting key sentences or words from a given source text using the TextRank algorithm, wherein the weight of each last node of TextRank is adjusted, and the candidate abstract sentence is generated; then the text generated by TextRank is input into the model using GPT-3, and then the generated deep learning model is used to form the generated summary into a coherent and meaningful summary. This takes into account the advantages of both extractive summarization and generative summarization, and since TextRank can effectively extract key sentences or words from the source text, it can provide an important basis for the subsequent generation of coherent summaries. GPT-3 is a powerful deep learning model that has the ability to understand and generate natural language text. It can generate coherent and meaningful summaries based on the key information extracted by TextRank, so that the generated text summary has good readability and coherence.
[0070] refer to Figure 3 The embodiment of the present application also discloses a summary generation device, including:
[0071] The model building module 11 is used to perform text segmentation processing on the acquired text to be processed by using a preset natural language processing method to obtain segmented text, and to build a target graph model of the text to be processed based on the segmented text;
[0072] A target text determination module 12, used to determine a weight array of each of the segmented texts in the target graph model based on a preset weight calculation formula in the preset natural language processing method, and determine a target segmented text from each of the segmented texts based on the weight array;
[0073] The summary generation module 13 is used to perform corresponding vector conversion on the target segmented text to obtain an input vector, and input the input vector into a preset language model for training to generate a summary of the text to be processed.
[0074] In this embodiment, the key information points are extracted from the text to be processed by a preset natural language processing method, and a coherent and meaningful summary is formed for the key information points using a preset language model. In this way, the advantages of extractive summarization and generative summarization are fully considered, so that the generated text summary has good readability and coherence.
[0075] In some specific embodiments, the model building module 11 may specifically include:
[0076] A text segmentation unit is used to segment the acquired text to be processed using the TextRank algorithm to obtain segmented text, and to construct a TextRank graph model after sentence processing on the segmented text to obtain a processing graph model;
[0077] The word filtering unit is used to perform word segmentation processing on each sentence in the graph model being processed to obtain each target word, and filter the stop words and sensitive words in each target word to obtain the target graph model of the text to be processed.
[0078] In some specific embodiments, the summary generating device may further include:
[0079] A similarity calculation module is used to convert each of the segmented texts in the target graph model into a corresponding processing vector based on a preset cosine similarity calculation method, and determine the semantic similarity between each of the segmented texts in the target graph model based on the processing vector.
[0080] In some specific embodiments, the target text determination module 12 may specifically include:
[0081] A weight array determination unit, configured to iteratively train the weights of each of the segmented texts in the target graph model based on a preset weight calculation formula in the preset natural language processing method and the semantic similarity to obtain a corresponding weight array;
[0082] The text selection unit is used to determine a target segmented text from the segmented texts, wherein the weight of the weight array corresponding to the target segmented text is greater than that of other segmented texts in the segmented texts.
[0083] In some specific embodiments, the summary generation module 13 may specifically include:
[0084] A token conversion unit, used for performing word segmentation processing on the target segmented text by using a hidden Markov model and converting the word segmentation into corresponding tokens;
[0085] A vector mapping unit is used to map the token to a preset high-dimensional vector space to form an embedding vector to obtain an input vector corresponding to the target segmented text.
[0086] In some specific embodiments, the summary generation module 13 may specifically include:
[0087] A vector conversion submodule, used to input the input vector into the GPT-3 model, and transform the input vector through the multi-head attention mechanism and transformation layer in the GPT-3 model to obtain an output vector;
[0088] A vector decoding unit is used to decode the output vector using a linear transformation layer and a softmax function in the GPT-3 model to generate a summary of the text to be processed.
[0089] In some specific embodiments, the vector conversion submodule may specifically include:
[0090] A vector transformation unit, configured to linearly transform the input vector through a multi-head attention mechanism in the GPT-3 model to obtain a query vector, a key vector, and a value vector;
[0091] a result normalization unit, configured to perform a dot product calculation on the query vector and the key vector, and normalize the result of the dot product calculation using a preset normalization function to obtain a first output value;
[0092] A target vector determination unit is used to perform weighted summation on the value vector using the first output value to obtain a second output value, and input the second output value into the change layer in the GPT-3 model for processing to obtain an output vector.
[0093] Furthermore, the present application also discloses an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be considered as any limitation on the scope of use of the present application.
[0094] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the summary generation method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0095] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0096] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0097] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, and may be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the summary generation method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 may further include a computer program that can be used to complete other specific tasks.
[0098] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed method for generating a summary. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.
[0099] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0100] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0101] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0102] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0103] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for generating a summary, characterized in that: include: Using a preset natural language processing method to perform text segmentation processing on the acquired text to be processed to obtain segmented text, and constructing a target graph model of the text to be processed based on the segmented text; Determine a weight array of each of the segmented texts in the target graph model based on a preset weight calculation formula in the preset natural language processing method, and determine a target segmented text from each of the segmented texts based on the weight array; The target segmented text is subjected to corresponding vector transformation to obtain an input vector, and the input vector is input into a preset language model for training to generate a summary of the text to be processed.
2. The method for generating a summary according to claim 1, characterized in that: The method of performing text segmentation processing on the acquired text to be processed by using a preset natural language processing method to obtain segmented text, and constructing a target graph model of the text to be processed based on the segmented text, includes: The acquired text to be processed is segmented by using the TextRank algorithm to obtain segmented text, and the segmented text is sentence-processed to construct a TextRank graph model to obtain a processing graph model; Each sentence in the graph model being processed is segmented to obtain each target word, and stop words and sensitive words in each target word are filtered to obtain a target graph model of the text to be processed.
3. The method for generating a summary according to claim 1, characterized in that: Before determining the weight array of each segmented text in the target graph model based on the preset weight calculation formula in the preset natural language processing method, the method further includes: Based on a preset cosine similarity calculation method, each of the segmented texts in the target graph model is converted into a corresponding processing vector, and the semantic similarity between each of the segmented texts in the target graph model is determined based on the processing vector.
4. The method for generating a summary according to claim 3, characterized in that: The step of determining a weight array of each segmented text in the target graph model based on a preset weight calculation formula in the preset natural language processing method, and determining a target segmented text from each segmented text based on the weight array, includes: Iteratively training the weights of each of the segmented texts in the target graph model based on a preset weight calculation formula in the preset natural language processing method and the semantic similarity to obtain a corresponding weight array; A target segmented text is determined from each of the segmented texts, wherein the weight of the weight array corresponding to the target segmented text is greater than that of other segmented texts in each of the segmented texts.
5. The method for generating a summary according to claim 1, wherein: The step of performing corresponding vector conversion on the target segmented text to obtain an input vector includes: Using a hidden Markov model to perform word segmentation on the target segmented text and convert it into corresponding tokens; The token is mapped to a preset high-dimensional vector space to form an embedding vector to obtain an input vector corresponding to the target segmented text.
6. The method for generating a summary according to any one of claims 1 to 5, characterized in that: The step of inputting the input vector into a preset language model for training to generate a summary of the text to be processed includes: Input the input vector into the GPT-3 model, and transform the input vector through the multi-head attention mechanism and transformation layer in the GPT-3 model to obtain an output vector; The output vector is decoded using a linear transformation layer and a softmax function in the GPT-3 model to generate a summary of the text to be processed.
7. The method for generating a summary according to claim 6, characterized in that: The converting the input vector through the multi-head attention mechanism and the transformation layer in the GPT-3 model to obtain the output vector includes: Linearly transform the input vector through the multi-head attention mechanism in the GPT-3 model to obtain a query vector, a key vector, and a value vector; Performing a dot product calculation on the query vector and the key vector, and normalizing the result of the dot product calculation using a preset normalization function to obtain a first output value; The first output value is used to perform weighted summation on the value vector to obtain a second output value, and the second output value is input into the change layer in the GPT-3 model for processing to obtain an output vector.
8. A summary generation device, characterized in that: include: A model building module, used to perform text segmentation processing on the acquired text to be processed using a preset natural language processing method to obtain segmented text, and to build a target graph model of the text to be processed based on the segmented text; A target text determination module, used to determine a weight array of each of the segmented texts in the target graph model based on a preset weight calculation formula in the preset natural language processing method, and determine a target segmented text from each of the segmented texts based on the weight array; The summary generation module is used to perform corresponding vector conversion on the target segmented text to obtain an input vector, and input the input vector into a preset language model for training to generate a summary of the text to be processed.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the abstract generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the abstract generation method according to any one of claims 1 to 7.
Citation Information
Cited By
Text processing method and device, electronic equipment, storage medium and program product
CN120523936A
