Method, device and electronic device for entity alignment
By constructing a collection containing entities and their relationships in the knowledge graph, the shared relationships and entity probabilities between entities are obtained, which solves the problem of low entity alignment accuracy in the existing technology and improves the accuracy of entity alignment.
Patent Information
- Application Number
- CN202210337904.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-01
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2042-04-01
AI Technical Summary
In the existing technology, the entity alignment method is only judged based on the similarity between the entity relationship and the entity alignment matrix, and the accuracy is not high.
Determine the entities to be aligned in the knowledge graph, build a collection containing the entities and their relationships, and determine whether the entities are the same object by obtaining the shared relationships and entity probabilities between entities.
The accuracy of entity alignment is improved by taking into account shared relationships and entities between entities.
Smart Images

Figure CN114676267B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of entity alignment, for example, to a method and device, and electronic equipment for entity alignment. Background Art
[0002] Different knowledge graphs have different focuses on collecting knowledge. For the same entity, some knowledge graphs may focus on describing a certain aspect of the entity itself, while others may focus on describing the relationship between the entity and other entities. Through knowledge fusion, the knowledge in different knowledge graphs can be complementary and integrated to form a comprehensive, accurate and complete entity description. The main work involved in the knowledge fusion process is entity alignment. Entity alignment can be used to determine whether entities from two different information sources refer to the same object in the real world.
[0003] In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in the related art:
[0004] In the prior art, whether two entities are the same object is determined only based on the similarity of the relationship alignment matrix and the entity alignment matrix corresponding to the two entities. This entity alignment method has low accuracy. Summary of the invention
[0005] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0006] The embodiments of the present disclosure provide a method and device for entity alignment, and an electronic device to improve the accuracy of entity alignment.
[0007] In some embodiments, the method for entity alignment includes: determining a first entity to be aligned and a second entity to be aligned in a knowledge graph; constructing a first set, a second set, and a third set; the first set includes the first entity to be aligned, the relationship corresponding to the first entity to be aligned, and the entity corresponding to the first entity to be aligned, the second set includes the second entity to be aligned, the relationship corresponding to the second entity to be aligned, and the entity corresponding to the second entity to be aligned, and the third set includes the relationship and entity common to the first entity to be aligned and the second entity to be aligned; obtaining a first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set, and the third set, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object; judging whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability.
[0008] In some embodiments, an apparatus for entity alignment includes: a determination module, configured to determine a first entity to be aligned and a second entity to be aligned in a knowledge graph; a set construction module, configured to construct a first set, a second set and a third set; the first set includes the first entity to be aligned, the relationship corresponding to the first entity to be aligned and the entity corresponding to the first entity to be aligned, the second set includes the second entity to be aligned, the relationship corresponding to the second entity to be aligned and the entity corresponding to the second entity to be aligned, and the third set includes the relationship and entity common to the first entity to be aligned and the second entity to be aligned; a probability acquisition module, configured to acquire a first probability that the first entity to be aligned and the second entity to be aligned are the same object, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object according to the first set, the second set and the third set; a judgment module, configured to judge whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability.
[0009] In some embodiments, an electronic device includes a processor and a memory storing program instructions, and the processor is configured to execute the above-mentioned method for entity alignment when running the program instructions.
[0010] The method, device, and electronic device for entity alignment provided by the embodiments of the present disclosure can achieve the following technical effects: first, determine the first entity to be aligned and the second entity to be aligned in the knowledge graph, then construct a first set including the first entity to be aligned and its corresponding relationship and corresponding entity, construct a second set including the second entity to be aligned and its corresponding relationship and corresponding entity, construct a third set including the relationship and entity shared by the first entity to be aligned and the second entity to be aligned, obtain a first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set, and the third set, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object, and then judge whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability. Since the existence of shared relationship and entity between the two entities is taken into account, the accuracy of entity alignment is improved.
[0011] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0013] Figure 1 is a schematic diagram of a method for entity alignment provided by an embodiment of the present disclosure;
[0014] Figure 2 is a schematic diagram of another method for entity alignment provided by an embodiment of the present disclosure;
[0015] Figure 3 is a schematic diagram of another method for entity alignment provided by an embodiment of the present disclosure;
[0016] Figure 4 is a structural schematic diagram of a device for entity alignment provided by an embodiment of the present disclosure;
[0017] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0019] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0020] Unless otherwise stated, the term "plurality" means two or more.
[0021] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0022] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0023] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0024] The technical solution of the embodiments of the present disclosure can be applied to electronic devices, including computers, smart terminals or servers. In some embodiments, the smart terminals include devices such as smart phones or tablets that store knowledge graphs.
[0025] In the disclosed embodiment, two entities to be aligned are determined in the knowledge graph using an intelligent terminal or a server, and a first set, a second set, and a third set are constructed. A first probability that the first entity to be aligned and the second entity to be aligned are the same object is obtained according to the first set, the second set, and the third set, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object is obtained, and then whether the first entity to be aligned and the second entity to be aligned are the same object is determined according to the first probability and the second probability. Since the common relationship and entity between the two entities are taken into consideration, the accuracy of entity alignment is improved.
[0026] Combination Figure 1 As shown, the embodiment of the present disclosure provides a method for entity alignment, including:
[0027] Step S101: The electronic device determines a first entity to be aligned and a second entity to be aligned in the knowledge graph.
[0028] Step S102, the electronic device constructs a first set, a second set and a third set; the first set includes the first entity to be aligned, the relationship corresponding to the first entity to be aligned and the entity corresponding to the first entity to be aligned, the second set includes the second entity to be aligned, the relationship corresponding to the second entity to be aligned and the entity corresponding to the second entity to be aligned, and the third set includes the relationship and entities common to the first entity to be aligned and the second entity to be aligned.
[0029] Step S103: The electronic device obtains a first probability that the first entity to be aligned and the second entity to be aligned are the same object, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object according to the first set, the second set and the third set.
[0030] Step S104: The electronic device determines whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability.
[0031] According to the method for entity alignment provided by the embodiment of the present disclosure, the first entity to be aligned and the second entity to be aligned are first determined in the knowledge graph, and then a first set including the first entity to be aligned and its corresponding relationship and corresponding entity is constructed, a second set including the second entity to be aligned and its corresponding relationship and corresponding entity is constructed, and a third set including the relationship and entity shared by the first entity to be aligned and the second entity to be aligned is constructed. According to the first set, the second set and the third set, a first probability that the first entity to be aligned and the second entity to be aligned are the same object and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object are obtained, and then according to the first probability and the second probability, whether the first entity to be aligned and the second entity to be aligned are the same object is determined. Since the existence of common relationship and entity between the two entities is taken into account, the accuracy of entity alignment is improved. At the same time, the knowledge graph technology is used to perform entity alignment, which facilitates the knowledge fusion of multiple knowledge graphs.
[0032] Optionally, the first entity to be aligned is a person or an object. Optionally, the second entity to be aligned is a person or an object.
[0033] In some embodiments, the first entity to be aligned is searched in the first knowledge graph to obtain several relationships of the first entity to be aligned and several entities of the first entity to be aligned. The second entity to be aligned is searched in the second knowledge graph to obtain several relationships of the second entity to be aligned and several entities of the second entity to be aligned. The first knowledge graph and the second knowledge graph may be the same knowledge graph or different knowledge graphs.
[0034] Optionally, the relationship corresponding to the first entity to be aligned is a unique relationship of the first entity to be aligned, the entity corresponding to the first entity to be aligned is a unique entity of the first entity to be aligned, and the entity corresponding to the first entity to be aligned is connected to the first entity to be aligned through the relationship corresponding to the first entity to be aligned. Among the multiple relationships of the first entity to be aligned, if the first relationship does not exist in the relationship of the second entity to be aligned, then the first relationship is determined to be a unique relationship of the first entity to be aligned, wherein the first relationship is any one of the relationships of the first entity to be aligned. Among the multiple entities of the first entity to be aligned, if the first entity does not exist in the entity of the second entity to be aligned, then the first entity is determined to be a unique entity of the first entity to be aligned, wherein the first entity is any one of the entities of the first entity to be aligned.
[0035] Optionally, the relationship corresponding to the second entity to be aligned is a unique relationship of the second entity to be aligned, the entity corresponding to the second entity to be aligned is a unique entity of the second entity to be aligned, and the entity corresponding to the second entity to be aligned is connected to the second entity to be aligned through the relationship corresponding to the second entity to be aligned. Among the multiple relationships of the second entity to be aligned, if the second relationship does not exist in the relationship of the first entity to be aligned, then the second relationship is determined to be a unique relationship of the second entity to be aligned, wherein the second relationship is any one of the relationships of the second entity to be aligned. Among the multiple entities of the second entity to be aligned, if the second entity does not exist in the entity of the first entity to be aligned, then the second entity is determined to be a unique entity of the second entity to be aligned, wherein the second entity is any one of the entities of the second entity to be aligned.
[0036] Optionally, among the multiple relationships of the first entity to be aligned, if a third relationship also exists in the relationship of the second entity to be aligned, the third relationship is determined to be a relationship shared by the first entity to be aligned and the second entity to be aligned, wherein the third relationship is any one of the relationships of the first entity to be aligned.
[0037] Optionally, an entity among several entities of the first entity to be aligned that is identical to an entity among the second entity to be aligned is determined as an entity common to the first entity to be aligned and the second entity to be aligned.
[0038] In some embodiments, statistics are performed on several relationships and several entities of the first entity to be aligned, and several relationships and several entities of the second entity to be aligned to obtain a first set A including the first entity to be aligned, its unique relationships, and its unique entities; a second set B including the second entity to be aligned, its unique relationships, and its unique entities; and a third set C including the common relationships and common entities between the first entity to be aligned and the second entity to be aligned.
[0039] Optionally, obtaining a first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set and the third set, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object, includes: obtaining a vector representation of the first entity to be aligned, obtaining a vector representation of the second entity to be aligned; obtaining an entity alignment matrix corresponding to the first set, obtaining a relationship alignment matrix corresponding to the first set; obtaining an entity alignment matrix corresponding to the second set, obtaining a relationship alignment matrix corresponding to the second set; obtaining an entity vector corresponding to the third set, obtaining a relationship vector corresponding to the third set; inputting each vector representation, each entity alignment matrix, each relationship alignment matrix, entity vector and relationship vector into a first preset model to obtain an output vector; inputting the output vector into a fully connected layer to obtain a first probability and a second probability. In this way, an output vector is obtained according to each vector representation, each entity alignment matrix, each relationship alignment matrix, entity vector and relationship vector, and then a first probability and a second probability of whether the first entity to be aligned and the second entity to be aligned are the same object are obtained according to the output vector, so that it can be determined whether the first entity to be aligned and the second entity to be aligned are the same object.
[0040] Optionally, the first preset model is a RoBerta (A Robustly Optimized BERT) model. In some embodiments, the vector representation of the first entity to be aligned, the vector representation of the second entity to be aligned, the entity alignment matrix corresponding to the first set, the relationship alignment matrix corresponding to the first set, the entity alignment matrix corresponding to the second set, the relationship alignment matrix corresponding to the second set, the entity vector corresponding to the third set, and the relationship vector corresponding to the third set are all input into the RoBerta model to obtain an output vector of the [CLS] (classification, used for downstream classification tasks) position.
[0041] Optionally, the output vector is input into a fully connected layer to obtain a first probability and a second probability, including: inputting the output vector into a fully connected layer to obtain a two-dimensional probability vector; wherein the two-dimensional probability vector includes a first dimension value and a second dimension value, the first dimension value is determined as a first probability that the first entity to be aligned and the second entity to be aligned are the same object, and the second dimension value is determined as a second probability that the first entity to be aligned and the second entity to be aligned are not the same object.
[0042] Combination Figure 2 As shown, the embodiment of the present disclosure provides a method for entity alignment, including:
[0043] Step S201: The electronic device determines a first entity to be aligned and a second entity to be aligned in the knowledge graph.
[0044] In step S202, the electronic device constructs a first set, a second set, and a third set; the first set includes the first entity to be aligned, the relationship corresponding to the first entity to be aligned, and the entity corresponding to the first entity to be aligned; the second set includes the second entity to be aligned, the relationship corresponding to the second entity to be aligned, and the entity corresponding to the second entity to be aligned; and the third set includes the relationship and entities common to the first entity to be aligned and the second entity to be aligned.
[0045] Step S203: the electronic device obtains a vector representation of the first entity to be aligned and obtains a vector representation of the second entity to be aligned.
[0046] Step S204: the electronic device obtains an entity alignment matrix corresponding to the first set, and obtains a relationship alignment matrix corresponding to the first set.
[0047] Step S205: The electronic device obtains an entity alignment matrix corresponding to the second set, and obtains a relationship alignment matrix corresponding to the second set.
[0048] Step S206: The electronic device obtains the entity vector corresponding to the third set, and obtains the relationship vector corresponding to the third set.
[0049] In step S207, the electronic device inputs each vector representation, each entity alignment matrix, each relationship alignment matrix, the entity vector and the relationship vector into a first preset model to obtain an output vector.
[0050] Step S208: The electronic device inputs the output vector into a fully connected layer to obtain a first probability that the first entity to be aligned and the second entity to be aligned are the same object, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object.
[0051] Step S209: The electronic device determines whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability.
[0052] Using the method for entity alignment provided by the embodiment of the present disclosure, first determine the first entity to be aligned and the second entity to be aligned in the knowledge graph, then construct a first set including the first entity to be aligned and its corresponding relationship and corresponding entity, construct a second set including the second entity to be aligned and its corresponding relationship and corresponding entity, and construct a third set including the relationship and entity shared by the first entity to be aligned and the second entity to be aligned; then obtain the first probability and the second probability according to the vector representation of the first entity to be aligned, the vector representation of the second entity to be aligned, the entity alignment matrix and the relationship alignment matrix corresponding to the first set, the entity alignment matrix and the relationship alignment matrix corresponding to the second set, the entity vector corresponding to the third set, and the relationship vector corresponding to the third set; and then determine whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability. Since the shared relationship and entity between the two entities are taken into account, the accuracy of entity alignment is improved.
[0053] Optionally, obtaining the vector representation of the first entity to be aligned includes: obtaining the vector representation of the first entity to be aligned using a second preset model.
[0054] Optionally, the first entity to be aligned is input into the TransE knowledge representation model to obtain a vector representation of the first entity to be aligned.
[0055] Optionally, obtaining the vector representation of the second entity to be aligned includes: obtaining the vector representation of the second entity to be aligned using a second preset model.
[0056] Optionally, the second entity to be aligned is input into the TransE knowledge representation model to obtain a vector representation of the second entity to be aligned.
[0057] Optionally, obtaining the entity alignment matrix corresponding to the first set includes: obtaining the shortest path lengths between each entity in the first set and all entities in the second set; normalizing the inverse of the shortest path lengths between each entity in the first set and all entities in the second set to obtain the path vectors corresponding to each entity in the first set; calculating the path vectors corresponding to each entity in the first set according to the first preset algorithm to obtain the entity alignment vector representation corresponding to each entity in the first set; and obtaining the entity alignment matrix corresponding to the first set according to the entity alignment vector representation corresponding to each entity in the first set. In this way, the path vectors corresponding to each entity in the first set are obtained according to the shortest path lengths between each entity in the first set and all entities in the second set, so as to reflect the correlation between each entity in the first set and all entities in the second set, and then obtain the entity alignment matrix corresponding to the first set, thereby considering the correlation between the entity specific to the first entity to be aligned and the entity specific to the entity to be aligned, facilitating the judgment of whether the first entity to be aligned and the second entity to be aligned are the same object, and by establishing and calculating the entity alignment vector representation of the entity to be aligned, the degree of association between the two entities to be aligned is further introduced and calculated, thereby improving the accuracy of entity alignment.
[0058] Optionally, obtaining the length of each shortest path between each entity in the first set and all entities in the second set includes: in the knowledge graph, obtaining the number of first nodes passed in each shortest path between each entity in the first set and all entities in the second set, and determining each first node number as the length of each shortest path between the corresponding entity in the first set and all entities in the second set. In some embodiments, the number of nodes passed in the shortest path is the number of relationships in the shortest path.
[0059] Optionally, normalizing the reciprocals of the shortest path lengths between each entity in the first set and all entities in the second set to obtain a path vector corresponding to each entity in the first set includes: normalizing the reciprocals of the shortest path lengths corresponding to each entity in the first set, concatenating the normalized values together, and obtaining a path vector corresponding to each entity in the first set. The path vector corresponding to each entity in the first set is a one-dimensional vector, and the number of columns of the one-dimensional vector is the number of entities in the second set.
[0060] Optionally, by calculating Obtain the entity alignment vector representation of the x-th entity in the first set A; where, is the entity alignment vector representation of the x-th entity in the first set A, is the vector representation of the first entity in the second set B, is the vector representation of the Nth entity in the second set B, hx [1] is the path vector h corresponding to the xth entity in the first set x The value of the first column in h x [N] is the path vector h corresponding to the x-th entity in the first set x The value of the Nth column in , where N is the number of entities in the second set B, N is a positive integer, and x is a positive integer.
[0061] Optionally, Obtained by inputting the Nth entity in the second set B into the TransE knowledge representation model.
[0062] In some embodiments, there are M entities in the first set A, where M is a positive integer. The path vectors corresponding to the M entities in the first set are calculated using a first preset algorithm to obtain entity alignment vector representations corresponding to each entity in the first set.
[0063] Optionally, acquiring an entity alignment matrix corresponding to the first set according to entity alignment vector representations corresponding to each entity in the first set includes: piecing together entity alignment vector representations corresponding to each entity in the first set to obtain an entity alignment matrix corresponding to the first set.
[0064] Optionally, obtaining the entity alignment matrix corresponding to the first set according to the entity alignment vector representations corresponding to the entities in the first set includes: using the entity alignment vector representations corresponding to the entities in the first set as columns of the matrix to form the entity alignment matrix corresponding to the first set. In some embodiments, the entity alignment vector representations corresponding to the entities in the first set are respectively and The entity alignment vectors corresponding to each entity in the first set are represented as columns of the matrix to form the entity alignment matrix corresponding to the first set:
[0065] Optionally, obtaining the relationship alignment matrix corresponding to the first set includes: obtaining the number of co-occurrences between each relationship in the first set and all relationships in the second set; normalizing the number of co-occurrences corresponding to each relationship in the first set to obtain the number of co-occurrences vector corresponding to each relationship in the first set; calculating the number of co-occurrences vector corresponding to each relationship in the first set according to the second preset algorithm to obtain the entity alignment vector representation corresponding to each relationship in the first set; obtaining the relationship alignment matrix corresponding to the first set according to the entity alignment vector representation corresponding to each relationship in the first set. In this way, the number of co-occurrences vector corresponding to each relationship in the first set is obtained according to the number of co-occurrences between each relationship in the first set and all relationships in the second set, so as to reflect the correlation between each relationship in the first set and all relationships in the second set, and then obtain the relationship alignment matrix corresponding to the first set, thereby considering the correlation between the relationship specific to the first entity to be aligned and the relationship specific to the entity to be aligned, so as to facilitate the judgment of whether the first entity to be aligned and the second entity to be aligned are the same object, and by establishing and calculating the entity alignment vector representation of the relationship between the two entities to be aligned, the degree of association between the relationship between the two entities to be aligned is further introduced and calculated, thereby improving the accuracy of entity alignment.
[0066] Optionally, the number of co-occurrences between each relationship in the first set and all relationships in the second set is obtained, including: counting the number of entities commonly connected to each relationship in the first set and all relationships in the second set in the knowledge graph, and obtaining the number of co-occurrences between each relationship in the first set and all relationships in the second set.
[0067] Optionally, normalizing each co-occurrence count corresponding to each relationship in each first set to obtain a co-occurrence count vector corresponding to each relationship in the first set includes: normalizing each co-occurrence count corresponding to each relationship in each first set, concatenating the values obtained after the normalization, and obtaining a co-occurrence count vector corresponding to each relationship in the first set. The co-occurrence count vector corresponding to each relationship in the first set is a one-dimensional vector, and the number of columns of the one-dimensional vector is the number of relationships in the second set.
[0068] Optionally, by calculating Obtain the entity alignment vector representation of the i-th relation in the first set A; where, is the entity alignment vector representation of the i-th relation in the first set A, is the vector representation of the first relation in the second set B, is the vector representation of the nth relation in the second set B, n is the number of relations in the second set B, f i [1] is the co-occurrence vector f corresponding to the i-th relationship in the first set i The first column value in fi [n] is the co-occurrence vector f corresponding to the i-th relationship in the first set i The value of the nth column in , where n is a positive integer and i is a positive integer. Optionally, Obtained by inputting the nth relation in the second set B into the TransE knowledge representation model.
[0069] In some embodiments, there are m relationships in the first set A, where m is a positive integer. The co-occurrence vectors corresponding to the m relationships in the first set are calculated respectively according to a second preset algorithm to obtain entity alignment vector representations corresponding to each relationship in the first set.
[0070] Optionally, obtaining a relationship alignment matrix corresponding to the first set according to entity alignment vector representations corresponding to each relationship in the first set includes: piecing together entity alignment vector representations corresponding to each relationship in the first set to obtain a relationship alignment matrix corresponding to the first set.
[0071] Optionally, obtaining the relationship alignment matrix corresponding to the first set according to the entity alignment vector representations corresponding to each relationship in the first set includes: using the entity alignment vector representations corresponding to each relationship in the first set as columns of the matrix to form the relationship alignment matrix corresponding to the first set. In some embodiments, the entity alignment vector representations corresponding to each relationship in the first set are respectively and The entity alignment vectors corresponding to each relationship in the first set are represented as columns of the matrix to form the relationship alignment matrix corresponding to the first set.
[0072] Optionally, obtaining the entity alignment matrix corresponding to the second set includes: obtaining the shortest path lengths between each entity in the second set and all entities in the first set; normalizing the inverse of the shortest path lengths between each entity in the second set and all entities in the first set to obtain the path vectors corresponding to each entity in the second set; calculating the path vectors corresponding to each entity in the second set according to a third preset algorithm to obtain the entity alignment vector representation corresponding to each entity in the second set; and obtaining the entity alignment matrix corresponding to the second set according to the entity alignment vector representation corresponding to each entity in the second set. In this way, the path vectors corresponding to each entity in the second set are obtained according to the shortest path lengths between each entity in the second set and all entities in the first set, so as to reflect the correlation between each entity in the second set and all entities in the first set, and then obtain the entity alignment matrix corresponding to the second set, thereby considering the correlation between the entity specific to the first entity to be aligned and the entity specific to the entity to be aligned, facilitating the judgment of whether the first entity to be aligned and the second entity to be aligned are the same object, and by establishing and calculating the entity alignment vector representation of the entity to be aligned, the degree of association between the two entities to be aligned is further introduced and calculated, thereby improving the accuracy of entity alignment.
[0073] Optionally, obtaining the shortest path lengths between each entity in the second set and all entities in the first set includes: in the knowledge graph, determining the number of second nodes passed through in each shortest path between each entity in the second set and all entities in the first set, and determining the second number of nodes as the shortest path lengths between each entity in the second set and all entities in the first set.
[0074] Optionally, normalizing the reciprocals of the shortest path lengths between each entity in the second set and all entities in the first set to obtain a path vector corresponding to each entity in the second set includes: normalizing the reciprocals of the shortest path lengths, concatenating the normalized values together, and obtaining a path vector corresponding to each entity in the second set. The path vector corresponding to each entity in the second set is a one-dimensional vector, and the number of columns of the one-dimensional vector is the number of entities in the first set.
[0075] Optionally, by calculating Obtain the entity alignment vector representation of the y-th entity in the second set B; where, is the entity alignment vector representation of the y-th entity in the second set B, is the vector representation of the first entity in the first set A, is the vector representation of the Mth entity in the first set A, M is the number of entities in the first set A, p y [1] is the path vector p corresponding to the yth entity in the second sety The first column value, p y [M] is the path vector p corresponding to the yth entity in the second set y The value in the Mth column, y is a positive integer.
[0076] Optionally, It is obtained by inputting the Mth entity in the first set A into the TransE knowledge representation model.
[0077] In some embodiments, the path vectors corresponding to the N entities in the second set are calculated according to a third preset algorithm to obtain an entity alignment vector representation corresponding to each entity in the second set.
[0078] Optionally, acquiring the entity alignment matrix corresponding to the second set according to the entity alignment vector representations corresponding to the entities in the second set includes: piecing together the entity alignment vector representations corresponding to the entities in the second set to obtain the entity alignment matrix corresponding to the second set.
[0079] Optionally, obtaining the entity alignment matrix corresponding to the second set according to the entity alignment vector representations corresponding to the entities in the second set includes: using the entity alignment vector representations corresponding to the entities in the second set as columns of the matrix to form the entity alignment matrix corresponding to the second set. In some embodiments, the entity alignment vector representations corresponding to the entities in the second set are respectively and The entity alignment vectors corresponding to each entity in the second set are represented as columns of the matrix to form the entity alignment matrix corresponding to the second set.
[0080] Optionally, obtaining the relationship alignment matrix corresponding to the second set includes: obtaining the number of co-occurrences between each relationship in the second set and all relationships in the first set; normalizing the number of co-occurrences corresponding to each relationship in the second set to obtain the number of co-occurrences vector corresponding to each relationship in the second set; calculating the number of co-occurrences vector corresponding to each relationship in the second set according to the fourth preset algorithm to obtain the entity alignment vector representation corresponding to each relationship in the second set; obtaining the relationship alignment matrix corresponding to the second set according to the entity alignment vector representation corresponding to each relationship in the second set. In this way, the number of co-occurrences vector corresponding to each relationship in the second set is obtained according to the number of co-occurrences between each relationship in the second set and all relationships in the first set, so as to reflect the correlation between each relationship in the second set and all relationships in the first set, and then obtain the relationship alignment matrix corresponding to the second set, thereby considering the correlation between the relationship specific to the first entity to be aligned and the relationship specific to the entity to be aligned, so as to facilitate the judgment of whether the first entity to be aligned and the second entity to be aligned are the same object, and by establishing and calculating the entity alignment vector representation of the relationship between the two entities to be aligned, the degree of association between the relationship between the two entities to be aligned is further introduced and calculated, thereby improving the accuracy of entity alignment.
[0081] Optionally, the number of co-occurrences between each relationship in the second set and all relationships in the first set is obtained, including: counting the number of entities commonly connected to each relationship in the second set and all relationships in the first set in the knowledge graph, and obtaining the number of co-occurrences between each relationship in the second set and all relationships in the first set.
[0082] Optionally, normalizing each co-occurrence count corresponding to each relationship in each second set to obtain a co-occurrence count vector corresponding to each relationship in the second set includes: normalizing each co-occurrence count corresponding to each relationship in each second set, concatenating the values obtained after the normalization, and obtaining a co-occurrence count vector corresponding to each relationship in the second set. The co-occurrence count vector corresponding to each relationship in the second set is a one-dimensional vector, and the number of columns of the one-dimensional vector is the number of relationships in the first set.
[0083] Optionally, by calculating Obtain the entity alignment vector representation of the j-th relation in the second set B; where, is the entity alignment vector representation of the jth relation in the second set B, is the vector representation of the first relation in the first set A, is the vector representation of the mth relation in the first set A, m is the number of relations in the first set A, g j [1] is the co-occurrence vector g corresponding to the j-th relationship in the second set j The first column value in gj [m] is the co-occurrence vector g corresponding to the j-th relationship in the second set j The value of the mth column in , where j is a positive integer.
[0084] Optionally, It is obtained by inputting the mth relation in the first set A into the TransE knowledge representation model.
[0085] In some embodiments, the co-occurrence frequency vectors corresponding to the n relations in the second set are calculated respectively according to a fourth preset algorithm to obtain an entity alignment vector representation corresponding to each relation in the second set.
[0086] Optionally, acquiring a relation alignment matrix corresponding to the second set according to entity alignment vector representations corresponding to each relation in the second set includes: piecing together entity alignment vector representations corresponding to each relation in the second set to obtain a relation alignment matrix corresponding to the second set.
[0087] Optionally, obtaining the relationship alignment matrix corresponding to the second set according to the entity alignment vector representations corresponding to each relationship in the second set includes: using the entity alignment vector representations corresponding to each relationship in the second set as columns of the matrix to form the relationship alignment matrix corresponding to the second set. In some embodiments, the entity alignment vector representations corresponding to each relationship in the second set are respectively and The entity alignment vectors corresponding to each relationship in the second set are represented as the columns of the matrix to form the relationship alignment matrix corresponding to the second set:
[0088] Optionally, obtaining the entity vector corresponding to the third set includes: using the second preset model to obtain the vector representation corresponding to each entity in the third set; obtaining a first average value of the vector representation corresponding to the entity in the third set, and determining the first average value as the entity vector corresponding to the third set. In this way, the vector representation corresponding to each entity in the third set is obtained, and then the entity vector corresponding to the third set is obtained, so that it is possible to judge whether the two entities to be aligned are the same object from the aspect of the common entities between the first entity to be aligned and the second entity to be aligned, thereby improving the accuracy of entity alignment.
[0089] Optionally, the second preset model is a TransE knowledge representation model. Optionally, each entity in the third set C is input into the TransE knowledge representation model to obtain a vector representation corresponding to each entity in the third set.
[0090] Optionally, obtaining a first average value of the vector representations corresponding to the entities in the third set includes: dividing the sum of the vector representations corresponding to the entities in the third set by the number of entities in the third set to obtain a first average value of the vector representations corresponding to the entities in the third set.
[0091] Optionally, obtaining the relationship vector corresponding to the third set includes: obtaining the vector representation corresponding to each relationship in the third set using the second preset model; obtaining the second average value of the vector representation corresponding to the relationship in the third set, and determining the second average value as the relationship vector corresponding to the third set. In this way, the vector representation corresponding to each relationship in the third set is obtained, and then the relationship vector corresponding to the third set is obtained, so that it is possible to judge whether the two entities to be aligned are the same object based on the common relationship between the first entity to be aligned and the second entity to be aligned, thereby improving the accuracy of entity alignment.
[0092] Optionally, the second preset model is used to obtain the vector representation corresponding to each relationship in the third set, including: inputting each relationship in the third set into the TransE knowledge representation model to obtain the vector representation corresponding to each relationship in the third set.
[0093] Optionally, obtaining a second average value of the vector representations corresponding to the relations in the third set includes: dividing the sum of the vector representations corresponding to the relations in the third set by the number of relations in the third set to obtain a first average value of the vector representations corresponding to the relations in the third set.
[0094] Optionally, judging whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability includes: when the first probability is greater than the second probability, determining that the first entity to be aligned and the second entity to be aligned are the same object; and, when the first probability is less than or equal to the second probability, determining that the first entity to be aligned and the second entity to be aligned are not the same object. In this way, by judging the difference between the first probability and the second probability, it is possible to determine whether the first entity to be aligned and the second entity to be aligned are the same object.
[0095] Combination Figure 3 As shown, the embodiment of the present disclosure provides a method for entity alignment, including:
[0096] Step S301: The electronic device determines a first entity to be aligned and a second entity to be aligned in the knowledge graph.
[0097] Step S302, the electronic device constructs a first set, a second set and a third set; the first set includes the first entity to be aligned, the relationship corresponding to the first entity to be aligned and the entity corresponding to the first entity to be aligned, the second set includes the second entity to be aligned, the relationship corresponding to the second entity to be aligned and the entity corresponding to the second entity to be aligned, and the third set includes the relationship and entities common to the first entity to be aligned and the second entity to be aligned.
[0098] Step S303: The electronic device obtains a first probability that the first entity to be aligned and the second entity to be aligned are the same object, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object according to the first set, the second set and the third set.
[0099] In step S304, the electronic device determines whether the first probability is greater than the second probability: if the first probability is greater than the second probability, execute step S305; if the first probability is less than or equal to the second probability, execute step S306.
[0100] Step S305: the electronic device determines that the first entity to be aligned and the second entity to be aligned are the same object.
[0101] Step S306: the electronic device determines that the first entity to be aligned and the second entity to be aligned are not the same object.
[0102] First, the first entity to be aligned and the second entity to be aligned are determined in the knowledge graph, and then a first set including the first entity to be aligned and its corresponding relationship and corresponding entity is constructed, a second set including the second entity to be aligned and its corresponding relationship and corresponding entity is constructed, and a third set including the relationship and entity shared by the first entity to be aligned and the second entity to be aligned is constructed; according to the first set, the second set and the third set, a first probability that the first entity to be aligned and the second entity to be aligned are the same object and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object are obtained, and then according to the first probability and the second probability, whether the first entity to be aligned and the second entity to be aligned are the same object is determined, and then by judging the size between the first probability and the second probability, whether the first entity to be aligned and the second entity to be aligned are the same object is determined. Since the existence of shared relationships and entities between the two entities is taken into account, the accuracy of entity alignment is improved, and the ability to express information such as relationships and entities is enhanced, and the generalization ability is improved.
[0103] Combination Figure 4As shown, the embodiment of the present disclosure provides a device for entity alignment, including a determination module 401, a set construction module 402, a probability acquisition module 403 and a judgment module 404. The determination module is configured to determine the first entity to be aligned and the second entity to be aligned in the knowledge graph; the set construction module is configured to construct a first set, a second set and a third set; the first set includes the first entity to be aligned, the relationship corresponding to the first entity to be aligned and the entity corresponding to the first entity to be aligned, the second set includes the second entity to be aligned, the relationship corresponding to the second entity to be aligned and the entity corresponding to the second entity to be aligned, and the third set includes the relationship and entity common to the first entity to be aligned and the second entity to be aligned; the probability acquisition module is configured to obtain a first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set and the third set, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object; the judgment module is configured to judge whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability.
[0104] Using the device for entity alignment provided by the embodiment of the present disclosure, first determine the first entity to be aligned and the second entity to be aligned in the knowledge graph, then construct a first set including the first entity to be aligned and its corresponding relationship and corresponding entity, construct a second set including the second entity to be aligned and its corresponding relationship and corresponding entity, and construct a third set including the relationship and entity shared by the first entity to be aligned and the second entity to be aligned; obtain a first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set and the third set, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object, and then judge whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability. Since the shared relationship and entity between the two entities are taken into consideration, the accuracy of entity alignment is improved.
[0105] Optionally, the probability acquisition module is configured to obtain the first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set and the third set, and the second probability that the first entity to be aligned and the second entity to be aligned are not the same object in the following manner: obtain the vector representation of the first entity to be aligned, obtain the vector representation of the second entity to be aligned; obtain the entity alignment matrix corresponding to the first set, obtain the relationship alignment matrix corresponding to the first set; obtain the entity alignment matrix corresponding to the second set, obtain the relationship alignment matrix corresponding to the second set; obtain the entity vector corresponding to the third set, obtain the relationship vector corresponding to the third set; input each vector representation, each entity alignment matrix, each relationship alignment matrix, entity vector and relationship vector into the first preset model to obtain an output vector; input the output vector into the fully connected layer to obtain the first probability and the second probability. In this way, the output vector is obtained according to each vector representation, each entity alignment matrix, each relationship alignment matrix, entity vector and relationship vector, and then the first probability and the second probability of whether the first entity to be aligned and the second entity to be aligned are the same object are obtained according to the output vector, so as to judge whether the first entity to be aligned and the second entity to be aligned are the same object.
[0106] Optionally, the probability acquisition module is configured to obtain the entity alignment matrix corresponding to the first set in the following manner: obtain the shortest path lengths between each entity in the first set and all entities in the second set; normalize the inverse of the shortest path lengths between each entity in the first set and all entities in the second set to obtain the path vector corresponding to each entity in the first set; calculate the path vector corresponding to each entity in the first set according to a first preset algorithm to obtain the entity alignment vector representation corresponding to each entity in the first set; obtain the entity alignment matrix corresponding to the first set based on the entity alignment vector representation corresponding to each entity in the first set.
[0107] Optionally, the probability acquisition module is configured to obtain the relationship alignment matrix corresponding to the first set in the following manner: obtain the number of co-occurrences between each relationship in the first set and all relationships in the second set; normalize the number of co-occurrences corresponding to each relationship in the first set to obtain the co-occurrence number vector corresponding to each relationship in the first set; calculate the co-occurrence number vector corresponding to each relationship in the first set according to a second preset algorithm to obtain the entity alignment vector representation corresponding to each relationship in the first set; obtain the relationship alignment matrix corresponding to the first set based on the entity alignment vector representation corresponding to each relationship in the first set.
[0108] Optionally, the probability acquisition module is configured to obtain the entity alignment matrix corresponding to the second set in the following manner: obtain the shortest path lengths between each entity in the second set and all entities in the first set; normalize the inverse of the shortest path lengths between each entity in the second set and all entities in the first set to obtain the path vector corresponding to each entity in the second set; calculate the path vector corresponding to each entity in the second set according to a third preset algorithm to obtain the entity alignment vector representation corresponding to each entity in the second set; obtain the entity alignment matrix corresponding to the second set according to the entity alignment vector representation corresponding to each entity in the second set.
[0109] Optionally, the probability acquisition module is configured to obtain the relationship alignment matrix corresponding to the second set in the following manner: obtain the number of co-occurrences between each relationship in the second set and all the relationships in the first set; normalize the number of co-occurrences corresponding to each relationship in the second set to obtain the co-occurrence number vector corresponding to each relationship in the second set; calculate the co-occurrence number vector corresponding to each relationship in the second set according to a fourth preset algorithm to obtain the entity alignment vector representation corresponding to each relationship in the second set; obtain the relationship alignment matrix corresponding to the second set based on the entity alignment vector representation corresponding to each relationship in the second set.
[0110] Optionally, the probability acquisition module is configured to obtain the entity vector corresponding to the third set in the following manner: using the second preset model to obtain the vector representation corresponding to each entity in the third set; obtaining the first average value of the vector representation corresponding to the entity in the third set, and determining the first average value as the entity vector corresponding to the third set.
[0111] Optionally, the probability acquisition module is configured to obtain the relationship vector corresponding to the third set in the following manner: using a second preset model to obtain the vector representation corresponding to each relationship in the third set; obtaining a second average value of the vector representation corresponding to the relationship in the third set, and determining the second average value as the relationship vector corresponding to the third set.
[0112] Optionally, the judgment module is configured to judge whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability in the following manner: when the first probability is greater than the second probability, determine that the first entity to be aligned and the second entity to be aligned are the same object; and, when the first probability is less than or equal to the second probability, determine that the first entity to be aligned and the second entity to be aligned are not the same object.
[0113] Combination Figure 5As shown, an embodiment of the present disclosure provides an electronic device, including a processor (processor) 500 and a memory (memory) 501. Optionally, the electronic device may also include a communication interface (Communication Interface) 502 and a bus 503. Among them, the processor 500, the communication interface 502, and the memory 501 can communicate with each other through the bus 503. The communication interface 502 can be used for information transmission. The processor 500 can call the logic instructions in the memory 501 to execute the method for entity alignment of the above embodiment.
[0114] In addition, the logic instructions in the memory 501 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0115] The memory 501 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 500 executes the function application and data processing by running the program instructions / modules stored in the memory 501, that is, the method for entity alignment in the above embodiment is implemented.
[0116] The memory 501 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 501 may include a high-speed random access memory and may also include a non-volatile memory.
[0117] Using the electronic device provided by this embodiment, first determine the first entity to be aligned and the second entity to be aligned in the knowledge graph, then construct a first set including the first entity to be aligned and its corresponding relationship and corresponding entity, construct a second set including the second entity to be aligned and its corresponding relationship and corresponding entity, and construct a third set including the relationship and entity shared by the first entity to be aligned and the second entity to be aligned; obtain the first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set and the third set, and the second probability that the first entity to be aligned and the second entity to be aligned are not the same object, and then judge whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability. Since the shared relationship and entity between the two entities are taken into consideration, the accuracy of entity alignment is improved.
[0118] Optionally, the electronic device includes a computer, an intelligent terminal or a server. Optionally, the intelligent terminal includes a device such as a smart phone or a tablet storing a knowledge graph.
[0119] An embodiment of the present disclosure provides a storage medium storing program instructions, which, when run, execute the above-mentioned method for entity alignment.
[0120] An embodiment of the present disclosure provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the above-mentioned method for entity alignment.
[0121] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0122] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes, or a transient storage medium.
[0123] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent only possible changes. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0124] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0125] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0126] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for entity alignment, characterized in that: include: Determine a first entity to be aligned and a second entity to be aligned in the knowledge graph; Constructing the first set, the second set, and the third set; The first set includes the first entity to be aligned, the relationship corresponding to the first entity to be aligned, and the entity corresponding to the first entity to be aligned; the second set includes the second entity to be aligned, the relationship corresponding to the second entity to be aligned, and the entity corresponding to the second entity to be aligned; and the third set includes the relationship and entity common to the first entity to be aligned and the second entity to be aligned; The relationship corresponding to the entity to be aligned is a unique relationship of the entity to be aligned, the entity corresponding to the entity to be aligned is a unique entity of the entity to be aligned, and the entity corresponding to the entity to be aligned is connected to the entity to be aligned through the relationship corresponding to the entity to be aligned; In the case where a first relationship among several relationships of the entities to be aligned does not exist in the relationship of the second entity to be aligned, the first relationship is determined to be a unique relationship of the first entity to be aligned; and in the case where a first entity among several entities of the first entity to be aligned does not exist in the entity of the second entity to be aligned, the first entity is determined to be a unique entity of the first entity to be aligned; In the case where the second relationship among the plurality of relationships of the second entity to be aligned does not exist in the relationship of the first entity to be aligned, determining the second relationship as a unique relationship of the second entity to be aligned; In the case where the second entity does not exist in the entity of the first entity to be aligned among the plurality of entities of the second entity to be aligned, determining the second entity as a unique entity of the second entity to be aligned; Acquire, according to the first set, the second set, and the third set, a first probability that the first entity to be aligned and the second entity to be aligned are the same object, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object; Determining whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability; Obtaining a first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set, and the third set, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object, including: obtaining a vector representation of the first entity to be aligned, obtaining a vector representation of the second entity to be aligned; obtaining an entity alignment matrix corresponding to the first set, obtaining a relationship alignment matrix corresponding to the first set; obtaining an entity alignment matrix corresponding to the second set, obtaining a relationship alignment matrix corresponding to the second set; obtaining an entity vector corresponding to the third set, obtaining a relationship vector corresponding to the third set; inputting each of the vector representations, each of the entity alignment matrices, each of the relationship alignment matrices, the entity vector, and the relationship vector into a first preset model to obtain an output vector; inputting the output vector into a fully connected layer to obtain the first probability and the second probability; Obtaining an entity alignment matrix corresponding to the first set, including: obtaining the shortest path lengths between each entity in the first set and all entities in the second set; normalizing the reciprocals of the shortest path lengths to obtain path vectors corresponding to each entity in the first set; calculating the path vectors corresponding to each entity in the first set according to a first preset algorithm to obtain entity alignment vector representations corresponding to each entity in the first set; obtaining an entity alignment matrix corresponding to the first set according to the entity alignment vector representations corresponding to each entity in the first set; Obtaining the relationship alignment matrix corresponding to the first set, including: obtaining the number of co-occurrences between each relationship in the first set and all relationships in the second set; normalizing the number of co-occurrences corresponding to each relationship in the first set to obtain a co-occurrence number vector corresponding to each relationship in the first set; calculating the co-occurrence number vector corresponding to each relationship in the first set according to a second preset algorithm to obtain an entity alignment vector representation corresponding to each relationship in the first set; obtaining the relationship alignment matrix corresponding to the first set according to the entity alignment vector representation corresponding to each relationship in the first set; Obtaining the entity alignment matrix corresponding to the second set, including: obtaining the shortest path lengths between each entity in the second set and all entities in the first set; normalizing the inverse of the shortest path lengths between each entity in the second set and all entities in the first set to obtain a path vector corresponding to each entity in the second set; calculating the path vector corresponding to each entity in the second set according to a third preset algorithm to obtain an entity alignment vector representation corresponding to each entity in the second set; obtaining the entity alignment matrix corresponding to the second set according to the entity alignment vector representation corresponding to each entity in the second set; Obtaining the relationship alignment matrix corresponding to the second set includes: obtaining the number of co-occurrences between each relationship in the second set and all the relationships in the first set; normalizing the number of co-occurrences corresponding to each relationship in the second set to obtain a co-occurrence number vector corresponding to each relationship in the second set; calculating the co-occurrence number vector corresponding to each relationship in the second set according to a fourth preset algorithm to obtain an entity alignment vector representation corresponding to each relationship in the second set; and obtaining the relationship alignment matrix corresponding to the second set according to the entity alignment vector representation corresponding to each relationship in the second set.
2. The method according to claim 1, characterized in that Obtaining a vector representation of the first entity to be aligned includes: A vector representation of the first entity to be aligned is obtained using a second preset model.
3. The method according to claim 1, characterized in that: Obtaining the entity vector corresponding to the third set includes: Using the second preset model to obtain a vector representation corresponding to each entity in the third set; A first average value of vector representations corresponding to entities in the third set is obtained, and the first average value is determined as the entity vector corresponding to the third set.
4. The method according to claim 1, characterized in that: Obtaining the relationship vector corresponding to the third set includes: Using the second preset model to obtain a vector representation corresponding to each relationship in the third set; A second average value of the vector representations corresponding to the relations in the third set is obtained, and the second average value is determined as the relation vector corresponding to the third set.
5. The method according to claim 1, characterized in that Judging whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability includes: When the first probability is greater than the second probability, determining that the first entity to be aligned and the second entity to be aligned are the same object; and, When the first probability is less than or equal to the second probability, it is determined that the first entity to be aligned and the second entity to be aligned are not the same object.
6. A device for entity alignment, characterized in that: include: A determination module, configured to determine a first entity to be aligned and a second entity to be aligned in the knowledge graph; A set construction module is configured to construct a first set, a second set and a third set; the first set includes the first entity to be aligned, the relationship corresponding to the first entity to be aligned and the entity corresponding to the first entity to be aligned; the second set includes the second entity to be aligned, the relationship corresponding to the second entity to be aligned and the entity corresponding to the second entity to be aligned; the third set includes the relationship and entity common to the first entity to be aligned and the second entity to be aligned; The relationship corresponding to the entity to be aligned is a unique relationship of the entity to be aligned, the entity corresponding to the entity to be aligned is a unique entity of the entity to be aligned, and the entity corresponding to the entity to be aligned is connected to the entity to be aligned through the relationship corresponding to the entity to be aligned; In the case where a first relationship among several relationships of the entities to be aligned does not exist in the relationship of the second entity to be aligned, the first relationship is determined to be a unique relationship of the first entity to be aligned; and in the case where a first entity among several entities of the first entity to be aligned does not exist in the entity of the second entity to be aligned, the first entity is determined to be a unique entity of the first entity to be aligned; In the case where the second relationship among the plurality of relationships of the second entity to be aligned does not exist in the relationship of the first entity to be aligned, determining the second relationship as a unique relationship of the second entity to be aligned; In the case where the second entity does not exist in the entity of the first entity to be aligned among the plurality of entities of the second entity to be aligned, determining the second entity as a unique entity of the second entity to be aligned; a probability acquisition module, configured to acquire, according to the first set, the second set, and the third set, a first probability that the first entity to be aligned and the second entity to be aligned are the same object, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object; a judging module, configured to judge whether the first entity to be aligned and the second entity to be aligned are the same object according to the first probability and the second probability; Obtaining a first probability that the first entity to be aligned and the second entity to be aligned are the same object according to the first set, the second set, and the third set, and a second probability that the first entity to be aligned and the second entity to be aligned are not the same object, including: obtaining a vector representation of the first entity to be aligned, obtaining a vector representation of the second entity to be aligned; obtaining an entity alignment matrix corresponding to the first set, obtaining a relationship alignment matrix corresponding to the first set; obtaining an entity alignment matrix corresponding to the second set, obtaining a relationship alignment matrix corresponding to the second set; obtaining an entity vector corresponding to the third set, obtaining a relationship vector corresponding to the third set; inputting each of the vector representations, each of the entity alignment matrices, each of the relationship alignment matrices, the entity vector, and the relationship vector into a first preset model to obtain an output vector; inputting the output vector into a fully connected layer to obtain the first probability and the second probability; Obtaining an entity alignment matrix corresponding to the first set, including: obtaining the shortest path lengths between each entity in the first set and all entities in the second set; normalizing the reciprocals of the shortest path lengths to obtain path vectors corresponding to each entity in the first set; calculating the path vectors corresponding to each entity in the first set according to a first preset algorithm to obtain entity alignment vector representations corresponding to each entity in the first set; obtaining an entity alignment matrix corresponding to the first set according to the entity alignment vector representations corresponding to each entity in the first set; Obtaining the relationship alignment matrix corresponding to the first set, including: obtaining the number of co-occurrences between each relationship in the first set and all relationships in the second set; normalizing the number of co-occurrences corresponding to each relationship in the first set to obtain a co-occurrence number vector corresponding to each relationship in the first set; calculating the co-occurrence number vector corresponding to each relationship in the first set according to a second preset algorithm to obtain an entity alignment vector representation corresponding to each relationship in the first set; obtaining the relationship alignment matrix corresponding to the first set according to the entity alignment vector representation corresponding to each relationship in the first set; Obtaining the entity alignment matrix corresponding to the second set, including: obtaining the shortest path lengths between each entity in the second set and all entities in the first set; normalizing the inverse of the shortest path lengths between each entity in the second set and all entities in the first set to obtain a path vector corresponding to each entity in the second set; calculating the path vector corresponding to each entity in the second set according to a third preset algorithm to obtain an entity alignment vector representation corresponding to each entity in the second set; obtaining the entity alignment matrix corresponding to the second set according to the entity alignment vector representation corresponding to each entity in the second set; Obtaining the relationship alignment matrix corresponding to the second set includes: obtaining the number of co-occurrences between each relationship in the second set and all the relationships in the first set; normalizing the number of co-occurrences corresponding to each relationship in the second set to obtain a co-occurrence number vector corresponding to each relationship in the second set; calculating the co-occurrence number vector corresponding to each relationship in the second set according to a fourth preset algorithm to obtain an entity alignment vector representation corresponding to each relationship in the second set; and obtaining the relationship alignment matrix corresponding to the second set according to the entity alignment vector representation corresponding to each relationship in the second set.
7. An electronic device comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to execute the method for entity alignment according to any one of claims 1 to 5 when running the program instructions.
Citation Information
Patent Citations
An optimization method of entity alignment based on graph partition
CN109359172A
Alignment method and device
CN110516078A
Display device, display system and entity alignment method
CN111475657A
Knowledge graph entity alignment method and device, computer equipment and storage medium
CN112417169A
Large-scale entity alignment method based on bidirectional graph partition and reciprocal reasoning
CN114048323A
