Question answering method and related device, electronic device and storage medium

By combining the answer prediction model of the question text and common sense text, the problems of deep mining and small sample data in intelligent question answering are solved, and the accuracy and stability of question answers are improved.

CN114357107BActive Publication Date: 2025-09-12HEFEI IFLY DIGITAL TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111389113.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-22
Publication Date
2025-09-12
Estimated Expiration
2041-11-22

AI Technical Summary

Technical Problem

Existing intelligent question-answering network models are unable to deeply explore underlying meanings, resulting in insufficient reliability and accuracy in answering questions, especially in niche areas where sample data is scarce.

Method used

By obtaining the question text to be answered and common sense text, the answer prediction model is used to predict the answer. During the training process, characters in the sample text data are selected for masking, and the answer prediction is combined with the semantic information of the common sense text to improve the question-answering reasoning ability and data diversity.

Benefits of technology

It improves the accuracy and stability of question answers, alleviates the limitations of small sample data, and achieves more accurate and stable question answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114357107B_ABST
    Figure CN114357107B_ABST
Patent Text Reader

Abstract

This application discloses a question answering method and related devices, electronic devices, and storage media. The question answering method includes: obtaining a question text to be answered and common sense text related to the question to be answered; predicting the answer to the question text and the common sense text based on an answer prediction model to obtain an answer text for the question text to be answered; wherein the answer prediction model is trained using several sets of sample text data, and when training the answer prediction model based on the sample text data, at least one sample character is selected from the sample text data for masking. The above scheme can accurately and stably answer questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent question answering technology, and in particular to a question answering method and related devices, electronic devices and storage media. Background Art

[0002] With the rapid development of technologies like natural language processing, intelligent question answering through robots has been applied in an increasing number of scenarios. For example, in e-commerce, smart government affairs, voice assistants, and many other scenarios, intelligent question answering can provide intelligent and efficient self-service.

[0003] Currently, existing network models for intelligent question answering typically only perform superficial recognition and are unable to deeply explore underlying meaning, making it difficult to ensure the reliability of answering questions. Furthermore, the performance of network models often relies on a large amount of sample data. However, in certain niche fields, sample data is often scarce, making it difficult to ensure the accuracy of network models. Therefore, how to achieve accurate and stable question answering has become an urgent problem to be solved. Summary of the Invention

[0004] The main technical problem solved by this application is to provide a question answering method and related devices, electronic devices and storage media, which can accurately and stably answer questions.

[0005] In order to solve the above technical problems, the first aspect of the present application provides a question answering method, including: obtaining the text of the question to be answered and the common sense text related to the question to be answered; predicting the answer to the text of the question to be answered and the common sense text based on an answer prediction model to obtain the answer text of the question to be answered; wherein the answer prediction model is trained using several groups of sample text data, and when training the answer prediction model based on the sample text data, at least one sample character is selected in the sample text data for masking.

[0006] In order to solve the above technical problems, the second aspect of the present application provides a body question answering device, including: a text acquisition module and an answer prediction module, the text acquisition module is used to obtain the text of the question to be answered and the common sense text related to the question to be answered; the answer prediction module is used to predict the answer to the text of the question to be answered and the common sense text based on an answer prediction model, and obtain the answer text of the question to be answered; wherein, the answer prediction model is trained using several groups of sample text data, and when training the answer prediction model based on the sample text data, at least one sample character is selected in the sample text data for masking.

[0007] In order to solve the above technical problems, the third aspect of the present application provides an electronic device, including a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the question answering method in the above first aspect.

[0008] In order to solve the above technical problems, the fourth aspect of the present application provides a computer-readable storage medium storing program instructions that can be executed by a processor, and the program instructions are used to implement the question answering method in the above first aspect.

[0009] The above scheme obtains the question text to be answered and the common sense text involved in the question text to be answered, and predicts the answer to the question text to be answered and the common sense text based on the answer prediction model to obtain the answer text of the question text to be answered, and the answer prediction model is obtained by training with several groups of sample text data. When training the answer prediction model based on the sample text data, at least one sample character is selected in the sample text for shielding. On the one hand, in the answer prediction process, not only the question text to be answered itself is referenced, but also the common sense text involved is further referenced, so that not only the semantic information of the question text to be answered itself can be referenced, but also the semantic information of the common sense text designed by it can be referenced. Combining the semantic information of the two can deeply mine key elements such as context information, environmental information, and background information of different dimensions, which is conducive to improving the question-answering reasoning ability and thus improving the stability of question answering. On the other hand, selecting at least one sample character in the sample text data for shielding during the training process can improve data diversity, thereby alleviating the limitations of small sample data, and thus helping to improve the accuracy of the network model. Therefore, question answering can be achieved accurately and stably. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 It is a flowchart of an embodiment of the method for answering questions of this application;

[0011] Figure 2 It is a schematic diagram of a framework of an embodiment of an answer prediction model;

[0012] Figure 3 is a schematic diagram of an embodiment of sample text data;

[0013] Figure 4 It is a flowchart of another embodiment of the question answering method of the present application;

[0014] Figure 5 It is a schematic diagram of the process of constructing an inquiry text embodiment;

[0015] Figure 6 It is a schematic diagram of the framework of an embodiment of the question answering method of the present application;

[0016] Figure 7This is a schematic diagram of the framework of an embodiment of the question answering device of the present application;

[0017] Figure 8 This is a schematic diagram of the framework of an embodiment of the electronic device of the present application;

[0018] Figure 9 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0019] The following describes the embodiments of the present application in detail with reference to the accompanying drawings.

[0020] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0021] The terms "system" and "network" are often used interchangeably in this document. The term "and / or" is simply a description of an association between related objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " generally indicates that the related objects are in an "or" relationship. Furthermore, "multiple" in this document means two or more than two.

[0022] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of the question answering method of this application. Specifically, it may include the following steps:

[0023] Step S11: Obtain the text of the question to be answered and the common sense text related to the question to be answered.

[0024] In one implementation scenario, the question text to be answered can be specifically configured based on the actual application scenario. For example, in an e-commerce scenario, the question text to be answered may include, but is not limited to, "Can I return the item I bought a few days ago if it's broken?" or "Do you offer free shipping?" Other scenarios are similar and will not be listed here.

[0025] In one implementation scenario, the user may input the question to be answered in text form, or the user may ask the question in voice form, thereby obtaining the question to be answered by performing voice recognition on the user's voice, which is not limited here.

[0026] In one implementation scenario, it should be noted that common sense is the universal knowledge everyone possesses about the attributes, relationships, and interactions between objects. Common sense is typically independent of location, language, and culture, and is rarely explicitly described in text. It includes, but is not limited to, subconscious prior knowledge (background knowledge), including survival skills (self-care skills), environmental awareness, basic labor skills, and basic knowledge of the natural sciences and humanities and social sciences. Common sense can include single concepts, facts, knowledge, and triples of facts and principles. Furthermore, the common sense involved in different application scenarios varies. To facilitate the acquisition of common sense text during the application process, a common sense library for the domain scenario can be pre-built. For example, domain common sense data (e.g., e-commerce data, smart government data, etc.) can be collected. Structured data (e.g., triples) within the domain common sense data can be first regularized, while unstructured data (e.g., sentences, paragraphs, articles, etc.) can be structured using knowledge extraction technologies such as CASREL. Finally, all knowledge sources can be integrated to establish a common sense library. For example, we can integrate all sources of knowledge, first establish a common sense concept system, and then fill the triples from various sources into the common sense concept system to form a common sense library.

[0027] In one implementation scenario, the common sense text involved in the question text to be answered can include time information, background information, expert knowledge, and so on, without limitation here. For example, in an e-commerce store, for time information, general goods can support a seven-day no-questions-asked return policy, while fresh goods currently do not support returns. Alternatively, for background information, a manufacturer recently issued a recall notice due to a design defect in a certain product. Alternatively, for expert knowledge, relevant laws and regulations stipulate that "if the goods or services provided by the operator do not meet quality requirements, the consumer may return the goods in accordance with national regulations or the parties' agreement, or request the operator to fulfill its obligations such as replacement or repair." Other scenarios can be analogized in this way, and I will not provide examples one by one here.

[0028] In one implementation scenario, the question text to be answered can first be semantically understood, and then, based on the semantic understanding results, the common sense text related to the question text to be answered can be obtained from the common sense database. Taking the aforementioned question text to be answered, "I bought something a few days ago and it's broken. Can I return it?" as an example, semantic understanding can be used to obtain the semantic understanding results of the question text to be answered. Analysis reveals that its intention is related to product returns. Therefore, common sense text related to product returns can be obtained from the common sense database, such as the aforementioned "General products can support seven-day no-reason returns," "Fresh products are not currently supported for returns," "Recently, a manufacturer issued a recall notice due to a design defect in a certain product," and the specific provisions of relevant laws and regulations. Other situations can be deduced in this way, and no examples are given here.

[0029] Step S12: predicting the answer to the question text and the common sense text based on the answer prediction model to obtain the answer text of the question text.

[0030] In the disclosed embodiments, the answer prediction model is trained using several sets of sample text data. When training the answer prediction model based on the sample text data, at least one sample character in the sample text data is selected for masking. Specifically, the answer prediction model may include, but is not limited to, UniLM, and the network structure of the answer prediction model is not limited herein.

[0031] In one implementation scenario, each set of sample text data can include sample question text, sample common sense text related to the sample question text, and sample answer text for the sample question text. Taking the e-commerce mall scenario as an example, the sample text data can include the sample question text "What should I do if the XX brand kettle I just bought yesterday suddenly breaks today?", the sample common sense text related to it, "The mall supports seven-day no-questions-asked returns" and "XX manufacturer today issued a recall announcement for kettles," and the sample answer text, "You can choose to return the product, and the mall will refund you within X days." It should be noted that the sample common sense text "The mall supports seven-day no-questions-asked returns" involves time information, while the sample common sense text "XX manufacturer today issued a recall announcement for kettles" involves context information. Other scenarios can be analogized similarly, and examples are not given here one by one. In the above scheme, each set of sample text data includes sample question text, sample common sense text related to the sample question text, and sample answer text for the sample question text. This allows common sense information to be incorporated into the training process, allowing the network model to focus on both question information and common sense information, helping the network model better understand the question intent and generate factually accurate answers based on common sense information, thereby improving the accuracy and stability of question-answering.

[0032] In one implementation scenario, a preset proportion of sample characters may be randomly selected from the sample text data for masking. For example, the preset proportion may include but is not limited to: 5%, 10%, 20%, etc., which is not limited here.

[0033] In one implementation scenario, during the training process, an embedded feature representation of sample characters in the sample text data can be obtained, and the masked sample characters in the sample text data are represented by preset characters. The sample characters are then encoded based on the embedded feature representation to obtain a semantic feature representation of the sample characters. On this basis, a prediction can be made based on the semantic feature representation of the sample characters to obtain a predicted answer text, and the network parameters of the answer prediction model are adjusted based on the difference between the sample answer text and the predicted answer text. In the above method, during the training process, the sample answer text is used to supervise the training of the answer prediction model by performing the steps of embedding, encoding, prediction, and parameter adjustment, so that the predicted answer text output by the model can continuously approach the sample answer text during the iterative training process, thereby enabling the network model to deeply mine the semantic information of the sample question text itself, and at the same time deeply mine the semantic information of the sample common sense text, thereby improving the model performance of the network model.

[0034] In a specific implementation scenario, the answer prediction model may include an input layer, an embedding layer, an encoding layer, and a prediction layer. The input layer is used to input sample common sense text, sample question text, and sample answer text. The embedding layer is used to obtain embedded feature representations. The encoding layer is used to encode semantic feature representations. The prediction layer is used to predict the predicted answer text. Taking the answer prediction model as UniLM as an example, please refer to Figure 2 , Figure 2 Schematic diagram of the framework of an embodiment of the answer prediction model. Figure 2 As shown, the sample text data can be segmented at the input layer to obtain individual sample characters. Specifically, you can use wordpiece and other word segmentation tools to process tokens into subwords, such as dividing "looking" into subwords "look" and "ing". Other cases can be deduced by analogy, and no examples are given here. Please refer to Figure 3 , Figure 3 Schematic diagram of an embodiment of sample text data. Figure 3 As shown in the figure, the sample text data is organized into a set of data in the form of "sample common sense text", "sample question text" and "sample answer text", and is input into the answer prediction model. Still taking the above-mentioned e-commerce scenario as an example, the sample text data can be Figure 3The data is organized and input as shown. Other scenarios can be deduced by analogy, so we will not give examples one by one here. In addition, in order to distinguish different texts, [SOS] can be added in front of the sample common sense text to indicate the beginning of the text, and [EOS] can be added after the sample question text to indicate the end of segment 1, and [EOS] can be added after the sample answer text to indicate the end of segment 2. Furthermore, in the embedding layer, the character embedding representation (i.e. token embedding), position embedding representation (i.e. position embedding) and paragraph embedding representation (i.e. segment embedding) of each sample character can be obtained. For each sample character, the above three embedding representations can be added together to obtain the embedding feature representation of the sample character. The specific meanings of the above three embedding representations can be found in the relevant technical details of pre-trained language models such as UniLM, which will not be repeated here. Furthermore, as Figure 2 As shown, the encoding layer may include multiple layers of Transformer, and each Transformer may be composed of a multi-head self-attention mechanism. For example, the multi-head self-attention mechanism can be expressed as:

[0035]

[0036] In the above formula (1), M∈R |x|×|x| This indicates whether each sample character can be referenced by other sample characters. For more details, please refer to the relevant technical details of the multi-head self-attention mechanism, which will not be repeated here. After encoding by the encoding layer, the prediction layer can predict each character one by one. When the predicted character [EOS] or other character representing the end of the representation is obtained, the prediction is considered complete, and the predicted characters can be combined to form the predicted answer text.

[0037] In a specific implementation scenario, the preset character can be set to [mask], etc., which is not limited here. Figure 2 , a preset proportion (e.g., 10%, 20%) of sample characters (e.g., Figure 2 The sample characters filled with diagonal hatching represent masked sample characters. For example, if the sample text data is organized as [SOS]x1x2x3x4[EOS]x5x6x7x8[EOS] at the input layer, x1x2x3x4 represents sample common sense text and sample question text, and x5x6x7x8 represents sample answer text, then we can randomly select and mask the two sample characters x3 and x7. In this case, the sample text data becomes: [SOS]x1x2[mask1]x4[EOS]x5x6[mask2]x8[EOS]. Other cases can be deduced in this way, and we will not give examples one by one here.

[0038] In a specific implementation scenario, when the preset character belongs to a sample question text or a sample common sense text, that is, when the preset character is located in segment 1, the semantic feature representation of the preset character can be obtained based on the first reference character encoding, and the first reference character includes: all sample characters in the sample question text and the sample common sense text. For example, for the aforementioned [mask1], the first reference character can include x1x2x4 and itself, and other cases can be deduced by analogy, and no further examples are given here. In the above manner, when the preset character belongs to a sample question text or a sample common sense text, the semantic feature representation of the preset character is obtained based on the first reference character encoding, and the first reference character includes: all sample characters in the sample question text and the sample common sense text, which can fully combine the semantic information of the sample common sense text and the sample question text during the training process, so that the network model can deeply explore the deep meaning of the two and enhance the reasoning ability of the network model combined with common sense.

[0039] In a specific implementation scenario, when the preset character belongs to the sample answer text, that is, when the preset character is located in segment 2, the semantic feature representation of the preset character is obtained based on the second reference character encoding, and the second reference character includes: the preset character itself, all sample characters in the sample question text and the sample common sense text, and all sample characters in the sample answer text that are located before the preset character. For example, for the aforementioned [mask2], the second reference character may include x1x2[mask1]x4, x5x6 and itself, and other cases can be deduced by analogy, and examples are not given one by one here. In the above method, when the preset character belongs to the sample answer text, the semantic feature representation of the preset character is obtained based on the second reference character encoding, and the second reference character includes: the preset character itself, all sample characters in the sample question text and the sample common sense text, and all sample characters in the sample answer text that are located before the preset character. It is possible to implicitly learn the causal relationship between the sample answer text and the sample common sense text and the sample question text during the training process, thereby improving the ability of the network model to reason based on common sense and problems.

[0040] In a specific implementation scenario, as described above, the prediction layer can perform character-by-character prediction. In this case, the predicted probability values ​​of each sample character in the sample answer text can be obtained by comparing them with the sample answer text. These predicted probability values ​​are processed using a loss function such as cross-entropy to obtain the loss value of the answer prediction model. The network parameters of the answer prediction model are then adjusted using an optimization method such as gradient descent. It should be noted that the specific loss calculation process can be referenced in the technical details of loss functions such as cross-entropy, and the specific parameter adjustment process can be referenced in the technical details of optimization methods such as gradient descent, which will not be further elaborated here.

[0041] In one implementation scenario, Figure 2 Shown and Figure 3 As shown, the common sense text and the question text to be answered are organized and input into the answer prediction model. The answer prediction model can predict the answer text of the question text to be answered. The specific processing process can be referred to the description related to model training above, which will not be repeated here.

[0042] In one implementation scenario, to quickly answer similar questions later, after obtaining the answer text, the question text and the answer text can be combined into a question-answer pair and incorporated into the standard question-answer database. Later, when answering similar questions, a semantic search can be performed within the standard question-answer database. If a standard question text with high semantic similarity is found, the standard answer text for that standard question text can be directly used as the answer text, without requiring a network model to predict the answer. For example, after including "The XX brand kettle I just bought yesterday suddenly broke today, what should I do?" and "You can choose to return it, and the mall will refund you within X days" as the standard question text and standard answer text as a question-answer pair in the standard question-answer database, if the question text to be answered is "The XX brand kettle I bought just two days ago no longer boils water," you can search the standard question database for a standard question text with similar semantics, "The XX brand kettle I just bought yesterday suddenly broke today, what should I do?" In this case, the standard answer text "You can choose to return it, and the mall will refund you within X days" to the standard question text "The XX brand kettle I just bought yesterday suddenly broke today, what should I do?" can be directly used as the answer text to the question text to be answered. In addition, in actual applications, the question text to be answered and the answer text predicted by the answer prediction model can be continuously added to the standard question-answer database as a question-answer pair.

[0043] The above scheme obtains the question text to be answered and the common sense text involved in the question text to be answered, and predicts the answer to the question text to be answered and the common sense text based on the answer prediction model to obtain the answer text of the question text to be answered, and the answer prediction model is obtained by training with several groups of sample text data. When training the answer prediction model based on the sample text data, at least one sample character is selected in the sample text for shielding. On the one hand, in the answer prediction process, not only the question text to be answered itself is referenced, but also the common sense text involved is further referenced, so that not only the semantic information of the question text to be answered itself can be referenced, but also the semantic information of the common sense text designed by it can be referenced. Combining the semantic information of the two can deeply mine key elements such as context information, environmental information, and background information of different dimensions, which is conducive to improving the question-answering reasoning ability and thus improving the stability of question answering. On the other hand, selecting at least one sample character in the sample text data for shielding during the training process can improve data diversity, thereby alleviating the limitations of small sample data, and thus helping to improve the accuracy of the network model. Therefore, question answering can be achieved accurately and stably.

[0044] See also Figure 4 , Figure 4 This is a flow chart of another embodiment of the question answering method of the present application. Specifically, it may include the following steps:

[0045] Step S41: Obtain the text of the question to be answered and the common sense text related to the question to be answered.

[0046] For details, please refer to the aforementioned disclosed embodiments, which will not be described again here.

[0047] Step S42: In response to the existence of entity texts whose entity meanings meet the first condition in the question text to be answered, query texts about the entity texts are sequentially constructed based on the importance levels of the respective entity texts.

[0048] In one implementation scenario, the first condition includes that the entity text has no corresponding entity meaning in the common sense database. That is, the relationship extraction can be performed on the question text to be answered to extract triples, and then combined with the common sense database to determine whether there are entity texts with unclear entity meanings. If so, it is necessary to construct query texts about these entity texts to interact with the user and guide the user to enrich and improve the relevant information. Please refer to Figure 5 , Figure 5 Schematic diagram of the process of constructing an inquiry text embodiment. Figure 5As shown, taking the aforementioned question text "I bought something a few days ago and it's broken. Can I return it?" as an example, the entity texts "a few days ago," "thing," "breakdown," and "return" can be found. By searching the common sense database, the meaning of the entity text "return" can be determined. However, no entity meanings can be found for the other entity texts "a few days ago," "thing," and "breakdown." By setting the first condition to include the entity text where no corresponding entity meaning is found in the common sense database, the above approach can construct a query text for problems where the entity text has unclear meaning, guiding the user to clarify its specific meaning. This helps to enhance the clarity of the meaning of the question text and improve the accuracy of subsequent answer predictions.

[0049] In an implementation scenario, the importance levels of different entity categories can be predefined. Taking the e-commerce mall scenario as an example, the importance levels from low to high can be: time, item, reason, etc. Other scenarios can be deduced in this way, and no examples are given here. In addition, in the aforementioned relationship extraction process, the entity category of each entity text can also be identified. For example, it can be identified that the entity category of the entity text "a few days ago" is "time", the entity category of the entity text "things" is "items", and the entity category of the entity text "fault" is "reason". Therefore, the query text can be constructed for the entity texts "a few days ago", "things", and "fault" in turn. Please refer to Figure 5 For the entity text "a few days ago," we can construct the query text "When did you buy it?" and through interaction with the user, we can obtain the user's answer text "Yesterday." Then, for the entity text "things," we can construct the query text "What product did you buy from our store?" and through interaction with the user, we can obtain the user's answer text "XX brand kettle." Finally, for the entity text "fault," we can construct the query text "What is the specific fault?" and through interaction with the user, we can obtain the user's answer text "The water cannot be boiled." Other cases can be analogized in this way and are not listed here.

[0050] Step S43: Obtain the answer text of the user in response to each inquiry text, and replace the entity text in the question text to be answered with the answer text.

[0051] In one implementation scenario, after obtaining the answer text for each ambiguous entity text, the entity text in the question text to be answered can be replaced with the corresponding answer text. For example, using the question text to be answered, "Can I return the item I bought a few days ago if it's broken?" after replacement, the question text to be answered becomes "Can I return the XX brand kettle I bought yesterday if it doesn't boil water?" Other scenarios can be analogized and are not listed here.

[0052] In one implementation scenario, in order to further improve the accuracy of subsequent answer predictions, before replacing the unclear entity text in the question text with the corresponding answer text, you can also query the standard text with the same semantics as the answer text based on the common sense library, and replace the entity text in the question text with the standard text. Still taking the aforementioned question text to be answered "The item I bought a few days ago broke down. Can I return it?" as an example, you can query the common sense library for standard texts with the same semantics for each of the above answer texts "yesterday", "XX brand kettle", and "cannot boil water". After querying the first two, no standard text is found. You can query the standard text of "cannot boil water" "cannot boil". Then, after the replacement, the question text to be answered can be updated to "The XX brand kettle I bought yesterday cannot boil. Can I return it?" Other situations can be deduced by analogy, and no examples are given here one by one. The above method, before replacing the entity text with unclear meaning in the question text to be answered with the corresponding answer text, queries the standard text with the same semantics as the answer text based on the common sense library, and replaces the entity text in the question text to be answered with the standard text. It can realize attribute linking in combination with the common sense library, convert the answer text into more standardized terms, and automatically complete event abstraction and generalization.

[0053] Step S44: predicting the answer to the question text and the common sense text based on the answer prediction model to obtain the answer text to the question text.

[0054] In the disclosed embodiment, the answer prediction model is trained using several groups of sample text data, and when training the answer prediction model based on the sample text data, at least one sample character is selected from the sample text data for masking. For details, please refer to the relevant description in the aforementioned disclosed embodiment, which will not be repeated here.

[0055] In an implementation scenario, after the above-mentioned generalization operation, the answer prediction model can be used to predict the answer to the question text and the common sense text to obtain the answer text of the question text to be answered. At the same time, based on the generalized event relationship statistics, the statistical proportion of subsequent dynamics and result events can be used as the predicted probability, thereby achieving its purpose judgment and improving the accuracy of intention recognition. For example, still taking the aforementioned question text to be answered "Can I return the item I bought a few days ago that broke down?" as an example, after the generalization operation, the question text to be answered can be updated to "Can I return the XX brand kettle I bought yesterday that can't boil?" Based on the generalized event relationship statistics, the subsequent dynamics and result events may include but are not limited to "the user insists on returning the product", "the user wants a warranty", etc., and the probability of occurrence of each is obtained through historical statistics as the predicted probability, and for dynamics or events whose predicted probabilities meet certain conditions (such as higher than the preset value), the corresponding suggestion text is obtained in combination with historical statistics, and fed back to the user in combination with the answer text. Please refer to Figure 5Historical statistics show that subsequent dynamics or events such as "user insists on returning the product" and "user desires a warranty" are both highly likely. Since the answer text already indicates the decision for "user insists on returning the product," we can use historical statistics to obtain the suggested text for "user desires a warranty," which reads, "If you need a warranty, you can contact the manufacturer yourself or entrust our store to do so." The final decision text is, "You can choose to return the product, and the mall will issue a refund within X days. If you need a warranty, you can contact the manufacturer yourself or entrust our store to do so." Other situations can be deduced in this way, and we won't provide examples here.

[0056] In an implementation scenario, during the actual application process, it may also happen that there is no entity text in the question text to be answered whose entity meaning meets the first condition. At this time, you can first try to search the standard question and answer library for a standard question text whose semantic similarity with the question text to be answered meets the second condition. If it can be found, the standard answer text of the standard question text can be directly used as the answer text. Otherwise, if it cannot be found, the above-mentioned step of predicting the answer for the question text to be answered and the common sense text based on the answer prediction model can be performed to obtain the answer text of the question text to be answered. In the above method, when there is no entity text in the question text to be answered whose entity meaning meets the first condition, the standard question and answer library is first searched. If a standard question text whose semantic similarity with the question text to be answered meets the second condition can be found, the standard answer text of the standard question text can be directly used as the answer text. Otherwise, if it cannot be found, the answer prediction model is used to predict the answer, so that the efficiency of question answering can be improved as much as possible.

[0057] In a specific implementation scenario, during the actual application process, a standard question and answer library can be pre-built, which can be obtained by collecting historical question and answer data. Taking the e-commerce scenario as an example, several rounds of human-computer dialogues can be collected in advance, and data screening, data cleaning and other operations can be performed to obtain several question and answer pairs, which are included in the standard question and answer library. In addition, it should be noted that in the actual application process, the question text to be answered and the answer text can also be included in the standard question and answer library as a question and answer pair to expand the standard question and answer library. For details, please refer to the relevant description in the aforementioned public embodiment, which will not be repeated here.

[0058] In a specific implementation scenario, the second condition may include the highest semantic similarity being higher than a preset threshold. Specifically, the standard question texts may be sorted in descending order of semantic similarity, and the semantic similarity corresponding to the first standard question text may be checked to see if it is higher than the preset threshold. If so, the standard answer text of the standard question text may be used as the answer text to the question to be answered.

[0059] In an implementation scenario, please refer to Figure 6 , Figure 6 This is a schematic diagram of the framework of an embodiment of the question answering method of this application. Figure 6 As shown in the figure, in actual application, it is necessary to first collect relevant domain data in the offline stage, and perform knowledge regularization (i.e., triple regularization) on the structured domain data, and knowledge extraction (i.e., triple extraction) on the unstructured domain data. The two are combined to construct a knowledge concept tree. Through the knowledge concept tree, rule template construction, semantic model training, and knowledge graph construction can be carried out. In addition, in the offline stage, a knowledge management platform (such as the aforementioned standard question-answering library) can be built in combination with the knowledge graph. On this basis, the answer prediction of the question text to be answered can be realized in the online stage. For example, the semantic understanding of the question text to be answered can be carried out by combining the aforementioned rule template and semantic model through information extraction, intention recognition and other related technologies, and then the common sense text involved in the question text to be answered can be extracted from the common sense library to enhance the accuracy of subsequent knowledge reasoning through common sense information. Furthermore, the common sense library can be combined to discover the entity text with unclear meaning in the question text to be answered, and the entity meaning can be gradually clarified through multiple rounds of conversation. In addition, the knowledge concept tree can be combined with technologies such as entity linking and attribute linking to implement generalization operations, and finally the answer text can be output through the answer prediction model. In addition, in order to expand the knowledge management platform, the standard question and answer library can also be searched for standard question texts whose semantic similarity with the question text to be answered (for example, the semantic similarity is higher than a preset threshold) meets the preset conditions. If no standard question text is retrieved, it can be considered that there is no standard question text in the standard question and answer library that is semantically similar to the question text to be answered. Therefore, the question text to be answered and the answer text can be taken as a question and answer pair and included in the standard question and answer library for supplementation.

[0060] In the above scheme, when there is entity text whose entity meaning meets the first condition in the question text to be answered, based on the importance level of each entity text, query text about the entity text is constructed in sequence, and the answer text of the user to each query text is obtained, and the entity text in the question text to be answered is replaced with the answer text. On this basis, the answer prediction model is used to predict the answer for the question text to be answered and the common sense text to obtain the answer text of the question text to be answered. That is, before using the network model to predict the answer, it is possible to actively interact with the user and induce the user to supplement and complete the question-related information to assist the network model in answer reasoning and decision-making, which is conducive to further improving the accuracy and stability of the question answering.

[0061] See also Figure 7 , Figure 7Schematic diagram of the framework of an embodiment of a question-answering device 70 of the present application. Question-answering device 70 comprises: a text acquisition module 71 and an answer prediction module 72. Text acquisition module 71 is configured to acquire the text of the question to be answered and the common sense text related to the question to be answered; answer prediction module 72 is configured to predict the answer to the question to be answered and the common sense text based on an answer prediction model, thereby obtaining the answer text to the question to be answered. The answer prediction model is trained using several sets of sample text data, and when training the answer prediction model based on the sample text data, at least one sample character is selected from the sample text data for masking.

[0062] The above scheme, on the one hand, refers not only to the question text itself but also to the common sense text involved in the answer prediction process. Thus, it can refer to not only the semantic information of the question text itself but also the semantic information of the common sense text designed for it. Combining the semantic information of the two can deeply mine key elements such as contextual information, environmental information, and background information of different dimensions, which is conducive to improving the reasoning ability of question answering and thus improving the stability of question answering. On the other hand, during the training process, selecting at least one sample character in the sample text data for masking can improve data diversity, thereby alleviating the limitations of small sample data and thus helping to improve the accuracy of the network model. Therefore, it is possible to accurately and stably answer questions.

[0063] In some disclosed embodiments, each set of sample text data includes a sample question text, a sample common sense text related to the sample question text, and a sample answer text to the sample question text.

[0064] Therefore, each set of sample text data includes sample question text, sample common sense text related to the sample question text, and sample answer text of the sample question text. Therefore, common sense information can be incorporated into the training process, so that the network model pays attention to common sense information while paying attention to question information, to assist the network model to better understand the intention of the question, combine common sense information to generate answers that conform to the facts, and improve the accuracy and stability of question and answer answers.

[0065] In some disclosed embodiments, the question answering device 70 further includes a sample embedding module for obtaining an embedded feature representation of sample characters in sample text data; wherein, masked sample characters in the sample text data are represented by preset characters; the question answering device 70 further includes a sample encoding module for encoding sample characters based on the embedded feature representation to obtain a semantic feature representation of the sample characters; the question answering device 70 further includes a sample prediction module for performing prediction based on the semantic feature representation of the sample characters to obtain a predicted answer text; the question answering device 70 further includes a parameter adjustment module for adjusting the network parameters of the answer prediction model based on the difference between the sample answer text and the predicted answer text.

[0066] Therefore, during the training process, the sample answer text is used to supervise the training of the answer prediction model by performing embedding, encoding, prediction, and parameter adjustment steps, so that the predicted answer text output by it can continue to approach the sample answer text during the iterative training process, thereby enabling the network model to deeply mine the semantic information of the sample question text itself, and at the same time deeply mine the semantic information of the sample common sense text, thereby improving the model performance of the network model.

[0067] In some disclosed embodiments, when a preset character belongs to a sample question text or a sample common sense text, the semantic feature representation of the preset character is obtained based on a first reference character encoding, and the first reference character includes: all sample characters in the sample question text and the sample common sense text; and / or, when the preset character belongs to a sample answer text, the semantic feature representation of the preset character is obtained based on a second reference character encoding, and the second reference character includes: the preset character itself, all sample characters in the sample question text and the sample common sense text, and all sample characters in the sample answer text that are located before the preset character.

[0068] Therefore, in the case where the preset character belongs to the sample question text or the sample common sense text, the semantic feature representation of the preset character is obtained based on the first reference character encoding, and the first reference character includes: all sample characters in the sample question text and the sample common sense text, which can fully combine the semantic information of the sample common sense text and the sample question text during the training process, so that the network model can deeply explore the deep meaning of the two and improve the network model's reasoning ability based on common sense; and in the case where the preset character belongs to the sample answer text, the semantic feature representation of the preset character is obtained based on the second reference character encoding, and the second reference character includes: the preset character itself, all sample characters in the sample question text and the sample common sense text, and all sample characters in the sample answer text that are located before the preset character, which can implicitly learn the causal relationship between the sample answer text and the sample common sense text and the sample question text during the training process, and improve the network model's ability to reason based on common sense and problems.

[0069] In some disclosed embodiments, the answer prediction model includes an input layer, an embedding layer, an encoding layer, and a prediction layer; wherein the input layer is used to input sample common sense text, sample question text, and sample answer text, the embedding layer is used to obtain embedded feature representation, the encoding layer is used to encode to obtain semantic feature representation, and the prediction layer is used to predict to obtain predicted answer text.

[0070] Therefore, implementing embedding, encoding, and prediction through each network layer of the answer prediction model can help improve the efficiency of each stage.

[0071] In some disclosed embodiments, the question answering device 70 also includes a text construction module for, in response to the presence of entity text in the question text to be answered whose entity meaning satisfies the first condition, sequentially constructing inquiry texts about the entity texts based on the importance level of each entity text; the question answering device 70 also includes a text replacement module for obtaining the answer text of the user's answer to each inquiry text, and replacing the entity text in the question text to be answered with the answer text.

[0072] Therefore, when there is entity text in the question text to be answered whose entity meaning meets the first condition, based on the importance level of each entity text, query text about the entity text is constructed in sequence, and the answer text of the user's answer to each query text is obtained, and the entity text in the question text to be answered is replaced with the answer text. On this basis, the answer prediction model is used to predict the answer for the question text to be answered and the common sense text to obtain the answer text of the question text to be answered. That is, before using the network model to predict the answer, it is possible to actively interact with the user and induce the user to supplement and complete the question-related information to assist the network model in answer reasoning and decision-making, which is conducive to further improving the accuracy and stability of question answers.

[0073] In some disclosed embodiments, the question answering device 70 also includes a question query module for, in response to the absence of entity text whose entity meaning satisfies a first condition in the question text to be answered, and a standard question text whose semantic similarity with the question text to be answered satisfies a second condition is found in the standard question and answer library, using the standard answer text of the standard question text as the answer text; and / or, the answer prediction module 72 is specifically used for, in response to the absence of entity text whose entity meaning satisfies a first condition in the question text to be answered, and no standard question text whose semantic similarity with the question text to be answered satisfies a second condition is found in the standard question and answer library, executing the step of predicting the answer to the question text to be answered and the common sense text based on the answer prediction model, and obtaining the answer text of the question text to be answered.

[0074] Therefore, when there is no entity text whose entity meaning meets the first condition in the question text to be answered, the standard question and answer database is queried first. If a standard question text whose semantic similarity with the question text to be answered meets the second condition can be found, the standard answer text of the standard question text is directly used as the answer text. Otherwise, if no standard answer text is found, the answer prediction model is used to predict the answer, so that the efficiency of answering questions can be improved as much as possible.

[0075] In some disclosed embodiments, the first condition includes: no corresponding entity meaning is found in the common sense database for the entity text.

[0076] Therefore, by setting the first condition to include the entity text and the corresponding entity meaning is not found in the common sense database, it is possible to construct a query text for the problem that the entity text has unclear meaning, so as to induce the user to clarify its specific meaning, which is conducive to enhancing the clarity of the meaning of the question text to be answered and improving the accuracy of subsequent answer predictions.

[0077] In some disclosed embodiments, the question answering device 70 also includes a text query module for querying standard text with the same semantics as the answer text based on a common sense library; the text replacement module is specifically used to replace the entity text in the question text to be answered with the standard text.

[0078] Therefore, before replacing the entity text with unclear meaning in the question text with the corresponding answer text, the common sense library is used to query the standard text with the same semantics as the answer text, and the entity text in the question text is replaced with the standard text. This can realize attribute linking in combination with the common sense library, convert the answer text into more standardized terms, and automatically complete event abstraction and generalization.

[0079] See also Figure 8 , Figure 8 1 is a schematic diagram illustrating an embodiment of an electronic device 80 of the present application. Electronic device 80 includes a memory 81 and a processor 82 coupled to each other. Memory 81 stores program instructions, and processor 82 is configured to execute the program instructions to implement the steps of any of the aforementioned question-answering method embodiments. Specifically, electronic device 80 may include, but is not limited to, desktop computers, laptop computers, servers, mobile phones, tablet computers, and the like.

[0080] Specifically, the processor 82 is used to control itself and the memory 81 to implement the steps in any of the above-mentioned question answering method embodiments. The processor 82 can also be called a CPU (Central Processing Unit). The processor 82 may be an integrated circuit chip with signal processing capabilities. The processor 82 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 82 can be implemented by an integrated circuit chip.

[0081] The above scheme, on the one hand, refers not only to the question text itself but also to the common sense text involved in the answer prediction process. Thus, it can refer to not only the semantic information of the question text itself but also the semantic information of the common sense text designed for it. Combining the semantic information of the two can deeply mine key elements such as contextual information, environmental information, and background information of different dimensions, which is conducive to improving the reasoning ability of question answering and thus improving the stability of question answering. On the other hand, during the training process, selecting at least one sample character in the sample text data for masking can improve data diversity, thereby alleviating the limitations of small sample data and thus helping to improve the accuracy of the network model. Therefore, it is possible to accurately and stably answer questions.

[0082] See also Figure 9 , Figure 9 1 is a schematic diagram of a framework of an embodiment of a computer-readable storage medium 90 of the present application. The computer-readable storage medium 90 stores program instructions 91 that can be executed by a processor, and the program instructions 91 are used to implement the steps of any of the above-mentioned question answering method embodiments.

[0083] The above scheme, on the one hand, refers not only to the question text itself but also to the common sense text involved in the answer prediction process. Thus, it can refer to not only the semantic information of the question text itself but also the semantic information of the common sense text designed for it. Combining the semantic information of the two can deeply mine key elements such as contextual information, environmental information, and background information of different dimensions, which is conducive to improving the reasoning ability of question answering and thus improving the stability of question answering. On the other hand, during the training process, selecting at least one sample character in the sample text data for masking can improve data diversity, thereby alleviating the limitations of small sample data and thus helping to improve the accuracy of the network model. Therefore, it is possible to accurately and stably answer questions.

[0084] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.

[0085] The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced with each other and will not be repeated herein for the sake of brevity.

[0086] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation methods described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0087] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0088] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0089] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

Claims

1. A question answering method, characterized in that: include: Obtaining the text of the question to be answered and the common sense text related to the question to be answered; In response to the existence of entity texts in the question text to be answered whose entity meanings meet a first condition, query texts about the entity texts are sequentially constructed based on the importance levels of the respective entity texts; wherein the first condition includes: no corresponding entity meaning of the entity text is found in the common sense database; Obtain the answer text of the user to each of the inquiry texts, and replace the entity text in the question text to be answered with the answer text; Perform answer prediction on the question text to be answered and the common sense text based on the answer prediction model to obtain an answer text for the question text to be answered; The answer prediction model is trained using several groups of sample text data, and when training the answer prediction model based on the sample text data, at least one sample character is selected from the sample text data for masking. Each group of sample text data includes a sample question text, a sample common sense text related to the sample question text, and a sample answer text to the sample question text. The training steps of the answer prediction model include: Obtaining embedded feature representations of the sample characters in the sample text data; wherein the masked sample characters in the sample text data are represented by preset characters; Encoding the sample characters based on the embedded feature representation to obtain a semantic feature representation of the sample characters; Perform prediction based on the semantic feature representation of the sample characters to obtain a predicted answer text; Based on the difference between the sample answer text and the predicted answer text, the network parameters of the answer prediction model are adjusted; wherein, when the preset character belongs to the sample question text or the sample common sense text, the semantic feature representation of the preset character is obtained based on a first reference character encoding, and the first reference character includes: all the sample characters in the sample question text and the sample common sense text; and / or, when the preset character belongs to the sample answer text, the semantic feature representation of the preset character is obtained based on a second reference character encoding, and the second reference character includes: the preset character itself, all the sample characters in the sample question text and the sample common sense text, and all the sample characters in the sample answer text that are located before the preset character.

2. The method according to claim 1, characterized in that The answer prediction model includes an input layer, an embedding layer, an encoding layer and a prediction layer; Among them, the input layer is used to input the sample common sense text, sample question text and the sample answer text, the embedding layer is used to obtain the embedded feature representation, the encoding layer is used to encode the semantic feature representation, and the prediction layer is used to predict the predicted answer text.

3. The method according to claim 1, characterized in that Before replacing the entity text in the question text to be answered with the answer text, the method further includes: Querying a standard text having the same semantics as the answer text based on a common sense database; The step of replacing the entity text in the question text to be answered with the answer text includes: The entity text in the question to be answered is replaced with the standard text.

4. The method according to claim 1, wherein The method further comprises: In response to the absence of entity text whose entity meaning satisfies the first condition in the question text to be answered, and a standard question text whose semantic similarity with the question text to be answered satisfies the second condition is found in the standard question and answer database, the standard answer text of the standard question text is used as the answer text; and / or, In response to the fact that there is no entity text whose entity meaning satisfies the first condition in the question text to be answered, and no standard question text whose semantic similarity with the question text to be answered satisfies the second condition is found in the standard question and answer library, the step of predicting the answer to the question text to be answered and the common sense text based on the answer prediction model is executed to obtain the answer text of the question text to be answered.

5. A question answering device, characterized in that: include: A text acquisition module is used to acquire the text of the question to be answered and the common sense text related to the question to be answered; A text construction module is configured to, in response to the presence of entity texts in the question text to be answered whose entity meanings satisfy a first condition, sequentially construct inquiry texts about the entity texts based on the importance levels of the respective entity texts; wherein the first condition includes: no corresponding entity meaning of the entity text is found in the common sense database; A text replacement module is used to obtain the answer text of the user to each of the inquiry texts, and replace the entity text in the question text to be answered with the answer text; An answer prediction module is used to predict the answer to the question text and the common sense text based on the answer prediction model to obtain the answer text of the question text; The answer prediction model is trained using several groups of sample text data, and when training the answer prediction model based on the sample text data, at least one sample character is selected from the sample text data for masking. Each group of sample text data includes a sample question text, a sample common sense text related to the sample question text, and a sample answer text to the sample question text. The training steps of the answer prediction model include: Obtaining embedded feature representations of the sample characters in the sample text data; wherein the masked sample characters in the sample text data are represented by preset characters; Encoding the sample characters based on the embedded feature representation to obtain a semantic feature representation of the sample characters; Perform prediction based on the semantic feature representation of the sample characters to obtain a predicted answer text; Based on the difference between the sample answer text and the predicted answer text, the network parameters of the answer prediction model are adjusted; wherein, when the preset character belongs to the sample question text or the sample common sense text, the semantic feature representation of the preset character is obtained based on a first reference character encoding, and the first reference character includes: all the sample characters in the sample question text and the sample common sense text; and / or, when the preset character belongs to the sample answer text, the semantic feature representation of the preset character is obtained based on a second reference character encoding, and the second reference character includes: the preset character itself, all the sample characters in the sample question text and the sample common sense text, and all the sample characters in the sample answer text that are located before the preset character.

6. An electronic device, characterized in that: The system comprises a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the question answering method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the question answering method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Software crowdsourcing task type dialogue system and method

    CN111078844A