Retrieval method and device based on knowledge graph
By calculating the intermediate center degree and graph embedding representation in the knowledge graph, and judging that the search statement is a fact class or event class, the problem of confusing search results in the existing technology is solved, and the search accuracy and user experience are improved.
Patent Information
- Application Number
- CN202111287340.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-07-08
- Filing Date
- 2021-11-02
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-11-02
AI Technical Summary
When using knowledge graphs for searching, the prior art cannot effectively distinguish user intentions, resulting in confusion and accuracy of search results, especially when dealing with fact-based and event-based queries.
By obtaining the search statement, determine the minimum sub-graph and intermediate center degree in the knowledge graph, calculate the graph embedding representation, and judge the search statement as a fact class or event class based on the preset threshold and similarity, and then return a result that is more consistent with the user's intentions. .
Improve the accuracy and user experience of the search results, and assist in judging user intentions through intermediate center and graph embedding representation, and return search results that are more in line with needs.
Smart Images

Figure CN113987126B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence in computer technology, and in particular to a retrieval method based on a knowledge graph. The present application also relates to a retrieval device based on a knowledge graph, a computing device, and a computer-readable storage medium. Background Art
[0002] Artificial intelligence (AI) refers to the ability of an engineered (i.e. designed and manufactured) system to perceive the environment, as well as the ability to acquire, process, apply and represent knowledge. The knowledge graph describes concepts, entities and their relationships in the objective world in a structured form, expresses the information on the Internet in a form closer to the human cognitive world, and provides a better ability to organize, manage and understand the massive amount of information on the Internet. The logical structure of the knowledge graph can be divided into a model layer and a data layer. The model layer is above the data layer and is the core of the knowledge graph. The model layer stores refined knowledge. An ontology library is usually used to manage the model layer of the knowledge graph. The ontology library's support for axioms, rules and constraints is used to standardize the connections between entities, relationships, and entity types and attributes. The data layer is mainly composed of a series of facts, and knowledge will be stored in units of facts. In the data layer of the knowledge graph, knowledge is stored in the graph database in units of facts. If the "entity-relationship-entity" or "entity-attribute-value" triple is used as the basic expression of facts, all data stored in the graph database will constitute a huge entity relationship network, forming a "knowledge graph".
[0003] With the development of Internet technology, more and more users are using knowledge graphs for retrieval. For example, when students face data problems that they cannot solve, they will use math question banks to search for answers, and when history enthusiasts encounter interesting history, they will use browsers to search. The use of knowledge graphs greatly facilitates users' retrieval of relevant content.
[0004] In the prior art, when using knowledge graphs for retrieval, subgraphs are usually retrieved based on the search statements entered by the user, and the importance of different nodes in the subgraphs is not differentiated, and all are directly returned to the user. However, after understanding the user's intention, only all subgraphs involved are returned based on the user's intention, without distinguishing the content. This will greatly reduce the user experience when the user may have different return requirements for factual and event categories. In addition, the returned content is confusing and cannot effectively provide feedback on the search statements entered by the user, which will greatly affect the accuracy of determining the search results. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the invention
[0005] In view of this, the embodiment of the present application provides a retrieval method based on a knowledge graph to solve the technical defects existing in the prior art. The embodiment of the present application also provides a retrieval device based on a knowledge graph, a computing device, and a computer-readable storage medium.
[0006] According to a first aspect of an embodiment of the present application, a knowledge graph-based retrieval method is provided, comprising:
[0007] Obtain a search statement, determine a minimum subgraph in the knowledge graph according to the search statement, and calculate the intermediate centrality and graph embedding representation of each node in the minimum subgraph;
[0008] According to a preset centrality threshold, determining at least two target nodes in the minimum subgraph, the target nodes being nodes whose intermediate centrality is higher than the centrality threshold;
[0009] In a case where the at least two target nodes form a path based on time information, calculating graph embedding representation similarities between two target nodes on the path;
[0010] If the graph embedding representation similarities of the two target nodes adjacent to the time information are both greater than the similarity threshold, the search statement is determined to be an event-type search statement;
[0011] If there are two target nodes whose time information is adjacent and whose graph embedding representation similarity is not greater than a similarity threshold, the search statement is determined to be a factual search statement.
[0012] According to a second aspect of an embodiment of the present application, a knowledge graph-based retrieval device is provided, comprising:
[0013] An acquisition module is configured to acquire a search statement, determine a minimum subgraph in the knowledge graph according to the search statement, and calculate the intermediate centrality and graph embedding representation of each node in the minimum subgraph;
[0014] A target node determination module is configured to determine at least two target nodes in the minimum subgraph according to a preset centrality threshold, wherein the target nodes are nodes whose intermediate centrality is higher than the centrality threshold;
[0015] A calculation module is configured to calculate the graph embedding representation similarity between two target nodes on the path when the at least two target nodes form a path based on time information;
[0016] An event-type search statement determination module is configured to determine the search statement as an event-type search statement if the graph embedding representation similarities of the two target nodes adjacent to the time information are both greater than a similarity threshold;
[0017] The fact-based search statement determination module is configured to determine the search statement as a fact-based search statement if the graph embedding representation similarity of two target nodes whose time information is adjacent is not greater than a similarity threshold.
[0018] According to a third aspect of an embodiment of the present application, a computing device is provided, including:
[0019] Memory and processor;
[0020] The memory is used to store computer-executable instructions, and the processor implements the steps of the knowledge graph-based retrieval method when executing the computer-executable instructions.
[0021] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the knowledge graph-based retrieval method are implemented.
[0022] According to a fifth aspect of an embodiment of the present application, a chip is provided, which stores computer instructions, and when the computer instructions are executed by the chip, the steps of the knowledge graph-based retrieval method are implemented.
[0023] The retrieval method based on knowledge graph provided in the present application obtains a retrieval statement, determines the minimum subgraph in the knowledge graph according to the retrieval statement, and calculates the intermediate centrality and graph embedding representation of each node in the minimum subgraph; determines at least two target nodes in the minimum subgraph according to a preset centrality threshold, and the target node is a node whose intermediate centrality is higher than the centrality threshold; in the case where the at least two target nodes constitute a path based on time information, calculates the graph embedding representation similarity between the target nodes on the path; if the graph embedding representation similarity of the two target nodes adjacent to the time information is greater than the similarity threshold, the retrieval statement is determined to be an event-type retrieval statement; if there are two target nodes adjacent to the time information, the graph embedding representation similarity is not greater than the similarity threshold, the retrieval statement is determined to be a fact-type retrieval statement. In this way, when searching the knowledge graph according to the obtained retrieval statement, the intermediate centrality and graph embedding representation can be used to assist in judging whether the user's intention is biased towards event-type retrieval results or fact-type retrieval results, so as to more accurately understand the user's intention and return results that are more in line with the user's intention. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a flowchart of a knowledge graph-based retrieval method provided in one embodiment of the present application;
[0025] Figure 2 This is a structural schematic diagram of dividing a minimum subgraph into two communities provided by an embodiment of the present application;
[0026] Figure 3 It is a processing flow chart of a knowledge graph-based retrieval method applied to a browser provided in one embodiment of the present application;
[0027] Figure 4 It is a schematic diagram of the structure of a knowledge graph-based retrieval device provided in one embodiment of the present application;
[0028] Figure 5 It is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0029] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0030] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0031] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0032] First, the terms involved in one or more embodiments of the present invention are explained.
[0033] Knowledge Graph is a series of various graphs that show the development process and structural relationship of knowledge. It uses visualization technology to describe knowledge resources and their carriers, and mines, analyzes, constructs, draws and displays knowledge and their mutual connections. It is a modern theory that achieves the purpose of multidisciplinary integration by combining the theories and methods of applied mathematics, graphics, information visualization technology, information science and other disciplines with metrological citation analysis, co-occurrence analysis and other methods, and using visualized graphs to vividly display the core structure, development history, frontier fields and overall knowledge architecture of the discipline.
[0034] Betweenness centrality is an indicator commonly used to measure centrality. It refers to the ratio of the shortest path passing through a point and connecting two points in the network to the total number of shortest path lines between the two points.
[0035] Graph Embedding (also called Network Embedding) is a process of mapping graph data (usually high-dimensional dense matrices) into low-dimensional dense vectors, which can effectively solve the problem that graph data is difficult to efficiently input into machine learning algorithms. Graph embedding is the conversion of attribute graphs into vectors or vector sets. Embedding should capture the topological structure of the graph, vertex-to-vertex relationships, and other relevant information about graphs, subgraphs, and vertices.
[0036] Convolutional Neural Networks (CNN) are a type of feedforward neural network with deep structure and convolutional calculations. They have representation learning capabilities and can perform translation-invariant classification of input information according to their hierarchical structure. Convolutional neural networks are constructed by imitating the visual perception mechanism of organisms and can perform supervised and unsupervised learning. The convolution kernel parameter sharing in the hidden layer and the sparsity of the inter-layer connections enable convolutional neural networks to grid features with less computation.
[0037] The Louvain algorithm is a community discovery algorithm based on modularity. The algorithm performs well in terms of efficiency and effectiveness, and can discover hierarchical community structures. Its optimization goal is to maximize the modularity of the entire community network.
[0038] Modularity, also known as modularity metric, is a metric for evaluating the quality of a community network division. Its physical meaning is the difference between the number of edges connecting nodes in the community and the number of edges in a random situation. It can also be understood as the weight of the edge within the community minus the sum of the weights of all edges connected to the community nodes. For an undirected graph, it is the degree of the edge within the community minus the total degree of the nodes in the community.
[0039] In the present application, a retrieval method based on a knowledge graph is provided. The present application also relates to a retrieval device based on a knowledge graph, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0040] Figure 1 A flowchart of a knowledge graph-based retrieval method provided according to an embodiment of the present application is shown, which specifically includes the following steps:
[0041] Step 102: Obtain a search statement, determine the minimum subgraph in the knowledge graph based on the search statement, and calculate the intermediate centrality and graph embedding representation of each node in the minimum subgraph.
[0042] Specifically, a search statement refers to a statement that a user enters in a search box or search bar when searching based on needs. For example, if Xiao Ming enters "What planets are there in the solar system" in the search box, then "What planets are there in the solar system" is a search statement. A knowledge graph consists of nodes (points) and edges (edges). Each node represents an "entity", and each edge is a "relationship" between entities. Entities can be things in the real world, such as people, place names, companies, telephones, animals, etc. Relationships are used to express certain connections between different entities, such as colleague relationships, school relationships, and employment relationships. A subgraph refers to a graph whose node set and edge set are respectively a subset of the node set and edge set of a certain graph. The minimum subgraph refers to a subgraph with the least nodes. The betweenness centrality is an indicator that characterizes the importance of a node by the number of shortest paths passing through a node. Graph embedding representation is to map the graph model to a low-dimensional vector space, and retain the structural information and characteristics of the graph model when it is expressed in vector form.
[0043] In actual applications, when a user enters a search statement in the search bar and clicks "Search", "Query", or "Confirm" buttons, the search statement can be obtained. On this basis, the search statement is analyzed, and the minimum subgraph related to the search statement is determined in the knowledge graph based on the analysis results. Furthermore, based on the connection relationship between the nodes in the minimum subgraph, that is, the "edge", the intermediate centrality of each node and the graph embedding representation are determined.
[0044] For example, user U enters "the longest river in the world" in the search box of the browser and clicks the search button to obtain the search statement "the longest river in the world". "The longest river in the world" is analyzed, and the minimum subgraph containing 7 nodes is determined based on the analysis results. Then, based on the connection relationship between the 7 nodes, the intermediate centrality and graph embedding representation of these 7 nodes are determined respectively.
[0045] It should be noted that when calculating the intermediate centrality and graph embedding representation of each node in the minimum subgraph, the intermediate centrality of each node can be determined first, and then the graph embedding representation of each node can be determined; the graph embedding representation of each node can be determined first, and then the intermediate centrality of each node can be determined; and the graph embedding representation of each node can also be calculated while calculating the intermediate centrality of each node. In addition, when calculating the intermediate centrality and / or graph embedding representation of each node, it can be calculated node by node or simultaneously. For example, if there are three nodes, the intermediate centrality and / or graph embedding representation of the first node can be calculated first, and then the intermediate centrality and / or graph embedding representation of the second node can be calculated, and finally the intermediate centrality and / or graph embedding representation of the third node can be calculated; the intermediate centrality and / or graph embedding representation of these three nodes can also be calculated simultaneously.
[0046] In most cases, there are many unnecessary words in the retrieval statement input by the user, such as modal particles "ma", "a", "ba", etc. These words in the retrieval statement will increase the amount of data processing to a certain extent, thereby causing a certain degree of energy waste and at the same time reducing the retrieval speed. To improve the retrieval efficiency, when determining the minimum subgraph in the knowledge graph according to the retrieval statement, the keywords in the retrieval statement can be extracted, and then the minimum subgraph can be determined in the knowledge graph according to the keywords. The specific implementation process is as follows:
[0047] Perform word segmentation and stop word removal processing on the retrieval statement to obtain at least one keyword of the retrieval statement;
[0048] Search for the specified nodes containing each keyword in the knowledge graph, and form the minimum subgraph according to the specified nodes and the second-degree relationship nodes of the specified nodes.
[0049] Specifically, word segmentation refers to the word segmentation process of string matching in the retrieval statement, which can be the forward maximum matching method, the reverse maximum matching method, the shortest path word segmentation method or the bidirectional maximum matching method. This application does not make any restrictions on this. Stop words refer to certain words or characters that will be automatically filtered out before or after processing natural language text in order to save storage space and improve retrieval efficiency during retrieval. These words or characters are called stop words. These stop words are generally input manually and not generated automatically. After generation, the stop words will form a stop word list. The specified node refers to the node containing all keywords. The second-degree relationship node refers to two nodes that are indirectly associated through a node. For example, node A and node B are connected through node C, node A and node B are second-degree relationship nodes with each other, and node A and node B are first-degree relationship nodes with node C respectively.
[0050] In practical applications, after obtaining the retrieval statement, perform word segmentation processing on the retrieval statement to obtain the initial keywords, and then delete and filter the keywords without practical significance in the initial keywords, that is, the stop words. The remaining keywords in the initial keywords are the keywords corresponding to the retrieval statement. Further, match the corresponding nodes in the knowledge graph according to the obtained keywords. When the nodes in the knowledge graph contain all keywords, determine this node as the specified node. Traverse all nodes in the knowledge graph, that is, determine all specified nodes, and then determine the second-degree relationship nodes of each specified node, and form the minimum subgraph according to the specified nodes and the second-degree relationship nodes.
[0051] For example, after word segmentation of the search sentence "How many people will take the college entrance examination in 2021?", 7 initial keywords "2021", "national", "participate", "college entrance examination", "of", "number of people", "how many", among which stop words include "of" and "how many", and the stop words in the initial keywords are filtered, and the remaining initial keywords are the keywords of the search sentence, that is, the keywords of "How many people will take the college entrance examination in 2021?" include "2021", "national", "participate", "college entrance examination" and "number of people". According to the obtained 5 keywords, they are matched in the knowledge graph, and 6 designated nodes including "2021", "national", "participate", "college entrance examination" and "number of people" are determined, and the second-degree relationship nodes of each designated node are determined to form a minimum subgraph.
[0052] In this way, by performing word segmentation and stop word removal on the search statement, redundant data in the search statement is removed, computing resources are saved, the accuracy of determining the specified node by the search statement is further improved, the accuracy of determining the minimum subgraph is guaranteed, and the efficiency of subsequent determination of the search statement type is improved.
[0053] When the minimum subgraph contains at least three nodes, the number of nodes contained in the minimum subgraph can be regarded as M, that is, the minimum subgraph contains M nodes, M is a positive integer greater than or equal to 3. At this time, the specific implementation process of calculating the intermediate centrality and graph embedding representation of each node in the minimum subgraph can be as follows:
[0054] Calculate the number of the first shortest paths from the i-th node to the j-th node in the minimum subgraph, where i and j are both positive integers less than or equal to M, and i is not equal to j;
[0055] Determine the number of the second shortest paths between the i-th node and the j-th node that pass through the k-th node, where k is a positive integer less than or equal to M, and k is not equal to any of i and j;
[0056] Determine the betweenness centrality of the kth node according to the first shortest path number and the second shortest path number;
[0057] The graph embedding representation of the kth node is obtained through a graph convolutional neural network.
[0058] Specifically, the shortest path refers to the shortest path from one node to other nodes. The first shortest path number refers to the number of shortest paths from one node to other nodes. The second shortest path number refers to the number of shortest paths from one node to other nodes that pass through another node. The kth node is the node for which the intermediate centrality is currently determined. Graph convolutional neural network refers to a convolutional neural network applied to a knowledge graph or subgraph.
[0059] In practical applications, when determining the betweenness centrality and graph embedding representation of a node in a subgraph, we can first determine the shortest paths between other nodes and the number of shortest paths between other nodes. On this basis, we determine the number of shortest paths between other nodes that pass through the node, and determine the betweenness centrality of the node based on the ratio of the number and the number of shortest paths. The specific calculation process is shown in Formula 1. The formula in Formula 1 can accurately and quickly minimize the betweenness centrality of each node in the subgraph, which can improve the efficiency of retrieval to a certain extent. Finally, the graph embedding representation of the node is obtained through the graph convolutional neural network.
[0060]
[0061] Among them, b k is the betweenness centrality of the kth node, σ ij (k) is the number of the second shortest paths between the i-th node and the j-th node that pass through the k-th node, σ ij is the number of the first shortest path from the i-th node to the j-th node.
[0062] For example, there are 4 nodes in the smallest subgraph. When calculating the betweenness centrality of the first node, we can first determine that there is one shortest path from the second node to the third node, and only one shortest path passes through the first node. That is, at this time σ 23 is 1, σ 23 (1) is 1; then determine that there is one shortest path from the second node to the fourth node, which does not pass through the first node. At this time, σ 24 is 1, σ 24 (1) is 0; then determine that there are two shortest paths from the 3rd node to the 4th node, of which only one shortest path passes through the 1st node. At this time, σ 34 =2,σ 34 (1) is 1. Then the betweenness centrality of the first node is 1 / 1+0 / 1+1 / 2=1.5, that is, b1 is 1.5. The graph embedding representation of the first node is obtained according to the graph convolutional neural network. The betweenness centrality and graph embedding representation of the second to fourth nodes can be determined by referring to the calculation process of the betweenness centrality and graph embedding representation of the first node.
[0063] Step 104: According to a preset centrality threshold, at least two target nodes in the minimum subgraph are determined, where the target nodes are nodes whose intermediate centrality is higher than the centrality threshold.
[0064] Based on the obtained search statement, the minimum subgraph related to the search statement in the knowledge graph is determined, and the betweenness centrality and graph embedding representation of each node in the minimum subgraph are calculated. Then, the target node is further determined based on the betweenness centrality of each node and a preset centrality threshold.
[0065] Specifically, the centrality threshold refers to a pre-set value used to measure the level of betweenness centrality. It can be set manually based on experience or automatically by the machine based on the feature information of the smallest subgraph. The target node refers to the node with a higher betweenness centrality in the smallest subgraph, that is, the node with a betweenness centrality higher than the centrality threshold.
[0066] In practical applications, since nodes with high intermediate centrality are more relevant to the search statement to a certain extent, these nodes with high intermediate centrality can be screened out to facilitate the subsequent analysis of the type of search statement. That is, the intermediate centrality of each node in the smallest subgraph is compared with the centrality threshold, and the nodes with intermediate centrality lower than or equal to the centrality threshold are determined as ordinary nodes, and the nodes with intermediate centrality higher than the centrality threshold are determined as target nodes.
[0067] For example, referring to Table 1, there are 5 nodes in the smallest subgraph, namely nodes p1, p2, p3, p4 and p5, and the corresponding betweenness centrality is 1.5, 2.0, 1.0, 2.5, 0.5. When the preset centrality threshold is 1.5, nodes p2 and p4 are target nodes, and nodes p1, p3 and p5 are ordinary nodes.
[0068] Table 1 The betweenness centrality of each node
[0069] Minimum subgraph p1 p2 p3 p4 p5 Betweenness Centrality 1.5 2.0 1.0 2.5 0.5
[0070] It should be noted that in this embodiment, when determining the target node, the centrality threshold is introduced to compare with the middle centrality of each node to determine the target node, and the first few nodes with the highest middle centrality are not directly determined as the target node. This avoids the situation where the first few nodes with the highest middle centrality are determined as the target nodes, because only a very small number of nodes have a high middle centrality, resulting in the existence of some nodes with low middle centrality among the determined target nodes.
[0071] Step 106: When at least two target nodes form a path based on time information, calculate the graph embedding representation similarity between each two target nodes on the path.
[0072] On the basis of determining at least two target nodes according to a preset centrality threshold, further, in the case where the at least two target nodes constitute a path based on time information, the graph embedding representation similarity between any two target nodes on the path is calculated.
[0073] Specifically, time information refers to information related to time, such as May 24, 2021, October 1, 1949. Graph embedding representation similarity refers to the similarity between two graph embedding representations.
[0074] In practical applications, it is necessary to first determine whether the target nodes can form a path in chronological order based on the time information stored on the target nodes. When a certain proportion of the target nodes can form a path in chronological order, it is considered that the target nodes constitute a path based on time information. The proportion can be pre-set data, such as 80%, 85%, etc. On this basis, the graph embedding representation similarity of any two target nodes on the path is calculated. There are many similarity functions for calculating the similarity of graph embedding representation, such as angle cosine function, Mahalanobis distance function, Pearson correlation coefficient function, Jaccard similarity coefficient function, Euclidean distance function, etc. In this application, the choice of similarity function for calculating the similarity of graph embedding representation is not limited.
[0075] For example, referring to Table 3, there are 10 identified target nodes, namely n1, n2, n3, n4, n5, n6, n7, n8, n9 and n10, of which only 9 target nodes have time information. These 9 target nodes form a path in chronological order, namely n4, n1, n10, n3, n6, n2, n9, n8 and n7. When the preset ratio is 0.8, since the target nodes with time information account for 0.9, which is higher than 0.8, the target nodes form a path based on time information. At this time, the graph embedding representation similarity of any two target nodes among the 9 target nodes is calculated according to the Euclidean distance function.
[0076] Table 2 Determined target nodes
[0077]
[0078] It should be noted that when at least two target nodes do not form a path based on time information, the search statement is determined to be a factual search statement. That is, a path cannot be formed in chronological order based on the time information stored on the target node, or the proportion of target nodes constituting the path is lower than the preset proportion, for example, the proportion is 0.9, and the target nodes constituting the path account for 0.8 of the total number of target nodes. This shows that the content retrieved in the knowledge graph based on the search statement has a low temporal correlation and an unclear progressive relationship in development. The content retrieved by the search statement tends to be factual, and therefore the search statement is determined to be a factual search statement.
[0079] In this embodiment, by determining that the target nodes constitute a path based on time information, the graph embedding representation similarity between the target nodes on the path is calculated, which prepares for the subsequent determination of the type of search statement and the search, and improves the search efficiency to a certain extent.
[0080] Step 108: If the graph embedding representation similarities of two target nodes with adjacent time information are both greater than the similarity threshold, the search statement is determined to be an event-type search statement.
[0081] When the target nodes form a path based on time information, the graph embedding representation similarity between the target nodes on the path is calculated. Furthermore, when the graph embedding representation similarities of two adjacent target nodes on the path are all greater than the similarity threshold, the search statement is determined to be an event-type search statement.
[0082] Specifically, the similarity threshold refers to a pre-set value used to measure the similarity of graph embedding representations. It can be set manually based on experience or automatically based on the characteristic information of the path. An event-based search statement refers to a search statement that retrieves important content that has a strong connection with time. For example, users who search through event-based search statements are more likely to want to learn about some important content and some expansions based on the important content.
[0083] In practical applications, after determining the graph embedding representation similarities between each pair of target nodes on the path, the graph embedding representation similarities between adjacent target nodes on the path can be screened out from these graph embedding representation similarities. When the graph embedding representation similarities of two adjacent target nodes on the path are all greater than the similarity threshold, it means that the content retrieved in the knowledge graph according to the search statement has a clear development context, is temporally relevant, and has a progressive relationship in development. Therefore, the graph embedding representation similarities are relatively close to each other in chronological order. At this time, the search statement is determined to be an event-type search statement.
[0084] Using the above example, the path is composed of nodes n4, n1, n10, n3, n6, n2, n9, n8, and n7 in order. The graph embedding representation similarity of two adjacent target nodes is shown in Table 3. If the similarity threshold is 0.7, the graph embedding representation similarity of two adjacent target nodes is greater than 0.7, and the corresponding search statement can be determined as an event-type search statement.
[0085] Table 3. Graph embedding representation similarity of adjacent target nodes
[0086]
[0087]
[0088] In one or more embodiments of the present application, after determining the search statement as an event-type search statement, it is necessary to generate event-type search results based on the target nodes constituting the path so as to feed back to the user. The specific implementation process is as follows:
[0089] Starting from the first target node on the path, determine the auxiliary nodes of the current target node in turn. The auxiliary nodes are first-degree relationship nodes other than the target node.
[0090] Generate event-type retrieval results based on each target node and its auxiliary nodes.
[0091] Specifically, an auxiliary node refers to a node that is connected to the target node in a first-degree relationship and is not a first-degree node of the target node. For example, if node 1 is connected to node 2 and node 3 respectively, where node 1 and node 3 are the target nodes on the path, then node 2 is an auxiliary node. Event search results are the results or content retrieved based on event search statements.
[0092] In actual applications, when generating event-type search results, it is necessary to use the generated path as the main time axis, the point on the main time axis, i.e., the target node, as the reference, select the target node on the path in the first degree relationship except the node on the path for supplementary description, and jointly generate the return result provided to the user, i.e., the event-type search result. In this way, the accuracy and completeness of the event-type search results can be guaranteed.
[0093] Assuming that the target nodes on the path are node x, node y, and node z in sequence, the determination of the auxiliary nodes of node y is taken as an example for explanation. The first-degree relationship nodes of node y are node x, node z, node p, and node q. Since node x and node z are the target nodes on the path, the auxiliary nodes of node y are node p and node q. The process of determining the auxiliary nodes of node x and node z is the same as the process of determining the auxiliary base point of node y. Afterwards, event class retrieval results are generated based on node x and the auxiliary nodes of node x, node y and node p, node q, node z, and the auxiliary nodes of node z, and fed back to the user.
[0094] Since a target node on the path may have multiple auxiliary nodes, the event-type retrieval results generated based on the auxiliary nodes of this target node must contain a lot of redundant content, which not only increases the amount of data processing in the background, reduces the retrieval efficiency, but also reduces the user experience. To avoid the above problems, you can select the auxiliary nodes of the target node on the path, and combine them with the auxiliary node with the highest similarity to the target node graph embedding representation to generate event-type retrieval results. The specific process is as follows:
[0095] Starting from the first target node on the path, the auxiliary node with the highest graph similarity to the current target node is embedded in turn, and is determined as the target auxiliary node of the current target node;
[0096] Generate event class retrieval results based on each target node and the target auxiliary node corresponding to each target node.
[0097] In practical applications, on the basis of determining the auxiliary node of the first target node on the path, further, the graph embedding representation similarity between each auxiliary node and the first target node is calculated, and the auxiliary node with the highest graph embedding representation similarity is determined as the target auxiliary node of the first target node. Then, the target auxiliary nodes from the second target node to the last target node on the path are determined in the same way. Finally, event class retrieval results are generated based on each target node and each target auxiliary node on the path.
[0098] For example, there are two target nodes on the path, namely node g1 and node g2. The auxiliary nodes of node g1 are node g11, node g12, and node g13, and the similarities between node g11, node g12, and node g13 and the graph embedding representation of node g1 are 0.55, 0.79, and 0.36, respectively. Then node g12 is determined as the target auxiliary node of node g1; the auxiliary nodes of node g2 are node g21 and node g22, and the similarities between node g21 and node g22 and the graph embedding representation of node g2 are 0.9 and 0.88, respectively. Then node g21 is determined as the target auxiliary node of node g2. On this basis, event-type retrieval results are generated based on nodes g1, g12, g2, and g21, and fed back to the user.
[0099] Step 110: If the graph embedding representation similarity between two target nodes with adjacent time information is not greater than the similarity threshold, the search statement is determined to be a fact-based search statement.
[0100] When the target nodes form a path based on time information, the graph embedding representation similarity between the target nodes on the path is calculated. Furthermore, when the graph embedding representation similarity of two adjacent target nodes on the path is not all greater than the similarity threshold, the search statement is determined to be a fact-based search statement.
[0101] In practical applications, after determining the graph embedding representation similarities between each pair of target nodes on the path, the graph embedding representation similarities between adjacent target nodes on the path can be screened out from these graph embedding representation similarities. When the graph embedding representation similarity of one or some two adjacent target nodes on the path is less than or equal to the similarity threshold, it means that the content retrieved in the knowledge graph according to the search statement here has low temporal correlation and the progressive relationship in development is not obvious. Therefore, the gap between the graph embedding representation similarities in chronological order will be relatively large. At this time, the search statement is determined to be a factual search statement.
[0102] Using the above example, the path is composed of nodes n4, n1, n10, n3, n6, n2, n9, n8, and n7 in order. The graph embedding representation similarity of two adjacent target nodes is shown in Table 4. If the similarity threshold is 0.7, the graph embedding representation similarity of n3 and n6 is equal to 0.7, and the graph embedding representation similarity of n9 and n8 is less than 0.7, that is, the corresponding search statement can be determined as a fact-based search statement.
[0103] Table 4 Graph embedding representation similarity of adjacent target nodes
[0104]
[0105] It should be noted that there is no order between step 110 and step 108, but different processing methods are used for different situations after judging the similarity of graph embedding representations of two target nodes with adjacent time information and the size of the similarity threshold. This embodiment is described by taking step 108 after step 110 as an example.
[0106] In one or more embodiments of the present application, after determining the search statement as a factual search statement, it is necessary to generate factual search results based on the target nodes that constitute the path so as to provide feedback to the user, that is, to generate factual search results based on the nodes in the minimum subgraph. In order to make the factual search results more complete and organized, it is necessary to divide the subgraph into multiple communities, with the central node of each community as the main axis and each N-degree relationship node as the auxiliary axis, to generate factual search results. The specific implementation process is as follows:
[0107] Divide each node in the minimum subgraph into at least two communities;
[0108] Select the central node of each community and determine the N-degree relationship nodes of each central node, where the central node is the node with the highest intermediate centrality in the community, and N is a positive integer greater than zero;
[0109] Generate fact-based retrieval results based on each central node and its N-degree relationship nodes.
[0110] Specifically, a community refers to a group of nodes in a minimum subgraph. If the internal links of a group of nodes are dense and the external links are sparse, then this group of nodes is called a community. The central node refers to the node with the highest betweenness centrality in the community.
[0111] In practical applications, the nodes in the minimum subgraph are divided into multiple communities according to the Louvain algorithm, that is, each node in the minimum graph is regarded as an independent community, and the number of communities is the same as the number of nodes; for each node w, try to assign node w to the community where each of its adjacent nodes is located, calculate the modularity change before and after the assignment, and record the adjacent node with the largest modularity change. If the maximum modularity change is greater than 0, node w is assigned to the community where the adjacent node with the largest modularity change is located, otherwise it remains unchanged; continue to repeat the above process until the communities where all nodes are located no longer change; compress the minimum subgraph, compress all nodes in the same community into a new node, convert the edge weights between nodes in the community into the ring weights of the new node, and convert the edge weights between communities into edge weights between new nodes; continue to repeat the above process until the modularity of the entire minimum subgraph no longer changes. Among them, the calculation process of modularity change is shown in Equation 2 and Equation 3, and Equation 3 is the result of simplifying Equation 2.
[0112]
[0113]
[0114] Among them, k w,in It is twice the sum of the weights of the edges between nodes in the community and node w; k w represents the sum of the weights of all edges connected to node w; ∑ in represents the sum of the weights of the edges within the community; ∑ tot represents the sum of the weights of the edges connected to the nodes in the community; m represents the sum of the weights of all edges, that is, the number of edges.
[0115] After the minimum subgraph is divided into multiple communities, the node with the intermediate centrality is determined according to the intermediate centrality of each node in the community, and the node is determined as the central node of the community. Furthermore, the first-degree relationship node and the second-degree relationship node of the central node of the community are determined. According to the above method, the central node of each community and the N-degree relationship node of the central node are determined. Finally, the fact-based retrieval results are generated based on each central node and the N-degree relationship node of each central node.
[0116] For example, see Figure 2 , Figure 2A structural diagram of dividing a minimum subgraph into two communities provided by an embodiment of the present application is shown. According to the Louvain algorithm, the minimum subgraph is divided into two communities: community 1 and community 2, wherein community 1 includes node A, node A1, node A2, node A3 and node A21, and community 2 includes node B, node B1, node B2 and node B3. According to formula 1, the intermediate centralities of nodes A, node A1, node A2, node A3 and node A21 in community 1 are 5, 0, 3, 0 and 0 respectively. Therefore, the intermediate centrality of node A in community 1 is the highest, that is, node A is the central node of community 1; according to formula 1, the intermediate centralities of nodes B, node B1, node B2 and node B3 in community 2 are 3, 0, 0 and 0 respectively. Therefore, the intermediate centrality of node B in community 2 is the highest, that is, node B is the central node of community 2. By Figure 2 It can be seen that nodes A1, A2 and A3 are first-degree relationship nodes of node A, node A21 is a second-degree relationship node of node A, and nodes B1, B2 and B3 are first-degree relationship nodes of node B. According to nodes A, A1, A2, A3, A21, B, B1, B2 and B3, fact-based search results are generated and fed back to the user.
[0117] Preferably, in order to make the fact-based search results fed back to the user more clearly prioritized, when generating fact-based search results based on each central node and the N-degree relationship nodes of each central node, the fact-based search results can be generated in combination with the weight of each node. The specific implementation process is as follows:
[0118] Determine the weight of each central node and each N-degree relationship node according to a pre-set weight table;
[0119] The central nodes and N-degree relationship nodes are sorted according to their weights to generate fact-based retrieval results.
[0120] In practical applications, different types of nodes may be equipped with different weight values, and different nodes of the same type may also have different weights. In this application, different weights can be set in advance for different types of nodes, for example, the weight of the central node is 0.5, the weight of the first-degree relationship node is 0.3, and the weight of the second-degree relationship node is 0.2; different weight ranges can also be set for different types of nodes, for example, the weight of the central node is 0.5-0.9, the weight of the first-degree relationship node is 0.2-0.4, and the weight of the second-degree relationship node is 0.1-0.2. Then sort the nodes from high to low according to their weights to generate fact-based retrieval results. It should be noted that the weight of a community center node must be greater than the weight of the second-degree relationship node of other communities, and the weight of the second-degree relationship node of the community must also be greater than the weight of the three-degree relationship node of other communities, that is, the weight of the central node is higher than the weight of the N-degree relationship node of any community, and the weight of the N-degree relationship node is higher than the weight of the N+1 degree relationship node of any community.
[0121] Using the above example, the pre-set weights of Node A, Node A1, Node A2, Node A3, Node A21, Node B, Node B1, Node B2, and Node B3 are 0.5, 0.2, 0.15, 0.1, 0.05, 0.6, 0.12, 0.11, 0.17 respectively, and the weights are sorted as Node B, Node A, Node A1, Node B3, Node A2, Node B1, Node B2, and Node A21. The fact-based search results are generated according to this order and fed back to the user.
[0122] The retrieval method based on knowledge graph provided by the present application obtains a retrieval statement, determines the minimum subgraph in the knowledge graph according to the retrieval statement, and calculates the intermediate centrality and graph embedding representation of each node in the minimum subgraph; determines at least two target nodes in the minimum subgraph according to a pre-set centrality threshold, and the target node is a node with an intermediate centrality higher than the centrality threshold; in the case where at least two target nodes constitute a path based on time information, calculates the graph embedding representation similarity between the target nodes on the path; if the graph embedding representation similarity of the two target nodes adjacent to the time information is greater than the similarity threshold, the retrieval statement is determined to be an event-type retrieval statement; if the graph embedding representation similarity of the two target nodes adjacent to the time information is not greater than the similarity threshold, the retrieval statement is determined to be a fact-type retrieval statement. In this way, when retrieving the knowledge graph according to the obtained retrieval statement, the intermediate centrality and graph embedding representation can be used to assist in judging whether the user's intention is biased towards event-type retrieval results or fact-type retrieval results, so as to more accurately understand the user's intention and return results that are more in line with the user's intention.
[0123] The following combination Figure 3, taking the application of the knowledge graph-based retrieval method provided in this application to the browser as an example, the knowledge graph-based retrieval method is further explained. Figure 3 A processing flow chart of a knowledge graph-based retrieval method applied to a browser provided in an embodiment of the present application is shown, which specifically includes the following steps:
[0124] Step 302: Receive a search statement input by a user into a browser search box.
[0125] Step 304: Determine a minimum subgraph in the knowledge graph corresponding to the browser according to the search statement.
[0126] Step 306: Calculate the betweenness centrality and graph embedding representation of each node in the minimum subgraph.
[0127] Step 308: Determine the target node in the minimum subgraph according to a preset centrality threshold.
[0128] Step 310: Determine whether the target node can form a path based on time information.
[0129] If yes, then execute step 312 , if no, then execute step 318 .
[0130] Step 312: Calculate the graph embedding representation similarity between any two target nodes on the path.
[0131] Step 314: Determine whether the calculated graph embedding representation similarities are all greater than a similarity threshold.
[0132] If yes, execute step 316 , if no, execute step 318 .
[0133] Step 316: Determine the search statement as an event-type search statement.
[0134] Step 318: Determine the search statement as a factual search statement.
[0135] Step 320: Starting from the first target node on the path, determine the target auxiliary nodes of the current target node in sequence.
[0136] Step 322: Generate event type retrieval results according to each target node and the corresponding target auxiliary node.
[0137] Step 324: Divide each node in the minimum subgraph into at least two communities.
[0138] Step 326: Select the central node of each community and determine the N-degree relationship nodes of each central node.
[0139] Step 328: Determine the weight of each central node and each N-degree relationship node according to a preset weight table.
[0140] Step 330: Sort the central nodes and N-degree relationship nodes according to the weights of the central nodes and N-degree relationship nodes to generate fact-based retrieval results.
[0141] Step 332: Feedback the time-related search results or fact-related search results to the user via a browser page.
[0142] The knowledge graph-based retrieval method provided in the present application is applied to the browser. By determining the minimum subgraph in the knowledge graph according to the received search statement, and calculating the intermediate centrality and graph embedding representation of each node of the minimum subgraph, the target node is further determined according to the centrality threshold, and whether the target node can form a path based on time information and whether the graph embedding representation similarity between adjacent target nodes on the path is greater than the similarity threshold, the search statement is determined to be an event-type search statement or a fact-type search statement, and then the corresponding search results are generated according to different situations and returned to the user. In this way, when searching the knowledge graph according to the obtained search statement, the intermediate centrality and graph embedding representation can be used to assist in judging whether the user's intention is biased towards event-type search results or fact-type search results, so as to more accurately understand the user's intention and return results that are more in line with the user's intention.
[0143] Corresponding to the above method embodiment, the present application also provides a retrieval device embodiment based on knowledge graph, Figure 4 FIG. 1 shows a schematic diagram of a knowledge graph-based retrieval device provided in an embodiment of the present application. Figure 4 As shown, the device comprises:
[0144] The acquisition module 402 is configured to acquire a search statement, determine a minimum subgraph in the knowledge graph according to the search statement, and calculate the intermediate centrality and graph embedding representation of each node in the minimum subgraph;
[0145] The target node determination module 404 is configured to determine at least two target nodes in the minimum subgraph according to a preset centrality threshold, wherein the target nodes are nodes whose intermediate centrality is higher than the centrality threshold;
[0146] A calculation module 406 is configured to calculate the graph embedding representation similarity between two target nodes on the path when the at least two target nodes form a path based on time information;
[0147] The event type search statement determination module 408 is configured to determine the search statement as an event type search statement if the graph embedding representation similarities of the two target nodes adjacent to the time information are both greater than a similarity threshold;
[0148] The fact-based search statement determination module 410 is configured to determine the search statement as a fact-based search statement if the graph embedding representation similarity of two target nodes whose time information is adjacent is not greater than a similarity threshold.
[0149] In one or more implementations of this embodiment, the fact-based search statement determination module 410 is configured to:
[0150] When the at least two target nodes do not form a path based on time information, the search sentence is determined to be a factual search sentence.
[0151] In one or more implementations of this embodiment, the device further includes an event type search result determination module, which is configured to:
[0152] Starting from the first target node on the path, the auxiliary nodes of the current target node are determined in sequence, wherein the auxiliary nodes are first-degree relationship nodes other than the target node;
[0153] Generate event-type retrieval results based on each target node and its auxiliary nodes.
[0154] In one or more implementations of this embodiment, the event retrieval result determination module is further configured to:
[0155] Starting from the first target node on the path, embedding the auxiliary nodes with the highest graph similarity to the current target node in turn, and determining them as target auxiliary nodes of the current target node;
[0156] Generate event class retrieval results based on each target node and the target auxiliary node corresponding to each target node.
[0157] In one or more implementations of this embodiment, the device further includes a fact-based search result determination module configured to:
[0158] Dividing each node in the minimum subgraph into at least two communities;
[0159] Select the central node of each community and determine the N-degree relationship nodes of each central node, where the central node is the node with the highest intermediate centrality in the community, and N is a positive integer greater than zero;
[0160] Generate fact-based retrieval results based on each central node and its N-degree relationship nodes.
[0161] In one or more implementations of this embodiment, the fact-based search result determination module is further configured to:
[0162] Determine the weight of each central node and each N-degree relationship node according to a pre-set weight table;
[0163] The central nodes and N-degree relationship nodes are sorted according to their weights to generate fact-based retrieval results.
[0164] In one or more implementations of this embodiment, the acquisition module 402 is further configured to:
[0165] Performing word segmentation and stop word removal on the search sentence to obtain at least one keyword of the search sentence;
[0166] Search the knowledge graph for a designated node containing each keyword, and construct a minimum subgraph based on the designated nodes and the second-degree relationship nodes between the designated nodes.
[0167] In one or more implementations of this embodiment, the minimum subgraph includes M nodes, where M is a positive integer greater than or equal to 3;
[0168] The acquisition module 402 is further configured to:
[0169] Calculate the number of first shortest paths from the i-th node to the j-th node in the minimum subgraph, where i and j are both positive integers less than or equal to M, and i is not equal to j;
[0170] Determine the number of second shortest paths passing through the kth node in the shortest path between the i-th node and the j-th node, where k is a positive integer less than or equal to M, and k is not equal to any one of i and j;
[0171] Determining the betweenness centrality of the kth node according to the first shortest path number and the second shortest path number;
[0172] The graph embedding representation of the k-th node is obtained through a graph convolutional neural network.
[0173] The retrieval device based on the knowledge graph provided by the present application obtains a retrieval statement, determines the minimum subgraph in the knowledge graph according to the retrieval statement, and calculates the intermediate centrality and graph embedding representation of each node in the minimum subgraph; determines at least two target nodes in the minimum subgraph according to a preset centrality threshold, and the target node is a node with an intermediate centrality higher than the centrality threshold; in the case where the at least two target nodes constitute a path based on time information, calculates the graph embedding representation similarity between the target nodes on the path; if the graph embedding representation similarity of the two target nodes adjacent to the time information is greater than the similarity threshold, the retrieval statement is determined to be an event-type retrieval statement; if there are two target nodes adjacent to the time information, the graph embedding representation similarity is not greater than the similarity threshold, the retrieval statement is determined to be a fact-type retrieval statement. In this way, when searching the knowledge graph according to the obtained retrieval statement, the intermediate centrality and graph embedding representation can be used to assist in judging whether the user's intention is biased towards event-type retrieval results or fact-type retrieval results, so as to more accurately understand the user's intention and return results that are more in line with the user's intention.
[0174] The above is a schematic scheme of a retrieval device based on a knowledge graph in this embodiment. It should be noted that the technical scheme of the retrieval device based on the knowledge graph and the technical scheme of the retrieval method based on the knowledge graph belong to the same concept. For details not described in detail in the technical scheme of the retrieval device based on the knowledge graph, please refer to the description of the technical scheme of the retrieval method based on the knowledge graph.
[0175] In addition, the components in the device embodiment should be understood as the functional modules that must be established to implement the steps of the program flow or the steps of the method, and the functional modules are not actually functionally divided or separated. The device claim defined by such a group of functional modules should be understood as the functional module architecture of the solution mainly implemented by the computer program recorded in the specification, and should not be understood as the physical device that mainly implements the solution by hardware.
[0176] Figure 5 The structure block diagram of a computing device 500 provided according to an embodiment of the present specification is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0177] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0178] In one embodiment of the present specification, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0179] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 500 may also be a mobile or stationary server.
[0180] Among them, the processor 520 is used to execute computer executable instructions of the knowledge graph-based retrieval method.
[0181] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned knowledge graph-based retrieval method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be found in the description of the technical scheme of the above-mentioned knowledge graph-based retrieval method.
[0182] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, are used in a knowledge graph-based retrieval method.
[0183] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned knowledge graph-based retrieval method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be found in the description of the technical scheme of the above-mentioned knowledge graph-based retrieval method.
[0184] An embodiment of the present application discloses a chip storing computer instructions, which, when executed by a processor, implement the steps of the knowledge graph-based retrieval method as described above.
[0185] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0186] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0187] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0188] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0189] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.
Claims
1. A retrieval method based on knowledge graph, characterized in that: include: Obtain a search statement, determine a minimum subgraph in the knowledge graph according to the search statement, and calculate the intermediate centrality and graph embedding representation of each node in the minimum subgraph; According to a preset centrality threshold, determining at least two target nodes in the minimum subgraph, the target nodes being nodes whose intermediate centrality is higher than the centrality threshold; In a case where the at least two target nodes form a path based on time information, calculating graph embedding representation similarities between two target nodes on the path; If the graph embedding representation similarities of the two target nodes adjacent to the time information are both greater than the similarity threshold, the search statement is determined to be an event-type search statement; If there are two target nodes whose time information is adjacent and whose graph embedding representation similarity is not greater than a similarity threshold, the search statement is determined to be a factual search statement.
2. The method according to claim 1, characterized in that The method further comprises: When the at least two target nodes do not form a path based on time information, the search sentence is determined to be a factual search sentence.
3. The method according to claim 1 or 2, characterized in that: After determining the search statement as an event-type search statement, the method further includes: Starting from the first target node on the path, the auxiliary nodes of the current target node are determined in sequence, wherein the auxiliary nodes are first-degree relationship nodes other than the target node; Generate event-type retrieval results based on each target node and its auxiliary nodes.
4. The method according to claim 3, characterized in that Generate event-type retrieval results based on each target node and its auxiliary nodes, including: Starting from the first target node on the path, embedding the auxiliary nodes with the highest graph similarity to the current target node in turn, and determining them as target auxiliary nodes of the current target node; Generate event class retrieval results based on each target node and the target auxiliary node corresponding to each target node.
5. The method according to claim 1 or 2, characterized in that: After determining the search statement as a factual search statement, the method further includes: Dividing each node in the minimum subgraph into at least two communities; Select the central node of each community and determine the N-degree relationship nodes of each central node, where the central node is the node with the highest intermediate centrality in the community, and N is a positive integer greater than zero; Generate fact-based retrieval results based on each central node and its N-degree relationship nodes.
6. The method according to claim 5, characterized in that Generate fact-based search results based on each central node and its N-degree relationship nodes, including: Determine the weight of each central node and each N-degree relationship node according to a pre-set weight table; The central nodes and N-degree relationship nodes are sorted according to their weights to generate fact-based retrieval results.
7. The method according to claim 1, characterized in that According to the search statement, a minimum subgraph is determined in the knowledge graph, including: Performing word segmentation and stop word removal on the search sentence to obtain at least one keyword of the search sentence; Search the knowledge graph for a designated node containing each keyword, and construct a minimum subgraph based on the designated node and the second-degree relationship nodes of the designated node.
8. The method according to claim 1, characterized in that The minimum subgraph contains M nodes, where M is a positive integer greater than or equal to 3; Calculating the betweenness centrality and graph embedding representation of each node in the minimum subgraph, including: Calculate the number of first shortest paths from the i-th node to the j-th node in the minimum subgraph, where i and j are both positive integers less than or equal to M, and i is not equal to j; Determine the number of second shortest paths passing through the kth node in the shortest path between the i-th node and the j-th node, where k is a positive integer less than or equal to M, and k is not equal to any one of i and j; Determining the betweenness centrality of the kth node according to the first shortest path number and the second shortest path number; The graph embedding representation of the k-th node is obtained through a graph convolutional neural network.
9. A retrieval device based on knowledge graph, characterized in that: include: An acquisition module is configured to acquire a search statement, determine a minimum subgraph in the knowledge graph according to the search statement, and calculate the intermediate centrality and graph embedding representation of each node in the minimum subgraph; A target node determination module is configured to determine at least two target nodes in the minimum subgraph according to a preset centrality threshold, wherein the target nodes are nodes whose intermediate centrality is higher than the centrality threshold; A calculation module is configured to calculate the graph embedding representation similarity between two target nodes on the path when the at least two target nodes form a path based on time information; An event-type search statement determination module is configured to determine the search statement as an event-type search statement if the graph embedding representation similarities of the two target nodes adjacent to the time information are both greater than a similarity threshold; The fact-based search statement determination module is configured to determine the search statement as a fact-based search statement if the graph embedding representation similarity of two target nodes whose time information is adjacent is not greater than a similarity threshold.
10. A computing device, characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the knowledge graph-based retrieval method described in any one of claims 1 to 8.
11. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by the processor, the steps of the knowledge graph-based retrieval method described in any one of claims 1 to 8 are implemented.
