Information acquisition method, device, equipment and storage medium
By encoding the query keywords to generate representation vectors and selecting the target representation vector based on similarity, the target entity node is recalled, which solves the problem of low recall in the prior art and realizes efficient entity node recall and knowledge information acquisition.
Patent Information
- Application Number
- CN202110501638.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-08
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-05-08
AI Technical Summary
When recalling entity nodes in the medical knowledge graph based on string matching in the prior art, the recall rate is low and all corresponding entity nodes cannot be matched.
By encoding the query keywords, a representation vector is generated, and the target representation vector is selected based on the similarity, thereby recalling the target entity node and using the knowledge graph to obtain knowledge information.
It improves the recall rate and recall efficiency of entity nodes, reduces the similarity matching time, and realizes recall of entity nodes from the semantic level.
Smart Images

Figure CN113761220B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to an information acquisition method, apparatus, device, and storage medium. Background Art
[0002] With the development of artificial intelligence technology, keyword search technology based on knowledge graphs can be applied to a variety of tasks, such as knowledge recall, knowledge verification, knowledge question and answer, etc.
[0003] Taking the recall of entity nodes in the medical knowledge graph as an example, related technologies use string matching to recall entity nodes. For example, if a user enters a query keyword related to a disease, the related technology will traverse and match the query keyword string with the keyword strings corresponding to each entity node in the medical knowledge graph, and recall entity nodes that meet the matching criteria.
[0004] However, due to the diversity of colloquial expressions of diseases, related technologies cannot match all corresponding entity nodes in the medical knowledge graph based on query keyword strings, resulting in too few recalled entity nodes and a low recall rate of entity nodes. Summary of the Invention
[0005] The embodiments of the present application provide an information acquisition method, apparatus, device, and storage medium that can improve the recall rate of required entity nodes in a knowledge graph. The technical solution is as follows:
[0006] According to one aspect of an embodiment of the present application, a method for obtaining information is provided, the method comprising:
[0007] Obtain query keywords in query information;
[0008] Encoding the query keyword to obtain a representation vector corresponding to the query keyword;
[0009] Based on the representation vector corresponding to the query keyword, a target representation vector is selected from a representation vector set; wherein the representation vector set includes the representation vectors of the keywords corresponding to each entity node in the knowledge graph of the target domain, and the target representation vector refers to a representation vector in the representation vector set whose similarity with the representation vector corresponding to the query keyword meets a first condition;
[0010] Based on the target entity node corresponding to the target representation vector, knowledge information corresponding to the query information is obtained from the knowledge graph of the target domain.
[0011] According to one aspect of an embodiment of the present application, there is provided an information acquisition device, the device comprising:
[0012] Keyword acquisition module, used to obtain query keywords in query information;
[0013] A keyword encoding module, configured to encode the query keyword to obtain a representation vector corresponding to the query keyword;
[0014] a target vector acquisition module, configured to select a target representation vector from a representation vector set based on the representation vector corresponding to the query keyword; wherein the representation vector set includes the representation vectors of the keywords corresponding to each entity node in the knowledge graph of the target domain, and the target representation vector refers to a representation vector in the representation vector set whose similarity with the representation vector corresponding to the query keyword satisfies a first condition;
[0015] A knowledge information acquisition module is used to acquire the knowledge information corresponding to the query information from the knowledge graph of the target domain based on the target entity node corresponding to the target representation vector.
[0016] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the above-mentioned information acquisition method.
[0017] Optionally, the computer device is a terminal or a server.
[0018] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned information acquisition method.
[0019] According to one aspect of an embodiment of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described information acquisition method.
[0020] The technical solutions provided in the embodiments of the present application can bring the following beneficial effects:
[0021] By recalling the target entity nodes based on the similarity between the representation vector of the query keyword and the representation vector of the keyword corresponding to each entity node in the knowledge graph of the target domain, and then obtaining knowledge information based on the target entity nodes, the entity nodes in the knowledge graph are recalled at the semantic level, which improves the recall rate of entity nodes (i.e., keywords). BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0023] Figure 1 This is a schematic diagram of an implementation environment for a solution provided by an embodiment of the present application;
[0024] Figure 2 This is a flowchart of an information acquisition method provided by an embodiment of the present application;
[0025] Figure 3 is a schematic diagram of a keyword encoding model provided by an embodiment of the present application;
[0026] Figure 4 This is a schematic diagram of a knowledge graph keyword search provided by an embodiment of the present application;
[0027] Figure 5 is a flowchart of an information acquisition method provided by another embodiment of the present application;
[0028] Figure 6 This is a schematic diagram of a knowledge graph keyword search provided by another embodiment of the present application;
[0029] Figure 7 is a block diagram of an information acquisition device provided by an embodiment of the present application;
[0030] Figure 8 This is a structural block diagram of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0032] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0033] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0034] Natural language processing (NLP) is a key area of research in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use in everyday life—and is closely linked to the study of linguistics. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robotic question answering, and knowledge graphs.
[0035] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0036] The solution provided in the embodiment of the present application involves natural language processing technology of artificial intelligence, which uses natural language processing technology to train a keyword encoding model, and encodes query keywords or keywords corresponding to each entity node in the medical knowledge graph based on the keyword encoding model.
[0037] In the methods provided in the embodiments of the present application, the execution entity of each step may be a computer device, which refers to an electronic device with data computing, processing, and storage capabilities. The computer device may be a terminal such as a PC (Personal Computer), a tablet computer, a smartphone, a wearable device, an intelligent robot, or a server. The server may be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services.
[0038] The technical solution provided in the embodiments of the present application can be used in any product or system that requires knowledge information search functions, such as knowledge recall systems, knowledge question-and-answer systems, knowledge verification systems, sentiment analysis systems, intention analysis systems, etc. The technical solution provided in the embodiments of the present application can effectively improve the recall rate of required entity nodes in the knowledge graph.
[0039] In one example, if Figure 1 As shown, taking the knowledge recall system as an example, the system may include a terminal 10 and a server 20 .
[0040] The terminal 10 may be an electronic device such as a mobile phone, tablet computer, PC, wearable device, etc. The user may access the server 20 through the terminal 10 and perform a knowledge recall operation. For example, a client of a target application may be installed in the terminal 10, and the user may access the server 20 through the client and perform a knowledge recall operation. The target application may be any application that provides a knowledge recall service, such as a knowledge query application, an information retrieval application, an information recommendation application, etc., and the embodiments of the present application are not limited thereto.
[0041] The server 20 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The server 20 is used to provide background services for the client of the target application in the terminal 10. For example, the server 20 may be the background server of the target application.
[0042] The terminal 10 and the server 20 can communicate with each other via the network 30 .
[0043] For example, the user enters a piece of text information (such as "Introduction to Gout") in the client of the target application. The client extracts keywords (such as "gout") from the text information and sends the keywords to the server 20. The server 20 obtains the corresponding knowledge information from the knowledge graph (such as the medical knowledge graph) based on the keywords and returns the obtained knowledge information to the client.
[0044] Please refer to Figure 2 , which shows a flowchart of an information acquisition method provided by an embodiment of the present application. The execution subject of each step of the method can be the computer device introduced above. The method may include the following steps (201-203):
[0045] Step 201: Obtain query keywords in query information.
[0046] In the embodiment of the present application, query information is used to obtain the required knowledge information. For example, query information can refer to information entered by a user in the client of the above-mentioned target application, and the information can be information of types such as text, numbers, letters, etc. Query information can be expressed in a standard form or a non-standard form. For example, gout can be called tongbi, lijie, Gout (gout), etc., and then inputting gout, tongbi, lijie, Gout (gout), etc. can obtain the knowledge information corresponding to gout.
[0047] Query keywords are words that can be used to represent the central concept of the query information. For example, if the query information is "gout symptoms," then "gout" in the query information can be used as a query keyword. Optionally, the query information can include multiple query keywords. For example, if the query information is "the therapeutic effect of drug A on gout," the query information corresponding to the query information can include "gout" and "drug A."
[0048] Step 202: Encode the query keyword to obtain a representation vector corresponding to the query keyword.
[0049] In the embodiments of this application, representation vectors are used to represent the semantic features of query keywords. For example, the aforementioned condition "gout" can be colloquially expressed as "tongbi" (painful arthritis) and "lijie" (severe joints). However, in essence, the semantics of "gout," "tongbi," and "lijie" are the same, meaning that the representation vectors corresponding to "gout," "tongbi," and "lijie" are identical. Based on semantic information, different colloquial expressions of the same condition can be normalized to the same medical entity concept.
[0050] Optionally, the method for obtaining the representation vector corresponding to the query keyword can be as follows: calling the keyword encoding model, which is a model trained with text corpus in the target field; encoding the query keyword through the keyword encoding model to obtain the representation vector corresponding to the query keyword.
[0051] Among them, the keyword encoding model is used to obtain the representation vector of the keyword. Optionally, the keyword encoding model in this application can be obtained by training the BERT (Bidirectional Encoder Representation from Transformers) model. The BERT model is a pre-trained language expression model that can learn rich semantic information.
[0052] In an exemplary embodiment, reference Figure 3 After obtaining the query keyword "Tok", the BERT model 301 adds a [CLS] mark in front of the query keyword "Tok", and then obtains the word vector "E" of the query keyword "Tok" through the word embedding extraction unit of the BERT model 301. (CLS) , E”, and then the semantic vector “C, T” corresponding to the query keyword “Tok” is obtained through the encoder of the BERT model 301, and the hidden state vector C of [CLS] in the last layer of the encoder is taken as the semantic vector of the query keyword “Tok”, that is, the above-mentioned representation vector.
[0053] Optionally, the target field may refer to fields such as medical care, services, food, and any field that requires knowledge information search. The text corpus refers to the corpus corresponding to the target field. For example, in the medical field, corpus samples of various topics including medical articles, medical questions and answers, drug knowledge, pharmaceutical research, etc. can be used to train the BERT model to obtain a keyword encoding model for the medical field. Since the BERT model is trained on general corpus, there is still a certain semantic drift with the actual application scenario. Therefore, for different target fields, it is necessary to use corpus samples corresponding to different target fields to train the model to reduce the impact of semantic drift.
[0054] In one example, the training process of the keyword encoding model can be as follows: obtain a corpus sample of the target domain; perform keyword hiding processing on the corpus sample to obtain a hidden corpus sample and hidden keywords; encode the hidden corpus sample through the keyword encoding model to obtain an output representation vector; obtain predicted keywords based on the output representation vector; obtain the training loss of the keyword encoding model based on the predicted keywords and the hidden keywords; and train the keyword encoding model based on the training loss.
[0055] Optionally, the output representation vector can be input into a classifier consisting of a fully connected layer and a Softmax function to obtain the predicted keyword. Finally, the keyword encoding model is trained by minimizing the training loss and iterating continuously.
[0056] Step 203: Based on the representation vector corresponding to the query keyword, a target representation vector is selected from the representation vector set; wherein the representation vector set includes the representation vectors of the keywords corresponding to each entity node in the knowledge graph of the target domain, and the target representation vector refers to a representation vector in the representation vector set whose similarity with the representation vector corresponding to the query keyword meets the first condition.
[0057] In an embodiment of the present application, a knowledge graph refers to an undirected graph that shows the knowledge development process and structural relationship. The knowledge graph includes a large amount of knowledge information, and each piece of knowledge information is represented as an SPO (Subject-Predicate-Object) triple. Among them, the subject or object of each piece of knowledge information corresponds to an entity node in the knowledge graph, and the relationship between the subject and object of each piece of knowledge information is represented by the point edge between the entity nodes corresponding to the subject and object respectively. Optionally, the present application uses a relationship extraction algorithm to determine the probability of the point-edge relationship between entity nodes, and uses the probability as the weight of the edge. In different application scenarios, the weights of the edges in the knowledge graph can be adjusted in a targeted manner. For example, taking the medical knowledge graph as an example, refer to Figure 4 The information corresponding to entity node 401 is the disease "gout", and the information corresponding to entity node 402 is "tophetolith resection". The information corresponding to entity node 402 is the treatment surgery for the information corresponding to entity node 401. The probability of the point-edge relationship between entity node 402 and entity node 401 being established is 0.8.
[0058] Optionally, the method for obtaining the representation vector set can be as follows: the keywords corresponding to each entity node in the knowledge graph of the target domain are encoded by a keyword encoding model to obtain a representation vector set. The keyword encoding model is the same model as the keyword encoding model used to encode the query keyword. For example, referring to Figure 4 , obtain the information "gout" corresponding to entity node 401. "Gout" can be used as the keyword corresponding to entity node 401 (optionally, an entity node can include multiple keywords). Then, the keyword "gout" is encoded using the keyword encoding model to obtain the representation vector corresponding to entity node 401. Finally, the representation vectors corresponding to all entity nodes in the knowledge graph are grouped into a representation vector set.
[0059] Optionally, the first condition may be that the cosine similarity between the representation vectors is greater than a first set threshold, that is, the representation vector in the representation vector set whose cosine similarity with the representation vector corresponding to the query keyword is greater than the first set threshold is selected as the target representation vector. The first set threshold can be adaptively adjusted according to actual needs. Optionally, the present application uses the Faiss method for similarity matching of representation vectors.
[0060] Exemplarily, the method for obtaining the target representation vector can be as follows: clustering the representation vectors in the representation vector set to obtain multiple cluster vector combinations and cluster center vectors corresponding to each of the multiple cluster vector combinations; determining the target cluster center vector based on the distance between the representation vector corresponding to the query keyword and the cluster center vectors corresponding to each of the multiple cluster vector combinations; wherein the target cluster center vector refers to the cluster center vector corresponding to each of the multiple cluster vector combinations, whose distance to the representation vector corresponding to the query keyword meets the second condition; and determining the representation vector in the cluster vector combination corresponding to the target cluster center vector, whose similarity to the representation vector corresponding to the query keyword meets the first condition, as the target representation vector.
[0061] Among them, the cluster vector combination refers to a vector combination formed by the aggregation of representation vectors of the same type as the cluster center vector. The cluster center vector can be obtained by the K-means (K-means clustering algorithm) method, and the above-mentioned second condition can refer to the cosine similarity between vectors being less than the second set threshold, that is, the cluster center vector whose cosine similarity between the representation vectors corresponding to the query keywords is less than the second set threshold is used as the target cluster center vector. The second set threshold can be adaptively adjusted according to actual needs. Finally, the representation vector whose cosine similarity of the representation vector corresponding to the query keyword in the cluster vector combination corresponding to the target cluster center vector is less than the first review threshold is used as the target representation vector. The present application realizes fast matching of similarity between vectors through the Faiss method, without the need to traversely match all entity nodes in the knowledge graph, reducing the similarity matching time, thereby improving the recall efficiency of the entity nodes.
[0062] Get the keyword corresponding to the target representation vector, and then get the corresponding target entity node based on the keyword. Optionally, different entity nodes in the knowledge graph can include the same keyword, that is, one query keyword can recall multiple target entity nodes from the knowledge graph. For example, refer to Figure 4 , the query keyword “gout” can recall entity node 401 , entity node 402 and entity node 403 .
[0063] To sum up, the technical solution provided in the embodiment of the present application recalls the target entity node based on the similarity between the representation vector of the query keyword and the representation vector of the keyword corresponding to each entity node in the knowledge graph of the target field, and then obtains knowledge information based on the target entity node, thereby realizing the recall of entity nodes in the knowledge graph from a semantic level and improving the recall rate of entity nodes (i.e., keywords).
[0064] In addition, the Faiss method is used to achieve fast similarity matching between vectors without the need to traverse all entity nodes in the knowledge graph, which reduces the similarity matching time and improves the recall efficiency of entity nodes.
[0065] The above describes the recall method of entity nodes. The following describes how to acquire knowledge information based on the recalled entity nodes:
[0066] Please refer to Figure 5 , which shows a flow chart of an information acquisition method provided by another embodiment of the present application. The execution subject of each step of the method can be the computer device introduced above. The method may include the following steps (501-504):
[0067] Step 501: Obtain query keywords in query information.
[0068] Step 502: Encode the query keyword to obtain a representation vector corresponding to the query keyword.
[0069] Step 503: Based on the representation vector corresponding to the query keyword, a target representation vector is selected from the representation vector set; wherein the representation vector set includes the representation vectors of the keywords corresponding to each entity node in the knowledge graph of the target domain, and the target representation vector refers to a representation vector in the representation vector set whose similarity with the representation vector corresponding to the query keyword meets the first condition.
[0070] Steps 501 to 503 are the same as those described in the above embodiment and will not be repeated here.
[0071] Step 504: Based on the target entity node corresponding to the target representation vector, obtain the knowledge information corresponding to the query information from the knowledge graph of the target domain.
[0072] Optionally, after recalling the entity nodes, knowledge information corresponding to the query information can be extracted from the knowledge graph based on the recalled entity nodes. The specific method of extracting the knowledge information can be as follows: obtaining the center point label information corresponding to each target entity node, the center point label information includes the associated entity nodes directly or indirectly connected to the target entity node in the knowledge graph of the target domain, and the minimum distance between the associated entity nodes and the target entity node; dividing each target entity node to obtain at least one candidate entity node set, the candidate entity set includes at least one target entity node corresponding to each target representation vector; based on the center point label information corresponding to each target entity node in the candidate entity node set, determining the target node tree corresponding to the candidate entity node set, the target node tree refers to the node tree with the smallest path weight in the node tree composed of each target entity node in the candidate entity node set; taking the node tree with the smallest path weight in the target node tree corresponding to at least one candidate entity node set as the final node tree; and obtaining the knowledge information corresponding to the query information from the knowledge graph of the target domain based on the final node tree.
[0073] Among them, the center point label information can be obtained through the HL (Hub Labeling) method. The HL method is a query method that can greatly reduce resource loss and quickly complete the shortest distance between two entity nodes on the knowledge graph. The HL method can add an "accessible entity node (i.e., associated entity node) list" to all entity nodes in the knowledge graph, and give the shortest access distance from each entity node in the "accessible entity node list" to the corresponding entity node. In an embodiment of the present application, the static knowledge graph can be statically pre-processed by the HL method, that is, the "accessible entity node list" of each entity node will no longer change. Since the static knowledge graph can be pre-processed by the HL method to obtain the center point label information of each entity node, when performing a static knowledge graph keyword search, the computing time and computing resource loss can be greatly reduced while ensuring the search quality.
[0074] In an exemplary embodiment, the process of obtaining the candidate entity node set can be as follows: recall entity node 1 and entity node 2 based on query keyword A, recall entity node 3 and entity node 4 based on query keyword B, and recall entity node 5 based on query keyword C. The candidate entity node set can include a set consisting of entity node 1, entity node 3 and entity node 5, a set consisting of entity node 1, entity node 4 and entity node 5, a set consisting of entity node 2, entity node 3 and entity node 5, a set consisting of entity node 2, entity node 4 and entity node 5, and the like.
[0075] In one example, the process of obtaining the target node tree may be as follows:
[0076] 1. Obtain at least one candidate node tree corresponding to each target entity node in the candidate entity node set. The candidate node tree refers to a node tree formed by connecting the remaining target entity nodes in the candidate entity node set with the target entity node as the starting point; wherein the node tree includes entity nodes and point-edge relationships between entity nodes.
[0077] For example, take the set consisting of entity node 1, entity node 3, and entity node 5 as an example. The candidate node tree corresponding to entity node 1 may include the path from entity node 1 to entity node 3 (including other entity nodes passed by the path and the point-edge relationship between entity nodes), the path from entity node 1 to entity node 5, entity node 1, entity node 3, and entity node 5. Among them, entity node 1 is the root of the candidate node tree. Optionally, since there are multiple possible paths from entity node 1 to entity node 3 and multiple possible paths from entity node 1 to entity node 5, different possible combinations form candidate node trees of different forms.
[0078] 2. Based on the center point label information corresponding to each target entity node, determine the minimum path weight corresponding to the candidate node tree.
[0079] Optionally, the method for obtaining the minimum path weight can be as follows: based on the center point label information corresponding to each target entity node, determine the minimum path from the starting point entity node corresponding to the candidate node tree to the remaining target entity nodes in the candidate entity node set, where the starting point entity node refers to the root of the candidate node tree; based on the weight of the minimum path from the starting point entity node corresponding to the candidate node tree to the remaining target entity nodes in the candidate entity node set, determine the minimum path weight corresponding to the candidate node tree.
[0080] For example, let's take entity node 1 as the starting entity node. The minimum path from entity node 1 to entity node 3 and the minimum path from entity node 1 to entity node 5 are obtained. The sum of the path weights corresponding to the two minimum paths is used as the minimum path weight corresponding to the candidate node tree with entity node 1 as the starting entity node. Then, the minimum path weights corresponding to the candidate node trees with the remaining target entity nodes in the candidate entity node set as the starting entity node are obtained.
[0081] In one example, the minimum path between target entity nodes can be obtained as follows: based on the center point label information of the starting entity node and the first target entity node, determine the minimum distance between the starting entity node and the first target entity node; obtain the target public entity node corresponding to the minimum distance, where the target public entity node refers to the entity node corresponding to the minimum distance and the center point label information of both the starting entity node and the first target entity node; obtain the first minimum path from the starting entity node to the target public entity node, and the second minimum path from the first target entity node to the target public entity node; based on the first minimum path and the second minimum path, determine the minimum path from the starting entity node to the first target entity node.
[0082] The public entity node may be an intermediate public entity node corresponding to the minimum distance between the starting entity node and the first target entity node.
[0083] Exemplarily, take obtaining the minimum path from the above-mentioned entity node 1 to the above-mentioned entity node 5 as an example. Based on the central label information of entity node 1 and entity node 5, determine whether entity node 1 can access entity node 5. If entity node 1 cannot access entity node 5, it is determined that the distance between entity node 1 and entity node 5 is infinite. If entity node 1 can access entity node 5, obtain the minimum distance between entity node 1 and entity node 5. Select the intermediate public entity node corresponding to the minimum distance between entity node 1 and entity node 5, and then obtain the entity node and point-edge relationship corresponding to the minimum distance between entity node 1 and the intermediate public entity node, and then generate the minimum path from entity node 1 to the intermediate public entity node. Similarly, obtain the minimum path from entity node 5 to the intermediate public entity node, and determine the combination of the two minimum paths as the minimum path from entity node 1 to entity node 5.
[0084] 3. The candidate node tree with the smallest path weight among the minimum path weights corresponding to at least one candidate node tree is used as the target node tree corresponding to the candidate entity node set.
[0085] Finally, the knowledge information corresponding to each entity node in the final node tree and the point-edge relationship between each entity node are combined into the knowledge information corresponding to the query information. Figure 4 , the final node tree includes entity node 401, entity node 402, entity node 403, entity node 404, the point-edge relationship between entity node 401 and entity node 404, the point-edge relationship between entity node 404 and entity node 403, and the point-edge relationship between entity node 403 and entity node 402. The knowledge information corresponding to the query keyword "gout" is "the complications of gout include femoral head necrosis, gout includes primary gout, which can be treated by tophi resection."
[0086] To sum up, the technical solution provided in the embodiment of the present application recalls the target entity node based on the similarity between the representation vector of the query keyword and the representation vector of the keyword corresponding to each entity node in the knowledge graph of the target field, and then obtains knowledge information based on the target entity node, thereby realizing the recall of entity nodes in the knowledge graph from a semantic level and improving the recall rate of entity nodes (i.e., keywords).
[0087] Furthermore, the HL method enables rapid acquisition of the minimum distance between entity nodes, thereby improving the efficiency of acquiring the minimum path between entity nodes and, in turn, the efficiency of acquiring the final node tree. Furthermore, since the HL method can be used to pre-process the static knowledge graph to obtain the center point label information of each entity node, when performing keyword searches on the static knowledge graph, computing time and resource consumption can be greatly reduced while ensuring search quality.
[0088] In an exemplary embodiment, taking the medical knowledge graph as an example, the process of acquiring knowledge information is introduced:
[0089] refer to Figure 6 Medical knowledge graph 601 includes 9 entity nodes and 11 edge-to-edge relationships. The value next to the edge-to-edge relationship is the weight of the edge-to-edge relationship. The query keywords "COVID-19" and "Kaofuting" are obtained and encoded using the keyword encoding model to obtain the corresponding representation vectors for the query keywords "COVID-19" and "Kaofuting". The Faiss method is used to perform cosine similarity matching between the representation vectors of "COVID-19" and "Kaofuting" and the representation vectors of the corresponding representation vector set of medical knowledge graph 601, obtaining entity nodes 602 and 603.
[0090] The candidate node trees from entity node 602 to entity node 603 are: A: entity node 602-entity node 605-entity node 606-entity node 603, B: entity node 602-entity node 605-entity node 606-entity node 604-entity node 603, C: entity node 602-entity node 606-entity node 603, D: entity node 602-entity node 606-entity node 604-entity node 603, E: entity node 602-entity node 604-entity node 603, F: entity node 602-entity node 604-entity node 606-entity node 603.
[0091] Among them, the path weight of A is 2.8, the path weight of B is 3.1, the path weight of C is 0.9, the path weight of D is 1.2, the path weight of E is 1.3, and the path weight of F is 1.2. Then C can be used as the final node tree. The knowledge information corresponding to the final node tree can be "COVID-19 is a lung disease, and the drug for lung disease treatment can be Corfortin."
[0092] To sum up, the technical solution provided in the embodiment of the present application recalls the target entity node based on the similarity between the representation vector of the query keyword and the representation vector of the keyword corresponding to each entity node in the knowledge graph of the target field, and then obtains knowledge information based on the target entity node, thereby realizing the recall of entity nodes in the knowledge graph from a semantic level and improving the recall rate of entity nodes (i.e., keywords).
[0093] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0094] Please refer to Figure 7 , which shows a block diagram of an information acquisition device provided by one embodiment of the present application. The device has the functionality to implement the aforementioned method examples, which can be implemented by hardware or by hardware executing corresponding software. The device can be a computer device or can be provided within a computer device. The device 700 may include: a keyword acquisition module 701, a keyword encoding module 702, a target vector acquisition module 703, and a knowledge information acquisition module 704.
[0095] The keyword acquisition module 701 is used to acquire query keywords in the query information.
[0096] The keyword encoding module 702 is configured to encode the query keyword to obtain a representation vector corresponding to the query keyword.
[0097] The target vector acquisition module 703 is used to select a target representation vector from a representation vector set based on the representation vector corresponding to the query keyword; wherein the representation vector set includes the representation vectors of the keywords corresponding to each entity node in the knowledge graph of the target domain, and the target representation vector refers to a representation vector in the representation vector set whose similarity with the representation vector corresponding to the query keyword meets a first condition.
[0098] The knowledge information acquisition module 704 is configured to acquire the knowledge information corresponding to the query information from the knowledge graph of the target domain based on the target entity node corresponding to the target representation vector.
[0099] In an exemplary embodiment, the keyword encoding module 702 is configured to:
[0100] Invoking a keyword encoding model, wherein the keyword encoding model is a model trained with text corpus in the target domain;
[0101] The query keyword is encoded using the keyword encoding model to obtain a representation vector corresponding to the query keyword.
[0102] In an exemplary embodiment, the keyword encoding model is trained as follows:
[0103] Obtaining a corpus sample of the target domain;
[0104] Performing keyword hiding processing on the corpus sample to obtain a hidden corpus sample and hidden keywords;
[0105] Encoding the hidden corpus sample using the keyword encoding model to obtain an output representation vector;
[0106] Obtaining predicted keywords based on the output representation vector;
[0107] Obtaining a training loss of the keyword encoding model based on the predicted keyword and the hidden keyword;
[0108] The keyword encoding model is trained based on the training loss.
[0109] In an exemplary embodiment, the keyword encoding module 702 is further configured to:
[0110] The keywords corresponding to each entity node in the knowledge graph of the target domain are encoded using a keyword encoding model to obtain the representation vector set.
[0111] In an exemplary embodiment, the target vector acquisition module 703 is configured to:
[0112] performing clustering processing on the representation vectors in the representation vector set to obtain a plurality of cluster vector combinations and cluster center vectors corresponding to each of the plurality of cluster vector combinations;
[0113] Determining a target cluster center vector based on the distance between the representation vector corresponding to the query keyword and the cluster center vectors corresponding to each of the multiple cluster vector combinations; wherein the target cluster center vector refers to a cluster center vector among the cluster center vectors corresponding to each of the multiple cluster vector combinations, the distance between the target cluster center vector and the representation vector corresponding to the query keyword meeting the second condition;
[0114] A representation vector in the combination of cluster vectors corresponding to the target cluster center vectors, whose similarity with the representation vector corresponding to the query keyword meets the first condition, is determined as the target representation vector.
[0115] In an exemplary embodiment, the knowledge information acquisition module 704 is configured to:
[0116] Obtaining center point label information corresponding to each target entity node, the center point label information including associated entity nodes directly or indirectly connected to the target entity node in the knowledge graph of the target domain, and the minimum distance between the associated entity node and the target entity node;
[0117] Performing a division process on each of the target entity nodes to obtain at least one candidate entity node set, wherein the candidate entity set includes at least one target entity node corresponding to each of the target representation vectors;
[0118] Determine, based on the center point label information corresponding to each target entity node in the candidate entity node set, a target node tree corresponding to the candidate entity node set, wherein the target node tree refers to a node tree with the smallest path weight in the node tree composed of each target entity node in the candidate entity node set;
[0119] Taking the node tree with the smallest path weight in the target node tree corresponding to each of the at least one candidate entity node set as the final node tree;
[0120] Based on the final node tree, knowledge information corresponding to the query information is obtained from the knowledge graph of the target domain.
[0121] In an exemplary embodiment, the knowledge information acquisition module 704 is further configured to:
[0122] Obtain at least one candidate node tree corresponding to each target entity node in the candidate entity node set, where the candidate node tree is a node tree formed by connecting the remaining target entity nodes in the candidate entity node set with the target entity node as a starting point;
[0123] Determine the minimum path weight corresponding to the candidate node tree based on the center point label information corresponding to each target entity node;
[0124] The candidate node tree with the smallest path weight among the minimum path weights corresponding to the at least one candidate node tree is used as the target node tree corresponding to the candidate entity node set.
[0125] In an exemplary embodiment, the knowledge information acquisition module 704 is further configured to:
[0126] Based on the center point label information corresponding to each of the target entity nodes, determining the minimum path from the starting entity node corresponding to the candidate node tree to the remaining target entity nodes in the candidate entity node set, where the starting entity node is the root of the candidate node tree;
[0127] The minimum path weight corresponding to the candidate node tree is determined based on the weights of the minimum paths from the starting entity nodes corresponding to the candidate node tree to the remaining target entity nodes in the candidate entity node set.
[0128] In an exemplary embodiment, the knowledge information acquisition module 704 is further configured to:
[0129] Determining a minimum distance between the starting point entity node and the first target entity node based on center point label information of the starting point entity node and the first target entity node;
[0130] Acquire a target public entity node corresponding to the minimum distance, where the target public entity node refers to an entity node corresponding to the minimum distance that has both center point label information of the starting point entity node and center point label information of the first target entity node;
[0131] Acquire a first minimum path from the starting entity node to the target public entity node, and a second minimum path from the first target entity node to the target public entity node;
[0132] Based on the first minimum path and the second minimum path, a minimum path from the starting entity node to the first target entity node is determined.
[0133] To sum up, the technical solution provided in the embodiment of the present application recalls the target entity node based on the similarity between the representation vector of the query keyword and the representation vector of the keyword corresponding to each entity node in the knowledge graph of the target field, and then obtains knowledge information based on the target entity node, thereby realizing the recall of entity nodes in the knowledge graph from a semantic level and improving the recall rate of entity nodes (i.e., keywords).
[0134] It should be noted that the apparatus provided in the above embodiments, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the content structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0135] Please refer to Figure 8, which shows a block diagram of the structure of a computer device provided in one embodiment of the present application. The computer device can be used to implement the information acquisition method provided in the above embodiment. Specifically:
[0136] The computer device 800 includes a central processing unit (CPU, central processing unit), GPU (graphics processing unit), and FPGA (field programmable gate array) 801, a system memory 804 including RAM (random-access memory) 802 and ROM (read-only memory) 803, and a system bus 805 connecting the system memory 804 and the central processing unit 801. The computer device 800 also includes a basic input / output system (I / O system) 806 that facilitates information transmission between various components within the server, and a mass storage device 807 for storing an operating system 813, application programs 814, and other program modules 815.
[0137] The basic input / output system 806 includes a display 808 for displaying information and an input device 809 such as a mouse and a keyboard for user input. Both the display 808 and the input device 809 are connected to the central processing unit 801 via an input / output controller 810 connected to the system bus 805. The basic input / output system 806 may also include an input / output controller 810 for receiving and processing input from a variety of other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 810 also provides output to a display screen, printer, or other types of output devices.
[0138] The mass storage device 807 is connected to the central processing unit 801 via a mass storage controller (not shown) connected to the system bus 805. The mass storage device 807 and its associated computer-readable medium provide non-volatile storage for the computer device 800. In other words, the mass storage device 807 may include a computer-readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0139] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, tape cassettes, magnetic tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above-mentioned ones. The above-mentioned system memory 804 and mass storage device 807 can be collectively referred to as memory.
[0140] According to an embodiment of the present application, the computer device 800 can also be connected to a remote computer on a network such as the Internet for operation. That is, the computer device 800 can be connected to the network 812 via the network interface unit 811 connected to the system bus 805. Alternatively, the network interface unit 811 can be used to connect to other types of networks or remote computer systems (not shown).
[0141] The memory further includes a computer program, which is stored in the memory and configured to be executed by one or more processors to implement the above-mentioned information acquisition method.
[0142] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one instruction, at least one program, a code set or an instruction set is stored. When the at least one instruction, the at least one program, the code set or the instruction set is executed by a processor, the above-mentioned information acquisition method is implemented.
[0143] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0144] In an exemplary embodiment, a computer program product or computer program is further provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described information acquisition method.
[0145] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application do not limit this.
[0146] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0147] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for obtaining information, characterized in that: The method comprises: Obtaining at least one query keyword in the query information; For any query keyword among the at least one query keyword, encoding the query keyword to obtain a representation vector corresponding to the query keyword; Based on the representation vector corresponding to the query keyword, a target representation vector is selected from a representation vector set; wherein the representation vector set includes the representation vectors of the keywords corresponding to each entity node in the knowledge graph of the target domain, and the target representation vector refers to a representation vector in the representation vector set whose similarity with the representation vector corresponding to the query keyword meets a first condition, and the target representation vector of each query keyword is used to recall at least one target entity node from the knowledge graph; Obtaining center point label information corresponding to each target entity node, the center point label information including associated entity nodes directly or indirectly connected to the target entity node in the knowledge graph, and the minimum distance between the associated entity nodes and the target entity node, the center point label information being pre-processed for the knowledge graph; performing a division process on each of the target entity nodes to obtain at least one candidate entity node set, wherein when the query information includes at least two query keywords, each of the target entity nodes is divided into at least one candidate entity node set, each candidate entity node set including at least one target entity node corresponding to each of the target representation vectors, and when the query information includes one query keyword, each of the target entity nodes is divided into one candidate entity node set; Determine, based on the center point label information corresponding to each target entity node in the candidate entity node set, a target node tree corresponding to the candidate entity node set, wherein the target node tree refers to a node tree with the smallest path weight in the node tree composed of each target entity node in the candidate entity node set; Taking the node tree with the smallest path weight in the target node tree of each of the at least one candidate entity node set as the final node tree; Based on the final node tree, knowledge information corresponding to the query information is obtained from the knowledge graph.
2. The method according to claim 1, characterized in that The encoding process of the query keyword to obtain a representation vector corresponding to the query keyword includes: Invoking a keyword encoding model, wherein the keyword encoding model is a model trained with text corpus in the target domain; The query keyword is encoded using the keyword encoding model to obtain a representation vector corresponding to the query keyword.
3. The method according to claim 2, characterized in that The training method of the keyword encoding model is as follows: Obtaining a corpus sample of the target domain; Performing keyword hiding processing on the corpus sample to obtain a hidden corpus sample and hidden keywords; Encoding the hidden corpus sample using the keyword encoding model to obtain an output representation vector; Obtaining predicted keywords based on the output representation vector; Obtaining a training loss of the keyword encoding model based on the predicted keyword and the hidden keyword; The keyword encoding model is trained based on the training loss.
4. The method according to claim 1, wherein The method further comprises: The keywords corresponding to each entity node in the knowledge graph of the target domain are encoded using a keyword encoding model to obtain the representation vector set.
5. The method according to claim 1, wherein The selecting a target representation vector from a representation vector set based on the representation vector corresponding to the query keyword includes: performing clustering processing on the representation vectors in the representation vector set to obtain a plurality of cluster vector combinations and cluster center vectors corresponding to each of the plurality of cluster vector combinations; Determining a target cluster center vector based on the distance between the representation vector corresponding to the query keyword and the cluster center vectors corresponding to each of the multiple cluster vector combinations; wherein the target cluster center vector refers to a cluster center vector among the cluster center vectors corresponding to each of the multiple cluster vector combinations, the distance between the target cluster center vector and the representation vector corresponding to the query keyword meeting the second condition; A representation vector in the cluster vector combination corresponding to the target cluster center vector, whose similarity with the representation vector corresponding to the query keyword meets the first condition, is determined as the target representation vector.
6. The method according to any one of claims 1 to 5, characterized in that The determining the target node tree corresponding to the candidate entity node set based on the center point label information corresponding to each target entity node in the candidate entity node set includes: Obtain at least one candidate node tree corresponding to each target entity node in the candidate entity node set, where the candidate node tree is a node tree formed by connecting the remaining target entity nodes in the candidate entity node set with the target entity node as a starting point; Determine the minimum path weight corresponding to the candidate node tree based on the center point label information corresponding to each target entity node; The candidate node tree with the smallest path weight among the minimum path weights corresponding to the at least one candidate node tree is used as the target node tree corresponding to the candidate entity node set.
7. The method according to claim 6, characterized in that The determining, based on the center point label information corresponding to each of the target entity nodes, the minimum path weight corresponding to the candidate node tree includes: Based on the center point label information corresponding to each of the target entity nodes, determining the minimum path from the starting entity node corresponding to the candidate node tree to the remaining target entity nodes in the candidate entity node set, where the starting entity node is the root of the candidate node tree; The minimum path weight corresponding to the candidate node tree is determined based on the weights of the minimum paths from the starting entity nodes corresponding to the candidate node tree to the remaining target entity nodes in the candidate entity node set.
8. The method according to claim 7, characterized in that The determining, based on the center point label information corresponding to each of the target entity nodes, of the minimum paths from the starting entity nodes corresponding to the candidate node tree to the remaining target entity nodes in the candidate entity node set includes: Determining a minimum distance between the starting point entity node and the first target entity node based on center point label information of the starting point entity node and the first target entity node; Acquire a target public entity node corresponding to the minimum distance, where the target public entity node refers to an entity node corresponding to the minimum distance that has both center point label information of the starting point entity node and center point label information of the first target entity node; Acquire a first minimum path from the starting entity node to the target public entity node, and a second minimum path from the first target entity node to the target public entity node; Based on the first minimum path and the second minimum path, a minimum path from the starting entity node to the first target entity node is determined.
9. An information acquisition device, characterized in that: The device comprises: A keyword acquisition module, configured to acquire at least one query keyword from the query information; a keyword encoding module, configured to encode any query keyword among the at least one query keyword to obtain a representation vector corresponding to the query keyword; a target vector acquisition module, configured to select a target representation vector from a representation vector set based on the representation vector corresponding to the query keyword; wherein the representation vector set includes the representation vectors of the keywords corresponding to each entity node in the knowledge graph of the target domain, the target representation vector refers to a representation vector in the representation vector set whose similarity with the representation vector corresponding to the query keyword satisfies a first condition, and the target representation vector of each query keyword is used to recall at least one target entity node from the knowledge graph; The knowledge information acquisition module is used to obtain the center point label information corresponding to each of the target entity nodes, the center point label information includes the associated entity nodes directly or indirectly connected to the target entity node in the knowledge graph, and the minimum distance from the associated entity node to the target entity node. The center point label information is obtained by pre-processing the knowledge graph; each of the target entity nodes is divided into at least one candidate entity node set. When the query information includes at least two query keywords, each of the target entity nodes is divided into at least one candidate entity node set. The candidate entity node set includes the corresponding vectors of each target representation vector. at least one of the target entity nodes, when the query information includes a query keyword, each of the target entity nodes is divided into a set of candidate entity nodes; based on the center point label information corresponding to each of the target entity nodes in the candidate entity node set, the target node tree corresponding to the candidate entity node set is determined, and the target node tree refers to the node tree with the smallest path weight in the node tree composed of each of the target entity nodes in the candidate entity node set; the node tree with the smallest path weight in the target node tree of each of the at least one candidate entity node set is used as the final node tree; based on the final node tree, the knowledge information corresponding to the query information is obtained from the knowledge graph.
10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the information acquisition method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the information acquisition method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor reads and executes the computer instructions from the computer-readable storage medium to implement the information acquisition method according to any one of claims 1 to 8.
Citation Information
Patent Citations
A method and a device for carrying out sentiment classification on a text, a terminal
CN109726391A
Query feedback method and device, computer equipment and storage medium
CN111538894A
Knowledge reasoning method and system based on knowledge graph path analysis
CN111898760A