A knowledge graph question answering method based on multiple strategies
Through a multi-strategy knowledge graph question-answering method, specific query strategies and models are adopted for different types of questions, which solves the problem of low accuracy of answers to static attribute questions in the existing technology, realizes accurate answer retrieval for static and dynamic questions, and improves the recall rate and ease of use of the question-answering system.
Patent Information
- Application Number
- CN202210603640.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2042-05-30
AI Technical Summary
The existing knowledge graph question-answering method has a single model and can only query static attribute questions. The answer accuracy is low and it cannot effectively handle dynamic questions.
A multi-strategy knowledge graph question answering method is adopted. Through question classification, entity recognition and fuzzy query, different query strategies are selected for different types of questions using the BERT model and Cypher statements, and the most similar nodes or edges are selected as answers using the semantic similarity model.
It achieves accurate answer retrieval for static and dynamic questions, improves the recall rate and answer accuracy of the question-answering system, and enhances the generalization ability of the question-answering system.
Smart Images

Figure CN115422330B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing and analysis technology, and in particular to a knowledge graph question answering method based on multiple strategies. Background Art
[0002] Intelligent question-answering (Q&A) natural language processing is a hot research topic and has attracted considerable attention in recent years. With the continuous development of knowledge graphs, various fields are building proprietary knowledge graphs as high-quality data sources for intelligent Q&A. Compared to traditional databases, knowledge graphs more intuitively display data relationships and characteristics.
[0003] Currently, knowledge graph question answering mainly targets target attribute queries and simple relationship reasoning. Graph question answering extracts answers from the knowledge graph by understanding and parsing the semantics of the questions. The specific implementation process is as follows: first, the question entity is linked to the knowledge graph node. Based on the graph node, all triples related to the question are retrieved as candidate answer sets. The semantic similarity between the question and the candidate answers is then calculated, and the one with the greatest similarity is selected as the answer to the question. However, there are still two problems with current knowledge graph question answering:
[0004] First, the current knowledge graph question-answering method uses a unified query mode for all questions. The answer query mode is fixed and single, and it cannot perform specific queries on specific types of questions. As a result, some questions may not match the correct answer.
[0005] Second, the types of questions involved in knowledge graph question and answer are relatively simple. Knowledge graph question and answer mainly asks questions about static attribute content, which refers to the objective factual attributes of targets or things that exist objectively and will not change over time; while for dynamic questions such as targets, event statistics, numerical calculations, etc., knowledge graph question and answer cannot return answers to relevant questions. Summary of the Invention
[0006] The main purpose of this invention is to provide a knowledge graph question-answering method based on multiple strategies, aiming to solve the technical problems that the current knowledge graph question-answering mode is single, can only query static attribute type questions, and has a low answer accuracy rate.
[0007] To achieve the above objectives, the present invention provides a multi-strategy knowledge graph question answering method, which includes the following steps:
[0008] S1: Classify the types of questions according to their content;
[0009] S2: Based on the classified questions, the entity recognition model is used to identify the question entities. The question entities are linked to the graph nodes through fuzzy queries. The required search content is converted into Cypher statements according to the questions. Different query strategies are selected for different types of questions to obtain the triples corresponding to the questions.
[0010] S3: Use fuzzy query to match similar graph nodes for question entities, use the BERT model to match relevant nodes and edges for question relations, and use the semantic similarity model to select the nodes or edges most similar to the question and output them as the answer to the question.
[0011] Optionally, the types of the questions include attribute query questions, statistical query questions and temporal reasoning questions.
[0012] Optionally, for attribute query questions, step S2 specifically includes:
[0013] S201: Use the BERT+BiLSTM+CRF model to perform named entity recognition on the question;
[0014] S202: Link the problem entity to the graph node and determine whether the problem entity matches the graph node. If so, use Cypher language to fuzzy query all triples of the node and execute step S204. Otherwise, execute step S203.
[0015] S203: re-segment the entity, and return to step S202;
[0016] S204: vectorizing all the triples and question texts found out;
[0017] S205: Use the BERT model to measure the similarity between the question and each triple, and return the triple with the largest similarity value;
[0018] S206: Output the tail entity of the returned triple as the answer to the question.
[0019] Optionally, for statistical query questions, step S2 specifically includes:
[0020] S221: Use the BERT+BiLSTM+CRF model trained on project data to identify the problem subject;
[0021] S222: Reuse the entity recognition model to identify the problem object;
[0022] S223: Using Cypher statements, perform a triple fuzzy query with the question subject as the head entity and the question object as the tail entity;
[0023] S224: Return all tail entities matched by the fuzzy query as the answer to the question; if the fuzzy query has no result, execute step S225; otherwise, execute step S226;
[0024] S225: Using Cypher statements, perform a triple fuzzy query with the question subject as the tail entity and the question object as the head entity;
[0025] S226: Return all the header entities that match the fuzzy query as the answer to the question; if the fuzzy query has no result, terminate;
[0026] S227: Count the number of entities that return answers to the question and output it as another question result.
[0027] Optionally, for temporal reasoning problems, step S2 specifically includes:
[0028] S231: Use the BERT+BiLSTM+CRF model to identify problematic entities;
[0029] S232: Set time calculation rules, enter a question, and return the start time and end time involved in the question;
[0030] S233: Calculate the difference between the start time and the end time, thereby counting the date of each day between the start time and the end time, and save it as a time list;
[0031] S234: In the knowledge graph, with the question entity as a node, traverse the time list in sequence, use each date in the list as a relationship edge or graph node, and use Cypher statements to perform triple fuzzy query;
[0032] S235: storing the nodes or relationship edges obtained by the fuzzy query into the answer list in sequence;
[0033] S236: Output the answer to the question.
[0034] Optionally, step S3 specifically includes:
[0035] S311: Collect entity data and semantically similar text data in professional fields, and use this data to train the BERT+BILSTM entity recognition model and the BERT semantic similarity model;
[0036] S312: Use the trained BERT+BiLSTM model to identify the problem entity and link the entity to the knowledge graph. If successful, jump to step 4; if the entity is not linked to the graph node, jump to step 3;
[0037] S313: Traverse the graph nodes one by one, use the BERT model to match the nodes with the question entity for semantic similarity, and return the graph node with the highest similarity value;
[0038] S314: Using the searched graph node as the center point, query all related triples of the node and save the triples in a list;
[0039] S315: Then traverse the triple list in sequence, use the BERT semantic similarity model to measure the similarity between the triple and the question text, and return the triple with the highest similarity value. The relationship edge contained in the triple is the question relationship;
[0040] S316: Return graph nodes and relationship edges;
[0041] S317: Use the semantic similarity model to select the node or edge that is most similar to the question and output it as the answer to the question.
[0042] An embodiment of the present invention proposes a multi-strategy knowledge graph question-answering method. The method includes classifying question types according to question content, identifying question entities using an entity recognition model, linking question entities to graph nodes through fuzzy queries, converting the required search content into Cypher statements based on the question, selecting different query strategies for different question types, obtaining triples corresponding to the question, matching similar graph nodes to question entities using fuzzy queries, matching relevant nodes and edges to question relationships using the BERT model, and selecting the node or edge most similar to the question using a semantic similarity model, and outputting the node or edge as the answer to the question. The present invention provides an attribute query retrieval method for static questions and a temporal reasoning or statistical query retrieval method for dynamic questions. Different question-answering strategies are proposed for different question types, thereby enabling answer retrieval for dynamic questions. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a flow chart of a multi-strategy knowledge graph question answering method of the present invention;
[0044] Figure 2 This is a schematic diagram of the principle of a multi-strategy knowledge graph question answering method of the present invention;
[0045] Figure 3 A schematic diagram of an answer query mode for attribute query questions of the present invention;
[0046] Figure 4 A schematic diagram of a query mode for answering statistical query questions of the present invention;
[0047] Figure 5 Schematic diagram of the answer query mode for time reasoning questions of the present invention.
[0048] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0049] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0050] At present, in the relevant technical field, the existing knowledge graph question-answering model is single, can only query static attribute questions, and has a low answer accuracy rate.
[0051] To address this issue, various embodiments of the multi-strategy knowledge graph question-answering method of the present invention are proposed. The multi-strategy knowledge graph question-answering method provided by the present invention provides attribute query retrieval methods for static questions; temporal reasoning or statistical query retrieval methods for dynamic questions; and proposes different question-answering strategies for different types of questions, thereby enabling answer retrieval for dynamic questions.
[0052] The embodiment of the present invention provides a knowledge graph question answering method based on multiple strategies, referring to Figure 1 , Figure 1 This is a flow chart of an embodiment of the multi-strategy knowledge graph question-answering method of the present invention.
[0053] In this embodiment, the multi-strategy knowledge graph question answering method includes the following steps:
[0054] S1: Classify the types of questions according to their content;
[0055] S2: Based on the classified questions, the entity recognition model is used to identify the question entities. The question entities are linked to the graph nodes through fuzzy queries. The required search content is converted into Cypher statements according to the questions. Different query strategies are selected for different types of questions to obtain the triples corresponding to the questions.
[0056] S3: Use fuzzy query to match similar graph nodes for question entities, use the BERT model to match relevant nodes and edges for question relations, and use the semantic similarity model to select the nodes or edges most similar to the question and output them as the answer to the question.
[0057] It is easy to understand that the problem classification scheme recorded in step S1 specifically includes:
[0058] The types of questions are classified according to the content of the questions, and the questions are divided into attribute queries, statistical queries and time reasoning queries.
[0059] Among them, attribute queries mainly ask questions about the attributes and feature information of the target, and return answers by matching similar attributes of the target; statistical queries ask questions about the relevant content of multiple targets or events, and obtain answers through statistical reasoning; time reasoning queries mainly ask questions related to the time elements involved in the target or event, and retrieve answers to questions by reasoning time and using time elements.
[0060] It is easy to understand that the answer query mode solution recorded in step S2 specifically includes:
[0061] Based on the classified questions, the entity recognition model is used to identify the question entities, and the link between the question entities and the graph nodes is realized through fuzzy query; then, according to the specific question, the required search content is converted into Cypher statements, and different query strategies are selected for different types of questions to realize the query of question-related triples, relationship edges or nodes.
[0062] It should be noted that in the process of returning answers, statistical and temporal reasoning questions can directly locate the answers to the questions through Cypher statement query strategies and return the results of the questions; attribute query questions use deep learning models to measure the similarity between the question and the related triples, and finally use the triple tail entity with the highest similarity value as the answer to the question.
[0063] It is easy to understand that the generalization solution for the problem recorded in step S3 specifically includes:
[0064] During the graph query process, fuzzy queries are used to match question entities with as many similar graph nodes as possible, and the BERT model is used to match question relationships with as many similar graph relationship edges as possible, ensuring that all question-related nodes and edges are returned during the answer query process, thereby improving the question-answer recall rate and making it more likely to retrieve the true answer to the question.
[0065] This embodiment provides a knowledge graph question-answering method based on multiple strategies, by providing an attribute query retrieval method for static questions, providing a time reasoning or statistical query retrieval method for dynamic questions, and proposing different question-answering strategies for different types of questions, thereby realizing answer retrieval for dynamic questions, solving the technical problems that the current knowledge graph question-answering mode is single, can only query static attribute questions, and has a low answer accuracy rate.
[0066] In order to explain this application more clearly, a specific example of a multi-strategy based knowledge graph question answering method is proposed.
[0067] like Figure 2 As shown, in this embodiment, the multi-strategy knowledge graph question answering method includes three steps: question classification, answer query mode and question generalization.
[0068] 1. Problem Classification
[0069] Referring to Table 1, the present invention analyzes the characteristics of each question type and summarizes several question types. Specifically:
[0070] Static questions: Static content mainly refers to content that will not change with time updates, such as definitions, entries, attributes and other related content; static questions are usually asked based on the above content, and the answers to the questions are relatively fixed.
[0071] Dynamic questions: Dynamic content mainly refers to content that will be updated and changed dynamically over time, such as changes in major events, adjustments to departmental personnel structures, and other related content; dynamic questions are based on the above questions, and the answers to the questions will change with the time of questioning, and the answers are not fixed.
[0072] Attribute query questions: Attribute query questions are static questions, and they mainly ask questions about the basic information, characteristic attributes, and other static content of relevant subjects such as targets, people, and organizations. The main pattern of the question is: "What is B (attribute) of A (subject)?"
[0073] Statistical query questions: Statistical query questions are dynamic questions, mainly asking questions about multiple related subjects or events. The answers need to enumerate all related instances and count the number of related instances returned. The triggers included in the questions mainly include: "how many times in total", "cumulative", "total", etc.
[0074] Temporal reasoning questions: Temporal reasoning questions are dynamic questions, and they mainly ask questions about related events that occurred within a period of time. The trigger words contained in the questions mainly include: "recently", "past three months", "this week", "last year", etc.
[0075] Table 1 Question types
[0076]
[0077] By classifying questions, we can conduct targeted queries on various questions based on the knowledge graph to ensure the accuracy and effectiveness of the results returned.
[0078] 2. Answer query mode
[0079] For different question types, different knowledge graph-based question answer search modes will be introduced below.
[0080] like Figure 3 As shown in the figure, the answer query mode for attribute query questions: Attribute query mainly returns the answer to the question by matching similar attributes to the question target. The specific steps are as follows:
[0081] Step 1: Use the BERT+BiLSTM+CRF model to perform named entity recognition on the question. Before entity recognition, prepare relevant project data to train the model to improve the accuracy of entity recognition;
[0082] Step 2: Link the problem entity to the graph node and use Cypher language to fuzzy query all triples of the node, then jump to step 4;
[0083] Step 3: If the problem entity does not match a graph node, re-segment the entity and return to step 2;
[0084] Step 4: Vectorize all the searched triples and question texts;
[0085] Step 5: Use the BERT model to measure the similarity between the question and each triple, and return the triple with the largest similarity value;
[0086] Step 6: Output the tail entity of the returned triple as the answer to the question.
[0087] The core idea behind the above steps is to identify the question entity as the head entity, perform a similar match between the head entity's related triples and the question, find the relationship edge that best matches the question, and then use the triple relationship between the head entity, the relationship edge, and the tail entity in the graph to return the tail entity as the answer. The purpose of re-segmentation in step 3 is to ensure that the question entity is successfully linked to the graph node, thereby increasing the question recall rate.
[0088] like Figure 4 As shown in the figure, the answer query mode for statistical query questions is mainly aimed at multiple related contents contained in a subject. The answer needs to enumerate and retrieve all instances and count the number of returned instances. The specific steps are as follows:
[0089] Step 1: Use the BERT+BiLSTM+CRF model trained on project data to identify the question subject.
[0090] Step 2: Use the entity recognition model to identify the question object (the object of the question);
[0091] Step 3: Use Cypher statements to perform triple fuzzy query with the question subject as the head entity and the question object as the tail entity;
[0092] Step 4: Return all tail entities matched by the fuzzy query as the answer to the question; if the fuzzy query has no result, jump to step 5;
[0093] Step 5: Use Cypher statements to take the question subject as the tail entity and the question object as the head entity to perform triple fuzzy query;
[0094] Step 6: Return all the header entities that match the fuzzy query as the answer to the question; if the fuzzy query has no result, terminate;
[0095] Step 7: Count the number of entities that return the answer to the question and output it as another question result.
[0096] The core of the above steps is to identify the subject and object of the question. The key step is to use fuzzy query statements to retrieve specific object content related to the question subject in the knowledge graph. When the identified question entity is not unique, corresponding query rules must be set to ensure that every entity can be searched in the graph, and ultimately return a node as the answer to the question.
[0097] like Figure 5 As shown in the figure, the answer query mode for time reasoning questions is to dynamically infer the start and end times of the question content based on the question time. The start and end times are used as relationship edge elements in the knowledge graph to search for related content. The specific steps are as follows:
[0098] Step 1: Use the BERT+BiLSTM+CRF model to identify the problem entity;
[0099] Step 2: Set the time calculation rules, enter the question, and return the start and end times involved in the question;
[0100] Step 3: Calculate the difference between the start time and the end time, and then count the dates of each day between the start time and the end time, and save them as a time list;
[0101] Step 4: In the knowledge graph, take the question entity as a node, traverse the time list in sequence, use each date in the list as a relationship edge or graph node, and use Cypher statements to perform triple fuzzy query;
[0102] Step 5: Store the nodes or relationship edges found by the fuzzy query into the answer list in sequence;
[0103] Step 6: Output the answer to the question;
[0104] The core of the above steps is to calculate the start time and end time involved in the question. The present invention mainly infers the relevant time based on the question time by setting time calculation rules. The present invention takes into account that some event graphs may construct time as a relationship edge. Therefore, in the fuzzy query, time is queried separately as a relationship edge and node, ensuring the full recall of answers to relevant questions.
[0105] 3. Problem Generalization
[0106] The question generalization process is primarily reflected in the answer search process based on the knowledge graph, including the semantic generalization between question entities and graph nodes, and the semantic generalization between question relationships and graph relationship edges. In actual question-answering applications, users ask questions in a variety of ways, and different users express questions differently. It is impossible to guarantee that the entity and relationship names contained in the question are completely consistent with the node names and relationship edge names in the graph. Therefore, it is necessary to match question entities with graph nodes and question relationships with graph edges through semantic similarity, and then retrieve the answer to the question based on different answer query modes. The purpose of question generalization is to improve the recall rate of questions and answers, enhance the generalization ability of the question-answering system, and make the question-answering system more user-friendly.
[0107] This invention focuses on generalizing questions based on knowledge graphs, primarily from the perspectives of entity recognition and semantic similarity. Question generalization is achieved through generalization of question entities and graph nodes, and generalization of question relationships and graph relationship edges. The implementation process is shown in the figure, and the specific implementation steps are as follows:
[0108] Step 1: Collect entity data and semantically similar text data in professional fields, and use this data to train the BERT+BILSTM entity recognition model and the BERT semantic similarity model;
[0109] Step 2: Use the trained BERT+BiLSTM model to identify the problem entity and link the entity to the knowledge graph. If successful, jump to step 4; if the entity is not linked to the graph node, jump to step 3;
[0110] Step 3: Traverse the graph nodes one by one, use the BERT model to match the nodes with the question entities for semantic similarity, and return the graph node with the highest similarity value;
[0111] Step 4: Use the searched graph node as the center point, query all related triples of the node, and save the triples in a list;
[0112] Step 5: Traverse the triple list again, use the BERT semantic similarity model to measure the similarity between the triple and the question text, and return the triple with the highest similarity. The relationship edge contained in the triple is the question relationship.
[0113] Step 6: Return the graph nodes and relationship edges.
[0114] The above steps are partially implemented based on the answer query model. Different question types will use different answer query model strategies to achieve answer retrieval. When searching for answers based on the knowledge graph, all graph nodes and relationship edges similar to the question are returned, recalling a large number of candidate answers similar to the question. Based on the candidate answers, the semantic similarity model is then used to return the node or edge most similar to the question as the answer. Therefore, question generalization further improves the generalization ability and accuracy of multi-strategy knowledge graph question answering.
[0115] The above are only preferred embodiments of the invention and are not intended to limit the patent scope of the invention. Any equivalent structure or equivalent process transformation made using the contents of the invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the invention.
Claims
1. A multi-strategy knowledge graph question answering method, characterized by: The method comprises the following steps: S1: Classify the types of questions according to their content; S2: Based on the classified questions, the entity recognition model is used to identify the question entities. The question entities are linked to the graph nodes through fuzzy queries. The required search content is converted into Cypher statements according to the questions. Different query strategies are selected for different types of questions to obtain the triples corresponding to the questions. S3: Use fuzzy query to match similar graph nodes for question entities, use the BERT model to match relevant nodes and edges for question relations, and use the semantic similarity model to select the node or edge most similar to the question and output it as the answer to the question; The types of problems include attribute query problems, statistical query problems and temporal reasoning problems; For attribute query problems, step S2 specifically includes: S201: Use the BERT+BiLSTM+CRF model to perform named entity recognition on the question; S202: Link the problem entity to the graph node and determine whether the problem entity matches the graph node. If so, use Cypher language to fuzzy query all triples of the node and execute step S204. Otherwise, execute step S203. S203: re-segment the entity, and return to step S202; S204: vectorizing all the triples and question texts found out; S205: Use the BERT model to measure the similarity between the question and each triple, and return the triple with the largest similarity value; S206: Output the tail entity of the returned triple as the answer to the question.
2. The multi-strategy knowledge graph question answering method according to claim 1, characterized in that: For statistical query questions, step S2 specifically includes: S221: Use the BERT+BiLSTM+CRF model trained on project data to identify the problem subject; S222: Reuse the entity recognition model to identify the problem object; S223: Using Cypher statements, perform a triple fuzzy query with the question subject as the head entity and the question object as the tail entity; S224: Return all tail entities matched by the fuzzy query as the answer to the question; if the fuzzy query has no result, execute step S225; otherwise, execute step S226; S225: Using Cypher statements, perform a triple fuzzy query with the question subject as the tail entity and the question object as the head entity; S226: Return all the header entities that match the fuzzy query as the answer to the question; if the fuzzy query has no result, terminate; S227: Count the number of entities that return answers to the question and output it as another question result.
3. The multi-strategy knowledge graph question answering method according to claim 1, characterized in that: For temporal reasoning problems, step S2 specifically includes: S231: Use the BERT+BiLSTM+CRF model to identify problematic entities; S232: Set time calculation rules, enter a question, and return the start time and end time involved in the question; S233: Calculate the difference between the start time and the end time, thereby counting the date of each day between the start time and the end time, and save it as a time list; S234: In the knowledge graph, with the question entity as a node, traverse the time list in sequence, use each date in the list as a relationship edge or graph node, and use Cypher statements to perform triple fuzzy query; S235: storing the nodes or relationship edges obtained by the fuzzy query into the answer list in sequence; S236: Output the answer to the question.
4. The multi-strategy knowledge graph question answering method according to claim 3, characterized in that: The step S3 specifically includes: S311: Collect entity data and semantically similar text data in professional fields, and use this data to train the BERT+BILSTM entity recognition model and the BERT semantic similarity model; S312: Use the trained BERT+BiLSTM model to identify the problem entity and link the entity to the knowledge graph. If successful, jump to step 4; if the entity is not linked to the graph node, jump to step 3; S313: Traverse the graph nodes one by one, use the BERT model to match the nodes with the question entity for semantic similarity, and return the graph node with the highest similarity value; S314: Using the searched graph node as the center point, query all related triples of the node and save the triples in a list; S315: Then traverse the triple list in sequence, use the BERT semantic similarity model to measure the similarity between the triple and the question text, and return the triple with the highest similarity value. The relationship edge contained in the triple is the question relationship; S316: Return graph nodes and relationship edges; S317: Use the semantic similarity model to select the node or edge that is most similar to the question and output it as the answer to the question.
Citation Information
Patent Citations
Intelligent searching method based on natural language and knowledge graph engineering information
CN111708899A
Supplier association analysis method and device based on knowledge graph
CN112836919A