A semantic understanding method for complex problems based on knowledge graph

By generating semantic graphs and query graphs, the problem of identifying the importance of information in complex problems is solved, and efficient and accurate semantic understanding and answer generation are achieved.

CN114595341BActive Publication Date: 2025-10-03HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210264731.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-17
Publication Date
2025-10-03
Estimated Expiration
2042-03-17

AI Technical Summary

Technical Problem

Existing technologies have difficulty effectively identifying the importance of information when understanding complex problems, resulting in information loss and prediction errors, and are unable to accurately complete the semantic understanding of complex problems.

Method used

A semantic graph is generated through entity recognition and relationship extraction, and predictions are made using a query graph prediction model. The query path is traversed in the knowledge graph to obtain the answer through logical calculations. The BiLSTM and BERT models are combined for encoding and decoding to generate an accurate query graph.

Benefits of technology

It achieves accurate answers to complex questions, has excellent explainability and accuracy, and can efficiently understand and answer complex questions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114595341B_ABST
    Figure CN114595341B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for semantic understanding of complex questions based on a knowledge graph. The method first performs entity recognition and relationship extraction on the complex question, obtains entity features and inter-entity relationship features, and generates a semantic graph for the complex question. A query graph prediction model is used to predict the semantic graph, generating a query graph corresponding to the semantic graph. The query graph is then traversed through the knowledge graph to obtain a query path, and then the answer to the complex question is obtained based on the logical calculation of the complex question. The method of the present invention converts the input question into a corresponding query structure, has excellent interpretability and accuracy, and, combined with a knowledge graph search, can accurately complete the solution of complex questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language, and in particular to a method for semantic understanding of complex problems based on knowledge graphs. Background Art

[0002] Knowledge graphs provide effective data support for tasks such as search engines, intelligent question answering, and reasoning. Intelligent question answering based on knowledge graphs is an advanced form of information retrieval. It understands natural language questions posed by users, uses knowledge graphs to query, and returns accurate search results. While some progress has been made in understanding simple questions, the challenge of accurately and efficiently understanding and answering complex questions remains, as complex questions often involve multiple entities, multiple relationships, and multiple logical operations.

[0003] In recent years, various studies on semantic understanding of complex problems based on knowledge graphs have made breakthrough progress. The widely used semantic understanding methods mainly include: template-based methods, deep learning-based methods and query graph-based methods. Among them, the query graph-based method converts the input question into the corresponding query structure, which has good interpretability and accuracy. The query graph-based method mainly includes the steps of entity recognition, relationship extraction and semantic understanding. At present, the research on entity recognition and relationship extraction mainly recognizes and extracts by encoding the context information of the question, ignoring the structural information between entities, resulting in incorrect prediction of the head and tail nodes in the relationship extraction. The semantic understanding method based on the query graph cannot effectively distinguish the importance of information during the learning process, resulting in information loss and forgetting, leading to prediction errors and generating noisy query graphs, making complex problems difficult to understand. Summary of the Invention

[0004] Based on the above-mentioned shortcomings and deficiencies in the prior art, one of the objects of the present invention is to at least solve one or more of the above-mentioned problems in the prior art. In other words, one of the objects of the present invention is to provide a spliced ​​stacking table that meets one or more of the above-mentioned needs.

[0005] In order to achieve the above-mentioned object of the invention, the present invention adopts the following technical solutions:

[0006] A method for semantic understanding of complex problems based on knowledge graphs. Complex problems include entities, relationships, and logical operation features, including the following steps:

[0007] S1. Perform entity recognition and relationship extraction on complex problems to obtain entity features and relationship features between entities;

[0008] S2. Generate semantic graphs for complex problems using entity features and inter-entity relationship features;

[0009] S3. Use the query graph prediction model to predict the semantic graph and generate a query graph corresponding to the semantic graph;

[0010] S4. Traverse the query graph in the knowledge graph, and after obtaining the query path, get the answer to the complex question based on the logical calculation characteristics of the complex question.

[0011] As a preferred solution, step S1 specifically includes the following method:

[0012] S11. Use language representation models to identify complex problems and obtain entity features;

[0013] S12. Use the relationship extraction model to extract relationships from complex problems and obtain the relationship features between entities.

[0014] As a further preferred solution, step S12 specifically includes the following steps:

[0015] S121. Use BiLSTM model to obtain entity relationship context vectors for complex problems.

[0016] S122, encoding the entity features obtained in step S11 into an entity feature vector, and concatenating it with the entity relationship context vector to obtain a relationship extraction vector;

[0017] S123, using a graph encoder to encode entity features to obtain a semantic graph vector;

[0018] S124. Use the softmax function to calculate the relationship extraction vector and obtain the relationship features between entities.

[0019] As a further preferred solution, step S3 specifically includes the following steps:

[0020] S31. Use the word segmentation tool to obtain the word segmentation results for complex questions, and use the BERT model to encode the word segmentation results to obtain word vectors;

[0021] S32. Obtain a dependency tree for the complex problem and encode the dependency tree into a dependency tree vector;

[0022] S33, using a graph encoder to encode the semantic graph into a semantic graph vector;

[0023] S34. Take the word vector as input and use the BiLSTM model to encode the complex question and obtain the semantic understanding context vector;

[0024] S35. Construct an attention matrix using the dependency tree vector and the semantic graph vector.

[0025] S36. Calculate the context vector using the semantic understanding context vector and the attention matrix;

[0026] S37. Decode the attention matrix and context vector using the BiLSTM model to obtain the output vector.

[0027] S38. Use the output vector to predict the graph operation at each time step.

[0028] As a further preferred solution, the decoding end of the BiLSTM model defines four graph operations. The graph operation of each time step is obtained by taking the remainder of 4 for the time step.

[0029] As a preferred solution, step S0 is further included before step S1:

[0030] Sequence labeling for complex problems.

[0031] As a preferred solution, step S4 specifically includes:

[0032] S41, traverse the known entities using a depth-first algorithm to obtain a main query path;

[0033] S42: Adding logical calculation to the main query path to generate a query statement;

[0034] S43. Search the knowledge graph based on the query statement to get the answer to the complex question.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] The complex question semantic understanding method of the present invention converts the input question into a corresponding query structure, has excellent interpretability and accuracy, and combined with the search of the knowledge graph, can accurately complete the answer to complex questions. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is a flow chart of an embodiment of the present invention;

[0038] Figure 2 is a diagram of the labeling results of an embodiment of the present invention;

[0039] Figure 3 is an entity recognition result diagram of an embodiment of the present invention;

[0040] Figure 4 is a semantic graph of an embodiment of the present invention;

[0041] Figure 5 2 is a diagram illustrating operation of an embodiment of the present invention. DETAILED DESCRIPTION

[0042] To more clearly illustrate the embodiments of the present invention, specific embodiments of the present invention will be described below with reference to the accompanying drawings. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings and other embodiments can be obtained based on these drawings without inventive efforts.

[0043] Example:

[0044] This embodiment is a method for semantic understanding of complex problems based on knowledge graph, the flow chart of which is as follows: Figure 1 As shown, the following steps are included:

[0045] S1. Perform entity recognition and relationship extraction on complex problems to obtain entity features and inter-entity relationship features. More specifically, before step S1, step S0 is also included, which is to perform sequence labeling on complex problems based on the sequence labeling method, and split and label the entities and inter-entity relationships in the complex problems. Entity labeling is performed using the BMESO method, while inter-entity relationship labeling requires labeling the relationship type and the positions of its head and tail entities. In this embodiment, B is used to represent the first character of the entity, M represents the internal character of the entity, E represents the last character of the entity, S represents the single-character entity character, and O represents the non-entity character. In the relationship labeling, the relationship type and the head and tail entity positions are labeled, and N is used to represent non-relational words. Here is an example of a complex problem, and the results obtained based on the above labeling are as follows. Figure 2 shown.

[0046] After labeling is completed, the entity recognition and relationship extraction of step S1 are executed. Specifically, step S1 is divided into two parts: S11, using the language representation model to identify complex problems and obtain entity features; S12, using the relationship extraction model to extract relationships from complex problems and obtain relationship features between entities.

[0047] In this embodiment, the entity recognition of S11 can use the BERT-BiLSTM-CRF model to identify complex problems. Based on the entity recognition results of the above example, Figure 3 , containing three entities: Pennsylvania, 7800, and 40,000,000. The relation extraction model in S12 is based on BiLSTM and semantic graph embedding.

[0048] More specifically, in this embodiment, S12 is divided into the following steps:

[0049] S121. Use the BiLSTM model and, based on the context vector acquisition function of the model, encode complex questions into entity relationship context vectors h containing context information. t; In detail, first, Q is segmented, and the segmentation results are converted into word vectors using BERT as the input of BiLSTM at each time step t, which is encoded into the entity relationship context vector h t .

[0050] S122: Encode the entity features obtained by entity recognition in step S11 as entity feature vector l t , and the entity relationship context vector h t The relationship extraction vector r is obtained by splicing according to the position t ;

[0051] S123, use the graph encoder to encode the above entity features to obtain the initial semantic graph vector

[0052] S124, Relationship extraction based on BiLSTM and semantic graph embedding, calculating the relationship extraction vector r through the softmax function t The corresponding relationship type R; then use the relationship to extract the vector r t and semantic graph vector Calculate the probability of each entity existing in the relationship type R. The semantic graph at time t is constructed by the relationship recognition result at time t-1, and the result is encoded to obtain the semantic graph vector The semantic graph vector input at time t=0 is Semantic graph vector and relation extraction vector r t Splice by position to get the output vector z t The probability calculation formula is:

[0053] P(r i , r j ,R)=softmax(U r σ(V r r i +W r r j +X T z t +b r ));

[0054] Among them, σ is the tanh activation function, U r 、V r 、W r 、X r are the parameter matrices to be learned, b r is the bias vector.

[0055] Then, step S2 is performed to generate a semantic graph of the complex problem using entity features and inter-entity relationship features;

[0056] Specifically, the triples obtained by the above calculation are merged to obtain a new semantic graph, and the graph vector is updated through the graph encoder. In the above formula, r i and r j are the output vectors of the head entity and the tail entity respectively. Since the tail entity of the relationship may be the entity to be queried, the entity vector to be queried is also added, such as Figure 4 The V0 entity in . It is stipulated that the query entity without adding a relationship can only be calculated as the tail entity, and the query entity with adding a relationship can only be calculated as the head entity. The query entity may be the same entity, which will be determined in subsequent steps.

[0057] When extracting relations, we first predict the relation type corresponding to the input word. For example, the relation type corresponding to words like How and Many is N, and we do not calculate the head and tail entities. When the input word is counties, we get the relation type as counties, and then predict its head and tail entities. The head entity is Pennsylvania, and the tail entity is the query entity V0. Based on the above rules and methods, the complete semantic graph obtained by predicting all input words is as follows: Figure 4 shown.

[0058] After the relationship extraction, step S3 is performed to predict the semantic graph using the query graph prediction model, find the logical operations in the complex problem, and add them to the semantic graph to generate a query graph corresponding to the semantic graph;

[0059] Furthermore, in this embodiment, the logical operations include comparison, judgment, counting, and maximum and minimum operations. The specific method of S3 includes:

[0060] S31. Use the word segmentation tool to obtain the word segmentation results of complex problems, and use the BERT model to encode the word segmentation results to obtain the word vector x t ;

[0061] S32. Obtain the dependency tree of the complex problem and encode the dependency tree into a dependency tree vector

[0062] S33. Use the graph encoder to encode the semantic graph into the initial semantic graph vector

[0063] S34, word vector x t As the input of BiLSTM, the complex question Q is encoded to obtain the semantic understanding context vector containing context information

[0064] S35. Using Dependency Tree Vector and semantic graph vector Construct the attention matrix; the construction function is:

[0065]

[0066] S36. Using semantic understanding context vector And the attention matrix calculates the context vector c t The calculation formula is:

[0067] S37. Attention Matrix and context vector c t Use BiLSTM model decoding to get the output vector

[0068] S38, use the output vector to predict the graph operation of each time step. Specifically, four graph operations are defined at the decoding end, which are: add entity, add relationship, select head entity and select tail entity. Predict the graph operations at time step t. The operation that should be performed at each time step t is obtained by taking the remainder of t with respect to 4.

[0069] If the remainder is 0, add an entity and select the entity type c to be added av , c av The calculation method is: When the prediction is END, it means that the decoding is completed and the query graph structure is output.

[0070] If the remainder is 1, perform the add relation operation and select the relation c to be added. se , c se The calculation method is:

[0071]

[0072] If the remainder is 2, perform the tail entity selection operation and select the tail entity c of the relationship. st , the calculation method is:

[0073]

[0074] If the remainder is 3, perform the head entity selection operation and select the head entity c of the relationship. sh , the calculation process is:

[0075]

[0076] Examples of graph operations include Figure 5As shown, at time step t=0, the entity adding operation is performed, and the added entity is predicted to be the “<” in the comparison entity. The entity is added to the semantic graph for encoding, and then the calculation of the next time step is performed. At time step t=1, the relationship adding operation is performed, and the relationship is predicted to be a comparison relationship, and then the calculation of the next time step is performed. At time step t=2, since a new entity is added in time step t=0, it directly enters the next time step as the tail entity. At time step t=4, the head entity is predicted, and the head entity is 40000000. The comparison relationship is added to the graph, the head entity is 40000000, and the tail entity is “<”, and the graph vector is updated. After multiple iterations, the following is finally obtained. Figure 4 When the predicted entity is Non, it means no new entity is added. When the predicted entity is End, it means the decoding end is finished and the query graph is output.

[0077] After obtaining the query graph, proceed to step S4, traverse the knowledge graph according to the query graph, and after traversing to obtain the query path, obtain the answer to the complex question based on the logical calculation characteristics of the complex question.

[0078] Furthermore, this embodiment searches for answers by converting the query graph into a SPARQL query statement. Specifically, a depth-first traversal algorithm is used, starting from known entities, to obtain a main query path that matches the query graph. Logical calculations are then added to the query path to obtain a complete SPARQL query statement. Finally, this query statement is applied to the knowledge graph to return the answer to the complex question.

[0079] It should be noted that the above embodiments can be freely combined as needed. The above is only a detailed description of the preferred embodiments and principles of the present invention. For those skilled in the art, based on the ideas provided by the present invention, there will be changes in the specific implementation methods, and these changes should also be considered within the scope of protection of the present invention.

Claims

1. A method for semantic understanding of complex problems based on knowledge graphs, wherein the complex problems include entities, relationships, and logical operation features, and the method is characterized by comprising the following steps; S1. Perform entity recognition and relationship extraction on the complex problem to obtain entity features and relationship features between entities; S2. Generate a semantic graph of the complex problem using the entity features and inter-entity relationship features; S3. Predict the semantic graph using a query graph prediction model to generate a query graph corresponding to the semantic graph; S4. Traversing the query graph in the knowledge graph, and after obtaining the query path, obtaining the answer to the complex question based on the logical calculation characteristics of the complex question; The step S3 specifically includes the following steps: S31. Use a word segmentation tool to obtain a word segmentation result for the complex question, and use a BERT model to encode the word segmentation result to obtain a word vector; S32. Obtain a dependency tree for the complex problem, and encode the dependency tree into a dependency tree vector; S33, using a graph encoder to encode the semantic graph into a semantic graph vector; S34. Using the word vector as input, a BiLSTM model is used to encode the complex question to obtain a semantic understanding context vector. S35. Construct an attention matrix using the dependency tree vector and the semantic graph vector; S36. Calculate a context vector using the semantic understanding context vector and the attention matrix; S37. Decode the attention matrix and the context vector using a BiLSTM model to obtain an output vector; S38. Use the output vector to predict the graph operation of each time step. When the prediction is END, it indicates the end of decoding and outputs the query graph structure.

2. A method for semantic understanding of complex problems based on knowledge graph according to claim 1, characterized in that: The step S1 specifically includes the following method: S11. Using a language representation model to identify the complex problem and obtain the entity features; S12. Use a relationship extraction model to extract relationships from the complex problem to obtain the relationship features between entities.

3. A method for semantic understanding of complex problems based on knowledge graph according to claim 2, characterized in that: The step S12 specifically includes the following steps: S121. Obtaining the entity relationship context vector of the complex problem using a BiLSTM model; S122, encoding the entity features obtained in step S11 into an entity feature vector, and concatenating the vector with the entity relationship context vector to obtain a relationship extraction vector; S123, using a graph encoder to encode the entity features to obtain a semantic graph vector; S124, based on BiLSTM and semantic graph embedding, the relationship type R corresponding to the relationship extraction vector is calculated by the softmax function; then the probability of the relationship type existing with each entity is calculated using the relationship extraction vector and the semantic graph vector respectively. This probability is the relationship feature between entities; the semantic graph vector and the relationship extraction vector are spliced ​​by position to obtain the output vector Z t The calculation formula of the relationship feature between entities is: P(r i ,r j ,R)=softmax(U r σ(V r r i +W r r j +X r z t +b r )); Where σ is the tanh activation function, U r 、V r 、W r 、X r are the parameter matrices to be learned, b r is the bias vector, r i and r j are the output vector of the head entity and the output vector of the tail entity respectively.

4. The method for semantic understanding of complex problems based on knowledge graph according to claim 1, characterized in that: The decoding end of the BiLSTM model defines four graph operations, and the graph operation of each time step is obtained by taking the remainder of 4 of the time step.

5. The method for semantic understanding of complex problems based on knowledge graph according to claim 1, characterized in that: The step S1 also includes step S0: Sequence labeling for complex problems.

6. The method for semantic understanding of complex problems based on knowledge graph according to claim 1, characterized in that: The step S4 specifically includes: S41, traverse the known entities using a depth-first algorithm to obtain a main query path; S42: Adding logical calculation to the main query path to generate a query statement; S43. Query the knowledge graph according to the query statement to obtain answers to complex questions.

Citation Information

Patent Citations

  • Knowledge graph questioning and answering method and device based on semantic blocks

    CN111930906A

  • Intelligent question and answer method and system based on tourism knowledge graph

    CN113535917A