Abstract extraction method and related device
By combining the scores of importance and relevance in the summary extraction method, and using the BERT model and TextRank algorithm, we solve the problem in the existing technology that summary extraction is difficult to reflect the information of concern in specific application scenarios, generate high-quality summary text, and improve reading. experience and text quality.
Patent Information
- Application Number
- CN202210151621.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-18
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2042-02-18
AI Technical Summary
Existing summary extraction methods are difficult to reflect the information that readers care about in specific application scenarios, resulting in low-quality summary texts that cannot meet the actual needs of readers.
By determining the importance and target relevance of each text unit in the target text, combined with the BERT model and TextRank algorithm, we can extract summary text units that can reflect the main purpose of the text and the focus of the application scenario, and generate high-quality summary text.
The comprehensive quality of the summary text is improved, enabling it to reflect both the main idea of the text and the key content in specific application scenarios, thereby improving the reading experience and meeting the actual needs of the reading objects.
Smart Images

Figure CN116662536B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a summary extraction method and related devices. Background Art
[0002] Abstract extraction refers to the process of processing text to generate a concise and concise summary text that can summarize the meaning of the text. By reading the extracted summary text, the reader can grasp the main content of the text, thereby saving reading time and improving reading efficiency.
[0003] At present, there are two main types of summary extraction methods, namely extractive summarization and generative summarization. Extractive summarization refers to extracting sentences that can represent the main idea of the text from the text, and then using the extracted sentences to form a summary text. Generative summarization refers to analyzing and understanding the semantic content of the text, and then generating new text as a summary text based on it.
[0004] However, the above-mentioned summary extraction methods generally have the following problems: the generated summary text only focuses on reflecting the main idea of the text, but cannot reflect the specific content of interest in the application scenario. For example, in the public opinion recognition scenario, the reader often expects to learn about the information related to the public opinion in the text by reading the summary text. However, since the summary text is generated by only focusing on the main idea of the text, and not considering the information related to the public opinion, the generated summary text is difficult to reflect the information that the reader is more concerned about. Summary of the invention
[0005] The embodiment of the present application provides a summary extraction method and related devices, which can ensure that the generated summary text can reflect both the main idea of the text and the information that the reader is more concerned about in a specific application scenario.
[0006] In view of this, the first aspect of the present application provides a method for extracting an abstract, the method comprising:
[0007] Get the target text to be extracted;
[0008] Determining the importance of each text unit in the target text; the importance is used to represent the importance of the content expressed by the text unit in the target text;
[0009] Determine the target relevance of each text unit in the target text; the target relevance is used to characterize the degree of relevance between the content expressed by the text unit and the target focus content, where the target focus content is the content that is focused on in the target application scenario;
[0010] According to the importance and target relevance of each text unit in the target text, a summary text unit is extracted from the target text; based on the summary text unit, a summary text corresponding to the target text in the target application scenario is determined.
[0011] A second aspect of the present application provides a summary extraction device, the device comprising:
[0012] A text acquisition module is used to acquire the target text to be extracted and summarized;
[0013] An importance determination module, used to determine the importance of each text unit in the target text; the importance is used to represent the importance of the content expressed by the text unit in the target text;
[0014] A relevance determination module is used to determine the target relevance of each text unit in the target text; the target relevance is used to characterize the degree of relevance between the content expressed by the text unit and the target focus content, and the target focus content is the content that is focused on in the target application scenario;
[0015] The summary determination module is used to extract summary text units from the target text according to the importance and target relevance of each text unit in the target text; based on the summary text units, determine the summary text corresponding to the target text in the target application scenario.
[0016] A third aspect of the present application provides a computer device, the device comprising a processor and a memory:
[0017] The memory is used to store computer programs;
[0018] The processor is used to execute the steps of the abstract extraction method as described in the first aspect according to the computer program.
[0019] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the steps of the abstract extraction method described in the first aspect.
[0020] In a fifth aspect, the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of the abstract extraction method described in the first aspect above.
[0021] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0022] The embodiment of the present application provides a summary extraction method. In the process of extracting summary text, the method innovatively uses the degree of correlation between the content expressed by each text unit in the text and the key focus content in a specific application scenario as one of the reference factors for extracting summary text units, so that the generated summary text can reflect the information related to the key focus content in the specific application scenario. Specifically, in the summary extraction method provided in the embodiment of the present application, for the target text to be extracted, it is necessary to determine the importance and target relevance of each text unit in the target text; wherein the importance is used to characterize the importance of the content expressed by the text unit in the target text; the target relevance is used to characterize the degree of correlation between the content expressed by the text unit and the target focus content, which is the key focus content in the target application scenario; then, according to the importance and target relevance of each text unit in the target text, the summary text unit is extracted from the target text, and based on the extracted summary text unit, the summary text corresponding to the target text in the target application scenario is determined. In this way, in the process of generating the summary text corresponding to the target text in the target application scenario, considering the importance of each text unit in the target text can ensure that the generated summary text can include text units with higher importance in the target text, so that the generated summary text can reflect the main purpose of the target text; considering the degree of correlation between each text unit in the target text and the target focus content, it can ensure that the generated summary text can include text units in the target text with higher relevance to the focus content in the target application scenario, so that the generated summary text can reflect the information that the reading object focuses on in the target application scenario; thereby achieving the purpose of improving the comprehensive quality of the summary text. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A schematic diagram of an application scenario of the abstract extraction method provided in an embodiment of the present application;
[0024] Figure 2 A schematic diagram of a process for extracting an abstract provided in an embodiment of the present application;
[0025] Figure 3 A schematic diagram of a graph structure corresponding to a target text provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of the working principle of the BERT model provided in the embodiment of the present application;
[0027] Figure 5 A schematic diagram of the implementation process of extracting summary text units from target text provided in an embodiment of the present application;
[0028] Figure 6A schematic diagram of the structure of a first abstract extraction device provided in an embodiment of the present application;
[0029] Figure 7 A schematic diagram of the structure of a second abstract extraction device provided in an embodiment of the present application;
[0030] Figure 8 A schematic diagram of the structure of a third abstract extraction device provided in an embodiment of the present application;
[0031] Fig. 9 A schematic diagram of the structure of a fourth abstract extraction device provided in an embodiment of the present application;
[0032] Fig.10 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0033] Fig.11 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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.
[0035] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0036] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0037] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, mechatronics and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.
[0038] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0039] The solution provided in the embodiments of the present application relates to the natural language processing technology of artificial intelligence, which is specifically described by the following embodiments:
[0040] The summary text extracted by existing methods such as extractive summarization or generative summarization can often only reflect the main idea of the text, but cannot reflect the information related to the content that the reader focuses on in a specific application scenario. The generated summary text is of low quality and difficult to meet the actual needs of the reader, and the reading experience of the summary text is poor.
[0041] In order to solve the above technical problems, an embodiment of the present application provides a summary extraction method, which can ensure that the generated summary text can not only reflect the main purpose of the text, but also reflect the information that the reading object is more concerned about in a specific application scenario, thereby improving the quality of the generated summary text.
[0042] Specifically, in the summary extraction method provided in the embodiment of the present application, the target text to be extracted is first obtained. Then, the importance and target relevance of each text unit in the target text are determined; wherein the importance is used to characterize the importance of the content expressed by the text unit in the target text; the target relevance is used to characterize the degree of relevance between the content expressed by the text unit and the target focus content, where the target focus content is the content that is focused on in the target application scenario. Then, based on the importance and target relevance of each text unit in the target text, the summary text unit is extracted from the target text; and based on the extracted summary text unit, the summary text corresponding to the target text in the target application scenario is determined.
[0043] The above-mentioned summary extraction method, in the process of generating the summary text corresponding to the target text in the target application scenario, will consider the importance of each text unit in the target text on the one hand, so as to ensure that the generated summary text can include the text units with higher importance in the target text, so that the generated summary text can reflect the main theme of the target text. On the other hand, the degree of correlation between each text unit in the target text and the target content of interest will be considered, so as to ensure that the generated summary text can include the text units in the target text with higher relevance to the content focused on in the target application scenario, so that the generated summary text can reflect the information focused on by the reader in the target application scenario. In this way, the purpose of improving the comprehensive quality of the summary text is achieved, so that the generated summary text can meet the actual needs of the reader and improve the reading experience of the reader for the summary text.
[0044] It should be understood that the summary extraction method provided in the embodiment of the present application can be executed by a computer device with natural language processing capabilities, and the computer device can be a terminal device or a server. Among them, the terminal device can specifically be a mobile phone, a computer, an intelligent voice interaction device, a smart home appliance, a vehicle terminal, an aircraft, etc. The server can specifically be an application server or a Web server. In actual deployment, it can be an independent server, or a cluster server or cloud server composed of multiple physical servers. The relevant data involved in the embodiment of the present application can be stored on the blockchain.
[0045] To facilitate understanding of the summary extraction method provided in the embodiment of the present application, the following uses the execution subject of the summary extraction method as a server as an example to exemplarily introduce the application scenario of the summary extraction method.
[0046] See also Figure 1 , Figure 1 Schematic diagram of application scenario of the abstract extraction method provided in the embodiment of the present application. Figure 1As shown, the application scenario includes a server 110 and a database 120. The server 110 can retrieve data from the database 120 through a network, or the database 120 can also be integrated in the server 110. The server 110 is used to execute the summary extraction method provided in the embodiment of the present application to generate a summary text corresponding to the target text; the database 120 is used to store the text to be extracted.
[0047] In actual applications, the server 110 can retrieve any text from the database 120 as the target text to be extracted. It should be understood that the text stored in the database 120 can be the text crawled from the web page data by a web crawler, or it can be the text uploaded by a specific object (such as the text published or uploaded by the user of a certain application through the application client), and the present application does not impose any limitation on the source of the text stored in the database 120.
[0048] After the server 110 obtains the target text, it can determine the importance of each text unit in the target text; the importance is used to characterize the importance of the content expressed by the text unit in the target text. It should be understood that the higher the importance of the text unit, the more the content expressed by the text unit can reflect the main idea of the target text. As an example, the server 110 can use a specific algorithm that can measure the importance of text units to determine the importance of each text unit in the target text; or, the server 110 can also use a pre-trained neural network model for measuring the importance of text units to determine the importance of each text unit in the target text.
[0049] In addition, the server 110 can also determine the target relevance of each text unit in the target text; the target relevance is used to characterize the degree of relevance between the content expressed by the text unit and the target focus content, where the target focus content is the focus content in the target application scenario. It should be understood that the higher the target relevance of the text unit, the more relevant the content expressed by the text unit is to the focus content in the target application scenario. As an example, the server 110 can use a pre-trained neural network model for measuring the degree of relevance between a text unit and the target focus content to determine the target relevance of each text unit in the target text.
[0050] After the server 110 determines the importance and target relevance of each text unit in the target text, it can select a summary text unit from the text units included in the target text according to the importance and target relevance of each text unit in the target text; then, based on the selected summary text unit, determine the summary text corresponding to the target text in the target application scenario.
[0051] It should be understood that Figure 1The application scenarios shown are only examples. In actual applications, the server 110 can obtain the target text to be extracted from the database 120, or directly obtain the target text uploaded by the terminal device. In addition, the summary extraction method provided in the embodiment of the present application can also be executed by the terminal device, or by the terminal device and the server in collaboration. The application scenarios of the summary extraction method provided in the embodiment of the present application are not limited here.
[0052] The abstract extraction method provided in this application is described in detail below through a method embodiment.
[0053] See also Figure 2 , Figure 2 Schematic diagram of the process flow of the abstract extraction method provided in the embodiment of the present application. For the convenience of description, the following embodiment is still introduced by taking the execution subject of the abstract extraction method as a server as an example. Figure 2 As shown, the summary extraction method includes the following steps:
[0054] Step 201: Obtain the target text to be extracted.
[0055] In the embodiment of the present application, when the server performs the summary extraction task, it is necessary to first obtain the text of the summary to be extracted. For the sake of distinction, the present application refers to the text of the summary to be extracted as the target text.
[0056] In a possible implementation, the server can retrieve the target text to be extracted from the database. Exemplarily, a large number of texts to be extracted can be stored in the database. When the server performs the summary extraction task, the server can retrieve any one or more texts from the database through the network as the target text to be extracted. It should be understood that the text stored in the database can be text crawled from web page data by a web crawler, or it can be text uploaded by a specific object (such as text uploaded by the user of the application through the application). This application does not limit the type of target text to be extracted.
[0057] In another possible implementation, the server may also receive text uploaded by the terminal device, and use the received text as the target text to be extracted. Exemplarily, it is assumed that a target application is running on the terminal device, and the user of the target application can edit and upload the text through the target application, and the server is the background server of the target application; in this case, when the terminal device detects that the user has finished editing the text through the target application and confirms to upload the text, the text can be transmitted to the server through the network, and the server can regard the text as the target text to be extracted after receiving the text. It should be understood that the text uploaded by the terminal device here can be a literary work (such as a novel, an article, etc.) edited by the user, and can also be an evaluation text (such as a text used to evaluate an application, a commodity, a merchant, etc.) edited by the user. This application does not make any restrictions on the type of target text to be extracted.
[0058] It should be understood that in actual applications, in addition to obtaining the target text to be extracted by the above-mentioned method, the server can also obtain the target text by other methods according to actual needs. The present application does not impose any restrictions on the method by which the server obtains the target text. In addition, when the execution subject of the method provided in the embodiment of the present application is a terminal device, the terminal device can directly use the text input by the user as the target text to be extracted, or the terminal device can also receive text transmitted from other devices as the target text to be extracted. The present application does not impose any restrictions on the method by which the terminal device obtains the target text.
[0059] Step 202: Determine the importance of each text unit in the target text; the importance is used to represent the importance of the content expressed by the text unit in the target text.
[0060] After the server obtains the target text, it can determine the importance of each text unit in the target text. It should be noted that the above-mentioned text unit refers to the sub-text divided from the target text using the preset text division unit when performing the summary extraction task. The preset text division unit here can be a sentence, a participle, a phrase, etc.; taking the preset text division unit as a sentence as an example, each text unit in the target text is correspondingly each sentence in the target text. The importance of a text unit is used to characterize the importance of the content expressed by the text unit in the target text; it should be understood that the higher the importance of a text unit, the more important the content expressed by the text unit is in the target text, that is, the more the content expressed by the text unit can reflect the main idea of the target text.
[0061] In one possible implementation, the server can use the TextRank algorithm to determine the importance of each text unit in the target text. The TextRank algorithm is a graph-based sorting algorithm suitable for texts. Its basic idea comes from the PageRank algorithm. The TextRank algorithm divides the text into several text units and establishes a corresponding graph structure, and then uses a voting mechanism to sort the importance of each text unit in the text. The algorithm can measure the importance of each text unit in the text by only using the information of a single text itself, and the implementation cost is low.
[0062] When the TextRank algorithm is used to determine the importance of each text unit in the target text, a graph structure corresponding to the target text can be constructed first; the graph structure includes multiple nodes with connection relationships, wherein the nodes correspond to the text units in the target text, the connection relationships are used to characterize the association relationship between the text units, and the connection relationships have corresponding weight values. Then, for each text unit in the target text, the associated connection relationship of the node corresponding to the text unit in the graph structure is determined, and the associated nodes with the associated connection relationship between the nodes corresponding to the text unit in the graph structure are determined, and the associated text units corresponding to the associated nodes are determined; finally, the importance of the text unit is determined according to the initial importance of each associated text unit and the weight value corresponding to each associated connection relationship.
[0063] Exemplarily, when the server uses the TextRank algorithm to determine the importance of each text unit in the target text, it can first divide the target text according to the preset text division unit to obtain the various text units in the target text; for example, assuming that the preset text division unit is a sentence, the server can divide the various sentences in the target text by sentence; for another example, assuming that the preset text division unit is a word segment, the server can divide the various word segments in the target text by word segment. Then, the server can construct a graph structure corresponding to the target text based on the various text units in the target text and the association between the various text units; that is, the server can regard the various text units in the target text as various nodes in the graph structure, and for the text units that have an association relationship with each other, construct a connection relationship between the nodes corresponding to the two text units in the graph structure; in addition, the server can also assign corresponding weight values to the connection relationship between the nodes corresponding to the two text units according to the degree of association between the two text units.
[0064] As an example, when the preset text division unit is a sentence, that is, when each text unit in the target text is a sentence, the server can construct a graph structure corresponding to the target text in the following manner: combine each sentence in the target text in pairs to obtain multiple sentence combinations; for each sentence combination, determine the similarity between two sentences therein as the similarity corresponding to the sentence combination; for sentence combinations whose corresponding similarities are higher than a preset similarity threshold, construct a connection relationship between the nodes corresponding to the two sentences in the sentence combination in the graph structure, and use the similarity corresponding to the sentence combination as the weight value corresponding to the connection relationship.
[0065] For example, assuming that the target text is "A, B, C, D, E, F", where A, B, C, D, E, and F are all sentences, the server can combine A, B, C, D, E, and F in pairs to obtain 15 sentence combinations. Then, for each sentence combination, the server can calculate the similarity between the two sentences in the sentence combination, and use the similarity as the similarity corresponding to the sentence combination. The exemplary server can calculate the similarity corresponding to the sentence combination by the following formula (1):
[0066]
[0067] Among them, Similarity(S i ,S j ) represents the similarity between the i-th sentence and the j-th sentence in the target text, S i and S j represents the total number of words in the i-th sentence and the j-th sentence in the target text, w k Represents the word segment in the sentence. The numerator in formula (1) represents the number of identical word segments in the i-th sentence and the j-th sentence in the target text; the denominator in formula (1) represents the sum of the logarithms of the number of word segments in the i-th sentence and the j-th sentence in the target text. The denominator is designed in this way to curb the advantage of longer sentences in similarity calculation.
[0068] It should be understood that in actual applications, in addition to the above-mentioned method for calculating the similarity between two sentences in a sentence combination, other methods can also be used to calculate the similarity between two sentences in a sentence combination. For example, the semantic feature vectors of each of the two sentences in the sentence combination can be determined, and then the similarity between the semantic feature vectors of each of the two sentences can be calculated. The present application does not impose any limitation on the method for calculating the similarity corresponding to the sentence combination.
[0069] For sentence combinations whose corresponding similarity is higher than the preset similarity threshold, the server can construct a connection relationship between the nodes corresponding to the two sentences included in the sentence combination in the graph structure, and use the similarity corresponding to the sentence combination as the weight value corresponding to the connection relationship. In this way, an undirected weighted graph structure G = (V, E) corresponding to the target text is constructed, where V represents a node set, E represents a connection edge set, and E is a subset of V*V; Figure 3 The figure shows an exemplary graph structure diagram corresponding to the target text "A, B, C, D, E, F" mentioned above.
[0070] It should be understood that when the preset text division unit is a segmentation word or a phrase, that is, when each text unit in the target text is a segmentation word or a phrase, the implementation method of the server constructing the graph structure corresponding to the target text is similar to the graph structure construction method described above; the only difference is that when constructing the connecting edges between the nodes in the graph structure, it is based on the co-occurrence relationship between the segmentations or phrases corresponding to the nodes; if two segmentations or phrases appear together within a preset window range, a connection relationship can be constructed between the nodes corresponding to the two segmentations or phrases in the graph structure, and the weight value corresponding to the connection relationship can be a preset weight value, or the weight value corresponding to the connection relationship can be determined according to the distance between the two segmentations or phrases.
[0071] After the server constructs the graph structure corresponding to the target text, it can determine, for each text unit in the target text, the connection relationship of the node corresponding to the text unit in the graph structure as the associated connection relationship, determine the node in the graph structure that has an associated connection relationship with the node corresponding to the text unit as the associated node, and determine the text unit corresponding to the associated node as the associated text unit. Then, according to the following formula (2), iterative calculation is performed according to the initial importance of each associated text unit and the weight corresponding to each associated connection relationship until the iteration end condition is met to obtain the importance of the text unit; the iteration end condition here can be, for example, the change amplitude of the importance of the text unit is less than the preset amplitude threshold, or the number of iterative calculations reaches the preset number, etc.
[0072]
[0073] Among them, WS(V i ) is the importance of the i-th text unit; d is the damping coefficient, which ranges from 0 to 1 and represents the probability of pointing from a specific node in the graph structure to any other node, usually with a value of 0.85; In(V i ) represents the set of associated text units of the i-th text unit, V j In(V i ) in any associated text unit, w jiIndicates the weight value corresponding to the connection relationship between the nodes corresponding to the i-th text unit and the j-th text unit; Out(V j ) represents the associated text unit set of the jth text unit, V k Out(V j ) in any associated text unit, w ik It represents the weight value corresponding to the connection relationship between the nodes corresponding to the j-th text unit and the k-th text unit; WS is the initial importance of the associated text unit, which will change as the iterative calculation proceeds.
[0074] In another possible implementation, the server may use a neural network model trained by a supervised algorithm to determine the importance of each text unit in the target text. That is, the server may determine the importance of each text unit in the target text according to the target text by using a pre-trained importance recognition model; the importance recognition model here is trained based on a first training sample, the first training sample includes a first training text and its corresponding first annotation result, and the first annotation result includes the annotation importance of each text unit in the first training text.
[0075] Specifically, the server can pre-acquire a large number of first training samples for training the importance recognition model, each of which includes a first training text and a first annotation result corresponding to the first training text, and the first annotation result includes the pre-annotated annotation importance of each text unit in the first training text. Furthermore, the server can use the acquired first training samples to train the initial importance recognition model until the importance recognition model meets the training end condition; the initial importance recognition model here can be, for example, a BERT (Bidirectional Encoder Representation from Transformers) model or a Transformer model obtained through pre-training; the training end condition here can be, for example, that the model performance of the trained importance recognition model reaches a preset standard, or that the number of iterative trainings of the importance recognition model reaches a preset number, and so on.
[0076] After completing the training of the importance recognition model, the importance recognition model can be put into practical use, that is, the target text to be extracted can be input into the importance recognition model. The importance recognition model can analyze and process the target text and output the importance of each text unit in the target text accordingly.
[0077] It should be understood that in actual applications, in addition to using the above-mentioned method to determine the importance of each text unit in the target text, the server can also use other methods to determine the importance of each text unit in the target text according to actual needs. This application does not impose any limitation on the method of determining each text unit in the target text.
[0078] Step 203: Determine the target relevance of each text unit in the target text; the target relevance is used to characterize the degree of relevance between the content expressed by the text unit and the target focus content, where the target focus content is the content that is focused on in the target application scenario.
[0079] After the server obtains the target text, it can also determine the target relevance of each text unit in the target text. It should be noted that the target relevance of the text unit is used to characterize the degree of association between the content expressed by the text unit and the target focus content, which is the content that is focused on in the target application scenario to which the summary extraction task belongs; for example, assuming that the target application scenario to which the summary extraction task belongs is the public opinion recognition scenario, then the target focus content is correspondingly content related to public opinion, such as content related to negative public opinion (negative evaluation, etc.); for another example, assuming that the target application scenario to which the summary extraction task belongs is the sentiment analysis scenario, then the target focus content is correspondingly content that can express emotions, such as content that expresses negative emotions, etc.; it should be understood that different target application scenarios may have different target focus contents, and the target focus contents in the embodiments of the present application can be set according to actual needs, and the present application does not make any restrictions on the target application scenario and the target focus content.
[0080] In a possible implementation, the server may use a neural network model trained by a supervised algorithm to determine the target relevance of each text unit in the target text. That is, the server may determine the target relevance of each text unit in the target text according to the target text through a relevance recognition model; the relevance recognition model here is obtained by training the semantic recognition model based on the second training sample; the second training sample includes the second training text and its corresponding second annotation result, and the second annotation result includes the annotation relevance of each text unit in the second training text; the semantic recognition model here is a model trained with the goal of predicting masked word segmentation and predicting whether the next text unit of a text unit is correct.
[0081] For example, the server can use the BERT model as the training basis for the relevance recognition model, that is, the BERT model is used as the semantic recognition model. The BERT model is a pre-trained language representation model, which emphasizes that it no longer uses the traditional unidirectional language model or the shallow splicing method of two unidirectional language models for pre-training as in the past, but uses the masked language model (MLM) to generate deep bidirectional language representation. Its working principle is as follows Figure 4 As shown. The BERT model is pre-trained with the goal of predicting masked tokens in the input text and predicting whether the next text unit of a text unit is correct; predicting masked tokens in the input text means randomly masking some input tokens, and then training the model to correctly predict the masked tokens; predicting whether the next text unit of a text unit is correct means selecting two sentences as training samples, and there is a 50% probability that the next sentence of the first sentence is the second sentence. At this time, the model needs to be trained to normally predict whether the second sentence is the next sentence of the first sentence.
[0082] In an embodiment of the present application, the server can further train the BERT model using the acquired second training sample based on the BERT model configured with pre-trained parameters, so as to obtain a correlation recognition model for identifying the degree of correlation between each text unit in the text and the target focus content.
[0083] Specifically, the server can pre-acquire a large number of second training samples for training the relevance recognition model, each of which includes a second training text and a second annotation result corresponding to the second training text, and the second annotation result includes the annotation association of each text unit in the pre-annotated second training text, and the annotation association is used to characterize the degree of association between the text unit and the target content of interest. Furthermore, the server can use the acquired second training samples to train the BERT model until the BERT model meets the training end condition. Here, the BERT model that meets the training end condition is the relevance recognition model; the training end condition here can be, for example, that the model performance of the trained BERT model reaches a preset standard, or that the number of iterative trainings of the BERT model reaches a preset number, and so on.
[0084] After completing the training of the BERT recognition model, the BERT model can be put into practical use, that is, the text units in the target text to be extracted can be input into the BERT model. The BERT model can analyze and process the text units and output the target relevance of each text unit accordingly.
[0085] In addition, since the BERT model itself is a semantic recognition model, the BERT model can also obtain the semantic feature vector of the text unit in the process of processing the text unit in the target text. In an embodiment of the present application, the semantic feature vector of each text unit in the target text determined by the BERT model can be retained for use in the subsequent extraction of summary text units from the target text, so as to avoid extracting summary text units with high semantic similarity from the target text.
[0086] It should be understood that in practical applications, in addition to using the BERT model as the basis for training the relevance recognition model, other semantic recognition models such as the Transformer model can also be used as the semantic recognition model based on which the relevance recognition model is trained. This application does not make any limitation on the semantic recognition model. In addition, in practical applications, in addition to using the above-mentioned method to determine the target relevance of each text unit in the target text, other methods can also be used to determine the target relevance of each text unit in the target text according to actual needs. This application does not make any limitation on the method for determining the target relevance of the text unit.
[0087] It should be noted that, in actual applications, step 202 may be executed first and then step 203, or step 203 may be executed first and then step 202, or step 202 and step 203 may be executed simultaneously. This application does not impose any limitation on the execution order of the above steps 202 and 203.
[0088] Step 204: extracting summary text units from the target text according to the importance and target relevance of each text unit in the target text; and determining the summary text corresponding to the target text in the target application scenario based on the summary text units.
[0089] After the server determines the importance and target relevance of each text unit in the target text, it can further extract summary text units from each text unit included in the target text according to the importance and target relevance of each text unit in the target text. Then, the extracted summary text units are used to form a summary text corresponding to the target text in the target application scenario.
[0090] As an example, the server can determine the summary extraction score of each text unit in the target text according to the importance and target relevance of each text unit in the target text; for example, the server can perform weighted processing on the importance and target relevance of each text unit in the target text according to a preset weight ratio to obtain the summary extraction score of the text unit. Then, the server can arrange the text units in the target text in descending order of the summary extraction score, and select a preset number of text units with the highest ranking as summary text units. Furthermore, the summary text units are arranged in the order of their appearance in the target text to obtain the summary text corresponding to the target text in the target application scenario.
[0091] It should be understood that the above-mentioned implementation method of determining the summary text corresponding to the target text in the target application scenario according to the importance and target relevance of each text unit in the target text is only an example. In actual applications, the server may also adopt other methods to determine the summary extraction score of each text unit in the target text, adopt other methods to extract summary text units, and adopt other methods to determine the summary text based on the extracted summary text units. This application does not impose any limitation on this.
[0092] Optionally, in order to avoid the situation where the semantic similarity of the summary text units extracted from the target text is high, resulting in the generated summary text including a large number of semantically similar text units, the embodiment of the present application can introduce the semantic feature vectors of each text unit in the target text during the process of extracting the summary text units from the target text, that is, determine the semantic feature vector of each text unit in the target text, and then extract the summary text unit from the target text according to the importance, target relevance and semantic feature vector of each text unit in the target text.
[0093] As introduced above, since the relevance recognition model used to identify the target relevance of each text unit in the target text is trained on the basis of the semantic recognition model, the relevance recognition model can not only determine the target relevance of each text unit in the target text, but also determine the semantic feature vector of each text unit in the target text. Therefore, the semantic feature vector of each text unit in the target text determined by the relevance recognition model can be directly used here. Of course, in actual applications, the server can also determine the semantic feature vector of each text unit in the target text by other means, for example, using a specific semantic recognition model to determine the semantic feature vector of each text unit in the target text. The present application does not impose any limitation on the method of determining the semantic feature vector of the text unit in the target text.
[0094] As an example, when the server extracts summary text units from the target text according to the importance, target relevance and semantic feature vector of each text unit in the target text, it can use Figure 5 The process is implemented as shown in the flowchart. Figure 5 As shown, the implementation process includes the following steps:
[0095] Step 501: Determine the initial score of the summary extraction of each text unit in the target text according to the importance of each text unit in the target text and the target relevance.
[0096] Exemplarily, the server may select the minimum importance and the maximum importance from the importance of each text unit in the target text; and select the minimum target relevance and the maximum target relevance from the target relevance of each text unit in the target text. Then, for each text unit, the importance score of the text unit is determined according to the importance of the text unit itself, the minimum importance and the maximum importance; and the relevance score of the text unit is determined according to the target relevance of the text unit itself, the minimum target relevance and the maximum target relevance; and then, the initial score of the summary extraction of the text unit is determined according to the importance score and the relevance score of the text unit.
[0097] That is, the server can calculate the initial score Score0 of the summary extraction of each text unit in the target text by the following formula (3):
[0098] Score0=MaxMin(Score_tr)+MaxMin(Score_neg) (3)
[0099] Among them, MaxMin(Score_tr) is the importance score of the text unit, and MaxMin(Score_neg) is the relevance score of the text unit. The specific expression of the MaxMin function is shown in the following formula (4):
[0100]
[0101] When calculating the importance score of the i-th text unit, y i Score the importance of the i-th text unit, x i is the importance of the i-th text unit, min 1≤i≤n {x j} is the minimum importance of all text units, max 1≤i≤n {x j} is the maximum importance among all the importance of the text units. When calculating the relevance score of the i-th text unit, y i is the relevance score of the i-th text unit, xi is the target relevance of the i-th text unit, min 1≤i≤n {x j} is the minimum target relevance among all target relevances of all text units, max 1≤i≤n {x j} is the maximum target relevance among the target relevances of all text units.
[0102] It should be understood that the above-mentioned method of determining the initial score of the summary extraction of each text unit in the target text is only an example. In actual applications, the server can also adopt other methods to determine the initial score of the summary extraction of each text unit in the target text according to actual needs. This application does not impose any limitation on the method of determining the initial score of the summary extraction of each text unit in the target text.
[0103] Step 502: extracting the summary text unit from the target text according to the summary extraction initial score and semantic feature vector of each text unit in the target text.
[0104] Furthermore, the server can extract summary text units from the target text according to the summary extraction initial score of each text unit in the target text and the semantic feature vector of each text unit in the target text. On the one hand, it is ensured that the extracted summary text units can reflect both the main theme of the target text and the information related to the key content in the target application scenario; on the other hand, it is ensured that the semantic similarity between the extracted summary text units is not too high.
[0105] Exemplarily, the server may first extract an initial score based on the summary of each text unit in the target text, and select a summary text unit from each text unit; and use the selected summary text units to form a first text unit set, and use the text units in the target text other than the above summary text units to form a second text unit set.
[0106] Then, the following steps are executed in a loop until the number of selected summary text units reaches a preset number: for each text unit in the second text unit set, the similarity between it and each summary text unit in the first text unit set is determined, and the maximum similarity is selected as the basic similarity of the text unit. According to the importance and target relevance of each text unit in the second text unit set, the reference score of the summary extraction of each text unit in the second text unit set is determined; and according to the basic similarity of each text unit in the second text unit set, the reference similarity of each text unit in the second text unit set is determined. For each text unit in the second text unit set, the target score of the summary extraction of the text unit is determined according to the reference score and reference similarity of the summary extraction of the text unit. Then, according to the target score of the summary extraction of each text unit in the second text unit set, the summary text unit is selected from the second text unit set, and the selected summary text unit is migrated from the second text unit set to the first text unit set.
[0107] For ease of understanding, the following is an example of the process of extracting summary text units from the target text:
[0108] First, according to the initial score Score0 of each text unit in the target text, the text unit with the highest initial score Score0 is extracted from the target text as the first selected summary text unit t1. The selected summary text unit t1 is used to form the first text unit set S1, and the other text units in the target text except the summary text unit t1 are used to form the second text unit set S2.
[0109] Then, loop through the following steps:
[0110] Step 1: Based on the cosine similarity algorithm, for each text unit in the second text unit set S2, calculate the similarity between it and the text units in the first text unit set S1; then use the similarity between each text unit in the second text unit set S2 and each text unit in the first text unit set S1 to construct a similarity matrix M1.
[0111] When the first text unit set S1 only includes the summary text unit t1, the server needs to calculate the similarity between each text unit in the second text unit set S2 and the summary text unit t1; and use the similarity between each text unit in the second text unit set S2 and the summary text unit t1 to construct a similarity matrix M1. The similarity matrix M1 should be a matrix of size 1*n, where n represents the number of text units included in the second text unit set S2, and the elements carried by each row in the similarity matrix M1 are the similarities between each text unit in the second text unit set S2 and the summary text unit t1. When the first text unit set S1 includes summary text unit t1 and summary text unit t2, the server needs to calculate the similarity between each text unit in the second text unit set S2 and the summary text unit t1, and the similarity between each text unit and the summary text unit t2; and use the similarity between each text unit in the second text unit set S2 and the summary text unit t1 and the summary text unit t2 to construct a similarity matrix M1, which should be a matrix of size 2*(n-1), where n-1 represents the number of text units included in the second text unit set S2, and the elements carried by each row in the similarity matrix M1 are the similarity between each text unit in the second text unit set S2 and the summary text unit t1, and the similarity between each text unit and the summary text unit t2. And so on.
[0112] The above cosine similarity algorithm is specifically expressed as follows (5):
[0113]
[0114] Wherein, a and b are two elements whose similarity is to be calculated. In the embodiment of the present application, a and b are used to represent the semantic feature vectors of the two text units.
[0115] Step 2: For each row in the similarity matrix M1, select the maximum similarity from the similarities carried by the row as the basic similarity of the text unit corresponding to the row, and use the basic similarities of each text unit in the second text unit set S2 to construct the similarity matrix M2.
[0116] When the similarity matrix M1 is a matrix of size 1*n, the server can directly use the similarity matrix M1 as the similarity matrix M2. When the similarity matrix M1 is a matrix of size 2*(n-1), the server can use the maximum similarity in each row of the similarity matrix M1 to construct the similarity matrix M2, and the size of the similarity matrix M2 is 1*(n-1). And so on.
[0117] Step 3: Based on the MaxMin function, according to the importance and target relevance of each text unit in the second text unit set S2, recalculate the summary extraction reference score Score1 of each text unit in the second text unit set S2. And, based on the MaxMin function, according to the basic similarity of each text unit in the second text unit set S2, that is, according to the elements of each row in the similarity matrix M2, calculate the reference similarity of each text unit in the second text unit set S2, and use the reference similarity of each text unit to form the similarity matrix M3. The specific algorithm of the MaxMin function can be found in the above formula (4).
[0118] Step 4: For each text unit in the second text unit set S2, according to the summary extraction reference score Score1 of the text unit and the reference similarity m3 of the text unit in the similarity matrix M3, the summary extraction target score Score2 of the text unit is calculated using the following formula (6):
[0119] Score2=alpha*Score1-(1-alpha)*m3 (6)
[0120] Among them, alpha is a preset coefficient.
[0121] Step 5: According to the summary extraction target score Score2 of each text unit in the second text unit set S2, select the text unit with the highest summary extraction target score Score2 from the second text unit set S2 as the summary text unit ti, and migrate the summary text unit ti from the second text unit set S2 to the first text unit set S1.
[0122] In this way, the above Step 1 to Step 5 are repeatedly executed until the number of summary text units included in the first text unit set S1 reaches a preset number of summary units.
[0123] By extracting summary text units from the target text in the above manner, it can be effectively ensured that the extracted summary text units can reflect both the main theme of the target text and the information related to the key focus content in the target application scenario; and it can also be ensured that the similarity between the extracted summary text units is low, that is, avoiding the extraction of a large number of semantically similar summary text units.
[0124] It should be understood that in actual applications, in addition to extracting summary text units from the target text in the above-mentioned manner, other methods can also be used to extract summary text units from the target text according to actual needs. This application does not impose any limitation on the method of extracting summary text units from the target text.
[0125] The above-mentioned summary extraction method, in the process of generating the summary text corresponding to the target text in the target application scenario, will consider the importance of each text unit in the target text on the one hand, so as to ensure that the generated summary text can include the text units with higher importance in the target text, so that the generated summary text can reflect the main theme of the target text. On the other hand, the degree of correlation between each text unit in the target text and the target content of interest will be considered, so as to ensure that the generated summary text can include the text units in the target text with higher relevance to the content focused on in the target application scenario, so that the generated summary text can reflect the information focused on by the reader in the target application scenario. In this way, the purpose of improving the comprehensive quality of the summary text is achieved, so that the generated summary text can meet the actual needs of the reader and improve the reading experience of the reader for the summary text.
[0126] In order to facilitate further understanding of the summary extraction method provided in the embodiment of the present application, the summary extraction method provided in the embodiment of the present application is used to perform a summary extraction task in a public opinion recognition scenario as an example, and an overall exemplary introduction to the summary extraction method provided in the embodiment of the present application is given below.
[0127] For the target text to be extracted, the TextRank algorithm can be used to determine the importance of each sentence in the target text. The TextRank algorithm is a graph-based sorting algorithm for text, and its basic idea comes from the PageRank algorithm; the TextRank algorithm divides the text into several sentences and establishes a corresponding graph structure, and then uses a voting mechanism to sort the importance of each sentence in the text. The algorithm can measure the importance of each sentence in the text using only the information of a single text itself, and the implementation cost is low.
[0128] The graph structure corresponding to the target text constructed based on the TextRank algorithm is an undirected weighted graph structure, which can be expressed as G = (V, E); where V represents a set of nodes, each of which corresponds to a sentence in the target text; E represents a set of connecting edges, each of which corresponds to an association between sentences, and E is a subset of V*V. In the graph structure corresponding to the target text, the weight value of the connecting edge between any two nodes Vi and Vj is wji, and the weight value wji is equal to the similarity between the sentences corresponding to nodes Vi and Vj; for a given node Vi, In(Vi) and Out(Vi) are the same, both of which are the sets of nodes that have a connection relationship with node Vi. The importance calculation method of the sentence corresponding to node Vi is defined as follows:
[0129]
[0130] Among them, d is the damping coefficient, ranging from 0 to 1, representing the probability of pointing from a certain node in the graph structure to any other node, and generally takes a value of 0.85. When using the TextRank algorithm to calculate the importance of sentences corresponding to each node in the graph structure, it is necessary to specify any initial importance for the nodes in the graph structure, and recursively calculate until convergence, that is, when the error rate of the importance of sentences corresponding to any node in the graph structure is less than a given limit value, it can be considered that convergence has been achieved. Generally, this limit value can be taken as 0.0001.
[0131] For the target text to be extracted, the negative public opinion scoring system based on the BERT model can also be used to determine the degree of correlation between each sentence in the target text and the negative public opinion content, that is, the target correlation. The BERT model is a pre-trained language representation model, which emphasizes that it no longer uses the traditional unidirectional language model or the shallow splicing method of two unidirectional language models for pre-training as in the past, but uses a masked language model (MLM) to generate deep bidirectional language representation.
[0132] In specific applications, the BERT model can encode the input target text through pre-trained parameters to obtain the encoding vector of each sentence in the target text, that is, the semantic feature vector of each sentence. At the same time, the encoding vector of the sentence can be compressed based on the Softmax activation function, and the model parameters can be optimized in combination with the binary cross entropy loss function. The final output of the BERT model includes: the semantic feature vector of each sentence in the target text, and the target relevance of each sentence in the target text (used to characterize the degree of correlation between the content expressed by the sentence and the negative public opinion).
[0133] After determining the importance, target relevance, and semantic feature vector of each sentence in the target text, the following formula can be used to comprehensively consider the importance and target relevance of each sentence in the target text to calculate the initial score Score0 of the summary extraction of each sentence in the target text:
[0134] Score0=MaxMin(Score_tr)+MaxMin(Score_neg)
[0135] Wherein, MaxMin(Score_tr) is the importance score of the sentence, and MaxMin(Score_neg) is the relevance score of the sentence. The algorithm of the MaxMin function is specifically shown in the above formula (4).
[0136] Then, an initial score Score0 is extracted based on the summary of each sentence in the target text, and a sentence with the highest initial score Score0 is selected from the sentences included in the target text as the first summary t1; and the selected summary t1 is used to form a first sentence set S1, and the other sentences in the target text except sentence t1 are used to form a second sentence set S2.
[0137] Then perform the following sentence summary extraction process:
[0138] Step 1: Based on the cosine similarity algorithm, for each sentence in the second sentence set S2, calculate the similarity between it and each sentence in the first sentence set S1; then use the similarity between each sentence in the second sentence set S2 and each sentence in the first sentence set S1 to construct a similarity matrix M1. It should be understood that when the first sentence set S1 includes only one sentence, the size of the similarity matrix M1 is 1*n, where n is the number of sentences in the second sentence set S2; when the first sentence set S1 includes two sentences, the size of the similarity matrix M1 is 2*(n-1), and so on.
[0139] Step 2: For each row in the similarity matrix M1, select the largest similarity from the similarities carried by the row as the basic similarity of the sentence corresponding to the row, and use the basic similarities of each sentence in the second sentence set S2 to construct the similarity matrix M2.
[0140] Step 3: Based on the MaxMin function, according to the importance and target relevance of each sentence in the second sentence set S2, the summary extraction reference score Score1 of each sentence in the second sentence set S2 is recalculated. In addition, based on the MaxMin function, according to the basic similarity of each sentence in the second sentence set S2, that is, according to the elements of each row in the similarity matrix M2, the reference similarity of each sentence in the second sentence set S2 is calculated, and the similarity matrix M3 is composed using the reference similarity of each sentence.
[0141] Step 4: For each sentence in the second sentence set S2, calculate the summary extraction target score Score2 of the sentence based on the summary extraction reference score Score1 of the sentence and the reference similarity m3 of the sentence in the similarity matrix M3: Score2 = alpha*Score1-(1-alpha)*m3.
[0142] Step 5: According to the summary extraction target score Score2 of each sentence in the second sentence set S2, select the sentence with the highest summary extraction target score Score2 from the second sentence set S2 as the summary ti, and migrate the summary ti from the second sentence set S2 to the first sentence set S1.
[0143] The above Step 1 to Step 5 are repeatedly executed until the number of abstracts included in the first sentence set S1 reaches a preset number of abstracts.
[0144] With respect to the summary extraction method described above, the present application also provides a corresponding summary extraction device, so that the summary extraction method described above can be applied and implemented in practice.
[0145] See also Figure 6 , Figure 6 It is the same as above Figure 2 The schematic diagram of the structure of a summary extraction device 600 corresponding to the summary extraction method shown in FIG. Figure 6 As shown, the summary extraction device 600 includes:
[0146] The text acquisition module 601 is used to acquire the target text to be extracted;
[0147] Importance determination module 602, used to determine the importance of each text unit in the target text; the importance is used to represent the importance of the content expressed by the text unit in the target text;
[0148] A relevance determination module 603 is used to determine the target relevance of each text unit in the target text; the target relevance is used to characterize the degree of relevance between the content expressed by the text unit and the target focused content, and the target focused content is the content that is focused on in the target application scenario;
[0149] The summary determination module 604 is used to extract summary text units from the target text according to the importance and target relevance of each text unit in the target text; based on the summary text units, determine the summary text corresponding to the target text in the target application scenario.
[0150] Optional, in Figure 6 Based on the abstract extraction device shown, see Figure 7 , Figure 7 FIG. 7 is a schematic diagram of another abstract extraction device 700 provided in an embodiment of the present application. Figure 7 As shown, the summary extraction device also includes:
[0151] Semantic determination module 701, used to determine the semantic feature vector of each text unit in the target text;
[0152] The summary determination module 604 is specifically used for:
[0153] The summary text unit is extracted from the target text according to the importance, target relevance and semantic feature vector of each text unit in the target text.
[0154] Optional, in Figure 7 Based on the abstract extraction device shown, see Figure 8 , Figure 8 FIG. 8 is a schematic diagram of another abstract extraction device 800 provided in an embodiment of the present application. Figure 8 As shown, the summary determination module 604 includes:
[0155] An initial scoring submodule 801 is used to determine an initial score for abstract extraction of each text unit in the target text according to the importance and target relevance of each text unit in the target text;
[0156] The summary extraction submodule 802 is used to extract the summary text unit from the target text according to the summary extraction initial score and semantic feature vector of each text unit in the target text.
[0157] Optional, in Figure 8 Based on the summary extraction device shown, the initial scoring submodule 801 is specifically used for:
[0158] Selecting a minimum importance and a maximum importance from the importance of each of the text units; selecting a minimum target relevance and a maximum target relevance from the target relevance of each of the text units;
[0159] For each of the text units, an importance score of the text unit is determined based on the importance of the text unit, the minimum importance and the maximum importance; a relevance score of the text unit is determined based on the target relevance of the text unit, the minimum target relevance and the maximum target relevance; an initial score for summary extraction of the text unit is determined based on the importance score and the relevance score of the text unit.
[0160] Optional, in Figure 8 Based on the abstract extraction device shown, the abstract extraction submodule 802 is specifically used for:
[0161] Selecting summary text units from the text units according to the initial summary extraction scores of the respective text units; using the summary text units to form a first text unit set, and using the text units in the target text other than the summary text units to form a second text unit set;
[0162] The following steps are executed repeatedly until the number of the selected summary text units reaches a preset number:
[0163] For each text unit in the second text unit set, determine the similarity between it and each summary text unit in the first text unit set, and select the largest similarity as the basic similarity of the text unit;
[0164] Determine a summary extraction reference score for each text unit in the second text unit set according to the importance and target relevance of each text unit in the second text unit set; determine a reference similarity for each text unit in the second text unit set according to the basic similarity of each text unit in the second text unit set;
[0165] For each text unit in the second text unit set, determining a summary extraction target score of the text unit according to a summary extraction reference score and a reference similarity of the text unit;
[0166] According to the summary extraction target score of each text unit in the second text unit set, a summary text unit is selected from the second text unit set, and the selected summary text unit is migrated from the second text unit set to the first text unit set.
[0167] Optional, in Figure 6 Based on the abstract extraction device shown, see Fig. 9 , Fig. 9 FIG. 9 is a schematic diagram of another abstract extraction device 900 provided in an embodiment of the present application. Fig. 9 As shown, the importance determination module 602 includes:
[0168] A graph structure construction submodule 901 is used to construct a graph structure corresponding to the target text; the graph structure includes a plurality of nodes with connection relationships, the nodes correspond to text units in the target text, the connection relationships are used to represent the association relationship between text units, and the connection relationships have corresponding weight values;
[0169] The importance determination submodule 902 is used to determine, for each text unit in the target text, the associated connection relationship between the nodes corresponding to the text unit in the graph structure, determine the associated nodes having the associated connection relationship between the nodes corresponding to the text unit in the graph structure, and determine the associated text units corresponding to the associated nodes; determine the importance of the text unit according to the initial importance of each associated text unit and the weight value corresponding to each associated connection relationship.
[0170] Optional, in Fig. 9 Based on the abstract extraction device shown, when the text unit is a sentence, the graph structure construction submodule 901 is specifically used for:
[0171] Combining sentences in the target text in pairs to obtain multiple sentence combinations;
[0172] For each of the sentence combinations, determining the similarity between two of the sentences as the similarity corresponding to the sentence combination;
[0173] For sentence combinations whose corresponding similarities are higher than a preset similarity threshold, a connection relationship between nodes corresponding to two sentences in the sentence combination is constructed in the graph structure, and the similarity corresponding to the sentence combination is used as a weight value corresponding to the connection relationship.
[0174] Optional, in Figure 6 Based on the summary extraction device shown, the importance determination module 602 is specifically used for:
[0175] The importance of each text unit in the target text is determined according to the target text through an importance recognition model; the importance recognition model is obtained based on training of a first training sample, the first training sample includes a first training text and its corresponding first annotation result, and the first annotation result includes the annotation importance of each text unit in the first training text.
[0176] Optional, in Figure 6 Based on the abstract extraction device shown, the relevance determination module 603 is specifically used for:
[0177] The target relevance of each text unit in the target text is determined according to the target text through a relevance recognition model; the relevance recognition model is obtained by training a semantic recognition model based on a second training sample; the second training sample includes a second training text and its corresponding second annotation result, and the second annotation result includes the annotation relevance of each text unit in the second training text; the semantic recognition model is a model trained with the goal of predicting masked word segmentation and predicting whether the next text unit of a text unit is correct.
[0178] Optional, in Figure 7 Based on the abstract extraction device shown in the figure, the relevance determination module 603 and the semantic determination module 701 are specifically used for:
[0179] The target relevance and semantic feature vector of each text unit in the target text are determined according to the target text through a relevance recognition model; the relevance recognition model is obtained by training a semantic recognition model based on a second training sample; the second training sample includes a second training text and its corresponding second annotation result, and the second annotation result includes the annotation relevance of each text unit in the second training text; the semantic recognition model is a model trained with the goal of predicting masked word segmentation and whether the next text unit of a text unit is correct.
[0180] The above-mentioned summary extraction device, in the process of generating the summary text corresponding to the target text in the target application scenario, will consider the importance of each text unit in the target text on the one hand, so as to ensure that the generated summary text can include the text units with higher importance in the target text, so that the generated summary text can reflect the main idea of the target text. On the other hand, it will consider the degree of correlation between each text unit in the target text and the target content of interest, so as to ensure that the generated summary text can include the text units in the target text with higher relevance to the content focused on in the target application scenario, so that the generated summary text can reflect the information focused on by the reader in the target application scenario. In this way, the purpose of improving the comprehensive quality of the summary text is achieved, so that the generated summary text can meet the actual needs of the reader and improve the reading experience of the reader for the summary text.
[0181] The embodiment of the present application also provides a computer device for extracting summaries, which may specifically be a terminal device or a server. The terminal device and server provided in the embodiment of the present application will be introduced below from the perspective of hardware instantiation.
[0182] See also Fig.10 , Fig.10 Schematic diagram of the structure of the terminal device provided in the embodiment of the present application. Fig.10 For the sake of convenience, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The terminal can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS), a car computer, etc., taking the terminal as a computer as an example:
[0183] Fig.10 FIG. 1 is a block diagram showing a partial structure of a computer related to a terminal provided in an embodiment of the present application. Fig.10The computer includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030 (including a touch panel 1031 and other input devices 1032), a display unit 1040 (including a display panel 1041), a sensor 1050, an audio circuit 1060 (which can be connected to a speaker 1061 and a microphone 1062), a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090. Those skilled in the art can understand that Fig.10 The computer structure shown in the figure does not constitute a limitation of the computer, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0184] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various functional applications and data processing of the computer by running the software programs and modules stored in the memory 1020. The memory 1020 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the computer (such as audio data, a phone book, etc.), etc. In addition, the memory 1020 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0185] The processor 1080 is the control center of the computer. It uses various interfaces and lines to connect various parts of the entire computer. It executes various functions of the computer and processes data by running or executing software programs and / or modules stored in the memory 1020 and calling data stored in the memory 1020. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1080.
[0186] In the embodiment of the present application, the processor 1080 included in the terminal is used to execute the steps of any implementation manner of the summary extraction method provided in the embodiment of the present application.
[0187] See also Fig.11 , Fig.11A schematic diagram of the structure of a server 1100 provided for an embodiment of the present application. The server 1100 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1122 (for example, one or more processors) and a memory 1132, and one or more storage media 1130 (for example, one or more mass storage devices) storing application programs 1142 or data 1144. Among them, the memory 1132 and the storage medium 1130 may be temporary storage or permanent storage. The program stored in the storage medium 1130 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 1122 may be configured to communicate with the storage medium 1130 to execute a series of instruction operations in the storage medium 1130 on the server 1100.
[0188] The server 1100 may also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input and output interfaces 1158, and / or one or more operating systems, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.
[0189] The steps performed by the server in the above embodiment can be based on the Fig.11 The server structure shown.
[0190] The CPU 1122 is used to execute the steps of any implementation of the summary extraction method provided in the embodiments of the present application.
[0191] The embodiment of the present application further provides a computer-readable storage medium for storing a computer program, wherein the computer program is used to execute any implementation of a summary extraction method described in the aforementioned embodiments.
[0192] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes any one of the implementations of the summary extraction method described in the above embodiments.
[0193] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0194] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0195] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0196] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0197] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), disk or optical disk and other media that can store computer programs.
[0198] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0199] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A summary extraction method, characterized in that: The method comprises: Get the target text to be extracted; Determining the importance of each text unit in the target text; the importance is used to represent the importance of the content expressed by the text unit in the target text; Determine the target relevance of each text unit in the target text; the target relevance is used to characterize the degree of relevance between the content expressed by the text unit and the target focus content, where the target focus content is the content that is focused on in the target application scenario; Determining a semantic feature vector of each text unit in the target text; Selecting a minimum importance and a maximum importance from the importance of each text unit in the target text; selecting a minimum target relevance and a maximum target relevance from the target relevance of each text unit; For each of the text units, determine the importance score of the text unit according to the importance of the text unit, the minimum importance and the maximum importance; determine the relevance score of the text unit according to the target relevance of the text unit, the minimum target relevance and the maximum target relevance; determine the initial score of the summary extraction of the text unit according to the importance score and the relevance score of the text unit; According to the initial summary extraction scores and semantic feature vectors of the respective text units in the target text, a summary text unit is extracted from the target text; based on the summary text unit, a summary text corresponding to the target text in the target application scenario is determined.
2. The method according to claim 1, characterized in that The extracting the summary text unit from the target text according to the summary extraction initial score and semantic feature vector of each text unit in the target text includes: Selecting summary text units from the text units according to the initial summary extraction scores of the respective text units; using the summary text units to form a first text unit set, and using the text units in the target text other than the summary text units to form a second text unit set; The following steps are executed repeatedly until the number of the selected summary text units reaches a preset number: For each text unit in the second text unit set, determine the similarity between it and each summary text unit in the first text unit set, and select the largest similarity as the basic similarity of the text unit; Determine a summary extraction reference score for each text unit in the second text unit set according to the importance and target relevance of each text unit in the second text unit set; determine a reference similarity for each text unit in the second text unit set according to the basic similarity of each text unit in the second text unit set; For each text unit in the second text unit set, determining a summary extraction target score of the text unit according to a summary extraction reference score and a reference similarity of the text unit; According to the summary extraction target score of each text unit in the second text unit set, a summary text unit is selected from the second text unit set, and the selected summary text unit is migrated from the second text unit set to the first text unit set.
3. The method according to claim 1, characterized in that: Determining the importance of each text unit in the target text includes: Constructing a graph structure corresponding to the target text; the graph structure includes a plurality of nodes having connection relationships, the nodes corresponding to text units in the target text, the connection relationships being used to represent association relationships between text units, and the connection relationships having corresponding weight values; For each text unit in the target text, determine the associated connection relationship between the nodes corresponding to the text unit in the graph structure, determine the associated nodes with the associated connection relationship between the nodes corresponding to the text unit in the graph structure, and determine the associated text units corresponding to the associated nodes; determine the importance of the text unit based on the initial importance of each associated text unit and the weight value corresponding to each associated connection relationship.
4. The method according to claim 3, characterized in that When the text unit is a sentence, the step of constructing a graph structure corresponding to the target text includes: Combining sentences in the target text in pairs to obtain multiple sentence combinations; For each of the sentence combinations, determining the similarity between two of the sentences as the similarity corresponding to the sentence combination; For sentence combinations whose corresponding similarities are higher than a preset similarity threshold, a connection relationship between nodes corresponding to two sentences in the sentence combination is constructed in the graph structure, and the similarity corresponding to the sentence combination is used as a weight value corresponding to the connection relationship.
5. The method according to claim 1, characterized in that Determining the importance of each text unit in the target text includes: The importance of each text unit in the target text is determined according to the target text through an importance recognition model; the importance recognition model is obtained based on training of a first training sample, the first training sample includes a first training text and its corresponding first annotation result, and the first annotation result includes the annotation importance of each text unit in the first training text.
6. The method according to claim 1, characterized in that Determining the target relevance of each text unit in the target text includes: The target relevance of each text unit in the target text is determined according to the target text through a relevance recognition model; the relevance recognition model is obtained by training a semantic recognition model based on a second training sample; the second training sample includes a second training text and its corresponding second annotation result, and the second annotation result includes the annotation relevance of each text unit in the second training text; the semantic recognition model is a model trained with the goal of predicting masked word segmentation and predicting whether the next text unit of a text unit is correct.
7. The method according to claim 1, characterized in that The step of determining the semantic feature vector of each text unit in the target text comprises: The target relevance and semantic feature vector of each text unit in the target text are determined according to the target text through a relevance recognition model; the relevance recognition model is obtained by training a semantic recognition model based on a second training sample; the second training sample includes a second training text and its corresponding second annotation result, and the second annotation result includes the annotation relevance of each text unit in the second training text; the semantic recognition model is a model trained with the goal of predicting masked word segmentation and whether the next text unit of a text unit is correct.
8. A summary extraction device, characterized in that: The device comprises: A text acquisition module is used to acquire the target text to be extracted and summarized; An importance determination module, used to determine the importance of each text unit in the target text; the importance is used to represent the importance of the content expressed by the text unit in the target text; A relevance determination module is used to determine the target relevance of each text unit in the target text; the target relevance is used to characterize the degree of relevance between the content expressed by the text unit and the target focus content, and the target focus content is the content that is focused on in the target application scenario; A semantic determination module, used to determine the semantic feature vector of each text unit in the target text; The initial scoring submodule is used to select the minimum importance and the maximum importance from the importance of each text unit in the target text; select the minimum target relevance and the maximum target relevance from the target relevance of each text unit; for each text unit, determine the importance score of the text unit according to the importance of the text unit, the minimum importance and the maximum importance; determine the relevance score of the text unit according to the target relevance of the text unit, the minimum target relevance and the maximum target relevance; determine the initial score of the summary extraction of the text unit according to the importance score and the relevance score of the text unit; The summary extraction submodule is used to extract summary text units from the target text according to the initial summary extraction scores and semantic feature vectors of the respective text units in the target text; based on the summary text units, determine the summary text corresponding to the target text in the target application scenario.
9. The device according to claim 8, characterized in that The summary extraction submodule is specifically used for: Selecting summary text units from the text units according to the initial summary extraction scores of the respective text units; using the summary text units to form a first text unit set, and using the text units in the target text other than the summary text units to form a second text unit set; The following steps are executed repeatedly until the number of the selected summary text units reaches a preset number: For each text unit in the second text unit set, determine the similarity between it and each summary text unit in the first text unit set, and select the largest similarity as the basic similarity of the text unit; Determine a summary extraction reference score for each text unit in the second text unit set according to the importance and target relevance of each text unit in the second text unit set; determine a reference similarity for each text unit in the second text unit set according to the basic similarity of each text unit in the second text unit set; For each text unit in the second text unit set, determining a summary extraction target score of the text unit according to a summary extraction reference score and a reference similarity of the text unit; According to the summary extraction target score of each text unit in the second text unit set, a summary text unit is selected from the second text unit set, and the selected summary text unit is migrated from the second text unit set to the first text unit set.
10. The device according to claim 8, characterized in that The importance determination module comprises: A graph structure construction submodule, used to construct a graph structure corresponding to the target text; the graph structure includes a plurality of nodes with connection relationships, the nodes correspond to text units in the target text, the connection relationships are used to represent the association relationship between the text units, and the connection relationships have corresponding weight values; The importance determination submodule is used to determine, for each text unit in the target text, the associated connection relationship between the nodes corresponding to the text unit in the graph structure, determine the associated nodes having the associated connection relationship between the nodes corresponding to the text unit in the graph structure, and determine the associated text units corresponding to the associated nodes; determine the importance of the text unit according to the initial importance of each associated text unit and the weight value corresponding to each associated connection relationship.
11. The device according to claim 10, characterized in that When the text unit is a sentence, the graph structure construction submodule is specifically used for: Combining sentences in the target text in pairs to obtain multiple sentence combinations; For each of the sentence combinations, determining the similarity between two of the sentences as the similarity corresponding to the sentence combination; For sentence combinations whose corresponding similarities are higher than a preset similarity threshold, a connection relationship between nodes corresponding to two sentences in the sentence combination is constructed in the graph structure, and the similarity corresponding to the sentence combination is used as a weight value corresponding to the connection relationship.
12. The device according to claim 8, characterized in that The importance determination module is specifically used for: The importance of each text unit in the target text is determined according to the target text through an importance recognition model; the importance recognition model is obtained based on training of a first training sample, the first training sample includes a first training text and its corresponding first annotation result, and the first annotation result includes the annotation importance of each text unit in the first training text.
13. The device according to claim 8, characterized in that The association degree determination module is specifically used for: Determining the target relevance of each text unit in the target text according to the target text through a relevance recognition model; the relevance recognition model is obtained by training a semantic recognition model based on a second training sample; the second training sample includes a second training text and a corresponding second annotation result, and the second annotation result includes an annotation relevance of each text unit in the second training text; The semantic recognition model is a model trained with the goal of predicting masked word segments and predicting whether the next text unit of a text unit is correct.
14. The device according to claim 8, characterized in that The association determination module and the semantic determination module are specifically used for: Determine the target relevance and semantic feature vector of each text unit in the target text according to the target text through a relevance recognition model; the relevance recognition model is obtained by training the semantic recognition model based on a second training sample; the second training sample includes a second training text and a corresponding second annotation result, and the second annotation result includes the annotation relevance of each text unit in the second training text; The semantic recognition model is a model trained with the goal of predicting masked word segments and predicting whether the next text unit of a text unit is correct.
15. A computer device, characterized in that: The device includes a processor and a memory; The memory is used to store computer programs; The processor is configured to execute the abstract extraction method according to any one of claims 1 to 7 according to the computer program.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the abstract extraction method according to any one of claims 1 to 7.
17. A computer program product, comprising a computer program or instructions, characterized in that: When the computer program or the instruction is executed by a processor, the abstract extraction method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Abstract automatic generation method and device and computer readable storage medium
CN113468318A
