A knowledge graph question answering method, device and equipment and storage medium

By generating a similarity value matching method for topic query graphs and result candidate graphs, the problem of parsing complex questions and obtaining answers in knowledge graphs is solved, achieving more accurate and richer question-answering results.

CN117290478BActive Publication Date: 2025-12-26CRRC INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311215605.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-20
Publication Date
2025-12-26
Estimated Expiration
2043-09-20

AI Technical Summary

Technical Problem

Existing knowledge graphs suffer from incomplete knowledge and missing links in specific domains, making it difficult to effectively parse complex questions and obtain topic information, resulting in poor performance in multi-hop question answering.

Method used

By acquiring the query information input by the user, parsing the query statement to generate a topic query graph, using a preset knowledge graph to generate candidate result graphs, calculating the similarity value between the two, and selecting the candidate result graph with the largest similarity value as the answer.

Benefits of technology

It enables accurate retrieval of answers to complex questions involving multiple hops and aggregations within knowledge graphs, avoiding the loss of topical information and improving the accuracy and richness of question answering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117290478B_ABST
    Figure CN117290478B_ABST
Patent Text Reader

Abstract

The application relates to a knowledge graph question answering method, device and equipment and a storage medium. Main technical solutions comprise the following steps: acquiring inquiry information input by a user, wherein the inquiry information comprises an inquiry sentence; analyzing the inquiry sentence to obtain a subject query graph; generating a result candidate graph of the inquiry sentence according to the subject query graph and a preset knowledge graph; calculating a similarity value of the subject query graph and the result candidate graph; and generating reply information according to the result candidate graph with the maximum similarity value. The subject query graph contains more rich structural feature representations and subject information of the inquiry sentence, avoids loss of the subject information of the inquiry sentence, and accurately answers answers to complex questions such as multi-hop and aggregation by matching the subject query graph and the result candidate graph.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, in particular to a knowledge graph question answering method and device, equipment and a storage medium. BACKGROUND

[0002] Knowledge graph question answering is a natural language understanding and generation technology based on knowledge graph, aiming to solve the interaction problem between human and computer. In recent years, with the rapid development of artificial intelligence technology, knowledge graph question answering has also been widely concerned and researched.

[0003] At present, whether it is a general graph or a graph in a certain field, the simple question answering effect of its construction has reached a relatively good level, but in a specific field, there are many challenges such as imperfect knowledge graph, missing links and the like for multi-hop question answering. Many methods lack the analysis of complex questions and the acquisition of the theme information of the question, so it is difficult to find the answer to the question in the knowledge graph. SUMMARY

[0004] Based on this, the present application provides a knowledge graph question answering method, device, equipment and storage medium, which can accurately find the answer to complex questions such as multi-hop and aggregation in the knowledge graph.

[0005] In a first aspect, a knowledge graph question answering method is provided, which comprises:

[0006] Obtaining inquiry information input by a user, wherein the inquiry information comprises a question sentence;

[0007] Analyzing the question sentence to obtain a theme query graph;

[0008] Generating a result candidate graph of the question sentence according to the theme query graph and a preset knowledge graph;

[0009] Calculating the similarity value of the theme query graph and the result candidate graph;

[0010] Generating reply information according to the result candidate graph with the largest similarity value.

[0011] According to an implementable manner in the embodiments of the present application, the question sentence is analyzed to obtain a theme query graph, which comprises:

[0012] Obtaining the word vector of the question sentence through a pre-trained theme extraction model;

[0013] Performing dimension reduction processing on the word vector by using a data dimension reduction analysis algorithm to obtain a reduced dimension word vector;

[0014] Selecting at least one theme word of the question sentence according to the reduced dimension word vector;

[0015] According to the query sentence and the at least one subject word, a subject query graph is generated.

[0016] According to an implementable manner in the embodiments of the present application, according to the query sentence and the at least one subject word, a subject query graph is generated, comprising:

[0017] The query sentence is subjected to syntax analysis to obtain a question dependency tree graph, wherein the question dependency tree graph comprises at least one vertex;

[0018] The query sentence is subjected to vertex identification to obtain question entity information;

[0019] The query sentence is subjected to relation extraction to obtain entity relation information;

[0020] According to the question dependency tree graph, the at least one subject word, the question entity information, the at least one vertex and the entity relation information, a subject query graph is generated.

[0021] According to an implementable manner in the embodiments of the present application, the subject query graph comprises a first vertex and target entity information, and a preset knowledge graph comprises a second vertex; according to the subject query graph and the preset knowledge graph, a result candidate graph of the query sentence is generated, comprising:

[0022] The first vertex is linked as an entity to the second vertex;

[0023] According to the target entity information, a target second vertex is obtained by matching the target entity in the subject query graph with a corresponding second vertex in the preset knowledge graph;

[0024] The target second vertex is connected to obtain the result candidate graph of the query sentence.

[0025] According to an implementable manner in the embodiments of the present application, the similarity value of the subject query graph and the result candidate graph is calculated, comprising:

[0026] Node information of nodes in the subject query graph and the result candidate graph is extracted;

[0027] According to the node information, a node similarity value of the subject query graph and the result candidate graph is calculated;

[0028] According to the node similarity value of the subject query graph and the result candidate graph, a similarity value of the subject query graph and the result candidate graph is calculated.

[0029] According to an implementable manner in the embodiments of the present application, the node information comprises a total number of nodes, a total set of nodes and a linked node vector; the node information of nodes in the subject query graph and the knowledge graph subgraph is extracted, comprising:

[0030] The total number of nodes in the subject query graph and the result candidate graph is calculated by using a first formula, and the first formula is expressed as:

[0031] n = |R1| + |R2|

[0032] Where n represents the total number of nodes, R1 represents the set of nodes in the topic query graph, R2 represents the set of nodes in the result candidate graph, |R1| represents the number of nodes in the topic query graph, and R2 represents the number of nodes in the result candidate graph;

[0033] The second formula is used to calculate the total set of nodes in the topic query graph and the result candidate graph. The second formula is expressed as:

[0034] U = R1∪R2

[0035] Where U represents the total set of nodes, R1 represents the set of nodes in the topic query graph, and R2 represents the set of nodes in the result candidate graph;

[0036] The link node vectors of nodes in the topic query graph and the result candidate graph are calculated using the third and fourth formulas. The third formula is expressed as:

[0037]

[0038] in, express The vector of node degree in the middle. Let u be the set of nodes that are hop neighbors from the original node u to k, where k ≥ 0 and u ∈ U. Let vector() represent a variable-length array function.

[0039] When k∈[1,K], the fourth formula is expressed as:

[0040]

[0041] Where K is the set diameter, d u Represents a vector of linked nodes. express Let be a vector representing the degree of the nodes.

[0042] Based on node information, calculate the node similarity values ​​between the topic query graph and the result candidate graph, including:

[0043] Based on the link node vectors, a similarity algorithm is used to calculate the node similarity value between the topic query graph and the result candidate graph. The similarity algorithm is expressed by the following formula:

[0044]

[0045] Where sim(n1,n2) represents the node similarity value, γ s Represents a scalar parameter. This represents the link node vector of node n1 in the topic query graph of the total set of nodes U. A link node vector of a node n2 of the result candidate graph in the total set of nodes U.

[0046] According to an implementable manner in the embodiments of the present application, the similarity value of the topic query graph and the result candidate graph is calculated according to the node similarity values of the topic query graph and the result candidate graph, and includes:

[0047] The node similarity matrix is generated according to the node similarity values of the topic query graph and the result candidate graph.

[0048] The similarity value of the topic query graph and the result candidate graph is calculated based on the node similarity matrix by using a fifth formula, which can be expressed as:

[0049]

[0050] Wherein, α represents the similarity value of the topic query graph and the result candidate graph, sim ij The node similarity value of the i th node in the topic query graph and the j th node in the result candidate graph is represented, |R1| represents the number of nodes of the topic query graph, and |R2| represents the number of nodes of the result candidate graph.

[0051] In a second aspect, a knowledge graph question answering device is provided, which includes:

[0052] An acquisition module is configured to acquire inquiry information input by a user, wherein the inquiry information includes an inquiry sentence.

[0053] An analysis module is configured to analyze the inquiry sentence to obtain a topic query graph.

[0054] A first generation module is configured to generate a result candidate graph of the inquiry sentence according to the topic query graph and a preset knowledge graph.

[0055] A calculation module is configured to calculate the similarity value of the topic query graph and the result candidate graph.

[0056] A second generation module is configured to generate reply information according to the result candidate graph with the largest similarity value.

[0057] In a third aspect, a computer device is provided, which includes:

[0058] At least one processor; and

[0059] A memory in communication connection with the at least one processor; wherein

[0060] The memory stores computer instructions executable by the at least one processor, and the computer instructions are executed by the at least one processor to enable the at least one processor to execute the method involved in the first aspect.

[0061] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium has stored thereon computer instructions. The computer instructions are used to cause a computer to execute the method involved in the first aspect.

[0062] According to the technical content provided in the embodiments of the present application, the inquiry information input by a user is acquired, wherein the inquiry information includes an inquiry sentence, the inquiry sentence is parsed to obtain a topic query graph, a result candidate graph of the inquiry sentence is generated according to the topic query graph and a preset knowledge graph, a similarity value of the topic query graph and the result candidate graph is calculated, and reply information is generated according to the result candidate graph with the maximum similarity value. The topic query graph contains richer structural feature representation and topic information of the inquiry sentence, avoids loss of the topic information of the inquiry sentence, and accurately answers the answers to complex questions such as multi-hop and aggregation by matching the topic query graph and the result candidate graph. BRIEF DESCRIPTION OF DRAWINGS

[0063] Figure 1 An application environment diagram of the knowledge graph question answering method in one embodiment;

[0064] Figure 2 A flowchart of the knowledge graph question answering method in one embodiment;

[0065] Figure 3 A structural block diagram of the knowledge graph question answering device in one embodiment;

[0066] Figure 4 A schematic structural diagram of a computer device in one embodiment. DETAILED DESCRIPTION

[0067] The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely intended to explain the present application and are not intended to limit the present application.

[0068] Knowledge graph question answering is one of the technical routes of natural language field in intelligent question answering application. As a bottom-layer question answering technology based on knowledge graph, compared with the question answering method based on reading comprehension and the question answering method based on common questions, the knowledge graph question answering can combine the advanced information retrieval service model of industry graph to complete information extraction through confirmation, feedback and integration.

[0069] Currently, knowledge graph question answering has become an important research direction in the field of natural language processing. It is widely used in medical, financial, and government fields. For example, in the medical field, knowledge graph question answering can help doctors quickly and accurately diagnose diseases and improve medical efficiency; in the financial field, knowledge graph question answering can help investors better understand market dynamics and make more informed investment decisions; in the government field, knowledge graph question answering can help the government better understand public opinion and provide better public services.

[0070] In the future, knowledge graph-based question answering systems should aim to build models with high accuracy, strong interpretability, and stability, and continuously update the technology in the field of knowledge graph question answering. At the same time, it is also necessary to strengthen the quality control and data management of knowledge graph, and improve the credibility and usability of knowledge graph.

[0071] The basic principle of knowledge graph question answering is to convert the user's question into a machine-understandable form, then query the knowledge graph to obtain the answer, and finally convert the answer into a human-understandable form and return it to the user. Specifically, knowledge graph question answering includes the following steps:

[0072] (1) Question representation: convert the user's question into a machine-understandable form, such as using natural language processing techniques to perform word segmentation, named entity recognition, and other operations on the question.

[0073] Query knowledge graph: use graph database and other technologies to query the knowledge graph and obtain information related to the question, such as entities, attributes, and other information.

[0074] (2) Answer generation: generate answers based on the information obtained by querying the knowledge graph, which can use text generation models, template matching, and other technologies.

[0075] (3) Answer representation: convert the generated answer into a human-understandable form, such as using natural language generation techniques to perform syntax analysis, semantic disambiguation, and other operations on the answer.

[0076] Knowledge graph question answering can be divided into sequence encoding-based methods and path encoding-based methods. Sequence encoding is to convert the words or characters in the question into vectors by using word or character vector models, and then represent the question by sequence vectors. For example, an improved phased query graph method (QGG) applies a pre-trained bidirectional encoder representation from Transformers (BERT) model to the question to convert the question into a word vector, and then performs a query graph prediction task. Knowledge graph question answering directly applies a convolutional neural network to the question sequence and the path sequence to perform an encoding task, and finds the answer by calculating the inner product similarity. The autonomous access control model encodes and represents the question by using a bidirectional gated recurrent unit model. Most of the above methods apply the BERT pre-training model, which provides a certain theoretical and practical basis for this research. Although sequence encoding lacks interpretability, experiments show that the vector representation of natural language generated by deep learning has a clear leading position in performance.

[0077] The path method can more intuitively observe the encoding sequence. Specifically, it is a method of encoding the syntactic path of the question itself, such as a dependency tree model or a structural path model. The syntactic path information contains more information about the subject, predicate and object of the question, and can better identify the key semantics of the natural language question. The structural representation method also becomes a graph representation method, such as the CompaQ of Converse, which is a dependency path representation method for entity information in the question using a recurrent neural network. Although the path method is more intuitive, it lacks the overall structure information of the question and loses the language meaning of the entity itself.

[0078] To solve the problems in the prior art, the embodiments of the present application provide a knowledge graph question answering method, device, equipment and computer storage medium.

[0079] For the convenience of understanding, the system to which the present application is applied is described first. The knowledge graph question answering method provided by the present application can be applied to, for example, a knowledge graph question answering system as shown in FIG. 1. Figure 1The system architecture shown. Among them, the terminal 110 communicates with the server 120 through the network. The user inputs the inquiry information through the terminal 110, and the server 120 obtains the inquiry information input by the user, wherein the inquiry information includes an inquiry sentence, the inquiry sentence is parsed, a topic query graph is obtained, a result candidate graph of the inquiry sentence is generated according to the topic query graph and a preset knowledge graph, the similarity value of the topic query graph and the result candidate graph is calculated, and the reply information is generated according to the result candidate graph with the largest similarity value. Wherein, the terminal 110 can be, but not limited to, various personal computers, notebook computers, smart phones and tablet computers, and the server 120 can be realized by an independent server or a server cluster composed of multiple servers.

[0080] Figure 2 The flowchart of the knowledge graph question answering method provided by an embodiment of the application is shown. As shown in the figure, Figure 2 The method can include the following steps:

[0081] S210, obtaining the inquiry information input by the user.

[0082] Among them, the inquiry information includes inquiry sentence, inquiry user, inquiry time, inquiry type and other information.

[0083] The user inputs the inquiry sentence through the touch display screen or the key of the terminal device, or selects the inquiry sentence that needs to be consulted according to the displayed inquiry sentence. After the terminal device receives the operation information input by the user, the inquiry information is generated and sent to the server. The server receives the inquiry information input by the user and processes it subsequently.

[0084] S220, parsing the inquiry sentence to obtain a topic query graph.

[0085] The topic query graph is a complex sentence graph containing topic words. The topic words are obtained by parsing the inquiry sentence, then the dependency tree graph of the inquiry sentence is obtained by parsing the inquiry sentence, then the entity information of the inquiry sentence is obtained by vertex recognition, the connection relationship between the entities in the inquiry sentence is extracted, and finally the topic words are inserted into the dependency tree graph according to the entity information and the connection relationship to obtain the topic query graph. The topic query graph includes topic words, entities and at least one vertex.

[0086] S230, generating a result candidate graph of the inquiry sentence according to the topic query graph and a preset knowledge graph.

[0087] The preset knowledge graph is a structured semantic knowledge base of a certain field set in advance, which is used to describe various entities and concepts in the real world and their relationships. Its basic component unit is entity-relation-entity triple, entities are connected with each other through relations, and a network-like knowledge structure is formed.

[0088] The subject query graph is used to find a plurality of related subgraphs in the preset knowledge graph, and the plurality of subgraphs are matched with the subject query graph. The subgraphs are result candidate graphs, and the result candidate graphs belong to a part of the preset knowledge graph and can correspond to the meaning expressed by the inquiry sentence as much as possible. The result candidate graph includes an entity and at least one vertex.

[0089] S240, calculating a similarity value of the subject query graph and the result candidate graph.

[0090] The subject word and the entity in the subject query graph are taken as a node, and the entity in the result candidate graph is taken as a node. Node information of all nodes in the subject query graph and the result candidate graph is extracted, wherein the node information includes vector information of each node, and the vector information includes a vector of the node itself and vectors of nodes linked with the node. After the vector information of all nodes is found, a similarity value between nodes of the subject query graph and the result candidate graph is calculated, and the similarity values between the nodes are accumulated to obtain the similarity value of the subject query graph and the result candidate graph.

[0091] S250, generating reply information according to the result candidate graph with the largest similarity value.

[0092] The result candidate graph with the largest similarity value is the optimal answer graph structure of the inquiry sentence, and the graph can be converted to generate a standard query sentence to be executed in the knowledge graph to obtain the answer of the inquiry sentence. The reply information is generated and sent to the terminal to be fed back to the user.

[0093] It can be seen that, in the embodiments of the present application, inquiry information input by a user is acquired, wherein the inquiry information includes an inquiry sentence, the inquiry sentence is parsed to obtain a subject query graph, result candidate graphs of the inquiry sentence are generated according to the subject query graph and a preset knowledge graph, a similarity value of the subject query graph and the result candidate graph is calculated, and reply information is generated according to the result candidate graph with the largest similarity value. The subject query graph contains richer structural feature representation and subject information of the inquiry sentence, avoids loss of the subject information of the inquiry sentence, and accurately responds to answers of complex questions such as multi-hop and aggregation through matching of the subject query graph and the result candidate graph.

[0094] The steps in the above method process are described in detail below. First, the above S220, i.e., "parsing the inquiry sentence to obtain the subject query graph", is described in detail in combination with an embodiment.

[0095] As a realizable way, a word vector of the inquiry sentence is acquired through a pre-trained subject extraction model;

[0096] A data dimension reduction analysis algorithm is used to perform dimension reduction processing on the word vector to obtain a reduced dimension word vector;

[0097] At least one subject word of the inquiry sentence is selected according to the reduced dimension word vector.

[0098] generate a topic query graph according to the query statement and the at least one topic word.

[0099] The pre-trained topic extraction model is a Business Technology Platform (BTP) based topic extraction model, which is based on the BERTopic model and can generate word vectors using the BERT algorithm. The model also includes a data dimension reduction algorithm and a clustering algorithm.

[0100] After obtaining the word vector of the query statement, the topic extraction model in the dimension reduction stage adopts the Principal Component Analysis (PCA) algorithm as the data dimension reduction algorithm. The PCA algorithm can more effectively understand the data and extract more important information components of the data itself by reducing the high-dimensional data to a lower-dimensional space. Although the data after dimension reduction is difficult to explain its meaning in words, each dimension of data contains the saturated information of the original data, which can more intuitively present the value of the data itself. For example, when the data is reduced to two-dimensional or three-dimensional space, it can be expressed in a clearer graph. The word vector processed by the PCA algorithm is a dimension-reduced word vector.

[0101] The topic extraction model uses the HDBSCAN text clustering algorithm to cluster the dimension-reduced word vector, and uses the original function to select the cluster keywords to obtain at least one topic word of the query statement. The query statement and the selected topic word are matched in multiple-to-multiple mode by the topic extraction model, so that each query statement has its own topic word, narrowing the scope of the knowledge graph query.

[0102] As an implementable way, a topic query graph is generated according to the query statement and the at least one topic word, comprising:

[0103] performing syntax analysis on the query statement to obtain a question dependency tree graph, wherein the question dependency tree graph includes at least one vertex;

[0104] performing vertex recognition on the query statement to obtain question entity information;

[0105] performing relation extraction on the query statement to obtain entity relationship information;

[0106] generating a topic query graph according to the question dependency tree graph, the at least one topic word, the question entity information, the at least one vertex, and the entity relationship information.

[0107] The method of syntactic dependency tree is used to analyze the syntax of the inquiry sentence, and the dependency tree graph of the question sentence is obtained. The dependency tree graph of the question sentence is a macro-structure graph, which includes at least one vertex. The syntactic dependency tree is a graphical representation method for analyzing the structure of a natural language sentence. It consists of a tree structure, where each node represents a grammatical unit, such as a word, phrase, or sentence.

[0108] In the syntactic dependency tree, each node is associated with its parent node and child node, representing the dependency relationship between them. For example, in a sentence "I am eating an apple", "I" is the subject, "am" is the present progressive of the predicate verb, "eat" is the predicate verb, and "apple" is the object. These grammatical units can be organized into a tree, where "I" is the root node, and its child nodes include "am", "eat", and "apple".

[0109] The BERT classifier and the natural language analysis tool CoreNLP are used to identify the vertices of the inquiry sentence, and the entity information of the question sentence is obtained. The entity information of the question sentence includes the entity of the question sentence, the vector representation of the problem entity, and the type variable.

[0110] The BLSTM-crf model is used to extract the relationship of the inquiry sentence, and the entity relationship information is obtained. The entity relationship information includes the connection relationship between the entities in the inquiry sentence.

[0111] According to the vector similarity between the subject words, similar subject words are merged together. The subject words and each entity are linked according to the maximum value of the sim approximation in the word vector space. The entity is linked to at least one vertex. The at least one vertex is connected according to the connection relationship between the entities. The connection between the vertices is superimposed with the relationship line in the dependency tree graph of the question sentence to obtain the theme query graph.

[0112] The above step S230, i.e. "generating the result candidate graph of the inquiry sentence according to the theme query graph and the preset knowledge graph", is described in detail below in conjunction with an embodiment.

[0113] As an implementable way, the first vertex is linked to the second vertex as an entity;

[0114] According to the target entity information, the target entity in the theme query graph is matched with the corresponding second vertex in the preset knowledge graph, and the target second vertex is obtained;

[0115] The target second vertex is connected to obtain the result candidate graph of the inquiry sentence.

[0116] The subject query graph includes a first vertex and target entity information, the first vertex is a vertex in the subject query graph related to the query sentence, and the target entity information is entity information in the subject query graph related to the query sentence, which can include the name, type, and attributes of the target entity. The preset knowledge graph includes a second vertex, which is a vertex in the preset knowledge graph corresponding to the first vertex.

[0117] Each vertex in the subject query graph is linked to the corresponding second vertex in the preset knowledge graph as an entity mention of the result candidate graph by a dictionary-based entity linking method. The target entity in the subject query graph is determined according to the target entity information, and the target entity is matched with the entities in the preset knowledge graph. The second vertex corresponding to the matched entity is the target second vertex, and the subgraph search is completed. The target second vertex is connected to obtain the result candidate graph of the query sentence. When analyzing multi-hop and complex query sentences, different step lengths can be set to meet the needs of multi-hop and complex question answering.

[0118] The step S240, i.e., "calculating the similarity value of the subject query graph and the result candidate graph", will be described in detail below in combination with an embodiment.

[0119] As an implementable way, node information of nodes in the subject query graph and the result candidate graph is extracted.

[0120] According to the node information, the node similarity value of the subject query graph and the result candidate graph is calculated.

[0121] According to the node similarity value of the subject query graph and the result candidate graph, the similarity value of the subject query graph and the result candidate graph is calculated.

[0122] The node information can include the total number of nodes, the total set of nodes, and the linked node vector, wherein the linked node is a neighbor node from the original node to k hops, the original node passes through an edge, and k=1, and the linked node vector is a vector from the original node to the k-hop neighbor node. Each node can be any word in the query sentence. The first formula is used to calculate the total number of nodes in the subject query graph and the result candidate graph, and the first formula is represented as:

[0123] n = |R1| + |R2| (1)

[0124] Wherein, n represents the total number of nodes, R1 represents the node set of the subject query graph, and R2 represents the node set of the result candidate graph.

[0125] The second formula is used to calculate the total set of nodes in the subject query graph and the result candidate graph, and the second formula is represented as:

[0126] U = R1∪R2 (2)

[0127] Wherein, U represents the total set of nodes, R1 represents the node set of the subject query graph, and R2 represents the node set of the result candidate graph;

[0128] The link node vector of the node in the subject query graph and the result candidate graph is calculated by using the third formula and the fourth formula, and the third formula is represented as:

[0129]

[0130] Wherein, The vector of the intermediate node degree is represented as: is the node set of the k-hop neighbor node of the original node u, k≥0, u∈U, and vector() represents the variable-length array function;

[0131] When k∈[1,K], the fourth formula is represented as:

[0132]

[0133] Wherein, K is the set diameter, and d u The link node vector is represented as: The vector of the intermediate node degree is represented as:

[0134] According to the node information, the node similarity value of the subject query graph and the result candidate graph is calculated, including:

[0135] According to the link node vector, the node similarity value of the subject query graph and the result candidate graph is calculated by using the similarity algorithm, and the similarity algorithm is represented as the following formula:

[0136]

[0137] Wherein, sim(n1,n2) represents the node similarity value, λ s The scalar parameter is represented as: The link node vector of the node n1 in the subject query graph in the total node set U is represented as: The link node vector of the node n2 in the result candidate graph in the total node set U is represented as:

[0138] As an implementable way, according to the node similarity value of the subject query graph and the result candidate graph, the similarity value of the subject query graph and the result candidate graph is calculated, including:

[0139] According to the node similarity value of the subject query graph and the result candidate graph, the node similarity matrix is generated;

[0140] Based on the node similarity matrix, the similarity value of the subject query graph and the result candidate graph is calculated by using the fifth formula, and the fifth formula can be represented as:

[0141] ​​

[0142] wherein, a represents the similarity value of the subject query graph and the result candidate graph, sim ij represents the node similarity value of the ith node in the subject query graph and the jth node in the result candidate graph, |R1| represents the node number of the subject query graph, and |R2| represents the node number of the result candidate graph.

[0143] After the extraction of the node identity is completed, the node similarity value of the subject query graph and the result candidate graph is obtained, the similarity of the nodes in the subject query graph and the result candidate graph is determined, and a node similarity matrix of the structure and the attribute is constructed by using the method based on implicit matrix decomposition, which considers the kinship in different fields.

[0144] Firstly, an n x p node embedding matrix is constructed, wherein n is the total number of nodes, and p is a randomly selected node number less than n. In order to reduce the calculation of n x p similarity, p = n nodes are randomly selected in the subject query graph and the result candidate graph, the node similarity value of the node and all n nodes in the total node set U is determined, and an n x p local node similarity matrix C is obtained. The node similarity matrix S can be expressed as the following formula:

[0145] S = CU∑ 1 / 2 (7)

[0146] wherein C represents the node similarity matrix between n nodes and p randomly selected nodes, and U represents the total node set.

[0147] Since there can be multiple similar nodes of the node in the subject query graph in the result candidate graph, after the node similarity matrix is obtained, according to the size of the node similarity value of the node in the subject query graph and the node in the result candidate graph, the node with the largest node similarity value in the result candidate graph is determined as the most similar node, the node similarity value of the most similar node and the node in the subject query graph is taken as the final similarity value, and the node similarity values of the other similar nodes are represented by 0. The node similarity matrix contains the node similarity value of the node in the subject query graph and the most similar node in the result candidate graph, which is convenient for obtaining the node similarity of the subject query graph and the result candidate graph.

[0148] The node similarity value corresponding to the most similar node of each node in the subject query graph in the result candidate graph is accumulated by formula (6), and the similarity value of the subject query graph and the result candidate graph is obtained.

[0149] In this embodiment, by acquiring topic words and integrating them into a complex statement tree graph, and finding corresponding subgraphs (i.e., candidate graphs) in a preset knowledge graph using methods such as entity linking, the candidate graphs are finally matched with the topic query graph using graph matching to determine the similarity between the two graphs. This fully utilizes the information of the dependency tree structure, thereby obtaining richer structural feature representations. Furthermore, by using BERT's word vector method to obtain topic information for the added query statement, the question-oriented problem of the knowledge graph is solved. The final graph matching method also solves the problems of complex questions such as multi-hop and aggregation from the perspective of graphs.

[0150] It should be understood that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this application, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Furthermore, Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0151] Figure 3 This is a schematic diagram of the structure of a knowledge graph question-answering device provided in an embodiment of this application. The device can be disposed in... Figure 1 Server 120 in the system shown is used to perform, for example... Figure 2 The method flow is shown below. Figure 3 As shown, the device may include: an acquisition module 310, a parsing module 320, a first generation module 330, a calculation module 340, and a second generation module 350, and may further include: an extraction module. The main functions of each component module are as follows:

[0152] The acquisition module 310 is used to acquire query information input by the user, wherein the query information includes a query statement;

[0153] Parsing module 320 is used to parse the query statement to obtain a topic query graph;

[0154] The first generation module 330 is used to generate a result candidate graph of the query statement based on the topic query graph and the preset knowledge graph.

[0155] The calculation module 340 is used to calculate the similarity value between the topic query graph and the result candidate graph;

[0156] The second generation module 350 is configured to generate the reply information according to the result candidate graph with the largest similarity value.

[0157] As an implementable manner, the analysis module 320 is specifically configured to:

[0158] obtain a word vector of the inquiry sentence by using a pre-trained topic extraction model;

[0159] perform dimension reduction processing on the word vector by using a data dimension reduction analysis algorithm to obtain a reduced dimension word vector;

[0160] select at least one topic word of the inquiry sentence according to the reduced dimension word vector;

[0161] generate a topic query graph according to the inquiry sentence and the at least one topic word.

[0162] As an implementable manner, the first generation module 330 is specifically configured to:

[0163] perform syntax analysis on the inquiry sentence to obtain a question dependency tree graph, wherein the question dependency tree graph includes at least one vertex;

[0164] perform vertex identification on the inquiry sentence to obtain question entity information;

[0165] perform relation extraction on the inquiry sentence to obtain entity relation information;

[0166] generate a topic query graph according to the question dependency tree graph, the at least one topic word, the question entity information, the at least one vertex, and the entity relation information.

[0167] As an implementable manner, the topic query graph includes first vertices and target entity information, and the preset knowledge graph includes second vertices; the first generation module 330 is specifically configured to:

[0168] link the first vertices to the second vertices as entities;

[0169] match the target entity in the topic query graph with a corresponding second vertex in the preset knowledge graph according to the target entity information to obtain a target second vertex;

[0170] connect the target second vertex to obtain a result candidate graph of the inquiry sentence.

[0171] As an implementable manner, the calculation module 340 is specifically configured to:

[0172] extract node information of nodes in the topic query graph and the result candidate graph;

[0173] calculate node similarity values of the nodes in the topic query graph and the result candidate graph according to the node information;

[0174] According to the node similarity values of the topic query graph and the result candidate graph, a similarity value of the topic query graph and the result candidate graph is calculated.

[0175] As an implementable manner, the node information includes a total number of nodes, a total set of nodes, and a link node vector; the device further includes an extraction module configured to:

[0176] The total number of nodes in the topic query graph and the result candidate graph is calculated by using a first formula, and the first formula is represented as:

[0177] n = |R1| + |R2|

[0178] wherein n represents the total number of nodes, R1 represents the node set of the topic query graph, R2 represents the node set of the result candidate graph, |R1| represents the number of nodes of the topic query graph, and |R2| represents the number of nodes of the result candidate graph;

[0179] The total set of nodes in the topic query graph and the result candidate graph is calculated by using a second formula, and the second formula is represented as:

[0180] U = R1∪R2

[0181] wherein U represents the total set of nodes, R1 represents the node set of the topic query graph, and R2 represents the node set of the result candidate graph;

[0182] The link node vector of the nodes in the topic query graph and the result candidate graph is calculated by using a third formula and a fourth formula, and the third formula is represented as:

[0183]

[0184] wherein represents a vector of the node degree, is a node set of the k-hop neighbor node of the original node u, k ≥ 0, u ∈ U, and vector() represents a variable-length array function;

[0185] When k ∈ [1, K], the fourth formula is represented as:

[0186]

[0187] wherein K is a set diameter, and d u represents a link node vector, represents a vector of the node degree.

[0188] According to the node information, a node similarity value of the topic query graph and the result candidate graph is calculated, including:

[0189] According to the link node vector, a similarity algorithm is used to calculate the node similarity value of the topic query graph and the result candidate graph, and the similarity algorithm is expressed in the following formula:

[0190]

[0191] Wherein, sim(n1, n2) represents the node similarity value, γ s represents a scalar parameter, represents the link node vector of the node n1 of the topic query graph in the total node set U, represents the link node vector of the node n2 of the result candidate graph in the total node set U.

[0192] As an implementable way, the computing module 340 is specifically configured to:

[0193] According to the node similarity value of the topic query graph and the result candidate graph, a node similarity matrix is generated;

[0194] Based on the node similarity matrix, a fifth formula is used to calculate the similarity value of the topic query graph and the result candidate graph, and the fifth formula can be expressed as:

[0195]

[0196] Wherein, a represents the similarity value of the topic query graph and the result candidate graph, sim ij represents the node similarity value of the i th node in the topic query graph and the j th node in the result candidate graph, |R1| represents the node number of the topic query graph, and |R2| represents the node number of the result candidate graph.

[0197] The same and similar parts among the above various embodiments can be referred to each other, and each embodiment mainly describes the difference from other embodiments. Especially, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts can be referred to the part of the method embodiment.

[0198] It should be noted that the present application may involve the use of user data in the embodiments, and in actual application, user-specific personal data can be used in the schemes described herein within the scope allowed by applicable laws and regulations (for example, user's explicit consent, user's explicit authorization, etc.).

[0199] According to the embodiments of the present application, the present application also provides a computer device and a computer readable storage medium.

[0200] As Figure 4FIG. 1 shows a block diagram of a computer device according to an embodiment of the present application. The computer device is intended to represent various forms of digital computers or mobile devices. The digital computers can include desktop computers, portable computers, workstations, personal digital assistants, servers, mainframe computers, and other appropriate computers. The mobile devices can include tablets, smart phones, wearable devices, and the like.

[0201] As shown in FIG. 4, the device 400 includes a computing unit 401, a ROM 402, a RAM 403, a bus 404, and an input / output (I / O) interface 405. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other through the bus 404. The input / output (I / O) interface 405 is also connected to the bus 404. Figure 4

[0202] The computing unit 401 can perform various processes in the embodiments of the method of the present application according to computer instructions stored in the read-only memory (ROM) 402 or computer instructions loaded from the storage unit 408 to the random access memory (RAM) 403. The computing unit 401 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. The computing unit 401 can include, but is not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. In some embodiments, the method provided by the embodiments of the present application can be implemented as a computer software program, which is tangibly contained in a computer readable storage medium, such as the storage unit 408.

[0203] The RAM 403 can also store various programs and data required for the operation of the device 400. Part or all of the computer program can be loaded and / or installed on the device 400 via the ROM 802 and / or the communication unit 409.

[0204] The input unit 406, the output unit 407, the storage unit 408, and the communication unit 409 in the device 400 can be connected to the I / O interface 405. Among them, the input unit 406 can be, for example, a keyboard, a mouse, a touch screen, a microphone, etc.; the output unit 407 can be, for example, a display, a speaker, an indicator light, etc. The device 400 can exchange information, data, etc. with other devices through the communication unit 409.

[0205] It should be noted that the device can also include other components necessary for normal operation. It can also only contain components necessary to implement the scheme of the present application, and does not necessarily contain all the components shown in the figure.

[0206] ​Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations of them.

[0207] Computer instructions for implementing the methods of the present application can be written in any combination of one or more programming languages. These computer instructions can be provided to the computing unit 401 such that the computer instructions, when executed by the computing unit 401, such as a processor, cause the steps involved in the embodiments of the methods of the present application to be performed.

[0208] The computer readable storage medium provided by the present application can be a tangible medium, which can contain or store computer instructions for performing the steps involved in the embodiments of the methods of the present application. The computer readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, and the like forms of storage media.

[0209] The specific implementation described above does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application should be included in the scope of protection of the present application.

Claims

1. A knowledge graph question answering method, characterized in that, The method comprises: acquiring user input query information, wherein the query information comprises a query sentence; parsing the query sentence to obtain a subject query graph; generating a result candidate graph of the query sentence according to the subject query graph and a preset knowledge graph; calculating a similarity value of the subject query graph and the result candidate graph, specifically comprising: extracting node information of nodes in the subject query graph and the result candidate graph; calculating a node similarity value of the subject query graph and the result candidate graph according to the node information; and calculating a similarity value of the subject query graph and the result candidate graph according to the node similarity value of the subject query graph and the result candidate graph, wherein the node information comprises a total number of nodes, a total set of nodes and a link node vector, and the step of extracting the node information of the nodes in the subject query graph and the result candidate graph comprises: calculating the total number of nodes in the subject query graph and the result candidate graph by using a first formula, the first formula being represented as: ; wherein, denotes the total number of nodes, denotes the set of nodes of the subject query graph, denotes the set of nodes of the result candidate graph, denotes the number of nodes of the subject query graph, denotes the number of nodes of the result candidate graph; calculating the total set of nodes in the subject query graph and the result candidate graph by using a second formula, the second formula being represented as: ; wherein, denotes the total set of nodes, denotes the set of nodes of the subject query graph, denotes the set of nodes of the result candidate graph; calculating the link node vector of the nodes in the subject query graph and the result candidate graph by using a third formula and a fourth formula, the third formula being represented as: ; wherein, denotes a vector of node degrees, is a set of nodes of k-hop neighbors of the original node u, , , denotes a variable-length array function; When the fourth formula is expressed as: ; wherein K is a set diameter, denotes a link node vector, denotes is a vector of intermediate node degrees; generating reply information according to a result candidate graph with the largest similarity value.

2. The method of claim 1, wherein, The parsing of the query sentence to obtain a subject query graph comprises: obtaining a word vector of the query sentence through a pre-trained subject extraction model; performing dimension reduction processing on the word vector by using a data dimension reduction analysis algorithm to obtain a reduced dimension word vector; selecting at least one subject word of the query sentence according to the reduced dimension word vector; generating a subject query graph according to the query sentence and the at least one subject word.

3. The method of claim 2, wherein, The generation of a subject query graph according to the query sentence and the at least one subject word comprises: performing syntax analysis on the query sentence to obtain a question dependency tree graph, wherein the question dependency tree graph comprises at least one vertex; performing vertex identification on the query sentence to obtain question entity information; performing relation extraction on the query sentence to obtain entity relation information; generating a subject query graph according to the question dependency tree graph, the at least one subject word, the question entity information, the at least one vertex and the entity relation information.

4. The method of claim 1, wherein, The subject query graph comprises a first vertex and target entity information, and the preset knowledge graph comprises a second vertex; the generation of a result candidate graph of the query sentence according to the subject query graph and the preset knowledge graph comprises: linking the first vertex as an entity to the second vertex; matching a target entity in the subject query graph with a corresponding second vertex in the preset knowledge graph according to the target entity information to obtain a target second vertex; connecting the target second vertex to obtain a result candidate graph of the query sentence.

5. The method of claim 1, wherein, The calculation of a node similarity value of the subject query graph and the result candidate graph according to the node information comprises: According to the link node vector, a similarity algorithm is used to calculate node similarity values of the topic query graph and the result candidate graph, and the similarity algorithm is expressed as the following formula: ; wherein, represents a node similarity value, represents a scalar parameter, represents a total set of nodes link node vectors for nodes of a subject query graph represents a link node vector for a node of a result candidate graph, represents a total set of nodes link node vectors for nodes of a subject query graph represents a link node vector for a node of a result candidate graph.

6. The method of claim 5, wherein, The similarity value of the topic query graph and the result candidate graph is calculated according to the node similarity values of the topic query graph and the result candidate graph, and the calculation includes: A node similarity matrix is generated according to the node similarity values of the topic query graph and the result candidate graph; Based on the node similarity matrix, a fifth formula is used to calculate the similarity value of the topic query graph and the result candidate graph, and the fifth formula can be expressed as: ; wherein, denotes a similarity value of the subject query graph and the result candidate graph, denotes a node similarity value of the i-th node in the subject query graph and the j-th node in the result candidate graph, denotes a node similarity value of the i-th node in the subject query graph and the j-th node in the result candidate graph, denotes a node similarity value of the i-th node in the subject query graph and the j-th node in the result candidate graph, denotes a number of nodes of the subject query graph, denotes a number of nodes of the result candidate graph.

7. A knowledge graph question answering apparatus, characterized by comprising: The device comprises: An acquisition module configured to acquire inquiry information input by a user, wherein the inquiry information comprises an inquiry sentence; An analysis module configured to analyze the inquiry sentence to obtain a topic query graph; A first generation module configured to generate a result candidate graph of the inquiry sentence according to the topic query graph and a preset knowledge graph; A calculation module configured to calculate a similarity value of the topic query graph and the result candidate graph, and the calculation specifically includes: extracting node information of nodes in the topic query graph and the result candidate graph; calculating node similarity values of the topic query graph and the result candidate graph according to the node information; and calculating a similarity value of the topic query graph and the result candidate graph according to the node similarity values of the topic query graph and the result candidate graph, wherein the node information comprises a total number of nodes, a total set of nodes, and a link node vector, and the step of extracting the node information of the nodes in the topic query graph and the result candidate graph includes: calculating the total number of nodes in the topic query graph and the result candidate graph using a first formula, wherein the first formula is expressed as: ; wherein, denotes the total number of nodes, denotes the set of nodes of the subject query graph, denotes the set of nodes of the result candidate graph, denotes the number of nodes of the subject query graph, denotes the number of nodes of the result candidate graph; calculating the total set of nodes in the topic query graph and the result candidate graph using a second formula, wherein the second formula is expressed as: ; wherein, denotes the total set of nodes, denotes the set of nodes of the subject query graph, denotes the set of nodes of the result candidate graph; calculating the link node vector of the nodes in the topic query graph and the result candidate graph using a third formula and a fourth formula, wherein the third formula is expressed as: ; wherein, denotes a vector of node degrees, is a set of nodes that are k-hop neighbors of the original node u, , , denotes a variable-length array function; When the fourth formula is expressed as: ; wherein K is a set diameter, denotes a link node vector, denotes is a vector of the intermediate node degrees; A second generation module configured to generate reply information according to the result candidate graph with the largest similarity value.

8. A computer device, comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores computer instructions executable by the at least one processor, and the computer instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 6.

9. A computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Knowledge graph question-answering method and system based on graph neural network embedding matching

    CN112765312A