Question Answering Method, Device, Storage Medium and Question Answering Robot Based on Knowledge Graph

By identifying the entity and object-type attributes in the question and generating a multi-constrained multi-hop query diagram, the problem of insufficient accuracy in the problem of problem-answer systems in the prior art is solved, and accurate responses to problems with constraints and multi-hop relationships are achieved.

CN114357137BActive Publication Date: 2025-07-22ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210015302.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-07
Publication Date
2025-07-22
Estimated Expiration
2042-01-07

AI Technical Summary

Technical Problem

The existing knowledge graph-based Q&A system is difficult to accurately deal with complex problems with constraints and multiple-hop relationships, resulting in incorrect Q&A results and insufficient intelligent dialogue capabilities.

Method used

By identifying the constraint information of entity, object-type attributes and multi-hop attributes in the question, a multi-constraint multi-hop query diagram is generated, and a graph database is used to query to obtain accurate reply information.

Benefits of technology

Improve the accuracy of answering complex questions with constraints and multi-hop relationships, and can accurately identify and process multi-hop relationships and constraints, and generate accurate query diagrams to obtain correct answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114357137B_ABST
    Figure CN114357137B_ABST
Patent Text Reader

Abstract

The present application provides a question-answering method, device, storage medium, and question-answering robot based on a knowledge graph. The method of the present application can, for an input question sentence, not only identify the entities, first-level attributes, and first-level constraint information included in the question sentence, but also use the object-type attributes in the first-level attributes as second-level entities, identify the attributes of the second-level entities in the question sentence to obtain multi-hop attributes, and identify the constraint information of the multi-hop attributes in the question sentence to obtain multi-hop constraints; and generate a query graph including the entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints of the question sentence. For complex question sentences with both constraints and multi-hop relationships, it can generate a multi-constraint multi-hop query graph corresponding to the complex question sentence. Through the multi-constraint multi-hop query graph, accurate reply information corresponding to the complex question sentence can be queried, having the dialogue ability to handle complex questions with constraints and multi-hop relationships, and improving the reply accuracy of complex questions with constraints and multi-hop relationships.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to artificial intelligence technology, and in particular, to a question-answering method, device, storage medium, and question-answering robot based on a knowledge graph. Background Art

[0002] With the development of artificial intelligence, intelligent dialogue products such as intelligent customer service question-answering robots have dialogue capabilities such as task-based question-answering, frequently asked questions (FAQ) answering, and knowledge graph-based question-answering. They can, to a certain extent, replace humans to achieve question-answering services, reduce the labor cost of question-answering services, and improve the efficiency of question-answering services.

[0003] Currently, in the query graph designed for a knowledge graph-based question-answering system, entities, entity attributes, and constraints are defined, and entity attributes are used to describe entities. For complex questions with constraints and multi-hop relationships, the number of attributes and constraints involved is large and there are complex multi-hop relationships. It is easy to misidentify the multi-hop relationships and constraint attributes of the constraint conditions that appear in the questions, resulting in errors in multi-hop relationships and constraint attachment errors in the query graph, making the question-answering results incorrect and the intelligent dialogue ability insufficient. It is only applicable to single-handling single-relationship questions with constraints or questions with multi-hop relationships, but does not have the ability to handle complex questions with constraints and multi-hop relationships, and the answers to complex questions with constraints and multi-hop relationships are not accurate enough. Summary of the Invention

[0004] The present application provides a question-answering method, device, storage medium, and question-answering robot based on a knowledge graph.

[0005] On the one hand, the present application provides a question-answering method based on a knowledge graph, including:

[0006] In response to a question-answering request, according to the constructed graph database, identify the entities, first-level attributes, and first-level constraint information included in the input question sentence;

[0007] According to the type of the first-level attribute, if it is determined that there is an object-type attribute in the first-level attribute, use the object-type attribute in the first-level attribute as a secondary entity, identify the attributes of the secondary entity in the question sentence to obtain the multi-hop attributes of the entities included in the question sentence, and identify the constraint information of the multi-hop attributes in the question sentence to obtain the multi-hop constraints included in the question sentence;

[0008] According to the entities, the first-level attributes, and the first-level constraint information included in the question sentence, as well as the multi-hop attributes and the multi-hop constraints, generate a query graph corresponding to the question sentence, where the query graph includes the first-level constraint information, the multi-hop attributes, and the multi-hop constraints;

[0009] Query the graph database according to the query graph to determine the response information corresponding to the question sentence.

[0010] On the other hand, the present application provides an electronic device, including:

[0011] a processor, and a memory communicatively connected to the processor;

[0012] The memory stores computer-executable instructions;

[0013] The processor executes the computer-executable instructions stored in the memory to implement the above-mentioned question-answering method based on a knowledge graph.

[0014] On the other hand, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the above-mentioned question-answering method based on a knowledge graph.

[0015] On the other hand, the present application provides a question-answering robot, including:

[0016] an output device,

[0017] a processor, and a memory communicatively connected to the processor;

[0018] The memory stores computer-executable instructions;

[0019] The processor executes the computer-executable instructions stored in the memory to implement the above-mentioned question-answering method based on a knowledge graph.

[0020] The question-answering method, device, storage medium, and question-answering robot based on a knowledge graph provided by this application set object-type attributes. The object-type attributes themselves are also an entity and have their own attributes. The multi-hop relationship between entities and attributes can be reflected through the object-type attributes. For the input question sentence, it can not only identify the entities, first-level attributes, and first-level constraint information included in the question sentence, but also take the object-type attributes in the first-level attributes as second-level entities according to the object-type attributes in the first-level attributes, identify the attributes of the second-level entities in the question sentence, obtain the multi-hop attributes of the entities included in the question sentence, and identify the constraint information of the multi-hop attributes in the question sentence to obtain the multi-hop constraints included in the question sentence. It can accurately identify the multi-hop attributes and multi-hop constraints included in the question sentence and further generate a query graph including the entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints of the question sentence, which can avoid the situation of incorrect identification of multi-hop relationships and constraint attributes. That is, for complex question sentences with both constraints and multi-hop relationships, it can generate a multi-constraint multi-hop query graph corresponding to the complex question sentence. By performing graph query through the multi-constraint multi-hop query graph, the accurate reply information corresponding to the complex question sentence can be obtained, and it has the dialogue ability to handle complex questions with constraints and multi-hop relationships, which can improve the accuracy of the reply to complex questions with constraints and multi-hop relationships. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application.

[0022] Figure 1 It is an example diagram of a query graph provided by this application;

[0023] Figure 2 It is an example diagram of a constraint query graph provided by this application;

[0024] Figure 3 It is a flowchart of the question-answering method based on a knowledge graph provided by an embodiment of this application;

[0025] Figure 4 It is a flowchart of the question-answering method based on a knowledge graph provided by another embodiment of this application;

[0026] Figure 5 It is an example diagram of a basic query graph provided by an embodiment of this application;

[0027] Figure 6 It is an example diagram of a query graph with constraints provided by an embodiment of this application;

[0028] Figure 7 It is another example diagram of a basic query graph provided by an embodiment of this application;

[0029] Figure 8Another example diagram of a query graph with constraints provided by an embodiment of the present application;

[0030] Figure 9 An example diagram of the process for generating a multi-constraint multi-hop query graph provided by an embodiment of the present application;

[0031] Figure 10 An example diagram of an entity clarification page provided by an embodiment of the present application;

[0032] Figure 11 An example diagram of a constraint counter-question surface provided by an embodiment of the present application;

[0033] Figure 12 An example flowchart including entity clarification and constraint counter-questions provided by an embodiment of the present application;

[0034] Figure 13 A schematic structural diagram of a question-answering device based on a knowledge graph provided by an exemplary embodiment of the present application;

[0035] Figure 14 A schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application.

[0036] Through the above-mentioned drawings, specific embodiments of the present application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed implementation manners

[0037] Here, the exemplary embodiments will be described in detail, and their examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0038] First, the nouns involved in the present application are explained:

[0039] Query Graph: A sub-graph structure similar to a knowledge graph, which can be directly mapped into a semantic expression in a logical form, such as the graph query language SPARQL. By this means, semantic analysis is simplified into the process of generating a query graph and formalized into a phased search problem. Figure 1 As an example of a query graph, as Figure 1 shown, the query graph consists of four types of nodes: fixed entities (i.e., topic entities, Figure 1 represented by rounded rectangles inFigure 1 which is represented by a circle in the figure), Lambda variables (i.e., unknown variables, Figure 1 which is represented by a shaded circle in the figure), aggregation functions ( Figure 1 which is represented by a diamond in the figure). Inherent entities represent existing entities in the knowledge graph, corresponding to entities where the existential variables and Lambda variables are not fixed. Generally, the final answer is obtained by retrieving all entities that can be mapped to the Lambda variables. Here, the design of the aggregation function is used to perform functional operations on specific entities, usually capable of capturing some numerical features. Additionally, the nodes in the query graph are connected by edges, and the edges are labeled with predicates in the knowledge graph. Figure 1 An example of the structure of a possible query graph for the question "Who first voiced Actor M in Movie A?" is provided in the figure, as Figure 1 shown in the figure. Actor M and Movie A are two fixed entities, represented as Figure 1 two rounded rectangle nodes in the figure, Figure 1 and the circular node y in the figure indicates that there should be an intermediate entity in the figure to establish the connection relationship between the fixed entities and other entities. Figure 1 The shaded circular node x in the figure is also called the answer node, used to map the entity retrieved by the request. Figure 1 The diamond node argmin in the figure represents a constraint, indicating the minimum value, restricting that the answer must be the earliest actor to play this role.

[0040] Knowledge Based-Question Answering (KBQA for short): It answers users' questions based on the existing structured knowledge in the knowledge base. The structured knowledge in the knowledge base is usually represented in the form of triples, where a triple is represented as (subject, relation, object), and each triple is also called a fact. The most mainstream KBQA solution is the semantic parsing (SP) model. The specific approach is to transform natural language questions (utterances / queries) into machine-executable logical expressions through a certain semantic understanding architecture.

[0041] Multi-hop Complex Questions: In KBQA, according to the nature of the target question, it can be divided into two directions: the first is for simple questions, and the second is for complex questions opposite to them. The components of a simple question only contain a single relationship. Complex questions can be divided into two categories. One is a single-relationship question with constraints. For example, "Who was the first president of country X?" There is a simple relationship here, which is the president of country X. But there is also a constraint, "the first", that is, the condition "the first" needs to be satisfied. The other is a question with multi-hop relationships. For example, "Who is the wife of the founder of company Y?" There are two hops between the answer and company Y: one is the founder, and the other is the wife.

[0042] Multiple Constraint Query Graph (abbreviated as MultiCG): Based on the query graph, constraint types, operators are newly added, as well as type constraints, explicit and implicit time constraints, and the query graph is more systematically used to solve complex problems. Taking the question "Who was the first president of country X after 2000?" as an example, an example of a multiple constraint query graph generated is as Figure 2 shown. B is the basic query graph, the entity node is "countryX", the variable nodes are y0 and x, and there are two attribute edges, "officials" and "holders". {C1, C2, C3} are ordinal constraints parsed from the question. C1 = <President, Equal, y1>, C2 = <2000, <, y2>, C3 = <1, MaxAtN, y2>. By adding C1, C2, C3 in sequence, the multiple constraint query graph shown in Figure 2 is constructed.

[0043] In addition, the terms "first", "second", "third", etc. are only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. In the description of the following embodiments, "a plurality of" means more than two unless otherwise specifically defined.

[0044] Intelligent customer service Q&A robots are widely used intelligent dialogue products, and the main dialogue capabilities include task-based Q&A, FAQ Q&A, knowledge graph Q&A, and so on.

[0045] For a knowledge graph-based question answering system, the process of intelligent question answering is as follows: After the user sends a question answering request (for example, querying a 10-yuan 5G traffic package whose place of origin is Wuhan) to the question answering system (i.e., the question answering robot) through the client, the question answering system parses the question sentence given by the user through graph question answering to form a specific logical form (Logical Forms), such as a query graph; then the query graph is converted into a specific graph query statement (such as a query statement of a graph database query language like Sparql or Cypher), and then the graph database is queried and inferred to obtain the final answer and return it to the client.

[0046] Based on the analysis of historical customer service question answering data in a certain scenario and referring to the standards of question classification in the academic community, the types of problems that need to be solved by the KBQA question answering system of intelligent customer service are shown in Table 1 below:

[0047] Table 1

[0048]

[0049] The problem types in Table 1 can be combined into more complex problem types. For example, a multi-hop sentence may contain one or more constraint conditions, forming a multi-constraint multi-hop sentence.

[0050] Multi-hop questions and multi-constraint multi-hop questions belong to typical complex problems in the field of KBQA dialogue. Traditional question answering systems can usually only handle single-relation questions with constraints or multi-hop relation questions singly, but do not have the ability to handle complex problems with constraints and multi-hop relations. Their intelligent dialogue ability is insufficient, and the answers to complex problems with constraints and multi-hop relations are not accurate enough.

[0051] The knowledge graph-based question answering method provided by this application aims to solve the above technical problems of the prior art.

[0052] The knowledge graph-based question answering method provided by this application can target complex problems in various industries such as operators, taxation, and insurance, build a KBQA question answering engine for enterprise customers, and implement it in the real scenarios of the industries where the enterprises are located to form a KBQA question answering system applicable to various scenarios.

[0053] The technical solutions of this application and how the technical solutions of this application solve the above technical problems will be described in detail below with specific embodiments. These specific embodiments below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0054] Figure 3Flowchart of the question - answering method based on a knowledge graph provided by an embodiment of the present application. The question - answering method based on a knowledge graph provided by this embodiment can be specifically applied to electronic devices such as question - answering robots and question - answering systems. Such electronic devices can be terminal devices, servers, etc. This embodiment takes a question - answering robot as an example for illustrative purposes. In other embodiments, the electronic device can also be implemented using other devices, and specific limitations are not made here in this embodiment.

[0055] As Figure 3 shown, the specific steps of this method are as follows:

[0056] Step S101, in response to a question - answering request, based on the constructed graph database, identify the entities, first - level attributes, and first - level constraint information included in the input question sentence.

[0057] Among them, the constructed graph database is constructed for the current domain and stores all entity types, entity information, attribute types, attribute information, constraint condition information, operator information, etc. existing in the current domain. The graph database can be constructed based on the historical data of the current domain. The entity information of each entity can include which attributes each entity has, the type and value of the attributes, and can be specifically stored in the form of a graph to facilitate sorting out the attribute information of the entities.

[0058] When a user needs to ask a question to the question - answering robot, the user can send a question - answering request containing a question sentence to the question - answering robot. The question sentence included in the question - answering request is the question raised by the user.

[0059] Among them, the question sentence can be a complex question with both constraints and multi - hop relationships.

[0060] Exemplarily, if the question - answering robot is deployed on the server side, the user can input a question sentence through the client and trigger the client to send a question - answering request containing the question sentence to the server side. Among them, the way for the user to input a question sentence through the client can be through text input, voice interaction, etc., and specific limitations are not made here.

[0061] Exemplarily, if the question - answering robot is a physical robot, the user can directly send a question - answering request to the question - answering robot through the interaction device of the question - answering robot. For example, the user can directly have a voice interaction with the question - answering robot to ask a question; or, submit a question sentence through the display screen of the question - answering robot to trigger the question - answering robot to search for an answer.

[0062] In response to the question - answering request, the question - answering robot, based on the relevant data such as entities, entity types, attributes, attribute types, and constraints predefined or configured in the constructed graph database, identifies the entities, first - level attributes, and first - level constraint information included in the input question sentence.

[0063] In this embodiment, in order to distinguish the attributes of entities from multi-hop attributes, the attributes of entities are referred to as first-level attributes.

[0064] Step S102: According to the type of the first-level attributes, if it is determined that there are object-type attributes among the first-level attributes, then use the object-type attributes in the first-level attributes as second-level entities, identify the attributes of the second-level entities in the question sentence, obtain the multi-hop attributes of the entities included in the question sentence, and identify the constraint information of the multi-hop attributes in the question sentence to obtain the multi-hop constraints included in the question sentence.

[0065] In this embodiment, the type of attributes is increased by the object type. The object-type attribute itself is also an entity and has its own attributes. By setting the object-type attribute, the multi-hop relationship between different entities and attributes can be reflected. In order to distinguish it from the multi-hop attributes, in this embodiment, the attributes of the entities included in the question sentence are referred to as first-level attributes.

[0066] After identifying the entities, first-level attributes, and first-level constraint information included in the question sentence, in this step, the multi-hop attributes and multi-hop constraints included in the question sentence can be further identified.

[0067] In this embodiment, the attribute types configured in the graph database include the object type. The object-type attribute itself is an entity and has its own attributes. For example, taking the question sentence "the name of the shooting location of movie A" as an example, where "movie A" is the entity and has the attribute of "shooting location". This attribute is a location and itself is also an entity and has its own attributes. "Shooting location" is an object-type attribute.

[0068] In addition, the attribute types configured in the graph database can also include text, numerical value, date, boolean, list, etc., which can be set and adjusted according to the needs of the actual application scenario and are not specifically limited here.

[0069] In this step, according to the type of the first-level attributes included in the question sentence, the object-type attributes included in the question sentence can be determined. By using the object-type attributes in the first-level attributes as second-level entities and identifying the attributes of the second-level entities in the question sentence, the multi-hop attributes of the entities included in the question sentence can be identified.

[0070] After identifying the multi-hop attributes, the multi-hop constraints are obtained by identifying the constraint information of the multi-hop attributes included in the question sentence.

[0071] Step S103: Generate a query graph corresponding to the question sentence according to the entities, first-level attributes, and first-level constraint information included in the question sentence, as well as the multi-hop attributes and multi-hop constraints. The query graph includes the first-level constraint information, multi-hop attributes, and multi-hop constraints.

[0072] After identifying the entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints included in the question sentence, a query graph corresponding to the question sentence is generated. The query graph includes the entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints of the question sentence, and is a multi-constraint multi-hop query graph corresponding to the question sentence.

[0073] Step S104: Query the graph database according to the query graph to determine the reply information corresponding to the question sentence.

[0074] After generating a query graph that includes the entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints of the question sentence, that is, obtaining the multi-constraint multi-hop query graph corresponding to the question sentence, graph query can be performed according to this query graph and the graph database, and the reply information corresponding to the question sentence can be obtained.

[0075] The method provided by the embodiment of the present application sets object-type attributes. The object-type attribute itself is also an entity and has its own attributes. Through the object-type attribute, the multi-hop relationship between entities and attributes can be reflected. For the input question sentence, not only can the entities, first-level attributes, and first-level constraint information included in the question sentence be identified, but also according to the object-type attributes in the first-level attributes, the object-type attributes in the first-level attributes can be used as secondary entities, the attributes of the secondary entities in the question sentence can be identified, the multi-hop attributes of the entities included in the question sentence can be obtained, and the constraint information of the multi-hop attributes in the question sentence can be identified to obtain the multi-hop constraints included in the question sentence, which can accurately identify the multi-hop attributes and multi-hop constraints included in the question sentence; and further generate a query graph that includes the entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints of the question sentence, which can avoid the situation of incorrect identification of multi-hop relationships and constraint attributes. That is, for complex question sentences with both constraints and multi-hop relationships, a multi-constraint multi-hop query graph corresponding to the complex question sentence can be generated, and accurate reply information corresponding to the complex question sentence can be obtained through graph query of the multi-constraint multi-hop query graph, having the dialogue ability to handle complex questions with constraints and multi-hop relationships, and being able to improve the accuracy of the reply to complex questions with constraints and multi-hop relationships.

[0076] Figure 4 It is a flowchart of a question-answering method based on a knowledge graph provided by another embodiment of the present application. In the above Figure 3 On the basis of the corresponding embodiment, considering that the question sentence of a comparative sentence includes two different entities, and the question sentence of a non-comparative sentence usually includes one entity. In this embodiment, in response to a question-answering request, the sentence type of the input question sentence can be identified; if the question sentence is a comparative sentence, at least two different entities included in the question sentence, as well as the first-level attributes and first-level constraint information of the at least two different entities are identified; if the question sentence is not a comparative sentence, at least one entity included in the question sentence, as well as the first-level attributes and first-level constraint information of the at least one entity are identified.

[0077] Such as Figure 4As shown in the figure, the specific steps of this method are as follows:

[0078] Step S201: In response to the Q&A request, identify the sentence pattern type of the input question sentence.

[0079] In the actual application scenario, in a comparative sentence, semantically, it compares the differences in one attribute of two different entities. For example, "What is the difference between a general VAT invoice and a special VAT invoice?" Usually, a question sentence in a comparative sentence contains two entities, while a question sentence that is not a comparative sentence usually contains one entity.

[0080] In a parallel sentence, semantically, it compares the differences in two different attributes of one entity. For example, "How much can a children's accident insurance compensate at most? What is the maximum insured amount?" Usually, a parallel sentence contains one entity, and this entity contains multiple attributes.

[0081] In this embodiment, when identifying the entity and attribute of the question sentence, the sentence pattern type of the question sentence can be identified first. According to the number of entities and the number of attributes of the entities included in different sentence pattern types, the correct number of entities and attributes can be identified, which can improve the accuracy of the entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints included in the question sentence.

[0082] In this step, it can be identified whether the input question sentence is a comparative sentence or a parallel sentence.

[0083] An optionally implementation method for identifying whether the input question sentence is a comparative sentence or a parallel sentence is: training a sentence pattern classification model based on a large amount of corpus. Using the trained sentence pattern classification model, the question sentence can be classified and identified to determine the corresponding sentence pattern type of the question sentence.

[0084] For example, a TextCNN classification model can be trained. After training, the sentence pattern classification model is obtained to determine whether the question sentence belongs to one of a comparative sentence, a parallel sentence, and a common sentence pattern, so as to determine whether the question sentence is a comparative sentence or a parallel sentence. Among them, the common sentence pattern refers to other sentence patterns that are neither comparative sentences nor parallel sentences.

[0085] Another optionally implementation method for identifying whether the input question sentence is a comparative sentence or a parallel sentence is: both comparative sentences and parallel sentences have fixed patterns. The rule templates corresponding to comparative sentences and the rule templates corresponding to parallel sentences can be configured. By matching the question sentence with the rule templates, the sentence pattern type corresponding to the rule template that matches the question sentence is used as the sentence pattern type of the question sentence, so as to identify whether the question sentence is a comparative sentence or a parallel sentence.

[0086] In addition, any other method that can identify whether the question sentence is a comparative sentence or a parallel sentence can be adopted, or multiple different methods can be combined to implement the identification of whether the question sentence is a comparative sentence or a parallel sentence to improve the identification accuracy. Specific limitations are not made here.

[0087] Step S202: If the question sentence is a comparison sentence, identify at least two different entities included in the question sentence, as well as the first-level attributes and first-level constraint information of at least two different entities.

[0088] If it is determined in the above step S201 that the question sentence is a comparison sentence, the question sentence includes two different entities. When identifying the entities, first-level attributes, and first-level constraint information included in the question sentence, identify at least two different entities included in the question sentence, and further identify the first-level attributes and first-level constraint information of each identified entity.

[0089] Step S203: If the question sentence is not a comparison sentence, identify at least one entity included in the question sentence, as well as the first-level attributes and first-level constraint information of at least one entity.

[0090] If it is determined in the above step S201 that the question sentence is not a comparison sentence, the question sentence includes one entity. When identifying the entities, first-level attributes, and first-level constraint information included in the question sentence, identify at least one entity included in the question sentence, and further identify the first-level attributes and first-level constraint information of each identified entity.

[0091] In the above steps S202 and S203, the specific implementation methods for identifying the entities included in the question sentence are similar. The difference is that in the above step S202, it is necessary to ensure that at least two different entities included in the question sentence are identified, while in the above step S203, it is necessary to ensure that at least one entity included in the question sentence is identified.

[0092] When applied to the ToB scenario, the number of entities is small, the semantic differences between different entities are relatively large, and there is no cross of entities with the same name.

[0093] In this embodiment, all entity types, entity corresponding graph information, attribute types, attribute information, etc. in the current scenario can be stored in ElasticSearch. When identifying the entities included in the question sentence, rough recall can be performed among all entities in the current application scenario based on ElasticSearch to determine a candidate set; then, semantic similarity recognition is performed between the candidate entities in the candidate set and the question sentence to determine the entities included in the question sentence. Optionally, when identifying the entities included in the question sentence, rough recall can be performed among all entities in the current application scenario based on ElasticSearch to determine a candidate set; if the candidate set is empty, the entities included in the question sentence can be identified based on the method of semantic similarity matching.

[0094] Optionally, when performing rough recall based on ElasticSearch, the strategy of more_like_this (MLT) can be used to extract and analyze text from the input text to be queried (question sentence). Usually, the same similarity analyzer is used in the field, and then the top K phrases with the highest TF-IDF (term frequency–inverse document frequency) are selected to form a combined query statement of these phrases. The result returned based on the query statement is the similarity query result, and multiple entities appearing in the question sentence are obtained.

[0095] In an optional implementation manner of this embodiment, rough recall can be performed among all entities in the current application scenario based on ElasticSearch to determine a candidate set and the first confidence level of each candidate entity in the candidate set; based on the semantic similarity between the candidate entity in the candidate set and the question sentence and the first confidence level of the candidate entity, the second confidence level of the candidate entity is comprehensively determined, and the candidate entity with the second confidence level greater than the entity recognition confidence threshold is used as the entity included in the question sentence.

[0096] Optionally, after determining the candidate set by performing rough recall among all entities in the current application scenario based on ElasticSearch and based on the semantic similarity between the candidate entity in the candidate set and the question sentence, the semantic similarity can also be directly used as the second confidence level, and the candidate entity with the semantic similarity greater than the entity recognition confidence threshold is used as the entity included in the question sentence.

[0097] Among them, the entity recognition confidence threshold is set to a relatively low value, and more entities that may be included in the question sentence can be recognized. In subsequent steps, for each entity included in the recognized question sentence, a corresponding query graph is generated to obtain multiple query graphs; the optimal query graph is selected through the method of graph sorting as the query graph corresponding to the question sentence for graph query to determine the reply information corresponding to the question sentence.

[0098] In this implementation manner, it is necessary to ensure that at least two different entities included in the question sentence are recognized in step S202 above, and at least one entity included in the question sentence is recognized in step S203 above.

[0099] In addition, the entity recognition confidence threshold can be set and adjusted according to the actual application scenario, and no specific limitation is made here.

[0100] In another alternative implementation of this embodiment, rough recall is performed among all entities in the current application scenario based on ElasticSearch to determine a candidate set and the first confidence level of each candidate entity in the candidate set; then, based on the semantic similarity between the candidate entities in the candidate set and the question sentence and the first confidence level of the candidate entities, the second confidence level of the candidate entities is comprehensively determined, the candidate entities are sorted according to the second confidence level, and according to the sorting result, the entities included in the question sentence are determined.

[0101] In this implementation, in the above step S202, the first two candidate entities are used as the entities included in the question sentence according to the sorting result, and in the above step S203, the top-ranked candidate entity is used as the entity included in the question sentence according to the sorting result.

[0102] In addition, identifying the entities included in the question sentence can also be implemented by using any method for identifying the entities in the question sentence in existing intelligent question-and-answer methods, which will not be elaborated here.

[0103] In the above steps S202 and S203, after identifying the entities included in the question sentence, the specific implementation methods for identifying the first-level attributes included in the question sentence are similar. It should be noted that if the question sentence is not a comparison sentence, in the above step S203, if the question sentence is a parallel sentence and one entity has multiple first-level attributes, multiple first-level attributes of each entity need to be identified.

[0104] Optionally, when identifying the first-level attributes included in the question sentence, the identification result further includes the confidence level corresponding to the identified first-level attributes, which is referred to as the attribute identification confidence level in this application.

[0105] In this embodiment, identifying the first-level attributes included in the question sentence can be implemented by using at least one of the following methods:

[0106] The first method is: a property classification model is pre-trained using data in the current field, and the first-level attributes included in the input question sentence are identified through the property classification model. In this method, in the cold start stage, a large amount of training corpus for property classification in the current field is required for model training to obtain the property classification model.

[0107] The second method is: by matching the similarity between the question sentence and the configured property names, the first-level attributes included in the question sentence and the attribute identification confidence level corresponding to the first-level attributes are determined.

[0108] The third method is: combining the above two methods of property classification model and property similarity matching to determine the first-level attributes included in the question sentence, and the similarity between the question sentence and the first-level attributes can be used as the confidence level for the attribute identification of the first-level attributes.

[0109] In the third method, during the cold start phase, if there is no or only a small amount of training corpus for attribute classification, the first-level attributes included in the question can be identified based on the similarity between the question and the configured attributes. The attribute recognition confidence corresponding to the identified first-level attributes can be the similarity between the question and the first-level attributes, or it can be determined according to the third confidence of the attribute output by the attribute classification model and the similarity between the question and the first-level attributes.

[0110] After accumulating a large amount of training corpus for attribute classification and training a converged attribute classification model, the first-level attributes included in the question can be identified using the attribute classification model; alternatively, the first-level attributes included in the question can also be determined by combining the recognition result of the attribute classification model and the similarity between the question and the configured attributes.

[0111] Optionally, all entity types, entity information, attribute types, attribute information, etc. in the current scenario can be stored in ElasticSearch. When identifying the first-level attributes included in the question, a rough recall can be first performed among all attributes in the current application scenario based on ElasticSearch to determine an attribute candidate set; then, based on the above three methods for identifying the first-level attributes included in the question, the first-level attributes included in the question are determined from the candidate attributes in the attribute candidate set.

[0112] Optionally, when identifying the first-level attributes included in the question, a rough recall can be performed among all attributes in the current application scenario based on ElasticSearch to determine an attribute candidate set; if the attribute candidate set is empty, the above three methods for identifying the first-level attributes included in the question are used to determine the first-level attributes included in the question.

[0113] Optionally, when performing a rough recall based on ElasticSearch, the strategy of most similar text query (more_like_this, MLT) can be used.

[0114] In addition, identifying the first-level attributes included in the question can also be implemented using any method for identifying attributes in existing intelligent question answering methods, which will not be elaborated here.

[0115] In this embodiment, when identifying the first-level constraint information included in the question, three methods of regular matching, fuzzy factor word matching, and similarity matching are used to identify the constraint conditions included in the question; and the operator corresponding to the constraint condition is identified through keyword matching to obtain the first-level constraint information included in the question. Among them, the constraint information includes constraint conditions and operators.

[0116] Among them, regular matching is applied to text types, custom types, and types with a certain pattern. Types with a certain pattern can be information types with a specific pattern such as time, or custom specific patterns of information, such as "tariff 5 yuan", etc.

[0117] The fuzzy factor word matching mainly matches words such as "cheap" and "low traffic" that are uncertain in the current field, and converts them into corresponding constraint conditions and operators.

[0118] The similarity matching mainly targets the sub-attributes of composite attributes (such as CVT attributes). The attribute values are relatively long. By performing similarity matching between the sub-attribute values and the question sentence, the composite attributes are identified, and the constraint conditions and operators are determined.

[0119] Among them, a composite attribute refers to an attribute that contains multiple sub-attributes, and is also called a CVT attribute. For example, the "size chart" is a composite attribute, which contains multiple sub-attributes such as "height" and "weight".

[0120] Optionally, when identifying the first-level constraint information included in the question sentence, the recognition result also includes the confidence level of the identified constraint information, which is referred to as the constraint recognition confidence level in this application.

[0121] Optionally, all data such as entity types, entity information, attribute types, attribute information, constraint conditions, and operators in the current scenario can be stored in ElasticSearch. When identifying the first-level constraint information included in the question sentence, a rough recall can be first performed based on ElasticSearch in the constraint conditions and operators in the current application scenario to determine a condition candidate set and an operator candidate set; then, based on the condition candidate set and the operator candidate set, the first-level constraint information included in the question sentence is further identified.

[0122] Optionally, when identifying the first-level constraint information included in the question sentence, a rough recall can be first performed based on ElasticSearch in the constraint conditions and operators in the current application scenario to determine a condition candidate set and an operator candidate set; if the condition candidate set is empty or the operator candidate set is empty, three methods of regular matching, fuzzy factor word matching, and similarity matching can be used to identify the first-level constraint conditions included in the question sentence.

[0123] Optionally, when performing a rough recall based on ElasticSearch, the strategy of most similar text query (more_like_this, MLT) can be used.

[0124] In addition, identifying the first-level constraint information included in the question sentence can also be implemented by using any method of identifying the constraint conditions and operators in the existing intelligent question-answering methods, which will not be elaborated here.

[0125] Through the above steps S201 - S203, in response to the question-answering request, according to the constructed graph database, the entities, first-level attributes, and first-level constraint information included in the input question sentence are identified.

[0126] Step S204: Identify the multi-hop attributes and multi-hop constraints included in the question according to the object-type attributes included in the first-level attributes.

[0127] Among them, the object-type attribute is an entity with its own attributes. The multi-hop attribute refers to the attribute of the object-type attribute, and the multi-hop constraint refers to the constraint information of the multi-hop attribute.

[0128] In this embodiment, not only can the entities, first-level attributes, and first-level constraint information included in the question be identified, but also the multi-hop attributes and multi-hop constraints included in the question can be identified.

[0129] In this step, the specific way to identify the multi-hop attributes included in the question can be implemented as follows:

[0130] According to the type of the first-level attributes included in the question, if it is determined that there are object-type attributes in the first-level attributes, then the object-type attributes in the first-level attributes are used as the secondary entities; according to the graph database, identify the attributes of the secondary entities included in the question to obtain the multi-hop attributes included in the question.

[0131] Exemplarily, taking the question "the name of the filming location of movie A" as an example, it can be identified that the entity included in the question is: "movie A", and the attribute is "filming location", which is an object-type attribute. Take the filming location of movie A as the secondary entity, and perform a similarity match between the question and the attributes of the filming location of movie A, and it can be determined that the attribute included in the question is the attribute of the filming location of movie A: "name", to obtain the multi-hop attribute. Use the multi-hop attribute as the final answer attribute, and the value of the multi-hop attribute as the final answer.

[0132] Optionally, use the object-type attributes in the first-level attributes as the secondary entities; according to the graph database, identify the attributes of the secondary entities included in the question, and the obtained multi-hop attributes are the secondary attributes. For the secondary attributes, if there are object-type attributes in the secondary attributes, the object-type attributes in the secondary attributes can also be used as the tertiary entities; according to the graph database, identify the attributes of the tertiary entities included in the question to obtain the tertiary attributes, and so on to obtain multi-level multi-hop attributes. The multi-hop attributes include: secondary attributes, tertiary attributes, quaternary attributes... For relatively simple application scenarios, usually identifying the secondary attributes can meet the requirements. For complex application scenarios, the number of levels of multi-hop attributes to be identified can also be set and adjusted according to the actual application scenario requirements, and no specific limitation is made here.

[0133] Furthermore, according to the graph database, identify the constraint information of the multi-hop attributes included in the question to obtain the multi-hop constraints. The specific implementation method of identifying the multi-hop constraints is similar to the implementation method of identifying the first-level constraint information included in the question in the above steps S202 and S203, except that the constraint attributes are different, and details are not described here.

[0134] Optionally, after identifying the entities, first-level attributes, and multi-hop attributes included in the question, the first-level constraint information and multi-hop constraints included in the question can be identified.

[0135] Step S205: Generate a basic query graph for each entity according to the entities and first-level attributes included in the question. The basic query graph includes the corresponding entity and the first-level attributes of the corresponding entity.

[0136] After identifying the entities and first-level attributes included in the question, through this step, a basic query graph for each entity is generated. This basic query graph does not include constraints and multi-hop relationships.

[0137] In this step, generating the corresponding basic query graph according to the entities and first-level attributes included in the question can be implemented by any method in the prior art for constructing a query graph that does not include constraints and multi-hop relationships based on the entities and attributes of the question, which will not be elaborated here.

[0138] Step S206: Add the first-level constraint information, multi-hop attributes, and multi-hop constraints related to the corresponding entity to the basic query graph to generate a multi-constraint multi-hop query graph for each entity.

[0139] After constructing the basic query graph for each entity, by adding the first-level constraint information, multi-hop attributes, and multi-hop constraints to the basic query graph, a multi-constraint multi-hop query graph for each entity is generated.

[0140] Optionally, in this step, the multi-hop attributes can be added to the basic query graph first, and then the first-level constraint information and multi-hop constraints can be attached to obtain the corresponding multi-constraint multi-hop query graph.

[0141] Optionally, in this step, the first-level constraint information can be attached to the basic query graph first to obtain the first query graph; then the multi-hop attributes are added to the first constraint graph to obtain the second query graph; then the multi-hop constraints are attached to the second query graph to obtain the corresponding multi-constraint multi-hop query graph.

[0142] For the process of attaching constraints, mainly identify which attribute the constraint condition matches, determine the constraint attribute corresponding to the constraint condition, and attach the constraint information (first-level constraint information or multi-hop constraint) to the corresponding query graph with the constraint attribute as the edge to obtain a query graph including constraints.

[0143] Exemplarily, it can be attached to the corresponding node according to the similarity between the constraint condition and the root node attribute and multi-hop node attribute of the query graph.

[0144] For example, taking the question "Where is the pre-sale registration entrance for Double Eleven?" as an example, the identified entity is "Double Eleven". There are multiple registration entrances for the entity type "big promotion event" to which "Double Eleven" belongs, and different registration entrances have different participation methods. The registration entrance belongs to a composite attribute (CVT attribute), and a basic query graph (denoted as BG) as shown in Figure 5 within the dotted box in the figure is generated. Through this CVT attribute of the registration entrance, the values under the gameplay type are found, the constraint condition of "pre-sale" is matched, and then the default character operator Equal is selected to mount the first-level constraint information to construct a constraint graph, obtaining a constrained query graph as shown in Figure 6 . In Figure 6 , BG represents the basic query graph, and CG represents the constraint. Additionally, if the attribute of the entity "Double Eleven" is an ordinary attribute (non-composite attribute), such as "package logistics category", then a basic query graph as shown in Figure 7 is generated.

[0145] For example, taking the question "How much traffic does a cheaper fast food package have?" as an example, the identified entity is "fast food package". The first-level attribute of "fast food package" is "tariff standard: traffic". The tariff standard is a composite attribute, including sub-attributes such as "traffic" and "tariff". The traffic of fast food packages with different tariff standards is different. By performing fuzzy factor word matching on "cheaper", it is mapped into the constraint condition "8 yuan", the operator "less than", and the corresponding constraint attribute "tariff standard: tariff". After constraint mounting, a constraint graph as shown in Figure 8 is generated. Figure 8 In it, BG represents the basic query graph, and CG represents the constraint.

[0146] For example, for the multi-hop complex question: "In movie C, where is the hotel booked by character D in Sanya?", the identified entity is "movie C". The first-level attribute of "movie C" is "movie filming location: hotel name". Among them, "movie filming location" is a composite attribute, and "hotel name" is a sub-attribute of "movie filming location". According to the entity and first-level attribute of this question, a basic query graph as shown in Figure 9 is generated. The identified first-level constraint information in the question is: the constraint attribute is "city", and the constraint value is "Sanya". Mount the first-level constraint information to the basic query graph as shown in Figure 9 , obtaining a constrained query graph as shown in Figure 9 . The identified multi-hop attribute in the question is "address". Add the multi-hop attribute to the constrained query graph as shown in Figure 9 , obtaining a constrained multi-hop query graph as shown in Figure 9 . The identified multi-hop constraint is: "star rating = Max", where Max represents the maximum value. Mount the multi-hop constraint to the constrained multi-hop query graph as shown in Figure 9 , obtaining a constrained multi-hop query graph as shown in Figure 9The multi-constraint multi-hop query graph shown in Figure 9 Based on the multi-constraint multi-hop query graph shown in Figure 9 In

[0147] It should be noted that the multi-constraint multi-hop query graph generated in step S206 refers to the query graph with the first-level constraint information, multi-hop attributes, and multi-hop attributes included in the question added. If the question does not contain any constraints and multi-hop attributes, there is no need to go through the processing of step S206, and no multi-constraint multi-hop query graph will be generated. If the question does not contain constraints or does not contain multi-hop attributes, the query graph obtained after the processing of step S206 may not contain constraints or multi-hop relationships. To distinguish it from the basic query graph, the query graph obtained after the processing of step S206 is also called a multi-constraint multi-hop query graph. The multi-constraint multi-hop query graph in this embodiment refers to the query graph obtained after adding constraints and multi-hop attributes in step S206. There is no specific limitation on whether the query graph contains constraints and multi-hop attributes, and the number of multi-hop attributes and constraints included.

[0148] In addition, the appendix provided in this embodiment Figure 5-9 In

[0149] After generating the multi-constraint multi-hop query graph corresponding to each entity, through steps S207 - S209, according to the basic query graph and the multi-constraint multi-hop query graph corresponding to each entity, the query graph corresponding to the question is determined.

[0150] If the number of entities included in the question identified in step S203 is equal to 1, through the processing of subsequent steps S204 - S206, 1 basic query graph and 1 multi-constraint multi-hop query graph can be obtained, and the optimal 1 query graph corresponding to the question can be determined through the processing of steps S207 and S209; alternatively, the multi-constraint multi-hop query graph can also be preferentially used as the optimal query graph corresponding to the question.

[0151] Step S207, according to the confidence levels of the entities, first-level attributes, and first-level constraint information included in the question, as well as the confidence levels of the multi-hop attributes and multi-hop constraints, perform graph sorting on the basic query graphs and multi-constraint multi-hop query graphs corresponding to all entities to obtain a graph sorting result.

[0152] Optionally, according to the confidence of entities, the confidence of first-level attributes, the confidence of first-level constraint information, the confidence of multi-hop attributes, and the confidence of multi-hop constraints included in each query graph (including basic query graphs and multi-constraint multi-hop query graphs), comprehensively calculate the confidence of each query graph; sort all query graphs corresponding to entities (including basic query graphs and multi-constraint multi-hop query graphs) according to the confidence of each query graph to obtain the result of graph sorting.

[0153] Optionally, according to the confidence of entities, the confidence of first-level attributes, the confidence of first-level constraint information, the confidence of multi-hop attributes, and the confidence of multi-hop constraints included in each query graph (including basic query graphs and multi-constraint multi-hop query graphs), comprehensively calculate the confidence of each query graph, and use NDCG (Normalized Discounted Cumulative Gain) as the loss function to calculate the confidence loss value of the query graph. Sort all query graphs according to the confidence loss value of the query graph to obtain the result of graph sorting. The smaller the confidence loss value, the higher the confidence of the query graph, and the better the query graph.

[0154] Optionally, according to the confidence of entities, the confidence of first-level attributes, the confidence of first-level constraint information, the confidence of multi-hop attributes, and the confidence of multi-hop constraints included in each query graph, as well as the pre-set weight values corresponding to entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints respectively, perform weighted averaging on the confidence of entities, first-level attributes, first-level constraint information, multi-hop attributes, and multi-hop constraints included in the query graph to obtain the confidence of the query graph.

[0155] Step S208: If the question sentence is a comparison sentence, determine two query graphs corresponding to the question sentence according to the graph sorting result.

[0156] Step S209: If the question sentence is not a comparison sentence, determine one query graph corresponding to the question sentence according to the graph sorting result.

[0157] In this embodiment, by using a lower entity recognition confidence threshold when identifying entities included in the question sentence, a larger number of entities can be identified, so that more query graphs can be generated. The optimal query graph corresponding to the question sentence is selected through graph sorting, and the reply information of the question sentence is obtained through graph query based on the optimal query graph, which can improve the accuracy of question answering.

[0158] If the number of entities included in the question sentence identified in the above step S202 is greater than 2, through the processing of subsequent steps S204 - S206, multiple basic query graphs and multiple multi-constraint multi-hop query graphs can be obtained. Through the processing of step S207 and step S208, the two optimal query graphs corresponding to the question sentence are obtained.

[0159] If the number of entities included in the question sentence identified in step S203 is greater than 1, through the processing of subsequent steps S204 - S206, multiple basic query graphs and multiple multi - constraint multi - hop query graphs can be obtained. Through the processing of step S207 and step S209, an optimal query graph corresponding to the question sentence is obtained.

[0160] If the number of entities included in the question sentence identified in step S202 above is equal to 2, through the processing of subsequent steps S204 - S206, 2 basic query graphs and 2 multi - constraint multi - hop query graphs can be obtained. Through the processing of step S207 and step S208, two optimal query graphs corresponding to the question sentence can be determined; or, two multi - constraint multi - hop query graphs can be preferentially used as the two optimal query graphs corresponding to the question sentence.

[0161] Step S210: Query the graph database according to the query graph to determine the response information corresponding to the question sentence.

[0162] After determining the query graph corresponding to the question sentence, convert the query graph into a graph query statement; query the graph database according to the graph query statement to obtain the response information corresponding to the question sentence.

[0163] Exemplarily, in this step, the query graph corresponding to the question sentence can be converted into a graph query statement of an executable query language of the graph database, and the graph query statement is executed based on the API provided by the graph database, so that the response information corresponding to the question sentence can be queried from the graph database.

[0164] For example, the graph database can adopt Neo4j, and the corresponding executable query language is Cypher. By converting the query graph into a Cypher query statement of Neo4j and executing the Cypher query statement based on the Neo4j API, the response information can be queried from Neo4j. For a multi - constraint multi - hop query graph, during the process of converting the query graph into a Cypher query statement of Neo4j, when assembling the Cypher statement, the corresponding multi - hop nodes and multi - hop edges will be assembled to support the execution of multi - hop query answers. Based on the Neo4j Cypher syntax, the multi - constraint multi - hop query graph is converted into a query statement based on Cypher, executed in the Neo4j graph database, and the answer is obtained, enabling the question - answering robot to have the ability to answer multi - hop complex questions.

[0165] The embodiment of the present application expands entity types and edge types (i.e., attribute types) on the basis of a multi-constraint query graph, adds object-type attributes, can realize the recognition of multi-hop attributes, and adds multi-hop nodes and multi-hop edges in the query graph. When constraints are mounted, it can identify whether the constraint edge belongs to a root entity node or a multi-hop node, and constructs a multi-constraint query graph (referred to as a multi-constraint multi-hop query graph in this embodiment) that supports multi-hop question and answer. A constraint edge recognition scheme based on similarity matching is added to identify constraint edges, and first-level constraint information, multi-hop attributes and multi-hop constraints can be added to the basic query graph, thereby improving the accuracy of the identified multi-constraint multi-hop query graph; further, by converting the multi-constraint multi-hop query graph into a graph query statement, the answer information of the question can be obtained by executing the graph query statement in the graph database, so that the question and answer robot has the ability to handle complex multi-hop problems with constraints.

[0166] In an optional implementation of this embodiment, a processing flow of entity clarification and / or constraint questioning may be added.

[0167] When a question does not contain a clear entity but only an entity type, or a unique entity cannot be determined based on the current information of the question, multiple entities will be recalled when querying the graph database according to the query graph. At this time, entity clarification is required and the user must select an accurate entity. Therefore, a list of recalled entities is output for the user to choose.

[0168] Optionally, if a process for entity clarification is added, step S210 may be implemented in the following manner:

[0169] According to the query graph, a graph database is queried. For any entity node contained in the query graph, if multiple entities matching the entity node are queried, multiple entities are output, wherein the entity node includes a root node and a multi-hop node; according to the selected entity from the multiple entities, the query graph is updated; according to the updated query graph, the graph database is queried to determine the answer information corresponding to the question.

[0170] Optionally, while outputting multiple entities, entity clarification words may be output to prompt the user to select an entity from the multiple entities output.

[0171] The root node refers to the entity node corresponding to the entity, and the multi-hop node refers to the entity node except the root node.

[0172] The entity node to be clarified in the query graph refers to an entity node for which multiple entities matching the entity node are queried, and the unique entity corresponding to the entity node cannot be determined. Entity clarification is required to determine the entity corresponding to the entity node.

[0173] If the query graph contains multiple entity nodes to be clarified, start from the root node and clarify each entity node to be clarified in turn. If the query graph contains multiple entity nodes to be clarified, including both the root node and multi-hop nodes, the root node is clarified first, and then the multi-hop nodes are clarified.

[0174] Exemplarily, taking the question "What is the hometown of the star of the XX movie?" as an example, it can be recognized that the entity "XX movie" is included in this question. This entity has an object-type attribute "star", which is also an entity, corresponding to a multi-hop node. The query graph corresponding to this question contains a root node corresponding to the entity "XX movie" and a multi-hop node corresponding to the entity "star". If "XX movie" is a series of multiple movies, including three movies named "XX First", "XX Second", and "XX Third". Each movie has multiple actors. Therefore, both the root node and the multi-hop node need to be clarified. First, through the Figure 10 page shown, output three entities that match the root node: "XX First", "XX Second", and "XX Third", as well as the entity clarification statement "Which movie do you want to inquire about?" As shown in Figure 10 , if the user selects "XX First", then determine that the entity corresponding to the root node is "XX First", and update the query graph. According to the query graph updated this time, assume that the stars of "XX First" obtained by querying include: "Actor E", "Actor F", and "Actor G". Through the Figure 10 page shown, output three entities that match the multi-hop node: "Actor E", "Actor F", and "Actor G", as well as the entity clarification statement "Which actor do you want to inquire about?" As shown in Figure 10 , if the user selects "Actor E", then determine that the entity corresponding to this multi-hop node is "Actor G", and update the query graph again. According to the query graph updated again, the hometown of the star "Actor G" of "XX First" can be queried to obtain the reply information corresponding to the question.

[0175] Optionally, if the processing flow of adding constraint counter-questions is added, step S210 can be specifically implemented in the following manner:

[0176] Query the graph database according to the query graph. For any constraint condition included in the query graph, if the constraint attribute of the constraint condition is a composite attribute, and the constraint value of the constraint condition lacks the value of at least one sub-attribute of the composite attribute, generate a constraint counter-question statement, which is used to prompt the input of the value of at least one sub-attribute; update the constraint condition in the query graph according to the input value of at least one sub-attribute; query the graph database according to the updated query graph to determine the reply information corresponding to the question.

[0177] Among them, a composite attribute refers to an attribute that contains multiple sub-attributes, also known as a CVT attribute. For example, "size chart" is a composite attribute that contains multiple sub-attributes such as "height" and "weight".

[0178] For any constraint condition, if the constraint attribute of the constraint condition is a composite attribute, the constraint value of the constraint condition should include the values of all sub-attributes of the composite attribute in order to clarify the constraint content of the constraint condition. If the value of any sub-attribute is missing, the constraint content of the constraint condition is unclear and an exact query result cannot be obtained. Therefore, constraint interrogation is required to determine the values of all sub-attributes of the constraint attribute of the constraint condition and clarify the constraint content of the constraint condition.

[0179] Exemplarily, if it is determined that the constraint attribute of the constraint condition is a composite attribute and the constraint value of the constraint condition is missing the value of at least one sub-attribute of the composite attribute, a constraint interrogation statement can be generated, and the constraint interrogation statement is used to prompt the need to input the value of the missing at least one sub-attribute. After the user inputs the value of the missing at least one sub-attribute, the constraint condition in the query graph is updated.

[0180] For example, taking the composite attribute "size chart" that contains the sub-attributes "height" and "weight" as an example, if the constraint attribute of a constraint condition in the query graph is "size chart", the constraint value contains "height 160cm", and the constraint value is missing the value of the sub-attribute "weight", it can be passed through Figure 11 The page shown outputs the constraint interrogation statement "What is your weight?" After the user inputs the weight value, the constraint condition in the query graph is updated to achieve the clarification of the constraint condition, and the graph query continues according to the updated query graph, and the reply information is output.

[0181] Exemplarily, if entity clarification and constraint interrogation are added at the same time, as Figure 12 shown, step S210 can be specifically implemented by the following steps:

[0182] Step S2101: Query the graph database according to the query graph.

[0183] Step S2102: Determine whether to perform entity clarification.

[0184] In this step, according to the graph query result of step 2101, for any entity node included in the query graph, if multiple entities matching the entity node are queried, after performing step S2103 for entity clarification, step S2101 is executed, and the graph database is queried according to the updated query graph.

[0185] In this step, according to the graph query result of step 2101, if the number of entities matching each entity node is less than 2, entity clarification is not required, and step S2104 is continued to be executed.

[0186] Step S2103: Output multiple entities that match the entity node, and update the query graph according to the selected entity among the multiple entities.

[0187] In this embodiment, the entity node includes the root node corresponding to the entity and the multi-hop nodes corresponding to the multi-hop attributes.

[0188] Among them, the root node refers to the entity node corresponding to the entity, and the multi-hop node refers to the entity node other than the root node.

[0189] The entity node to be clarified in the query graph refers to the entity node for which multiple matching entities are queried, and the unique entity corresponding to this entity node cannot be determined. It is necessary to determine the entity corresponding to this entity node through entity clarification.

[0190] If the query graph contains multiple entity nodes to be clarified, the clarification process is performed on each entity node to be clarified in turn starting from the root node. If the query graph contains multiple entity nodes to be clarified that include both the root node and the multi-hop nodes, the root node is clarified first, and then the multi-hop nodes are clarified.

[0191] Step S2104: Determine whether to perform a constraint counter-question.

[0192] For any constraint condition, if the constraint attribute of the constraint condition is a composite attribute, the constraint value of this constraint condition should include the values of all sub-attributes of this composite attribute in order to clarify the constraint content of this constraint condition. If any sub-attribute value is missing, the constraint content of this constraint condition is not clear and an exact query result cannot be obtained. Therefore, it is necessary to perform a constraint counter-question to determine the values of all sub-attributes of the constraint attribute of this constraint condition and clarify the constraint content of this constraint condition.

[0193] Among them, the composite attribute refers to an attribute that contains multiple sub-attributes, and is also called a CVT attribute. For example, "size chart" is a composite attribute, which contains multiple sub-attributes such as "height" and "weight".

[0194] In this step, according to the graph query result of step 2101, for any constraint condition included in the query graph, if the constraint attribute of the constraint condition is a composite attribute and the constraint value of the constraint condition is missing the value of at least one sub-attribute of the composite attribute, then step S2105 is executed to perform a constraint counter-question.

[0195] In this step, according to the graph query result of step 2101, if there is no constraint condition in the query graph whose constraint attribute is a composite attribute and the constraint value is missing the value of at least one sub-attribute of the composite attribute, then there is no need to perform a constraint counter-question, and the query result contains a definite reply message. Step S2106 is executed to output the reply message.

[0196] Step S2105: Generate constrained rhetorical questions, which are used to prompt the values of at least one sub-attribute missing in the input constraint conditions; update the constraint conditions in the query graph according to the values of at least one sub-attribute in the input.

[0197] Exemplarily, if it is determined that the constraint attribute of the constraint condition is a composite attribute and the constraint value of the constraint condition is missing the values of at least one sub-attribute of the composite attribute, then constrained rhetorical questions can be generated, which are used to prompt the values of at least one missing sub-attribute to be input. After the user inputs the values of at least one missing sub-attribute, update the constraint condition in the query graph.

[0198] Step S2106: Output response information corresponding to the question sentence.

[0199] The solution provided by the embodiments of the present application supports entity clarification and constrained rhetorical questions, facilitating the accurate provision of answers to users, making the question-and-answer robot more intelligent and the provided response information more accurate.

[0200] Figure 13 It is a schematic structural diagram of a question-and-answer device based on a knowledge graph provided by an exemplary embodiment of the present application. The question-and-answer device based on a knowledge graph provided by the embodiments of the present application can execute the processing flow provided by the embodiments of the question-and-answer method based on a knowledge graph. As Figure 13 shown, the question-and-answer device 130 based on a knowledge graph includes: a first recognition module 1301, a second recognition module 1302, a query graph generation module 1303, and a graph query module 1304.

[0201] Specifically, the first recognition module 1301 is configured to, in response to a question-and-answer request, recognize the entities, first-level attributes, and first-level constraint information included in the input question sentence according to the constructed graph database.

[0202] The second recognition module 1302 is configured to, according to the type of the first-level attribute, if it is determined that there is an object-type attribute in the first-level attributes, use the object-type attribute in the first-level attributes as a second-level entity, recognize the attributes of the second-level entity in the question sentence, obtain the multi-hop attributes of the entities included in the question sentence, and recognize the constraint information of the multi-hop attributes in the question sentence to obtain the multi-hop constraints included in the question sentence.

[0203] The query graph generation module 1303 is configured to generate a query graph corresponding to the question sentence according to the entities, first-level attributes, and first-level constraint information included in the question sentence, as well as the multi-hop attributes and multi-hop constraints. The query graph includes first-level constraint information, multi-hop attributes, and multi-hop constraints.

[0204] The graph query module 1304 is configured to query the graph database according to the query graph to determine the response information corresponding to the question sentence.

[0205] Optionally, the first recognition module is further configured to: in response to a question-and-answer request, recognize the sentence type of the input question sentence; if the question sentence is a comparison sentence, recognize at least two different entities included in the question sentence, and the first-level attributes and first-level constraint information of the at least two different entities; if the question sentence is not a comparison sentence, recognize at least one entity included in the question sentence, and the first-level attributes and first-level constraint information of the at least one entity.

[0206] Optionally, the query graph generation module is further configured to: generate a basic query graph corresponding to each entity according to the entities and first-level attributes included in the question sentence, where the basic query graph includes the corresponding entity and the first-level attributes of the corresponding entity; add the first-level constraint information, multi-hop attributes, and multi-hop constraints related to the corresponding entity to the basic query graph to generate a multi-constraint multi-hop query graph corresponding to each entity; determine the query graph corresponding to the question sentence according to the basic query graph and the multi-constraint multi-hop query graph corresponding to each entity.

[0207] Optionally, the query graph generation module is further configured to: perform graph sorting on the basic query graphs and multi-constraint multi-hop query graphs corresponding to all entities according to the confidence levels of the entities, first-level attributes, and first-level constraint information included in the question sentence, as well as the confidence levels of the multi-hop attributes and multi-hop constraints, to obtain a graph sorting result; if the question sentence is a comparison sentence, determine two query graphs corresponding to the question sentence according to the graph sorting result; if the question sentence is not a comparison sentence, determine one query graph corresponding to the question sentence according to the graph sorting result.

[0208] Optionally, the question-and-answer device based on the knowledge graph may further include:

[0209] An entity clarification module, configured to: query a graph database according to the query graph, and for any entity node included in the query graph, if multiple entities matching the entity node are queried, output the multiple entities, where the entity node includes a root node and multi-hop nodes, the root node refers to the entity node corresponding to the entity, and the multi-hop node refers to an entity node other than the root node; update the query graph according to the selected entity among the multiple entities.

[0210] The graph query module is further configured to: query the graph database according to the updated query graph to determine the reply information corresponding to the question sentence.

[0211] Optionally, the question-and-answer device based on the knowledge graph may further include:

[0212] A constraint rhetorical question module, configured to: query a graph database according to the query graph, and for any constraint condition included in the query graph, if the constraint attribute of the constraint condition is a composite attribute and the constraint value of the constraint condition lacks the value of at least one sub-attribute of the composite attribute, generate a constraint rhetorical question statement for prompting to input the value of at least one sub-attribute; update the constraint condition in the query graph according to the input value of at least one sub-attribute.

[0213] The graph query module is further configured to: query the graph database according to the updated query graph, and determine the reply information corresponding to the question sentence.

[0214] Optionally, the graph query module is further configured to: convert the query graph into a graph query statement; query the graph database according to the graph query statement, and obtain the reply information corresponding to the question sentence.

[0215] The device provided by the embodiment of the present application can be specifically used to execute the method provided by any of the above method embodiments. The specific functions and effects are not described in detail here.

[0216] Figure 14 It is a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application. As Figure 14 shown, the electronic device 140 includes: a processor 1401, and a memory 1402 communicatively connected to the processor 1401. The memory 1402 stores computer-executable instructions.

[0217] Wherein, the processor executes the computer-executable instructions stored in the memory to implement the question-answering method based on the knowledge graph provided by any of the above method embodiments. The specific functions and achievable technical effects are not described in detail here.

[0218] The embodiment of the present application further provides a question-answering robot, including: an output device, a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions. The processor executes the computer-executable instructions stored in the memory to implement the question-answering method based on the knowledge graph provided by any of the above method embodiments. The specific functions and achievable technical effects are not described in detail here.

[0219] The embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the question-answering method based on the knowledge graph provided by any of the above method embodiments.

[0220] The embodiment of the present application further provides a computer program product, the program product includes: a computer program, the computer program is stored in a readable storage medium, and at least one processor of the electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program to enable the electronic device to execute the question-answering method based on the knowledge graph provided by any of the above method embodiments.

[0221] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the device described above can refer to the corresponding process in the foregoing method embodiments and will not be elaborated herein.

[0222] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present application. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include known common general knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present application are pointed out by the following claims.

[0223] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A question-answering method based on a knowledge graph, characterized in that Including: In response to a question-and-answer request, based on the constructed graph database, identify the entities, the first-level attributes, and the first-level constraint information included in the input question sentence; the entity is the entity directly mentioned in the question sentence; According to the type of the first-level attribute, if it is determined that there is an object-type attribute in the first-level attribute, then use the value of the object-type attribute in the first-level attribute as the secondary entity, identify the attributes of the secondary entity in the question sentence, obtain the multi-hop attributes of the entities included in the question sentence, and identify the constraint information of the multi-hop attributes in the question sentence to obtain the multi-hop constraints included in the question sentence; the object-type attribute is used to point the attribute value of one entity to another entity; According to the entities, the first-level attributes, and the first-level constraint information included in the question sentence, as well as the multi-hop attributes and the multi-hop constraints, generate a query graph corresponding to the question sentence, where the query graph includes the first-level constraint information, the multi-hop attributes, and the multi-hop constraints; Query the graph database according to the query graph to determine the response information corresponding to the question sentence.

2. The method according to claim 1, characterized in that In response to a question-and-answer request, based on the constructed graph database, identify the entities, the first-level attributes, and the first-level constraint information included in the input question sentence, including: In response to a question-and-answer request, identify the sentence type of the input question sentence; If the question sentence is a comparison sentence, then identify at least two different entities included in the question sentence, as well as the first-level attributes and the first-level constraint information of the at least two different entities; If the question sentence is not a comparison sentence, then identify at least one entity included in the question sentence, as well as the first-level attributes and the first-level constraint information of the at least one entity.

3. The method according to claim 2, wherein The generating a query graph corresponding to the question sentence according to the entities, the first-level attributes, and the first-level constraint information included in the question sentence, as well as the multi-hop attributes and the multi-hop constraints, includes: Generate a basic query graph corresponding to each entity according to the entities and the first-level attributes included in the question sentence, where the basic query graph includes the corresponding entity and the first-level attributes of the corresponding entity; Add the first-level constraint information, the multi-hop attributes, and the multi-hop constraints related to the corresponding entity to the basic query graph to generate a multi-constraint multi-hop query graph corresponding to each entity; Determine the query graph corresponding to the question sentence according to the basic query graph and the multi-constraint multi-hop query graph corresponding to each entity.

4. The method according to claim 3, characterized in that, The determining the query graph corresponding to the question sentence according to the basic query graph and the multi-constraint multi-hop query graph corresponding to each entity includes: Perform graph sorting on the basic query graphs and the multi-constraint multi-hop query graphs corresponding to all entities according to the confidence levels of the entities, the first-level attributes, and the first-level constraint information included in the question sentence, as well as the confidence levels of the multi-hop attributes and the multi-hop constraints, to obtain a graph sorting result; If the question sentence is a comparison sentence, then determine two query graphs corresponding to the question sentence according to the graph sorting result; If the question sentence is not a comparison sentence, then determine one query graph corresponding to the question sentence according to the graph sorting result.

5. The method according to any one of claims 1-4, characterized in that The querying the graph database according to the query graph to determine the response information corresponding to the question sentence includes: Query the graph database according to the query graph. For any entity node included in the query graph, if multiple entities matching the entity node are found, output the multiple entities, where the entity node includes a root node and multi-hop nodes. The root node refers to the entity node corresponding to the entity, and the multi-hop nodes refer to entity nodes other than the root node; Update the query graph according to the selected entity among the multiple entities; Query the graph database according to the updated query graph to determine the response information corresponding to the question sentence.

6. The method according to any one of claims 1-4, characterized in that, The querying the graph database according to the query graph to determine the response information corresponding to the question sentence includes: Query the graph database according to the query graph. For any constraint condition included in the query graph, if the constraint attribute of the constraint condition is a composite attribute and the constraint value of the constraint condition lacks the value of at least one sub-attribute of the composite attribute, generate a constraint rhetorical question for prompting to input the value of the at least one sub-attribute; Update the constraint condition in the query graph according to the input value of the at least one sub-attribute; Query the graph database according to the updated query graph to determine the response information corresponding to the question sentence.

7. The method according to any one of claims 1 to 4, characterized in that, The querying the graph database according to the query graph to determine the response information corresponding to the question sentence includes: Convert the query graph into a graph query statement; Query the graph database according to the graph query statement to obtain the response information corresponding to the question sentence.

8. An electronic device, characterized in that, including: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, Computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, they are used to implement the method according to any one of claims 1-7.

10. A question-and-answer robot, characterized in that, including: an output device, a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Multi-round dialogue processing method for professional scenes

    CN111026886A

  • Semantic analysis method, system and device for knowledge graph questions and answers

    CN111611806A