Knowledge graph construction method and device based on entity chain and storage medium

By combining the target large language model and graph neural network, the problem of insufficient accuracy in knowledge graph construction in existing technologies is solved, accurate identification and fusion of entities and relationships are achieved, and the adaptability of knowledge graphs is expanded.

CN120409640BActive Publication Date: 2025-10-21TUPU INTELLIGENT TECH (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510490338.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-10-21
Estimated Expiration
2045-04-18

AI Technical Summary

Technical Problem

In the existing technology, the extracted entities and relationships are linked to the knowledge graph ontology model by manually reviewing and establishing mapping relationships, which is highly subjective and leads to poor accuracy in knowledge graph construction.

Method used

The fine-tuned target large language model is used to obtain candidate entities and relationships from text data. The rationality of entities and relationships is verified using a graph neural network. Entity and relationship chaining are then processed through the graph neural network. Unsuccessful chained entities and relationships are expanded to construct the final knowledge graph.

Benefits of technology

It improves the accuracy and adaptability of knowledge graph construction, ensures the accuracy of entity and relationship identification and extraction, and realizes the effective integration and expansion of knowledge graph and ontology model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409640B_ABST
    Figure CN120409640B_ABST
Patent Text Reader

Abstract

The application relates to a knowledge graph construction method and device based on entity chain indication, a storage medium and electronic equipment, and relates to the technical field of knowledge graphs. The method comprises the following steps: performing relationship extraction on each candidate entity to obtain at least one target relationship; performing rationality verification on each target entity in an entity combination and the corresponding target relationship; after the rationality verification is passed, performing entity chain indication processing on each target entity and an entity category in a knowledge graph ontology model based on a preset graph neural network, and performing relationship chain indication processing on each target relationship and a relationship type in the knowledge graph ontology model to obtain a knowledge graph ontology model after chain indication; and based on a target entity and a target relationship that are not successfully indicated, the knowledge graph ontology model after chain indication is expanded to obtain a final knowledge graph corresponding to the text data to be analyzed. The application has the effect of improving the accuracy of knowledge graph construction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of knowledge graph technology, and specifically to a method, device and storage medium for constructing a knowledge graph based on entity chaining. Background Art

[0002] In the fields of modern artificial intelligence and big data, knowledge graphs, as structured semantic networks, have become a crucial enabler for applications such as information processing, intelligent search, and question-answering systems. They represent and store real-world knowledge through nodes (entities) and edges (relationships), enabling efficient storage, querying, and reasoning of complex information. However, building accurate knowledge graphs still faces a series of technical challenges. Constructing a knowledge graph requires not only extracting entities and relationships but also linking these extracted entities and relationships to the knowledge graph ontology model. This linking process is crucial for accurately constructing a knowledge graph.

[0003] At present, the commonly used method for linking the extracted entities and relationships with the knowledge graph ontology model is: based on manual review, a mapping relationship is established between the extracted entities and relationships and the knowledge graph ontology model, and finally the linking of entities and relationships is completed based on the mapping relationship. However, in this method, the mapping relationship is established through manual review, which is highly subjective, resulting in a large deviation in the linking, and causing the final constructed knowledge graph to have poor accuracy. Summary of the Invention

[0004] In order to improve the accuracy of knowledge graph construction, the present application provides a knowledge graph construction method, device, storage medium and electronic device based on entity chain reference.

[0005] In a first aspect of the present application, a method for constructing a knowledge graph based on entity chaining is provided, which specifically includes:

[0006] Obtain at least one candidate entity from the text data to be analyzed using the fine-tuned target large language model, and construct a knowledge graph ontology model corresponding to the text data to be analyzed;

[0007] Performing relationship extraction on each of the candidate entities to obtain at least one target relationship, determining the candidate entities corresponding to the target relationship as target entities and aggregating them into an entity combination;

[0008] Performing a rationality check on each target entity and the corresponding target relationship in the entity combination. After passing the rationality check, based on a preset graph neural network, performing entity linking processing on each target entity and the entity category in the knowledge graph ontology model, and performing relationship linking processing on each target relationship and the relationship type in the knowledge graph ontology model, to obtain a linked knowledge graph ontology model;

[0009] Based on the target entities and target relationships that were not successfully linked, the knowledge graph ontology model after the linking is expanded to obtain the final knowledge graph corresponding to the text data to be analyzed.

[0010] By adopting the above technical solution, the target large language model is used to more accurately identify candidate entities and extract target relationships from the text data to be analyzed. The identified target entities and the target relationships between the target entities are then verified, thereby ensuring the accuracy of the identified entities and extracted relationships to a certain extent, and thus paving the way for the subsequent construction of an accurate knowledge graph. Furthermore, based on the graph neural network, entity chaining and relationship chaining can be performed for the target entities and target relationships respectively, so that the target entities and target relationships can be better integrated with the knowledge graph ontology model. At the same time, based on the target entities and target relationships that were not successfully chained, the entity categories and relationship types of the knowledge graph ontology model after chaining are expanded, so that it can better adapt to new knowledge, thereby making the final constructed knowledge graph more accurate.

[0011] Optionally, performing rationality check on each target entity and the corresponding target relationship in the entity combination specifically includes:

[0012] Obtaining historical entities that have a relationship with a single target entity in the entity combination in the constructed knowledge graph of historical text data, counting the first occurrence count of each historical entity, and selecting a first number of historical entities from each historical entity in descending order of the first occurrence count to determine as key entities, wherein the historical text data is text data in the same field as the text data to be analyzed;

[0013] Obtaining historical relationships between a single key entity and a corresponding target entity, counting a second number of occurrences of each of the historical relationships, and selecting a second number of historical relationships from each of the historical relationships in descending order of the second number of occurrences as key relationships corresponding to the single key entity;

[0014] Determine a first weight for each of the key entities and a second weight for the key relationship corresponding to each of the key entities, wherein the first weight is a ratio of a first occurrence count of each key entity to a sum of first occurrence counts of all key entities, and the second weight is a ratio of a second occurrence count of a single key relationship corresponding to the key entity to a sum of second occurrence counts of all corresponding key relationships;

[0015] A rationality check is performed on each target entity and the corresponding target relationship in the entity combination according to the first weight and the second weight.

[0016] By employing this technical solution, the greater the number of first occurrences, the more likely the corresponding historical entity in the analyzed text data is to have a relationship with the target entity, thereby determining the key entity. The greater the number of second occurrences, the more likely a single key entity is to have a corresponding historical relationship with the target entity, thereby determining the key relationship. Finally, combining the first and second weights, the specific circumstances of the relationships between the target entities in the entity combination are analyzed, thereby more accurately verifying the rationality of each target entity and its corresponding target relationship.

[0017] Optionally, performing rationality verification on each target entity and the corresponding target relationship in the entity combination according to the first weight and the second weight specifically includes:

[0018] Obtain at least one other candidate entity that has a relationship with a single target entity in the entity combination and corresponding other relationships;

[0019] When the other candidate entities are focus entities, the corresponding other candidate entities are determined as reference entities, and when the other relationships corresponding to the reference entities are focus relationships, the other relationships corresponding to the reference entities are determined as reference relationships;

[0020] If the reference relationship exists in each key relationship corresponding to the reference entity, calculating a first product of a first weight of the reference entity and a second weight of the corresponding reference relationship;

[0021] Summing each of the first products to obtain a sum of first products of the corresponding target entities, and selecting a maximum sum of first products from the sums of the first products of the target entities in the entity combination;

[0022] If the sum of the largest first products is greater than a preset first threshold, determining the target entity corresponding to the sum of the largest first products as the first entity, determining the remaining target entities as the second entity, and determining that the rationality check of the first entity passes;

[0023] Based on the first entity, a rationality check is performed on the second entity, and a rationality check is performed on the target relationship between the first entity and the second entity.

[0024] By adopting the above technical solution, the larger the sum of the first products, the higher the overall rationality of the entity relationship between the target entity and other candidate entities, indicating a higher accuracy in identifying the target entity itself. When the maximum sum of the first products is greater than a preset first threshold, indicating a high accuracy in identifying the corresponding target entity, the target entity corresponding to the maximum sum of the first products is determined to be the first entity, and the rationality check of the first entity is determined to have passed. Finally, using the first entity as a reference, the rationality check of the second entity is more accurately performed, and the rationality check of the target relationship between the first and second entities is also performed.

[0025] Optionally, performing a rationality check on the second entity based on the first entity and performing a rationality check on the target relationship between the first entity and the second entity specifically includes:

[0026] Determine the target relationship between the first entity and the second entity as a relationship to be verified, and when the relationship to be verified exists in each key relationship corresponding to a single key entity that is likely to have a relationship with the first entity, determine the corresponding key entity as an entity to be analyzed;

[0027] Calculating a second product of the first weight of each of the entities to be analyzed and the second weight of the corresponding relationship to be verified, and selecting a maximum second product from the second products;

[0028] When the maximum second product is greater than a preset second threshold, the entity to be analyzed corresponding to the maximum second product is determined as a control entity. If the second entity is the control entity, it is determined that the rationality check of the second entity and the relationship to be verified has passed.

[0029] By adopting the above technical solution, the larger the second product, the greater the likelihood that the entity to be analyzed and the first entity have a relationship, and that the relationship is a relationship to be verified. If the maximum second product is greater than a preset second threshold, it indicates that there is a high likelihood that the corresponding entity to be analyzed and the first entity have a relationship to be verified, and the corresponding entity to be analyzed is determined to be a control entity. If the second entity is a control entity, the rationality check of the second entity and the relationship to be verified is determined to have passed, thereby performing a more accurate rationality check.

[0030] Optionally, the method further includes:

[0031] When the maximum second product is not greater than a preset second threshold, if the second entity is a key entity corresponding to the first entity, calculating a third product of the first weight of the second entity and the second weights of each corresponding key relationship;

[0032] Summing the third products to obtain a sum of the second products, and if the sum of the second products is greater than a preset third threshold, determining that the rationality check of the second entity has passed;

[0033] A maximum third product is selected from each of the third products, and the relationship to be verified is replaced by the key relationship corresponding to the maximum third product.

[0034] By adopting the above technical solution, if the largest second product is not greater than the second threshold, it indicates that the other candidate entities are less likely to have a relationship to be verified with the first entity, and the relationship to be verified between the first entity and the second entity may be incorrect, requiring further verification. Furthermore, if the sum of the second products exceeds the third threshold, it indicates that there is a high probability that the second entity is associated with the first entity, and the second entity is not misidentified, but rather the relationship to be verified between the two is incorrect. In this case, the rationality check of the second entity is determined to have passed.

[0035] Optionally, the preset graph neural network is used to perform entity linking processing on each target entity and the entity category in the knowledge graph ontology model, specifically including:

[0036] Determine a first embedding vector corresponding to a single target entity, and determine a second embedding vector for each entity category in the knowledge graph ontology model;

[0037] Optimizing the first embedding vector using a preset graph neural network to obtain a first optimized vector, and optimizing the second embedding vector using the graph neural network to obtain a second optimized vector;

[0038] Calculating similarities between the first optimized vector and each of the second optimized vectors, and selecting a maximum similarity from the similarities;

[0039] If the maximum similarity exceeds a preset similarity threshold, entity linking processing is performed on the entity category corresponding to the maximum similarity and the single target entity.

[0040] By adopting the above technical solution, the first and second embedding vectors are optimized through a graph neural network, so that the first optimized vector can more comprehensively and accurately represent the target entity, and the second optimized vector can more comprehensively and accurately represent the entity category. Furthermore, if the maximum similarity exceeds a preset similarity threshold, indicating that the single target entity and the corresponding entity category are closely matched, the entity category corresponding to the maximum similarity is then linked to the target entity, thereby facilitating the subsequent construction of a more accurate knowledge graph.

[0041] Optionally, based on the target entity and target relationship that were not successfully linked, the knowledge graph ontology model after the linking is expanded to obtain the final knowledge graph corresponding to the text data to be analyzed, specifically including:

[0042] Determine the target entity that is not successfully linked as a new entity, and perform cluster analysis on all new entities to obtain at least one entity classification set;

[0043] Adding a new entity closest to the corresponding cluster center in a single entity classification set to the linked knowledge graph ontology model to obtain an expanded ontology model;

[0044] Determine the target relationship that has not been successfully linked as a new relationship, and perform cluster analysis on all new relationships to obtain at least one relationship classification set;

[0045] A new relationship that is closest to the corresponding cluster center in a single relationship classification set is added to the expanded ontology model to obtain a final knowledge graph corresponding to the text data to be analyzed.

[0046] By adopting the above technical solution, the target entity and the target relationship are not successfully linked, which means that the target entity does not match any entity category in the knowledge graph ontology model, and the target relationship does not match any relationship type in the knowledge graph ontology model. The target entity and the target relationship are determined to be a new entity and a new relationship, and correspond to new entity categories and relationship types. Then, the new entity closest to the corresponding cluster center in the entity classification set and the new relationship closest to the corresponding cluster center in the relationship classification set are added to the knowledge graph ontology model, thereby realizing the expansion of new entity categories and relationship types in the knowledge graph ontology model, and thus making the final knowledge graph ontology model able to adapt to new knowledge.

[0047] In a second aspect of the present application, a knowledge graph construction device based on entity chaining is provided, specifically comprising:

[0048] An information acquisition module is used to obtain at least one candidate entity from the text data to be analyzed through the fine-tuned target large language model, and to construct a knowledge graph ontology model corresponding to the text data to be analyzed;

[0049] a relationship extraction module, configured to extract relationships from each of the candidate entities to obtain at least one target relationship, determine the candidate entities corresponding to the target relationship as target entities, and aggregate the candidate entities into entity combinations;

[0050] A link finger processing module is used to perform rationality verification on each target entity and the corresponding target relationship in the entity combination. After the rationality verification passes, based on a preset graph neural network, entity link finger processing is performed on each target entity and the entity category in the knowledge graph ontology model, and relationship link finger processing is performed on each target relationship and the relationship type in the knowledge graph ontology model to obtain a knowledge graph ontology model after link fingering;

[0051] The graph construction module is used to expand the knowledge graph ontology model after the chaining based on the target entities and target relationships that were not successfully chained, so as to obtain the final knowledge graph corresponding to the text data to be analyzed.

[0052] By adopting the above technical solution, the information acquisition module obtains candidate entities from the text data to be analyzed and constructs a knowledge graph ontology model. The relationship extraction module then extracts at least one target relationship and identifies the candidate entities corresponding to the target relationship as target entities and aggregates them into entity combinations. After passing the rationality check, the link processing module then performs entity and relationship link processing to obtain the linked knowledge graph ontology model. Finally, the graph construction module expands the linked knowledge graph ontology model to obtain the final knowledge graph corresponding to the text data to be analyzed.

[0053] In a third aspect of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is loaded and executed by a processor, the method steps as described in any one of the first aspects are performed.

[0054] In a fourth aspect of the present application, an electronic device is provided, specifically comprising:

[0055] A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the processor is used to load and execute the computer program stored in the memory so that the electronic device performs the method as described in any one of the first aspects.

[0056] In summary, the present application includes at least one of the following beneficial technical effects: through the target large language model, candidate entities are more accurately identified from the text data to be analyzed and target relationships are extracted, and then the identified target entities and target relationships between the target entities are verified, thereby ensuring the accuracy of the identified entities and extracted relationships to a certain extent, and thus paving the way for the subsequent construction of an accurate knowledge graph. Furthermore, based on the graph neural network, entity chaining and relationship chaining can be performed for the target entities and target relationships respectively, so that the target entities and target relationships can be better integrated with the knowledge graph ontology model. At the same time, based on the target entities and target relationships that have not been successfully chained, the entity categories and relationship types of the knowledge graph ontology model after chaining are expanded, so that it can better adapt to new knowledge, thereby making the final constructed knowledge graph more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 This is a flow chart of a method for constructing a knowledge graph based on entity chaining provided in an embodiment of the present application;

[0058] Figure 2 This is a schematic diagram of the structure of a knowledge graph construction device based on entity chain reference provided in an embodiment of the present application;

[0059] Figure 3 This is a structural diagram of another knowledge graph construction device based on entity chain reference provided in an embodiment of the present application.

[0060] Explanation of the accompanying symbols: 11. Information acquisition module; 12. Relationship extraction module; 13. Link processing module; 14. Graph construction module; 15. Reasonable verification module. DETAILED DESCRIPTION

[0061] In order to enable people skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0062] In the description of the embodiments of this application, words such as "exemplarily," "for example," or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily," "for example," or "for example" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily," "for example," or "for example" is intended to present the relevant concepts in a concrete manner.

[0063] In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, B exists alone, and A and B exist at the same time. In addition, unless otherwise specified, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0064] See also Figure 1 The present application discloses a flowchart of a method for constructing a knowledge graph based on entity linkage, which can be implemented by a computer program or run on a knowledge graph construction device based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone tool application, specifically including:

[0065] S101: Obtain at least one candidate entity from the text data to be analyzed using the fine-tuned target large language model, and construct a knowledge graph ontology model corresponding to the text data to be analyzed;

[0066] Specifically, a large language model (LLM) refers to a deep learning model trained using a large amount of text data, so that the model can generate natural language text or understand the meaning of language text. In an embodiment of the present application, the target large language model can adopt Qwen 2.5, and in other embodiments, the target large language model can also adopt Llama 3. The text data to be analyzed is text data for which a knowledge graph needs to be constructed in a targeted manner. For example, the text data to be analyzed can be text data such as news reports, research papers, etc. related to a single field, such as the medical field. Furthermore, entities refer to objects in the real world, such as people, places, etc. In the construction of a knowledge graph, named entity recognition (NER) is a key step, which involves automatically identifying named entities from text data. Candidate entities are entities identified from the text data to be analyzed. The knowledge graph ontology model is a structured model that describes and organizes domain knowledge, including elements such as entity categories, relationship types, and attributes. Among them, entity categories are a set of categories for dividing entities, which are used to describe entities with similar attributes or characteristics. The relationship type is a combination of types for classifying relationships between entities and is used to describe the association relationship between entities.

[0067] It should be noted that the fine-tuning process of the target large language model can be briefly described as follows: the text data samples, the names of the entities contained in the text data samples, and the relationships between different entities are used as training samples and input into the target large language model for fine-tuning training. During the process, the parameters are adjusted through the cross-entropy loss function until the model converges. This is a prior art and will not be described in detail here. The fine-tuned target large language model can automatically identify entities and extract the relationships between entities from the text data to be analyzed. Among them, the relationship between entities is to describe various semantic connections between different entities. For example, the two entities are "place" and "event", then the relationship between the two entities is "occurred in".

[0068] Furthermore, the fine-tuned target large language model is used to identify at least one candidate entity from the text data to be analyzed. Furthermore, one feasible approach to constructing a knowledge graph ontology model is to use the pre-defined Neo4j tool based on the Schema model. A Schema is a structured framework used to define and describe entities, attributes, relationships, and how they relate to each other. It defines the basic components of a knowledge graph and how they are organized, providing a foundation for its construction and application.

[0069] S102: Extract relations from each candidate entity to obtain at least one target relation, determine the candidate entity corresponding to the target relation as the target entity, and aggregate them into an entity combination.

[0070] Specifically, after candidate entities are determined, the fine-tuned target large language model is used to extract relationships between each pair of candidate entities from the text data to be analyzed, generating at least one target relationship. Finally, the two candidate entities corresponding to a single target relationship are determined as target entities, and each target entity is aggregated into an entity combination.

[0071] S103: Perform rationality check on each target entity and the corresponding target relationship in a single entity combination. After the rationality check is passed, based on the preset graph neural network, perform entity linking processing on each target entity and the entity category in the knowledge graph ontology model, and perform relationship linking processing on each target relationship and the relationship type in the knowledge graph ontology model to obtain the knowledge graph ontology model after linking.

[0072] Specifically, after candidate entity identification and target relationship extraction between candidate entities, the rationality of entity identification and the rationality of the extracted target relationships need to be verified to improve the accuracy of entity identification and relationship extraction, thereby ensuring a more accurate knowledge graph is subsequently constructed. Furthermore, a rationality check is performed on each target entity and corresponding target relationship in a single entity combination. One feasible verification method is to obtain historical entities in the constructed knowledge graph of historical text data that have a relationship with a single target entity in the entity combination, where the historical text data is related to the same field as the text data to be analyzed. For example, the historical text data and the text data to be analyzed can both be text data related to the medical field. Next, the first occurrence count of each historical entity is counted. The larger the first occurrence count, the more likely the corresponding historical entity is to have a relationship with the target entity in the text data to be analyzed. In descending order of first occurrence count, a first number of historical entities are selected from each historical entity to determine as key entities, i.e., entities that are likely to have a relationship with the target entity in the text data to be analyzed. The first occurrence count is the frequency of occurrence of the same historical entity across all historical entities.

[0073] Furthermore, the historical relationships between a single key entity and the target entity are obtained, and the second occurrence count of each historical relationship is counted. The larger the second occurrence count, the more likely it is that a corresponding historical relationship exists between the single key entity and the target entity. In descending order of the second occurrence count, a second number of historical relationships are selected from each historical relationship to determine them as key relationships corresponding to the key entity, i.e., entity relationships that are likely to exist between the key entity and the target entity. The second occurrence count is the frequency of occurrence of the same historical relationship among all historical relationships.

[0074] Determine the first weight of each key entity and the second weight of the key relationship corresponding to each key entity, where the first weight is the ratio of the first occurrence of each key entity to the sum of the first occurrences of all key entities, and the second weight is the ratio of the second occurrence of a single key relationship corresponding to the key entity to the sum of the second occurrences of all corresponding key relationships. Finally, based on the first and second weights, perform a rationality check on each target entity and the corresponding target relationship in the single entity combination. One achievable implementation method is:

[0075] Based on the extracted target relationships, at least one other candidate entity and the corresponding other relationships that have a relationship with a single target entity in the entity combination are screened out from each candidate entity. Then, when the other candidate entity is a key entity, the other candidate entity is determined as a reference entity, and when the other relationship corresponding to the reference entity, that is, the relationship between the reference entity and the single target entity, is a key relationship, the other relationship is determined as a reference relationship. Furthermore, if the above-mentioned reference relationship exists in each key relationship corresponding to the reference entity, the first product of the first weight of the reference entity and the second weight of the corresponding reference relationship is calculated. The larger the first product, the greater the possibility that the relationship between the target entity and the reference entity is a reference relationship, and the more reasonable the entity relationship. Then, the first products corresponding to each reference entity that has a relationship with the target entity are summed to obtain the sum of the first products corresponding to the target entity. The larger the sum of the first products, the higher the overall rationality of the entity relationship between the target entity and the other candidate entities, indicating that the accuracy of the target entity recognition itself is higher.

[0076] The maximum sum of the first products is selected from the sums of the first products corresponding to the target entities in the single entity combination. If the maximum sum of the first products is greater than a preset first threshold, indicating that the corresponding target entity recognition accuracy is high, the target entity corresponding to this maximum sum of the first products is determined as the first entity, and the rationality check of the first entity is determined to have passed. At the same time, the target entities other than the first entity in the entity combination are determined as the second entity. Then, based on the first entity, the rationality check is performed on the second entity, and the rationality check is performed on the target relationship between the first entity and the second entity. A feasible implementation method is as follows:

[0077] The target relationship between a first entity and a second entity is determined as a relationship to be verified. For the first entity, if a relationship to be verified exists among the key relationships corresponding to a single key entity that is likely to have a relationship with the first entity, the corresponding key entity is determined as the entity to be analyzed. The second product of the first weight of each entity to be analyzed and the second weight of the corresponding relationship to be verified is calculated. The larger the second product, the greater the likelihood that the entity to be analyzed has a relationship with the first entity and that the relationship is a relationship to be verified. The maximum second product is selected from the second products. If the maximum second product is greater than a preset second threshold, it indicates that there is a high likelihood that the corresponding entity to be analyzed has a relationship to be verified with the first entity, and the corresponding entity to be analyzed is determined as a control entity. If the second entity is a control entity, the rationality check of the second entity and the relationship to be verified is determined to have passed. If the second entity is not a control entity, it indicates that there is a high probability that the second entity has been identified incorrectly. If none of the other target relationships corresponding to the first entity are relationships to be verified, the second entity is replaced with the control entity.

[0078] In other embodiments, if the maximum second product is not greater than the second threshold, it indicates that the possibility of other candidate entities having a relationship to be verified with the first entity is small, and the relationship to be verified between the first entity and the second entity may be incorrect and needs further verification. Then, when the second entity is the key entity corresponding to the first entity, the third product of the first weight of the second entity and the second weight of each corresponding key relationship is calculated. The larger the third product, the greater the possibility that a corresponding key relationship exists between the first entity and the second entity. The sum of each third product is summed to obtain the sum of the second products. The sum of the second products is then compared with a preset third threshold. If the sum of the second products exceeds the third threshold, it indicates that there is a high possibility that the second entity is associated with the first entity. The second entity does not have an identification error problem, but the relationship to be verified between the two is incorrect. Then, it is determined that the rationality check of the second entity has passed. Further, the maximum third product is selected from each third product. The key relationship corresponding to the maximum third product is the most likely relationship between the first entity and the second entity, and the relationship to be verified is replaced with the key relationship corresponding to the maximum third product.

[0079] Furthermore, after the rationality check is passed, each target entity needs to be linked to the entity category in the knowledge graph ontology model, so that the candidate entities identified from the text data to be analyzed can be accurately mapped to the knowledge graph ontology model and effectively integrated with the knowledge graph ontology model. Among them, entity linking is to identify multiple entities mentioned in different data sources that point to the same real-world object, and associate them with the same node in the knowledge graph, thereby ensuring the consistency and accuracy of the knowledge graph. For example, the entity is xxx hospital, and the entity category to be linked is the hospital category.

[0080] Furthermore, a feasible way to perform entity chain processing is to determine the first embedding vector corresponding to a single target entity through a preset large language model, and determine the second embedding vector of each entity category in the knowledge graph ontology model. Among them, the embedding vector (Embedding Vector) is a method of converting text or entity into a numerical representation that can be understood by a computer. Then, the first embedding vector is optimized by the preset graph neural network (Graph Neural Networks, GNNs) to obtain a first optimized vector. Then, the second embedding vector is optimized to obtain a second optimized vector. Among them, the graph neural network is a neural network model that uses the topological structure of the graph to transmit and update information. In an embodiment of the present application, the embedding vector is optimized by the graph neural network, specifically by aggregating the information of neighboring nodes and integrating it into the embedding vector, so that the embedding vector represents the entity more comprehensively and accurately.

[0081] Furthermore, the similarity between the first optimized vector and the second optimized vector is calculated, which can be specifically achieved through cosine similarity. In other embodiments, it can also be achieved by calculating the Euclidean distance. The greater the similarity, the more the single target entity matches the corresponding entity category in the knowledge graph ontology model, and the more suitable it is for chain pointing. Then, the maximum similarity is selected from each similarity. If the maximum similarity exceeds the preset similarity threshold, it means that the single target entity is more matched with the corresponding entity category, and then the entity category corresponding to the maximum similarity is subjected to entity chain pointing processing with the target entity. On the contrary, if the maximum similarity does not exceed the similarity threshold, it means that the single target entity does not match the corresponding entity category and chain pointing cannot be performed.

[0082] Furthermore, the method for relationship chaining is similar to that for entity chaining. Similarly, the embedding vector corresponding to a single target relationship and the embedding vectors of each relationship type in the knowledge graph ontology model are determined. These embedding vectors are then optimized using a graph neural network to obtain optimized vectors. The similarity between the optimized vector of the target relationship and the optimized vectors of each relationship type is then calculated, and the maximum similarity is selected. If the maximum similarity exceeds the similarity threshold, indicating that the target relationship and the corresponding relationship type are closely matched, targeted relationship chaining is then performed. Finally, after entity chaining and relationship chaining are completed, the knowledge graph ontology model is obtained after chaining.

[0083] S104: Based on the target entities and target relationships that were not successfully linked, the knowledge graph ontology model after linking is expanded to obtain the final knowledge graph corresponding to the text data to be analyzed.

[0084] Specifically, after the linked knowledge graph ontology model is determined, target entities that do not match any entity category in the knowledge graph ontology model and target relationships that do not match any relationship type in the knowledge graph ontology model are obtained, i.e., target entities and target relationships that were not successfully linked. Furthermore, the unsuccessfully linked target entities are determined as brand new entities, and a cluster analysis is performed on all brand new entities using a preset clustering algorithm. Similar brand new entities are grouped together to obtain at least one entity classification set. The clustering algorithm may employ K-means or hierarchical clustering. Next, the clustering algorithm simultaneously determines the cluster centers (cluster centers) corresponding to each individual entity classification set, and calculates the distance between each brand new entity in the individual entity classification set and the corresponding cluster center. The brand new entity with the smallest distance to the cluster center is added to the linked knowledge graph ontology model to obtain an expanded ontology model, thereby expanding the brand new entity categories in the linked knowledge graph ontology model and enabling the linked knowledge graph ontology model to adapt to brand new knowledge. The distance between the brand new entity and the cluster center is calculated, specifically the Euclidean distance between the brand new entity and the cluster center.

[0085] Furthermore, the target relationships that were not successfully linked are identified as new relationships, and all new relationships are clustered to obtain at least one relationship classification set. The cluster center (cluster center) corresponding to each relationship classification set is then determined, and the distance between each new relationship in the single relationship classification set and the corresponding cluster center is calculated. The new relationship with the smallest distance to the cluster center is added to the expanded ontology model to obtain the final knowledge graph corresponding to the text data to be analyzed. The distance between the new relationship and the cluster center is calculated, specifically the Euclidean distance between the new relationship and the cluster center.

[0086] The implementation principle of the knowledge graph construction method based on entity chaining in the embodiment of the present application is: through the target large language model, the candidate entities are more accurately identified from the text data to be analyzed and the target relationships are extracted, and then the identified target entities and the target relationships between the target entities are verified, so as to ensure the accuracy of the identified entities and the extracted relationships to a certain extent, and thus pave the way for the subsequent construction of an accurate knowledge graph. Furthermore, based on the graph neural network, entity chaining and relationship chaining can be performed for the target entities and target relationships respectively, so that the target entities and target relationships are better integrated with the knowledge graph ontology model. At the same time, based on the target entities and target relationships that have not been successfully chained, the entity categories and relationship types of the knowledge graph ontology model after chaining are expanded, so that it can better adapt to new knowledge, thereby making the final constructed knowledge graph more accurate.

[0087] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0088] See Figure 2 , which is a schematic diagram of the structure of the knowledge graph construction device based on entity chain reference provided in an embodiment of the present application. The knowledge graph construction device based on entity chain reference can be implemented as all or part of the device through software, hardware, or a combination of both. The device includes an information acquisition module 11, a relationship extraction module 12, a chain reference processing module 13, and a graph construction module 14.

[0089] An information acquisition module 11 is configured to obtain at least one candidate entity from the text data to be analyzed using the fine-tuned target large language model, and to construct a knowledge graph ontology model corresponding to the text data to be analyzed;

[0090] The relationship extraction module 12 is used to extract relationships from each candidate entity to obtain at least one target relationship, determine the candidate entity corresponding to the target relationship as the target entity, and summarize it into an entity combination;

[0091] The link processing module 13 is used to perform rationality verification on each target entity and the corresponding target relationship in the entity combination. After the rationality verification passes, based on the preset graph neural network, the entity link processing is performed on each target entity and the entity category in the knowledge graph ontology model, and the relationship link processing is performed on each target relationship and the relationship type in the knowledge graph ontology model to obtain the knowledge graph ontology model after linking;

[0092] The graph construction module 14 is used to expand the knowledge graph ontology model after chaining based on the target entities and target relationships that were not successfully chained, so as to obtain the final knowledge graph corresponding to the text data to be analyzed.

[0093] Optionally, the chain finger processing module 13 is specifically configured to:

[0094] Obtain historical entities that have a relationship with a single target entity in the entity combination in the constructed knowledge graph of historical text data, count the first occurrence number of each historical entity, and select the first number of historical entities from each historical entity in descending order of the first occurrence number to determine as key entities, where the historical text data is text data in the same field as the text data to be analyzed;

[0095] Obtain historical relationships between a single key entity and the corresponding target entity, count the second occurrence counts of each historical relationship, and select a second number of historical relationships from each historical relationship in descending order of the second occurrence counts as key relationships corresponding to the single key entity;

[0096] Determine a first weight for each key entity and a second weight for each key relationship corresponding to the key entity, wherein the first weight is the ratio of the first occurrence count of each key entity to the sum of the first occurrence counts of all key entities, and the second weight is the ratio of the second occurrence count of a single key relationship corresponding to the key entity to the sum of the second occurrence counts of all corresponding key relationships;

[0097] According to the first weight and the second weight, a rationality check is performed on each target entity in the entity combination and the corresponding target relationship.

[0098] Optionally, the chain finger processing module 13 is specifically configured to:

[0099] Obtain at least one other candidate entity that has a relationship with a single target entity in the entity combination and corresponding other relationships;

[0100] When other candidate entities are key entities, the corresponding other candidate entities are determined as reference entities, and when other relationships corresponding to the reference entity are key relationships, the other relationships corresponding to the reference entity are determined as reference relationships;

[0101] If a reference relationship exists in each key relationship corresponding to the reference entity, a first product of a first weight of the reference entity and a second weight of the corresponding reference relationship is calculated;

[0102] Sum each first product to obtain the sum of the first products of the corresponding target entity, and select the maximum sum of the first products from the sums of the first products of each target entity in the entity combination;

[0103] If the sum of the largest first products is greater than a preset first threshold, the target entity corresponding to the sum of the largest first products is determined as the first entity, the remaining target entities are determined as the second entities, and it is determined that the rationality check of the first entity has passed;

[0104] Based on the first entity, a rationality check is performed on the second entity, and a rationality check is performed on the target relationship between the first entity and the second entity.

[0105] Optionally, the chain finger processing module 13 is specifically configured to:

[0106] Determine the target relationship between the first entity and the second entity as the relationship to be verified, and when there is a relationship to be verified in each key relationship corresponding to a single key entity that is likely to have a relationship with the first entity, determine the corresponding key entity as the entity to be analyzed;

[0107] Calculating a second product of the first weight of each entity to be analyzed and the second weight of the corresponding relationship to be verified, and selecting a maximum second product from the second products;

[0108] When the maximum second product is greater than a preset second threshold, the entity to be analyzed corresponding to the maximum second product is determined as a control entity. If the second entity is a control entity, it is determined that the rationality check of the second entity and the relationship to be checked passes.

[0109] Optional, such as Figure 3 As shown, the device further includes a reasonableness verification module 15, which is specifically used to:

[0110] When the maximum second product is not greater than a preset second threshold, if the second entity is a key entity corresponding to the first entity, calculating a third product of the first weight of the second entity and the second weights of each corresponding key relationship;

[0111] Summing the third products to obtain a sum of the second products, and if the sum of the second products is greater than a preset third threshold, determining that the rationality check of the second entity has passed;

[0112] The largest third product is selected from each third product, and the relationship to be verified is replaced with the key relationship corresponding to the largest third product.

[0113] Optionally, the chain finger processing module 13 is specifically configured to:

[0114] Determine the first embedding vector corresponding to the single target entity and determine the second embedding vector of each entity category in the knowledge graph ontology model;

[0115] Optimizing the first embedding vector using a preset graph neural network to obtain a first optimized vector, and optimizing the second embedding vector using a graph neural network to obtain a second optimized vector;

[0116] Calculating similarities between the first optimized vector and each second optimized vector, and selecting a maximum similarity from each similarity;

[0117] If the maximum similarity exceeds the preset similarity threshold, the entity category corresponding to the maximum similarity is linked to the single target entity.

[0118] Optionally, the graph construction module 14 is specifically used to:

[0119] Determine the target entity that is not successfully linked as a new entity, and perform cluster analysis on all new entities to obtain at least one entity classification set;

[0120] Add the new entity closest to the corresponding cluster center in the single entity classification set to the knowledge graph ontology model after chaining to obtain the expanded ontology model;

[0121] Determine the target relationship that has not been successfully linked as a new relationship, and perform cluster analysis on all new relationships to obtain at least one relationship classification set;

[0122] The new relationship closest to the corresponding cluster center in a single relationship classification set is added to the expanded ontology model to obtain the final knowledge graph corresponding to the text data to be analyzed.

[0123] It should be noted that the above embodiment provides a knowledge graph construction device based on entity chain references, and when executing the knowledge graph construction method based on entity chain references, only the division of the above functional modules is used as an example. In actual applications, the above functional distribution can be completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the above embodiment provides a knowledge graph construction device based on entity chain references and a knowledge graph construction method based on entity chain references. The implementation process is detailed in the method embodiment and will not be repeated here.

[0124] An embodiment of the present application also discloses a computer-readable storage medium, and the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, a knowledge graph construction method based on entity chain reference of the above embodiment is implemented.

[0125] Among them, the computer program can be stored in a computer-readable medium, the computer program includes computer program code, the computer program code can be in the form of source code, object code, executable file or certain middleware, etc. The computer-readable medium includes any entity or device that can carry computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that computer-readable medium includes but is not limited to the above-mentioned components.

[0126] Among them, through this computer-readable storage medium, a knowledge graph construction method based on entity chain reference of the above embodiment is stored in a computer-readable storage medium, and is loaded and executed on a processor to facilitate the storage and application of the above method.

[0127] An embodiment of the present application also discloses an electronic device, in which a computer program is stored in a computer-readable storage medium. When the computer program is loaded and executed by a processor, the above-mentioned method for constructing a knowledge graph based on entity chain reference is implemented.

[0128] Among them, the electronic device can be an electronic device such as a desktop computer, a laptop computer or a cloud server, and the electronic device includes but is not limited to a processor and a memory. For example, the electronic device can also include input and output devices, network access devices and buses, etc.

[0129] Among them, the processor can adopt a central processing unit (CPU). Of course, according to actual usage, other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. can also be adopted. The general-purpose processor can adopt a microprocessor or any conventional processor, etc., and this application does not impose any restrictions on this.

[0130] Among them, the memory can be an internal storage unit of the electronic device, such as the hard disk or memory of the electronic device, or it can be an external storage device of the electronic device, such as a plug-in hard disk, smart memory card (SMC), secure digital card (SD) or flash memory card (FC) equipped on the electronic device. In addition, the memory can also be a combination of an internal storage unit and an external storage device of the electronic device. The memory is used to store computer programs and other programs and data required by the electronic device. The memory can also be used to temporarily store data that has been output or is to be output. This application does not impose any restrictions on this.

[0131] Among them, through this electronic device, a knowledge graph construction method based on entity chain reference of the above embodiment is stored in the memory of the electronic device, and is loaded and executed on the processor of the electronic device for easy use.

[0132] The above description is merely an exemplary embodiment of the present disclosure and is not intended to limit the scope of the present disclosure. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. This application is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A knowledge graph construction method based on entity chaining, characterized in that: The method comprises: Obtain at least one candidate entity from the text data to be analyzed using the fine-tuned target large language model, and construct a knowledge graph ontology model corresponding to the text data to be analyzed; Performing relationship extraction on each of the candidate entities to obtain at least one target relationship, determining the candidate entities corresponding to the target relationship as target entities and aggregating them into an entity combination; Performing a rationality check on each target entity in the entity combination and the corresponding target relationship, including: obtaining historical entities that have a relationship with a single target entity in the entity combination in the constructed knowledge graph of historical text data, counting the first occurrence number of each historical entity, and selecting a first number of historical entities from each historical entity in descending order of the first occurrence number to determine as key entities, wherein the historical text data is text data of the same field as the text data to be analyzed; obtaining historical relationships in which a single key entity has appeared with the corresponding target entity, counting the second occurrence number of each historical relationship, and selecting a second number of historical relationships from each historical relationship in descending order of the second occurrence number to determine as key relationships corresponding to the single key entity; determining a first weight for each key entity and a second weight for the key relationship corresponding to each key entity, wherein the first weight is the ratio of the first occurrence number of each key entity to the sum of the first occurrence numbers of all key entities, and the second weight is the ratio of the second occurrence number of a single key relationship corresponding to the key entity to the sum of the second occurrence numbers of all key relationships; performing a rationality check on each target entity and the corresponding target relationship in the entity combination according to the first weight and the second weight; After the rationality check is passed, based on the preset graph neural network, entity chaining processing is performed on each of the target entities and the entity categories in the knowledge graph ontology model, and relationship chaining processing is performed on each of the target relationships and the relationship types in the knowledge graph ontology model to obtain the chained knowledge graph ontology model; Based on the target entities and target relationships that were not successfully linked, the knowledge graph ontology model after the linking is expanded to obtain the final knowledge graph corresponding to the text data to be analyzed.

2. The method for constructing a knowledge graph based on entity chaining according to claim 1, characterized in that: The performing rationality check on each target entity and the corresponding target relationship in the entity combination according to the first weight and the second weight specifically includes: Obtain at least one other candidate entity that has a relationship with a single target entity in the entity combination and corresponding other relationships; When the other candidate entities are focus entities, the corresponding other candidate entities are determined as reference entities, and when the other relationships corresponding to the reference entities are focus relationships, the other relationships corresponding to the reference entities are determined as reference relationships; If the reference relationship exists in each key relationship corresponding to the reference entity, calculating a first product of a first weight of the reference entity and a second weight of the corresponding reference relationship; Summing each of the first products to obtain a sum of first products of the corresponding target entities, and selecting a maximum sum of first products from the sums of the first products of the target entities in the entity combination; If the sum of the largest first products is greater than a preset first threshold, determining the target entity corresponding to the sum of the largest first products as the first entity, determining the remaining target entities as the second entity, and determining that the rationality check of the first entity passes; Based on the first entity, a rationality check is performed on the second entity, and a rationality check is performed on the target relationship between the first entity and the second entity.

3. The method for constructing a knowledge graph based on entity chaining according to claim 2, characterized in that: The performing of a rationality check on the second entity based on the first entity and performing a rationality check on the target relationship between the first entity and the second entity specifically includes: Determine the target relationship between the first entity and the second entity as a relationship to be verified, and when the relationship to be verified exists in each key relationship corresponding to a single key entity that is likely to have a relationship with the first entity, determine the corresponding key entity as an entity to be analyzed; Calculating a second product of the first weight of each of the entities to be analyzed and the second weight of the corresponding relationship to be verified, and selecting a maximum second product from the second products; When the maximum second product is greater than a preset second threshold, the entity to be analyzed corresponding to the maximum second product is determined as a control entity. If the second entity is the control entity, it is determined that the rationality check of the second entity and the relationship to be verified has passed.

4. The method for constructing a knowledge graph based on entity chaining according to claim 3 is characterized in that: The method further comprises: When the maximum second product is not greater than a preset second threshold, if the second entity is a key entity corresponding to the first entity, calculating a third product of the first weight of the second entity and the second weights of each corresponding key relationship; Summing the third products to obtain a sum of the second products, and if the sum of the second products is greater than a preset third threshold, determining that the rationality check of the second entity has passed; A maximum third product is selected from each of the third products, and the relationship to be verified is replaced by the key relationship corresponding to the maximum third product.

5. The method for constructing a knowledge graph based on entity chaining according to claim 1, characterized in that: The preset graph neural network is used to perform entity linking processing on each target entity and the entity category in the knowledge graph ontology model, specifically including: Determine a first embedding vector corresponding to a single target entity, and determine a second embedding vector for each entity category in the knowledge graph ontology model; Optimizing the first embedding vector using a preset graph neural network to obtain a first optimized vector, and optimizing the second embedding vector using the graph neural network to obtain a second optimized vector; Calculating similarities between the first optimized vector and each of the second optimized vectors, and selecting a maximum similarity from the similarities; If the maximum similarity exceeds a preset similarity threshold, entity linking processing is performed on the entity category corresponding to the maximum similarity and the single target entity.

6. The method for constructing a knowledge graph based on entity chaining according to claim 1, characterized in that: The method further comprises: expanding the knowledge graph ontology model after the linking based on the target entity and target relationship that were not successfully linked to obtain the final knowledge graph corresponding to the text data to be analyzed; specifically, the method comprises: Determine the target entity that is not successfully linked as a new entity, and perform cluster analysis on all new entities to obtain at least one entity classification set; Adding a new entity closest to the corresponding cluster center in a single entity classification set to the linked knowledge graph ontology model to obtain an expanded ontology model; Determine the target relationship that has not been successfully linked as a new relationship, and perform cluster analysis on all new relationships to obtain at least one relationship classification set; A new relationship that is closest to the corresponding cluster center in a single relationship classification set is added to the expanded ontology model to obtain a final knowledge graph corresponding to the text data to be analyzed.

7. A knowledge graph construction device based on entity chaining, used to implement the knowledge graph construction method based on entity chaining according to any one of claims 1 to 6, characterized in that: include: An information acquisition module (11) is used to obtain at least one candidate entity from the text data to be analyzed by using the fine-tuned target large language model, and to construct a knowledge graph ontology model corresponding to the text data to be analyzed; A relationship extraction module (12) is used to extract relationships from each candidate entity to obtain at least one target relationship, determine the candidate entity corresponding to the target relationship as a target entity, and summarize the candidate entity into an entity combination; A link finger processing module (13) is used to perform a rationality check on each target entity and the corresponding target relationship in the entity combination. After the rationality check passes, based on a preset graph neural network, entity link finger processing is performed on each target entity and the entity category in the knowledge graph ontology model, and relationship link finger processing is performed on each target relationship and the relationship type in the knowledge graph ontology model to obtain a knowledge graph ontology model after link finger processing; The graph construction module (14) is used to expand the knowledge graph ontology model after the linking based on the target entity and target relationship that were not successfully linked, so as to obtain the final knowledge graph corresponding to the text data to be analyzed.

8. A computer-readable storage medium storing a computer program, wherein: When the computer program is loaded and executed by a processor, the method according to any one of claims 1 to 6 is implemented.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that: When the processor loads and executes the computer program, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Knowledge graph construction method and device based on artificial intelligence, equipment and medium

    CN119250191A

  • Knowledge reasoning method, system and device for multivariate relation scene and medium

    CN119358689A