Knowledge graph generation methods, devices, storage media and electronic equipment

CN121365722BActive Publication Date: 2026-08-14CHINA AERO POLYTECH ESTAB +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

然而,这样的处理方式通常仅能够抽取出碎片化的知识,难以形成完整的知识网络,并且,易存在实体识别错误、关系识别错误等问题,已产生的错误在整个处理流程中会被不断传递和放大,导致最终构建的知识图谱在整体准确性上存在较大的欠缺

Benefits of technology

[0013]根据本公开的第四方面,提供一种电子设备,包括:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121365722B_ABST
    Figure CN121365722B_ABST
Patent Text Reader

Abstract

This disclosure relates to a knowledge graph generation method, apparatus, storage medium, and electronic device. The method includes: dividing the original text corpus into blocks to obtain a text block sequence; iteratively processing the text block sequence to determine the knowledge triples corresponding to each text block in the text block sequence, wherein each processing step includes: determining background information corresponding to the current text block being processed, the background information including semantically related associated text blocks and associated triples in the current knowledge base that are related to the current text block, the current knowledge base including knowledge triples determined in previous processing steps before this processing step; determining the knowledge triples corresponding to the current text block based on the current text block and the background information; and determining the knowledge graph corresponding to the original text corpus based on the knowledge triples corresponding to each text block in the text block sequence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a method, apparatus, storage medium, and electronic device for generating knowledge graphs. Background Technology

[0002] In the field of knowledge graph construction, especially the automated construction of knowledge graphs from unstructured text (such as technical standards and academic literature), it is usually necessary to rely on predefined rule templates or supervised machine learning models to perform named entity recognition and relation extraction in sequence. However, such processing methods can usually only extract fragmented knowledge, making it difficult to form a complete knowledge network. Furthermore, it is prone to problems such as entity recognition errors and relation recognition errors. The errors that have been generated can be continuously propagated and amplified throughout the processing flow, resulting in a significant deficiency in the overall accuracy of the final knowledge graph. Summary of the Invention

[0003] The purpose of this disclosure is to provide a method, apparatus, storage medium, and electronic device for generating knowledge graphs.

[0004] To achieve the above objectives, according to a first aspect of this disclosure, a knowledge graph generation method is provided, the method comprising: The original text corpus to be processed is divided into blocks to obtain a sequence of text blocks. The text block sequence is iteratively processed to determine the knowledge triplet corresponding to each text block in the text block sequence. Each processing step includes: determining the background information corresponding to the current text block being processed, the background information including related text blocks semantically related to the current text block, and related triplets in the current knowledge base that are related to the current text block, the current knowledge base including the knowledge triplets determined in each processing step before the current processing step; and determining the knowledge triplet corresponding to the current text block based on the current text block and the background information. Based on the knowledge triples corresponding to each text block in the text block sequence, a knowledge graph corresponding to the original text corpus is determined.

[0005] Optionally, the associated text block is determined in the following way: Determine the semantic vector corresponding to each text block in the text block sequence; Based on the semantic vector, the local density of each text block is determined using the density peak clustering algorithm, and the distance between the text block and its neighboring text blocks is determined for each text block, wherein the neighboring text blocks are the text blocks with higher density that are closest to the text block. A semantic hierarchy network is generated based on the local density and distance of each text block. The semantic hierarchy network includes the nodes corresponding to each text block, and the neighbor nodes of each text block are the nodes corresponding to the higher-density text blocks that are closest to the text block. In the semantic hierarchy network, a text block that is semantically related to the current text block is identified as the associated text block.

[0006] Optionally, determining the text block semantically related to the current text block in the semantic hierarchy network as the associated text block includes: In the semantic hierarchy network, the parent node, child node, and sibling node corresponding to the current text block are determined as associated nodes; At least one of the text blocks corresponding to the associated node is identified as the associated text block.

[0007] Optionally, the associated triples are determined in the following way: Extract key entities and keywords from the current text block; Using the key entities and the keywords as query conditions, a search is performed in the current knowledge base to obtain the association triplet associated with the current text block.

[0008] Optionally, determining the knowledge triple corresponding to the current text block based on the current text block and the background information includes: The first model is used to perform entity recognition on the current text block to determine the entity list corresponding to the current text block; Based on the entity list and the background information, the second model is used to extract relationships between entities in order to determine candidate triples. Based on the candidate triples, the candidate triples are modified using a third model to determine the initial triples; Based on the initial triples, determine the knowledge triples corresponding to the current text block; Among them, the first model, the second model, and the third model are all large language models.

[0009] Optionally, the cue words of the second model are at least used to instruct the second model to distinguish between direct relationships, implicit relationships, and attribute relationships between entities.

[0010] Optionally, determining the knowledge triple corresponding to the current text block based on the initial triple includes: The initial triplet is filtered according to a preset filtering rule to obtain the filtered intermediate triplet. The filtering rule includes at least one of the following: syntax structure filtering rule, confidence filtering rule, and deduplication rule. The intermediate triples are normalized according to preset normalization rules to obtain normalized triples, which serve as knowledge triples corresponding to the current text block. The normalization rules include at least one of relation normalization rules, conflict detection and resolution rules, and semantic fusion rules.

[0011] According to a second aspect of this disclosure, a knowledge graph generation apparatus is provided, the apparatus comprising: The first processing module is used to divide the original text corpus into blocks to obtain a sequence of text blocks. The second processing module is used to iteratively process the text block sequence to determine the knowledge triplet corresponding to each text block in the text block sequence. Each processing step includes: determining background information corresponding to the current text block being processed, the background information including related text blocks semantically related to the current text block, and related triplets in the current knowledge base that are related to the current text block. The current knowledge base includes knowledge triplets determined in each processing step before the current processing step; and determining the knowledge triplet corresponding to the current text block based on the current text block and the background information. The first determining module is used to determine the knowledge graph corresponding to the original text corpus based on the knowledge triples corresponding to each text block in the text block sequence.

[0012] According to a third aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in the first aspect of this disclosure.

[0013] According to a fourth aspect of this disclosure, an electronic device is provided, comprising: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method described in the first aspect of this disclosure.

[0014] The above technical solution involves segmenting the original text corpus into blocks to obtain a sequence of text blocks. This sequence is then iteratively processed to determine the knowledge triples corresponding to each text block. Based on these knowledge triples, a knowledge graph corresponding to the original text corpus is then determined. Each iteration includes: determining background information corresponding to the current text block. This background information includes semantically related text blocks and associated triples in the current knowledge base. The current knowledge base includes knowledge triples determined in previous iterations. Finally, the knowledge triples corresponding to the current text block are determined based on the current text block and the background information. By incorporating semantically related text blocks from the background information, a global semantic context is introduced. Furthermore, by using the associated triples determined from the current knowledge base, knowledge acquired during previous processing is introduced. Therefore, determining knowledge triples by introducing background information effectively expands contextual relationships, improves the completeness and depth of extracted knowledge, and effectively avoids knowledge fragmentation. Furthermore, by defining knowledge triples by combining the current text block with its background information, and through multiple iterations, obtaining multiple knowledge triples to construct a knowledge graph, each processing step is based on the correct knowledge accumulated from previous processing. This avoids the accumulation and propagation of errors in the early stages of the process, enabling early detection and correction of mistakes. In this way, the final generated knowledge graph can be guaranteed to have higher accuracy and richer semantic relationships.

[0015] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0016] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent upon reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not limitation, in which the same or corresponding reference numerals denote the same or corresponding parts. Wherein: Figure 1 A flowchart of a knowledge graph generation method according to one embodiment of the present disclosure is shown; Figure 2 An exemplary schematic diagram illustrates the complete process of extracting initial triples in the knowledge graph generation method provided in this disclosure; Figure 3 An exemplary schematic diagram of the processing procedure based on the iterative-extraction-optimization framework in the knowledge graph generation method provided in this disclosure is shown; Figure 4A block diagram of a knowledge graph generation apparatus according to one embodiment of the present disclosure is shown; Figure 5 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0017] The principles and spirit of the invention will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are provided merely to enable those skilled in the art to better understand and implement the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided to make the invention more thorough and complete, and to fully convey the scope of the invention to those skilled in the art.

[0018] Figure 1 A flowchart of a knowledge graph generation method according to one embodiment of this disclosure is shown. Figure 1 As shown, the knowledge graph generation method provided in this disclosure may include steps 11 to 13.

[0019] In step 11, the original text corpus to be processed is divided into blocks to obtain a sequence of text blocks.

[0020] The original text corpus can be unstructured. By segmenting the original text corpus (i.e., partitioning), it can be divided into an ordered sequence of text blocks, which consists of multiple text blocks.

[0021] In step 12, the text block sequence is iteratively processed to determine the knowledge triplet corresponding to each text block in the text block sequence. Each processing step includes: determining the background information corresponding to the current text block in the current processing step. The background information includes related text blocks that are semantically related to the current text block and related triplets that are related to the current text block in the current knowledge base. The current knowledge base includes the knowledge triplets that have been determined in each processing step before the current processing step during the iterative processing step; and determining the knowledge triplet corresponding to the current text block based on the current text block and the background information.

[0022] For a sequence of text blocks, iterative processing can be performed. This means processing each text block sequentially according to its order in the sequence to determine the knowledge triple corresponding to each text block. The knowledge triple can include a head entity, a relation, and a tail entity.

[0023] During a single processing step, for the current text block to be processed (i.e., the current text block), the following steps can be performed to determine the knowledge triples corresponding to that text block: Determine the background information corresponding to the current text block being processed; Based on the current text block and background information, determine the knowledge triplet corresponding to the current text block.

[0024] The background information can include related text blocks semantically relevant to the current text block, as well as related triples in the current knowledge base that are associated with the current text block. The current knowledge base can include knowledge triples determined in each processing iteration before the current processing. That is, whenever a knowledge triple for a text block is determined through sequential processing, the knowledge triple can be stored in the knowledge base. This knowledge base is updated in real time as the processing progresses. Therefore, the knowledge base used in each processing is actually the latest knowledge base at the time of processing, which is the current knowledge base. This ensures that the related triples are comprehensive and accurate.

[0025] In one possible implementation, the associated text block can be determined in the following way: Determine the semantic vector corresponding to each text block in the text block sequence; Based on the semantic vector, the local density of each text block is determined using the density peak clustering algorithm, and the distance between the text block and its neighboring text blocks is determined for each text block. The neighboring text blocks are the text blocks with higher density that are closest to the text block. Based on the local density and distance of each text block, a semantic hierarchical network is generated. The semantic hierarchical network includes the nodes corresponding to each text block, and the neighbor nodes of each text block are the nodes corresponding to the highest density text blocks that are closest to the text block. In the semantic hierarchy network, identify text blocks that are semantically related to the current text block and use them as associated text blocks.

[0026] Optionally, each text block in the text block sequence can be mapped to a high-dimensional semantic space through an embedding model to obtain the semantic vector corresponding to each text block.

[0027] Based on the semantic vector, the density peak clustering (DPC) algorithm can be used to determine the local density of each text block. At the same time, for each text block, the distance between the text block and its neighboring text blocks can be determined. The neighboring text blocks of a text block are the text blocks with higher density that are closest to the text block. This is equivalent to determining the minimum distance from each text block to its higher density.

[0028] For example, the first can be determined by the following formula. i Density of text blocks : in, It is the first i The first text block and the first j Semantic distance of text blocks, To cut off the distance, It is an indicator function, when When less than 0 When it is 1, When greater than or equal to 0 It is 0.

[0029] For example, the first can be determined by the following formula. i The text block and the first i Similar text blocks of text blocks Distance between : in,

[0030] After determining the local density and distance of each text block, a semantic hierarchical network can be generated based on these parameters. The semantic hierarchical network includes nodes corresponding to each text block, and the neighbor nodes of each text block are the nodes corresponding to the nearest higher-density text blocks. In the semantic hierarchical network, the nearest text blocks to a text block serve as its parent nodes. Therefore, the semantic hierarchical network essentially groups the nodes of each text block in the text block sequence into a directed acyclic graph (DAG), with the text block node corresponding to the highest local density as its root node.

[0031] Based on the generated semantic hierarchy network, text blocks that are semantically related to the current text block can be identified in the semantic hierarchy network and used as associated text blocks.

[0032] In one possible implementation, nodes that are related to the nodes of the current text block can be searched in the semantic hierarchy network. These nodes include the parent node (e.g., the parent node, grandparent node, or even higher-level node), the child node (e.g., the child node, grandchild node, or even lower-level node), and the sibling node (i.e., the node that shares the same parent node, grandparent node, or even higher-level node as the node of the current text block).

[0033] In another possible implementation, associated text blocks semantically related to the current text block can be determined in a semantic hierarchy network in the following way: In the semantic hierarchical network, the parent node, child node, and sibling node corresponding to the current text block are determined as associated nodes; Identify at least one of the text blocks corresponding to the associated node as the associated text block.

[0034] In a semantic hierarchical network, based on the node corresponding to the current text block, the parent node, child nodes, and sibling nodes of that node can be determined. The text block corresponding to the parent node is semantically the conceptual center of the current text block, providing more general background information. The text blocks corresponding to the child nodes are semantically subordinate to the current text block, providing more specific and detailed supplementary information. The text blocks corresponding to the sibling nodes share a parent node with the current text block, providing parallel or analogous contextual information. Based on this, at least one of the text blocks corresponding to the parent node, child nodes, and sibling nodes can be identified as a related text block.

[0035] Optionally, after determining the associated nodes, further optimization can be performed to identify higher-quality associated text blocks. For example, a strategy combining balanced allocation and importance ranking can be used to determine the final associated text blocks: Based on the preset total number of associated text blocks Number of non-empty node categories Determine the base quota for each category ; Within each category, the nodes corresponding to text blocks can be ranked according to their importance score (e.g., Sort the nodes in descending order and then select the key nodes that appear at the top of the sort.

[0036] This ensures the richness of associated text blocks and enhances the diversity and quality of contextual sources.

[0037] Through the above methods, a density-based context perception (DBCP) mechanism is formed to determine the associated text blocks of the current text block, that is, the context related to the semantics of the current text block. Thus, an optimal and dynamic set of associated text blocks can be determined and constructed for the current text block in the semantic space of the entire original text corpus, which can effectively expand the contextual association of the current text block and is conducive to extracting higher quality knowledge in the future.

[0038] Furthermore, background information may also include association triples in the current knowledge base that are related to the current text block. In one possible implementation, association triples can be determined in the following way: Extract key entities and keywords from the current text block; Using key entities and keywords as query criteria, a search is performed in the current knowledge base to obtain the association triples associated with the current text block.

[0039] Optionally, key entities and keywords can be extracted using a Large Language Model (LLM). Then, using the extracted key entities and keywords as query criteria, a search can be performed in the current knowledge base to retrieve relevant knowledge triples, which are then used as association triples associated with the current text block.

[0040] As mentioned earlier, the current knowledge base is a set of triples determined by processing other text blocks preceding the current text block during the iterative processing of the text block sequence corresponding to the original text corpus. Based on the extracted key entities and keywords, knowledge triples related to the key entities and keywords can be identified as association triples associated with the current text block. For example, if the current text block includes the key entity or keyword A, all triples containing A will be searched in the current knowledge base and identified as association triples associated with the current text block.

[0041] By using the above method, all previously processed knowledge highly relevant to the topic of the current text block can be retrieved from the current knowledge base as background information. This helps subsequent processing to understand the current text block more accurately and effectively avoids the problems of error accumulation and propagation.

[0042] After determining the background information corresponding to the current text block, this background information can be applied to the extraction of triples from the current text block to improve the accuracy of triple extraction. Optionally, determining the knowledge triples corresponding to the current text block based on the current text block and the background information may include the following steps: The first model is used to perform entity recognition on the current text block to determine the list of entities corresponding to the current text block. Based on the entity list and background information, the second model is used to extract relationships between entities in order to determine candidate triples; Based on the candidate triples, the candidate triples are modified using a third model to determine the initial triples; Based on the initial triples, determine the knowledge triples corresponding to the current text block.

[0043] Among them, the first model, the second model, and the third model are large language models, which have powerful capabilities in natural language understanding, reasoning generation, and context modeling.

[0044] The current text block is used as input to the first model. Leveraging the first model's information processing capabilities, entity recognition is performed on the current text block to determine the corresponding list of entities. For example, prompting can guide the first model to identify predefined core entity types (such as standards, clauses, and technical specifications). Another example is the discovery of new, domain-specific entity categories through prompting. Yet another example is the handling of complex entities (such as nested and composite entities) through rules and examples, improving the accuracy of entity boundary identification.

[0045] The entity list output by the first model can be used as input to the second model. Simultaneously, the background information corresponding to the current text block is also input into the second model along with the entity list. The second model's information processing capabilities are then used to extract relationships between entities to determine candidate triples. By inputting the background information corresponding to the current text block into the second model, the model's ability to parse complex relationships is effectively enhanced, thereby improving the comprehensiveness and accuracy of candidate triple determination.

[0046] The cue words for the second model can at least be used to instruct the second model to distinguish between direct, implicit, and attribute relationships between entities. For example, cue engineering can guide the second model to distinguish between these relationships. Furthermore, a confidence assessment mechanism can be introduced, using cue engineering to instruct the second model to generate a confidence score for each candidate triple.

[0047] The candidate triples output by the second model can be used as input to the third model. Based on the information processing capabilities of the third model, the candidate triples can be corrected to obtain the initial triples. The third model is used for quality control of the candidate triples. Through prompting engineering, the third model can be guided to systematically correct the candidate triples. Corrections include, but are not limited to, completeness completion, expression normalization, redundancy elimination, and confidence calibration, to improve the quality of the candidate triples. The third model outputs the improved knowledge triples as the initial triples.

[0048] After obtaining the initial triplet, the knowledge triplet corresponding to the current text block can be determined based on the initial triplet.

[0049] For example, the complete process of extracting the initial triplet can be as follows: Figure 2 As shown. Wherein: By determining the semantic vector corresponding to each text block in the text block sequence, the density peak clustering algorithm is used to determine the local density and distance of each text block, and a semantic hierarchical network is constructed. For the current text block, in the semantic hierarchy network, the associated nodes of the current text block (such as parent nodes, child nodes, and sibling nodes) are determined, and then the associated text blocks are determined; For the current text block, extract key entities and keywords, and query the current knowledge base to obtain related triples; The associated text block and the associated triples together serve as background information for the current text block, which is used for triple extraction; Triple extraction is divided into three stages: entity extraction based on the first model, triple extraction based on the second model, and triple correction based on the third model. From these stages, the initial triples can be obtained.

[0050] In one possible implementation, the initial triplet can be directly used as the knowledge triplet corresponding to the current text block.

[0051] In another possible implementation, determining the knowledge triples corresponding to the current text block based on the initial triples may include the following steps: The initial triples are filtered according to the preset filtering rules to obtain the filtered intermediate triples. The filtering rules include at least one of the following: syntax structure filtering rules, confidence filtering rules, and deduplication rules. According to the preset normalization rules, the intermediate triples are normalized to obtain normalized triples, which serve as the knowledge triples corresponding to the current text block. The normalization rules include at least one of relation standardization rules, conflict detection and resolution rules, and semantic fusion rules.

[0052] Although the initial triples obtained after processing by the third model have been verified for quality, they may still inevitably contain noise, redundancy, inconsistencies, etc. The initial triples can be refined through a two-stage optimization process of filtering rules and normalization rules.

[0053] Filtering rules can include, but are not limited to, at least one of the following: syntax structure filtering rules, confidence level filtering rules, and deduplication rules. After filtering based on these rules, knowledge triples with non-standard formats, insufficient information, or structural errors can be effectively removed, which is beneficial for improving the quality of the subsequent knowledge graph's basic structure. The details of the filtering rules can be flexibly set according to actual needs.

[0054] For example, grammatical structure filtering rules can be used to standardize the text of the components of knowledge triples (e.g., remove extra whitespace) and remove structurally invalid knowledge triples (such as null triples, semantically empty triples, irrational self-loops, etc.).

[0055] For example, a confidence filtering rule can be used to set a confidence threshold to filter out knowledge triples with a confidence level below that threshold. Optionally, the confidence threshold can be obtained from the second model described above.

[0056] For example, deduplication rules can be used to detect and remove completely duplicate knowledge triples. For instance, each knowledge triple can be combined into a unique identifier by the head entity, relation, and tail entity, and only one of the duplicate identifiers can be kept (e.g., keep the one with the highest confidence).

[0057] After filtering the initial triples according to preset filtering rules, the filtered intermediate triples can be obtained. At this point, the intermediate triples can be further normalized according to preset normalization rules. Normalization rules can include, but are not limited to, at least one of relation standardization rules, conflict detection and resolution rules, and semantic fusion rules. Normalization based on these rules helps improve the semantic consistency and cohesion of the subsequently generated knowledge graph.

[0058] For example, relation standardization rules can pre-set a set of predefined relation diversification expression mapping rules to map similar relation expressions (such as synonyms or near-synonyms like reference, follow, and based on) to the same relation description mode, so as to unify the expression mode of relation predicates.

[0059] For example, conflict detection and resolution rules can be used to detect mutual exclusion relationships (i.e., conflicts) between knowledge triples, and to resolve conflicts (i.e., how to select conflicting knowledge triples). For instance, potential semantic conflicts can be detected through entity pair grouping strategies to identify knowledge triples that may have mutual exclusion relationships within the same pair of entities, and the knowledge triples with the highest confidence can be retained as the final valid knowledge triples.

[0060] For example, semantic fusion rules can be used to construct strict identifiers that include entity types, such as generating unique identifiers based on head entity name, head entity type, relation, tail entity name, and tail entity type, to fuse semantically equivalent knowledge triples with the same unique identifier into one (or, retain only one), which can more effectively avoid deep semantic redundancy.

[0061] In this way, after normalizing the intermediate triples to obtain normalized triples, they can be used as the knowledge triples corresponding to the current text block.

[0062] Based on the method described above, each text block in the text block sequence can be processed separately to obtain the knowledge triple corresponding to that text block. Since the background information used in each processing is the latest, the quality of each knowledge triple can be effectively guaranteed, avoiding problems such as error accumulation and error propagation.

[0063] After determining the knowledge triple corresponding to each text block in the text block sequence, step 13 can be executed.

[0064] In step 13, a knowledge graph corresponding to the original text corpus is determined based on the knowledge triples corresponding to each text block in the text block sequence.

[0065] In one possible implementation, a knowledge graph can be generated directly based on the knowledge triples corresponding to each text block.

[0066] In another possible implementation, the knowledge triples corresponding to each text block in the text block sequence can be filtered, and a knowledge graph can be generated based on the filtered knowledge triples. The filtering rules can be pre-set and flexibly configured according to actual needs. For example, filtering can be achieved by retaining only one knowledge triple from two or more knowledge triples whose semantic similarity exceeds a specified threshold, based on the pairwise semantic similarity between each pair of knowledge triples corresponding to each text block in the text block sequence.

[0067] As described above, this disclosure provides an iterative-extraction-optimization framework. During the iterative processing of each text block, it dynamically generates the latest background information related to that text block, assisting in comprehensively determining the complex and long-distance relationships between entities within the text block. Furthermore, after obtaining knowledge triples in each iteration, timely corrections and optimizations can be performed to prevent errors from accumulating and amplifying during processing. Moreover, as iteration progresses, the background information becomes increasingly rich, facilitating the discovery of deeper and more subtle entity relationships in the original text corpus, thereby contributing to the construction of a more semantically coherent and consistent knowledge graph.

[0068] For example, the iterative-extraction-optimization framework described in this disclosure can be as follows: Figure 3 As shown. Wherein: The original text corpus is processed to obtain a sequence of text blocks, and then iterative processing is performed according to the order of the text blocks in the sequence, processing the current text block each time. In the current text block, during a single iteration, the extraction process first involves three stages: named entity recognition, triple extraction (i.e., entity relation extraction), and correction processing, to obtain the initial triples. The optimizer then performs two stages of optimization on the initial triplet: filtering and normalization, to obtain the knowledge triplet corresponding to the current text block. Once this iteration is complete, a termination check can be performed to determine whether the iteration is complete. If not, the iteration continues to process the next text block. The obtained knowledge triples will be stored in the knowledge base. Some triples in the knowledge base can be used as triples for the background information association triples to assist the extractor in extracting triples. Once each text block in the text block sequence has been processed, the termination condition is determined to confirm the completion of the iteration, and the iteration can be ended. The knowledge graph is then determined based on the knowledge triples.

[0069] The above technical solution involves segmenting the original text corpus into blocks to obtain a sequence of text blocks. This sequence is then iteratively processed to determine the knowledge triples corresponding to each text block. Based on these knowledge triples, a knowledge graph corresponding to the original text corpus is then determined. Each iteration includes: determining background information corresponding to the current text block. This background information includes semantically related text blocks and associated triples in the current knowledge base. The current knowledge base includes knowledge triples determined in previous iterations. Finally, the knowledge triples corresponding to the current text block are determined based on the current text block and the background information. By incorporating semantically related text blocks from the background information, a global semantic context is introduced. Furthermore, by using the associated triples determined from the current knowledge base, knowledge acquired during previous processing is introduced. Therefore, determining knowledge triples by introducing background information effectively expands contextual relationships, improves the completeness and depth of extracted knowledge, and effectively avoids knowledge fragmentation. Furthermore, by defining knowledge triples by combining the current text block with its background information, and through multiple iterations, obtaining multiple knowledge triples to construct a knowledge graph, each processing step is based on the correct knowledge accumulated from previous processing. This avoids the accumulation and propagation of errors in the early stages of the process, enabling early detection and correction of mistakes. In this way, the final generated knowledge graph can be guaranteed to have higher accuracy and richer semantic relationships.

[0070] Figure 4 A block diagram of a knowledge graph generation apparatus according to one embodiment of the present disclosure is shown. Figure 4 As shown, the device 40 may include: The first processing module 41 is used to perform block processing on the original text corpus to be processed, and obtain a text block sequence. The second processing module 42 is used to iteratively process the text block sequence to determine the knowledge triplet corresponding to each text block in the text block sequence. Each processing step includes: determining background information corresponding to the current text block being processed, the background information including related text blocks semantically related to the current text block, and related triplets in the current knowledge base that are related to the current text block. The current knowledge base includes knowledge triplets determined in each processing step before the current processing step during the iterative processing. Based on the current text block and the background information, the knowledge triplet corresponding to the current text block is determined. The first determining module 43 is used to determine the knowledge graph corresponding to the original text corpus based on the knowledge triples corresponding to each text block in the text block sequence.

[0071] Optionally, the associated text block is determined by the following module: The second determining module is used to determine the semantic vector corresponding to each text block in the text block sequence; The third determining module is used to determine the local density of each text block using the density peak clustering algorithm based on the semantic vector, and to determine the distance between the text block and the nearby text blocks for each text block, wherein the nearby text blocks are the text blocks with higher density that are closest to the text block. The generation module is used to generate a semantic hierarchy network based on the local density and distance corresponding to each text block. The semantic hierarchy network includes the nodes corresponding to each text block, and the neighbor nodes of each text block are the nodes corresponding to the higher-density text blocks that are closest to the text block. The fourth determining module is used to determine, in the semantic hierarchy network, a text block that is semantically related to the current text block, as the associated text block.

[0072] Optionally, the fourth determining module includes: The first determining submodule is used to determine the parent node, child node, and sibling node corresponding to the current text block in the semantic hierarchy network, as associated nodes; The second determining submodule is used to determine at least one of the text blocks corresponding to the associated node as the associated text block.

[0073] Optionally, the associated triples are determined by the following modules: The fifth determining module is used to extract key entities and keywords from the current text block; The retrieval module is used to search the current knowledge base using the key entities and the subject terms as query conditions to obtain the association triplet associated with the current text block.

[0074] Optionally, the second processing module 42 includes: The third determination submodule is used to perform entity recognition on the current text block using the first model to determine the entity list corresponding to the current text block; The fourth determination submodule is used to extract inter-entity relationships based on the entity list and the background information using the second model to determine candidate triples; The fifth determination submodule is used to modify the candidate triples according to the candidate triples using the third model to determine the initial triples; The sixth determining submodule is used to determine the knowledge triplet corresponding to the current text block based on the initial triplet; Among them, the first model, the second model, and the third model are all large language models.

[0075] Optionally, the cue words of the second model are at least used to instruct the second model to distinguish between direct relationships, implicit relationships, and attribute relationships between entities.

[0076] Optionally, the sixth determining submodule includes: The first processing submodule is used to filter the initial triples according to preset filtering rules to obtain filtered intermediate triples. The filtering rules include at least one of syntax structure filtering rules, confidence filtering rules, and deduplication rules. The second processing submodule is used to normalize the intermediate triples according to preset normalization rules to obtain normalized triples as knowledge triples corresponding to the current text block. The normalization rules include at least one of relation normalization rules, conflict detection and resolution rules, and semantic fusion rules.

[0077] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0078] Based on the same inventive concept, this disclosure also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the knowledge graph generation method provided in any embodiment of this disclosure.

[0079] Based on the same inventive concept, this disclosure also provides an electronic device, including: A memory on which computer programs are stored; A processor is configured to execute the computer program in the memory to implement the steps of the knowledge graph generation method provided in any embodiment of this disclosure.

[0080] Based on the same inventive concept, this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the knowledge graph generation method provided in any embodiment of this disclosure.

[0081] Figure 5 This is a block diagram illustrating an electronic device 700 according to an exemplary embodiment. Figure 5 As shown, the electronic device 700 may include a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output (I / O) interface 704, and a communication component 705.

[0082] The processor 701 controls the overall operation of the electronic device 700 to complete all or part of the steps in the knowledge graph generation method described above. The memory 702 stores various types of data to support the operation of the electronic device 700. This data may include, for example, instructions for any application or method operating on the electronic device 700, and application-related data such as contact data, sent and received messages, images, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The multimedia component 703 may include a screen and audio components. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 702 or transmitted via communication component 705. The audio component also includes at least one speaker for outputting audio signals. I / O interface 704 provides an interface between processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication may include Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination thereof; therefore, the corresponding communication component 705 may include a Wi-Fi module, a Bluetooth module, or an NFC module.

[0083] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the knowledge graph generation method described above.

[0084] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the knowledge graph generation method described above. For example, the computer-readable storage medium may be the memory 702 including the program instructions described above, which may be executed by the processor 701 of the electronic device 700 to complete the knowledge graph generation method described above.

[0085] In another exemplary embodiment, a computer program product is also provided, which includes a computer program executable by a processor, which, when executed by the processor, implements the steps of the knowledge graph generation method described above.

[0086] The preferred embodiments of this disclosure have been described in detail above with reference to the accompanying drawings. However, this disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this disclosure, various simple modifications can be made to the technical solutions of this disclosure, and these simple modifications all fall within the protection scope of this disclosure.

[0087] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0088] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

Claims

1. A method for generating knowledge graphs, characterized in that, The method includes: The original text corpus to be processed is divided into blocks to obtain a sequence of text blocks. The text block sequence is iteratively processed to determine the knowledge triplet corresponding to each text block in the text block sequence. Each processing step includes: determining the background information corresponding to the current text block being processed, the background information including related text blocks semantically related to the current text block, and related triplets in the current knowledge base that are related to the current text block, the current knowledge base including the knowledge triplets determined in each processing step before the current processing step; and determining the knowledge triplet corresponding to the current text block based on the current text block and the background information. Based on the knowledge triples corresponding to each text block in the text block sequence, a knowledge graph corresponding to the original text corpus is determined. The associated text block is determined in the following way: Determine the semantic vector corresponding to each text block in the text block sequence; Based on the semantic vector, the local density of each text block is determined using the density peak clustering algorithm, and the distance between the text block and its neighboring text blocks is determined for each text block, wherein the neighboring text blocks are the text blocks with higher density that are closest to the text block. A semantic hierarchy network is generated based on the local density and distance of each text block. The semantic hierarchy network includes the nodes corresponding to each text block, and the neighbor nodes of each text block are the nodes corresponding to the higher-density text blocks that are closest to the text block. In the semantic hierarchy network, a text block that is semantically related to the current text block is identified as the associated text block.

2. The method according to claim 1, characterized in that, The step of determining the text block semantically related to the current text block in the semantic hierarchy network as the associated text block includes: In the semantic hierarchy network, the parent node, child node, and sibling node corresponding to the current text block are determined as associated nodes; At least one of the text blocks corresponding to the associated node is identified as the associated text block.

3. The method according to claim 1, characterized in that, The associated triplet is determined in the following way: Extract key entities and keywords from the current text block; Using the key entities and the keywords as query conditions, a search is performed in the current knowledge base to obtain the association triplet associated with the current text block.

4. The method according to claim 1, characterized in that, The step of determining the knowledge triple corresponding to the current text block based on the current text block and the background information includes: The first model is used to perform entity recognition on the current text block to determine the entity list corresponding to the current text block; Based on the entity list and the background information, the second model is used to extract relationships between entities in order to determine candidate triples. Based on the candidate triples, the candidate triples are modified using a third model to determine the initial triples; Based on the initial triples, determine the knowledge triples corresponding to the current text block; Among them, the first model, the second model, and the third model are all large language models.

5. The method according to claim 4, characterized in that, The cue words of the second model are used at least to instruct the second model to distinguish between direct relationships, implicit relationships, and attribute relationships between entities.

6. The method according to claim 4, characterized in that, The step of determining the knowledge triple corresponding to the current text block based on the initial triple includes: The initial triplet is filtered according to a preset filtering rule to obtain the filtered intermediate triplet. The filtering rule includes at least one of the following: syntax structure filtering rule, confidence filtering rule, and deduplication rule. The intermediate triples are normalized according to preset normalization rules to obtain normalized triples, which serve as knowledge triples corresponding to the current text block. The normalization rules include at least one of relation normalization rules, conflict detection and resolution rules, and semantic fusion rules.

7. A knowledge graph generation device, characterized in that, The device includes: The first processing module is used to divide the original text corpus into blocks to obtain a sequence of text blocks. The second processing module is used to iteratively process the text block sequence to determine the knowledge triplet corresponding to each text block in the text block sequence. Each processing step includes: determining background information corresponding to the current text block being processed, the background information including related text blocks semantically related to the current text block, and related triplets in the current knowledge base that are related to the current text block. The current knowledge base includes knowledge triplets determined in each processing step before the current processing step during the iterative processing; and determining the knowledge triplet corresponding to the current text block based on the current text block and the background information. The first determining module is used to determine the knowledge graph corresponding to the original text corpus based on the knowledge triples corresponding to each text block in the text block sequence. The associated text block is determined by the following modules: The second determining module is used to determine the semantic vector corresponding to each text block in the text block sequence; The third determining module is used to determine the local density of each text block using the density peak clustering algorithm based on the semantic vector, and to determine the distance between the text block and the nearby text blocks for each text block, wherein the nearby text blocks are the text blocks with higher density that are closest to the text block. The generation module is used to generate a semantic hierarchy network based on the local density and distance corresponding to each text block. The semantic hierarchy network includes the nodes corresponding to each text block, and the neighbor nodes of each text block are the nodes corresponding to the higher-density text blocks that are closest to the text block. The fourth determining module is used to determine, in the semantic hierarchy network, a text block that is semantically related to the current text block, as the associated text block.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1-6.

9. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Incremental knowledge graph generation system and method of large language model

    CN120296175A