Information retrieval knowledge graph embedding method, device and computer equipment
Through subgraph sampling and image-text conversion strategies, combined with text encoding and decoding technology, the entity and relationship vectors of the information retrieval knowledge graph are updated, which solves the problem of low vector accuracy in existing methods and improves the effect of information retrieval tasks.
Patent Information
- Application Number
- CN202310766394.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2043-06-27
AI Technical Summary
Existing information retrieval knowledge graph embedding methods mainly analyze graph structure information, resulting in low accuracy of generated entity vectors and relationship vectors.
The subgraph information of the information retrieval knowledge graph is obtained through the subgraph sampling algorithm, and the image-text conversion strategy is used to convert the subgraph information into a text sequence. It is encoded and decoded through the text encoder and the relationship graph decoder, and the entities are updated based on the graph structure information. and relationship vectors to generate more accurate vector representations.
It improves the accuracy of entity and relationship vectors in the information retrieval knowledge graph and improves the effect of information retrieval tasks.
Smart Images

Figure CN116842109B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an information retrieval knowledge graph embedding method, apparatus and computer equipment. Background Art
[0002] In recent years, the rapid development of artificial intelligence and big data technology has spawned domain knowledge graphs in various industries. Among them, the application demand for knowledge graphs in the field of information retrieval is increasing. Researchers hope to empower actual application systems by building information retrieval knowledge graphs with the help of the prior knowledge contained therein. However, the information retrieval knowledge graph contains a large amount of graph structure information and text information, which makes it impossible to directly apply the information retrieval knowledge graph to confirm the retrieval task during the information retrieval process. Therefore, it is necessary to embed the information retrieval knowledge graph in the field of information retrieval into a knowledge graph to improve the confirmation accuracy of the retrieval task. The knowledge graph embedding task refers to generating accurate vector representations for entities and relationships in the knowledge graph to empower downstream tasks and improve the effectiveness of downstream tasks.
[0003] Existing research on embedding information retrieval knowledge graphs mainly uses graph structure information to identify the semantic information of the information retrieval knowledge graph, and based on the semantic information, generates entity and relationship vectors of the information retrieval knowledge graph. However, through the above technical solution, only the graph structure information of the information retrieval knowledge graph is analyzed, resulting in low accuracy of the entity vectors and relationship vectors generated for the information retrieval knowledge graph. Summary of the invention
[0004] Based on this, it is necessary to provide an information retrieval knowledge graph embedding method, device, computer equipment, computer-readable storage medium and computer program product to address the above technical problems.
[0005] In a first aspect, the present application provides a method for embedding an information retrieval knowledge graph. The method comprises:
[0006] Obtaining an information retrieval knowledge graph, and collecting information of each subgraph of the information retrieval knowledge graph through a subgraph sampling algorithm;
[0007] By means of a graph-text conversion strategy, each of the sub-graph information is converted into a text sequence corresponding to each of the sub-graph information, and each of the text sequences is subjected to encoding conversion processing by means of a text encoder to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector of each text sequence;
[0008] For each text sequence, based on the graph structure information of the subgraph information corresponding to the text sequence, the masked entity vector of the text sequence and the masked relationship vector of the text sequence are updated through a relationship graph decoder, and the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence are reconstructed to obtain the entity vectors corresponding to the information retrieval knowledge graph and the relationship vectors corresponding to the information retrieval knowledge graph.
[0009] Optionally, the collecting of each subgraph information of the sample information retrieval knowledge graph includes:
[0010] Acquire multiple entity nodes of the information retrieval knowledge graph, and traverse the information retrieval knowledge graph through a subgraph sampling algorithm to obtain path information corresponding to each entity node;
[0011] The intersection points of the path information intersecting with each other are taken as the central entity, and the central entity and the path information intersecting with the central entity are taken as subgraph information.
[0012] Optionally, the entity node includes text information, and the image-text conversion strategy is used to convert each sub-graph information into a text sequence corresponding to each sub-graph information, including:
[0013] For each subgraph information, path information contained in the subgraph information is identified, and for each path information, subtext sequence information corresponding to the path information is generated based on text information of each entity node contained in the path information;
[0014] Based on the central entity of the sub-graph information, the sub-text sequence information corresponding to each path information of the sub-graph information is spliced through a text splicing strategy to obtain a text sequence corresponding to the sub-graph information.
[0015] Optionally, the text encoder includes an entity masking sub-encoder and a relationship masking sub-encoder, and the text encoder performs encoding conversion processing on each of the text sequences to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector of each text sequence, including:
[0016] For each text sequence, the entity masking sub-encoder is used to perform entity masking reconstruction processing on the text sequence to obtain a masked entity vector corresponding to the text sequence, and the relationship masking sub-encoder is used to perform relationship masking reconstruction processing on the text sequence to obtain a masked relationship vector corresponding to the text sequence.
[0017] Optionally, the updating of the masked entity vector of the text sequence and the masked relationship vector of the text sequence by using a relationship graph decoder based on the graph structure information of the subgraph information corresponding to the text sequence includes:
[0018] Based on the graph structure information of the subgraph information corresponding to the text sequence, determine the subgraph structure information of each entity node of the text sequence, and perform pooling processing on the subgraph structure information of each entity node to obtain a graph structure vector of each entity node;
[0019] For each entity node of the text sequence, a sub-masked entity vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked entity vector of the entity node, and a sub-masked relationship vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked relationship vector of the entity node;
[0020] The graph convolutional neural network of the relationship graph decoder is used to convolve the subgraph structure masked entity vector of the entity node and the subgraph structure masked relationship vector of the entity node, respectively, to obtain an updated sub-masked entity vector of the entity node and an updated sub-masked relationship vector of the entity node, and the masked entity vector containing the updated sub-masked entity vectors of all entity nodes is used as the updated masked entity vector of the text sequence, and the masked relationship vector containing the updated sub-masked relationship vectors of all entity nodes is used as the updated masked relationship vector of the text sequence.
[0021] Optionally, reconstructing the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence to obtain each entity vector corresponding to the information retrieval knowledge graph and each relationship vector corresponding to the information retrieval knowledge graph includes:
[0022] Identify a first masked vector in the updated masked entity vector of the text sequence and a second masked vector in the updated masked relationship vector of the text sequence, and reconstruct the first masked vector through a linear layer of the relationship graph decoder to obtain an entity vector corresponding to the text sequence, and reconstruct the second masked vector through the linear layer to obtain a relationship vector corresponding to the text sequence;
[0023] The entity vectors of the text sequences corresponding to all subgraph information of the information retrieval knowledge graph are used as the entity vectors corresponding to the information retrieval knowledge graph, and the relationship vectors of the text sequences corresponding to all subgraph information of the information retrieval knowledge graph are used as the relationship vectors of the information retrieval knowledge graph.
[0024] In a second aspect, the present application also provides an information retrieval knowledge graph embedding device. The device comprises:
[0025] An acquisition module is used to acquire an information retrieval knowledge graph and collect information of each subgraph of the information retrieval knowledge graph through a subgraph sampling algorithm;
[0026] An encoding module, used to convert each of the sub-image information into a text sequence corresponding to each of the sub-image information through an image-text conversion strategy, and perform encoding conversion processing on each of the text sequences through a text encoder to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector of each text sequence;
[0027] A generation module is used to update the masked entity vector of the text sequence and the masked relationship vector of the text sequence for each text sequence based on the graph structure information of the subgraph information corresponding to the text sequence through a relationship graph decoder, and reconstruct the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence to obtain the entity vectors corresponding to the information retrieval knowledge graph and the relationship vectors corresponding to the information retrieval knowledge graph.
[0028] Optionally, the acquisition module is specifically used to:
[0029] Acquire multiple entity nodes of the information retrieval knowledge graph, and traverse the information retrieval knowledge graph through a subgraph sampling algorithm to obtain path information corresponding to each entity node;
[0030] The intersection points of the path information intersecting with each other are taken as the central entity, and the central entity and the path information intersecting with the central entity are taken as subgraph information.
[0031] Optionally, the encoding module is specifically used to:
[0032] For each subgraph information, path information contained in the subgraph information is identified, and for each path information, subtext sequence information corresponding to the path information is generated based on text information of each entity node contained in the path information;
[0033] Based on the central entity of the sub-graph information, the sub-text sequence information corresponding to each path information of the sub-graph information is spliced through a text splicing strategy to obtain a text sequence corresponding to the sub-graph information.
[0034] Optionally, the encoding module is specifically used to:
[0035] For each text sequence, the entity masking sub-encoder is used to perform entity masking reconstruction processing on the text sequence to obtain a masked entity vector corresponding to the text sequence, and the relationship masking sub-encoder is used to perform relationship masking reconstruction processing on the text sequence to obtain a masked relationship vector corresponding to the text sequence.
[0036] Optionally, the generating module is specifically used for:
[0037] Based on the graph structure information of the subgraph information corresponding to the text sequence, determine the subgraph structure information of each entity node of the text sequence, and perform pooling processing on the subgraph structure information of each entity node to obtain a graph structure vector of each entity node;
[0038] For each entity node of the text sequence, a sub-masked entity vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked entity vector of the entity node, and a sub-masked relationship vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked relationship vector of the entity node;
[0039] The graph convolutional neural network of the relationship graph decoder is used to convolve the subgraph structure masked entity vector of the entity node and the subgraph structure masked relationship vector of the entity node, respectively, to obtain an updated sub-masked entity vector of the entity node and an updated sub-masked relationship vector of the entity node, and the masked entity vector containing the updated sub-masked entity vectors of all entity nodes is used as the updated masked entity vector of the text sequence, and the masked relationship vector containing the updated sub-masked relationship vectors of all entity nodes is used as the updated masked relationship vector of the text sequence.
[0040] Optionally, the generating module is specifically used for:
[0041] Identify a first masked vector in the updated masked entity vector of the text sequence and a second masked vector in the updated masked relationship vector of the text sequence, and reconstruct the first masked vector through a linear layer of the relationship graph decoder to obtain an entity vector corresponding to the text sequence, and reconstruct the second masked vector through the linear layer to obtain a relationship vector corresponding to the text sequence;
[0042] The entity vectors of the text sequences corresponding to all subgraph information of the information retrieval knowledge graph are used as the entity vectors corresponding to the information retrieval knowledge graph, and the relationship vectors of the text sequences corresponding to all subgraph information of the information retrieval knowledge graph are used as the relationship vectors of the information retrieval knowledge graph.
[0043] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any one of the methods in the first aspect are implemented.
[0044] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0045] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0046] The above-mentioned information retrieval knowledge graph embedding method, device, computer equipment, storage medium and computer program product obtain an information retrieval knowledge graph and collect the subgraph information of the information retrieval knowledge graph through a subgraph sampling algorithm; through a graph-text conversion strategy, convert each subgraph information into a text sequence corresponding to each subgraph information, and perform encoding conversion processing on each text sequence through a text encoder to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector of each text sequence; for each text sequence, based on the graph structure information of the subgraph information corresponding to the text sequence, update the masked entity vector of the text sequence and the masked relationship vector of the text sequence through a relationship graph decoder, and reconstruct the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence to obtain each entity vector corresponding to the information retrieval knowledge graph and each relationship vector corresponding to the information retrieval knowledge graph. The information retrieval knowledge graph is divided into multiple sub-graph information through the sub-graph conversion algorithm, which improves the analysis accuracy of different parts of the information retrieval knowledge graph. Then, the text sequence corresponding to each sub-graph information of the information retrieval knowledge graph is extracted through the image-text conversion strategy, and the text information corresponding to each sub-graph information is determined. Then, the text encoder encodes the masked entity vector and masked relationship vector corresponding to each text sequence, and the masked entity vector and masked relationship vector of each text sequence are fused with the graph structure information of the sub-graph information through the relationship graph decoder. Finally, the text sequence is decoded to obtain the entity vectors corresponding to the information retrieval knowledge graph. Not only is the information retrieval knowledge graph divided into multiple sub-graph information for accurate determination, but also for each sub-graph information, the entity vector and structure vector corresponding to the sub-graph information are analyzed in combination with the graph structure information and text information of the sub-graph information, thereby improving the accuracy of generating the entity vector and relationship vector of the information retrieval knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic diagram of a process of embedding a method for information retrieval knowledge graph in one embodiment;
[0048] Figure 2 A schematic diagram of a process of embedding an example of information retrieval knowledge graph in one embodiment;
[0049] Figure 3 It is a structural block diagram of an information retrieval knowledge graph embedding device in one embodiment;
[0050] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0052] The information retrieval knowledge graph embedding method provided in the embodiment of the present application can be applied to a terminal, a server, or a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, etc. The server can be implemented with an independent server or a server cluster consisting of multiple servers. Among them, the terminal divides the information retrieval knowledge graph into multiple sub-graph information through a sub-graph conversion algorithm, thereby improving the analysis accuracy of different parts of the information retrieval knowledge graph, and then extracts the text sequence corresponding to each sub-graph information of the information retrieval knowledge graph through a graph-text conversion strategy, and determines the text information corresponding to each sub-graph information. Then, the text encoder encodes the masked entity vector and masked relationship vector corresponding to each text sequence, and through a relationship graph decoder, fuses the masked entity vector and masked relationship vector of each text sequence with the graph structure information of the sub-graph information. Finally, the text sequence is decoded to obtain the entity vectors corresponding to the information retrieval knowledge graph. Not only is the information retrieval knowledge graph divided into multiple sub-graph information for accurate determination, but also for each sub-graph information, the entity vector and structure vector corresponding to the sub-graph information are analyzed in combination with the graph structure information and text information of the sub-graph information, thereby improving the accuracy of generating the entity vector and relationship vector of the information retrieval knowledge graph.
[0053] In one embodiment, Figure 1 As shown, a method for embedding an information retrieval knowledge graph is provided, and the method is applied to a terminal as an example for explanation, including the following steps:
[0054] Step S101, obtain the information retrieval knowledge graph, and collect the subgraph information of the information retrieval knowledge graph through the subgraph sampling algorithm.
[0055] In this embodiment, the terminal responds to the information retrieval knowledge graph embedding operation of the terminal and obtains the information retrieval knowledge graph that needs to be embedded in the information retrieval knowledge graph. Then, the terminal performs a subgraph sampling operation on the information retrieval knowledge graph through a subgraph sampling algorithm to obtain multiple subgraph information corresponding to the information retrieval knowledge graph. Each subgraph information is a graph information that combines multiple path information centered on an entity node, and the path information includes a forward path (forward-path) and a reverse path (backward-path). Among them, the information retrieval knowledge graph is a graph information composed of multiple entity nodes containing text information and graph structure information. The specific process of collecting multiple subgraph information of the information retrieval knowledge graph will be described in detail later. The subgraph sampling algorithm is a center-based path sampling algorithm. The information retrieval knowledge graph may be a paper retrieval knowledge graph, and each subgraph information of the paper retrieval knowledge graph is a sub-knowledge graph corresponding to each paper information in the paper retrieval knowledge graph, wherein the sub-knowledge graph corresponding to the paper information includes multiple sub-information contents of the paper information, and the sub-information contents may be but are not limited to abstract information, name (paper name, author name, source name, etc.) information, paper content information, and number information, etc. Each entity node of the paper retrieval knowledge graph corresponds to a paper information.
[0056] Step S102, through the image-text conversion strategy, convert each sub-image information into a text sequence corresponding to each sub-image information, and perform encoding conversion processing on each text sequence through a text encoder to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector of each text sequence.
[0057] In this embodiment, the terminal converts each path information in the subgraph information into a text sequence of the arrangement and combination of each entity node corresponding to the path information through a graph-to-text conversion strategy. Then, the terminal performs encoding conversion processing on each text sequence through a text encoder to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector corresponding to each text sequence. The graph-to-text conversion strategy is a graph-to-text conversion (Graph2Seq) strategy based on a trained natural language model. The specific conversion process will be described in detail later. The text encoder is a text vectorization network trained based on the Masked Entity Modeling (MEM) and Masked Relation Modeling (MRM) corresponding to the Masked Modeling idea. Specifically, the specific encoding conversion process will be described in detail later.
[0058] Specifically, the training process is that the terminal obtains multiple sample text sequences, and the sample masked entity vector of each sample text sequence, and the sample masked relationship vector of each sample text sequence. Then the terminal performs encoding conversion processing on the sample text sequence through the initial text encoder to obtain the test masked entity vector corresponding to the sample text sequence and the test masked relationship vector of each text sequence, and calculates the first similarity between the test masked entity vector corresponding to the sample text sequence and the sample masked entity vector of the sample text sequence, and the second similarity between the test masked relationship vector corresponding to the sample text sequence and the sample masked relationship vector of the sample text sequence through the vector similarity algorithm. Finally, the terminal presets a similarity threshold, and when the first similarity is lower than the similarity threshold, the terminal deletes the entity masking parameter of the initial text encoder corresponding to the first similarity. In the case where the second similarity is lower than the similarity threshold, the terminal deletes the relation masking parameter of the initial text encoder corresponding to the second similarity, and returns to execute the step of encoding and converting the sample text sequence through the initial text encoder to obtain the test masked entity vector corresponding to the sample text sequence and the test masked relation vector of each text sequence, until the first similarity and the second similarity are both greater than the similarity threshold, the terminal uses the initial text encoder obtained by the last iteration as the text encoder. MEM masks one first-order neighbor entity of the central entity each time (the corresponding entity description will also be masked to avoid information leakage).
[0059] Specifically, according to the relationship between the masked entity and the central entity, it can be divided into masked head entity and masked tail entity, that is:
[0060] <c,r,[MASK]> , <[MASK], r, c>
[0061] Where c represents the central entity and [MASK] is a special token in the BERT model. Similarly, MRM masks the relationship between the central entity and a first-order neighboring entity node each time:
[0062] <c,[MASK],t> ,<h,[MASK],c>
[0063] Where t is the first-order positive neighboring entity node of the central entity, and h is the first-order reverse neighboring entity node of the central entity.
[0064] Step S103, for each text sequence, based on the graph structure information of the subgraph information corresponding to the text sequence, through the relationship graph decoder, update the masked entity vector of the text sequence and the masked relationship vector of the text sequence, and reconstruct the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence to obtain the entity vectors corresponding to the information retrieval knowledge graph and the relationship vectors corresponding to the information retrieval knowledge graph.
[0065] In this embodiment, for each text sequence, the terminal uses a relational graph decoder to fuse the graph structure information of the subgraph information corresponding to the text sequence with each masked entity vector of the text sequence and each masked relation vector of the text sequence to obtain an updated masked entity vector of the text sequence and a masked relation vector of the text sequence. Then, based on the vector reconstruction network of the relational graph decoder, the terminal reconstructs the entity vector corresponding to the updated masked entity vector of the text sequence and the relation vector corresponding to the updated masked relation vector of the text sequence to obtain each entity vector corresponding to the information retrieval knowledge graph and each relation vector corresponding to the information retrieval knowledge graph. Among them, the relational graph decoder is a graph neural network model that can handle multidimensional relationships. The specific fusion process and reconstruction process will be described in detail later.
[0066] Based on the above scheme, the information retrieval knowledge graph is divided into multiple sub-graph information through the sub-graph conversion algorithm, which improves the analysis accuracy of different parts of the information retrieval knowledge graph. Then, the text sequence corresponding to each sub-graph information of the information retrieval knowledge graph is extracted through the image-text conversion strategy, and the text information corresponding to each sub-graph information is determined. Then, the text encoder encodes the masked entity vector and masked relationship vector corresponding to each text sequence, and the masked entity vector and masked relationship vector of each text sequence are fused with the graph structure information of the sub-graph information through the relationship graph decoder. Finally, the text sequence is decoded to obtain the entity vectors corresponding to the information retrieval knowledge graph. Not only is the information retrieval knowledge graph divided into multiple sub-graph information for accurate determination, but also for each sub-graph information, the entity vector and structure vector corresponding to the sub-graph information are analyzed in combination with the graph structure information and text information of the sub-graph information, thereby improving the accuracy of generating the entity vector and relationship vector of the information retrieval knowledge graph.
[0067] Optionally, collect subgraph information of the sample information retrieval knowledge graph, including: obtain multiple entity nodes of the information retrieval knowledge graph, and traverse the information retrieval knowledge graph through a subgraph sampling algorithm to obtain path information corresponding to each entity node; take the intersection point of the path information that intersects each other as the central entity, and take the central entity and the path information that intersects with the central entity as subgraph information.
[0068] In this embodiment, the terminal obtains each entity node of the information retrieval knowledge graph, and then randomly selects an entity node as the target entity node. The terminal uses a subgraph sampling algorithm to traverse all entity nodes connected to the entity node through the entity node, until the traversed entity node has no adjacent entity nodes other than the entity node passed last time, and the terminal uses all the entity nodes traversed in this way as a path information. The path information includes a forward path and a reverse path. The terminal uses the intersection of Liang Liang Xiao Jia's path as a central entity point. Then the terminal establishes a subgraph information based on the central entity and all the path information that intersects the central entity. Similarly, through the above scheme, the terminal obtains all the subgraph information of the information retrieval knowledge graph.
[0069] Specifically, the terminal uses one entity in each entity node as the central entity, and then uses the entity as the current entity. The terminal randomly selects one from multiple triples with the current entity as the head entity (tail entity) and walks to the tail entity (head entity) of the triple. The terminal repeats the above steps until the number of entities passed reaches the maximum path length or there is no triple with the current entity as the head entity (tail entity), and the terminal takes a forward path (reverse path). Finally, the terminal uses the generated multiple forward paths and reverse paths to construct the subgraph information centered on the central entity.
[0070] Based on the above scheme, through the subgraph sampling algorithm, subgraph information centered on a single entity node is obtained, which improves the topological structure information in each subgraph information, and completes the embedding operation of the information retrieval knowledge graph based on each subgraph information, which improves the accuracy of subsequent acquisition of entity vectors and relationship vectors.
[0071] Optionally, the entity node contains text information, and each sub-graph information is converted into a text sequence corresponding to each sub-graph information through a graph-text conversion strategy, including: for each sub-graph information, identifying the path information contained in the sub-graph information, and for each path information, based on the text information of each entity node contained in the path information, generating sub-text sequence information corresponding to the path information; based on the central entity of the sub-graph information, through a text splicing strategy, splicing the sub-text sequence information corresponding to each path information of the sub-graph information to obtain a text sequence corresponding to the sub-graph information.
[0072] In this embodiment, the terminal identifies each path information contained in the subgraph information based on the central entity of the subgraph information for each acquired subgraph information. Then, for each path information, the terminal generates the self-text sequence information of the path information based on the text information of each entity node contained in the path information. Finally, based on the central entity of the subgraph information, the terminal splices the sub-text sequence information corresponding to each path information of the subgraph information through a text splicing strategy to obtain the text sequence corresponding to the subgraph information.
[0073] Assume that each sampled subgraph G′ consists of multiple paths, each path P i It can be expressed as:
[0074] P i ={E i0 , R i0 , E i1 , R i1 ,…,E iN , R iN , E iN+1}
[0075] Where E ij Represents the entity information of each entity node in the text sequence, R ij Represents the relationship information of each entity node in the text sequence, <E ij , R ij , E ij+1 > represents the jth triplet in the path. Terminal. For each path P i , using the text description of the entity in the path to generate the text sequence T i , in order to enrich the semantic information of the context. The expression of the text sequence is:
[0076]
[0077] Where D ij Indicates E ij The text description of E represents the text concatenation operation. ij , D ij , R ij Separate them with commas.
[0078] Then, this paper uses two special identifiers (tokens) in the natural language model, namely [CLS] and [SEP], to concatenate the text T corresponding to each path. i , generate the text sequence S corresponding to the subgraph:
[0079]
[0080] Based on the above scheme, each path information is converted into a text sequence through the graph-text conversion strategy, and the sub-text sequences are spliced to obtain the text sequence corresponding to the sub-graph. On the basis of the semantic information of the text sequence, the content of the graph structure information contained in the text sequence is improved.
[0081] Optionally, the text encoder includes an entity masking sub-encoder and a relationship masking sub-encoder, and the text encoder performs encoding conversion processing on each text sequence to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector for each text sequence, including: for each text sequence, performing entity masking reconstruction processing on the text sequence through the entity masking sub-encoder to obtain the masked entity vector corresponding to the text sequence, and performing relationship masking reconstruction processing on the text sequence through the relationship masking sub-encoder to obtain the masked relationship vector corresponding to the text sequence.
[0082] In this embodiment, for each text sequence, the terminal performs entity masking reconstruction processing on the entity information of each entity node in the text sequence through an entity masking sub-encoder to obtain a masked entity vector corresponding to the text sequence, and performs relationship masking reconstruction processing on the relationship information of each entity node in the text sequence through a relationship masking sub-encoder to obtain a masked relationship vector corresponding to the text sequence. The entity masking reconstruction processing and the relationship masking reconstruction processing both include pooling operations, so that the text sequence is converted into a vector. The entity masking sub-encoder is a text encoder trained by the training task designed by the masked modeling idea: Masked Entity Modeling (MEM); the entity masking sub-encoder is a text encoder trained by the training task designed by the masked modeling idea: Masked Entity Modeling (MEM).
[0083] Based on the above scheme, the entity information and relationship information of each entity node in the text sequence are masked and encoded through the trained entity masking sub-encoder and relationship masking sub-encoder, and the text sequence is subjected to relationship masking and reconstruction to obtain the masked relationship vector corresponding to the text sequence, thereby improving the accuracy of obtaining the entity information and relationship information of the entity node.
[0084] Optionally, based on the graph structure information of the subgraph information corresponding to the text sequence, the masked entity vector of the text sequence and the masked relationship vector of the text sequence are updated through a relationship graph decoder, including: based on the graph structure information of the subgraph information corresponding to the text sequence, the subgraph structure information of each entity node of the text sequence is determined, and the subgraph structure information of each entity node is pooled to obtain the graph structure vector of each entity node; for each entity node of the text sequence, the sub-masked entity vector of the entity node in the masked entity vector is fused with the graph structure vector of the entity node to obtain the subgraph structure masked entity vector of the entity node, and the sub-masked relationship vector of the entity node in the masked entity vector is pooled. The relationship vector is fused with the graph structure vector of the entity node to obtain the subgraph structure masked relationship vector of the entity node; the subgraph structure masked entity vector of the entity node and the subgraph structure masked relationship vector of the entity node are convolved respectively through the graph convolutional neural network of the relationship graph decoder to obtain the updated sub-masked entity vector of the entity node and the updated sub-masked relationship vector of the entity node, and the masked entity vector containing the updated sub-masked entity vectors of all entity nodes is used as the updated masked entity vector of the text sequence, and the masked relationship vector containing the updated sub-masked relationship vectors of all entity nodes is used as the updated masked relationship vector of the text sequence.
[0085] In this embodiment, the terminal determines the subgraph structure information of each entity node of the text sequence based on the graph structure information of the subgraph information corresponding to the text sequence, and then the terminal performs pooling processing on the subgraph structure information of each entity node to obtain the graph structure vector of each entity node. For each entity node in the text sequence, the terminal fuses the sub-masked entity vector of the entity node in the masked entity vector with the graph structure vector of the entity node to obtain the subgraph structure masked entity vector of the entity node. The terminal fuses the sub-masked relationship vector of the entity node in the masked entity vector with the graph structure vector of the entity node to obtain the subgraph structure masked relationship vector of the entity node. The terminal performs convolution processing on the subgraph structure masked entity vector of the entity node and the subgraph structure masked relationship vector of the entity node through the graph convolution neural network of the relationship graph decoder, respectively, to obtain the updated sub-masked entity vector of the entity node and the updated sub-masked relationship vector of the entity node. Then the terminal uses the masked entity vector containing the updated sub-masked entity vectors of all entity nodes as the updated masked entity vector of the text sequence. Finally, the terminal takes the masked relation vector containing the updated sub-masked relation vectors of all entity nodes as the updated masked relation vector of the text sequence.
[0086] Specifically, each entity or relationship in the subgraph can be represented as a vector with a dimension of □, and the initial value of the vector comes from the above text encoder. The vector update process is as follows:
[0087] e t =φ(e h , e r )
[0088] in, represents a combination operation, h, r, and t represent the head entity information, relationship information, and tail entity information in a triple of an entity node, respectively. Represent their vectors. For a K-layer relational graph decoder, assuming h k+1 V Represents the vector obtained by node v after k layers of convolution, then:
[0089]
[0090] in, represents the set of outgoing edges of node v and the corresponding first-order positive adjacent entity nodes (u, r), represents the learnable parameter matrix associated with a specific entity, hk u and hk r Represents the vectors of neighbor u and outgoing edge r at the k-1 level respectively. After the entity vector is updated, the relationship vector will also be updated:
[0091]
[0092] in, represents the learnable parameter matrix related to a specific relationship. It should be noted that h 0 v and h 0 r That is, the initialization vector generated by the text encoder (that is, the masked entity vector and the masked relationship vector).
[0093] Based on the above scheme, the graph structure information in the sub-graph information is fused with the masked entity vector of each entity node and the masked relationship vector through the relationship graph decoder to increase the content of the graph structure information of the relationship vector and the entity vector, thereby improving the accuracy of the finally obtained relationship vector and entity vector.
[0094] Optionally, the entity vectors corresponding to the updated masked entity vectors of the text sequence and the relationship vectors corresponding to the updated masked relationship vectors of the text sequence are reconstructed to obtain the entity vectors corresponding to the information retrieval knowledge graph and the relationship vectors corresponding to the information retrieval knowledge graph, including: identifying the first mask vector in the updated masked entity vectors of the text sequence and the second mask vector in the updated masked relationship vectors of the text sequence, and reconstructing the first mask vector through a linear layer of a relationship graph decoder to obtain the entity vector corresponding to the text sequence, and reconstructing the second mask vector through a linear layer to obtain the relationship vector corresponding to the text sequence; using the entity vectors of the text sequence corresponding to all sub-graph information of the information retrieval knowledge graph as the entity vectors corresponding to the information retrieval knowledge graph, and using the relationship vectors of the text sequence corresponding to all sub-graph information of the information retrieval knowledge graph as the relationship vectors of the information retrieval knowledge graph.
[0095] In this embodiment, the terminal identifies the first masked vector in the updated masked entity vector of the text sequence, and the second masked vector in the updated masked relationship vector of the text sequence. Then the terminal reconstructs the first masked vector through the linear layer of the relationship graph decoder to obtain the entity vector corresponding to the text sequence, and reconstructs the second masked vector through the linear layer to obtain the relationship vector corresponding to the text sequence. The terminal uses the entity vectors of the text sequence corresponding to all subgraph information of the information retrieval knowledge graph as the entity vectors corresponding to the information retrieval knowledge graph. Then the terminal uses the relationship vectors of the text sequence corresponding to all subgraph information of the information retrieval knowledge graph as the relationship vectors of the information retrieval knowledge graph. The first masked vector and the second masked vector are the sub-entity vectors corresponding to the masked entity node in the masked relationship vector, and the relationship vector corresponding to the masked entity node.
[0096] Specifically, through the vector h of the masked entity and relationship K mask Reconstruct the masked part, and the corresponding relationship of the reconstruction function is:
[0097]
[0098] Among them, W m and b m are learnable parameters.
[0099] The losses of MEM (Entity Masked Reconstruction) and MRM (Relation Masked Reconstruction) are calculated by the cross entropy function:
[0100]
[0101] Where z represents the output of the linear layer, t represents the true label to be predicted, and N represents the total number of labels, which is equal to the number of entities in the MEM task and the number of relations in the MRM task.
[0102] Based on the above scheme, each masked entity vector and each masked relationship vector are masked and reconstructed through a relationship graph decoder, so that the entity vector and relationship vector make full use of the graph structure information contained in the information retrieval knowledge graph, thereby improving the accuracy of each entity vector and relationship vector obtained.
[0103] In one embodiment, Figure 2 As shown, an information retrieval knowledge graph embedding example is provided, which includes the following steps:
[0104] Step S201, obtain an information retrieval knowledge graph and multiple entity nodes of the information retrieval knowledge graph, and traverse the information retrieval knowledge graph through a subgraph sampling algorithm to obtain path information corresponding to each entity node.
[0105] Step S202: The intersection points of the path information intersecting each other are taken as the central entity, and the central entity and the path information intersecting the central entity are taken as subgraph information.
[0106] Step S203 , for each subgraph information, identifying the path information contained in the subgraph information, and for each path information, generating corresponding subtext sequence information of the path information based on the text information of each entity node contained in the path information.
[0107] Step S204 , based on the central entity of the sub-graph information, the sub-text sequence information corresponding to each path information of the sub-graph information is spliced through a text splicing strategy to obtain a text sequence corresponding to the sub-graph information.
[0108] Step S205, for each text sequence, the entity masking sub-encoder is used to perform entity masking reconstruction processing on the text sequence to obtain a masked entity vector corresponding to the text sequence, and the relationship masking sub-encoder is used to perform relationship masking reconstruction processing on the text sequence to obtain a masked relationship vector corresponding to the text sequence.
[0109] Step S206: subgraph structure information of the entity node, and perform pooling processing on the subgraph structure information of each entity node to obtain a graph structure vector of each entity node.
[0110] Step S207, for each entity node in the text sequence, the sub-masked entity vector of the entity node in the masked entity vector is fused with the graph structure vector of the entity node to obtain the sub-graph structure masked entity vector of the entity node, and the sub-masked relationship vector of the entity node in the masked entity vector is fused with the graph structure vector of the entity node to obtain the sub-graph structure masked relationship vector of the entity node.
[0111] Step S208, through the graph convolutional neural network of the relationship graph decoder, convolution processing is performed on the subgraph structure masked entity vector of the entity node and the subgraph structure masked relationship vector of the entity node respectively, to obtain the updated sub-masked entity vector of the entity node and the updated sub-masked relationship vector of the entity node, and the masked entity vector containing the updated sub-masked entity vectors of all entity nodes is used as the updated masked entity vector of the text sequence, and the masked relationship vector containing the updated sub-masked relationship vectors of all entity nodes is used as the updated masked relationship vector of the text sequence.
[0112] Step S209, identify the first masked vector in the updated masked entity vector of the text sequence, and the second masked vector in the updated masked relationship vector of the text sequence, and reconstruct the first masked vector through the linear layer of the relationship graph decoder to obtain the entity vector corresponding to the text sequence, and reconstruct the second masked vector through the linear layer to obtain the relationship vector corresponding to the text sequence.
[0113] Step S210, the entity vectors of the text sequence corresponding to all sub-graph information of the information retrieval knowledge graph are used as the entity vectors corresponding to the information retrieval knowledge graph, and the relationship vectors of the text sequence corresponding to all sub-graph information of the information retrieval knowledge graph are used as the relationship vectors of the information retrieval knowledge graph.
[0114] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0115] Based on the same inventive concept, the embodiment of the present application also provides an information retrieval knowledge graph embedding device for implementing the above-mentioned information retrieval knowledge graph embedding method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more information retrieval knowledge graph embedding device embodiments provided below can refer to the limitations of the information retrieval knowledge graph embedding method above, and will not be repeated here.
[0116] In one embodiment, Figure 3 As shown, an information retrieval knowledge graph embedding device is provided, including: an acquisition module 310, an encoding module 320 and a generation module 330, wherein:
[0117] An acquisition module 310 is used to acquire an information retrieval knowledge graph and collect information of each subgraph of the information retrieval knowledge graph through a subgraph sampling algorithm;
[0118] The encoding module 320 is used to convert each of the sub-image information into a text sequence corresponding to each of the sub-image information through a graph-text conversion strategy, and perform encoding conversion processing on each of the text sequences through a text encoder to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector of each text sequence;
[0119] A generation module 330 is used to update, for each text sequence, the masked entity vector of the text sequence and the masked relationship vector of the text sequence based on the graph structure information of the subgraph information corresponding to the text sequence, through a relationship graph decoder, and reconstruct the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence to obtain the entity vectors corresponding to the information retrieval knowledge graph and the relationship vectors corresponding to the information retrieval knowledge graph.
[0120] Optionally, the acquisition module 310 is specifically configured to:
[0121] Acquire multiple entity nodes of the information retrieval knowledge graph, and traverse the information retrieval knowledge graph through a subgraph sampling algorithm to obtain path information corresponding to each entity node;
[0122] The intersection points of the path information intersecting with each other are taken as the central entity, and the central entity and the path information intersecting with the central entity are taken as subgraph information.
[0123] Optionally, the encoding module 320 is specifically used to:
[0124] For each subgraph information, path information contained in the subgraph information is identified, and for each path information, subtext sequence information corresponding to the path information is generated based on text information of each entity node contained in the path information;
[0125] Based on the central entity of the sub-graph information, the sub-text sequence information corresponding to each path information of the sub-graph information is spliced through a text splicing strategy to obtain a text sequence corresponding to the sub-graph information.
[0126] Optionally, the encoding module 320 is specifically used to:
[0127] For each text sequence, the entity masking sub-encoder is used to perform entity masking reconstruction processing on the text sequence to obtain a masked entity vector corresponding to the text sequence, and the relationship masking sub-encoder is used to perform relationship masking reconstruction processing on the text sequence to obtain a masked relationship vector corresponding to the text sequence.
[0128] Optionally, the generating module 330 is specifically configured to:
[0129] Based on the graph structure information of the subgraph information corresponding to the text sequence, determine the subgraph structure information of each entity node of the text sequence, and perform pooling processing on the subgraph structure information of each entity node to obtain a graph structure vector of each entity node;
[0130] For each entity node of the text sequence, a sub-masked entity vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked entity vector of the entity node, and a sub-masked relationship vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked relationship vector of the entity node;
[0131] The graph convolutional neural network of the relationship graph decoder is used to convolve the subgraph structure masked entity vector of the entity node and the subgraph structure masked relationship vector of the entity node, respectively, to obtain an updated sub-masked entity vector of the entity node and an updated sub-masked relationship vector of the entity node, and the masked entity vector containing the updated sub-masked entity vectors of all entity nodes is used as the updated masked entity vector of the text sequence, and the masked relationship vector containing the updated sub-masked relationship vectors of all entity nodes is used as the updated masked relationship vector of the text sequence.
[0132] Optionally, the generating module 330 is specifically configured to:
[0133] Identify a first masked vector in the updated masked entity vector of the text sequence and a second masked vector in the updated masked relationship vector of the text sequence, and reconstruct the first masked vector through a linear layer of the relationship graph decoder to obtain an entity vector corresponding to the text sequence, and reconstruct the second masked vector through the linear layer to obtain a relationship vector corresponding to the text sequence;
[0134] The entity vectors of the text sequences corresponding to all subgraph information of the information retrieval knowledge graph are used as the entity vectors corresponding to the information retrieval knowledge graph, and the relationship vectors of the text sequences corresponding to all subgraph information of the information retrieval knowledge graph are used as the relationship vectors of the information retrieval knowledge graph.
[0135] Each module in the above-mentioned information retrieval knowledge graph embedding device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0136] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for embedding an information retrieval knowledge graph is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0137] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0138] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of any one of the methods in the first aspect are implemented.
[0139] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0140] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the steps of any one of the methods in the first aspect.
[0141] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0142] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0143] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0144] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for embedding a knowledge graph for information retrieval, characterized in that: The method comprises: Obtaining an information retrieval knowledge graph, and collecting information of each subgraph of the information retrieval knowledge graph through a subgraph sampling algorithm; For each subgraph information, path information contained in the subgraph information is identified, and for each path information, subtext sequence information corresponding to the path information is generated based on text information of each entity node contained in the path information; Based on the central entity of the sub-graph information, the sub-text sequence information corresponding to each path information of the sub-graph information is spliced through a text splicing strategy to obtain a text sequence corresponding to the sub-graph information; Performing encoding conversion processing on each of the text sequences through a text encoder to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector of each text sequence; the text encoder includes an entity masking sub-encoder and a relationship masking sub-encoder; Wherein, for each text sequence, the entity masking sub-encoder is used to perform entity masking reconstruction processing on the text sequence to obtain a masked entity vector corresponding to the text sequence, and the relation masking sub-encoder is used to perform relation masking reconstruction processing on the text sequence to obtain a masked relation vector corresponding to the text sequence; For each text sequence, based on the graph structure information of the subgraph information corresponding to the text sequence, the masked entity vector of the text sequence and the masked relationship vector of the text sequence are updated through a relationship graph decoder, and the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence are reconstructed to obtain the entity vectors corresponding to the information retrieval knowledge graph and the relationship vectors corresponding to the information retrieval knowledge graph.
2. The method according to claim 1, characterized in that The collecting of the subgraph information of the sample information retrieval knowledge graph includes: Acquire multiple entity nodes of the information retrieval knowledge graph, and traverse the information retrieval knowledge graph through a subgraph sampling algorithm to obtain path information corresponding to each entity node; The intersection points of the path information intersecting with each other are taken as the central entity, and the central entity and the path information intersecting with the central entity are taken as subgraph information.
3. The method according to claim 1, characterized in that The updating of the masked entity vector of the text sequence and the masked relationship vector of the text sequence by using a relationship graph decoder based on the graph structure information of the subgraph information corresponding to the text sequence includes: Based on the graph structure information of the subgraph information corresponding to the text sequence, determine the subgraph structure information of each entity node of the text sequence, and perform pooling processing on the subgraph structure information of each entity node to obtain a graph structure vector of each entity node; For each entity node of the text sequence, a sub-masked entity vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked entity vector of the entity node, and a sub-masked relationship vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked relationship vector of the entity node; The graph convolutional neural network of the relationship graph decoder is used to convolve the subgraph structure masked entity vector of the entity node and the subgraph structure masked relationship vector of the entity node, respectively, to obtain an updated sub-masked entity vector of the entity node and an updated sub-masked relationship vector of the entity node, and the masked entity vector containing the updated sub-masked entity vectors of all entity nodes is used as the updated masked entity vector of the text sequence, and the masked relationship vector containing the updated sub-masked relationship vectors of all entity nodes is used as the updated masked relationship vector of the text sequence.
4. The method according to claim 1, characterized in that: The reconstructing the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence to obtain each entity vector corresponding to the information retrieval knowledge graph and each relationship vector corresponding to the information retrieval knowledge graph includes: Identify a first masked vector in the updated masked entity vector of the text sequence and a second masked vector in the updated masked relationship vector of the text sequence, and reconstruct the first masked vector through a linear layer of the relationship graph decoder to obtain an entity vector corresponding to the text sequence, and reconstruct the second masked vector through the linear layer to obtain a relationship vector corresponding to the text sequence; The entity vectors of the text sequences corresponding to all subgraph information of the information retrieval knowledge graph are used as the entity vectors corresponding to the information retrieval knowledge graph, and the relationship vectors of the text sequences corresponding to all subgraph information of the information retrieval knowledge graph are used as the relationship vectors of the information retrieval knowledge graph.
5. An information retrieval knowledge graph embedding device, characterized in that: The device comprises: An acquisition module is used to acquire an information retrieval knowledge graph and collect information of each subgraph of the information retrieval knowledge graph through a subgraph sampling algorithm; An encoding module is used to identify the path information contained in each subgraph information, and for each path information, generate the corresponding sub-text sequence information of the path information based on the text information of each entity node contained in the path information; based on the central entity of the subgraph information, the sub-text sequence information corresponding to each path information of the subgraph information is spliced through a text splicing strategy to obtain a text sequence corresponding to the subgraph information; each text sequence is encoded and converted through a text encoder to obtain a masked entity vector corresponding to each text sequence and a masked relationship vector of each text sequence; the text encoder includes an entity masking sub-encoder and a relationship masking sub-encoder; wherein, for each text sequence, the entity masking sub-encoder performs entity masking reconstruction processing on the text sequence to obtain a masked entity vector corresponding to the text sequence, and the relationship masking sub-encoder performs relationship masking reconstruction processing on the text sequence to obtain a masked relationship vector corresponding to the text sequence; A generation module is used to update the masked entity vector of the text sequence and the masked relationship vector of the text sequence for each text sequence based on the graph structure information of the subgraph information corresponding to the text sequence through a relationship graph decoder, and reconstruct the entity vector corresponding to the updated masked entity vector of the text sequence and the relationship vector corresponding to the updated masked relationship vector of the text sequence to obtain the entity vectors corresponding to the information retrieval knowledge graph and the relationship vectors corresponding to the information retrieval knowledge graph.
6. The device according to claim 5, characterized in that The acquisition module is specifically used for: Acquire multiple entity nodes of the information retrieval knowledge graph, and traverse the information retrieval knowledge graph through a subgraph sampling algorithm to obtain path information corresponding to each entity node; The intersection points of the path information intersecting with each other are taken as the central entity, and the central entity and the path information intersecting with the central entity are taken as subgraph information.
7. The device according to claim 5, characterized in that The generating module is specifically used for: Based on the graph structure information of the subgraph information corresponding to the text sequence, determine the subgraph structure information of each entity node of the text sequence, and perform pooling processing on the subgraph structure information of each entity node to obtain a graph structure vector of each entity node; For each entity node of the text sequence, a sub-masked entity vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked entity vector of the entity node, and a sub-masked relationship vector of the entity node in the masked entity vector is fused with a graph structure vector of the entity node to obtain a sub-graph structure masked relationship vector of the entity node; The graph convolutional neural network of the relationship graph decoder is used to convolve the subgraph structure masked entity vector of the entity node and the subgraph structure masked relationship vector of the entity node, respectively, to obtain an updated sub-masked entity vector of the entity node and an updated sub-masked relationship vector of the entity node, and the masked entity vector containing the updated sub-masked entity vectors of all entity nodes is used as the updated masked entity vector of the text sequence, and the masked relationship vector containing the updated sub-masked relationship vectors of all entity nodes is used as the updated masked relationship vector of the text sequence.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Sequence text information-combined knowledge graph expression learning method and device
CN107871158A
Text processing method and device based on fusion knowledge graph
CN110609902A
Knowledge representation learning method and device, equipment and storage medium
CN111475658A
Knowledge-driven dialogue generation method and device
CN113111190A
Medical text processing method and device, computer equipment and storage medium
CN113673244A
