A knowledge graph construction method and device, and an electronic device

By tagging attributes and determining relationships in the target text, entities and relationships are identified, solving the problem of incomplete information in knowledge graphs and enabling more comprehensive information construction.

CN115470356BActive Publication Date: 2026-02-03HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202110653469.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-11
Publication Date
2026-02-03
Estimated Expiration
2041-06-11

AI Technical Summary

Technical Problem

In existing technologies, entities and/or attributes in unstructured text cannot be extracted when they do not appear in the form of triples, resulting in incomplete information in the constructed knowledge graph.

Method used

By tagging the target text with attributes, determining each attribute and its category, and using the attributes of the preset categories as entity mentions, a knowledge graph is constructed by combining a relationship judgment model to determine the relationship between entity mentions and attributes and entity mentions.

Benefits of technology

Even if attributes exist in isolation, they can still be tagged and reflected in the knowledge graph, improving the comprehensiveness of information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115470356B_ABST
    Figure CN115470356B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a knowledge graph construction method and device and electronic equipment. The method comprises: performing attribute marking on a target text, determining each attribute present in the target text and the category of each attribute; determining, among the attributes, an attribute of a preset category as an entity mention, wherein the attribute of the preset category is an attribute that can uniquely identify a described entity and is set in advance; for each entity mention, determining an attribute associated with the entity mention and not an entity mention in the target text to obtain an attribute of an entity identified by the entity mention; determining the association relationship of each entity mention in the target text to obtain the relationship between entities identified by each entity mention; and constructing a knowledge graph according to the attributes of the entities identified by each entity mention and the relationship between the entities identified by each entity mention. The information in the constructed knowledge graph can be more comprehensive.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge graph technology, and in particular to a knowledge graph construction method, apparatus, and electronic device. Background Technology

[0002] A knowledge graph consists of nodes and edges. Nodes represent entities, and edges connect two nodes, representing the relationships between the entities represented by those two nodes. Therefore, a knowledge graph is a knowledge network used to represent entities and the relationships between them. Many applications rely on the entities and relationships represented by knowledge graphs, making the accurate construction of knowledge graphs a pressing technical problem.

[0003] In related technologies, relation triples representing relationships between entities and attribute triples representing entity attributes can be extracted from unstructured text, and a knowledge graph can be constructed based on the extracted relation triples and attribute triples.

[0004] However, if an entity and / or attribute does not appear in the form of a triple in the unstructured text, the entity or attribute cannot be extracted. For example, if there is an isolated entity [Xiaoming] in the unstructured text, the entity [Xiaoming] will not be reflected in the constructed knowledge graph, resulting in the information in the knowledge graph being relatively missing compared to the information in the unstructured text, that is, the information in the constructed knowledge graph is not comprehensive enough. Summary of the Invention

[0005] The purpose of this invention is to provide a knowledge graph construction method, apparatus, and electronic device, so that the information in the constructed knowledge graph is more comprehensive. The specific technical solution is as follows:

[0006] In a first aspect of the present invention, a knowledge graph construction method is provided, the method comprising:

[0007] The target text is tagged with attributes to determine the various attributes present in the target text and the categories of each attribute;

[0008] Among the various attributes, attributes of a preset category are identified as entity references, wherein the preset category attributes are pre-set attributes that can uniquely identify the described entity;

[0009] For each entity mention, identify the attributes in the target text that are associated with the entity mention but are not entity mentions, and obtain the attributes of the entity identified by the entity mention;

[0010] Determine the relationships between the entity references in the target text to obtain the relationships between the entities identified by the entity references;

[0011] A knowledge graph is constructed based on the attributes of the entities mentioned by each entity and the relationships between the entities mentioned by each entity.

[0012] In one possible embodiment, the step of attribute tagging of the target text, determining the various attributes present in the target text and the categories of each attribute, includes:

[0013] The target text is input into a pre-trained attribute labeling model to obtain the attributes present in the target text and the categories of each attribute as output by the attribute labeling model.

[0014] The attribute labeling model includes a first pre-trained sub-model and a labeling sub-model. The input of the first pre-trained sub-model is the text input to the attribute labeling model, and the output is the word vector of each word segment contained in the input text. The input of the labeling sub-model is the word vector of each word segment, and the output is the attributes present in each word segment and the category of the attributes. The first pre-trained sub-model is trained through unsupervised learning.

[0015] In one possible embodiment, for each entity mention, determining the attributes in the target text that are associated with the entity mention but are not entity mentions, to obtain the attributes of the entity identified by the entity mention, includes:

[0016] For each entity mention and each attribute not mentioned by an entity, the entity mention, the attribute, and the target text are input into a pre-trained relation judgment model to obtain a first output result from the relation judgment model. The first output result is used to represent the association relationship between the entity mention and the attribute in the target text.

[0017] If the first output result indicates that the entity mention is associated with the attribute, then the attribute is determined to be an attribute of the entity identified by the entity mention;

[0018] Determining the association relationships between entity mentions in the target text, and obtaining the relationships between the entities identified by the entity mentions, includes:

[0019] For every two entity mentions, the two entity mentions and the target text are input into the relationship judgment model to obtain a second output result of the relationship judgment model. The second output result is used to represent the association relationship between the two entity mentions in the target text.

[0020] Based on the association relationship represented by the second output result, determine the association relationship between the two entities mentioned in the entity references;

[0021] The relation judgment model includes a second pre-trained sub-model and a judgment sub-model. The input of the second pre-trained sub-model is the text input to the relation judgment model, and the output is the word vector of each word segment contained in the input text. The input of the judgment sub-model is the word vector of each word segment and the attributes input to the relation judgment model, and the output is the association relationship between the attributes input to the relation judgment model. The second pre-trained sub-model is trained through unsupervised learning.

[0022] In one possible embodiment, after constructing the knowledge graph based on the attributes of the entities identified by each entity mentions and the relationships between the entities identified by each entity mentions, the method further includes:

[0023] Determine whether any two entity references identify the same entity;

[0024] If any two entity references identify the same entity, then merge the entity references of the two entities.

[0025] In one possible embodiment, determining whether any two entity references the same identified entity includes:

[0026] Determine whether any two entity mentions belong to a pre-defined identifier library for the same entity, wherein the identifier library includes multiple identifiers for the same entity;

[0027] If any two entity references belong to a pre-defined identifier library for the same entity, it is determined that the entities identified by the two entity references are the same.

[0028] In one possible embodiment, determining whether any two entity references the same identified entity includes:

[0029] Determine whether the attributes of any two entity references match those of the identified entity;

[0030] If any two entities refer to the same entity, it is determined that the two entities refer to the same entity.

[0031] In one possible embodiment, determining the association relationships between entity mentions in the target text, and obtaining the relationships between the entities identified by the entity mentions, includes:

[0032] For every two entity mentions, determine the association between the two entity mentions in the target text, as a predicted association;

[0033] Determine whether the predicted association relationship belongs to a preset association relationship set, wherein the preset association relationship set is a set of categories mentioned for the two entities in advance;

[0034] If the predicted association relationship belongs to the preset association relationship set, it is determined that there is a predicted association relationship between the entities identified by the two entity mentions;

[0035] If the predicted association does not belong to the preset association set, it is determined that there is no association between the entities identified by the two entity mentions.

[0036] In a second aspect of the present invention, a knowledge graph construction apparatus is provided, the apparatus comprising:

[0037] The attribute tagging module is used to tag the target text with attributes, and to determine the various attributes present in the target text and the category of each attribute.

[0038] An entity mention module is used to determine, among the various attributes, attributes of a preset category as entity mentions, wherein the preset category attributes are pre-set attributes that can uniquely identify the described entity;

[0039] The attribute attribution module is used to determine, for each entity mention, the attributes in the target text that are associated with the entity mention but are not entity mentions, and to obtain the attributes of the entity identified by the entity mention;

[0040] The entity association module is used to determine the association relationship between each entity mention in the target text, and to obtain the relationship between the entities identified by each entity mention;

[0041] The knowledge graph construction module is used to construct a knowledge graph based on the attributes of the entities mentioned by each entity and the relationships between the entities mentioned by each entity.

[0042] In one possible embodiment, the attribute tagging module tags the target text by determining the various attributes present in the target text and the categories of each attribute, including:

[0043] The target text is input into a pre-trained attribute labeling model to obtain the attributes present in the target text and the categories of each attribute as output by the attribute labeling model.

[0044] The attribute labeling model includes a first pre-trained sub-model and a labeling sub-model. The input of the first pre-trained sub-model is the text input to the attribute labeling model, and the output is the word vector of each word segment contained in the input text. The input of the labeling sub-model is the word vector of each word segment, and the output is the attributes present in each word segment and the category of the attributes. The first pre-trained sub-model is trained through unsupervised learning.

[0045] In one possible embodiment, the attribute attribution module, for each entity mention, determines the attributes in the target text that are associated with the entity mention but are not entity mentions themselves, thereby obtaining the attributes of the entity identified by the entity mention, including:

[0046] For each entity mention and each attribute not mentioned by an entity, the entity mention, the attribute, and the target text are input into a pre-trained relation judgment model to obtain a first output result from the relation judgment model. The first output result is used to represent the association relationship between the entity mention and the attribute in the target text.

[0047] If the first output result indicates that the entity mention is associated with the attribute, then the attribute is determined to be an attribute of the entity identified by the entity mention;

[0048] Determining the association relationships between entity mentions in the target text, and obtaining the relationships between the entities identified by the entity mentions, includes:

[0049] For every two entity mentions, the two entity mentions and the target text are input into the relationship judgment model to obtain a second output result of the relationship judgment model. The second output result is used to represent the association relationship between the two entity mentions in the target text.

[0050] Based on the association relationship represented by the second output result, determine the association relationship between the two entities mentioned in the entity references;

[0051] The relation judgment model includes a second pre-trained sub-model and a judgment sub-model. The input of the second pre-trained sub-model is the text input to the relation judgment model, and the output is the word vector of each word segment contained in the input text. The input of the judgment sub-model is the word vector of each word segment and the attributes input to the relation judgment model, and the output is the association relationship between the attributes input to the relation judgment model. The second pre-trained sub-model is trained through unsupervised learning.

[0052] In one possible embodiment, the device further includes an entity fusion module for determining whether any two entity references identify the same entity;

[0053] If any two entity references identify the same entity, then merge the entity references of the two entities.

[0054] In one possible embodiment, the entity fusion module determines whether any two entity references identify the same entity, including:

[0055] Determine whether any two entity mentions belong to a pre-defined identifier library for the same entity, wherein the identifier library includes multiple identifiers for the same entity;

[0056] If any two entity references belong to a pre-defined identifier library for the same entity, it is determined that the entities identified by the two entity references are the same.

[0057] In one possible embodiment, the entity fusion module determines whether any two entity references identify the same entity, including:

[0058] Determine whether the attributes of any two entity references match those of the identified entity;

[0059] If any two entities refer to the same entity, it is determined that the two entities refer to the same entity.

[0060] In one possible embodiment, the entity association module determines the association relationships between entity mentions in the target text, obtaining the relationships between the entities identified by the entity mentions, including:

[0061] For every two entity mentions, determine the association between the two entity mentions in the target text, as a predicted association;

[0062] Determine whether the predicted association relationship belongs to a preset association relationship set, wherein the preset association relationship set is a set of categories mentioned for the two entities in advance;

[0063] If the predicted association relationship belongs to the preset association relationship set, it is determined that there is a predicted association relationship between the entities identified by the two entity mentions;

[0064] If the predicted association does not belong to the preset association set, it is determined that there is no association between the entities identified by the two entity mentions.

[0065] In a third aspect of the present invention, an electronic device is provided, comprising:

[0066] Memory, used to store computer programs;

[0067] When a processor executes a program stored in memory, it implements any of the steps described in the first aspect above.

[0068] In a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when executed by a processor, the computer program implements the steps of any of the methods described in the first aspect above.

[0069] Beneficial effects of the embodiments of the present invention:

[0070] The knowledge graph construction method, apparatus, and electronic device provided in this invention can comprehensively mark all attributes existing in a target text through attribute tagging, and distinguish and mark entities existing in the target text by setting preset category attributes as entity mentions. Then, by judging the relationship between entity mentions and attributes, and between entity mentions themselves, the entity to which each attribute belongs, and the relationship between entities, are determined. Because this invention first tags attributes and then combines attributes based on the relationships between attributes to obtain entity attributes and the relationships between entities, even if an attribute exists in isolation in the target text, it can be tagged and reflected in the constructed knowledge graph. Therefore, the information in the constructed knowledge graph is more comprehensive.

[0071] Of course, implementing any product or method of the present invention does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0072] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.

[0073] Figure 1 This is a schematic flowchart of a knowledge graph construction method provided in an embodiment of the present invention;

[0074] Figure 2 This is a schematic diagram of the structure of an attribute tagging model provided in an embodiment of the present invention;

[0075] Figure 3 A schematic diagram of a relationship judgment model provided in an embodiment of the present invention;

[0076] Figure 4 This is another flowchart illustrating the knowledge graph construction method provided in an embodiment of the present invention;

[0077] Figure 5 A schematic diagram of a knowledge graph construction device provided in an embodiment of the present invention;

[0078] Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0079] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of the present invention.

[0080] See Figure 1 , Figure 1 The diagram shown is a flowchart of a knowledge graph construction method provided by an embodiment of the present invention, which may include:

[0081] S101, perform attribute tagging on the target text to determine the various attributes present in the target text and the category of each attribute.

[0082] S102, among the various attributes, determine the attribute whose category is a preset category, and mention it as an entity.

[0083] S103, for each entity mention, determine the attributes in the target text that are associated with the entity mention but are not entity mentions, and obtain the attributes of the entity identified by the entity mention.

[0084] S104, determine the association relationship of each entity mention in the target text, and obtain the relationship between the entities identified by each entity mention.

[0085] S105, construct a knowledge graph based on the attributes of the entities mentioned by each entity and the relationships between the entities mentioned by each entity.

[0086] Using this embodiment, all attributes present in the target text can be comprehensively marked using attribute tagging. Entities present in the target text are distinguished by setting preset categories of attributes as entity mentions. Then, by judging the relationships between entity mentions and attributes, and between entity mentions themselves, the entity to which each attribute belongs, as well as the relationships between entities, are determined. Because this embodiment of the invention first tags attributes and then combines attributes based on the relationships between attributes to obtain entity attributes and relationships between entities, even if an attribute exists in isolation in the target text, it can be tagged and reflected in the constructed knowledge graph. Therefore, the information in the constructed knowledge graph is more comprehensive.

[0087] In S101, the target text can be unstructured text, such as books or papers in a specific field. An attribute is a feature of an entity in a certain dimension; for example, attributes could be [Age: 18], [Place of Residence: Hangzhou], [Gender: Male], [Name: Zhang San], etc. The category of an attribute is the dimension it represents. For example, attributes [Age: 18] and [Age: 28] both represent features in the dimension of age, therefore [Age: 18] and [Age: 28] have the same category. However, attributes [Age: 18] and [Name: Zhang San] represent features in different dimensions, therefore [Age: 18] and [Name: Zhang San] are attributes of different categories.

[0088] The methods for attribute tagging will be explained in detail below, and will not be repeated here.

[0089] In S102, the attributes of the preset category are pre-set attributes that can uniquely identify the described entity. It is understood that the entities involved may be different in different application scenarios, and the attributes of different categories can uniquely identify the described entity. Therefore, the attributes of the preset category may be different in different possible application scenarios.

[0090] For example, assuming the entities involved in the target text include employees and departments within a company, for employees, since both name and employee ID can uniquely identify an employee, the attribute category [Name] or attribute category [Employee ID] can be pre-set as a default category. For departments, since the department name can uniquely identify a department, the attribute category [Department Name] can be pre-set as a default category.

[0091] Furthermore, assuming the entities involved in the target text include employees from multiple different companies, then for each employee, there might be employees with the same employee number in different companies. Therefore, the employee number cannot uniquely identify an employee. Thus, the attribute category [Name] can be pre-set as a default category. Also, since the company name can uniquely identify a company, the attribute category [Company Name] can be pre-set as a default category.

[0092] It is understandable that, since the attributes of the preset categories are pre-defined attributes that can uniquely identify the described entity, entity mentions can uniquely identify the entity. For example, without considering the existence of people with the same name, assuming that the attribute [Name: Zhang San] is an entity mention, the attribute [Name: Zhang San] can obviously uniquely identify a person.

[0093] In S103, for ease of description, attributes not mentioned by an entity will be referred to as characteristic attributes to distinguish them from entity mentions in attributes. If an entity mention is associated with a characteristic attribute, it can be considered that the characteristic attribute and the entity mention are used to describe the same entity. Since an entity mention can uniquely identify the entity it describes, the characteristic attribute can be considered to describe the attribute identified by the entity mention.

[0094] For example, assuming that the entity mention [Name: Zhang San] is associated with the characteristic attribute [Age: 18], then the characteristic attribute [Age: 18] can be considered to describe the entity identified by the entity mention [Name: Zhang San], that is, the person identified by the entity mention [Name: Zhang San] has the characteristic attribute [Age: 18].

[0095] It can be done by iterating through each entity mention-feature attribute pair, determining whether the entity mention involved in the entity mention-feature attribute pair is related to the feature attribute, and if the entity mention involved in the entity mention-feature attribute pair is related to the feature attribute, then the feature attribute is determined as the attribute of the entity identified by the entity mention.

[0096] The method for determining whether an entity mention is related to a feature attribute will be explained in detail below, and will not be repeated here.

[0097] In S104, as analyzed above, since entity mentions can uniquely identify entities, theoretically two different entity mentions identify different entities. Therefore, when two entity mentions are associated in the target text, it can be assumed that the entities identified by the two entity mentions are associated. Thus, the relationship between the entities identified by each entity mention can be obtained based on the association relationship of each entity mention in the target text.

[0098] For example, assuming that entity mentions [Name: Zhang San] and entity mentions [Name: Li Si] have a friendship relationship in the target text, then it can be assumed that the person identified by entity mentions [Name: Zhang San] and the person identified by entity mentions [Name: Li Si] have a friendship relationship.

[0099] In S105, nodes can be created for the entities identified by each entity mention, and edges can be established between the nodes based on the attributes of the entities identified by each entity mention and the entities identified by each entity mention, thereby obtaining a knowledge graph.

[0100] To more clearly illustrate the knowledge graph construction method provided in the embodiments of the present invention, the attribute tagging process will be described below:

[0101] In one possible embodiment, the target text can be input into a pre-trained attribute tagging model to obtain the various attributes present in the target text and the categories of each attribute as output by the attribute tagging model.

[0102] It is understandable that training an attribute labeling model requires a large number of sample texts labeled with attributes and attribute categories, and labeling the sample text with attributes and attribute categories requires a lot of human resources.

[0103] Based on this, in another possible embodiment, the attribute tagging model can be as follows: Figure 2 As shown, the model includes a first pre-trained sub-model 201 and a tagging sub-model 202. The input of the first pre-trained sub-model 201 is the text input to the attribute tagging model, and the output is the word vectors of each word segment contained in the input text. The input of the tagging sub-model 202 is the word vectors of each word segment, and the output is the attributes present in each word segment and the category of the attributes. The first pre-trained sub-model 201 is trained through unsupervised learning.

[0104] By using this embodiment, the attribute labeling model can be divided into a first pre-trained sub-model and a labeling sub-model. This separates the portion of the attribute labeling model that can be trained through unsupervised learning, thus requiring only supervised training of the labeling sub-model. Since the labeling sub-model is a smaller part of the attribute labeling model, the amount of sample text required for supervised training of the labeling sub-model is less than that required for supervised training of the entire attribute labeling model. Therefore, the labor cost of training the attribute labeling model can be effectively reduced.

[0105] To more clearly illustrate the knowledge graph construction method provided in the embodiments of the present invention, the following will explain how to determine whether entity mentions are associated with feature attributes and whether entity mentions are associated with each other:

[0106] In one possible embodiment, determining whether an entity mention and a feature attribute are related can be achieved by inputting the target text, the entity mention, and the feature attribute into a pre-trained relationship determination model, and obtaining a first output result from the relationship determination model. The first output result represents the relationship between the entity mention and the feature attribute in the target text.

[0107] To determine whether two entity mentions are related, the target text and two entity mentions can be input into the relationship determination model, yielding a second output result. This second output result represents the relationship between the two entity mentions within the target text.

[0108] It is understandable that training a relationship judgment model requires a large number of labeled sample texts and sample attribute pairs with related relationships, and labeling the sample texts with related relationships requires a lot of manpower.

[0109] Based on this, in another possible embodiment, the relationship judgment model can be as follows: Figure 3 As shown, it includes a second pre-trained sub-model 301 and a judgment sub-model 302. The input of the second pre-trained sub-model 301 is the text input to the relation judgment model, and the output is the word vector of each word segment contained in the input text. The input of the judgment sub-model 302 is the word vector of each word segment and the attributes input to the relation judgment model, and the output is the association relationship between the attributes input to the relation judgment model. The second pre-trained sub-model 301 is trained through unsupervised learning.

[0110] By using this embodiment, the relation judgment model can be divided into a second pre-trained sub-model and a judgment sub-model. This separates the part of the relation judgment model that can be trained through unsupervised learning, thus requiring only supervised training of the judgment sub-model. Since the judgment sub-model is part of the attribute labeling model and its size is smaller than the relation judgment model, the amount of sample text required for supervised training of the judgment sub-model is less than that required for supervised training of the entire relation judgment model. Therefore, the labor cost of training the relation judgment model can be effectively reduced.

[0111] The aforementioned first and second pre-trained sub-models can be two different models or the same model. When the first and second pre-trained sub-models are the same model, since the attribute labeling model and the relation judgment model can reuse the same sub-models, the computational resources required to train the attribute labeling model and the relation judgment model can be reduced.

[0112] The unsupervised learning methods used to train the first and second pre-trained sub-models can vary depending on the application scenario. For example, unsupervised learning methods may include, but are not limited to, BERT (an unsupervised learning method), ALBERT (an unsupervised learning method), and GPT (an unsupervised learning method).

[0113] When training the first pre-trained sub-model and / or the second pre-trained sub-model, unsupervised learning can be performed using text from the relevant domain, so that the trained first pre-trained sub-model and / or the second pre-trained sub-model can learn the word segmentation rules and grammar in the text from the relevant domain.

[0114] Understandably, although in theory an entity reference can uniquely identify an entity, in practice an entity may have multiple entity references. For example, a person named Zhang San may have entity references such as [Name: Zhang San] and [Name: Xiao Zhang]. Therefore, the attributes and relationships of an entity may be distributed among multiple entities.

[0115] For example, suppose the entity mention [Name: Zhang San] is associated with the feature attribute [Age: 18], and the entity mention [Name: Xiao Zhang] is associated with the feature attribute [Address: Hangzhou City]. Then, the constructed knowledge graph will contain two entities: one entity is a person named Zhang San with an age of 18, and the other entity is a person named Xiao Zhang with an address in Hangzhou City.

[0116] According to this knowledge graph, relevant personnel may not be able to directly obtain the information that Zhang San lives in Hangzhou. Further integration of information from the knowledge graph is required to confirm this, making the process rather cumbersome.

[0117] Based on this, in one possible embodiment, it can be as follows: Figure 4 As shown, Figure 4 The diagram shown is another flowchart illustrating the knowledge graph construction method provided in this embodiment of the invention, which may include:

[0118] S401, perform attribute tagging on the target text to determine the various attributes present in the target text and the category of each attribute.

[0119] This step is the same as S101 mentioned above, and you can refer to the relevant explanation of S101 mentioned above, so it will not be repeated here.

[0120] S402, among the various attributes, the attribute whose category is determined to be a preset category is mentioned as an entity.

[0121] This step is the same as S102 mentioned above. Please refer to the relevant explanation of S101 mentioned above. It will not be repeated here.

[0122] S403, for each entity mention, determine the attributes in the target text that are associated with the entity mention but are not entity mentions, and obtain the attributes of the entity identified by the entity mention.

[0123] This step is the same as S103 mentioned above, and you can refer to the relevant explanation of S103 mentioned above, so it will not be repeated here.

[0124] S404, determine the association relationship of each entity mention in the target text, and obtain the relationship between the entities identified by each entity mention.

[0125] This step is the same as S104 mentioned above, and you can refer to the relevant explanation of S104 mentioned above, so it will not be repeated here.

[0126] S405, determine whether any two entity references identify the same entity.

[0127] The method for determining whether the entities identified by entity mentions are the same varies depending on the application scenario. For example, in one possible embodiment, an identifier library may be pre-established, and different entity mentions used to identify the same entity may be stored in the identifier library. When determining whether the entities identified by two entity mentions are the same, the metadata database may be searched to determine whether the entities identified by the two entity mentions are the same.

[0128] It is understandable that the identifier database may not contain all entity mentions that identify the same entity. Therefore, in some scenarios, it may not be possible to accurately determine whether the entities identified by the entity mentions are the same based on the metadata database.

[0129] Based on this, in one possible embodiment, it can be determined whether the attributes of any two entities referencing the identified entity match. If the attributes of any two entities referencing the identified entity match, then it is determined that the entities identified by the two entities are the same.

[0130] For example, the attributes of the entities identified by the two entity mentions can be converted into feature vectors, and the similarity between the feature vectors obtained based on the attribute conversion of the two entities can be calculated. If the similarity is greater than a preset similarity threshold, the entities identified by the two entity mentions are considered to be the same. If the similarity is not greater than the preset similarity threshold, the entities identified by the two entity mentions are considered to be different.

[0131] S406, if any two entity references identify the same entity, merge the entities identified by the two entity references.

[0132] Merging two entity references refers to combining the attributes and relationships of the entities identified by the two entity references. For example, suppose one entity is a person named Zhang San who is 18 years old, and the other entity is a person named Xiao Zhang who is a friend of Li Si. Then the merged entity is a person named Zhang San or Xiao Zhang who is 18 years old and is a friend of Li Si.

[0133] S407, construct a knowledge graph based on the attributes of the entities mentioned by each entity and the relationships between the entities mentioned by each entity.

[0134] This step is the same as S105 mentioned above, and you can refer to the relevant explanation of S105 mentioned above, so it will not be repeated here.

[0135] By using this embodiment, information about the same entity in the knowledge graph can be integrated by merging entities, which facilitates subsequent processing.

[0136] In some application scenarios, the identified relationships between entity mentions may not be accurate enough. For example, in the identified relationships, entity mention [Name: Zhang San] and entity mention [City: Hangzhou] are friends, but in reality, the person identified by entity mention [Name: Zhang San] and the city identified by entity mention [City: Hangzhou] should be a residential relationship.

[0137] Based on this, in one possible embodiment, when determining the association between entity mentions, for each pair of entity mentions, the association between the two entity mentions in the target text can be determined as a predicted association. It is then determined whether the predicted association belongs to a preset association set, where the preset association set is pre-set for the categories of the two entity mentions. If the predicted association belongs to the preset association set, it is determined that the predicted association exists between the entities identified by the two entity mentions; otherwise, if the predicted association does not belong to the preset association set, it is determined that there is no association between the entities identified by the two entity mentions.

[0138] For example, a preset set of association relationships can be set in advance for the attribute category [Name] and the attribute category [City Name]. Since the relationship between a person and a city may be a relationship such as address, place of origin, or former residence, the preset set of association relationships may include relationships such as address, place of origin, and former residence.

[0139] If the entity mentions [Name: Zhang San] and the entity mentions [City: Hangzhou] are friends in the determined association relationship, that is, the predicted association relationship is a friend relationship, then since the friend relationship does not belong to the preset association relationship set for attribute category [Name] and attribute category [City], it can be considered that the determined association relationship is inaccurate. Therefore, it is determined that the entity mentions [Name: Zhang San] and the entity mentions [City: Hangzhou] do not have an association relationship.

[0140] If the entity mentions [Name: Zhang San] and the entity mentions [City Name: Hangzhou] in the determined association relationship is a place of origin relationship, that is, the predicted association relationship is a place of origin relationship, then since the place of origin relationship belongs to the preset association relationship set for the attribute category [Name] and the attribute category [City Name], the determined association relationship can be considered accurate. Therefore, it is determined that the entity mentions [Name: Zhang San] and the entity mentions [City Name: Hangzhou] have a place of origin relationship.

[0141] See Figure 5 , Figure 5The diagram shown is a structural schematic of a knowledge graph construction device provided in an embodiment of the present invention, which may include:

[0142] The attribute tagging module 501 is used to tag the target text with attributes and determine the various attributes present in the target text and the category of each attribute.

[0143] Entity mention module 502 is used to determine the attribute with a preset category among the various attributes as an entity mention, wherein the attribute with the preset category is a pre-set attribute that can uniquely identify the described entity;

[0144] The attribute attribution module 503 is used to determine, for each entity mention, the attributes in the target text that are associated with the entity mention but are not entity mentions, and to obtain the attributes of the entity identified by the entity mention;

[0145] The entity association module 504 is used to determine the association relationship of each entity mention in the target text, and to obtain the relationship between the entities identified by each entity mention;

[0146] The knowledge graph construction module 505 is used to construct a knowledge graph based on the attributes of the entities mentioned by each entity and the relationships between the entities mentioned by each entity.

[0147] In one possible embodiment, the attribute tagging module 501 tags the target text by determining the various attributes present in the target text and the categories of each attribute, including:

[0148] The target text is input into a pre-trained attribute labeling model to obtain the attributes present in the target text and the categories of each attribute as output by the attribute labeling model.

[0149] The attribute labeling model includes a first pre-trained sub-model and a labeling sub-model. The input of the first pre-trained sub-model is the text input to the attribute labeling model, and the output is the word vector of each word segment contained in the input text. The input of the labeling sub-model is the word vector of each word segment, and the output is the attributes present in each word segment and the category of the attributes. The first pre-trained sub-model is trained through unsupervised learning.

[0150] In one possible embodiment, the attribute attribution module 503, for each entity mention, determines the attributes in the target text that are associated with the entity mention but are not entity mentions themselves, thereby obtaining the attributes of the entity identified by the entity mention, including:

[0151] For each entity mention and each attribute not mentioned by an entity, the entity mention, the attribute, and the target text are input into a pre-trained relation judgment model to obtain a first output result from the relation judgment model. The first output result is used to represent the association relationship between the entity mention and the attribute in the target text.

[0152] If the first output result indicates that the entity mention is associated with the attribute, then the attribute is determined to be an attribute of the entity identified by the entity mention;

[0153] The entity association module 504 determines the association relationship between each entity mention in the target text, and obtains the relationship between the entities identified by each entity mention, including:

[0154] For every two entity mentions, the two entity mentions and the target text are input into the relationship judgment model to obtain a second output result of the relationship judgment model. The second output result is used to represent the association relationship between the two entity mentions in the target text.

[0155] Based on the association relationship represented by the second output result, determine the association relationship between the two entities mentioned in the entity references;

[0156] The relation judgment model includes a second pre-trained sub-model and a judgment sub-model. The input of the second pre-trained sub-model is the text input to the relation judgment model, and the output is the word vector of each word segment contained in the input text. The input of the judgment sub-model is the word vector of each word segment and the attributes input to the relation judgment model, and the output is the association relationship between the attributes input to the relation judgment model. The second pre-trained sub-model is trained through unsupervised learning.

[0157] In one possible embodiment, the device further includes an entity fusion module for determining whether any two entity references identify the same entity;

[0158] If any two entity references identify the same entity, then merge the entity references of the two entities.

[0159] In one possible embodiment, the entity fusion module determines whether any two entity references identify the same entity, including:

[0160] Determine whether any two entity mentions belong to a pre-defined identifier library for the same entity, wherein the identifier library includes multiple identifiers for the same entity;

[0161] If any two entity references belong to a pre-defined identifier library for the same entity, it is determined that the entities identified by the two entity references are the same.

[0162] In one possible embodiment, the entity fusion module determines whether any two entity references identify the same entity, including:

[0163] Determine whether the attributes of any two entity references match those of the identified entity;

[0164] If any two entities refer to the same entity, it is determined that the two entities refer to the same entity.

[0165] In one possible embodiment, the entity association module 504 determines the association relationship between entity mentions in the target text, obtaining the relationship between the entities identified by the entity mentions, including:

[0166] For every two entity mentions, determine the association between the two entity mentions in the target text, as a predicted association;

[0167] Determine whether the predicted association relationship belongs to a preset association relationship set, wherein the preset association relationship set is a set of categories mentioned for the two entities in advance;

[0168] If the predicted association relationship belongs to the preset association relationship set, it is determined that there is a predicted association relationship between the entities identified by the two entity mentions;

[0169] If the predicted association does not belong to the preset association set, it is determined that there is no association between the entities identified by the two entity mentions.

[0170] This invention also provides an electronic device, such as... Figure 6 As shown, it includes:

[0171] Memory 601 is used to store computer programs;

[0172] When processor 602 executes a program stored in memory 601, it performs the following steps:

[0173] The target text is tagged with attributes to determine the various attributes present in the target text and the categories of each attribute;

[0174] Among the various attributes, attributes of a preset category are identified as entity references, wherein the preset category attributes are pre-set attributes that can uniquely identify the described entity;

[0175] For each entity mention, identify the attributes in the target text that are associated with the entity mention but are not entity mentions, and obtain the attributes of the entity identified by the entity mention;

[0176] Determine the relationships between the entity references in the target text to obtain the relationships between the entities identified by the entity references;

[0177] A knowledge graph is constructed based on the attributes of the entities mentioned by each entity and the relationships between the entities mentioned by each entity.

[0178] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0179] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0180] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0181] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0182] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the knowledge graph construction methods described above.

[0183] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the knowledge graph construction methods described above.

[0184] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

[0185] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0186] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, embodiments of devices, electronic devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0187] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A method for constructing a knowledge graph, characterized in that, The method includes: The target text is tagged with attributes to determine the various attributes present in the target text and the categories of each attribute; Among the various attributes, attributes of a preset category are identified as entity references, wherein the preset category attributes are pre-set attributes that can uniquely identify the described entity; For each entity mention and each attribute not mentioned by an entity, the entity mention, the attribute, and the target text are input into a pre-trained relation judgment model to obtain a first output result from the relation judgment model. The first output result is used to represent the association relationship between the entity mention and the attribute in the target text. If the first output result indicates that there is an association relationship between the entity mention and the attribute, the attribute is determined to be an attribute of the entity identified by the entity mention. For each pair of entity mentions, the two entity mentions and the target text are input into the relationship judgment model to obtain a second output result. The second output result represents the association relationship between the two entity mentions in the target text. Based on the association relationship represented by the second output result, the association relationship between the entities identified by the two entity mentions is determined. The relationship judgment model includes a second pre-trained sub-model and a judgment sub-model. The input of the second pre-trained sub-model is the text input to the relationship judgment model, and the output is the word vectors of each word segment contained in the input text. The input of the judgment sub-model is the word vectors of each word segment and the attributes input to the relationship judgment model, and the output is the association relationship between the attributes input to the relationship judgment model. The second pre-trained sub-model is trained through unsupervised learning. A knowledge graph is constructed based on the attributes of the entities mentioned by each entity and the relationships between the entities mentioned by each entity.

2. The method according to claim 1, characterized in that, The step of attribute tagging the target text, determining the various attributes present in the target text and the categories of each attribute, includes: The target text is input into a pre-trained attribute labeling model to obtain the attributes present in the target text and the categories of each attribute as output by the attribute labeling model. The attribute labeling model includes a first pre-trained sub-model and a labeling sub-model. The input of the first pre-trained sub-model is the text input to the attribute labeling model, and the output is the word vector of each word segment contained in the input text. The input of the labeling sub-model is the word vector of each word segment, and the output is the attributes present in each word segment and the category of the attributes. The first pre-trained sub-model is trained through unsupervised learning.

3. The method according to claim 1, characterized in that, After constructing the knowledge graph based on the attributes of the entities identified by each entity mentions and the relationships between the entities identified by each entity mentions, the method further includes: Determine whether any two entity references identify the same entity; If any two entity references identify the same entity, then merge the entity references of the two entities.

4. The method according to claim 3, characterized in that, The determination of whether any two entity references the same entity includes: Determine whether any two entity mentions belong to a pre-defined identifier library for the same entity, wherein the identifier library includes multiple identifiers for the same entity; If any two entity references belong to a pre-defined identifier library for the same entity, it is determined that the entities identified by the two entity references are the same.

5. The method according to claim 3, characterized in that, The determination of whether any two entity references the same entity includes: Determine whether the attributes of any two entity references match those of the identified entity; If any two entities refer to the same entity, it is determined that the two entities refer to the same entity.

6. A knowledge graph construction device, characterized in that, The device includes: The attribute tagging module is used to tag the target text with attributes, and to determine the various attributes present in the target text and the category of each attribute. An entity mention module is used to determine, among the various attributes, attributes of a preset category as entity mentions, wherein the preset category attributes are pre-set attributes that can uniquely identify the described entity; The attribute attribution module is used to determine, for each entity mention, the attributes in the target text that are associated with the entity mention but are not entity mentions, and to obtain the attributes of the entity identified by the entity mention; The entity association module is used to determine the association relationship between each entity mention in the target text, and to obtain the relationship between the entities identified by each entity mention; The knowledge graph construction module is used to construct a knowledge graph based on the attributes of the entities mentioned by each entity and the relationships between the entities mentioned by each entity. For each entity mention, the attribute attribution module determines the attributes in the target text that are associated with the entity mention but are not entity mentions themselves, thus obtaining the attributes of the entity identified by the entity mention, including: For each entity mention and each attribute not mentioned by an entity, the entity mention, the attribute, and the target text are input into a pre-trained relation judgment model to obtain a first output result from the relation judgment model. The first output result is used to represent the association relationship between the entity mention and the attribute in the target text. If the first output result indicates that the entity mention is associated with the attribute, then the attribute is determined to be an attribute of the entity identified by the entity mention; Determining the association relationships between entity mentions in the target text, and obtaining the relationships between the entities identified by the entity mentions, includes: For every two entity mentions, the two entity mentions and the target text are input into the relationship judgment model to obtain a second output result of the relationship judgment model. The second output result is used to represent the association relationship between the two entity mentions in the target text. Based on the association relationship represented by the second output result, determine the association relationship between the two entities mentioned in the entity references; The relation judgment model includes a second pre-trained sub-model and a judgment sub-model. The input of the second pre-trained sub-model is the text input to the relation judgment model, and the output is the word vectors of each word segment contained in the input text. The input of the judgment sub-model is the word vectors of each word segment and the attributes input to the relation judgment model, and the output is the association relationship between the attributes input to the relation judgment model. The second pre-trained sub-model is learned through unsupervised learning.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-5.

Citation Information

Patent Citations

  • Entity alignment method and device, equipment and medium

    CN110795572A

  • Text data processing method, apparatus and device, and medium

    CN110909546A

  • Knowledge graph construction method and device

    CN111061841A

  • Diabetic foot knowledge graph generation method and device and readable storage medium

    CN111341456A

  • Knowledge graph questioning and answering method and device based on deep learning technology, and equipment

    CN111506722A