User problem handling method, device, electronic device and storage medium
By determining the set and type of keywords for user questions in the human-computer interaction system, generating query statements and querying the knowledge graph, the problem that the system cannot handle complex problems is solved, and the efficiency and accuracy of user problem processing are improved.
Patent Information
- Application Number
- CN202011025702.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-25
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-09-25
AI Technical Summary
Existing human-computer interaction systems cannot provide effective answers when dealing with users' uncommon or complex questions, resulting in low efficiency and low accuracy in handling user questions.
By determining the set of entities, attributes, and relationships to which keywords in user questions belong, query statements are generated and the pre-built knowledge graph is queried to obtain answers to user questions. Specific steps include determining the question type, generating query statements, and obtaining answers in the knowledge graph based on the query statements.
It improves the efficiency and accuracy of user problem processing, can effectively handle complex or uncommon problems, and provides more accurate answers.
Smart Images

Figure CN112182177B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to computer technology, and in particular to a method, device, electronic device and storage medium for handling user problems. Background Art
[0002] With the development of computer technology, some questions raised by users can be answered through human-computer interaction systems.
[0003] In the prior art, common simple questions frequently asked by users are usually summarized so that users can obtain answers associated with the questions by inputting keywords.
[0004] However, when the questions are uncommon or complex, the system cannot give corresponding answers. Summary of the invention
[0005] The embodiments of the present invention provide a method, device, electronic device and storage medium for handling user problems, so as to achieve the effect of improving the efficiency and accuracy of handling user problems.
[0006] In a first aspect, an embodiment of the present invention provides a method for handling a user problem, the method comprising:
[0007] Determine the question set to which the keywords in the user question belong; wherein the question set is an entity set; or, the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set;
[0008] Determining the type of question according to the number of entity elements in the entity set and the set type of the question set;
[0009] Generate a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type;
[0010] The pre-constructed knowledge graph is queried according to the query statement to obtain the answer to the user's question.
[0011] In a second aspect, an embodiment of the present invention further provides a user problem handling device, the device comprising:
[0012] A question set determination module, used to determine the question set to which the keywords in the user's question belong; wherein the question set is an entity set; or the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set;
[0013] A question type determination module, used to determine the question type according to the number of entity elements in the entity set and the set type of the question set;
[0014] A query statement generating module, used for generating a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type;
[0015] The question answer acquisition module is used to query the pre-built knowledge graph according to the query statement to obtain the answer to the user's question.
[0016] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0017] one or more processors;
[0018] a storage device for storing one or more programs,
[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the user problem processing method as described above.
[0020] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the user problem handling method as described above.
[0021] The embodiment of the present invention determines the question set to which the keywords in the user's question belong; wherein the question set is an entity set; or the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set; determines the question type according to the number of entity elements in the entity set and the set type of the question set; generates a query statement according to the element type and element name of the elements in the question set, the set type of the question set, and the question type; queries the pre-constructed knowledge graph according to the query statement to obtain the answer to the user's question. The problem that the system cannot give the corresponding answer when the user's question is uncommon or the question is relatively complex in the human-computer interaction system is solved, thereby improving the efficiency and accuracy of user question processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A flowchart of a method for handling user problems provided in Embodiment 1 of the present invention;
[0023] Figure 2 A flowchart of a method for handling user problems provided in Embodiment 2 of the present invention;
[0024] Figure 3 A schematic diagram of the structure of a user problem handling device provided in Embodiment 3 of the present invention;
[0025] Figure 4 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0026] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0027] Embodiment 1
[0028] Figure 1 This is a flowchart of a method for handling user questions provided in the first embodiment of the present invention. This embodiment is applicable to the case of automatically obtaining answers to user questions. The method can be executed by the user question handling device provided in the embodiment of the present invention, and the device can be implemented in software and / or hardware. Figure 1 The user problem handling method provided in this embodiment includes:
[0029] Step 110, determine the question set to which the keywords in the user question belong; wherein the question set is an entity set; or, the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set.
[0030] The user question may be a text question input by the user, or a question obtained by recognizing the user's voice, which is not limited in this embodiment. The keywords in the user question are words that are relatively relevant to the content of the user question. For example, if the user question is what types of credit cards are there, "credit card" and "type" are keywords.
[0031] The question set is a general term for the set to which the keywords belong. The question set may include only the entity set, or may include at least one item in the attribute set, attribute value set, and relationship set in addition to the entity set, that is, the keywords at least include keywords of the entity type. When the keywords of the entity type are not included, it may be displayed that there is no query content, or the customer may be further asked, which is not limited in this embodiment.
[0032] Step 120: Determine the question type according to the number of entity elements in the entity set and the set type of the question set.
[0033] The number of entity elements in the entity set is the number of keywords of entity type in the user's question. The set type of the question set is the type of keyword in the user's question.
[0034] The question type is the purpose of the user's question. Exemplarily, it can be a known attribute query, a known entity query, an unknown entity query, a full known attribute query, and a full unknown attribute query. Among them, the known attribute query and the known entity query are queries for known entities and known attributes in the user's question. For example, in the question "How to repay a credit card", "credit card" and "repayment" are known entity queries. The unknown entity query is a query for entities that are not directly reflected in the user's question. For example, in the question "What is the card sample of Longka credit card in Henan", it is necessary to obtain the unknown entity "Henan credit card" based on the known entities "Henan" and "credit card", and then query Henan credit card. The full known attribute query is to query all attributes related to the known entities in the user's question. For example, if the user's question is "Longka credit card", all attributes related to Longka credit card are queried. The full unknown attribute query is to query all attributes related to the unknown entity in the user's question. All attributes can be returned, or attribute summaries can be returned. Specific attributes are returned according to the user's choice. This embodiment does not limit this.
[0035] The question type is determined based on the number of entity elements in the entity set and the set type of the question set.
[0036] In this embodiment, optionally, determining the question type according to the number of entity elements in the entity set and the set type of the question set includes:
[0037] If the entity set has only one entity element, the problem type is determined as follows:
[0038] If the set type of the question set contains an attribute set but does not contain an attribute value set, then determining that the question type is a known attribute query;
[0039] If the set type of the question set includes an attribute set and an attribute value set, determining that the question type is a known entity query;
[0040] If the set type of the question set does not contain an attribute set but contains a relationship set, then the question type is determined to be an unknown entity query;
[0041] If the set type of the question set does not contain a set of attributes and a set of attribute values, it is determined that the question type is a full-known attribute query.
[0042] Among them, the number of entity elements in the entity set is unique, that is, there is only one keyword of entity type in the user question.
[0043] If there is no attribute set in the set type of the question set, but there is a relationship set, then the question type is determined to be an unknown entity query. For example, the user question is "What series is the Longka Joy Credit Card", where "Longka Joy Credit Card" is an entity and "series" is a relationship, that is, there is no attribute set, but there is a relationship set, then the question type is determined to be an unknown entity query.
[0044] In this embodiment, optionally, determining the question type according to the number of entity elements in the entity set and the set type of the question set includes:
[0045] If the number of entity elements in the entity set is not unique, the problem type is determined as follows:
[0046] If the set type of the question set contains an attribute set but does not contain an attribute value set, then the question type is determined to be an unknown attribute query;
[0047] If the set type of the question set does not contain a set of attributes and a set of attribute values, it is determined that the question type is a full unknown attribute query.
[0048] In other cases, the question type is determined to be an unknown entity query.
[0049] The problem type is determined by determining whether the number of entities in the entity set is unique and the set type of the problem set, thereby improving the accuracy of problem type determination and thus improving the accuracy of subsequent user problem processing.
[0050] Step 130: Generate a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type.
[0051] The element type and element name of an element in a problem collection are the type of the collection to which the element belongs and the name of the element itself. For example, the element type of the "credit card" element is entity and the element name is credit card.
[0052] The form and content of the query statement are determined according to the element type and element name of the element in the question set, the set type of the question set, and the question type.
[0053] Convert user questions into query statements to quickly obtain corresponding answers in the knowledge graph.
[0054] In this embodiment, optionally, generating a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type includes:
[0055] If the set type of the question set is unknown entity query, unknown entity nodes are generated, and known nodes are generated according to element types and element names of elements in the question set;
[0056] Generate a first query sub-statement according to the unknown entity node and the known node;
[0057] Generate a second query sub-statement according to the set type of the question set;
[0058] A third query sub-statement is generated according to the question type, to obtain a query statement including the first query sub-statement, the second query sub-statement and the third query sub-statement.
[0059] If the set type of the question set is an unknown entity query, an unknown entity node is generated, and a known node is generated according to the element type and element name of the element in the question set.
[0060] When the collection type of the question collection is other types, known nodes are generated only according to the element types and element names of the elements in the question collection.
[0061] Exemplarily, the entity set is traversed, and an entity node is generated for each entity element, where the entity element name is the node name, and the node type is the entity type;
[0062] If a relationship set exists, the relationship set is traversed and a relationship node is generated for each relationship element. The relationship element name is the node name and the node type is the relationship type.
[0063] If there are attribute sets and attribute value sets, then traverse the attribute sets, obtain the corresponding attribute values according to the attribute elements, and generate an attribute node for each attribute element. The attribute element name is the node name, and the node type is the attribute type.
[0064] If the collection type of the question set is unknown entity query, an unknown entity node is generated, the node type is unknown entity, and the node name is anonymous.
[0065] Build a partial query statement by generating known nodes and / or unknown entity nodes.
[0066] According to the unknown entity node and the known node, a first query sub-statement is generated. Exemplarily, if there is no unknown entity node, the first query sub-statement is generated: (n); if there is an unknown entity node and no relationship node, the first query sub-statement is generated: (n)-[]->(n{i}), where i is the sequence number of the entity node, indicating the connection between the unknown entity node and the known entity node; if there is an unknown entity node and a relationship node, the first query sub-statement is generated: f'(n)-[:{name}]-(n{i}), indicating the connection between the unknown entity node, the relationship node and the entity node, where {name} is the name of the relationship node.
[0067] According to the set type of the problem set, a second query sub-statement is generated. For example, if there is an attribute set in the set type but no attribute value set: then the second query sub-statement is generated: n.{name}IS NOT NULL, name is the name of the attribute element; if there is an attribute set and an attribute value set in the set type, then the second query sub-statement is generated: n.{property}="{value}, property is the name of the attribute element, value is the value of the attribute value element; if there is an entity set in the set type, then the second query sub-statement is generated: n{i}.name="{name}, i is the sequence number of the entity element in the entity set, and name is the name of the entity element. It should be noted that multiple types of second query sub-statements can be generated, that is, there may be both attribute sets and entity sets in the set type, then two types of second query sub-statements can be generated accordingly.
[0068] According to the question type, a third query sub-statement is generated. Exemplarily, if the question type is a known attribute query, the third query sub-statement is generated: n.`{name}`as`{name}`, where {name} is the name of the attribute element; if the question type is a full known attribute query, the third query sub-statement is generated:
[0069] query_return='KEYS(n)as result UNION MATCH(n)-[:inherit]->(n{i})where
[0070] n{i}.name="{name}"AND n.name STARTS WITH n{i}.name RETURN KEYS(n)asresult'.
[0071] A query statement including the first query sub-statement, the second query sub-statement and the third query sub-statement is obtained. For example, the query statement is: MATCH{match}WHERE{where}RETURN{return}, where match is the first query sub-statement, where is the second query sub-statement, and return is the third query sub-statement. The query statement is formed by combining the first query sub-statement, the second query sub-statement and the third query sub-statement generated according to the element type and element name of the elements in the question set, the set type of the question set, and the question type to improve the comprehensiveness of the query statement and the accuracy of the user question analysis, thereby improving the accuracy of user question processing; and the query statement can be modified by modifying any part of the first query sub-statement, the second query sub-statement and the third query sub-statement to improve the efficiency of query statement modification.
[0072] Step 140: query the pre-constructed knowledge graph according to the query statement to obtain the answer to the user's question.
[0073] The pre-built knowledge graph can be a knowledge graph built according to the business field, such as a knowledge graph built for the credit card field. By analyzing the relevant knowledge of credit cards, the product field involved in credit cards can be determined; a classification system and knowledge representation of credit cards can be built, and the relationship between credit card product instances and various business support instances, as well as the attributes of various instances, can be defined.
[0074] Extract knowledge graph entities such as operations, operation parameters, series, credit cards, channels, card organizations, card levels, and the relationships between knowledge graph entities such as inheritance, channels, card organizations, and series from the credit card knowledge base to construct a knowledge graph, thereby improving the targeted nature of knowledge graph construction.
[0075] The knowledge graph is queried through a query statement, and the results related to the query statement in the knowledge graph are obtained and returned to the user as the answer to the question.
[0076] In this embodiment, optionally, querying a pre-built knowledge graph according to the query statement to obtain an answer to the user's question includes:
[0077] Storing the pre-built knowledge graph in a Neo4j graph database;
[0078] The knowledge graph in the Neo4j graph database is queried according to the query statement to obtain an answer to the user's question.
[0079] Neo4j is a high-performance graph database that stores structured data on the Internet. It has strong adaptability and can maintain efficient query performance from beginning to end. By querying the knowledge graph in the Neo4j graph database, we can get the answers to user questions and improve the efficiency of answer acquisition.
[0080] The technical solution provided in this embodiment is to determine the question set to which the keywords in the user's question belong; wherein the question set is an entity set; or the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set; determine the question type according to the number of entity elements in the entity set and the set type of the question set; generate a query statement according to the element type and element name of the elements in the question set, the set type of the question set, and the question type; query the pre-constructed knowledge graph according to the query statement to obtain the answer to the user's question. This solves the problem in a human-computer interaction system that the system cannot give a corresponding answer when the user's question is uncommon or the question is relatively complex, thereby improving the efficiency and accuracy of user question processing.
[0081] Embodiment 2
[0082] Figure 2 This is a flowchart of a method for handling user questions provided in Embodiment 2 of the present invention. This technical solution is a supplementary explanation of the process of obtaining answers to user questions. Compared with the above solution, this solution is specifically optimized to obtain answers to the user questions, including:
[0083] Determine the number of answer entities contained in the answer to the question;
[0084] If the number of answer entities is not unique, the query statement is updated according to the answer set, and the pre-built knowledge graph is queried according to the updated query statement to obtain the answer to the user question; wherein the answer set is composed of the answer entities. Specifically, the flowchart of the user question processing method is as follows Figure 2 As shown:
[0085] Step 210: determine the question set to which the keywords in the user question belong; wherein the question set is an entity set; or, the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set.
[0086] In this embodiment, optionally, determining the question set to which the keyword in the user question belongs includes:
[0087] By performing question recognition on the acquired user questions, keywords in the user questions are acquired;
[0088] The keyword is matched with a question word list to determine the question set to which the keyword belongs; wherein the question word list includes at least one item of an entity word list, an attribute word list, an attribute value word list and a relationship word list.
[0089] By performing question recognition on the acquired user questions, keywords in the user questions are acquired, which may be acquired through keyword extraction algorithms such as document topic generation models, and this embodiment does not impose any limitation on this.
[0090] The question word list is a pre-built word list related to the business field. The keywords can be matched with the question word list through matching algorithms such as Aho-Corasick to determine the question word list matched by the keywords, thereby determining the question set to which the keywords belong. The question word list includes at least one of an entity word list, an attribute word list, an attribute value word list, and a relationship word list. Exemplarily, the keyword is "credit card", and the entity word list includes credit card. Then the keyword matches the entity word list, and the credit card belongs to the entity set. By matching the keywords in the question with the question word list, the question set to which the keywords belong is determined, thereby improving the accuracy and pertinence of keyword classification.
[0091] Step 220: Determine the question type according to the number of entity elements in the entity set and the set type of the question set.
[0092] Step 230: Generate a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type.
[0093] Step 240: query the pre-constructed knowledge graph according to the query statement to determine the number of answer entities contained in the answer to the question.
[0094] The number of answer entities contained in the answer to the question is the number of answers returned after querying the pre-built knowledge graph. If the number of answer entities is unique, the answer entity is the answer to the question and can be returned directly to the user.
[0095] Step 250: If the number of answer entities is not unique, update the query statement according to the answer set, and query the pre-constructed knowledge graph according to the updated query statement to obtain the answer to the user's question; wherein the answer set is composed of the answer entities.
[0096] If the number of answer entities is not unique, the query statement is updated according to the determination of the answer entity in the answer set, wherein when the query statement includes the first query sub-statement, the second query sub-statement and the third query sub-statement, the updated query statement may be the first query sub-statement in the updated query statement, avoiding updating from the beginning and improving the query statement updating efficiency. The pre-built knowledge graph is queried according to the updated query statement to obtain the answer to the user's question.
[0097] In this embodiment, optionally, updating the query statement according to the answer set includes:
[0098] Determine the entity relationship of the answer entity in the knowledge graph according to the knowledge graph, and determine the candidate answer set associated with the answer set according to the entity relationship of the answer entity;
[0099] In response to a user's selection of a candidate answer entity in the candidate answer set, the query statement is updated.
[0100] The entity relationships of the answer entity in the knowledge graph are obtained as all relationships related to the answer entity, and the candidate answer set associated with the answer set is determined according to the entity relationship. The candidate answer set is a set associated with the answer set, which is used to return to the user for selection to update the query statement. Exemplarily, the answer entity is credit card SMS application and credit card WeChat application, then the candidate answer related to credit card SMS application obtained according to the entity relationship is SMS, and the candidate answer related to credit card WeChat application obtained according to the entity relationship is WeChat, then WeChat and SMS are returned to the user for selection. If the user chooses WeChat, WeChat is used as a new entity node to update the query statement. This improves the accuracy of problem handling.
[0101] In this embodiment, optionally, determining a candidate answer set associated with the answer set according to the entity relationship of the answer entity includes:
[0102] Obtaining the entity relationship type of each answer entity;
[0103] Determine a common entity relationship of the same entity relationship type among entity relationships between each of the answer entities and other answer entities in the answer set;
[0104] According to the common relationship, candidate answer entities associated with each answer entity are obtained, and according to the candidate answer entities, a candidate answer set associated with the answer set is determined.
[0105] Obtain the entity relationship type of each answer entity, and determine the common entity relationship of the answer entity. For example, the entity relationship of the answer entity includes inheritance, channel, card organization, series and other types. Answer entity A includes inheritance and card organization type entity relationships, and answer entity B includes inheritance and series type entity relationships. Then the common entity relationship between answer entity A and answer entity B is inheritance.
[0106] According to the common relationship, the candidate answer entity associated with each answer entity is obtained. For example, the candidate answer entity A that is in an inheritance relationship with the answer entity A is obtained; the candidate answer entity B that is in an inheritance relationship with the answer entity B is obtained. Then the candidate answer set includes the candidate answer entity A and the candidate answer entity B. By determining the candidate answer set through the common entity relationship, the accuracy of obtaining the candidate answer entity that needs to be determined by the user is improved, thereby improving the accuracy of user question processing.
[0107] The embodiment of the present invention updates the query statement according to the number of answer entities, thereby obtaining the answer to the question that best matches the user's question and improving the accuracy of handling the user's question.
[0108] Embodiment 3
[0109] Figure 3 This is a schematic diagram of the structure of a user problem handling device provided in the third embodiment of the present invention. The device can be implemented by hardware and / or software, can execute a user problem handling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. Figure 3 As shown, the device comprises:
[0110] The question set determination module 310 is used to determine the question set to which the keywords in the user question belong; wherein the question set is an entity set; or the question set is at least one of an attribute set, an attribute value set and a relationship set, and an entity set;
[0111] A question type determination module 320, configured to determine a question type according to the number of entity elements in the entity set and the set type of the question set;
[0112] A query statement generating module 330, configured to generate a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type;
[0113] The question answer acquisition module 340 is used to query the pre-constructed knowledge graph according to the query statement to obtain the answer to the user's question.
[0114] The technical solution provided in this embodiment is to determine the question set to which the keywords in the user's question belong; wherein the question set is an entity set; or the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set; determine the question type according to the number of entity elements in the entity set and the set type of the question set; generate a query statement according to the element type and element name of the elements in the question set, the set type of the question set, and the question type; query the pre-constructed knowledge graph according to the query statement to obtain the answer to the user's question. This solves the problem in a human-computer interaction system that the system cannot give a corresponding answer when the user's question is uncommon or the question is relatively complex, thereby improving the efficiency and accuracy of user question processing.
[0115] On the basis of the above technical solutions, optionally, the question set determination module includes:
[0116] A keyword acquisition unit, configured to acquire keywords in the user's question by performing question recognition on the acquired user's question;
[0117] The question set determination unit is used to match the keyword with a question word list to determine the question set to which the keyword belongs; wherein the question word list includes at least one item of an entity word list, an attribute word list, an attribute value word list and a relationship word list.
[0118] Based on the above technical solutions, optionally, the question type determination module includes:
[0119] If the entity set has only one entity element, the problem type is determined as follows:
[0120] a known attribute query determining unit, configured to determine that the question type is a known attribute query if there is an attribute set in the set type of the question set but there is no attribute value set;
[0121] A known entity query unit, configured to determine that the question type is a known entity query if an attribute set and an attribute value set exist in the set type of the question set;
[0122] An unknown entity query unit, configured to determine that the question type is an unknown entity query if there is no attribute set in the set type of the question set but there is a relationship set;
[0123] A full known attribute query unit is used to determine that the question type is a full known attribute query if the attribute set and the attribute value set do not exist in the set type of the question set.
[0124] Based on the above technical solutions, optionally, the question type determination module includes:
[0125] If the number of entity elements in the entity set is not unique, the problem type is determined as follows:
[0126] An unknown attribute query unit, configured to determine that the question type is an unknown attribute query if there is an attribute set in the set type of the question set but there is no attribute value set;
[0127] A full unknown attribute query unit is used to determine that the question type is a full unknown attribute query if the attribute set and the attribute value set do not exist in the set type of the question set.
[0128] On the basis of the above technical solutions, optionally, the query statement generating module includes:
[0129] A node generation unit, configured to generate unknown entity nodes if the set type of the question set is an unknown entity query, and to generate known nodes according to the element type and element name of the elements in the question set;
[0130] A first query sub-statement generating unit, configured to generate a first query sub-statement according to unknown entity nodes and known nodes;
[0131] A second query sub-statement generating unit, configured to generate a second query sub-statement according to a set type of the question set;
[0132] The third query sub-statement generating unit is used to generate a third query sub-statement according to the question type, and obtain a query statement including the first query sub-statement, the second query sub-statement and the third query sub-statement.
[0133] On the basis of the above technical solutions, optionally, the question answer acquisition module includes:
[0134] An answer entity quantity determination submodule is used to determine the number of answer entities contained in the answer to the question;
[0135] The query statement updating submodule is used to update the query statement according to the answer set if the number of answer entities is not unique, and query the pre-constructed knowledge graph according to the updated query statement to obtain the answer to the user's question; wherein the answer set is composed of the answer entities.
[0136] On the basis of the above technical solutions, optionally, the query statement updating submodule includes:
[0137] A candidate answer set acquisition unit, configured to determine the entity relationship of the answer entity in the knowledge graph according to the knowledge graph, and determine the candidate answer set associated with the answer set according to the entity relationship of the answer entity;
[0138] The query statement updating unit is used to update the query statement in response to the user's selection of a candidate answer entity in the candidate answer set.
[0139] On the basis of the above technical solutions, optionally, the candidate answer set acquisition unit includes:
[0140] An entity relationship type acquisition subunit, used to acquire the entity relationship type of each of the answer entities;
[0141] A shared entity relationship determination subunit, used to determine shared entity relationships of the same entity relationship type among entity relationships between each of the answer entities and other answer entities in the answer set;
[0142] The candidate answer set determination subunit is used to obtain the candidate answer entities associated with each of the answer entities according to the common relationship, and determine the candidate answer set associated with the answer set according to the candidate answer entities.
[0143] On the basis of the above technical solutions, optionally, the question answer acquisition module includes:
[0144] A knowledge graph storage unit, used to store the pre-built knowledge graph in a Neo4j graph database;
[0145] A database query unit is used to query the knowledge graph in the Neo4j graph database according to the query statement to obtain the answer to the user's question.
[0146] Embodiment 4
[0147] Figure 4 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention is shown in FIG. Figure 4 As shown, the electronic device includes a processor 40, a memory 41, an input device 42 and an output device 43; the number of processors 40 in the electronic device can be one or more. Figure 4 A processor 40 is taken as an example; the processor 40, the memory 41, the input device 42 and the output device 43 in the electronic device can be connected by a bus or other means. Figure 4 The example of connecting through bus is taken in the following.
[0148] The memory 41 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the user problem handling method in the embodiment of the present invention. The processor 40 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 41, that is, implements the above-mentioned user problem handling method.
[0149] The memory 41 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 41 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 41 may further include a memory remotely arranged relative to the processor 40, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0150] Embodiment 5
[0151] Embodiment 5 of the present invention further provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to execute a user problem handling method when executed by a computer processor, the method comprising:
[0152] Determine the question set to which the keywords in the user question belong; wherein the question set is an entity set; or, the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set;
[0153] Determining the type of question according to the number of entity elements in the entity set and the set type of the question set;
[0154] Generate a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type;
[0155] The pre-constructed knowledge graph is queried according to the query statement to obtain the answer to the user's question.
[0156] Of course, the storage medium containing computer executable instructions provided by an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in the user problem handling method provided by any embodiment of the present invention.
[0157] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0158] It is worth noting that in the embodiment of the above-mentioned user problem handling device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0159] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for handling user problems, characterized in that: include: Determine the question set to which the keywords in the user question belong; wherein the question set is an entity set; or, the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set; Determine the question type according to the number of entity elements in the entity set and the set type of the question set; wherein the set type of the question set is the type of keywords in the user question; and the question type is the purpose of the user question; Generate a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type; Querying a pre-built knowledge graph according to the query statement to obtain an answer to the user's question; The step of generating a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type includes: If the question type is an unknown entity query, an unknown entity node is generated, and a known node is generated according to the element type and element name of the element in the question set; Generate a first query sub-statement according to the unknown entity node and the known node; Generate a second query sub-statement according to the set type of the question set; A third query sub-statement is generated according to the question type, to obtain a query statement including the first query sub-statement, the second query sub-statement and the third query sub-statement.
2. The method according to claim 1, characterized in that: Determine the question set to which the keywords in the user's question belong, including: By performing question recognition on the acquired user questions, keywords in the user questions are acquired; The keyword is matched with a question word list to determine the question set to which the keyword belongs; wherein the question word list includes at least one item of an entity word list, an attribute word list, an attribute value word list and a relationship word list.
3. The method according to claim 1, characterized in that Determining the type of the question according to the number of entity elements in the entity set and the set type of the question set includes: If the entity set has only one entity element, the problem type is determined as follows: If the set type of the question set contains an attribute set but does not contain an attribute value set, then determining that the question type is a known attribute query; If the set type of the question set includes an attribute set and an attribute value set, determining that the question type is a known entity query; If the set type of the question set does not contain an attribute set but contains a relationship set, then the question type is determined to be an unknown entity query; If the set type of the question set does not contain a set of attributes and a set of attribute values, it is determined that the question type is a full-known attribute query.
4. The method according to claim 1, characterized in that Determining the type of the question according to the number of entity elements in the entity set and the set type of the question set includes: If the number of entity elements in the entity set is not unique, the problem type is determined as follows: If the set type of the question set contains an attribute set but does not contain an attribute value set, then the question type is determined to be an unknown attribute query; If the set type of the question set does not contain a set of attributes and a set of attribute values, it is determined that the question type is a full unknown attribute query.
5. The method according to claim 1, characterized in that Get answers to the user's questions, including: Determine the number of answer entities contained in the answer to the question; If the number of answer entities is not unique, the query statement is updated according to the answer set, and the pre-constructed knowledge graph is queried according to the updated query statement to obtain the answer to the user's question; wherein the answer set is composed of the answer entities.
6. The method according to claim 5, characterized in that Updating the query statement according to the answer set includes: Determine the entity relationship of the answer entity in the knowledge graph according to the knowledge graph, and determine the candidate answer set associated with the answer set according to the entity relationship of the answer entity; In response to a user's selection of a candidate answer entity in the candidate answer set, the query statement is updated.
7. The method according to claim 6, characterized in that Determining a candidate answer set associated with the answer set according to the entity relationship of the answer entity includes: Obtaining the entity relationship type of each answer entity; Determine a common entity relationship of the same entity relationship type among entity relationships between each of the answer entities and other answer entities in the answer set; According to the common entity relationship, a candidate answer entity associated with each answer entity is obtained, and a candidate answer set associated with the answer set is determined according to the candidate answer entity.
8. The method according to claim 1, characterized in that The pre-built knowledge graph is queried according to the query statement to obtain the answer to the user's question, including: Storing the pre-built knowledge graph in a Neo4j graph database; The knowledge graph in the Neo4j graph database is queried according to the query statement to obtain an answer to the user's question.
9. A user problem handling device, characterized in that: include: A question set determination module, used to determine the question set to which the keywords in the user's question belong; wherein the question set is an entity set; or the question set is at least one of an attribute set, an attribute value set, and a relationship set, and an entity set; A question type determination module, used to determine the question type according to the number of entity elements in the entity set and the set type of the question set; wherein the set type of the question set is the type of keywords in the user question; the question type is the purpose of the user question; A query statement generating module, used for generating a query statement according to the element type and element name of the element in the question set, the set type of the question set, and the question type; A question answer acquisition module is used to query the pre-built knowledge graph according to the query statement to obtain the answer to the user's question; Wherein, the query statement generating module includes: A node generation unit, configured to generate unknown entity nodes if the question type is an unknown entity query, and to generate known nodes according to element types and element names of elements in the question set; A first query sub-statement generating unit, configured to generate a first query sub-statement according to unknown entity nodes and known nodes; A second query sub-statement generating unit, configured to generate a second query sub-statement according to a set type of the question set; The third query sub-statement generating unit is used to generate a third query sub-statement according to the question type, and obtain a query statement including the first query sub-statement, the second query sub-statement and the third query sub-statement.
10. The device according to claim 9, characterized in that The problem set determination module comprises: A keyword acquisition unit, configured to acquire keywords in the user's question by performing question recognition on the acquired user's question; The question set determination unit is used to match the keyword with a question word list to determine the question set to which the keyword belongs; wherein the question word list includes at least one of an entity word list, an attribute word list, an attribute value word list and a relationship word list.
11. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the user problem handling method as described in any one of claims 1-8.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the user problem processing method as described in any one of claims 1-8 is implemented.
