A method and device for extracting summary of answer text, electronic equipment and medium

By selecting the appropriate model according to the type and length of the answer text for processing, generating or extracting text summary, the problem of large amount of information in Internet search results is solved, and the user experience and information acquisition efficiency is improved.

CN113688231BActive Publication Date: 2024-11-08BEIJING XIAOMI MOBILE SOFTWARE CO LTD +1
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202110881696.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-02
Publication Date
2024-11-08
Estimated Expiration
2041-08-02

AI Technical Summary

Technical Problem

The answers returned by Internet search are large in volume, and users need to spend a lot of time browsing to identify valid information, resulting in poor user experience.

Method used

According to the text type and length of the answer text, select the generative model, extracted model or comprehensive model for processing, and generate or extract text summary to ensure that the length of the summary is shorter than the original text but retains the main meaning.

Benefits of technology

Improve the accuracy of the summary extraction of answer text and improve the efficiency and experience of users to obtain information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113688231B_ABST
    Figure CN113688231B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a method, device, electronic device and medium for extracting a summary of an answer text. The method includes: obtaining a first answer text of a first text length; determining a target model from multiple alternative models based on the text type and / or the first text length of the first answer text; using the target model to process the first answer text to obtain a second answer text of a second text length, wherein the second text length is shorter than the first text length, and the second answer text has the same main meaning as the first answer text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of natural language processing, and in particular to a method and device for extracting a summary of an answer text, an electronic device, and a medium. Background Art

[0002] With the popularization of the Internet, more and more people are searching for answers to questions on the Internet. However, the Internet often returns a large amount of matching answer information, which requires a lot of time to browse to identify valid answers, resulting in poor user experience.

[0003] Therefore, it becomes particularly important to extract summary information of the answer. Summary of the invention

[0004] In view of this, the embodiments of the present disclosure provide a method and device for extracting a summary of an answer text, an electronic device, and a storage medium.

[0005] According to a first aspect of an embodiment of the present disclosure, a method for extracting a summary of an answer text is provided, comprising:

[0006] Get the first answer text of the first text length;

[0007] Determining a target model from a plurality of candidate models according to a text type of the first answer text and / or a first text length;

[0008] The first answer text is processed using the target model to obtain a second answer text of a second text length, wherein the second text length is shorter than the first text length, and the second answer text has the same main meaning as the first answer text.

[0009] In one embodiment, the candidate model includes at least one of the following:

[0010] A generative model, for generating the second answer text based on the content of the first answer text;

[0011] The extractive model extracts at least one keyword and / or key sentence already existing in the first answer text to form the second answer text;

[0012] The comprehensive model includes the extractive model and the generative model which are arranged successively, and is used to form the second answer text after the first answer text is processed by the extractive model and the generative model in sequence.

[0013] In one embodiment, determining a target model from a plurality of candidate models according to the text type and / or the first text length of the first answer text comprises at least one of the following:

[0014] If the text type of the first answer text is the first text type and the length of the first text is within a first interval, determining that the target model is the generative model;

[0015] If the first answer text is of the first text type and the first text length is within the second interval, determining that the target model is the extractive model;

[0016] If the first answer text is of the first text type and the first text length is within a third interval, determining that the target model is the comprehensive model;

[0017] The minimum value of the second interval is greater than or equal to the maximum value of the first interval, and the minimum value of the third interval is greater than or equal to the maximum value of the second interval.

[0018] In one embodiment, determining a target model from a plurality of candidate models according to the text type and / or the first text length of the first answer text further includes:

[0019] If the first answer text is of the second text type or the third text type, and the first text length is within the fourth region, the target model is determined to be the extractive model.

[0020] In one embodiment, the generative model is used to generate the second answer text based on the content of the first answer text, including:

[0021] Performing word segmentation processing on the first answer text to determine the word segmentation positions in the first answer text;

[0022] Inserting a predetermined separator at the word segmentation position in the first answer text;

[0023] The first answer text with the separator inserted is input into the generative model to obtain the second answer text.

[0024] In one embodiment, the generative model is a language model of BERT, a bidirectional encoder based on Transformers.

[0025] In one embodiment, the extractive model extracts at least one keyword and / or key sentence already existing in the first answer text to form the second answer text, including:

[0026] Splitting the first answer text into N sentences, and selecting M sentences from the N sentences, where M is not greater than N;

[0027] Determining candidate keywords for the M sentences;

[0028] Sorting the candidate keywords by importance;

[0029] Select a preset number of candidate keywords with high importance as keywords;

[0030] Based on the keywords, the second answer text is formed.

[0031] According to a second aspect of an embodiment of the present disclosure, a device for extracting a summary of an answer text is provided, comprising:

[0032] An acquisition module, used for acquiring a first answer text of a first text length;

[0033] A model determination module, used to determine a target model from a plurality of candidate models according to a text type of the first answer text and / or a first text length;

[0034] A processing module is used to process the first answer text using the target model to obtain a second answer text of a second text length, wherein the second text length is shorter than the first text length, and the second answer text has the same main meaning as the first answer text.

[0035] In one embodiment, the candidate model includes at least one of the following:

[0036] A generative model, for generating the second answer text based on the content of the first answer text;

[0037] The extractive model extracts at least one keyword and / or key sentence already existing in the first answer text to form the second answer text;

[0038] The comprehensive model includes the extractive model and the generative model which are arranged successively, and is used to form the second answer text after the first answer text is processed by the extractive model and the generative model in sequence.

[0039] In one embodiment, the generative model includes:

[0040] A processing unit, configured to perform word segmentation processing on the first answer text to determine word segmentation positions in the first answer text;

[0041] A separator inserting unit, used for inserting a predetermined separator at the word segmentation position in the first answer text;

[0042] A generating unit is used to input the first answer text with the separator inserted into the generating model to obtain the second answer text.

[0043] In one embodiment, the generative model is a language model of BERT, a bidirectional encoder based on Transformers.

[0044] In one embodiment, the extractive model includes:

[0045] A selection unit, used for splitting the first answer text into N sentences, and selecting M sentences from the N sentences, wherein M is not greater than N;

[0046] A candidate keyword determination unit, used to determine candidate keywords of the M sentences;

[0047] A sorting unit, used to sort the candidate keywords by importance;

[0048] A selection unit, used to select a preset number of candidate keywords with high importance as keywords;

[0049] The conjunction unit is used to form the second answer text based on the keyword.

[0050] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, wherein the electronic device includes the device described in the second aspect.

[0051] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, storing executable instructions for causing a processor to execute the method described in the first aspect.

[0052] The embodiments of the present disclosure provide a method and device for extracting a summary of an answer text, an electronic device, and a storage medium. The method uses different candidate models to process a first answer text of different text types and / or text lengths according to the text type and text length of the answer text, and obtains a second answer text as its summary, thereby improving the accuracy of extracting the summary of the answer text and enhancing the efficiency and experience of users in obtaining information.

[0053] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the embodiments of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The accompanying drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the principles of the embodiments of the present disclosure.

[0055] Figure 1 is a flowchart of a first method for extracting a summary of an answer text according to an exemplary embodiment;

[0056] Figure 2is a flow chart of a second method for extracting a summary of an answer text according to an exemplary embodiment;

[0057] Figure 3 is a flow chart of a third method for extracting a summary of an answer text according to an exemplary embodiment;

[0058] Figure 4 is a flowchart of a fourth method for extracting a summary of an answer text according to an exemplary embodiment;

[0059] Figure 5 is a flowchart of a fifth method for extracting a summary of an answer text according to an exemplary embodiment;

[0060] Figure 6 is a flowchart of a sixth method for extracting a summary of an answer text according to an exemplary embodiment;

[0061] Figure 7 is a schematic diagram of an extractive model according to an exemplary embodiment;

[0062] Figure 8 is a schematic diagram of a generative model according to an exemplary embodiment;

[0063] Fig. 9 is a schematic diagram of a comprehensive model according to an exemplary embodiment;

[0064] Fig.10 is another schematic diagram of a generative model according to an exemplary embodiment;

[0065] Fig.11 is a structural schematic diagram of a first type of answer text summary extraction device according to an exemplary embodiment;

[0066] Fig.12 is a structural schematic diagram of a second answer text summary extraction device according to an exemplary embodiment;

[0067] Fig.13 is a schematic structural diagram of a third device for extracting a summary of an answer text according to an exemplary embodiment;

[0068] Fig.14 is a schematic structural diagram of a fourth device for extracting a summary of an answer text according to an exemplary embodiment;

[0069] Fig.15 The present invention is a structural block diagram of a device for extracting a summary of an answer text according to an exemplary embodiment. DETAILED DESCRIPTION

[0070] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the embodiments of the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present disclosure as detailed in the appended claims.

[0071] The terms used in the disclosed embodiments are only for the purpose of describing specific embodiments and are not intended to limit the disclosed embodiments. The singular forms of "a", "said" and "the" used in the disclosed embodiments and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0072] It should be understood that although the terms first, second, third, etc. may be used to describe various information in the disclosed embodiments, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the disclosed embodiments, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0073] like Figure 1 As shown, this exemplary embodiment provides a method for extracting a summary of an answer text, comprising:

[0074] Step S101: obtaining a first answer text of a first text length;

[0075] Step S103: determining a target model from a plurality of candidate models according to the text type and / or the first text length of the first answer text;

[0076] Step S104: Use the target model to process the first answer text to obtain a second answer text of a second text length, wherein the second text length is shorter than the first text length, and the second answer text has the same main meaning as the first answer text.

[0077] In this embodiment, the answer text summary extraction method can be performed by an answer text summary extraction device, which can be integrated in an electronic device (such as a server) and can be implemented in the form of hardware and / or software.

[0078] In this embodiment, the first answer text may be answer information provided by the interactive system based on the question information, wherein the interactive system may be an intelligent interactive system such as an intelligent terminal, platform, application, client, etc. that can provide intelligent interactive services, for example, an intelligent speaker, an intelligent video speaker, an intelligent storytelling machine, an intelligent interactive platform, an intelligent interactive application, a search engine, a question-and-answer system, etc. For example, the interactive system matches the input question information through a preset question-and-answer library, and uses the answer with the highest matching degree as the answer information corresponding to the question information.

[0079] like Figure 2 As shown, before step S103, the method further includes:

[0080] Step S102: Determine the text type of the first answer text.

[0081] Here, the text type can be determined based on the first answer text and / or the question information corresponding to the first answer text. The text type includes factual text, cause text, method text, etc.

[0082] In some possible implementations, a question library may be pre-established, and sentence similarity calculations may be performed between the question information corresponding to the first answer text and all question statements in the question library, and finally the question type corresponding to the question statement with the highest similarity may be used as the text type of the first answer text.

[0083] For example, different types of question statements are pre-defined in the question library, and the question statements may include: factual question statements, cause-type question statements and method-type question statements, among which, factual question statements may include: what is, who is, what is it called, how many, where, which ones are there, which ones are included, etc.; cause-type question statements may include: why, what is the reason, etc.; method-type question statements may include: how, how, the method is, the way is, etc.

[0084] It can be understood that the contents included in the various types of question statements given above are only some examples for constructing a question library, and in specific applications, they can be defined according to actual application fields and scenarios.

[0085] In some other possible implementations, an answer library may be pre-established, sentence similarity may be calculated between the first answer text and all answer sentences in the answer library, and finally the answer type corresponding to the answer sentence with the highest similarity may be used as the text type of the first answer text.

[0086] For example, different types of answer statements are pre-defined in the answer library, and the answer statements may include: factual answer statements, cause-based answer statements and method-based answer statements, among which factual answer statements may include: "(person, place or entity) is", "(person, place or entity) is called", "(person, place or entity) has", "(person, place or entity) includes", etc.; cause-based answer statements may include: "the reason is", "because", "due to" and other words indicating the reason; method-based answer statements may include: "the method is", "the way is", "the step is" and other words indicating the method.

[0087] It can be understood that the contents included in the various types of answer statements given above are only some examples for constructing an answer library, and in specific applications, they can be defined according to actual application fields and scenarios.

[0088] It is understandable that, according to the needs of actual application, other methods may be used to determine the text type of the first answer text, and this embodiment does not limit this.

[0089] After the text type of the first answer text is determined, in step S103, a target model is determined from a plurality of candidate models according to the text type of the first answer text and / or the first text length.

[0090] Here, since the text type reflects the composition characteristics of the text to a certain extent, and at the same time, under the premise of the same target model, the text length directly determines the complexity of model processing, therefore, at least one dimension of text type and text length is considered to select the target model for extracting the answer text.

[0091] In this embodiment, the alternative model may be a model that implements a text summary extraction function algorithm, for example, an extractive model and / or a generative model. The extractive model includes a model that implements the Lead-3 algorithm, TextRank algorithm, LDA algorithm, CNN algorithm and / or BERT algorithm, and the generative model includes a model that implements the LSTM algorithm, convS2S algorithm and / or UniLM algorithm.

[0092] In some possible implementations, the target model may be determined directly from a plurality of candidate models according to the text type of the first answer text.

[0093] For example, for factual text or reason text, since the main meaning of the facts or reasons to be stated is mainly concentrated in the first few sentences or the last few sentences of the first answer text, when determining the target model from the candidate models, the model determined is mainly based on the first few sentences or the last few sentences of the first answer text as the second answer text. For example, the determined target model is an extractive model, and the first answer text is processed by the extractive model, and the second answer text obtained includes the first few sentences or the last few sentences of the first answer text as the second answer text.

[0094] For another example, for a method-based text, the main idea of ​​the method to be stated is scattered throughout the first answer text. Therefore, when determining the target model from the candidate models, the model that summarizes the keywords / sentences of the first answer text into the second answer text is determined. For example, the target model determined is a generative model, and the first answer text is processed by the generative model, and the second answer text obtained is a summary of the main idea of ​​the first answer text.

[0095] In some other possible implementations, the target model may be determined directly from a plurality of candidate models based on the first text length of the first answer text.

[0096] For example, if the length of the first text is less than the first preset threshold, when determining the target model from the candidate models, a model is determined that summarizes the keywords / sentences of the first answer text into the second answer text. For example, if the determined target model is a generative model, the first answer text is processed by the generative model, and the second answer text obtained is a summary of the main meaning of the first answer text.

[0097] For another example, if the length of the first text is greater than the first preset threshold, when determining the target model from the candidate models, a model is determined that mainly extracts keywords / sentences from the first answer text to form a second answer text. For example, if the determined target model is an extractive model, the first answer text is processed by the extractive model, and the obtained second answer text includes a second answer text of keywords / sentences.

[0098] In some other possible implementations, the target model may be determined from a plurality of candidate models in combination with the text type and text length of the first answer text.

[0099] For example, for a method-type text whose first text length is greater than a first preset threshold, when determining a target model from the candidate models, first, a first model for extracting keywords / sentences from the first answer text is determined, and an intermediate answer text is generated by the first model processing, and then a second model for summarizing the intermediate answer text into a second answer text is determined. Finally, the target model includes the first model and the second model set in sequence.

[0100] It can be understood that the above are only some examples of determining a target model from multiple candidate models according to text type and / or text length. In specific applications, a suitable target model can be selected according to actual application needs.

[0101] After determining the target model, the first answer text is processed using the target model to obtain a second answer text of a second text length.

[0102] That is, the first answer text is used as the input of the target model, and the target model processes and outputs the second answer text. The second answer text is a summary of the first answer text, so the second text length of the second answer text is shorter than the first text length of the first answer text, and the second answer text has the same main meaning as the first answer text.

[0103] The summary extraction method of the answer text provided in the embodiment of the present disclosure adopts different candidate models to process the first answer text of different text types and / or text lengths according to the text type and text length of the answer text, and obtains the second answer text as its summary, thereby improving the accuracy of the summary extraction of the answer text and enhancing the efficiency and experience of users in obtaining information.

[0104] In some possible implementations, before using the target model to process the first answer text in step S103, the method further includes:

[0105] Filter the first answer text.

[0106] Specifically, the noise information contained in the first answer text is filtered, where the noise information may include: hypertext markup language tags, garbled text, punctuation marks and / or colloquial words, etc. By filtering the first answer text, the accuracy of the extracted summary can be effectively improved.

[0107] In some possible implementations, the candidate model includes at least one of the following:

[0108] A generative model is used to generate the second answer text based on the content of the first answer text; for example, the generative model rewrites and reorganizes the first answer text based on its understanding of the semantics of the first answer text to generate a more concise and generalized second answer text.

[0109] The extractive model extracts at least one keyword and / or key sentence already existing in the first answer text to form the second answer text; for example, the extractive model directly selects important phrases or sentences (i.e., keywords or key sentences) from the first answer text, combines the keywords and / or key sentences to form the second answer text.

[0110] The comprehensive model includes the extractive model and the generative model which are set successively, and is used to process the first answer text by the extractive model and the generative model in sequence to form the second answer text. For example, first, the first answer text is processed by the extractive model to obtain an intermediate answer text, and then, the intermediate answer text is processed by the generative model to obtain the second answer text.

[0111] In this embodiment, the third text length of the intermediate answer text is not less than the second preset threshold, wherein the third text length is K times the second text length, and K is greater than 1.

[0112] In some possible implementations, if the determined target model is a generative model, and the second answer text is generated based on the generative model, the method further includes:

[0113] Use the semantic matching model to determine whether the semantics of the second answer text is consistent with the first answer text;

[0114] If they are inconsistent, the first answer text is processed using an extractive model to obtain a third answer text, and the third answer text is output.

[0115] In some possible implementations, when determining a target model from a plurality of candidate models, at least one of the following methods may be used:

[0116] If the text type of the first answer text is the first text type and the length of the first text is within a first interval, determining that the target model is the generative model;

[0117] If the first answer text is of the first text type and the first text length is within the second interval, determining that the target model is the extractive model;

[0118] If the first answer text is of the first text type and the first text length is within a third interval, determining that the target model is the comprehensive model;

[0119] The minimum value of the second interval is greater than or equal to the maximum value of the first interval, and the minimum value of the third interval is greater than or equal to the maximum value of the second interval.

[0120] In this embodiment, when the text type of the first answer text is the first text type, a suitable candidate model is used as the target model according to the first text length of the first answer text.

[0121] Here, the first interval range, the second interval range and the third interval range are divided based on the length of the text, and then the target model is determined according to the divided interval ranges. For example, the first interval range is no more than 300 words, the second interval range is greater than 300 words and less than 1000 words, and the third interval range is not less than 1000 words.

[0122] The first text type may be factual text or reason text, preferably factual text.

[0123] Specifically, for example, when the first answer text is a factual text and the length of the first text does not exceed 300 words, the target model is determined to be a generative model. The generative model rewrites and reorganizes the first answer text based on its understanding of the semantics of the first answer text to generate a more concise and general second answer text.

[0124] For another example, when the first answer text is a factual text and the length of the first text is not less than 1,000 words, the target model is determined to be a comprehensive model, and the first answer text is first processed by the extractive model to obtain an intermediate answer text, and then the intermediate answer text is processed by the generative model to obtain the second answer text.

[0125] In some possible implementations, if the first answer text is of the second text type or the third text type, and the first text length is within a fourth region, the target model is determined to be the extractive model.

[0126] In this embodiment, when the text type of the first answer text is the second text type or the third text type, a suitable candidate model is used as the target model according to the first text length of the first answer text.

[0127] Here, the fourth interval range, the fifth interval range and the sixth interval range are divided based on the length of the text, and then the target model is determined according to the divided interval ranges. Among them, the minimum value of the fourth interval range is greater than or equal to the maximum value of the fifth interval range, and the minimum value of the sixth interval range is greater than or equal to the maximum value of the fourth interval range. For example, the fifth interval range is no more than 500 words, the fourth interval range is greater than 500 words and less than 1000 words, and the sixth interval range is not less than 1000 words.

[0128] It can be understood that the fourth interval range, the fifth interval range and the sixth interval range divided here have no direct correlation with the first interval range, the second interval range and the third interval range divided for the first text type.

[0129] The second text type and the third text type may be cause-type text or method-type text.

[0130] Specifically, for example, when the first answer text is a method-type text and the length of the first text is greater than 500 words and less than 1000 words, the target model is determined to be an extractive model. The extractive model directly selects important phrases or sentences (that is, keywords or key sentences) from the first answer text, combines the keywords and / or key sentences to form a second answer text.

[0131] In some possible implementations, such as Figure 3 As shown, the generative model forms a second answer text based on the first answer text, including:

[0132] Step S201: performing word segmentation processing on the first answer text to determine the word segmentation positions in the first answer text;

[0133] Step S202: inserting a predetermined separator at the word segmentation position in the first answer text;

[0134] Step S203: inputting the first answer text with the separator inserted into the generative model to obtain the second answer text.

[0135] In the above step S201, the first answer text is segmented, and the position of the segmentation in the first answer text can be recorded, wherein one segmentation is included between two adjacent segmentation positions. At the same time, based on the BERT mechanism, the symbol [CLS] can be set at the beginning of a sentence in the first answer text, the symbol [SEP] can be used to separate two adjacent sentences, and the symbol [SEP] can be set at the end of the first answer text.

[0136] For example, the first answer text is "Typhoon is a type of tropical cyclone. Tropical cyclone is a low-pressure vortex that occurs on the tropical or subtropical ocean surface. It is a powerful and deep "tropical weather system". ... Among them, those with wind speeds of 12 or above are collectively called typhoons." Then, through word segmentation, the first answer text can be obtained as "[CLS] Typhoon / belongs to / a type of / tropical / cyclone / Tropical / cyclone / is / a / low-pressure / vortex / that / occurs / on / tropical / or / subtropical / ocean / is / a / powerful / and / deep / tropical / weather / system / ... / Those / with / wind speeds / reaching / 12 / or / above / are / collectively / called / typhoons[SEP]", where " / " can be used to determine the participle position. A participle is contained between the symbol [CLS] or [SEP] and " / ", and a participle is also contained between two adjacent " / ".

[0137] In step S202, the separator may be a symbol used to separate two adjacent words in a sentence. The specific form of the separator may be various and may be set according to actual conditions. For example, the separator may be " / " or "[SEW]". A word may be between two adjacent separators. The word may form a kind of semantic information and may also indicate that multiple characters in the word have a strong correlation with each other, and the correlation between different words is weak.

[0138] If the separator is "[SEW]", after inserting the preset separator at the word participle position in the first answer text, the above example sentence becomes "[CLS] Typhoon [SEW] belongs to [SEW] a kind of [SEW] tropical [SEW] cyclone [SEW]. Tropical [SEW] cyclone [SEW] is [SEW] a [SEW] low-pressure [SEW] vortex [SEW] that [SEW] occurs [SEW] on the [SEW] tropical [SEW] or [SEW] subtropical [SEW] ocean surface [SEW]. It is [SEW] a [SEW] powerful [SEW] and [SEW] deep [SEW] tropical [SEW] weather [SEW] system [SEW]... [SEW] Among them, those with wind force [SEW] reaching [SEW] level 12 [SEW] or above [SEW] are collectively referred to as [SEW] typhoons [SEP]".

[0139] In step S203, the first answer text with separators inserted is input into the generative model to obtain the second answer text.

[0140] In some possible implementations, the generative model is a language model of a bidirectional encoder BERT based on Transformers.

[0141] In this embodiment, the language model of the Transformers-based bidirectional encoder BERT is completely based on the attention mechanism to model the first answer text, to calculate the relationship between each word in the first answer text and all the words in the first answer text, and then considers that the relationship between the word and all the words reflects the correlation and importance between different words in the first answer text to a certain extent. Based on this, the above correlation and importance are used to adjust the importance (or weight) of each word, and finally obtain a new expression for each word.

[0142] Finally, based on the new expression of each word, the second answer text corresponding to the first answer text is determined, thereby improving the accuracy of the second text.

[0143] In some possible implementations, the extractive model extracts at least one keyword and / or key sentence already existing in the first answer text to form the second answer text, such as Figure 4 As shown, including:

[0144] Step S301: split the first answer text into N sentences, and select M sentences from the N sentences, where M is not greater than N;

[0145] Step S302: Determine candidate keywords for the M sentences;

[0146] Step S303: sorting the candidate keywords by importance;

[0147] Step S304: selecting a preset number of candidate keywords with high importance as keywords;

[0148] Step S305: Based on the keywords, form the second answer text.

[0149] In this embodiment, by directly extracting some sentences (M sentences) from the N sentences of the first answer text for further processing, the computational complexity of the entire model processing can be effectively reduced. Here, the extraction method can be to extract the first M sentences of the first answer text, the last M sentences of the first answer text, etc.

[0150] In step S302, a method of extracting keywords in related technologies may be used to determine candidate keywords.

[0151] After determining the candidate keywords, an importance value is determined for each candidate keyword to characterize the importance of the candidate keywords. Here, the importance value of the candidate keyword can be determined based on its frequency of occurrence in the first answer text. The higher the frequency of occurrence, the greater the importance value, and the higher the corresponding importance; or it can be determined based on the corresponding relationship between the preset keywords and the importance value.

[0152] Finally, the candidate keywords are ranked according to their importance values, a preset number of candidate keywords with high importance are selected as keywords, and a second answer text is formed based on the determined keywords.

[0153] A specific example is provided below in combination with any of the above embodiments:

[0154] The disclosed embodiment is applied to the open domain answering scenario in intelligent question answering. The basic process is as follows: Figure 5 and Figure 6 As shown:

[0155] A1: After the question-answering system obtains the user's question information (query), it retrieves the final answer (i.e., the first answer text) from the database;

[0156] A2: For answers with longer length, the text analysis module (i.e., model determination module) determines the text type of the answer and determines which summary module (i.e., target model) it is suitable for.

[0157] A3: Send the query and the first answer text to the summary module, and process them to obtain the summary result (i.e., the second answer text);

[0158] A4: If the summary module used is a generative model, a verification module (such as a semantic matching model) is required to further determine whether the semantics of the second answer text and the first answer text are consistent. If not, the extractive model is used to process the text to obtain the third answer text, and the third answer text is used as the summary of the first answer text.

[0159] Here, the text analysis module is used to analyze the text type and text length of the first answer text; the query and the first answer text are analyzed by the text analysis module to obtain the type, length and other information of the answer text. By analyzing the query and the first answer text, the main question types can be obtained, which are what (i.e., factual text), why (i.e., cause-type text), and what to do (i.e., method-type text). Through this information, the first answer texts of different text types and text lengths will pass through different summary modules. Through experimental comparison, the following scheme is preferably used: if the factual text is between 200-500 words, the extractive model is used; if the factual text is between 100-300 words, the generative model is used; if the factual text is greater than 1000 words, the comprehensive model is used. Cause-type text and method-type text are generally paragraph texts without line breaks. For these two types of texts and the text length is between 300-1000 words, the extractive model is used.

[0160] The summary module is used to extract the second answer text based on the first answer text, including a generative model, an extractive model and a comprehensive model.

[0161] For the extractive model, the first problem to be faced is the choice of sentence granularity. In this embodiment, commas, periods, semicolons, etc. are selected as sentence segments, so that texts with coherent semantics and short text length can be extracted as much as possible.

[0162] For factual text, the extractive summary model ensures semantic coherence, such as Figure 7As shown in the figure, the Lead-3 algorithm is combined with the TextRank algorithm that uses bm25 as weight and word vector as weight. At the same time, in order to ensure that the key core sentences are not lost, the longest common subsequence matching algorithm is also used to match the similarities between the query and the first answer text, and thus determine the position of the core sentence.

[0163] Here, the relevant algorithms are introduced as follows:

[0164] Lead-3 algorithm selects the first three sentences according to the sentence granularity. The information concentration of factual text is relatively high, and its key information is generally concentrated in the first few fragments of the text, followed by some additional information;

[0165] The TextRank algorithm is a graph-based sorting algorithm for text. It divides the text into several sentences and builds a graph model, and uses a voting mechanism to score the important components of the text. The extraction results of TextRank are relatively scattered, and sentences distributed in various places in the answer text will be extracted;

[0166] The longest common subsequence matching algorithm ensures that the key core sentences are not lost after extraction.

[0167] The main problems faced by the generative model include: less training data, unregistered words appearing during generation, and not being faithful to the original text. At the same time, since the first answer text covers a variety of cultural categories, such as life, technology, etc., the text writing methods of each cultural category are different.

[0168] Therefore, in order to achieve better results in the subdivision of categories, BERT based on the pre-trained model is used as the initialization model. At the same time, in order to address the problem that the BERT model is not suitable for generative tasks, its attention matrix is ​​improved to support generative tasks. In this way, by annotating data of a small number of categories, better summaries can be generated in each category.

[0169] Here, BERT is a pre-trained model based on the bidirectional encoder representation of Transformers, which uses a large amount of corpus for self-supervised pre-training upstream tasks. This allows natural language processing tasks to use some prior corpus and improve the performance of downstream tasks. The original BERT cannot perform generative tasks, and UNILM has modified the mask matrix so that a single BERT model can be used for Seq2Seq tasks.

[0170] like Figure 8 As shown, the usual bidirectional attention adopts Figure 8The splicing method shown on the left in the figure will cause information leakage when using bidirectional attention when generating tasks. Since the real prediction is only the information of "today's weather", the information mask of "sunny day" can be removed to obtain Figure 8 The attention splicing is shown on the right side of the figure. In this way, the attention of the input part is bidirectional, and the attention of the output part is unidirectional, which meets the requirements of Seq2Seq. This is the idea provided by UNILM to complete the Seq2Seq task with a single Bert model. Just add a mask of the above shape without modifying the model architecture, and use the training weights for generative tasks.

[0171] At the same time, in order to solve the problems of unknown words and semantic inconsistency, a sequence tagging model is also used to assist in generating results. Some fragments are copied from the original text to the generated summary (i.e., the second answer text).

[0172] When annotating data, the longest common subsequence is used to calculate the common part of the summary and the original text. Any part that overlaps between the summary and the article is a fragment that needs to be retained. Such fragments are marked with B for the beginning, I for the remaining words, and O for words that do not appear. For example, if the article is a smart question-answer summary and the summary is a question-answer summary, it is marked as OOBIII, and the others are marked as O.

[0173] During the training phase, a sequence prediction task is added, and the copy mechanism of sequence annotation can ensure the fidelity of the summary to the original text and avoid professional errors.

[0174] For comprehensive models, such as Fig. 9 As shown in the figure, it can be applied to factual texts with a text length greater than 1,000 words. This type of answer text is long and the key information is scattered throughout the article. The effect of using either the extractive model or the generative model alone is not good.

[0175] For this kind of problem, we first use the extractive model to get a shorter text (intermediate answer text), such as less than 500 words, and then use the generative model to process the shorter text to get the second answer text. At this time, the model can finally give two results: the intermediate answer text and the second answer text. The semantic matching model is used to match the second answer text generated by the generative model. If the matching degree between the second answer text and the first answer text does not meet the preset conditions, then the intermediate answer text obtained by the extractive model is used as the final result; if the matching degree between the second answer text and the first answer text meets the preset conditions, then the second answer text is used as the final result.

[0176] The verification module is used to verify the matching degree between the second answer text and the first answer text. In order to ensure that the generated second answer text is faithful to the original first answer text, the second answer text is verified by the verification module to ensure the matching degree of the final generated summary. Here, the verification module can be a semantic matching model.

[0177] like Fig.10 As shown, the embodiment of the present application uses the pre-trained model BERT, which only requires a small amount of labeled data to achieve relatively good results on downstream tasks. By using the pre-trained model BERT to splice the generated summary (second answer text) with the original article (first answer text) for machine reasoning tasks, the context information can be obtained, attention can be paid to the original article and the generated sentences, and the context representation can be obtained.

[0178] like Fig.11 As shown, this exemplary embodiment also provides a summary extraction device 10 for answer text, comprising:

[0179] An acquisition module 110 is used to acquire a first answer text of a first text length;

[0180] A model determination module 120, configured to determine a target model from a plurality of candidate models 140 according to a text type and / or a first text length of the first answer text;

[0181] The processing module 130 is used to process the first answer text using the target model to obtain a second answer text of a second text length, wherein the second text length is shorter than the first text length, and the second answer text has the same main meaning as the first answer text.

[0182] In some possible implementations, such as Fig.12 As shown, the candidate model 140 includes at least one of the following:

[0183] A generative model 1401, used to generate the second answer text based on the content of the first answer text;

[0184] The extractive model 1402 extracts at least one keyword and / or key sentence existing in the first answer text to form the second answer text;

[0185] The comprehensive model 1403 includes the extractive model and the generative model which are arranged successively, and is used to form the second answer text after the first answer text is processed by the extractive model and the generative model in sequence.

[0186] In some possible implementations, such as Fig.13 As shown, the generative model 1401 includes:

[0187] The processing unit 14011 is used to perform word segmentation processing on the first answer text to determine the word segmentation position in the first answer text;

[0188] Insert separator unit 14012, used for inserting a predetermined separator at the word segmentation position in the first answer text;

[0189] The generating unit 14013 is used to input the first answer text with the separator inserted into the generative model to obtain the second answer text.

[0190] In some possible implementations, the generative model 1401 is a language model of a bidirectional encoder BERT based on Transformers.

[0191] In some possible implementations, such as Fig.14 As shown, the extractive model 1402 includes:

[0192] A selection unit 14021, configured to split the first answer text into N sentences, and select M sentences from the N sentences, wherein M is not greater than N;

[0193] A candidate keyword determining unit 14022, configured to determine candidate keywords for the M sentences;

[0194] A sorting unit 14023, used to sort the candidate keywords by importance;

[0195] A selection unit 14024, configured to select a preset number of candidate keywords with high importance as keywords;

[0196] Conjunction unit 14025 is used to form the second answer text based on the keywords.

[0197] This exemplary embodiment further provides an electronic device, which includes the device described in any one of the above embodiments.

[0198] This exemplary embodiment also provides a computer-readable storage medium storing executable instructions for causing a processor to execute the instructions to implement the method described in any of the above embodiments.

[0199] The computer-readable storage medium may be a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other storage media that can store program codes, and may be a non-transient storage medium.

[0200] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0201] In an exemplary embodiment, each module / unit in the device can be implemented by one or more central processing units (CPU), graphics processing units (GPU), baseband processors (BP), application-specific integrated circuits (ASIC), DSPs, programmable logic devices (PLD), complex programmable logic devices (CPLD), field programmable gate arrays (FPGA), general-purpose processors, controllers, microcontrollers (MCU), microprocessors, or other electronic components to execute the aforementioned method.

[0202] Fig.15 800 is a block diagram of an electronic device according to an exemplary embodiment. For example, the device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0203] Reference Fig.15 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0204] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0205] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0206] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0207] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0208] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0209] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0210] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0211] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0212] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0213] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0214] Those skilled in the art will readily appreciate other embodiments of the disclosed embodiments after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosed embodiments, which follow the general principles of the disclosed embodiments and include common knowledge or customary technical means in the art that are not disclosed in the disclosed embodiments. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the disclosed embodiments are indicated by the following claims.

[0215] It should be understood that the embodiments of the present disclosure are not limited to the precise structures described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the embodiments of the present disclosure is limited only by the appended claims.

Claims

1. A method for extracting a summary of an answer text, characterized in that: include: Obtaining the first answer text from the question and answer database based on the input question information; According to the text type and first text length of the first answer text, a target model is determined from a plurality of candidate models, including at least one of the following: if the text type of the first answer text is the first text type and the first text length is within a first interval range, the target model is determined to be a generative model; if the first answer text is the first text type and the first text length is within a second interval range, the target model is determined to be an extractive model; if the first answer text is the first text type and the first text length is within a third interval range, the target model is determined to be a comprehensive model; wherein the minimum value of the second interval range is greater than or equal to the maximum value of the first interval range, and the minimum value of the third interval range is greater than or equal to the maximum value of the second interval range; the first text type is a factual text or a cause type; When the target model is the comprehensive model, the extractive model in the comprehensive model is used to extract text from the first answer text to obtain an intermediate answer text, and the generative model in the comprehensive model is used to process the intermediate answer text to obtain a second answer text; when the matching degree between the second answer text and the first answer text meets a preset condition, the second answer text is determined to be a summary of the first answer text, otherwise, the intermediate answer text is determined to be a summary of the first answer text; the second text length of the second answer text is shorter than the first text length of the first answer text, and the second answer text has the same main meaning as the first answer text.

2. The method for extracting a summary of an answer text according to claim 1, characterized in that: The alternative models include one of the following: A generative model, for generating the second answer text based on the content of the first answer text; The extractive model extracts at least one keyword and / or key sentence already existing in the first answer text to form the second answer text; A comprehensive model, wherein the comprehensive model includes the extractive model and the generative model.

3. The method for extracting a summary of an answer text according to claim 2, characterized in that: The step of determining a target model from a plurality of candidate models according to the text type and / or the first text length of the first answer text further includes: If the first answer text is of the second text type or the third text type, and the first text length is within the fourth region, the target model is determined to be the extractive model.

4. The method for extracting a summary of an answer text according to claim 2, characterized in that: The method comprises: When the target model is the generative model, performing word segmentation processing on the first answer text to determine the word segmentation position in the first answer text; Inserting a predetermined separator at the word segmentation position in the first answer text; The first answer text with the separator inserted is input into the generative model to obtain the second answer text.

5. The method for extracting a summary of an answer text according to claim 4, characterized in that: The generative model is a language model based on the Transformers bidirectional encoder BERT.

6. The method for extracting a summary of an answer text according to claim 2, characterized in that: The method comprises: When the target model is the extractive model, splitting the first answer text into N sentences, and selecting M sentences from the N sentences, where M is not greater than N; Determining candidate keywords for the M sentences; Sorting the candidate keywords by importance; Select a preset number of candidate keywords with high importance as keywords; Based on the keywords, the second answer text is formed.

7. A device for extracting a summary of an answer text, characterized in that: include: An acquisition module, used to acquire a first answer text from a question-answer library based on input question information; A model determination module, used to determine a target model from a plurality of candidate models according to a text type and a first text length of the first answer text; the model determination module is specifically used to determine that the target model is a generative model if the text type of the first answer text is a first text type and the first text length is within a first interval; to determine that the target model is an extractive model if the first answer text is a first text type and the first text length is within a second interval; to determine that the target model is a comprehensive model if the first answer text is a first text type and the first text length is within a third interval; wherein the minimum value of the second interval is greater than or equal to the maximum value of the first interval, and the minimum value of the third interval is greater than or equal to the maximum value of the second interval; the first text type is a factual text or a cause type; A processing module, used for, when the target model is the comprehensive model, using the extractive model in the comprehensive model to extract text from the first answer text to obtain an intermediate answer text, and using the generative model in the comprehensive model to process the intermediate answer text to obtain a second answer text; when the matching degree between the second answer text and the first answer text meets a preset condition, determining that the second answer text is a summary of the first answer text, otherwise, determining that the intermediate answer text is a summary of the first answer text; the second text length of the second answer text is shorter than the first text length of the first answer text, and the second answer text has the same main meaning as the first answer text.

8. The device for extracting a summary of an answer text according to claim 7, characterized in that: The alternative models include one of the following: A generative model, for generating the second answer text based on the content of the first answer text; The extractive model extracts at least one keyword and / or key sentence already existing in the first answer text to form the second answer text; A comprehensive model, wherein the comprehensive model includes the extractive model and the generative model.

9. The device for extracting a summary of an answer text according to claim 8, characterized in that: The generative model comprises: A processing unit, configured to perform word segmentation processing on the first answer text and determine word segmentation positions in the first answer text; A separator inserting unit, used for inserting a predetermined separator at the word segmentation position in the first answer text; A generating unit is used to input the first answer text with the separator inserted into the generating model to obtain the second answer text.

10. The answer text summary extraction device according to claim 8, characterized in that: The generative model is a language model based on the Transformers bidirectional encoder BERT.

11. The device for extracting a summary of an answer text according to claim 9, characterized in that: The extractive model comprises: A selection unit, used for splitting the first answer text into N sentences, and selecting M sentences from the N sentences, wherein M is not greater than N; A candidate keyword determination unit, used to determine candidate keywords of the M sentences; A sorting unit, used to sort the candidate keywords by importance; A selection unit, used to select a preset number of candidate keywords with high importance as keywords; The conjunction unit is used to form the second answer text based on the keyword.

12. An electronic device, characterized in that: The electronic device comprises the device according to any one of claims 7 to 11.

13. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to cause a processor to execute and implement the method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Abstract generation method and apparatus, and computer device

    CN108280112A

  • Method and system for selecting answers to non-factual questions and answers based on text abstracts

    CN108681574A

  • Abstract generation method and device

    CN109960790A

  • Text abstract generation method and device, text abstract training method and device, equipment and medium

    CN111026861A

  • Emergency management objective question automatic generation system based on deep learning

    CN111783428A