Method and device for generating text summary
Through the element-based coverage mechanism, the elements of text data are identified and the attention of repeated elements is penalized, the problem of repeated generation of synonyms in the existing technology is solved, and more streamlined and accurate text summary generation is achieved.
Patent Information
- Application Number
- CN202010182475.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-16
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-03-16
AI Technical Summary
In the existing text summary generation technology, the word-based coverage mechanism cannot effectively avoid the repeated generation of synonyms, resulting in redundant summaries.
The feature-based coverage mechanism is used to build a feature dictionary and feature collection, identify the elements of text data and record the attention history of the elements, and punish the attention of repeated elements, thereby generating a more streamlined text summary.
It effectively reduces the redundancy of text summaries, making the generated summaries more concise and accurate, and able to better cover information.
Smart Images

Figure CN113407707B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for generating a text summary. Background Art
[0002] Automatic text summarization is a technology based on natural language generation technology that automatically generates short summaries based on detailed text descriptions. Usually, the automatic text summarization model includes an encoder and a decoder. The encoder encodes a detailed description of a text and generates a hidden sequence. The decoder uses the hidden sequence to generate the target summary word by word through the attention mechanism.
[0003] In order to meet the conciseness of the summary, it is necessary to control the redundancy of the summary and reduce the generation of repeated content, so as to describe more information in a shorter text summary. The usual practice is to use the coverage mechanism to reduce the decoder's repeated attention to the source vocabulary, thereby reducing the generation of repeated words.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0005] The existing coverage mechanism is based on words, that is, it reduces the generation of repeated words. In fact, some different words may express the same semantics. For example, the semantics expressed by the two words "silent" and "low noise" are the same. When the decoder generates "silent", the word-based coverage mechanism will prevent the repeated generation of "silent", but will not prevent the repeated generation of "low noise", causing the decoder to generate "low noise", making "silent" and "low noise" appear in the generated summary at the same time, resulting in information redundancy. Summary of the invention
[0006] In view of this, an embodiment of the present invention provides a method and device for generating a text summary, which can avoid repeated attention to the same element, thereby reducing the repeated description of the same element in the summary, reducing the redundancy of the generated summary, and making the generated text summary more concise and accurate, and can cover more information.
[0007] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for generating a text summary is provided.
[0008] A method for generating a text summary comprises: encoding text data for generating a summary to obtain a hidden sequence; and decoding the hidden sequence according to a preset element dictionary and an element-based coverage mechanism to generate a text summary.
[0009] Optionally, the element dictionary is constructed in the following manner: classifying the text data according to content characteristics of the text data; and constructing an element dictionary corresponding to the text data by annotating and learning each type of text data.
[0010] Optionally, the element dictionary is constructed in the following manner: classifying the text data according to the category of the object; and constructing the element dictionary corresponding to the text data by annotating and learning each category of text data.
[0011] Optionally, decoding the hidden layer sequence according to a preset element dictionary and an element-based coverage mechanism to generate a text summary includes: decoding the hidden layer sequence according to a preset element dictionary to obtain an element set; according to the element set and the element-based coverage mechanism, recording the attention history of each element in the element set, and penalizing the attention of repeated elements in the loss function to generate a text summary.
[0012] Optionally, decoding the hidden layer sequence according to a preset element dictionary to obtain an element set includes: decoding the hidden layer sequence with elements in the preset element dictionary as basic units to generate an element set element by element.
[0013] Optionally, the element-based coverage mechanism includes the following formula:
[0014] α t,i =softmax(e t,i );c t =∑ i α t,i h i ; Among them, e t,i is an intermediate variable, h i is the hidden state of the i-th word in the text data, s t is the hidden state of the decoder at time t, u a , U a , W a and V a is the model parameter matrix; x k ∈a j Indicates that it belongs to element a j The word x k , Represents the effect of time t on factor a j Attention; α t,i Represents the attention to the i-th word in the text data at time t; Indicates the factor a before time t j of attention accumulation.
[0015] Optionally, attention on repeated features is penalized as follows:
[0016] Among them, L β is the loss function for repeated attention on the decoder; α t,i Represents the attention to the i-th word in the text data at time t; Indicates the factor a before time t j of attention accumulation.
[0017] According to another aspect of an embodiment of the present invention, a device for generating a text summary is provided.
[0018] A device for generating a text summary comprises: an encoding module for encoding text data for generating a summary to obtain a hidden sequence; a decoding module for decoding the hidden sequence according to a preset element dictionary and an element coverage mechanism to generate a text summary.
[0019] According to yet another aspect of an embodiment of the present invention, an electronic device for generating a text summary is provided.
[0020] An electronic device for generating a text summary includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating a text summary provided by an embodiment of the present invention.
[0021] According to still another aspect of the embodiments of the present invention, a computer readable medium is provided.
[0022] A computer readable medium stores a computer program, which, when executed by a processor, implements a method for generating a text summary provided by an embodiment of the present invention.
[0023] An embodiment of the above invention has the following advantages or beneficial effects: by encoding the text data for which a summary is to be generated to obtain a hidden sequence; decoding the hidden sequence according to a preset element dictionary and an element-based coverage mechanism to generate a text summary, the elements of the text data and the corresponding element words can be identified based on the element dictionary; based on the element coverage mechanism, multiple element words of the same element can be clustered and described to generate a text summary, thereby better avoiding repeated attention to the same element, thereby reducing repeated descriptions of the same element in the summary, reducing the redundancy of the generated summary, and making the generated text summary more concise and accurate, and can cover more information.
[0024] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0026] Figure 1 is a schematic diagram of main steps of a method for generating a text summary according to an embodiment of the present invention;
[0027] Figure 2 is a schematic diagram of a process of generating a text summary according to an embodiment of the present invention;
[0028] Figure 3 is a schematic diagram of main modules of a device for generating a text summary according to an embodiment of the present invention;
[0029] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0030] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0032] In order to solve the problems existing in the prior art, the present invention proposes a method for reducing the redundancy of automatic product summarization based on the coverage mechanism of elements. Based on the element dictionary, the elements of the product can be identified; based on the coverage mechanism of the product elements, the decoder can reduce the repeated attention of the source end to the words belonging to the same product element, thereby reducing the repeated description of the same product element in the product summary.
[0033] Figure 1 FIG. 1 is a schematic diagram of the main steps of a method for generating a text summary according to an embodiment of the present invention. Figure 1 As shown, the method for generating a text summary according to an embodiment of the present invention mainly includes the following steps S101 to S102.
[0034] Step S101: Encode the text data for which a summary is to be generated to obtain a hidden layer sequence;
[0035] Step S102: Decode the hidden sequence according to the element dictionary and the element-based coverage mechanism to generate a summary of the text data.
[0036] According to one embodiment of the present invention, the element dictionary may be constructed, for example, in the following manner:
[0037] Classify text data according to its content characteristics;
[0038] Each type of text data is labeled and learned to build a feature dictionary corresponding to the text data.
[0039] There are many types of text data, and text data can be classified according to its content characteristics. For example, text data can be divided into poetry, prose, novels, lyrics, etc. according to the subject matter of the text content; for example, text data can be divided into news, finance, technology, sports, entertainment, etc. according to different content.
[0040] According to another embodiment of the present invention, the element dictionary may be constructed, for example, in the following manner:
[0041] Classify text data according to the category of items;
[0042] Each type of text data is labeled and learned to build a feature dictionary corresponding to the text data.
[0043] In one embodiment of the present invention, taking the generation of a summary from a detailed description text data of a commodity as an example, the text data may be classified according to different commodity categories.
[0044] After the text data is classified, each type of text data can be annotated. When annotating, it can generally be done by experts. Given a batch of detailed description text data of commodities, the expert responsible for annotation reads each sentence and marks the elements and element words of the commodities contained therein. Then, the annotated elements and element words are learned to summarize and generate an element dictionary. For example, for the text data "This mobile phone has a long battery life", the element is "battery" and the element word is "battery life", and finally an "element-element word" dictionary is formed. In addition, machine learning can be performed based on the previous expert annotation results and semantic analysis tools to obtain a model for generating an element dictionary, and the model can be used to generate an element dictionary.
[0045] In an embodiment of the present invention, the element dictionary is an "element-element word" dictionary, which describes the correspondence between elements and element words, and each element can have multiple corresponding element words. For example, for the commodity "mobile phone", its elements include "battery", "screen" and "memory", etc.; the element words corresponding to the element "battery" include "power consumption", "power" and "battery life", etc. In an embodiment of the present invention, each commodity can have an average of about 10 elements; and each element can have 30-100 element words. According to the elements and element words corresponding to the commodity, the element dictionary of the commodity can be constructed.
[0046] After obtaining the element dictionary, the text data to be generated can be encoded to obtain the hidden layer sequence. When encoding the text data, it is necessary to input a detailed description text data of a product {x1, x2, ..., x n}, where each x i (i∈1, 2, ..., n) is a word, which can be obtained by segmenting the detailed description of the product using a word segmentation tool (such as the Stanford Chinese word segmentation tool). Then, a bidirectional LSTM (Long Short-Term Memory) encoder f enc Encode the detailed description text data of the product to generate a hidden layer sequence {h1, h2, ..., h n}, the encoding formula is as follows:
[0047] h i =f enc (x i ,h i-1 )
[0048] After the hidden sequence is obtained, the hidden sequence can be decoded to generate a text summary. In the embodiment of the present invention, decoding is performed based on an element dictionary and an element-based coverage mechanism. Compared with the technical solution of decoding based on words and a word-based coverage mechanism in the prior art, repeated attention to the same element can be better avoided, thereby reducing repeated descriptions of the same element in the summary and reducing the redundancy of the generated summary.
[0049] According to an embodiment of the present invention, decoding the hidden sequence according to a preset element dictionary and an element-based coverage mechanism to generate a text summary may be performed as follows:
[0050] Decoding the hidden layer sequence according to a preset element dictionary to obtain an element set;
[0051] According to the feature set and the feature-based coverage mechanism, the attention history of each feature in the feature set is recorded, and the attention of repeated features is penalized in the loss function to generate a text summary.
[0052] In an embodiment of the present invention, a unidirectional LSTM decoder f dec Using this hidden layer sequence, the first summary is generated word by word through the attention mechanism. The formula is as follows:
[0053] s t =f dec (s t-1 ,y t-1 ,c t );
[0054] Among them, {t1, t2, …, t m} is the decoder hidden sequence, {y1, y2, …, y m} is the first summary, c t is the context vector at time t, generated by the attention mechanism.
[0055] In order to solve the technical problems proposed by the present invention, the present invention proposes a coverage mechanism based on elements, which records the history of the decoder's attention to elements, and penalizes the decoder's repeated attention to elements in the loss function, thereby reducing the generation of repeated elements. When the hidden layer sequence is decoded according to the preset element dictionary to obtain the element set, it can be specifically: the element in the preset element dictionary is used as the basic unit, and the hidden layer sequence is decoded to generate the element set element by element. Therefore, multiple element words of the same element can be clustered and described to generate a text summary.
[0056] The formula of the element-based coverage mechanism of the present invention is as follows:
[0057]
[0058] α t,i =softmax(e t,i );
[0059] c t =∑ i α t,i h i
[0060]
[0061]
[0062] Among them, x k ∈a j Indicates that it belongs to element a j The word x k , Represents the effect of time t on factor a j Attention; α t,i Represents the attention to the i-th word in the text data at time t; Indicates the factor a before time t j The accumulation of attention; t,i is an intermediate variable, h i is the hidden state of the i-th word in the input text data, s t is the hidden state of the decoder at time t, u a , U a , W a and V a is the model parameter matrix.
[0063] The final decoder uses the decoder hidden state and context vector to generate a detailed description of the probability that each word w in the text data is determined to be a summary word. The formula is as follows:
[0064] P(w)=softmax(W b s t +V b c t );
[0065] Among them, W b and V b is the model parameter matrix.
[0066] The model is trained based on maximum likelihood, and the loss function is as follows:
[0067]
[0068] Based on the coverage of elements, the present invention penalizes the attention of the decoder to repeated elements in the loss function, thereby reducing the generation of repeated elements. The final loss function formula is as follows:
[0069]
[0070] L final =L+L β ;
[0071] Among them, L β is the loss function for repeated attention on the decoder; L final is the final loss function of the model.
[0072] It can be seen from the above-mentioned feature-based coverage mechanism that, compared with the existing word-based coverage mechanism, it can cluster and describe multiple feature words of the same feature to generate a text summary, thereby avoiding repeated descriptions of the same feature, making the generated text summary more concise and accurate, and can cover more information.
[0073] Figure 2 FIG. 1 is a flow chart of generating a text summary according to an embodiment of the present invention. Figure 2 As shown, in one embodiment of the present invention, taking the generation of corresponding summaries according to the detailed description texts of different commodities as an example, the process of generating text summaries mainly includes the following steps:
[0074] Step S201: constructing a commodity element dictionary for different commodity categories to record the correspondence between elements and element words;
[0075] Step S202: Encode the detailed description text of the product using a bidirectional LSTM encoder to obtain a hidden layer sequence;
[0076] Step S203: Integrate the attention history of the elements of the product into the decoder attention calculation process, use the unidirectional LSTM decoder to decode the hidden layer sequence, and penalize the attention of repeated elements to generate a text summary.
[0077] Figure 3 Schematic diagram of the main modules of the apparatus for generating text summaries according to an embodiment of the present invention. Figure 3 As shown, the apparatus 300 for generating a text summary according to the embodiment of the present invention mainly includes an encoding module 301 and a decoding module 302 .
[0078] An encoding module 301, used for encoding text data for which a summary is to be generated to obtain a hidden layer sequence;
[0079] The decoding module 302 is used to decode the hidden layer sequence according to a preset element dictionary to generate a summary of the text data.
[0080] According to one embodiment of the present invention, the element dictionary can be constructed in the following manner:
[0081] Classify text data according to its content characteristics;
[0082] Each type of text data is labeled and learned to build a feature dictionary corresponding to the text data.
[0083] According to another embodiment of the present invention, the element dictionary can be constructed in the following manner:
[0084] Classify text data according to the category of items;
[0085] Each type of text data is labeled and learned to build a feature dictionary corresponding to the text data.
[0086] According to yet another embodiment of the present invention, the decoding module 302 may also be used for:
[0087] Decoding the hidden layer sequence according to a preset element dictionary to obtain an element set;
[0088] According to the feature set and the feature-based coverage mechanism, the attention history of each feature in the feature set is recorded, and the attention of repeated features is penalized in the loss function to generate a text summary.
[0089] According to yet another embodiment of the present invention, when the decoding module 302 decodes the hidden layer sequence according to the preset element dictionary to obtain the element set, it can also be used to:
[0090] The hidden layer sequence is decoded with elements in a preset element dictionary as basic units to generate element sets element by element.
[0091] According to an embodiment of the present invention, the element-based coverage mechanism includes the following formula:
[0092] α t,i =softmax(e t,i );c t =∑ i α t,i h i ; Among them, e t,i is an intermediate variable, h i is the hidden state of the i-th word in the text data, s t is the hidden state of the decoder at time t, u a , U a , W a and V a is the model parameter matrix; x k ∈a j Indicates that it belongs to element a j The word x k , Represents the effect of time t on factor a j Attention; α t,i Represents the attention to the i-th word in the text data at time t; Indicates the factor a before time t j of attention accumulation.
[0093] According to yet another embodiment of the present invention, the way to penalize the attention of repeated elements is as follows: Among them, L β is the loss function for repeated attention on the decoder; α t,i Represents the attention to the i-th word in the text data at time t; Indicates the factor a before time t j of attention accumulation.
[0094] According to the technical solution of the embodiment of the present invention, the text data for which a summary is to be generated is encoded to obtain a hidden sequence; the hidden sequence is decoded according to a preset element dictionary and an element-based coverage mechanism to generate a text summary, and based on the element dictionary, the elements of the text data and the corresponding element words can be identified; based on the element coverage mechanism, multiple element words of the same element can be clustered and described to generate a text summary, thereby better avoiding repeated attention to the same element, thereby reducing repeated descriptions of the same element in the summary, reducing the redundancy of the generated summary, and making the generated text summary more concise and accurate, and can cover more information.
[0095] Figure 4 An exemplary system architecture 400 is shown to which the method for generating a text summary or the apparatus for generating a text summary according to the embodiments of the present invention can be applied.
[0096] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0097] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0098] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0099] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0100] It should be noted that the method for generating a text summary provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the device for generating a text summary is generally disposed in the server 405 .
[0101] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0102] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 5 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0103] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0104] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0105] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0106] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0107] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0108] The units or modules involved in the embodiments of the present invention may be implemented by software or hardware. The units or modules described may also be arranged in a processor, for example, they may be described as: a processor includes an encoding module and a decoding module. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves, for example, the encoding module may also be described as "a module for encoding text data to be summarized to obtain a hidden sequence".
[0109] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: encoding the text data to be summarized to obtain a hidden layer sequence; decoding the hidden layer sequence according to a preset element dictionary and an element-based coverage mechanism to generate a text summary.
[0110] According to the technical solution of the embodiment of the present invention, the text data for generating a summary is encoded to obtain a hidden sequence; the hidden sequence is decoded according to the element dictionary and the element-based coverage mechanism to generate a text summary, and the elements of the text data and the corresponding element words can be identified based on the element dictionary; based on the element coverage mechanism, multiple element words of the same element can be clustered and described to generate a text summary, thereby better avoiding repeated attention to the same element, thereby reducing repeated descriptions of the same element in the summary, reducing the redundancy of the generated summary, and making the generated text summary more concise and accurate, and can cover more information.
[0111] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for generating a text summary, characterized in that: include: Encode the text data for which summary is to be generated to obtain a hidden sequence; Decoding the hidden sequence according to a preset element dictionary and an element-based coverage mechanism to generate a text summary; Decoding the hidden layer sequence according to a preset element dictionary and an element-based coverage mechanism to generate a text summary includes: decoding the hidden layer sequence according to a preset element dictionary to obtain an element set; recording the attention history of each element in the element set according to the element set and the element-based coverage mechanism, and penalizing the attention of repeated elements in the loss function to generate a text summary; Decoding the hidden layer sequence according to the preset element dictionary to obtain the element set includes: decoding the hidden layer sequence with the elements in the preset element dictionary as basic units to generate the element set element by element; The element-based coverage mechanism includes the following formula: a t,i =softmax(e t,i ); c t =∑ i a t,i h i ; Among them, e t,i is an intermediate variable, h i is the hidden state of the i-th word in the text data, s t-1 is the hidden state of the decoder at time (t-1), u a , U a , W a and V a is the model parameter matrix; x k ∈a j Indicates that it belongs to element a j The word x k , Represents the effect of time t on factor a j attention, Represents the factor a at time τ j Attention; α t,i Represents the attention to the i-th word in the text data at time t; Indicates the factor a before time t j The accumulation of attention; c t is the context vector at time t, generated by the attention mechanism.
2. The method according to claim 1, characterized in that The feature dictionary is constructed in the following way: Classify text data according to its content characteristics; Each type of text data is labeled and learned to build a feature dictionary corresponding to the text data.
3. The method according to claim 1, characterized in that The feature dictionary is constructed in the following way: Classify text data according to the category of items; Each type of text data is labeled and learned to build a feature dictionary corresponding to the text data.
4. The method according to claim 1, characterized in that: The way to penalize attention for repeated elements is as follows: Among them, L β is the loss function for repeated attention on the decoder; α t,i Represents the attention to the i-th word in the text data at time t; Indicates the factor a before time t j accumulation of attention.
5. A device for generating a text summary, characterized in that: include: An encoding module, used for encoding text data for which a summary is to be generated to obtain a hidden sequence; A decoding module, used for decoding the hidden layer sequence according to a preset element dictionary and an element coverage mechanism to generate a text summary; The decoding module is further used to decode the hidden layer sequence according to a preset element dictionary to obtain an element set; according to the element set and the element-based coverage mechanism, record the attention history of each element in the element set, and penalize the attention of repeated elements in the loss function to generate a text summary; Decoding the hidden layer sequence according to the preset element dictionary to obtain the element set includes: decoding the hidden layer sequence with the elements in the preset element dictionary as basic units to generate the element set element by element; The element-based coverage mechanism includes the following formula: a t,i =softmax(e t,i ); c t =∑ i a t,i h i ; Among them, e t,i is an intermediate variable, h i is the hidden state of the i-th word in the text data, s t-1 is the hidden state of the decoder at time (t-1), u a , U a , W a and V a is the model parameter matrix; x k ∈a j Indicates that it belongs to element a j The word x k , Represents the effect of time t on factor a j attention, Represents the factor a at time τ j Attention; α t,i Represents the attention to the i-th word in the text data at time t; Indicates the factor a before time t j The accumulation of attention; c t is the context vector at time t, generated by the attention mechanism.
6. An electronic device for generating a text summary, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Abstract text generation method and device and computer equipment
CN108427771A
A text summarization model generation algorithm that fuses information selection and semantic association
CN109145105A
