Text abstract extraction method and device, electronic equipment, storage medium and product
Through the combination of dual-channel document encoder and statement features, text timing features are extracted and text summary is generated, which solves the problem of insufficient text feature extraction and improves the accuracy and user experience of text summary.
Patent Information
- Application Number
- CN202411746869.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, text feature extraction is insufficient, resulting in inaccurate text summary.
A dual-channel document encoder is used, combined with an additive attention mechanism encoder and a bidirectional gated cyclic unit encoder, text timing features are extracted through statement features, and the importance of the target statement is determined based on document features to generate a text summary.
Through two perspectives, we can fully extract text timing characteristics, improve the accuracy of text summary, and improve user experience.
Smart Images

Figure CN119669459A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a text summary extraction method, device, electronic equipment, storage medium and product. Background Art
[0002] In this era where traffic can be monetized, many unscrupulous people use exaggerated and false titles that have little to do with the content of the article in order to gain traffic. They rely entirely on shocking titles to attract users to click to view the full text, commonly known as "title party". In addition, in this fast-paced era, it is difficult for people to calm down and read an article carefully, especially a long article. If you only judge whether an article is worth reading based on the title, it is very easy to be misunderstood by "title party". It is precisely because of the mixture of various articles that it is difficult for people to quickly select the articles they want to browse from a large number of articles. Therefore, more and more people are eager to spend as little time as possible to obtain articles that are important to them or attract their attention from as many sources as possible.
[0003] In the prior art, extractive text summarization technology is used to extract key sentences from the content of an article to form a summary, which allows users to understand the main content of an article in a shorter time. It can also prevent people from being confused by some so-called "clickbait" articles to a certain extent. However, at present, most of the research on extractive text summarization adopts a two-layer feature extraction model of sentence encoder and document encoder. Only understanding the relationship between sentences from a single perspective will lead to insufficient text feature extraction, resulting in inaccurate text summaries. Therefore, how to accurately and quickly extract text summaries has become a problem that needs to be solved urgently. Summary of the invention
[0004] The present invention provides a text summary extraction method, device, electronic device, storage medium and product to solve the problem of insufficient text feature extraction and inaccurate text summary.
[0005] According to one aspect of the present invention, a text summary extraction method is provided, which includes:
[0006] Acquire a text to be processed, split the text to be processed into at least two target sentences according to a preset sentence recognition rule, and determine sentence features of the target sentences;
[0007] Determine the text temporal features of the target sentence based on the dual-channel document encoder and the sentence features, and determine the document features of the to-be-processed text according to the text temporal features; wherein the dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder;
[0008] The importance of the target sentence is determined according to the document features, and a text summary is generated according to the importance.
[0009] According to another aspect of the present invention, a text summary extraction device is provided, comprising:
[0010] A sentence splitting module is used to obtain a text to be processed, split the text to be processed into at least two target sentences according to a preset sentence recognition rule, and determine the sentence features of the target sentences;
[0011] A feature extraction module, used to determine the text temporal features of the target sentence based on the dual-channel document encoder and the sentence features, and determine the document features of the to-be-processed text according to the text temporal features; wherein the dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder;
[0012] The summary extraction module is used to determine the importance of the target sentence according to the document features and generate a text summary according to the importance.
[0013] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the text summary extraction method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the text summary extraction method described in any embodiment of the present invention when executed.
[0018] According to another aspect of the present invention, an embodiment of the present invention further provides a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, the text summary extraction method of any embodiment of the present invention is implemented.
[0019] The technical solution of the embodiment of the present invention obtains a text to be processed, splits the text to be processed into at least two target sentences according to preset sentence recognition rules, and determines the sentence features of the target sentences; determines the text timing features of the target sentences based on a dual-channel document encoder and sentence features, and determines the document features of the text to be processed according to the text timing features; wherein the dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder; achieves an in-depth understanding of the relationship between the target sentences from two perspectives and fully extracts the text timing features; determines the importance of the target sentence according to the document features, generates a text summary according to the importance, improves the accuracy of the text summary, and enhances the user experience.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a flowchart of a text summary extraction method provided in Embodiment 1 of the present invention;
[0023] Figure 2 is a flowchart of a text summary extraction method provided in Embodiment 2 of the present invention;
[0024] Figure 3 is a structural diagram of a text summary extraction system provided according to Embodiment 3 of the present invention;
[0025] Figure 4 is a structural schematic diagram of a text summary extraction device provided according to a fourth embodiment of the present invention;
[0026] Figure 5 It is a structural schematic diagram of an electronic device for implementing the text summary extraction method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Embodiment 1
[0030] Figure 1 1 is a flowchart of a text summary extraction method provided according to the first embodiment of the present invention. This embodiment is applicable to the case of extracting a text summary from a text. The method can be executed by a text summary extraction device. The text summary extraction device can be implemented in the form of hardware and / or software. The text summary extraction device can be configured in an electronic device. Figure 1 As shown, the method includes:
[0031] S110: Obtain a text to be processed, split the text to be processed into at least two target sentences according to a preset sentence recognition rule, and determine sentence features of the target sentences.
[0032] Among them, the text to be processed can be understood as the text that needs to be abstracted. In the actual operation process, the text to be processed may include but is not limited to news text, article text, etc. The preset sentence recognition rules can be understood as pre-set rules for splitting the text to be processed into target sentences. Generally speaking, the preset sentence recognition rules may include but are not limited to splitting by punctuation marks, or splitting by the number of words. The target sentence can be a sentence used to extract text temporal features, which is a sentence contained in the text to be processed. In the actual operation process, the target sentence can be in the form of a sentence vector, and the number of target sentences can be multiple. Sentence features refer to the use of a vector of fixed dimension to characterize the various features contained in the target sentence in the text to be processed. Generally speaking, the sentence features include at least information such as the semantics of the target sentence, the semantic association between the target sentence and other target sentences.
[0033] In an embodiment, a text to be processed can be received, an initial sentence in the text to be processed can be identified by a preset sentence recognition rule, a target sentence can be confirmed by the initial sentence, and then the sentence features of the target sentence can be confirmed. In the actual operation process, the punctuation configured by the preset sentence recognition rule can be extracted, and the sentences in the text to be processed can be split according to the punctuation; or, the sentences in the text to be processed can be split according to the preset number of words, and then the sentences can be converted into sentence vectors as target sentences, and the target sentences can be input into a preset sentence encoder, and the sentence features of the target sentences can be determined by the preset sentence encoder. In one embodiment, the preset sentence encoder can be a pre-trained BERTSUM model. Among them, the BERTSUM model is a text summary model based on a bidirectional Transformer encoder (Bidirectional Encoder Representations from Transformers, BERT) model. In one embodiment, the number of target sentences, the length of the target sentence, and the meaning of the target sentence can be determined as sentence features, and the sentence features can be three-dimensional vectors.
[0034] S120, determining the text temporal features of the target sentence based on the dual-channel document encoder and the sentence features, and determining the document features of the to-be-processed text according to the text temporal features. The dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder.
[0035] Among them, the dual-channel document encoder refers to a document encoder that encodes documents through two different channels. The dual-channel document encoder can be composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder. In one embodiment, the additive attention mechanism encoder can be based on Fastformer. Fastformer is a text understanding model, which is a Transformer variant based on additive attention. Compared with the quadratic complexity of Transformer, Fastformer can understand contextual information under linear complexity. The bidirectional gated recurrent unit (Dual-Channel Document Encoder, BiGRU) encoder is a bidirectional recurrent neural network model, which is divided into two directions, forward and backward. Text timing features refer to text features extracted according to the time sequence of the text, and the text timing features can be in vector form. Document features are used to characterize the document-level features contained in the text to be processed. The document features can contain information such as semantic associations and logical structures between target sentences. In one embodiment, the document features can be in vector form.
[0036] In an embodiment, the sentence features can be input into a dual-channel document encoder, and the global text features and local text features of the target sentence corresponding to the sentence features can be determined by the dual-channel document encoder, and the global text features and local text features can be used as text temporal features, and the global text features and local text features can be spliced to obtain the document features of the text to be processed. In the actual operation process, the sentence features can be input into an additive attention mechanism encoder to determine the logical relationship of the target sentence corresponding to each sentence feature, and the global feature vector of the target sentence can be obtained as the global text feature; the sentence features can be input into a bidirectional gated recurrent unit encoder to form a target sentence pair with the sentence features corresponding to two adjacent target sentences, and the semantic relationship of the target sentence pair can be determined to obtain the local feature vector of the target sentence corresponding to the target sentence as the local text feature.
[0037] S130: Determine the importance of the target sentence according to the document features, and generate a text summary according to the importance.
[0038] Among them, text summary refers to the extraction of key information from the text to be processed, generating a relatively short, concise text that can accurately reflect the core content of the original text.
[0039] In an embodiment, the importance of each target sentence can be determined by using a linear neural network and a Sigmoid activation function according to the document features, and the target sentences are sorted according to the importance, and a preset number of target sentences with the highest order are selected to form a final summary in the order in the text to be processed. In the actual operation process, the central theme corresponding to the text to be processed can be determined according to the document features, and the similarity between each target sentence and the central theme is determined as the importance of the target sentence. The target sentences are sorted in order from large to small in importance, and a preset number of target sentences with the highest importance are selected from the sorted target sentences, and the positions of the preset number of target sentences in the text to be processed are determined, and the preset number of target sentences are arranged according to the positions to generate a text summary.
[0040] The embodiment of the present invention obtains a text to be processed, splits the text to be processed into at least two target sentences according to a preset sentence recognition rule, and determines the sentence features of the target sentences; determines the text timing features of the target sentences based on a dual-channel document encoder and sentence features, and determines the document features of the text to be processed according to the text timing features; wherein the dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder; achieves an in-depth understanding of the relationship between the target sentences from two perspectives, and fully extracts the text timing features; determines the importance of the target sentence according to the document features, generates a text summary according to the importance, improves the accuracy of the text summary, and enhances the user experience.
[0041] Embodiment 2
[0042] Figure 2 1 is a flowchart of a text summary extraction method provided according to the second embodiment of the present invention. This embodiment is based on the above embodiment and is used to extract a text summary of a civilization. Figure 2 As shown, the method includes:
[0043] S201, receiving a text to be processed, identifying a preset delimiter configured by a preset sentence recognition rule in the text to be processed, and splitting the text to be processed into at least two initial sentences.
[0044] The preset separator may be a preset symbol for splitting into sentences. In one embodiment, the preset separator may include punctuation marks, such as ".", "?", "!" and "...". The initial sentence may be understood as a sentence directly divided according to the preset separator.
[0045] In an embodiment, the text to be processed may be obtained, preset delimiter symbols in the text to be processed may be identified, the text to be processed may be delimited according to the preset delimiter symbols, and the text delimited by the preset delimiter symbols may be used as an initial sentence.
[0046] S202: Convert the initial sentence into a sentence vector, and mark the starting position and odd and even positions of the initial sentence.
[0047] In an embodiment, the initial sentence can be converted into a sentence vector through a deep learning network model, the starting position of the sentence vector is determined, the starting position of the initial sentence is marked, and the position of the sentence vector in the text to be processed is determined, and the odd and even positions of the initial sentence are marked. In one embodiment, [CLS] and [SEP] can be added before and after each target sentence to divide the sentence, and then the initial sentence is converted into a sentence vector, a vector cls_ids is set to record the starting position of each initial sentence, which is used to quickly locate each initial sentence, and the odd and even positions of each sentence are marked in order according to token_type_ids, with sentences in odd positions being 1 and sentences in even positions being 0.
[0048] S203: Adjust each sentence vector to a preset length, and use the adjusted sentence vector as the target sentence.
[0049] Among them, the preset length can be understood as the length of a preset sentence vector, which is convenient for the preset sentence encoder to process the preset sentence encoder.
[0050] In an embodiment, the length of each sentence vector can be determined. If the length of the sentence vector is greater than a preset length, the portion of the sentence vector that exceeds the preset length is deleted; if the length of the sentence vector is less than the preset length, the sentence vector can be filled with 0 or 1.
[0051] S204: Input the target sentence into a preset sentence encoder, and determine the sentence features of the target sentence through the preset sentence encoder.
[0052] Among them, the preset sentence encoder can be understood as an encoder used to determine the characteristics of the target sentence. In actual operation, the preset sentence encoder can be a BERTSUM model.
[0053] In an embodiment, the target sentence may be input into a preset sentence encoder, and the preset sentence encoder may be used to determine the number of target sentences, the length of the target sentences, and the meaning of the target sentences as sentence features of the target sentences.
[0054] S205. Input the sentence features into the additive attention mechanism encoder and the bidirectional gated recurrent unit encoder in the dual-channel document encoder respectively, determine the global text features and local text features of the target sentence corresponding to the sentence features, and use the global text features and local text features as text temporal features.
[0055] In an embodiment, sentence features can be respectively input into the additive attention mechanism encoder and the bidirectional gated recurrent unit encoder in the dual-channel document encoder, the global text features of the target sentence are determined by the additive attention mechanism encoder, and the local text features of the target sentence are determined by the bidirectional gated recurrent unit encoder, and the global text features and the local text features are used as text temporal features.
[0056] In one embodiment, sentence features are respectively input into an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder in a dual-channel document encoder, global text features and local text features of a target sentence corresponding to the sentence features are determined, and the global text features and local text features are used as text temporal features, including:
[0057] The logical relationship of the target sentence corresponding to each sentence feature is determined by the additive attention mechanism encoder, and the global feature vector of the target sentence is obtained as the global text feature;
[0058] The sentence features corresponding to two adjacent target sentences are combined into a target sentence pair through a bidirectional gated recurrent unit encoder, the semantic relationship of the target sentence pair is determined, and the local feature vector of the target sentence corresponding to the target sentence is obtained as the local text feature.
[0059] In an embodiment, the additive attention mechanism encoder can process the input sentence features to generate a global query vector, combine the global query vector with the sentence features through operations such as element-wise multiplication, further perform global context perception, and obtain the global feature vector of the target sentence as the global text feature; the bidirectional gated recurrent unit encoder combines the sentence features corresponding to two adjacent target sentences into a target sentence pair, determines the semantic relationship between the target sentence pairs, and obtains the local feature vector of the target sentence corresponding to the target sentence as the local text feature.
[0060] S206: Concatenate the global text features and the local text features to obtain document features of the text to be processed.
[0061] S207: Input the document features into a preset linear neural network, and determine the importance of each target sentence through the preset linear neural network.
[0062] Among them, the activation function of the preset linear neural network is the Sigmoid function (Sigmoid activation function).
[0063] In one embodiment, document features are input into a preset linear neural network, and the importance of each target sentence is determined by the preset linear neural network, including:
[0064] Determine the central theme of the text to be processed according to the document features based on a preset linear neural network;
[0065] Determine the degree of similarity between each target sentence and the central theme, and use the degree of similarity as the importance of the target sentence.
[0066] In an embodiment, document features can be input into a pre-trained preset linear neural network, and the central theme corresponding to the text to be processed can be determined by the preset linear neural network. The distance between each target sentence and the central theme is confirmed as the similarity, and the similarity is used as the importance of the target sentence.
[0067] S208. Sort the target sentences based on the importance of each target sentence to obtain sorted target sentences.
[0068] In an embodiment, the target sentences may be sorted in descending order according to their importance to obtain sorted target sentences.
[0069] S209: Select a preset number of target sentences with the highest importance from the sorted target sentences as candidate target sentences.
[0070] The preset number can be understood as the number of candidate target sentences, and the preset number can be set according to user needs. For example, the preset number can include but is not limited to 5, 10, 15, etc.
[0071] In an embodiment, a preset number of target sentences may be selected in order from the sorted target sentences as candidate target sentences.
[0072] S210: Determine the positions of the candidate target sentences in the text to be processed, and arrange the candidate target sentences according to the positions to generate a text summary.
[0073] In an embodiment, it can be determined that the candidate target sentence is located at a corresponding position in the text to be processed, and the candidate target sentence is concatenated according to the corresponding position in the text to be processed to generate a text summary.
[0074] According to an embodiment of the present invention, a text to be processed is received, a preset separator symbol configured by a preset sentence recognition rule is identified in the text to be processed, the text to be processed is split into at least two initial sentences, the initial sentences are converted into sentence vectors, the starting position and the odd and even position of the initial sentences are marked, each sentence vector is adjusted to a preset length, and the adjusted sentence vector is used as a target sentence to achieve accurate division of the target sentence; the target sentence is input into a preset sentence encoder, the sentence feature of the target sentence is determined by the preset sentence encoder, the sentence feature is respectively input into an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder in a dual-channel document encoder, the global text feature and the local text feature of the target sentence corresponding to the sentence feature are determined, the global text feature and the local text feature are used as text temporal features, the global text feature and the local text feature are spliced to obtain the document feature of the text to be processed, the document feature is input into a preset linear neural network, the importance of each target sentence is determined by the preset linear neural network, the target sentence is sorted based on the importance of each target sentence, the sorted target sentence is obtained, the position of the candidate target sentence in the text to be processed is determined, the candidate target sentence is arranged according to the position to generate a text summary, and the accuracy of the generated text summary is improved.
[0075] Embodiment 3
[0076] Figure 3 1 is a structural diagram of a text summary extraction system provided according to Embodiment 3 of the present invention. This embodiment is based on the above embodiment and takes the extractive text summary based on BERTSUM. The core idea is to compare the text summary task to the sentence importance ranking task as an example to further illustrate a text summary extraction. Figure 3 As shown in the figure, the text summary extraction system consists of three parts: sentence representation layer, document representation layer and output layer.
[0077] First, the model selects the BERTSUM model as the preset sentence encoder to obtain the sentence-level representation (sentence features) of the text to be processed (news text); then, the document representation layer selects two different document encoders, Fastformer and BiGRU, to form a dual-channel document encoder; finally, in terms of output, the importance of each sentence is calculated through the linear layer and the Sigmoid activation function, and then according to actual needs, multiple sentences with the highest importance are selected to form a summary in the order of appearance in the original text.
[0078] In one embodiment, the sentence representation layer first needs to convert the received text to be processed into the format required by the BERTSUM model, and then use the BERTSUM model to obtain the sentence-level vector representation of the text (S1, S2...Sn, etc. in the figure). Specifically, the text to be processed is segmented according to the four Chinese punctuation marks ".", "?", "!" and "...", and the initial sentences of the text to be processed are obtained to form a sentence set. Construct the model input vector, including input_ids, cls_ids, token_type_ids and mask. Among them, to construct input_ids, it is necessary to add [CLS] and [SEP] before and after each sentence to divide the sentences, and then convert the constructed sentence set into sentence vectors. At the same time, it is necessary to set an additional vector cls_ids to record the starting position of each sentence for fast positioning of each sentence; token_type_ids marks the odd and even positions of each sentence in order, with sentences at odd positions as 1 and sentences at even positions as 0; mask records whether each sentence contains a padding field. The BERTSUM model needs to set all sentence vectors to a preset length. Sentence vectors that exceed the preset length will be truncated directly, and those that are less than the preset length will be padded to obtain the target sentence, which is then input into the BERTSUM model to obtain sentence features.
[0079] The input of the document representation layer is the sentence-level vector representation (sentence features) obtained by the sentence representation layer, that is, a three-dimensional vector. The purpose of this layer is to understand the text at a deeper level, obtain the text temporal features by correctly understanding the relationship between sentences, and thus obtain the document-level vector representation. The document representation layer adopts a dual document encoder method to understand the relationship between sentences from both global and local perspectives to obtain global text features (f1, f2...fn, etc. in the figure) and local text features (h1, h2...hn, etc. in the figure) as text temporal features, and by splicing the encoding results of the two encoders, the encoding capabilities of the two encoders are comprehensively utilized to obtain the document-level representation of the text (document features, x1, x2...xn, etc. in the figure).
[0080] The purpose of the output layer is to use the document-level representation obtained by the upper layer to calculate the probability that each sentence should appear in the summary, and use a linear neural network (Linear) and a Sigmoid activation function to calculate the importance of each sentence, and sort them according to their importance. Finally, the top few sentences are selected to form the final summary in the order of the original text.
[0081] Embodiment 4
[0082] Figure 4 Schematic diagram of a text summary extraction device according to Embodiment 4 of the present invention. Figure 4As shown, the device includes: a sentence splitting module 41, a feature extraction module 42 and a summary extraction module 43.
[0083] The sentence splitting module 41 is used to obtain the text to be processed, split the text to be processed into at least two target sentences according to the preset sentence recognition rules, and determine the sentence features of the target sentences;
[0084] A feature extraction module 42 is used to determine the text temporal features of the target sentence based on the dual-channel document encoder and the sentence features, and determine the document features of the to-be-processed text according to the text temporal features; wherein the dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder;
[0085] The summary extraction module 43 is used to determine the importance of the target sentence according to the document features and generate a text summary according to the importance.
[0086] In an embodiment of the present invention, a text to be processed is obtained through a sentence splitting module, and the text to be processed is split into at least two target sentences according to a preset sentence recognition rule, and the sentence features of the target sentences are determined; a feature extraction module determines the text timing features of the target sentences based on a dual-channel document encoder and sentence features, and determines the document features of the text to be processed according to the text timing features; wherein the dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder; an in-depth understanding of the relationship between the target sentences is achieved through two perspectives, and the text timing features are fully extracted; a summary extraction module determines the importance of the target sentence according to the document features, generates a text summary according to the importance, improves the accuracy of the text summary, and enhances the user experience.
[0087] In one embodiment, the statement splitting module 41 includes:
[0088] A sentence splitting unit is used to receive a text to be processed, identify a preset separator symbol configured by a preset sentence recognition rule in the text to be processed, and split the text to be processed into at least two initial sentences;
[0089] A sentence marking unit, which is used to convert the initial sentence into a sentence vector and mark the starting position and odd and even positions of the initial sentence;
[0090] A sentence determination unit, used to adjust each sentence vector to a preset length and use the adjusted sentence vector as a target sentence;
[0091] The feature determination unit is used to input the target sentence into a preset sentence encoder and determine the sentence features of the target sentence through the preset sentence encoder.
[0092] In one embodiment, the feature extraction module 42 includes:
[0093] A feature extraction unit is used to input the sentence features into the additive attention mechanism encoder and the bidirectional gated recurrent unit encoder in the dual-channel document encoder, respectively, determine the global text features and local text features of the target sentence corresponding to the sentence features, and use the global text features and the local text features as text temporal features;
[0094] The feature determination unit is used to combine the global text features and the local text features to obtain the document features of the text to be processed.
[0095] In one embodiment, the feature extraction unit is specifically used to:
[0096] The logical relationship of the target sentence corresponding to each sentence feature is determined by the additive attention mechanism encoder, and the global feature vector of the target sentence is obtained as the global text feature;
[0097] The sentence features corresponding to two adjacent target sentences are combined into a target sentence pair through a bidirectional gated recurrent unit encoder, the semantic relationship of the target sentence pair is determined, and the local feature vector of the target sentence corresponding to the target sentence is obtained as the local text feature.
[0098] In one embodiment, the summary extraction module 43 includes:
[0099] An importance determination unit, used for inputting document features into a preset linear neural network, and determining the importance of each target sentence through the preset linear neural network; wherein the activation function of the preset linear neural network is a Sigmund function;
[0100] A sentence sorting unit, used for sorting the target sentences based on the importance of each target sentence to obtain sorted target sentences;
[0101] A candidate sentence determination unit, used to select a preset number of target sentences with the highest importance from the sorted target sentences as candidate target sentences;
[0102] The summary generation unit is used to determine the position of the candidate target sentences in the text to be processed, and to arrange the candidate target sentences according to the position to generate a text summary.
[0103] In one embodiment, the importance determination unit is specifically configured to:
[0104] Determine the central theme of the text to be processed according to the document features based on a preset linear neural network;
[0105] Determine the degree of similarity between each target sentence and the central theme, and use the degree of similarity as the importance of the target sentence.
[0106] The text summary extraction device provided in the embodiment of the present invention can execute the text summary extraction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0107] Embodiment 5
[0108] Further description of this abstract extraction method
[0109] Figure 5 1 is a schematic diagram of the structure of an electronic device for implementing the text summary extraction method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0110] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0111] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0112] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a text summary extraction method.
[0113] In some embodiments, the text summary extraction method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the text summary extraction method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the text summary extraction method in any other appropriate manner (e.g., by means of firmware).
[0114] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0115] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0116] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.
[0117] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0118] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0119] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0120] In one embodiment, the embodiment of the present invention further includes a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, the text summary extraction method of any embodiment of the present invention is implemented.
[0121] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0122] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0123] 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 can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A text summary extraction method, characterized in that: include: Acquire a text to be processed, split the text to be processed into at least two target sentences according to a preset sentence recognition rule, and determine sentence features of the target sentences; Determine the text temporal features of the target sentence based on the dual-channel document encoder and the sentence features, and determine the document features of the to-be-processed text according to the text temporal features; wherein the dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder; The importance of the target sentence is determined according to the document features, and a text summary is generated according to the importance.
2. The method according to claim 1, characterized in that The step of obtaining the text to be processed, splitting the text to be processed into at least two target sentences according to a preset sentence recognition rule, and determining sentence features of the target sentences includes: receiving a text to be processed, identifying a preset delimiter configured by a preset sentence recognition rule in the text to be processed, and splitting the text to be processed into at least two initial sentences; Convert the initial sentence into a sentence vector, and mark the starting position and odd and even positions of the initial sentence; Adjusting each of the sentence vectors to a preset length, and using the adjusted sentence vectors as target sentences; The target sentence is input into a preset sentence encoder, and sentence features of the target sentence are determined by the preset sentence encoder.
3. The method according to claim 1, characterized in that The step of determining the text timing features of the target sentence based on the dual-channel document encoder and the sentence features, and determining the document features of the to-be-processed text according to the text timing features, includes: Inputting the sentence features into an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder in a dual-channel document encoder respectively, determining global text features and local text features of a target sentence corresponding to the sentence features, and using the global text features and local text features as text temporal features; The global text features and the local text features are concatenated to obtain the document features of the text to be processed.
4. The method according to claim 3, characterized in that The step of inputting the sentence features into an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder in a dual-channel document encoder respectively, determining global text features and local text features of a target sentence corresponding to the sentence features, and using the global text features and local text features as text temporal features includes: Determining the logical relationship of the target sentence corresponding to each of the sentence features through the additive attention mechanism encoder, and obtaining the global feature vector of the target sentence as the global text feature; The bidirectional gated recurrent unit encoder combines sentence features corresponding to two adjacent target sentences into a target sentence pair, determines the semantic relationship of the target sentence pair, and obtains a local feature vector of the target sentence corresponding to the target sentence as a local text feature.
5. The method according to claim 1, characterized in that The step of determining the importance of the target sentence according to the document features and generating a text summary according to the importance includes: Inputting the document features into a preset linear neural network, and determining the importance of each target sentence through the preset linear neural network; wherein the activation function of the preset linear neural network is a Sigmund function; sorting the target sentences based on the importance of each target sentence to obtain sorted target sentences; Selecting a preset number of target sentences with the highest importance from the sorted target sentences as candidate target sentences; Determine the position of the candidate target sentences in the text to be processed, and arrange the candidate target sentences according to the position to generate a text summary.
6. The method according to claim 5, characterized in that The step of inputting the document features into a preset linear neural network and determining the importance of each target sentence through the preset linear neural network includes: Determining the central theme of the text to be processed according to the document features based on the preset linear neural network; The similarity between each of the target sentences and the central theme is determined, and the similarity is used as the importance of the target sentence.
7. A text summary extraction device, characterized in that: include: A sentence splitting module is used to obtain a text to be processed, split the text to be processed into at least two target sentences according to a preset sentence recognition rule, and determine the sentence features of the target sentences; A feature extraction module, used to determine the text temporal features of the target sentence based on the dual-channel document encoder and the sentence features, and determine the document features of the to-be-processed text according to the text temporal features; wherein the dual-channel document encoder is composed of an additive attention mechanism encoder and a bidirectional gated recurrent unit encoder; The summary extraction module is used to determine the importance of the target sentence according to the document features and generate a text summary according to the importance.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the text summary extraction method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the text summary extraction method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the text summary extraction method according to any one of claims 1 to 6.