Answer generation method and device and storage medium

By identifying the target entities and intentions in the question text and using mapping relationships to generate answers, the problem that traditional intelligent customer service cannot accurately match and repeat the content of the knowledge base is solved, and efficient and flexible answer generation and maintenance are achieved.

CN119106112APending Publication Date: 2024-12-10BEIJING XIAOMI MOBILE SOFTWARE CO LTD +1
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202310686318.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-09
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

Traditional intelligent customer service is based on manual maintenance knowledge base Q&A, and cannot accurately match user questions with similar semantics, resulting in the inability to obtain answers, and the same or similar knowledge base content needs to be repeatedly written, resulting in low writing efficiency and difficulty in maintaining.

Method used

By determining the target entity and intention information in the question text, using the pre-generated mapping relationship, determine whether there is an associated target answer template. If it exists, generate the target answer, and realize the analysis of the user's true intention and accurate identification of the answer, and be flexible. Adjust the mapping relationship to meet different product and scenario needs.

Benefits of technology

It realizes accurate identification of user intentions and accurate generation of answers, reduces the difficulty of answer generation caused by differences in different product parameter items, reduces the cost of repeated writing and maintenance, and improves the efficiency and flexibility of intelligent customer service.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119106112A_ABST
    Figure CN119106112A_ABST
Patent Text Reader

Abstract

The invention relates to an answer generation method and device and a storage medium, and aims to reduce the maintenance cost of answers. The method comprises the following steps: in response to an obtained question text, determining a target entity contained in the question text; according to the question text and the target entity, intention information of the question text is determined by utilizing a pre-generated first mapping relation, and the first mapping relation is used for indicating a corresponding relation among the text, the entity and an intention; according to an associated entity and the intention information, whether a target answer template associated with a target parameter item exists or not is determined by using a pre-generated second mapping relation, the associated entity is an entity for determining the intention information in the first mapping relation, and the target answer template is an entity for determining the intention information in the second mapping relation. The second mapping relationship is used for indicating a corresponding relationship among the entity, the intention and the answer template associated with the parameter item corresponding to the intention; and if the target answer template exists, generating a target answer according to the target answer template and the target parameter item.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to an answer generation method, device and storage medium. Background Art

[0002] With the development of technologies such as the Internet and artificial intelligence, the traditional customer service field is facing problems such as increased labor costs, increased response efficiency requirements, and training difficulties. Therefore, intelligent customer service has been introduced to solve many problems existing in traditional customer service. At present, intelligent customer service is mostly based on manually maintained knowledge base question and answer pairs. Under this implementation method, for semantically similar questions raised by users, it is impossible to achieve accurate matching in the artificial knowledge base, resulting in the inability to obtain answers. In addition, for different products, the same or similar knowledge pairs need to be repeatedly written multiple times, resulting in repeated writing work and low efficiency, and difficulty in knowledge base maintenance. Summary of the invention

[0003] In order to overcome the problems existing in the related art, the present disclosure provides an answer generation method, device and storage medium.

[0004] According to a first aspect of an embodiment of the present disclosure, a method for generating an answer is provided, the method comprising:

[0005] In response to obtaining the question text, determining a target entity included in the question text;

[0006] According to the question text and the target entity, determining the intention information of the question text by using a pre-generated first mapping relationship, wherein the first mapping relationship is used to indicate the correspondence between text, entity and intention;

[0007] According to the associated entity and the intent information, using a pre-generated second mapping relationship, determining whether there is a target answer template associated with the target parameter item, the associated entity being the entity whose intent information is determined in the first mapping relationship, and the second mapping relationship being used to indicate a correspondence between an entity, an intent, and an answer template associated with a parameter item corresponding to the intent;

[0008] If the target answer template exists, generate the target answer according to the target answer template and the target parameter items.

[0009] Optionally, determining the intention information of the question text based on the question text and the target entity by using a pre-generated first mapping relationship includes:

[0010] According to the first mapping relationship, determining whether there is a target intent corresponding to the question text and the target entity;

[0011] If the target intention exists, determining the target intention as the intention information;

[0012] If the target intent does not exist, rewritten content is generated, and the intent information is determined based on the rewritten content and the first mapping relationship, where the rewritten content is obtained by modifying the question text and / or the target entity.

[0013] Optionally, the generating the rewritten content and determining the intention information according to the rewritten content and the first mapping relationship includes:

[0014] Generate the rewritten content of this modification according to the target modification method;

[0015] Determining whether there is a target intent corresponding to the rewritten content of this modification according to the first mapping relationship;

[0016] If the target intention exists, determining the target intention as the intention information;

[0017] If the target intent does not exist, determine a new target modification method, and based on the new target modification method, re-execute the step of generating the rewritten content of this modification according to the target modification method and the step of determining whether there is a target intent corresponding to the rewritten content of this modification according to the first mapping relationship, until it is determined that the target intent exists or the number of times the rewritten content is generated reaches a preset number of times.

[0018] Optionally, the target modification method includes:

[0019] A first modification method for rewriting the question text;

[0020] A second modification method for replacing a target entity in the question text with a first preset entity;

[0021] A third modification method for rewriting the question text and replacing a target entity in the rewritten question text with a second preset entity;

[0022] A fourth modification method for replacing at least two target entities in the question text with at least two third preset entities when the question text contains more than one target entity;

[0023] A fifth modification method for rewriting the question text when the question text contains more than one target entity, and replacing at least two target entities in the rewritten question text with at least two fourth preset entities;

[0024] A sixth modification method for using the fifth preset entity as a target entity;

[0025] Among them, the first preset entity, the second preset entity, the third preset entity, and the fourth preset entity are entities on the path from the replaced target entity to the root entity in a pre-constructed entity hierarchy tree, and the fifth preset entity is determined by historical conversation information associated with the question text.

[0026] Optionally, generating a target answer according to the target answer template and the target parameter item includes:

[0027] Determine a target intent attribute according to the intent information, wherein the target intent attribute is one of a parameter query, a comparison query, and an inference query;

[0028] The target answer is generated according to the target answer template in accordance with the answer generation method corresponding to the target intention attribute.

[0029] Optionally, if the target intent attribute is the parameter-type query, the target answer template includes a first string with a first placeholder;

[0030] If the target intent attribute is the parameter query, generating the target answer according to the target answer template in the answer generation method corresponding to the target intent attribute includes:

[0031] Determine the entity type of the associated entity, the entity type is a precise entity or a fuzzy entity, the precise entity represents an entity with a degree of 0 in a pre-constructed entity hierarchy tree, and the fuzzy entity represents an entity with a degree greater than 0 in the entity hierarchy tree;

[0032] If the entity type of the associated entity is the precise entity, a target parameter value corresponding to the target parameter item is obtained, and the target parameter value is filled into the position of the first placeholder in the first character string to generate a target answer.

[0033] Optionally, the method further comprises:

[0034] If the entity type of the associated entity is the fuzzy entity, a second character string with at least one second placeholder is obtained, and at least one subclass entity of the associated entity is filled into the position of the second placeholder in the second character string to generate a target answer.

[0035] Optionally, if the target intent attribute is the comparison query, the target answer template includes a third character string with at least two third placeholders, and each of the third placeholders corresponds to a target parameter item of an associated entity;

[0036] If the target intent attribute is the comparison query, generating the target answer according to the target answer template in the answer generation method corresponding to the target intent attribute includes:

[0037] For each of the associated entities, obtaining a target parameter value corresponding to the target parameter item of the associated entity;

[0038] For each target parameter value, the target parameter value is filled into the target position corresponding to the target parameter value in the third character string to generate a target answer, wherein the target position corresponding to the target parameter value is the position of the third placeholder corresponding to the target parameter item to which the target parameter value belongs.

[0039] Optionally, if the target intent attribute is the reasoning type query, the target answer template includes a fourth character string with a fourth placeholder;

[0040] If the target intent attribute is the reasoning query, generating the target answer according to the target answer template in the answer generation method corresponding to the target intent attribute includes:

[0041] Determine an inference condition according to the intention information, where the inference condition is used to filter or sort entities;

[0042] Obtaining a target parameter value corresponding to the target parameter item;

[0043] Determining a reasoning result according to the reasoning condition and the target parameter value;

[0044] Fill the inference result into the position of the fourth placeholder in the fourth character string to generate a target answer.

[0045] Optionally, a target parameter value corresponding to the target parameter item is obtained from a pre-generated knowledge graph parameter table, wherein the knowledge graph parameter table stores parameter values ​​corresponding to each of a plurality of parameter items.

[0046] Optionally, the method further comprises:

[0047] If the target answer template does not exist, the target answer string is determined from a preset knowledge base based on the associated entity and the intent information as the target answer to the question text. The preset knowledge base stores the correspondence between entities, intents, and answer strings.

[0048] According to a second aspect of an embodiment of the present disclosure, there is provided an answer generating device, the device comprising:

[0049] A first determination module is configured to determine a target entity contained in the question text in response to obtaining the question text;

[0050] A second determination module is configured to determine the intention information of the question text according to the question text and the target entity using a pre-generated first mapping relationship, wherein the first mapping relationship is used to indicate a correspondence between text, entity and intention;

[0051] A third determination module is configured to determine whether there is a target answer template associated with a target parameter item based on the associated entity and the intent information using a pre-generated second mapping relationship, wherein the associated entity is an entity whose intent information is determined in the first mapping relationship, and the second mapping relationship is used to indicate a correspondence between an entity, an intent, and an answer template associated with a parameter item corresponding to the intent;

[0052] The answer generation module is configured to generate a target answer according to the target answer template and the target parameter item if the target answer template exists.

[0053] According to a third aspect of an embodiment of the present disclosure, there is provided an answer generating device, including:

[0054] processor;

[0055] a memory for storing processor-executable instructions;

[0056] Wherein, the processor is configured to execute the answer generation method described in the first aspect of the present disclosure.

[0057] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the answer generation method provided in the first aspect of the present disclosure are implemented.

[0058] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0059] According to the question text and the target entity contained in the question text, the first mapping relationship is used to determine the intent information of the question text, and then according to the associated entities and intent information of the determined intent information, the second mapping relationship is used to determine whether there is a target answer template associated with the target parameter item. If there is a target answer template, the target answer is generated according to the target answer template and the target parameter item. Among them, the first mapping relationship is used to indicate the correspondence between text, entity and intent, and the second mapping relationship is used to indicate the correspondence between entity, intent and answer template associated with parameter items corresponding to the intent. Therefore, through the first mapping relationship, the intent of the question text can be parsed, and then the true intent of the user who inputs the question text can be accurately identified. At the same time, even if an error occurs in the intent recognition, timely intervention can be implemented by adjusting the first mapping relationship to ensure the accuracy of subsequent intent recognition. Moreover, through the first mapping relationship and the second mapping relationship, the decoupling of questions and answers is achieved. If the intent in the first mapping relationship is adjusted, it is only necessary to adjust the intent of the second mapping relationship accordingly without making additional changes. At the same time, based on the intent and the parameter items corresponding to the intent, for the same intent, the parameter items corresponding to the entity can be determined from the second mapping relationship according to the entity to generate answers for the entity. Thus, answers can be generated for the same questions of different entities in a targeted manner, and the problem of being unable to generate answers due to differences in parameter items of different products can be effectively solved. In addition, the first mapping relationship and the second mapping relationship can be flexibly adjusted and reused to meet different scenario requirements without a large amount of repeated writing, which is conducive to reducing the maintenance cost of questions and answers.

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

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

[0062] Figure 1 The figure is a flowchart of a method for generating an answer according to an exemplary embodiment.

[0063] Figure 2 It is an exemplary flowchart of the steps of determining the intention information of the question text in the answer generation method provided by the present disclosure.

[0064] Figure 3 It is an exemplary schematic diagram of the entity hierarchy tree provided by the present disclosure.

[0065] Figure 4 It is a block diagram of an answer generating device according to an exemplary embodiment.

[0066] Figure 5 It is a block diagram of an answer generating device according to an exemplary embodiment. DETAILED DESCRIPTION

[0067] 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, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0068] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.

[0069] Figure 1 FIG. 1 is a flow chart of a method for generating an answer according to an exemplary embodiment. Figure 1 As shown, the method may include steps 11 to 14.

[0070] In step 11, in response to obtaining the question text, a target entity included in the question text is determined.

[0071] Optionally, named entity recognition (NER) technology may be used to identify the question text to determine the entities contained in the question text, ie, the target entities.

[0072] In step 12, the intention information of the question text is determined according to the question text and the target entity using the pre-generated first mapping relationship.

[0073] The first mapping relationship is used to indicate the corresponding relationship between the text, entity and intent. The first mapping relationship can be pre-generated according to actual needs.

[0074] For example, if the first mapping relationship may include a correspondence between "How many watts of a mobile phone is", "mobile phone", and "power", where "How many watts of a mobile phone is" is text, "mobile phone" is an entity, and "power" is an intent. Based on this, when a question text such as "How many watts of a mobile phone is", the target entity is identified as "mobile phone". Based on these two, the correspondence between "How many watts of a mobile phone is", "mobile phone", and "power" can be located from the first mapping relationship. Therefore, it can be determined that the intent information of the obtained question text is "power".

[0075] In step 13, based on the associated entity and the intention information, using the pre-generated second mapping relationship, it is determined whether there is a target answer template associated with the target parameter item.

[0076] The associated entity is the entity whose intent information is determined in the first mapping relationship. For example, in the previous example, the associated entity is the entity whose intent "power" is determined from the first mapping relationship, that is, the entity "mobile phone".

[0077] The second mapping relationship is used to indicate the corresponding relationship between the entity, the intent, and the answer template associated with the parameter item corresponding to the intent. The second mapping relationship can be pre-generated according to actual needs.

[0078] Among them, the parameter items corresponding to the intent can be pre-defined for different entities to form a part of the second mapping relationship. That is, the same intent can correspond to different parameter items based on the differences between different entities. For example, for the intent of "power": if the entity is "mobile phone", the corresponding parameter items can be "charging power" and "charger power"; if the entity is "TV", the corresponding parameter item is "power supply power".

[0079] The answer template is a speech template used to form an answer. It can be a pre-generated string, which can be composed of characters such as text, placeholders, punctuation marks, etc. The text can be composed of characters such as words, letters, and numbers. Among them, the text can contain text content used to represent the parameter items corresponding to the intent, and the placeholder is used to hold a place so that the parameter value corresponding to the parameter item can be filled in the placeholder later to form an accurate answer.

[0080] For example, the answer template could be:

[0081] “The power of mobile phone A is as follows:

[0082] Charging power: XXX (W / watt);

[0083] Charger power: YYY (W / W)".

[0084] Among them, "The power of mobile phone A is as follows", "charging power", "charger power", "W", and "watts" are texts in the answer template, "XXX" is the placeholder corresponding to the parameter item of charging power in the answer template (in actual applications, placeholders usually have their own specific formats, and other examples of placeholders here and in this article are only used for illustration), "YYY" is the placeholder corresponding to the parameter item of charger power in the answer template, ":", ";", "(", " / " and ")" are all punctuation marks in the answer text, and "mobile phone A" is the entity corresponding to the answer template, and "charging power" and "charger power" are the text content used to characterize the parameter item in the answer template. Based on this, when forming the answer, the value X1 of the charging power of mobile phone A can be obtained and filled in the position of the placeholder corresponding to the parameter item of charging power, and the value Y1 of the charger power of mobile phone A can be obtained and filled in the position of the placeholder corresponding to the parameter item of charger power. Assuming that the obtained parameter value X1 is 5 and the parameter value Y1 is 10, the answer formed after filling is:

[0085] “The power of mobile phone A is as follows:

[0086] Charging power: 5 (W / watt);

[0087] Charger power: 10 (W / W)".

[0088] Based on the above description, multiple correspondences between entities, intents, and answer templates associated with parameter items corresponding to intents can be pre-generated according to actual needs to form a second mapping relationship. For example, the second mapping relationship may include "TV B" (entity), "power" (intent), and "the power supply power of TV B is: MMM watts" (answer template associated with parameter items corresponding to intent, where the power supply power is the parameter item corresponding to the intent, and MMM represents the placeholder). For another example, the second mapping relationship may also include "mobile phone C" (entity), "power" (intent), and "the charging power of mobile phone C is: NNN watts" (answer template associated with parameter items corresponding to intent, where the charging power is the parameter item corresponding to the intent, and NNN represents the placeholder).

[0089] According to the pre-generated second mapping relationship, combined with the associated entities and intent information determined based on the question text, a match can be performed in the second mapping relationship to determine whether there is an answer template that can correspond to the associated entities and intent information. If so, the answer template can be obtained as the target answer template for subsequent answer generation, wherein the parameter item corresponding to the intent associated with the target answer template in the second mapping relationship is the target parameter item.

[0090] In step 14, if a target answer template exists, a target answer is generated according to the target answer template and the target parameter items.

[0091] If it is determined in step 13 that a target answer template exists, the target answer can be generated based on the target answer template. For example, the parameter value corresponding to the target parameter item can be obtained and filled into the target answer. For example, in the above example, "the power of mobile phone A is as follows: charging power: 5 (W / W); charger power: 10 (W / W)" is a target answer.

[0092] After the target answer is generated, the target answer can be fed back to the sender according to the sender of the question text. For example, if the user inputs the question text through the specified question-answering dialog box, the target answer can be output through the question-answering dialog box as an answer to the question text.

[0093] Through the above technical solution, the first mapping relationship is used to determine the intent information of the question text according to the question text and the target entity contained in the question text, and then the second mapping relationship is used to determine whether there is a target answer template associated with the target parameter item according to the associated entity and intent information of the determined intent information. If there is a target answer template, the target answer is generated according to the target answer template and the target parameter item. Among them, the first mapping relationship is used to indicate the correspondence between text, entity and intent, and the second mapping relationship is used to indicate the correspondence between entity, intent and answer template associated with parameter items corresponding to the intent. Therefore, through the first mapping relationship, the intent of the question text can be parsed, and then the true intent of the user who inputs the question text can be accurately identified. At the same time, even if an error occurs in the intent recognition, timely intervention can be implemented by adjusting the first mapping relationship to ensure the accuracy of subsequent intent recognition. Moreover, through the first mapping relationship and the second mapping relationship, the decoupling of questions and answers is achieved. If the intent in the first mapping relationship is adjusted, it is only necessary to adjust the intent of the second mapping relationship accordingly without making additional changes. At the same time, based on the intent and the parameter items corresponding to the intent, for the same intent, the parameter items corresponding to the entity can be determined from the second mapping relationship according to the entity to generate answers for the entity. Thus, answers can be generated for the same questions of different entities in a targeted manner, and the problem of being unable to generate answers due to differences in parameter items of different products can be effectively solved. In addition, the first mapping relationship and the second mapping relationship can be flexibly adjusted and reused to meet different scenario requirements without a large amount of repeated writing, which is conducive to reducing the maintenance cost of questions and answers.

[0094] In order to enable those skilled in the art to better understand the answer generation method provided by the present disclosure, the relevant steps involved in the above are described in detail below.

[0095] In a possible implementation, step 12 may include the following steps: Figure 2 shown.

[0096] In step 21, based on the first mapping relationship, it is determined whether there is a target intent corresponding to the question text and the target entity.

[0097] If there is a target intention, execute step 22; if there is no target intention, execute step 23.

[0098] In step 22, the target intention is determined as intention information.

[0099] In step 23, rewritten content is generated, and intention information is determined according to the rewritten content and the first mapping relationship.

[0100] That is to say, in the initial case, we can directly determine whether there is a target intent that can match it in the first mapping relationship based on the question text and the target entity. If it does, it will be used as the intent information; if it does not, we can rewrite the question text and the target entity to a certain extent, generate rewritten content, and try to match the intent in the first mapping relationship again based on the text and entity corresponding to the generated rewritten content.

[0101] The rewritten content may be obtained by modifying the question text and / or the target entity.

[0102] Optionally, the question text may be modified by rewriting the question text, for example, removing punctuation marks in the question text, correcting incorrect words in the question text, etc.

[0103] Optionally, the modification of the target entity can be achieved through entity replacement. For example, the target entity is replaced with a superordinate entity that can generalize the target entity. For example, mobile phones include many different models of mobile phones, so mobile phone is the superordinate entity of mobile phone model. Therefore, if the target entity is mobile phone model D, the entity mobile phone can be used to replace mobile phone model D. It should be noted that if the target entity is replaced, the target entity in the question text should also be replaced synchronously.

[0104] In a possible implementation, step 23 may include the following steps:

[0105] Generate the rewritten content of this modification according to the target modification method;

[0106] Determine, based on the first mapping relationship, whether there is a target intent corresponding to the rewritten content of this modification;

[0107] If there is a target intention, the target intention is determined as the intention information;

[0108] If the target intent does not exist, a new target modification method is determined, and based on the new target modification method, the steps of generating the rewritten content of this modification according to the target modification method and determining whether there is a target intent corresponding to the rewritten content of this modification according to the first mapping relationship are re-executed until it is determined that the target intent exists or the number of times the rewritten content is generated reaches a preset number of times.

[0109] That is to say, after the target intent cannot be determined in step 21, the question text and / or the target entity can be modified to obtain the rewritten content for the intent matching again. Among them, if the target intent cannot be determined, multiple intent matching may be required, that is, the modification can be performed multiple times. Therefore, each time a modification is required, the target modification method of this modification can be determined, and the rewritten content of this modification can be generated based on the target modification method for this intent matching.

[0110] Thus, when the intent information cannot be determined based on the original question text, the rewritten content obtained by modifying at least one of the question text and the target entity is used for another intent matching by generating rewritten content. Moreover, whenever the intent information still cannot be determined based on the current rewritten content, new rewritten content is generated through a new modification method, and intent matching is tried again. This cycle is repeated until the existence of the target intent can be determined (i.e., the intent information can be determined) or the number of modifications reaches a preset number.

[0111] Among them, the preset number of times can be set according to actual needs. For example, the preset number of times can be set to the maximum number of possible modifications to the question text. For example, if the question text T1 contains a target entity E1, and there are two entities E2 and E3 that can be used to replace the target entity E1, then the possible modifications to the question text T1 and the target entity E1 may include: retaining the target entity E1 while modifying the question text T1 (to obtain text T2), replacing the target entity E1 with entity E2 and synchronously replacing the target entity E1 in the question text T1, replacing the target entity E1 with entity E3 and synchronously replacing the target entity E1 in the question text T1, replacing the target entity E1 with entity E2 and synchronously replacing the target entity E1 in the text T2, replacing the target entity E1 with entity E3 and synchronously replacing the target entity E1 in the text T2, there are 5 modification methods, so the preset number of times can be set to 5. It should be noted that in actual implementation, there may be more modification methods for the question text T1 and the target entity E1, so the preset number of times can be changed according to actual needs.

[0112] Optionally, target modification methods may include but are not limited to the following:

[0113] A first modification method for rewriting the question text;

[0114] A second modification method for replacing a target entity in the question text with the first preset entity;

[0115] A third modification method for rewriting the question text and replacing a target entity in the rewritten question text with a second preset entity;

[0116] A fourth modification method for replacing at least two target entities in the question text with at least two third preset entities when the question text contains more than one target entity;

[0117] A fifth modification method for rewriting the question text when the question text contains more than one target entity, and replacing at least two target entities in the rewritten question text with at least two fourth preset entities;

[0118] A sixth modification method for taking the fifth preset entity as a target entity.

[0119] The first preset entity, the second preset entity, the third preset entity, and the fourth preset entity may be entities located on a path from the target entity to be replaced to the root entity in a pre-constructed entity hierarchy tree.

[0120] The entity hierarchy tree is a tree structure used to represent the hierarchical relationship between entities, wherein the second entity that is the parent node of the first entity is the upper entity of the first entity and can summarize the first entity in a higher level. For example, the entity hierarchy tree can be as follows: Figure 3 As shown, the root node is the electronic device entity, and its lower-level entities include televisions, mobile phones, and computers. The lower-level entities of televisions include different models of televisions, the lower-level entities of mobile phones include different models of mobile phones, and the lower-level entities of computers include different models of computers. Therefore, based on the entity hierarchy tree, when generating rewritten content, the target entity can be replaced with the upper-level entity of the target entity, or the target entity can be replaced with a higher-level entity, for example, the target entity can be replaced with the entity at the root node in the entity hierarchy tree (i.e., the root entity).

[0121] The fifth preset entity can be determined by the historical session information associated with the question text. For example, the entity with the closest timestamp to the timestamp of the question text in the historical session information associated with the question text can be used as the fifth preset entity. For example, if the user enters text containing entity E4 in the dialog box before entering the question text, entity E4 can be determined as the fifth preset entity.

[0122] The above-mentioned modification methods are described in detail below.

[0123] The first modification method is to rewrite the question text, wherein the rewriting process may adopt a normalization process commonly used in the art, such as removing punctuation marks, correcting incorrect characters, changing the order of characters, changing voice, replacing synonymous characters, etc.

[0124] The second modification method is used to replace a target entity in the question text with the first preset entity. The path from the target entity to the root entity may contain multiple entities, that is, there may be multiple first preset entities. Accordingly, the second modification method may contain multiple sub-modification methods, each of which corresponds to a first preset entity. Figure 3 Taking the entity hierarchy tree shown as an example, if the target entity is "Model 4", the second modification method may include replacing the target entity with the entity "Mobile Phone" and replacing the target entity with the entity "Electronic Device". In actual application, the first preset entity can be determined step by step upward based on the entity hierarchy tree. In addition, if the question text contains more than one target entity, if one target entity has been replaced in the above manner, the target entity can also be replaced, that is, the replaced target entity can be restored and one of the other target entities can be tried to be replaced.

[0125] It should be noted that, in the present disclosure, if the target entity is replaced, the text corresponding to the target entity in the question text will also be replaced synchronously.

[0126] The third modification method is used to rewrite the question text and replace a target entity in the rewritten question text with the second preset entity. The rewriting and single entity replacement methods have been described in the first modification method and the second modification method, respectively, and will not be repeated here.

[0127] The fourth modification method is used to replace at least two target entities in the question text with at least two third preset entities when the question text contains more than one target entity. That is to say, when the question text includes more than one target entity, at least two target entities in the question text can be replaced with the third preset entities corresponding to each target entity. In addition, if the number of target entities in the question text is more than two, after trying to replace two of the target entities, you can also try to replace more entities, for example, replace three or more of them, replace all the target entities, etc. Among them, the replacement method of each target entity can refer to the description of the modification of a single entity given in the second modification method, and will not be repeated here.

[0128] The fifth modification method is used to rewrite the question text when the question text contains more than one target entity, and replace at least two target entities in the rewritten question text with at least two fourth preset entities. That is to say, when the question text includes more than one target entity, at least two target entities in the rewritten question text can also be replaced with the fourth preset entities corresponding to each target entity. In addition, if the number of target entities in the question text is more than two (the number of target entities remains unchanged after the rewriting process), after trying to replace two of the target entities, you can also try to replace more entities, for example, replace three or more of them, replace all the target entities, etc. Among them, the method of rewriting the question text and replacing a single entity has been given in the aforementioned modification method, and will not be repeated here.

[0129] The sixth modification method is used to use the fifth preset entity as the target entity. That is to say, the rewritten content is generated directly based on the fifth preset entity and the question text for intent matching. For example, the fifth preset entity and the question text are used as the rewritten content, the upper entity (or higher entity) of the fifth preset entity and the question text are used as the rewritten content, the fifth preset entity and the rewritten question text are used as the rewritten content, the upper entity (or higher entity) of the fifth preset entity and the rewritten question text are used as the rewritten content, and the upper entity (or higher entity) of the fifth preset entity and the rewritten question text are used as the rewritten content.

[0130] For example, the sixth modification method can be used when it is determined in step 11 that the question text does not contain the target entity. For another example, the sixth modification method can be used after it is determined in step 11 that the target entity exists, and the intent information cannot be determined after the first modification method to the fifth modification method. That is, although the entity is identified from the question text, the intent information cannot be determined based on the entity in any way. The identified target entity can be considered invalid, so the target entity is discarded and the fifth preset entity obtained based on the historical session information is used to try intent matching again in combination with the question text. Among them, the rewriting processing of the question text and the replacement of a single entity have been given in the aforementioned modification method and will not be repeated here.

[0131] It should be noted that, in the present disclosure, if the target entity is replaced, the text corresponding to the target entity in the question text (or the question text after rewriting) will also be replaced synchronously.

[0132] In one possible implementation, different modification methods may each have a corresponding different priority. When determining a new modification method, the priority corresponding to each modification method may be referred to, and modifications may be made in order of priority from high to low. That is, when determining a new target modification method, based on the modification methods that have been used, the modification method with the highest priority among the modification methods that have not been used is selected as the target modification method for the next modification.

[0133] In a possible embodiment, the priorities of various modification methods may be set as follows:

[0134] First modification method>Second modification method>Third modification method>Fourth modification method>Fifth modification method>Sixth modification method.

[0135] Among them, different sub-modification methods under the same modification method may also correspond to different priorities. Taking the second modification method as an example, its priority setting may be: the entity on the path from the target entity to be replaced to the root entity in the entity hierarchy tree, the closer to the target entity to be replaced, the higher its priority as the first preset entity. Therefore, if multiple modifications are made using the second modification method, you can start from the parent entity of the target entity and select entities as the first preset entity step by step to replace the target entity until you reach the root entity.

[0136] In another possible embodiment, the priority can be set from high to low in the order of the degree of change from small to large. For example, for both of them, the meaning of the parent entity is closer to the target entity than the meaning of the grandparent entity, which is equivalent to a smaller degree of change corresponding to the replacement with the parent entity. Therefore, the priority of the modification method of replacing the target entity with the parent entity is higher than the priority of the modification method of replacing the target entity with the grandparent entity. For another example, the modification method F1 of replacing the target entity in the rewritten question text with the parent entity of the target entity is closer to the question text in meaning and has a smaller degree of change than the modification method F2 of replacing the target entity in the original question text with the grandparent entity of the target entity. Therefore, the priority of the modification method F1 is higher than the priority of the modification method F2.

[0137] The following is an example to illustrate the process S1-S13 of determining the intention information according to the rewriting content.

[0138] S1, after it is determined in step 21 that there is no target intent corresponding to the question text and the target entity, it is necessary to generate rewritten content: rewrite the question text through the first modification method to obtain the rewritten content of this modification, and determine whether there is a target intent corresponding to the rewritten content of this modification;

[0139] S2, if the target intent does not exist, it needs to be rewritten again: through the second modification method, the target entity is replaced with the parent entity of the target entity in the entity hierarchy tree to obtain the rewritten content of this modification, and determine whether there is a target intent corresponding to the rewritten content of this modification (if the target entity has no upper entity in the entity hierarchy tree, there is no need to execute S2-S9, and directly enter S10);

[0140] S3, if the target intent does not exist, it needs to be rewritten again: rewrite the question text through the third modification method, and replace the target entity with the parent entity of the target entity in the entity hierarchy tree to obtain the rewritten content of this modification, and determine whether there is a target intent corresponding to the rewritten content of this modification;

[0141] S4, if the target intent does not exist, it needs to be rewritten again: through the second modification method, the root entity in the entity hierarchy tree (that is, the entity at the top level in the entity hierarchy tree) is used to replace the target entity, and the rewritten content of this modification is obtained, and it is determined whether there is a target intent corresponding to the rewritten content of this modification;

[0142] S5, if the target intent does not exist, it needs to be rewritten again: rewrite the question text through the third modification method, and replace the target entity with the root entity in the entity hierarchy tree to obtain the rewritten content of this modification, and determine whether there is a target intent corresponding to the rewritten content of this modification;

[0143] S6, if the target intent does not exist, it needs to be rewritten again: through the fourth modification method, for at least two target entities, the parent entity corresponding to the target entity in the entity hierarchy tree is used to replace the target entity, to obtain the rewritten content of this modification, and to determine whether there is a target intent corresponding to the rewritten content of this modification;

[0144] S7, if the target intent does not exist, it needs to be rewritten again: rewrite the question text through the fifth modification method, and for at least two target entities, replace the target entity with the parent entity corresponding to the target entity in the entity hierarchy tree to obtain the rewritten content of this modification, and determine whether there is a target intent corresponding to the rewritten content of this modification;

[0145] S8, if the target intent does not exist, it needs to be rewritten again: through the fourth modification method, for at least two target entities, the target entity is replaced with the root entity in the entity hierarchy tree to obtain the rewritten content of this modification, and determine whether there is a target intent corresponding to the rewritten content of this modification;

[0146] S9, if the target intent does not exist, it needs to be rewritten again: rewrite the question text through the fifth modification method, and replace the target entity with the root entity in the entity hierarchy tree for at least two target entities to obtain the rewritten content of this modification, and determine whether there is a target intent corresponding to the rewritten content of this modification;

[0147] S10, if the target intent does not exist, rewriting is required: through the sixth modification method, the fifth preset entity is determined, and the fifth preset entity and the question text are used as the rewriting content of this modification, and it is determined whether there is a target intent corresponding to the rewriting content of this modification;

[0148] S11, if the target intent does not exist, it needs to be rewritten again: referring to the first to fifth modification methods, the fifth preset entity and the question text are subjected to operations similar to the target entity and the question text to generate new rewritten content, and determining whether there is a target intent corresponding to the generated rewritten content;

[0149] S12, if the target intent exists, there is no need to rewrite it again, and the target intent is used as the intent information, and the entity (i.e., the associated entity in step 13) and text used when the intent matching is successful are recorded;

[0150] S13: If the target intent does not exist, it is determined that the intent match cannot be achieved, the match fails, and an empty intent information result is returned.

[0151] Through the above method, when the intent information cannot be determined directly based on the question text and the target entity in the question text, the question text and the target entity are rewritten to a certain extent to obtain rewritten content with similar meaning, which is used for intent matching and determining the intent information. This can improve the flexibility of intent matching, thereby ensuring the accuracy of intent matching while improving the success rate of intent matching, and avoiding the subsequent inability to generate answers due to the inability to determine the intent.

[0152] In a possible implementation, generating a target answer according to the target answer template and the target parameter items in step 14 may include the following steps:

[0153] According to the intention information, determine the target intention attribute;

[0154] Generate the target answer according to the target answer template in the answer generation method corresponding to the target intent attribute.

[0155] Among them, the target intent attribute can be one of a parameter query, a comparison query, and a reasoning query. The attributes of the intent can be determined according to the intent, that is, the relationship between the intent and the intent attribute can be preset, so that after the intent is determined, the intent attribute can also be determined accordingly. For example, the intent attribute of the intent "power" can be set as a parameter query to request an answer about the power value of the relevant entity. For another example, the intent attribute of the intent "screen size comparison" can be set as a comparison query to request an answer containing the screen size value of each entity involved in the question. For another example, the intent attribute of the intent "with 5G function" can be set as a reasoning query to request the answer obtained after filtering the devices involved in the entity in the question with the 5G function as the filtering condition. For another example, the intent attribute of the intent "largest screen size" can be set as a reasoning query to request the largest answer obtained after sorting the devices involved in the entity in the question with the screen size as the sorting condition.

[0156] In a possible implementation, if the target intent attribute is a parameter query, the target answer template may include a first string with a first placeholder. The first placeholder is used to fill in the parameter value corresponding to the target parameter item later. For example, the first string may be "The power of TV B is: MMM watts", where MMM represents the placeholder.

[0157] Correspondingly, if the target intent attribute is a parameter query, generating the target answer according to the target answer template in accordance with the answer generation method corresponding to the target intent attribute may include the following steps:

[0158] Determine the entity type of the associated entity;

[0159] If the entity type of the associated entity is an exact entity, obtain a target parameter value corresponding to the target parameter item, and fill the target parameter value into the position of the first placeholder in the first string to generate a target answer.

[0160] The entity type of an entity can be a precise entity or a fuzzy entity. A precise entity represents an entity with a degree of 0 in a pre-constructed entity hierarchy tree (i.e., it has no lower-level entities and is a leaf node in the entity hierarchy tree), while a fuzzy entity represents an entity with a degree greater than 0 in the entity hierarchy tree (i.e., it has lower-level entities and is a non-leaf node in the entity hierarchy tree).

[0161] If the entity type of the associated entity is a precise entity, it indicates that the entity is clearly intended. Therefore, the target parameter value corresponding to the target parameter item can be directly obtained, and the obtained target parameter value can be filled into the position of the first placeholder in the first character string to generate the target answer. For example, if the precise entity "TV B" and the intention "power" correspond to the target answer template "The power supply power of TV B is: MMM watts" associated with the parameter item "power supply power", when it is determined that the associated entity is TV B and the intention is power, the target answer template is also determined accordingly. At the same time, it can be identified that the entity type of the TV B entity is a precise entity, so that the target answer template can be used directly. Based on this, the target parameter value corresponding to the target parameter item of the power supply power of TV B can be obtained, and the obtained target parameter value can be filled into the position of the first placeholder MMM to form the target answer. If the obtained target parameter value is 60, the target answer obtained is "The power supply power of TV B is: 60 watts".

[0162] Optionally, you can obtain the target parameter value corresponding to the target parameter item in the following way:

[0163] Get the target parameter value corresponding to the target parameter item from the pre-generated knowledge graph parameter table.

[0164] The knowledge graph parameter table may store parameter values ​​corresponding to multiple parameter items. For example, the knowledge graph parameter table may store parameter items owned by each entity in the entity hierarchy tree, and parameter values ​​corresponding to each parameter item.

[0165] By adopting the above method, a knowledge graph parameter table is pre-built to store parameter items and corresponding parameter values. When an answer with parameter values ​​needs to be generated, it is only necessary to obtain the parameter values ​​from the knowledge graph parameter table and fill them into the specified position in the answer template to generate the answer. There is no need to maintain multiple answers in the knowledge base, which reduces the maintenance cost of the knowledge base.

[0166] Optionally, if the entity type of the associated entity is a fuzzy entity, the method provided by the present disclosure may further include the following steps:

[0167] A second character string with at least one second placeholder is determined according to the target answer template, and at least one subclass entity of the associated entity is filled into the position of the second placeholder in the second character string to generate a target answer.

[0168] If the entity type of the associated entity is a fuzzy entity, it means that the associated entity has sub-class entities. The sub-class entities of the associated entity are the entities that are child nodes of the associated entity in the entity hierarchy tree. For example, Figure 3 In the entity hierarchy tree shown, "Model 6" and "Model 7" are both subclass entities of "Computer".

[0169] Since the target intent attribute is a parameter-type query, when the associated entity has sub-class entities, the parameter value to be obtained is usually unclear, and thus the target answer template cannot be directly applied. Based on this, a second string with at least one second placeholder can be obtained, and then at least one sub-class entity of the associated entity is filled into the position of the second placeholder in the second string to generate the target answer. Optionally, the second string can also include characters used to characterize the associated entity. Based on this step, it is equivalent to generating a target answer for the sub-class entities contained in the associated entity, and the target answer is used to be output to the user who inputs the question text for the user to make a more detailed selection of the entity.

[0170] For example, Figure 3 Taking the entity hierarchy tree shown in the figure as an example, if the associated entity is the entity "mobile phone", the second string can be "mobile phones include the following models, please select: XX1, XX2, XX3", where XX1, XX2, and XX3 are all second placeholders. Figure 3 It can be seen that mobile phones include three subcategory entities: Model 3, Model 4, and Model 5. Therefore, they can be filled into the second placeholder respectively, and the generated target answer is "Mobile phones include the following models, please select: Model 3, Model 4, Model 5".

[0171] Through the above method, when the associated entity is a fuzzy entity, a target answer with a subclass entity of the associated entity is generated and output to the user for the user to make a more detailed selection, thereby playing an effective guiding role and facilitating the generation of more accurate answers for the user in the future.

[0172] In another possible implementation, if the target intent attribute is a comparison query, the target answer template may include a third string with at least two third placeholders, and each third placeholder corresponds to a target parameter item of an associated entity. For example, if the associated entities are product P1 and product P2, and the intent is screen size comparison, the third string may be:

[0173] “The screen size comparison between product P1 and product P2 is as follows:

[0174] Product P1: XXX1 (inch);

[0175] Product P2: XXX2 (inches)".

[0176] Among them, XXX1 is the third placeholder corresponding to product P1, and XXX2 is the third placeholder corresponding to product P2.

[0177] Accordingly, if the target intent attribute is a comparison query, generating a target answer according to the target answer template in accordance with the answer generation method corresponding to the target intent attribute may include the following steps:

[0178] For each associated entity, obtaining a target parameter value corresponding to the target parameter item of the associated entity;

[0179] For each target parameter value, the target parameter value is filled into a target position corresponding to the target parameter value in the third character string to generate a target answer.

[0180] The target position corresponding to the target parameter value is the position of the third placeholder corresponding to the target parameter item to which the target parameter value belongs.

[0181] For comparison queries, the answer expected by the user usually contains the parameter values ​​of each entity to be compared under the specified parameter items. Therefore, it is necessary to obtain the parameter values ​​of the target parameter items of the objects to be compared (ie, entities) respectively to generate the corresponding target answer.

[0182] Based on the above idea, for each associated entity, the target parameter value corresponding to the target parameter item of the associated entity can be obtained, and then for each target parameter value, the target parameter value can be filled into the target position corresponding to the target parameter value in the third character string to generate a target answer.

[0183] For example, based on the third string in the above example, the target parameter item is "screen size". If the parameter value of the screen size of product P1 is 7, and the parameter value of the screen size of product 2 is 5.2, then the parameter value corresponding to the screen size of product P1 needs to be filled into the target position corresponding to the parameter value (that is, the position where the third placeholder XXX1 is located), and the parameter value corresponding to the screen size of product P2 needs to be filled into the target position corresponding to the parameter value (that is, the position where the third placeholder XXX2 is located). Thus, the generated target answer is:

[0184] “The screen size comparison between product P1 and product P2 is as follows:

[0185] Product P1: 7 (inch);

[0186] Product P2: 5.2 (inches)".

[0187] Optionally, the target parameter value corresponding to the target parameter item can be obtained from a pre-generated knowledge graph parameter table. The description of the knowledge graph parameter table has been given above and will not be repeated here.

[0188] Through the above method, for comparison queries, the parameter values ​​of each entity to be compared corresponding to the specified parameter items can be directly obtained from the knowledge graph parameter table according to the answer template to generate the target answer. The answer generation method is very flexible, so there is no need to maintain multiple answers in the knowledge base for different comparison requirements, and the maintenance cost is low.

[0189] In another possible implementation, if the target intent attribute is a reasoning query, the target answer template may include a fourth string with a fourth placeholder. Accordingly, if the target intent attribute is a reasoning query, generating a target answer according to the target answer template in accordance with the answer generation method corresponding to the target intent attribute may include the following steps:

[0190] Determine the reasoning conditions based on the intention information;

[0191] Get the target parameter value corresponding to the target parameter item;

[0192] Determine the inference result according to the inference condition and the target parameter value;

[0193] The inference result is filled into the position of the fourth placeholder in the fourth string to generate the target answer.

[0194] Among them, the inference conditions can be used to filter or sort entities.

[0195] If the inference condition is screening, the representation needs to screen out the entities involved in the question text that meet the inference condition for generating answers. For example, the question text can be "What are the mobile phones with NFC function", where the entity is the mobile phone (including various models of mobile phones), the inference condition is NFC function, and the parameter item is NFC function (its parameter value can include yes or no). For such a question text, when generating an answer, it should be determined for each model of mobile phone whether it provides NFC function, and screen out mobile phones with NFC function (NFC stands for Near Field Communication, which means near field communication or short-distance wireless communication in Chinese).

[0196] If the inference condition is sorting, the representation needs to be sorted according to the parameter values ​​corresponding to the parameter items according to the entities involved in the question text, and the answer (for example, the sorting result, or the top few in the sorting result, etc.) is generated according to the sorting result. For example, the question text can be "Which mobile phone has the largest screen size", where the entity is a mobile phone (including various models of mobile phones), the inference condition is the largest screen size, and the parameter item is the screen size. For such a question text, when generating an answer, the parameter value of the screen size of each model of mobile phone should be obtained and sorted. For example, if sorted from large to small, the answer is the first in the sorting result.

[0197] For inference queries, you first need to determine the inference condition based on the intent information and obtain the parameter value corresponding to the target parameter item. For example, if the intent is "largest screen size", you can determine the inference condition as the largest sort, and the sorting basis is the parameter value of the screen size parameter item. For another example, if the intent is "NFC function", you can determine the inference condition as filtering, and the filtering condition is the parameter value of the NFC function parameter item.

[0198] After obtaining the target parameter value corresponding to the target parameter item, the inference result can be determined according to the inference condition and the target parameter value. For example, if the intention is "largest screen size", the entity is a mobile phone, and the inference condition is sorting, the parameter value corresponding to the screen size parameter item of each model of mobile phone can be obtained, and the parameter value of the screen size can be sorted based on the inference condition, and then the largest one can be determined as the inference result according to the sorting result. For another example, if the intention is "with NFC function", the entity is a mobile phone, and the inference condition is screening, the parameter value corresponding to the NFC function parameter item of each model of mobile phone can be obtained, and the mobile phone with the parameter value of "with" can be screened out as the inference result based on the inference condition.

[0199] After determining the inference result, the inference result can be filled into the position of the fourth placeholder in the fourth character string. For example, the fourth character string can be "the mobile phone with the largest screen size is: X", where X represents the fourth placeholder. Based on this, after determining that the inference result is model 4, it can be filled into the fourth placeholder, and the target answer is "the mobile phone with the largest screen size is: model 4". For another example, the fourth character string can be "the mobile phone with NFC function is: X", where X represents the fourth placeholder. Based on this, after determining that the inference result is model 5, it can be filled into the fourth placeholder, and the target answer is "the mobile phone with NFC function is: model 5".

[0200] Optionally, the target parameter value corresponding to the target parameter item can be obtained from a pre-generated knowledge graph parameter table. The description of the knowledge graph parameter table has been given above and will not be repeated here.

[0201] Through the above method, for reasoning queries, the parameter value corresponding to the specified parameter item can be directly obtained from the knowledge graph parameter table according to the answer template to obtain the reasoning result, and then generate the target answer, so as to realize automatic reasoning based on parameter value, and there is no need to maintain multiple answers through the knowledge base, which greatly reduces the maintenance cost.

[0202] Optionally, based on Figure 1 The method provided by the present disclosure may further include the following steps:

[0203] If there is no target answer template, the target answer string is determined from the preset knowledge base according to the associated entity and intent information as the target answer for the question text.

[0204] Among them, the preset knowledge base stores the correspondence between entities, intents, and answer strings.

[0205] That is to say, if the target answer template does not exist, the answer can be obtained from the manually maintained preset knowledge base based on the associated entities and intent information to generate the target answer.

[0206] Through the above method, a part of the answers are maintained by pre-setting the knowledge base to solve the problem that the answer content cannot be generated according to the answer template, which is conducive to applying to more question-and-answer scenarios and improving the efficiency of answer generation.

[0207] Figure 4 FIG. 1 is a block diagram of an answer generation device according to an exemplary embodiment. Figure 4 , the device 40 comprises:

[0208] A first determination module 41 is configured to determine a target entity contained in the question text in response to obtaining the question text;

[0209] A second determination module 42 is configured to determine the intention information of the question text according to the question text and the target entity using a pre-generated first mapping relationship, wherein the first mapping relationship is used to indicate a correspondence between text, entity and intention;

[0210] A third determination module 43 is configured to determine whether there is a target answer template associated with a target parameter item based on the associated entity and the intent information using a pre-generated second mapping relationship, wherein the associated entity is an entity whose intent information is determined in the first mapping relationship, and the second mapping relationship is used to indicate a correspondence between an entity, an intent, and an answer template associated with a parameter item corresponding to the intent;

[0211] The answer generation module 44 is configured to generate a target answer according to the target answer template and the target parameter items if the target answer template exists.

[0212] Optionally, the second determining module 42 includes:

[0213] A first determination submodule is configured to determine whether there is a target intent corresponding to the question text and the target entity according to the first mapping relationship;

[0214] A second determination submodule is configured to determine the target intention as the intention information if the target intention exists;

[0215] The third determination submodule is configured to generate rewritten content if the target intent does not exist, and determine the intent information based on the rewritten content and the first mapping relationship, wherein the rewritten content is obtained by modifying the question text and / or the target entity.

[0216] Optionally, the third determination submodule is used to: generate the rewritten content of this modification according to the target modification method; determine whether there is a target intent corresponding to the rewritten content of this modification according to the first mapping relationship; if the target intent exists, determine the target intent as the intent information; if the target intent does not exist, determine a new target modification method, and based on the new target modification method, re-execute the generation of the rewritten content of this modification according to the target modification method and determine whether there is a target intent corresponding to the rewritten content of this modification according to the first mapping relationship, until it is determined that the target intent exists or the number of times the rewritten content is generated reaches a preset number of times.

[0217] Optionally, the target modification method includes:

[0218] A first modification method for rewriting the question text;

[0219] A second modification method for replacing a target entity in the question text with a first preset entity;

[0220] A third modification method for rewriting the question text and replacing a target entity in the rewritten question text with a second preset entity;

[0221] A fourth modification method for replacing at least two target entities in the question text with at least two third preset entities when the question text contains more than one target entity;

[0222] A fifth modification method for rewriting the question text when the question text contains more than one target entity, and replacing at least two target entities in the rewritten question text with at least two fourth preset entities;

[0223] A sixth modification method for using the fifth preset entity as a target entity;

[0224] Among them, the first preset entity, the second preset entity, the third preset entity, and the fourth preset entity are entities on the path from the replaced target entity to the root entity in a pre-constructed entity hierarchy tree, and the fifth preset entity is determined by historical conversation information associated with the question text.

[0225] Optionally, the answer generation module 44 includes:

[0226] A fourth determination submodule is configured to determine a target intent attribute according to the intent information, wherein the target intent attribute is one of a parameter query, a comparison query, and an inference query;

[0227] The generation submodule is configured to generate the target answer according to the target answer template in an answer generation method corresponding to the target intention attribute.

[0228] Optionally, if the target intent attribute is the parameter-type query, the target answer template includes a first string with a first placeholder;

[0229] If the target intent attribute is the parameter type query, the generating submodule includes:

[0230] A fifth determination submodule is configured to determine an entity type of the associated entity, wherein the entity type is a precise entity or a fuzzy entity, wherein the precise entity represents an entity with a degree of 0 in a pre-constructed entity hierarchy tree, and the fuzzy entity represents an entity with a degree greater than 0 in the entity hierarchy tree;

[0231] The first filling submodule is configured to obtain a target parameter value corresponding to the target parameter item if the entity type of the associated entity is the precise entity, and fill the target parameter value into the position of the first placeholder in the first character string to generate a target answer.

[0232] Optionally, the device 40 further includes:

[0233] The filling module is configured to obtain a second character string with at least one second placeholder if the entity type of the associated entity is the fuzzy entity, and fill at least one subclass entity of the associated entity into the position of the second placeholder in the second character string to generate a target answer.

[0234] Optionally, if the target intent attribute is the comparison query, the target answer template includes a third character string with at least two third placeholders, and each of the third placeholders corresponds to a target parameter item of an associated entity;

[0235] If the target intent attribute is the comparison query, the generating submodule includes:

[0236] A first acquisition submodule is configured to acquire, for each of the associated entities, a target parameter value corresponding to a target parameter item of the associated entity;

[0237] The second filling submodule is configured to fill the target parameter value into the target position corresponding to the target parameter value in the third character string for each target parameter value to generate a target answer, wherein the target position corresponding to the target parameter value is the position of the third placeholder corresponding to the target parameter item to which the target parameter value belongs.

[0238] Optionally, if the target intent attribute is the reasoning type query, the target answer template includes a fourth character string with a fourth placeholder;

[0239] If the target intent attribute is the reasoning query, the generating submodule includes:

[0240] a sixth determination submodule, configured to determine a reasoning condition according to the intention information, wherein the reasoning condition is used to filter or sort entities;

[0241] A second acquisition submodule is configured to acquire a target parameter value corresponding to the target parameter item;

[0242] a seventh determination submodule, configured to determine a reasoning result according to the reasoning condition and the target parameter value;

[0243] The third filling submodule is configured to fill the inference result into the position where the fourth placeholder is located in the fourth character string to generate a target answer.

[0244] Optionally, a target parameter value corresponding to the target parameter item is obtained from a pre-generated knowledge graph parameter table, wherein the knowledge graph parameter table stores parameter values ​​corresponding to each of a plurality of parameter items.

[0245] Optionally, the device 40 further includes:

[0246] The fourth determination module is configured to determine the target answer string from a preset knowledge base as the target answer to the question text based on the associated entity and the intent information if the target answer template does not exist, and the preset knowledge base stores the correspondence between entities, intents, and answer strings.

[0247] 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.

[0248] The present disclosure also provides an answer generating device, comprising:

[0249] processor;

[0250] a memory for storing processor-executable instructions;

[0251] The processor is configured to execute the steps of the answer generation method provided by the present disclosure.

[0252] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, which implement the steps of the answer generation method provided by the present disclosure when the program instructions are executed by a processor.

[0253] Figure 5 8 is a block diagram of an answer generation device 800 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.

[0254] Reference Figure 5 , 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 interface 812 , a sensor component 814 , and a communication component 816 .

[0255] 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 answer generation 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.

[0256] 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.

[0257] 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.

[0258] 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.

[0259] 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.

[0260] The input / output interface 812 provides an interface between the processing component 802 and the peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0261] 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.

[0262] 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, 2G or 3G, 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.

[0263] 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-mentioned answer generation method.

[0264] 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 complete the above-mentioned answer generation 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.

[0265] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program executable by a programmable device, and the computer program has a code portion for executing the above-mentioned answer generation method when executed by the programmable device.

[0266] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

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

Claims

1. A method for generating an answer, characterized in that: The method comprises: In response to obtaining the question text, determining a target entity included in the question text; According to the question text and the target entity, determining the intention information of the question text by using a pre-generated first mapping relationship, wherein the first mapping relationship is used to indicate the correspondence between text, entity and intention; According to the associated entity and the intent information, using a pre-generated second mapping relationship, determining whether there is a target answer template associated with the target parameter item, the associated entity being the entity whose intent information is determined in the first mapping relationship, and the second mapping relationship being used to indicate a correspondence between an entity, an intent, and an answer template associated with a parameter item corresponding to the intent; If the target answer template exists, generate the target answer according to the target answer template and the target parameter items.

2. The method according to claim 1, characterized in that The step of determining the intention information of the question text based on the question text and the target entity by using a pre-generated first mapping relationship includes: According to the first mapping relationship, determining whether there is a target intent corresponding to the question text and the target entity; If the target intention exists, determining the target intention as the intention information; If the target intent does not exist, rewritten content is generated, and the intent information is determined based on the rewritten content and the first mapping relationship, where the rewritten content is obtained by modifying the question text and / or the target entity.

3. The method according to claim 2, characterized in that The generating the rewritten content and determining the intention information according to the rewritten content and the first mapping relationship includes: Generate the rewritten content of this modification according to the target modification method; Determining whether there is a target intent corresponding to the rewritten content of this modification according to the first mapping relationship; If the target intention exists, determining the target intention as the intention information; If the target intent does not exist, determine a new target modification method, and based on the new target modification method, re-execute the step of generating the rewritten content of this modification according to the target modification method and the step of determining whether there is a target intent corresponding to the rewritten content of this modification according to the first mapping relationship, until it is determined that the target intent exists or the number of times the rewritten content is generated reaches a preset number of times.

4. The method according to claim 3, characterized in that The target modification methods include: A first modification method for rewriting the question text; A second modification method for replacing a target entity in the question text with a first preset entity; A third modification method for rewriting the question text and replacing a target entity in the rewritten question text with a second preset entity; A fourth modification method for replacing at least two target entities in the question text with at least two third preset entities when the question text contains more than one target entity; A fifth modification method for rewriting the question text when the question text contains more than one target entity, and replacing at least two target entities in the rewritten question text with at least two fourth preset entities; A sixth modification method for using the fifth preset entity as a target entity; Among them, the first preset entity, the second preset entity, the third preset entity, and the fourth preset entity are entities on the path from the replaced target entity to the root entity in a pre-constructed entity hierarchy tree, and the fifth preset entity is determined by historical conversation information associated with the question text.

5. The method according to claim 1, characterized in that The step of generating a target answer according to the target answer template and the target parameter item includes: Determine a target intent attribute according to the intent information, wherein the target intent attribute is one of a parameter query, a comparison query, and an inference query; The target answer is generated according to the target answer template in accordance with the answer generation method corresponding to the target intention attribute.

6. The method according to claim 5, characterized in that If the target intent attribute is the parameter-type query, the target answer template includes a first string with a first placeholder; If the target intent attribute is the parameter query, generating the target answer according to the target answer template in the answer generation method corresponding to the target intent attribute includes: Determine the entity type of the associated entity, the entity type is a precise entity or a fuzzy entity, the precise entity represents an entity with a degree of 0 in a pre-constructed entity hierarchy tree, and the fuzzy entity represents an entity with a degree greater than 0 in the entity hierarchy tree; If the entity type of the associated entity is the precise entity, a target parameter value corresponding to the target parameter item is obtained, and the target parameter value is filled into the position of the first placeholder in the first character string to generate a target answer.

7. The method according to claim 6, characterized in that The method further comprises: If the entity type of the associated entity is the fuzzy entity, a second character string with at least one second placeholder is obtained, and at least one subclass entity of the associated entity is filled into the position of the second placeholder in the second character string to generate a target answer.

8. The method according to claim 5, characterized in that If the target intent attribute is the comparison query, the target answer template includes a third character string with at least two third placeholders, and each of the third placeholders corresponds to a target parameter item of an associated entity; If the target intent attribute is the comparison query, generating the target answer according to the target answer template in the answer generation method corresponding to the target intent attribute includes: For each of the associated entities, obtaining a target parameter value corresponding to the target parameter item of the associated entity; For each target parameter value, the target parameter value is filled into the target position corresponding to the target parameter value in the third character string to generate a target answer, wherein the target position corresponding to the target parameter value is the position of the third placeholder corresponding to the target parameter item to which the target parameter value belongs.

9. The method according to claim 5, characterized in that If the target intent attribute is the reasoning query, the target answer template includes a fourth character string with a fourth placeholder; If the target intent attribute is the reasoning query, generating the target answer according to the target answer template in the answer generation method corresponding to the target intent attribute includes: Determine an inference condition according to the intention information, where the inference condition is used to filter or sort entities; Obtaining a target parameter value corresponding to the target parameter item; Determining a reasoning result according to the reasoning condition and the target parameter value; Fill the inference result into the position of the fourth placeholder in the fourth character string to generate a target answer.

10. The method according to any one of claims 6, 8 and 9, characterized in that: Obtain a target parameter value corresponding to the target parameter item from a pre-generated knowledge graph parameter table, wherein the knowledge graph parameter table stores parameter values ​​corresponding to each of a plurality of parameter items.

11. The method according to claim 1, characterized in that: The method further comprises: If the target answer template does not exist, the target answer string is determined from a preset knowledge base based on the associated entity and the intent information as the target answer to the question text. The preset knowledge base stores the correspondence between entities, intents, and answer strings.

12. An answer generation device, characterized in that: The device comprises: A first determination module is configured to determine a target entity contained in the question text in response to obtaining the question text; A second determination module is configured to determine the intention information of the question text according to the question text and the target entity using a pre-generated first mapping relationship, wherein the first mapping relationship is used to indicate a correspondence between text, entity and intention; A third determination module is configured to determine whether there is a target answer template associated with a target parameter item based on the associated entity and the intent information using a pre-generated second mapping relationship, wherein the associated entity is an entity whose intent information is determined in the first mapping relationship, and the second mapping relationship is used to indicate a correspondence between an entity, an intent, and an answer template associated with a parameter item corresponding to the intent; The answer generation module is configured to generate a target answer according to the target answer template and the target parameter item if the target answer template exists.

13. An answer generation device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the answer generation method according to any one of claims 1 to 11.

14. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the method described in any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Method and device for generating Q&A statement

    CN108536818A

  • Method, system, medium and apparatus for automatically obtaining answers to health care questions

    CN109637674A

  • Intelligent response method and device and computer readable storage medium

    CN111324693A

  • Question and answer system and method based on knowledge graph, electronic equipment and storage medium

    CN113641813A

  • Question answering method and device based on knowledge graph

    CN114880480A