Knowledge graph representation method and device fusing topology and semantic information

By integrating topological and semantic information into a knowledge graph representation method, the problem that the semantic information of entity concepts cannot be fully represented in existing technologies is solved, thereby improving the representation effect and enhancing the adaptability of knowledge graphs.

CN116484020BActive Publication Date: 2026-05-29TSINGHUA UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TSINGHUA UNIVERSITY
Filing Date
2023-04-24
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies only consider the topological association constraints of entities in the knowledge space, which cannot fully reflect the richness of the semantic information of entity concepts in the knowledge graph. This leads to a weakening of the knowledge representation effect, reduces the ability of knowledge representation to help downstream tasks, and results in poor adaptability and practicality.

Method used

By modeling the semantic information of knowledge, we design a semantic representation comparison learning task based on real text and a topological representation comparison learning task based on knowledge graph association, and integrate semantic and topological information to achieve knowledge graph representation results.

Benefits of technology

It improves the adaptability and practicality of knowledge graph representation, enhances its adaptability to different knowledge graphs and scenarios, and ensures the representation effect of knowledge graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116484020B_ABST
    Figure CN116484020B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of knowledge graphs, in particular to a knowledge graph representation method and device fusing topological and semantic information, wherein the method comprises the following steps: obtaining a first vector representation of entity description text and a second vector representation of entity recall text, performing contrast learning on the first vector representation and the second vector representation, and performing distance vector model learning on the first vector representation of the entity description text and the embedded representation of the knowledge graph, to obtain a knowledge graph representation result. The embodiment of the application can model semantic information of knowledge, design a semantic representation contrast learning task based on real text and a topological representation contrast learning task based on knowledge graph association, to obtain a knowledge graph representation result, so that the fusion of semantic information and topological information is realized, the representation effect of the knowledge graph is guaranteed, the adaptability of the graph representation to different knowledge graphs and scenes is improved, and the application is more reliable and practical.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of knowledge graph technology, and in particular to a knowledge graph representation method and apparatus that integrates topological and semantic information. Background Technology

[0002] A knowledge graph is a structured semantic knowledge base used to describe concepts and their relationships in the physical world in symbolic form. Embedded representation technology of the graph can map entities and relationships in the knowledge graph from a semantic relation network to a real vector space, while effectively preserving the semantic structure of the graph.

[0003] In related technologies, the main methods for embedded representation of knowledge graphs can be divided into distance vector-based methods, bilinear methods, neural network-based methods, hyperbolic geometry-based methods, and rotation-based methods, etc. The selection and adjustment should be based on the characteristics of different knowledge graphs and application scenarios.

[0004] However, the relevant technologies only consider the topological association constraints of entities in the knowledge space, which cannot reflect the richness of the semantic information of entity concepts in the knowledge graph. This leads to a weakening of the knowledge representation effect, reduces the ability of knowledge representation to help downstream tasks, and has poor adaptability and practicality, which urgently needs to be solved. Summary of the Invention

[0005] This application provides a knowledge graph representation method and apparatus that integrates topological and semantic information to solve the problems in related technologies that only consider the topological association constraints of entities in the knowledge space, which cannot fully reflect the richness of the semantic information of entity concepts in the knowledge graph, resulting in weakened knowledge representation effect, reduced ability of knowledge representation to help downstream tasks, and poor adaptability and practicality.

[0006] The first aspect of this application provides a knowledge graph representation method that integrates topological and semantic information, comprising the following steps: modeling the descriptive text of an entity to obtain a first vector representation of the entity descriptive text; modeling the text retrieved by the entity in a corpus to obtain a second vector representation of the entity recall text; performing comparative learning by combining the first vector representation of the entity descriptive text with the second vector representation of the entity recall text; and, based on the comparative learning result, performing distance vector model learning by combining the first vector representation of the entity descriptive text with the embedded representation of the knowledge graph to obtain a knowledge graph representation result.

[0007] Optionally, in one embodiment of this application, before modeling the descriptive text of the entity, the method further includes: preprocessing the text dataset to segment the text into sentences and convert it into a first character sequence.

[0008] Optionally, in one embodiment of this application, the step of modeling the entity description text to obtain a first vector representation of the entity description text includes: finding a third vector representation of the text characters based on a first preset character vector embedding matrix; and performing context modeling on the third vector representation to obtain a first contextual implicit vector representation of the text.

[0009] Optionally, in one embodiment of this application, before modeling the text retrieved from the corpus for the entity, the method further includes: retrieving the entity from the corpus and recalling the sentence containing the entity; segmenting the sentence containing the entity and converting it into a second character sequence.

[0010] Optionally, in one embodiment of this application, the step of modeling the text retrieved by the entity in the corpus to obtain a second vector representation of the entity recall text includes: finding a fourth vector representation of the retrieved text characters based on a second preset character vector embedding matrix; and performing contextual modeling on the fourth vector representation to obtain a second contextual latent vector representation of the text.

[0011] Optionally, in one embodiment of this application, the comparative learning of the first vector representation of the entity description text and the second vector representation of the entity recall text includes: using the first vector representation and the second vector representation as positive samples, randomly selecting description text vectors of other entities as negative samples, and calculating a first loss function for comparative learning.

[0012] Optionally, in one embodiment of this application, before learning the distance vector model by combining the first vector representation of the entity description text with the embedded representation of the knowledge graph, the method further includes: initializing the embedded representation vectors of the entities and relations in the knowledge graph.

[0013] Optionally, in one embodiment of this application, the step of learning a distance vector model by combining the first vector representation of the entity description text with the embedded representation of the knowledge graph includes: training a distance vector model by combining the embedded representation vector of the knowledge graph with the first vector representation, calculating a second loss function; and performing multi-task learning by combining the first loss function.

[0014] A second aspect of this application provides a knowledge graph representation device that integrates topological and semantic information, comprising: a first modeling module for modeling entity description text to obtain a first vector representation of the entity description text; a second modeling module for modeling text retrieved from a corpus by the entity to obtain a second vector representation of the entity recall text; a first learning module for comparative learning by combining the first vector representation of the entity description text with the second vector representation of the entity recall text; and a second learning module for learning a distance vector model by combining the first vector representation of the entity description text with the embedded representation of the knowledge graph based on the comparative learning result to obtain a knowledge graph representation result.

[0015] Optionally, in one embodiment of this application, the first modeling module includes: a first preprocessing unit, configured to preprocess the text dataset before modeling the descriptive text of the entity, so as to segment the text into sentences and convert it into a first character sequence.

[0016] Optionally, in one embodiment of this application, the first modeling module further includes: a first search unit, configured to search for a third vector representation of a text character based on a first preset character vector embedding matrix; and a first modeling unit, configured to perform contextual modeling on the third vector representation to obtain a first contextual implicit vector representation of the text.

[0017] Optionally, in one embodiment of this application, the second modeling module includes: a retrieval unit, configured to retrieve the entity in the corpus before modeling the text retrieved from the corpus for the entity, and recall the sentence containing the entity; and a conversion unit, configured to segment the sentence containing the entity and convert it into a second character sequence.

[0018] Optionally, in one embodiment of this application, the second modeling module further includes: a second search unit, used to search for a fourth vector representation of the retrieved text character based on a second preset character vector embedding matrix; and a second modeling unit, used to perform context modeling on the fourth vector representation to obtain a second contextual implicit vector representation of the text.

[0019] Optionally, in one embodiment of this application, the first learning module includes: a computing unit, configured to use the first vector representation and the second vector representation as positive samples, randomly select description text vectors of other entities as negative samples, and calculate a first loss function for contrastive learning.

[0020] Optionally, in one embodiment of this application, the second learning module includes: a second preprocessing unit, configured to initialize the embedded representation vectors of entities and relations in the knowledge graph before learning the distance vector model by combining the first vector representation of the entity description text with the embedded representation of the knowledge graph.

[0021] Optionally, in one embodiment of this application, the second learning module further includes: a second computing unit, used to train a distance vector model by combining the embedded representation vector of the knowledge graph with the first vector representation, and to calculate a second loss function; and a learning unit, used to perform multi-task learning by combining the first loss function.

[0022] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the knowledge graph representation method for fusing topological and semantic information as described in the above embodiments.

[0023] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the knowledge graph representation method that integrates topological and semantic information as described above.

[0024] This application's embodiments can design semantic representation comparison learning tasks based on real text and topological representation comparison learning tasks based on knowledge graph associations by modeling the semantic information of knowledge, thereby obtaining knowledge graph representation results. This achieves the fusion of semantic and topological information, ensuring the representation effect of the knowledge graph, improving the adaptability of the graph representation to different knowledge graphs and scenarios, and making it more reliable and practical. Therefore, it solves the problems in related technologies that only consider the topological association constraints of entities in the knowledge space, failing to fully reflect the richness of the semantic information of entity concepts in the knowledge graph, resulting in weakened knowledge representation effects, reduced ability of knowledge representation to help downstream tasks, and poor adaptability and practicality.

[0025] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0026] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0027] Figure 1 This is a flowchart of a knowledge graph representation method that integrates topological and semantic information according to an embodiment of this application;

[0028] Figure 2 This is a schematic diagram illustrating a knowledge graph representation process that integrates topological and semantic information according to an embodiment of this application.

[0029] Figure 3 This is an example diagram illustrating a knowledge graph representation process that integrates topological and semantic information according to an embodiment of this application.

[0030] Figure 4 This is a schematic diagram of the structure of a knowledge graph representation device that integrates topological and semantic information according to an embodiment of this application;

[0031] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0032] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0033] The following description, with reference to the accompanying drawings, describes a knowledge graph representation method and apparatus that integrates topological and semantic information according to embodiments of this application. Addressing the problem that related technologies mentioned in the background only consider the topological association constraints of entities in the knowledge space, failing to fully reflect the richness of the semantic information of entity concepts in the knowledge graph, resulting in weakened knowledge representation effects, reduced ability of knowledge representation to assist downstream tasks, and poor adaptability and practicality, this application provides a knowledge graph representation method that integrates topological and semantic information. In this method, by modeling the semantic information of knowledge, a semantic representation comparison learning task based on real text and a topological representation comparison learning task based on knowledge graph associations are designed to obtain knowledge graph representation results. This achieves the integration of semantic and topological information, ensuring the representation effect of the knowledge graph, improving the adaptability of the graph representation to different knowledge graphs and scenarios, and making it more reliable and practical.

[0034] Specifically, Figure 1 This is a flowchart illustrating a knowledge graph representation method that integrates topological and semantic information, as provided in an embodiment of this application.

[0035] like Figure 1 As shown, this knowledge graph representation method that integrates topological and semantic information includes the following steps:

[0036] In step S101, the entity's description text is modeled to obtain the first vector representation of the entity's description text.

[0037] In practice, a Bidirectional Long Short-Term Memory (Bi-LSTM) network can be used to encode each character vector in a context-dependent manner. Bi-LSTM can learn global semantic features by utilizing information from both directions. Alternatively, a Convolutional Neural Network (CNN) can be used to extract local features from each character vector. CNNs, through multiple convolutional kernels and pooling layers, can focus on local information at different scales and locations, which is beneficial for recognizing entity boundaries. Another option is to use a character-level pre-trained language model (such as BERT) to perform deep semantic representation on each character vector. BERT is a model pre-trained on large-scale unlabeled text and can learn rich latent features through self-attention mechanisms and multi-layer transformer structures.

[0038] Optionally, in one embodiment of this application, before modeling the descriptive text of the entity, the method further includes: preprocessing the text dataset to segment the text into sentences and convert it into a first character sequence.

[0039] The embodiments of this application can realize the preprocessing process of text datasets, perform text segmentation, convert text into character sequences, and obtain the first character sequence as the result, so as to realize the modeling process of entity description text.

[0040] Optionally, in one embodiment of this application, modeling the entity's descriptive text to obtain a first vector representation of the entity's descriptive text includes: finding a third vector representation of the text characters based on a first preset character vector embedding matrix; and modeling the third vector representation in context to obtain a first contextual latent vector representation of the text.

[0041] It is understood that, in the embodiments of this application, the third vector representation may be the text character vector representation found using the character vector embedding matrix, and the first contextual implicit vector representation may be the modeling result of the entity's descriptive text, that is, the vector representation of the entity's descriptive text.

[0042] It should be noted that the first preset character vector embedding matrix can be set by those skilled in the art according to the actual situation, and no specific limitation is made here.

[0043] For example, for a character sequence of a text [w1, w2, ..., w...] N This requires modeling a latent vector representation of local textual information, thereby enabling each character to be embedded through a character embedding lookup table. This is mapped to a low-dimensional vector, where V is the vocabulary size and D is the embedding dimension. During model training, the parameters of this character embedding lookup table can be trained, and the text character sequence is transformed into a vector sequence [e1, e2, ..., e...]. N ].

[0044] Secondly, the latent vectors of the embedding vectors are calculated. Taking the character-level pre-trained language model BERT as an example, for the input vector E = [e1, e2, ..., e N After passing through 12 layers of transformer self-attention encoders, the output latent vector sequence is R = [r1, r2, ..., r]. N The vector representation of the entire sentence can be obtained through pooling or by calculating the special label [CLS]. BERT is based on a transformer structure, and its attention mechanism is...

[0045]

[0046] Where Q, K, and V are respectively:

[0047] Q = EW Q ,

[0048] K = EW K ,

[0049] V = EW V ,

[0050] Where E is the input vector, W Q W K W R Let d be the weight matrix corresponding to Q, K, V. k For vector dimensions, use √d k Normalization is performed, and finally, softmax activation is used to obtain the attention weights. Since the transformer structure lacks positional awareness, for the input vector sequence, it is concatenated with the positional encoding:

[0051]

[0052]

[0053] Where pos represents the position of the word, i represents the dimension of the word, and d is the vector dimension. For the sequence R = [r1, r2, ..., r... N Pooling, denoted M is the embedding dimension, and average pooling can be used:

[0054]

[0055] Where N is the sequence length, k is the specified dimension, and R is the pooling result for that dimension.

[0056] This application embodiment can find the vector representation of text characters based on the character vector embedding matrix, and obtain the contextual implicit vector representation of the entity description text by modeling the context of the vector representation, so as to further realize the following learning process and provide the necessary data foundation for comparative learning.

[0057] In step S102, the text retrieved by the entity in the corpus is modeled to obtain the second vector representation of the entity recall text.

[0058] Optionally, in one embodiment of this application, before modeling the text retrieved from the corpus for the entity, the method further includes: retrieving the entity from the corpus and recalling the sentence containing the entity; segmenting the sentence containing the entity and converting it into a second character sequence.

[0059] In actual execution, entities can be retrieved from the corpus to obtain the sentences in which the entities appear, i.e., entity recall text. The sentences containing the entities are then segmented and converted into character sequences to achieve the preprocessing process before text modeling.

[0060] Optionally, in one embodiment of this application, the text retrieved by an entity in a corpus is modeled to obtain a second vector representation of the entity recall text, including: finding a fourth vector representation of the retrieved text characters based on a second preset character vector embedding matrix; and modeling the fourth vector representation in context to obtain a second contextual latent vector representation of the text.

[0061] It is understood that, in the embodiments of this application, the fourth vector representation may be the text character vector representation found using the character vector embedding matrix, and the second contextual latent vector representation may be the modeling result of the text retrieved by the entity in the corpus, that is, the vector representation of the entity recall text.

[0062] It should be noted that the second preset character vector embedding matrix can be set by those skilled in the art according to the actual situation, and no specific limitation is made here.

[0063] For example, the positions where entities appear in the recalled text can be replaced with masking labels. Then, using the aforementioned process for obtaining the first contextual latent vector representation, the processed sentence can be converted into a vector sequence [e1, e2, ..., e] through a character embedding lookup table. N ], and then converted into a latent vector sequence [r1, r2, ..., r] using BERT. N The vector of the masked part is pooled to obtain the final vector representation.

[0064] The embodiments of this application can find the vector representation of text characters based on the character vector embedding matrix, and obtain the contextual latent vector representation of entity recall text by performing context modeling on the vector representation, so as to further obtain the text information required for the following learning process.

[0065] In step S103, the first vector representation of the joint entity description text is compared and learned with the second vector representation of the entity recall text.

[0066] Optionally, in one embodiment of this application, the comparative learning of the first vector representation of the entity description text and the second vector representation of the entity recall text includes: using the first vector representation and the second vector representation as positive samples, randomly selecting the description text vectors of other entities as negative samples, and calculating the first loss function of the comparative learning.

[0067] In actual execution, for an entity, its descriptive text vector representation can be denoted as v1, the vector representation of the retrieved text from the corpus can be denoted as v, a negative sample can be sampled, and its descriptive text vector can be denoted as v2. The loss function Loss1 is:

[0068] Loss1=max(d(v,v1)-d(v,v2)+α1,0),

[0069] d(v,v i )=|vv i || 2 ,

[0070] Where d is the distance function, which can be calculated using Euclidean distance, v is the vector representation of the retrieved recall text from the corpus, v1 is the vector representation of the entity's descriptive text, v2 is the vector representation of the negative sample's descriptive text, and α1 is a set constant.

[0071] In this embodiment, the vector representations of entity description text and entity recall text can be used as positive samples, and negative samples can be randomly selected to calculate the first loss function for contrastive learning.

[0072] In step S104, based on the contrastive learning results, the first vector representation of the entity description text and the embedded representation of the knowledge graph are used to learn the distance vector model to obtain the knowledge graph representation results.

[0073] The embodiments of this application can learn a distance vector model based on the comparative learning results, combining the first vector representation of the entity description text with the embedded representation of the knowledge graph, to obtain the knowledge graph representation results, thereby realizing the fusion of semantic information and topological information, ensuring the representation effect of the knowledge graph, and improving the adaptability of the graph representation to different knowledge graphs and scenarios.

[0074] Optionally, in one embodiment of this application, before learning the distance vector model between the first vector representation of the joint entity description text and the embedded representation of the knowledge graph, the method further includes: initializing the embedded representation vectors of the entities and relations in the knowledge graph.

[0075] This application embodiment can initialize embedded representation vectors for entities and relations in a knowledge graph, thereby further realizing the joint learning of the first vector representation of entity description text and the embedded representation of the knowledge graph, and completing the data preprocessing process.

[0076] Optionally, in one embodiment of this application, learning a distance vector model by combining the first vector representation of the entity description text with the embedded representation of the knowledge graph includes: training a distance vector model by combining the embedded representation vector of the knowledge graph with the first vector representation, calculating a second loss function, and performing multi-task learning by combining the first loss function.

[0077] In actual implementation, for a triple, the topological feature vector of its head entity can be denoted as h. s The text vector is denoted as h. d The final vector representation of the head entity is h = [h s ,h d ], that is, the concatenation of the two. Similarly, the vector representation of the tail entity is t = [t s ,t d The vector representation of the relationship is denoted as r, and the final score of the positive sample is:

[0078] d pos =||h+rt|| 2 ,

[0079] Where, d pos Let be the score of the positive sample, h be the topological feature vector of the head entity of the triplet, r be the vector representation of the triplet relation, and t be the vector representation of the tail entity of the triplet. Negative samples are sampled using a random replacement method, and their scores are denoted as d. neg ,for:

[0080] d neg =||h+rt|| 2 ,

[0081] Where, d neg Let be the score of the negative sample, h be the topological feature vector of the head entity of the triplet, r be the vector representation of the triplet relation, and t be the vector representation of the tail entity of the triplet. The corresponding loss function Loss2 is:

[0082] Loss2 = max(d pos -d neg +α2,0),

[0083] Where, d pos The score of the positive sample, d neg Let be the score of the negative samples, and α2 be a constant. Then the overall training loss function Loss is:

[0084] Loss = Loss1 + λLoss2

[0085] Where Loss1 is the loss function obtained by comparing the vector representation of the entity description text with the vector representation of the entity recall text, Loss2 is the loss function obtained by comparing the vector representation of the entity description text with the embedded representation of the knowledge graph, and λ is a hyperparameter.

[0086] Finally, the model is trained to optimize the loss function Loss using the Adam optimizer. The formula for Adam optimization is as follows:

[0087]

[0088]

[0089]

[0090] Where μ is the learning rate, β1 and β2 are the weight parameters, ∈ is the numerical stability addition term, and γ is the weight decay term.

[0091] The embodiments of this application can train a distance vector model by combining the embedded representation vector of the knowledge graph with the first vector representation, calculate the second loss function, and then combine the first loss function to perform multi-task learning, thereby combining the semantic representation comparison learning task based on real text and the topological representation comparison learning task based on knowledge graph association to obtain the final representation result of the knowledge graph.

[0092] The following detailed description of the working content of the embodiments of this application is based on a specific example, such as... Figure 2-3 As shown, the vector representation of the entity description text is obtained by modeling the entity description text, and the vector representation of the entity recall text is obtained by modeling the text retrieved from the corpus. The vector representations of the entity description text and the recall text are compared and learned together. The vector representations of the entity description text and the embedded representation of the knowledge graph are combined to learn the distance vector model, so as to realize the representation of the knowledge graph.

[0093] The knowledge graph representation method that integrates topological and semantic information proposed in the embodiments of this application can obtain knowledge graph representation results by modeling the semantic information of knowledge, designing a semantic representation comparison learning task based on real text and a topological representation comparison learning task based on knowledge graph association, thereby realizing the fusion of semantic and topological information, ensuring the representation effect of knowledge graph, improving the adaptability of graph representation to different knowledge graphs and scenarios, and making it more reliable and practical.

[0094] Next, with reference to the accompanying drawings, a knowledge graph representation apparatus that integrates topological and semantic information according to an embodiment of this application is described.

[0095] Figure 4 This is a schematic diagram of the structure of a knowledge graph representation device that integrates topological and semantic information according to an embodiment of this application.

[0096] like Figure 4 As shown, the knowledge graph representation device 10 that integrates topological and semantic information includes: a first modeling module 100, a second modeling module 200, a first learning module 300, and a second learning module 400.

[0097] The first modeling module 100 is used to model the entity's description text to obtain a first vector representation of the entity's description text.

[0098] The second modeling module 200 is used to model the text retrieved by the entity in the corpus to obtain the second vector representation of the entity recall text.

[0099] The first learning module 300 is used to compare and learn the first vector representation of the entity description text with the second vector representation of the entity recall text.

[0100] The second learning module 400 is used to learn a distance vector model based on the contrastive learning results, combining the first vector representation of the entity description text with the embedded representation of the knowledge graph, to obtain the knowledge graph representation results.

[0101] Optionally, in one embodiment of this application, the first modeling module 100 includes: a first preprocessing unit.

[0102] The first preprocessing unit is used to preprocess the text dataset before modeling the descriptive text of the entities, in order to segment the text into sentences and convert it into a first character sequence.

[0103] Optionally, in one embodiment of this application, the first modeling module 100 further includes a first search unit and a first modeling unit.

[0104] The first search unit is used to search for the third vector representation of a text character based on a first preset character vector embedding matrix.

[0105] The first modeling unit is used to model the context of the third vector representation to obtain the first contextual latent vector representation of the text.

[0106] Optionally, in one embodiment of this application, the second modeling module 200 includes a retrieval unit and a conversion unit.

[0107] The retrieval unit is used to retrieve the entity from the corpus before modeling the text retrieved from the corpus, and to recall the sentence containing the entity.

[0108] The transformation unit is used to segment the sentence containing the entity and convert it into a second character sequence.

[0109] Optionally, in one embodiment of this application, the second modeling module 200 further includes: a second search unit and a second modeling unit.

[0110] The second search unit is used to search for the fourth vector representation of the retrieved text characters based on the second preset character vector embedding matrix.

[0111] The second modeling unit is used to model the context of the fourth vector representation to obtain the second contextual latent vector representation of the text.

[0112] Optionally, in one embodiment of this application, the first learning module 300 includes a computing unit.

[0113] The computation unit is used to take the first vector representation and the second vector representation as positive samples, randomly select the description text vectors of other entities as negative samples, and calculate the first loss function of the contrastive learning.

[0114] Optionally, in one embodiment of this application, the second learning module 400 includes a second preprocessing unit.

[0115] The second preprocessing unit is used to initialize the embedded representation vectors of entities and relations in the knowledge graph before learning the distance vector model between the first vector representation of the joint entity description text and the embedded representation of the knowledge graph.

[0116] Optionally, in one embodiment of this application, the second learning module 400 further includes a second computing unit and a learning unit.

[0117] The second computational unit is used to train the distance vector model by combining the embedded representation vector of the knowledge graph with the first vector representation, and to calculate the second loss function.

[0118] The learning unit is used to perform multi-task learning in conjunction with the first loss function.

[0119] It should be noted that the foregoing explanation of the knowledge graph representation method embodiment that integrates topological and semantic information also applies to the knowledge graph representation device that integrates topological and semantic information in this embodiment, and will not be repeated here.

[0120] The knowledge graph representation device that integrates topological and semantic information proposed in the embodiments of this application can obtain knowledge graph representation results by modeling the semantic information of knowledge, designing semantic representation comparison learning tasks based on real text and topological representation comparison learning tasks based on knowledge graph associations, thereby realizing the fusion of semantic and topological information, ensuring the representation effect of knowledge graph, improving the adaptability of graph representation to different knowledge graphs and scenarios, and making it more reliable and practical.

[0121] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include:

[0122] The memory 501, the processor 502, and the computer program stored on the memory 501 and capable of running on the processor 502.

[0123] When the processor 502 executes the program, it implements the knowledge graph representation method that integrates topological and semantic information provided in the above embodiments.

[0124] Furthermore, electronic devices also include:

[0125] Communication interface 503 is used for communication between memory 501 and processor 502.

[0126] The memory 501 is used to store computer programs that can run on the processor 502.

[0127] The memory 501 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0128] If the memory 501, processor 502, and communication interface 503 are implemented independently, then the communication interface 503, memory 501, and processor 502 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0129] Optionally, in a specific implementation, if the memory 501, processor 502, and communication interface 503 are integrated on a single chip, then the memory 501, processor 502, and communication interface 503 can communicate with each other through an internal interface.

[0130] Processor 502 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.

[0131] This embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the knowledge graph representation method that integrates topological and semantic information as described above.

[0132] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0133] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0134] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0135] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0136] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0137] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0138] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0139] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. A knowledge graph representation method that integrates topological and semantic information, characterized in that, Includes the following steps: Model the entity's description text to obtain the first vector representation of the entity's description text; The text retrieved by the entity in the corpus is modeled to obtain a second vector representation of the entity recall text; The first vector representation of the entity description text is compared and learned by combining it with the second vector representation of the entity recall text; as well as Based on the contrastive learning results, the distance vector model is learned by combining the first vector representation of the entity description text with the embedded representation of the knowledge graph to obtain the knowledge graph representation results. The comparison and learning between the first vector representation of the entity description text and the second vector representation of the entity recall text includes: The first vector representation and the second vector representation are used as positive samples, and the description text vectors of other entities are randomly selected as negative samples. The first loss function of contrastive learning is calculated. The learning of the distance vector model by combining the first vector representation of the entity description text with the embedded representation of the knowledge graph includes: The embedded representation vectors of the knowledge graph are combined with the first vector representation to train a distance vector model, and a second loss function is calculated. Multi-task learning is performed in conjunction with the first loss function.

2. The knowledge graph representation method that integrates topological and semantic information according to claim 1, characterized in that, Before modeling the descriptive text of the entity, the following is also included: The text dataset is preprocessed to segment the text into sentences and convert it into a first character sequence.

3. The method according to claim 1, characterized in that, The process of modeling the entity's descriptive text to obtain a first vector representation of the entity's descriptive text includes: Based on the first preset character vector embedding matrix, find the third vector representation of the text character; The third vector representation is modeled in context to obtain the first contextual latent vector representation of the text.

4. The method according to claim 1, characterized in that, Before modeling the text retrieved from the corpus for the entity, the method further includes: The entity is retrieved from the corpus to recall the sentence containing the entity; The sentence containing the entity is segmented and converted into a second character sequence.

5. The method according to claim 1, characterized in that, The step of modeling the text retrieved from the corpus for the entity to obtain a second vector representation of the entity recall text includes: Based on the second preset character vector embedding matrix, find the fourth vector representation of the retrieved text characters; The fourth vector representation is modeled in context to obtain the second contextual latent vector representation of the text.

6. The method according to claim 1, characterized in that, Before learning the distance vector model by combining the first vector representation of the entity description text with the embedded representation of the knowledge graph, the method further includes: Initialize embedded representation vectors for the entities and relations in the knowledge graph.

7. A knowledge graph representation device that integrates topological and semantic information, characterized in that, include: The first modeling module is used to model the entity's description text to obtain the first vector representation of the entity's description text; The second modeling module is used to model the text retrieved by the entity in the corpus to obtain a second vector representation of the entity recall text; The first learning module is used to compare and learn by combining the first vector representation of the entity description text with the second vector representation of the entity recall text. as well as The second learning module is used to learn a distance vector model based on the contrastive learning results, combining the first vector representation of the entity description text with the embedded representation of the knowledge graph, to obtain the knowledge graph representation results. The first learning module is further configured to use the first vector representation and the second vector representation as positive samples, randomly select the descriptive text vectors of other entities as negative samples, and calculate the first loss function for comparative learning; The second learning module is further configured to train a distance vector model by combining the embedded representation vector of the knowledge graph with the first vector representation, calculate a second loss function, and perform multi-task learning by combining the first loss function.

8. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the knowledge graph representation method that integrates topological and semantic information as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the knowledge graph representation method that integrates topological and semantic information as described in any one of claims 1-6.