A knowledge graph retrieval method and device
Through situation-aware entity recognition technology and deep learning models, situation-aware subgraphs and comprehensive vectors are constructed, which solves the problem that traditional knowledge graph retrieval methods cannot understand the user's true intentions, and achieves more accurate and efficient knowledge graph retrieval.
Patent Information
- Application Number
- CN202410508581.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-25
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-04-25
AI Technical Summary
Traditional knowledge graph retrieval methods cannot deeply understand the user's true intentions, resulting in low accuracy of query results in complex queries or fuzzy information requirements.
The context-aware entity recognition technology is used to encode the text-class query problems entered by the user through a deep learning model, determine the text vector, and calculate its probability value as an entity based on the vector representation of each word and phrase, and then construct a situation-aware sub-graph and a comprehensive vector for more accurate retrieval in the knowledge graph.
By fully considering the context of text-based query problems, accurately identifying the user's true intentions, the accuracy and efficiency of knowledge graph retrieval is improved, and more accurate search results are provided.
Smart Images

Figure CN118364119B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge graph technology, and more specifically, to a knowledge graph retrieval method and device. Background Art
[0002] With the rapid development of information technology, knowledge graphs have gradually become a key technology for processing complex data and providing efficient query results. Knowledge graphs usually store entities and the relationships between entities in the form of graphs to provide structured knowledge for various intelligent systems.
[0003] Traditional knowledge graph retrieval methods mainly rely on keyword matching or fixed semantic query expansion. This retrieval method often only interprets the user's query literally and cannot deeply understand the user's true intention, especially in complex queries or ambiguous information needs. For example, when a user asks "What is the highest mountain in Asia?", traditional retrieval methods only search based on the keywords "Asia" and "mountain", so a large number of irrelevant results may be returned, resulting in low accuracy of query results.
[0004] In summary, how to provide a knowledge graph retrieval method that can deeply understand the user's real query intention and improve the accuracy of the query results has become a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0005] In view of this, the present invention discloses a knowledge graph retrieval method and device, so as to fully consider the context of the entire text query problem, accurately identify the user's true intention, and provide more accurate retrieval results.
[0006] A knowledge graph retrieval method, comprising:
[0007] Get the text query question entered by the user;
[0008] Determine the text vector corresponding to the text query question and the relationship between each word and phrase in the text query question and the text query question as a whole based on context-aware entity recognition technology to obtain the key entity of the text query question;
[0009] Constructing a context-aware subgraph based on the key entities in the knowledge graph;
[0010] determining a comprehensive vector based on the text vector;
[0011] The comprehensive vector is used to search in the knowledge graph to obtain a target search result, wherein the target search result is a target context-aware subgraph or a target entity node.
[0012] Optionally, the context-aware entity recognition technology is used to determine the text vector corresponding to the text query question, and the relationship between each word and phrase in the text query question and the text query question as a whole, to obtain the key entity of the text query question, including:
[0013] Using a deep learning model to encode the text query problem, and converting the text query problem into a text vector;
[0014] Determine a probability value of each of the words and phrases as an entity based on the text vector and the vector representation of each of the words and phrases in the text vector;
[0015] An entity whose probability value is greater than a probability threshold is determined as the key entity.
[0016] Optionally, constructing a context-aware subgraph based on the key entity in the knowledge graph includes:
[0017] Based on the key entity, searching for a corresponding entity node in the knowledge graph;
[0018] Based on all the entity nodes and all the edges between the entity nodes, construct a preliminary context-aware subgraph;
[0019] determining a complexity of the preliminary situation awareness subgraph;
[0020] When the complexity does not exceed a first complexity threshold, determining the preliminary context-aware subgraph as the final context-aware subgraph;
[0021] When the complexity exceeds the first complexity threshold, the preliminary context-aware subgraph is expanded based on the query question characteristics and the knowledge graph characteristics to obtain the final context-aware subgraph.
[0022] Optionally, after constructing the context-aware subgraph based on the key entity in the knowledge graph, the method further includes:
[0023] Adaptively adjusting the retrieval depth of the context-aware subgraph according to the complexity of the context-aware subgraph and the query question;
[0024] Accordingly, the use of the comprehensive vector to search in the knowledge graph to obtain a target search result specifically includes:
[0025] The comprehensive vector is used to search in the knowledge graph, and the search scope and search accuracy are determined based on the search depth adjusted by the context-aware subgraph to obtain the target search result.
[0026] Optionally, the adaptively adjusting the retrieval depth of the context-aware subgraph according to the complexity of the context-aware subgraph and the query question includes:
[0027] Determining a query problem complexity measure based on the importance of each entity in the text-based query problem in the query problem;
[0028] Comparing the query problem complexity measure with a second complexity threshold to obtain a comparison result;
[0029] The retrieval depth of the context-aware subgraph is adaptively adjusted according to the comparison result.
[0030] Optionally, determining a comprehensive vector based on the text vector includes:
[0031] Determine whether the user enters a non-text query question during search;
[0032] If not, determining the text vector as the comprehensive vector;
[0033] If yes, extracting the feature vector of the non-text query question;
[0034] The text vector and the feature vector are fused to obtain the comprehensive vector.
[0035] Optionally, the using the comprehensive vector to search in the knowledge graph to obtain a target search result includes:
[0036] Using the comprehensive vector to search the knowledge graph, find candidate context-aware subgraphs or candidate entities related to the comprehensive vector;
[0037] Using a preset similarity measurement method, calculate the matching scores between each of the candidate context-aware subgraphs or each of the candidate entities and the comprehensive vector;
[0038] Sort the candidate context-aware subgraphs or the candidate entities according to the corresponding matching scores;
[0039] The candidate context-aware subgraph or the candidate entity with the highest matching score is selected as the target retrieval result.
[0040] A knowledge graph retrieval device, comprising:
[0041] An acquisition unit, used for acquiring a text query question input by a user;
[0042] A key entity determination unit is used to determine the text vector corresponding to the text query question and the relationship between each word and phrase in the text query question and the text query question as a whole based on context-aware entity recognition technology to obtain the key entity of the text query question;
[0043] A subgraph construction unit, used to construct a context-aware subgraph based on the key entity in the knowledge graph;
[0044] A comprehensive vector determining unit, configured to determine a comprehensive vector based on the text vector;
[0045] A retrieval unit is used to use the comprehensive vector to search in the knowledge graph to obtain a target retrieval result, wherein the target retrieval result is a target context-aware subgraph or a target entity node.
[0046] Optionally, the key entity determination unit is specifically used to:
[0047] Using a deep learning model to encode the text query problem, and converting the text query problem into a text vector;
[0048] Determine a probability value of each of the words and phrases as an entity based on the text vector and the vector representation of each of the words and phrases in the text vector;
[0049] An entity whose probability value is greater than a probability threshold is determined as the key entity.
[0050] Optionally, the subgraph construction unit is specifically used for:
[0051] Based on the key entity, searching for a corresponding entity node in the knowledge graph;
[0052] Based on all the entity nodes and all the edges between the entity nodes, construct a preliminary context-aware subgraph;
[0053] determining a complexity of the preliminary situation awareness subgraph;
[0054] When the complexity does not exceed a first complexity threshold, determining the preliminary context-aware subgraph as the final context-aware subgraph;
[0055] When the complexity exceeds the first complexity threshold, the preliminary context-aware subgraph is expanded based on the query question characteristics and the knowledge graph characteristics to obtain the final context-aware subgraph.
[0056] As can be seen from the above technical solution, the present invention discloses a method and device for searching a knowledge graph, obtains a text query question input by a user, determines the text vector corresponding to the text query question based on the context-aware entity recognition technology, and the relationship between each word and phrase in the text query question and the text query question as a whole, obtains the key entity of the text query question, constructs a context-aware subgraph based on the key entity in the knowledge graph, and determines a comprehensive vector based on the text vector, and uses the comprehensive vector to search in the knowledge graph to obtain the target search result. When performing knowledge graph retrieval, the present invention uses context-aware entity recognition technology to determine the relationship between each word and phrase in the text query question and the text query question as a whole, thereby fully considering the context of the entire text query question, accurately identifying the user's true intention, and providing more accurate retrieval results. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without paying creative work.
[0058] Figure 1 A flow chart of a knowledge graph retrieval method disclosed in an embodiment of the present invention;
[0059] Figure 2 A flow chart of a method for determining a text vector and a key entity disclosed in an embodiment of the present invention;
[0060] Figure 3 A flow chart of a method for constructing a context-aware subgraph based on key entities in a knowledge graph disclosed in an embodiment of the present invention;
[0061] Figure 4 A flow chart of a method for adaptively adjusting the retrieval depth of a context-aware subgraph according to the complexity of the context-aware subgraph and the query question disclosed in an embodiment of the present invention;
[0062] Figure 5 A flow chart of a method for obtaining a target search result by searching in a knowledge graph using a comprehensive vector disclosed in an embodiment of the present invention;
[0063] Figure 6 A schematic diagram of the structure of a knowledge graph retrieval device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] The embodiment of the present invention discloses a method and device for searching a knowledge graph, which obtains a text query question input by a user, determines the text vector corresponding to the text query question based on the context-aware entity recognition technology, and the relationship between each word and phrase in the text query question and the text query question as a whole, obtains the key entity of the text query question, constructs a context-aware subgraph based on the key entity in the knowledge graph, and determines a comprehensive vector based on the text vector, and uses the comprehensive vector to search in the knowledge graph to obtain the target search result. When performing knowledge graph retrieval, the present invention uses the context-aware entity recognition technology to determine the relationship between each word and phrase in the text query question and the text query question as a whole, thereby fully considering the context of the entire text query question, accurately identifying the user's true intention, and providing more accurate search results.
[0066] See also Figure 1 , a flow chart of a knowledge graph retrieval method disclosed in an embodiment of the present invention, the method comprising:
[0067] Step S101, obtaining a text query question input by a user;
[0068] When a user needs to search in the knowledge graph, the user can enter a text query question in the front-end interface.
[0069] Step S102: determining the text vector corresponding to the text query question and the relationship between each word and phrase in the text query question and the text query question as a whole based on context-aware entity recognition technology, and obtaining the key entity of the text query question;
[0070] In this embodiment, the text query question includes a series of words and phrases.
[0071] The present invention uses context-aware entity recognition technology when searching the knowledge graph to deeply understand the user's real query intention. Different from the traditional keyword matching-based method, the context-aware entity recognition technology determines the relationship between each word and phrase in the text query problem and the text query problem as a whole through a deep model, that is, considering the context of the entire text query problem, which can effectively capture the deep semantics of the text query problem, for example, it can capture the specific meaning of "highest" in the query "the highest mountain in Asia", thereby providing more accurate retrieval results.
[0072] It should be noted that key entities, as the basis for constructing the context-aware subgraph in subsequent steps, can directly affect the accuracy and relevance of the context-aware subgraph construction.
[0073] Step S103: construct a context-aware subgraph based on key entities in the knowledge graph;
[0074] In the context of knowledge graph retrieval, the construction of context-aware subgraphs is a crucial step. By constructing context-aware subgraphs related to text-based query questions, information retrieval and retrieval result generation can be more efficient.
[0075] Step S104, determining a comprehensive vector based on the text vector;
[0076] Comprehensive vectors can make comprehensive use of all available information to provide users with the most accurate search results.
[0077] Step S105: Use the comprehensive vector to search in the knowledge graph to obtain the target search results.
[0078] The target retrieval result is a target context-aware subgraph or a target entity node.
[0079] In the entire knowledge graph, there may be many potential context-aware subgraphs, each of which is built around a specific set of key entities to reflect the context and needs of a specific user query. However, in this embodiment, only one context-aware subgraph is usually built for the current user query, and this subgraph is dynamically determined based on the key entities of the current query.
[0080] The target entity node in this embodiment is a target entity node selected from the entity nodes in the knowledge graph. The entity nodes in the knowledge graph are the basis for the construction of the knowledge graph and represent specific concepts or objects in the knowledge graph. After the key entities in the text query problem are identified based on the context-aware entity recognition technology in step S102, these key entities are used to locate the corresponding entity nodes in the knowledge graph, and these entity nodes and their relationships constitute the context-aware subgraph.
[0081] In this embodiment, when using the comprehensive vector to perform knowledge graph retrieval, the goal is to find the context-aware subgraph or entity node in the knowledge graph that best matches the comprehensive vector as the final target retrieval result.
[0082] It should be noted that the target context-aware subgraph or target entity node retrieved in this embodiment is the context-aware subgraph or entity with the highest matching degree with the comprehensive vector.
[0083] In summary, the present invention discloses a knowledge graph retrieval method, which obtains a text query question input by a user, determines the text vector corresponding to the text query question based on the context-aware entity recognition technology, and the relationship between each word and phrase in the text query question and the text query question as a whole, obtains the key entity of the text query question, constructs a context-aware subgraph based on the key entity in the knowledge graph, and determines a comprehensive vector based on the text vector, and uses the comprehensive vector to perform a search in the knowledge graph to obtain a target search result. When performing a knowledge graph search, the present invention uses the context-aware entity recognition technology to determine the relationship between each word and phrase in the text query question and the text query question as a whole, thereby fully considering the context of the entire text query question, accurately identifying the user's true intention, and providing more accurate search results.
[0084] To further optimize the above embodiment, see Figure 2 , the embodiment of the present invention discloses a flow chart of a method for determining a text vector and a key entity, that is, step S102 specifically includes:
[0085] Step S201: Encode the text query question using a deep learning model to convert the text query question into a text vector;
[0086] This embodiment uses a deep learning model (such as BERT, RoBERTa or GPT series) to encode the text query question Q to obtain a vector representation of the text query question, that is, a text vector v_Q, thereby capturing the global semantic information of the text query question, thereby providing strong support for subsequent entity recognition.
[0087] Specifically, a text query question Q can be regarded as a set of words and phrases, that is, Q = {q_1, q_2, ..., q_n}, where each q_i is a word and phrase in the text query question Q. Usually, a text query question Q contains multiple entities, verbs, and modifiers, etc., but not all words are relevant to the search results. Therefore, it is crucial to determine which words are key entities.
[0088] Based on this, this embodiment uses the deep learning model M to encode the text query question Q to obtain the text vector v_Q, which is as follows:
[0089] v_Q=M(Q).
[0090] Step S202: determining a probability value of each word and phrase as an entity based on the text vector and the vector representation of each word and phrase in the text vector;
[0091] For each word and phrase q_i in the text query problem, it is necessary to determine its probability value P(e_i|Q) as an entity. The probability value P(e_i|Q) is determined based on the context of the entire text query problem.
[0092] The calculation formula of the probability value P(e_i|Q) is as follows:
[0093] P(e_i|Q)=exp(v_qi*v_Q) / sum_from_j=1_to_n(exp(v_qj*v_Q));
[0094] Where v_qi is the vector representation of q_i.
[0095] Based on the above formula, this embodiment first calculates the dot product between the vector representation v_qi of the word and phrase q_i and the vector representation v_Q of the text query question, which can be regarded as the correlation between q_i and the entire text query question. Then, the dot product is converted into a probability value, and it is ensured that the sum of the probability values of all words and phrases in the same text query question is 1.
[0096] Step S203: Determine an entity whose probability value is greater than a probability threshold as a key entity.
[0097] The value of the probability threshold theta is determined according to actual needs and is not limited in the present invention.
[0098] This embodiment sets a probability threshold theta and selects q_i with a probability value P(e_i|Q) greater than theta as a key entity to ensure that the selected key entity is the most relevant and representative entity, while ignoring those less relevant words and phrases.
[0099] The present invention adopts a method for identifying entities using context-aware entity recognition technology, which can accurately extract key entities from questions, thereby providing strong support for subsequent knowledge graph retrieval.
[0100] In the context of knowledge graph retrieval, the construction of context-aware subgraphs is a crucial step. By constructing a context-aware subgraph related to the question, information retrieval can be performed more efficiently and retrieval results can be obtained.
[0101] Therefore, to further optimize the above embodiment, see Figure 3 , a flowchart of a method for constructing a context-aware subgraph based on key entities in a knowledge graph disclosed in an embodiment of the present invention, that is, step S103 may specifically include:
[0102] Step S301: Based on the key entity, search for the corresponding entity node in the knowledge graph;
[0103] Specifically, assume that the knowledge graph is represented as G_kg=(V,E), where V is a node set and E is an edge set. The goal is to find the entity nodes corresponding to the key entity from V, which is mathematically represented as: selected_nodes={v∈V|vcorresponds to key entity}.
[0104] Step S302: construct a preliminary context-aware subgraph based on all entity nodes and all edges between entity nodes;
[0105] The initial context-aware subgraph includes all selected entity nodes and edges between entity nodes, which is specifically expressed as: G_initial = (V_initial, E_initial), where V_initial is the set of selected entity nodes, and E_initial is the set of edges between entity nodes.
[0106] Step S303: determining the complexity of the preliminary context-aware subgraph;
[0107] In practical applications, it may not be enough to just construct the initial context-aware subgraph. This is because in some cases, G_initial may be too simple to cover all the information of the problem, or G_initial may be too complex and contain too much irrelevant information. Therefore, this embodiment determines the complexity of the initial context-aware subgraph to determine whether G_initial needs to be further expanded to cover more relevant information.
[0108] The complexity of the preliminary context-aware subgraph is calculated by the following formula.
[0109] C(G)=a*|V(G)|+b*|E(G)|;
[0110] Where C(G) represents the complexity of the preliminary context-aware subgraph G, and a and b are weight parameters used to adjust the influence of the number of nodes |V(G)| and the number of edges |E(G)| in the complexity calculation.
[0111] The core idea of the above formula is that the complexity of a preliminary context-aware subgraph depends not only on the number of its nodes, but also on the number of its edges. By adjusting the weight parameters a and b, the calculation of the complexity of the preliminary context-aware subgraph can be adjusted according to actual needs.
[0112] Step S304: when the complexity does not exceed a first complexity threshold, determining the preliminary context-aware subgraph as a final context-aware subgraph;
[0113] The first complexity threshold can be denoted as T.
[0114] In this embodiment, when C(G_initial) does not exceed the first complexity threshold T, it is considered that G_initial is good enough and does not need to be expanded.
[0115] Step S305: When the complexity exceeds a first complexity threshold, the preliminary context-aware subgraph is expanded based on the query question characteristics and the knowledge graph characteristics to obtain a final context-aware subgraph.
[0116] When C(G_initial) exceeds the first complexity threshold T, it is decided to further expand G_initial.
[0117] In summary, the construction of a context-aware subgraph is a dynamic process that needs to be adjusted according to the characteristics of the query question and the knowledge graph. This embodiment aims to construct a context-aware subgraph that is neither too simple nor too complex, thereby providing a solid foundation for subsequent retrieval processes and retrieval results.
[0118] In traditional knowledge graph retrieval, the retrieval depth is usually fixed, which may cause the processing of simple queries to be too complicated, while the results of complex queries are not deep enough. To solve this problem, the present invention proposes an adaptive subgraph depth strategy. This strategy dynamically adjusts the retrieval depth of the knowledge graph according to the complexity of the query. Simple queries may only touch the surface of the knowledge graph, while complex queries may need to go deep into multiple levels of the graph. The present invention intelligently selects the appropriate retrieval depth through real-time evaluation of query complexity, which not only ensures retrieval efficiency, but also ensures the accuracy and relevance of the results. This enables the knowledge graph to better meet the needs of different users and in different scenarios, thereby greatly improving the user's retrieval experience.
[0119] Therefore, to further optimize the above embodiment, after step S103, the retrieval method may further include:
[0120] The retrieval depth of the context-aware subgraph is adaptively adjusted according to the complexity of the context-aware subgraph and the query question.
[0121] Accordingly, step S105 may specifically include:
[0122] The comprehensive vector is used to search in the knowledge graph, and the search scope and search accuracy are determined based on the search depth adjusted by the context-aware subgraph to obtain the target search results.
[0123] This embodiment directly uses the context-aware subgraph to adjust the final search results. When using a comprehensive vector to search in a knowledge graph, the search depth affects the search scope and search accuracy. The search depth adjustment ensures that the context-aware subgraph or entity node most relevant to the user query is more accurately located, so that the most matching target search results can be found in the actual search process, and the final target search results can be returned to the user.
[0124] In summary, the adaptive adjustment mechanism disclosed in the present invention makes the retrieval process of the knowledge graph more intelligent and precise, and can be flexibly adjusted according to different query requirements, thereby providing more accurate and satisfactory retrieval results.
[0125] It should be noted that the adjustment of the retrieval depth of the context-aware subgraph will directly affect the comprehensiveness and accuracy of the retrieval results.
[0126] Therefore, to further optimize the above embodiment, see Figure 4 , a flow chart of a method for adaptively adjusting the retrieval depth of a context-aware subgraph according to the complexity of the context-aware subgraph and the query question disclosed in an embodiment of the present invention, the method comprising:
[0127] Step S401, determining a query problem complexity measure based on the importance of each entity in the text query problem;
[0128] This embodiment uses the query problem complexity metric C(Q) to evaluate the difficulty or complexity of the query problem.
[0129] The query problem complexity measure is calculated based on the probability P(e_i|Q) of each entity in the text query problem. Its purpose is to measure the contribution of each part of the text query problem to the overall complexity.
[0130] Mathematically, the calculation formula of the query problem complexity measure C(Q) is as follows:
[0131] C(Q)=sum_from_i=1_to_n(P(e_i|Q)) / n;
[0132] Where n represents the number of words and phrases in the text query question.
[0133] The intuitive explanation of this formula is that the importance of each entity in the query problem is averaged to obtain the overall query problem complexity measure.
[0134] Step S402: Compare the query question complexity measure with the second complexity threshold to obtain a comparison result;
[0135] This embodiment determines the retrieval depth d of the context-aware subgraph according to the query problem complexity metric. To this end, a second complexity threshold gamma is set.
[0136] If the query problem complexity metric C(Q) exceeds the second complexity threshold gamma, the maximum subgraph depth D_max is selected; otherwise, the minimum subgraph depth D_min is selected.
[0137] Mathematically, it is expressed as: if C(Q)>gamma, then d=D_max;
[0138] If C(Q)≤gamma, then d=D_min.
[0139] Where D_max is the predefined maximum sub-image depth, and D_min is the predefined minimum sub-image depth.
[0140] D_max and D_min allow setting boundaries during the retrieval process, ensuring that the context-aware subgraph is neither too shallow nor too deep.
[0141] Step S403: adaptively adjust the retrieval depth of the context-aware subgraph according to the comparison result.
[0142] In summary, the adaptive context-aware subgraph retrieval depth selection mechanism disclosed in the present invention has great practical significance. For simple questions, selecting a shallow context-aware subgraph can speed up the retrieval process and reduce unnecessary calculations; for complex questions, selecting a deep context-aware subgraph ensures that all relevant information is captured, thereby improving the quality of the answer. In addition, by setting appropriate gamma, D_max, and D_min values, the retrieval process can be further optimized to make it more adaptable to different application scenarios. In general, the adaptive subgraph depth mechanism provides a powerful tool for knowledge graph retrieval, aiming to improve the efficiency and accuracy of retrieval.
[0143] With the development of information retrieval and knowledge graph technology, a single text input may not be sufficient to meet complex query requirements. In the real world, users may provide multiple modal data such as text, images, and audio to ask a question.
[0144] Based on this, the present invention provides a multimodal data integration method to effectively integrate these multimodal data to provide more accurate knowledge graph retrieval results.
[0145] Therefore, to further optimize the above embodiment, step S104 may specifically include:
[0146] Determine whether the user enters a non-text query question during search;
[0147] If not, the text vector is determined to be a comprehensive vector;
[0148] If yes, extract the feature vector of the non-text query question;
[0149] The text vector and feature vector are fused to obtain a comprehensive vector.
[0150] It should be noted that the comprehensive vector further enhances the system's ability to understand the user's true query intention and provides richer information to support retrieval.
[0151] In practical applications, for non-text query problems, such as image I and audio A, they cannot be directly processed together with text data because the characteristics of these non-text data are very different from those of text data. To solve this problem, we use two specialized models, M_I and M_A, to process image and audio data respectively. The task of these two models is to extract feature vectors of these non-text data, which can capture the key information in images and audio.
[0152] In this embodiment, for non-text query questions (such as images and audio), corresponding feature extraction models are used to extract feature vectors. For image I, model M_I is used to process to obtain feature vector v_I=M_I(I), and for audio A, model M_A is used to process to obtain feature vector v_A=M_A(A).
[0153] By fusing the feature vector with the text vector, a comprehensive vector is obtained, which reflects the information of text, image and audio. The fusion process uses weights alpha, beta, and gamma to represent the weights of text, image and audio in the comprehensive vector v_QA, respectively, satisfying alpha+beta+gamma=1. The comprehensive vector is calculated as v_QA=alpha*v_Q+beta*v_I+gamma*v_A.
[0154] The choice of weights is crucial to the effectiveness of the combined vector. They reflect the contribution of text, image, and audio data to the solution of a particular query. For example, for a query that relies primarily on visual information, beta may be larger than alpha and gamma. These weights can be optimized based on training data or can be manually adjusted based on the specific needs of the application.
[0155] It should be noted that the adjustment of the retrieval depth of the context-aware subgraph determines the scale and complexity of the context-aware subgraph, which may affect how to utilize image and audio data. For example, a context-aware subgraph with a deeper retrieval depth may involve more entities and concepts, which requires that the comprehensive vector must be able to capture a wider range of contextual information to ensure that it can cover the additional information introduced by the deep subgraph.
[0156] In summary, the multimodal data integration step is a key link in the knowledge graph enhanced retrieval method. It can not only process data of multiple modalities, but also assign appropriate weights to each modality according to the importance of these data. This integration method provides a powerful tool to capture and utilize the rich information in multimodal data, thereby providing more accurate and comprehensive knowledge graph retrieval results.
[0157] To further optimize the above embodiment, see Figure 5 , a flowchart of a method for obtaining a target search result by searching in a knowledge graph using a comprehensive vector disclosed in an embodiment of the present invention, that is, step S105 may specifically include:
[0158] Step S501: Search the knowledge graph using the comprehensive vector to find candidate context-aware subgraphs or candidate entities related to the comprehensive vector;
[0159] Specifically, the similarity between the comprehensive vector v_QA and the feature vector of each subgraph or entity in the knowledge graph is calculated, and the cosine similarity is used as the similarity measurement method as follows:
[0160] similarity(S,Q)=(v_S*v_QA) / (||v_S||*||v_QA||);
[0161] Where v_S is the feature vector of the subgraph or entity S in the knowledge graph.
[0162] Step S502: using a preset similarity measurement method to calculate the matching scores between each of the candidate context-aware subgraphs or each of the candidate entities and the comprehensive vector;
[0163] Using the similarity formula, a matching score is calculated for each subgraph or entity in the knowledge graph. This matching score represents the degree of match between the subgraph or entity and the user query.
[0164] Step S503: sorting the candidate context-aware subgraphs or candidate entities according to the corresponding matching scores;
[0165] Step S504: Select the candidate context-aware subgraph or candidate entity with the highest matching score as the target retrieval result.
[0166] This embodiment selects the candidate context-aware subgraph or candidate entity with the highest matching score as the target retrieval result. In practical applications, in order to increase the diversity and completeness of the answers, the target retrieval result may include multiple subgraphs or entities with high matching scores.
[0167] In summary, the sorting step in this embodiment is the last key link in the knowledge graph enhanced retrieval method. It uses the comprehensive vector v_QA to search in the knowledge graph, then sorts the retrieved subgraphs or entities based on the matching scores, and finally returns the candidate context-aware subgraphs or candidate entities with the highest matching scores as the target retrieval results. As a result, the retrieval method disclosed in the present invention can not only process data of multiple modalities, but also effectively find the most relevant answers in the knowledge graph.
[0168] It should be noted that the knowledge graph retrieval method disclosed in the present invention combines the advanced technologies of deep learning, contextual awareness and multimodal data processing to provide users with a more intelligent and accurate knowledge graph retrieval experience. The close connection of the overall process ensures that from user query to receiving the final retrieval results, it is carried out on the basis of continuously deepening the understanding of user needs, thereby greatly improving the retrieval accuracy and user satisfaction. The application prospects of this method are broad, not only applicable to knowledge graphs, but also can be extended to other fields, such as recommendation systems, automatic question-answering systems, etc. .
[0169] To facilitate understanding of the knowledge graph retrieval method disclosed in the present invention, the present invention also provides a specific embodiment as follows:
[0170] Scenario description: A large e-commerce platform wants to provide users with more accurate product recommendation services. Users can ask the platform for information about a certain product through text, images or audio, and the platform needs to quickly and accurately return recommendations for related products based on the user's query.
[0171] Real-time steps:
[0172] 1. Context-aware entity recognition: First, the user enters a query, such as "red summer women's clothing". The system first decomposes the query into {"red", "summer", "women's clothing"}. Using the trained large model M, the system encodes the entire question and obtains its vector representation. Then it calculates the probability of each word and phrase being an entity, and selects items with a probability above a certain threshold, such as "women's clothing", as key entities.
[0173] 2. Context-aware subgraph construction: The system searches for entity nodes related to "women's clothing" in the knowledge graph, and then constructs a preliminary subgraph, which contains various categories, brands, styles and other information directly related to "women's clothing".
[0174] 3. Adaptive context-aware subgraph depth: Considering the complexity of the query, the system determines the depth of retrieval. Since the query contains descriptions of color and season, it means that the knowledge graph needs to be retrieved more deeply to obtain more detailed women's clothing information related to "red" and "summer".
[0175] 4. Multimodal data integration: Assume that the user also uploaded a picture of women's clothing that they like. The system uses model M_I to extract the feature vector of the image and integrates it with the question vector representation obtained in the previous step to form a more comprehensive integrated vector.
[0176] 5. Context-aware retrieval and ranking: The system uses the above comprehensive vector to search in the knowledge graph and obtain a list of women's clothing products related to both the query and the image. The products are then sorted according to the degree of match between the products and the comprehensive vector, and the highest-ranked products are finally returned to the user.
[0177] Results: Through the implementation of the above technical solution, the e-commerce platform successfully provided users with highly relevant product recommendations, greatly improving the user's purchase conversion rate and satisfaction. This proves the effectiveness and superiority of the technical solution of the present invention in practical applications.
[0178] Corresponding to the above method embodiment, the present invention also discloses a knowledge graph retrieval device.
[0179] See also Figure 6 , a schematic diagram of a knowledge graph retrieval device disclosed in an embodiment of the present invention, the device may include:
[0180] An acquisition unit 601 is used to acquire a text query question input by a user;
[0181] When a user needs to search in the knowledge graph, the user can enter a text query question in the front-end interface.
[0182] A key entity determination unit 602 is used to determine the text vector corresponding to the text query question and the relationship between each word and phrase in the text query question and the text query question as a whole based on context-aware entity recognition technology to obtain the key entity of the text query question;
[0183] In this embodiment, the text query question includes a series of words and phrases.
[0184] The present invention uses context-aware entity recognition technology when searching the knowledge graph to deeply understand the user's real query intention. Different from the traditional keyword matching-based method, the context-aware entity recognition technology determines the relationship between each word and phrase in the text query problem and the text query problem as a whole through a deep model, that is, considering the context of the entire text query problem, which can effectively capture the deep semantics of the text query problem, for example, it can capture the specific meaning of "highest" in the query "the highest mountain in Asia", thereby providing more accurate retrieval results.
[0185] It should be noted that key entities, as the basis for constructing the context-aware subgraph in subsequent steps, can directly affect the accuracy and relevance of the context-aware subgraph construction.
[0186] A subgraph construction unit 603, configured to construct a context-aware subgraph based on the key entity in the knowledge graph;
[0187] In the context of knowledge graph retrieval, the construction of context-aware subgraphs is a crucial step. By constructing context-aware subgraphs related to text-based query questions, information retrieval and retrieval result generation can be more efficient.
[0188] A comprehensive vector determining unit 604, configured to determine a comprehensive vector based on the text vector;
[0189] Comprehensive vectors can make comprehensive use of all available information to provide users with the most accurate search results.
[0190] The retrieval unit 605 is used to use the comprehensive vector to search in the knowledge graph to obtain a target retrieval result, wherein the target retrieval result is a target context-aware subgraph or a target entity node.
[0191] In the entire knowledge graph, there may be many potential context-aware subgraphs, each of which is built around a specific set of key entities to reflect the context and needs of a specific user query. However, in this embodiment, only one context-aware subgraph is usually built for the current user query, and this subgraph is dynamically determined based on the key entities of the current query.
[0192] The target entity node in this embodiment is a target entity node selected from the entity nodes in the knowledge graph. The entity nodes in the knowledge graph are the basis for the construction of the knowledge graph and represent specific concepts or objects in the knowledge graph. After the key entities in the text query problem are identified based on the context-aware entity recognition technology in step S102, these key entities are used to locate the corresponding entity nodes in the knowledge graph, and these entity nodes and their relationships constitute the context-aware subgraph.
[0193] In this embodiment, when using the comprehensive vector to perform knowledge graph retrieval, the goal is to find the context-aware subgraph or entity node in the knowledge graph that best matches the comprehensive vector as the final target retrieval result.
[0194] It should be noted that the target context-aware subgraph or target entity node retrieved in this embodiment is the context-aware subgraph or entity with the highest matching degree with the comprehensive vector.
[0195] In summary, the present invention discloses a retrieval device for a knowledge graph, which obtains a text query question input by a user, determines the text vector corresponding to the text query question based on the context-aware entity recognition technology, and the relationship between each word and phrase in the text query question and the text query question as a whole, obtains the key entity of the text query question, constructs a context-aware subgraph based on the key entity in the knowledge graph, and determines a comprehensive vector based on the text vector, and uses the comprehensive vector to perform a search in the knowledge graph to obtain a target search result. When performing a knowledge graph search, the present invention uses the context-aware entity recognition technology to determine the relationship between each word and phrase in the text query question and the text query question as a whole, thereby fully considering the context of the entire text query question, accurately identifying the user's true intention, and providing more accurate search results.
[0196] To further optimize the above embodiment, the key entity determination unit 602 may be specifically used for:
[0197] Using a deep learning model to encode the text query problem, and converting the text query problem into a text vector;
[0198] Determine a probability value of each of the words and phrases as an entity based on the text vector and the vector representation of each of the words and phrases in the text vector;
[0199] An entity whose probability value is greater than a probability threshold is determined as the key entity.
[0200] To further optimize the above embodiment, the subgraph construction unit 603 may be specifically used for:
[0201] Based on the key entity, searching for a corresponding entity node in the knowledge graph;
[0202] Based on all the entity nodes and all the edges between the entity nodes, construct a preliminary context-aware subgraph;
[0203] determining a complexity of the preliminary situation awareness subgraph;
[0204] When the complexity does not exceed a first complexity threshold, determining the preliminary context-aware subgraph as the final context-aware subgraph;
[0205] When the complexity exceeds the first complexity threshold, the preliminary context-aware subgraph is expanded based on the query question characteristics and the knowledge graph characteristics to obtain the final context-aware subgraph.
[0206] To further optimize the above embodiment, the retrieval device may further include:
[0207] A retrieval depth adjustment unit, configured to adaptively adjust the retrieval depth of the context-aware subgraph according to the complexity of the context-aware subgraph and the query question after the subgraph construction unit 603 constructs the context-aware subgraph based on the key entity in the knowledge graph;
[0208] Accordingly, the retrieval unit 605 is specifically used for:
[0209] The comprehensive vector is used to search in the knowledge graph, and the search scope and search accuracy are determined based on the search depth adjusted by the context-aware subgraph to obtain the target search result.
[0210] To further optimize the above embodiment, the search depth adjustment unit may be specifically used for:
[0211] Determining a query problem complexity measure based on the importance of each entity in the text-based query problem in the query problem;
[0212] Comparing the query problem complexity measure with a second complexity threshold to obtain a comparison result;
[0213] The retrieval depth of the context-aware subgraph is adaptively adjusted according to the comparison result.
[0214] To further optimize the above embodiment, the comprehensive vector determination unit 604 may be specifically used for:
[0215] Determine whether the user enters a non-text query question during search;
[0216] If not, determining the text vector as the comprehensive vector;
[0217] If yes, extracting the feature vector of the non-text query question;
[0218] The text vector and the feature vector are fused to obtain the comprehensive vector.
[0219] To further optimize the above embodiment, the retrieval unit 605 may be specifically used for:
[0220] Using the comprehensive vector to search the knowledge graph, find candidate context-aware subgraphs or candidate entities related to the comprehensive vector;
[0221] Using a preset similarity measurement method, calculate the matching scores between each of the candidate context-aware subgraphs or each of the candidate entities and the comprehensive vector;
[0222] Sort the candidate context-aware subgraphs or the candidate entities according to the corresponding matching scores;
[0223] The candidate context-aware subgraph or the candidate entity with the highest matching score is selected as the target retrieval result.
[0224] It should be noted that for the specific working principles of the various components in the device embodiment, please refer to the corresponding part of the method embodiment, which will not be repeated here.
[0225] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0226] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0227] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A knowledge graph retrieval method, characterized in that: include: Get the text query question entered by the user; Determine the text vector corresponding to the text query question and the relationship between each word and phrase in the text query question and the text query question as a whole based on context-aware entity recognition technology to obtain the key entity of the text query question; Constructing a context-aware subgraph based on the key entities in the knowledge graph; determining a comprehensive vector based on the text vector; Using the comprehensive vector to search in the knowledge graph to obtain a target search result, wherein the target search result is a target context-aware subgraph or a target entity node; Wherein, constructing a context-aware subgraph based on the key entity in the knowledge graph includes: Based on the key entity, searching for a corresponding entity node in the knowledge graph; Based on all the entity nodes and all the edges between the entity nodes, construct a preliminary context-aware subgraph; determining a complexity of the preliminary situation awareness subgraph; When the complexity does not exceed a first complexity threshold, determining the preliminary context-aware subgraph as the final context-aware subgraph; When the complexity exceeds the first complexity threshold, the preliminary context-aware subgraph is expanded based on the query question characteristics and the knowledge graph characteristics to obtain the final context-aware subgraph.
2. The search method according to claim 1, characterized in that: The context-aware entity recognition technology is used to determine the text vector corresponding to the text query question, and the relationship between each word and phrase in the text query question and the text query question as a whole, to obtain the key entity of the text query question, including: Using a deep learning model to encode the text query problem, and converting the text query problem into a text vector; Determine a probability value of each of the words and phrases as an entity based on the text vector and the vector representation of each of the words and phrases in the text vector; An entity whose probability value is greater than a probability threshold is determined as the key entity.
3. The search method according to claim 1, characterized in that: After constructing the context-aware subgraph based on the key entity in the knowledge graph, the method further includes: Adaptively adjusting the retrieval depth of the context-aware subgraph according to the complexity of the context-aware subgraph and the query question; Accordingly, the use of the comprehensive vector to search in the knowledge graph to obtain a target search result specifically includes: The comprehensive vector is used to search in the knowledge graph, and the search scope and search accuracy are determined based on the search depth adjusted by the context-aware subgraph to obtain the target search result.
4. The search method according to claim 3, characterized in that: The step of adaptively adjusting the retrieval depth of the context-aware subgraph according to the complexity of the context-aware subgraph and the query question includes: Determining a query problem complexity measure based on the importance of each entity in the text-based query problem in the query problem; Comparing the query problem complexity measure with a second complexity threshold to obtain a comparison result; The retrieval depth of the context-aware subgraph is adaptively adjusted according to the comparison result.
5. The search method according to claim 1, characterized in that: The determining of the comprehensive vector based on the text vector comprises: Determine whether the user enters a non-text query question during search; If not, determining the text vector as the comprehensive vector; If yes, extracting the feature vector of the non-text query question; The text vector and the feature vector are fused to obtain the comprehensive vector.
6. The search method according to claim 1, characterized in that: The using the comprehensive vector to search in the knowledge graph to obtain a target search result includes: Using the comprehensive vector to search the knowledge graph, find candidate context-aware subgraphs or candidate entities related to the comprehensive vector; Using a preset similarity measurement method, calculate the matching scores between each of the candidate context-aware subgraphs or each of the candidate entities and the comprehensive vector; Sort the candidate context-aware subgraphs or the candidate entities according to the corresponding matching scores; The candidate context-aware subgraph or the candidate entity with the highest matching score is selected as the target retrieval result.
7. A knowledge graph retrieval device, characterized in that: include: An acquisition unit, used for acquiring a text query question input by a user; A key entity determination unit is used to determine the text vector corresponding to the text query question and the relationship between each word and phrase in the text query question and the text query question as a whole based on context-aware entity recognition technology to obtain the key entity of the text query question; A subgraph construction unit, used to construct a context-aware subgraph based on the key entity in the knowledge graph; A comprehensive vector determining unit, configured to determine a comprehensive vector based on the text vector; A retrieval unit, configured to use the comprehensive vector to search in the knowledge graph to obtain a target retrieval result, wherein the target retrieval result is a target context-aware subgraph or a target entity node; The subgraph construction unit is specifically used for: Based on the key entity, searching for a corresponding entity node in the knowledge graph; Based on all the entity nodes and all the edges between the entity nodes, construct a preliminary context-aware subgraph; determining a complexity of the preliminary situation awareness subgraph; When the complexity does not exceed a first complexity threshold, determining the preliminary context-aware subgraph as the final context-aware subgraph; When the complexity exceeds the first complexity threshold, the preliminary context-aware subgraph is expanded based on the query question characteristics and the knowledge graph characteristics to obtain the final context-aware subgraph.
8. The search device according to claim 7, characterized in that: The key entity determination unit is specifically used for: Using a deep learning model to encode the text query problem, and converting the text query problem into a text vector; Determine a probability value of each of the words and phrases as an entity based on the text vector and the vector representation of each of the words and phrases in the text vector; An entity whose probability value is greater than a probability threshold is determined as the key entity.
Citation Information
Patent Citations
Question and answer knowledge retrieval method, device and equipment based on graph embedding
CN113947084A
Contextual awareness of smart devices by sensing transient and continuous events
CN116738284A