Knowledge graph generation method and device, storage medium and electronic equipment

By segmenting and iteratively processing unstructured text, and combining density peak clustering and a large language model, the accuracy and completeness issues in knowledge graph construction in existing technologies are solved, resulting in a high-quality knowledge graph.

CN121365722AActive Publication Date: 2026-01-20CHINA AERO POLYTECH ESTAB +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511645144.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-01-20
Estimated Expiration
2045-11-11

AI Technical Summary

Technical Problem

Existing technologies struggle to form complete knowledge networks when automatically constructing knowledge graphs from unstructured text, and errors in entity and relationship recognition result in inaccurate knowledge graphs.

Method used

By segmenting the original text corpus into blocks, a sequence of text blocks is generated. Through iterative processing, the knowledge triples of each text block are determined. Using density peak clustering algorithm and large language model, combined with semantic hierarchical network and background information, associated text blocks and triples are gradually determined, entity recognition, relation extraction and correction are performed, and a knowledge graph is constructed.

Benefits of technology

It improves the accuracy and semantic relevance of knowledge graphs, avoids error accumulation and propagation, and generates a more complete and in-depth knowledge network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121365722A_ABST
    Figure CN121365722A_ABST
Patent Text Reader

Abstract

The invention relates to a knowledge graph generation method and device, a storage medium and electronic equipment. The method comprises the following steps: performing block processing on a to-be-processed original text corpus to obtain a text block sequence; performing iterative processing on the text block sequence to determine a knowledge triple corresponding to each text block in the text block sequence, each processing comprising: determining background information corresponding to the current text block of the current processing, the background information comprises an associated text block related to the semantics of the current text block and an associated triad having an association relationship with the current text block in a current knowledge base, and the current knowledge base comprises knowledge triads determined in each time of processing before the current time of processing in the iterative processing process; determining a knowledge triple corresponding to the current text block according to the current text block and the background information; and determining a knowledge graph corresponding to the original text corpus according to the knowledge triple 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] The present disclosure relates to the technical field of computer, in particular, to a knowledge graph generation method and device, a storage medium and an electronic device. BACKGROUND

[0002] In the field of knowledge graph construction, especially in the field of automatically constructing a knowledge graph from unstructured text (such as technical standards, academic literature), it is usually necessary to rely on a pre-defined rule template or a supervised machine learning model to sequentially perform named entity recognition and relation extraction. However, such a processing method can usually only extract fragmented knowledge, and it is difficult to form a complete knowledge network, and there are problems such as entity recognition errors and relation recognition errors, and the errors generated in the entire processing process will be continuously transmitted and amplified, resulting in a large lack of overall accuracy in the finally constructed knowledge graph. SUMMARY

[0003] The purpose of the present disclosure is to provide a knowledge graph generation method, device, storage medium and electronic device.

[0004] In order to achieve the above-mentioned purpose, according to a first aspect of the present disclosure, a knowledge graph generation method is provided, the method comprising: performing block processing on a to-be-processed original text corpus to obtain a text block sequence; performing iterative processing on the text block sequence to determine a knowledge triple corresponding to each text block in the text block sequence, wherein each processing comprises: determining background information corresponding to a current text block of the current processing, the background information comprising associated text blocks related to the semantic of the current text block, and associated triples in a current knowledge base having an association relationship with the current text block, the current knowledge base comprising knowledge triples determined by each processing before the current processing in the iterative processing process; determining a knowledge triple corresponding to the current text block according to the current text block and the background information; determining a knowledge graph corresponding to the original text corpus according to the knowledge triple corresponding to each text block in the text block sequence.

[0005] Optionally, the associated text blocks are determined by the following method: determining a semantic vector corresponding to each text block in the text block sequence; determining the local density of each text block using a density peak clustering algorithm according to the semantic vector, and determining the distance between the text block and the similar text blocks of the text block for each text block, wherein the similar text blocks of the text block are the text blocks with higher density closest to the text block; generate a semantic hierarchical network according to the local density and distance corresponding to each text block, the semantic hierarchical network comprising a node corresponding to each text block, and a neighbor node of each text block being a node corresponding to a text block with the closest distance and higher density; determine, in the semantic hierarchical network, a text block related to the semantic of the current text block as the associated text block.

[0006] Optionally, the determining, in the semantic hierarchical network, a text block related to the semantic of the current text block as the associated text block comprises: determine, in the semantic hierarchical network, a parent node, a child node and a sibling node corresponding to the current text block as an associated node; determine at least one of the text blocks corresponding to the associated node as the associated text block.

[0007] Optionally, the associated triple is determined by: extract a key entity and a subject word from the current text block; perform a search in the current knowledge base with the key entity and the subject word as a query condition to obtain an associated triple related to the current text block.

[0008] Optionally, the determining, according to the current text block and the background information, of a knowledge triple corresponding to the current text block comprises: perform entity recognition on the current text block by a first model to determine an entity list corresponding to the current text block; perform inter-entity relationship extraction on the entity list and the background information by a second model to determine a candidate triple; perform correction processing on the candidate triple by a third model according to the candidate triple to determine an initial triple; determine a knowledge triple corresponding to the current text block according to the initial triple; wherein the first model, the second model and the third model are large language models respectively.

[0009] Optionally, the prompt word of the second model is used at least to indicate that the second model distinguishes direct relationships, implicit relationships and attribute relationships between entities.

[0010] Optionally, the determining, according to the initial triple, of a knowledge triple corresponding to the current text block comprises: According to a preset filtering rule, the initial triple is filtered to obtain an intermediate filtered triple, the filtering rule including at least one of a syntax structure filtering rule, a confidence filtering rule, and a deduplication rule; According to a preset normalization rule, the intermediate triple is normalized to obtain a normalized triple as a knowledge triple corresponding to the current text block, the normalization rule including at least one of a relationship standardization rule, a conflict detection and resolution rule, and a semantic fusion rule.

[0011] According to a second aspect of the present disclosure, a knowledge graph generation device is provided, and the device includes: A first processing module is configured to perform block processing on an original text corpus to be processed to obtain a text block sequence. A second processing module is configured to perform iterative processing on the text block sequence to determine a knowledge triple corresponding to each text block in the text block sequence, wherein each processing includes: determining background information corresponding to a current text block of the current processing, the background information including associated text blocks related to the semantic of the current text block and associated triples in a current knowledge base having an association relationship with the current text block, the current knowledge base including knowledge triples determined by each processing before the current processing in the iterative processing process; and determining a knowledge triple corresponding to the current text block according to the current text block and the background information. A first determining module is configured to determine a knowledge graph corresponding to the original text corpus according to the knowledge triple corresponding to each text block in the text block sequence.

[0012] According to a third aspect of the present disclosure, a computer readable storage medium is provided, which stores a computer program, and the program is executed by a processor to implement the steps of the method of the first aspect of the present disclosure.

[0013] According to a fourth aspect of the present disclosure, an electronic device is provided, and the device includes: A memory storing a computer program; A processor configured to execute the computer program in the memory to implement the steps of the method of the first aspect of the present disclosure.

[0014] By the technical solution, the original text corpus to be processed is subjected to block processing to obtain a text block sequence, and the text block sequence is subjected to iterative processing to determine a knowledge triple corresponding to each text block in the text block sequence, and then a knowledge graph corresponding to the original text corpus is determined according to the knowledge triple corresponding to each text block in the text block sequence. Each processing of the iterative processing includes: determining background information corresponding to a current text block of the processing, the background information including an associated text block semantically related to the current text block and an associated triple in the current knowledge base having an association relationship with the current text block, the current knowledge base including the knowledge triples determined by respective processing before the current processing in the iterative processing, and then determining the knowledge triple corresponding to the current text block according to the current text block and the background information. The associated text block semantically related to the current text block in the background information is equivalent to introducing a global semantic context, and the associated triple determined based on the current knowledge base in the background information is equivalent to introducing the knowledge obtained in the historical processing. Thus, by introducing the background information to determine the knowledge triple, the context association can be effectively expanded, the completeness and depth of the extracted knowledge can be improved, and the knowledge fragmentation can be effectively avoided. Moreover, the knowledge triple is determined for the current text block and its background information, and multiple knowledge triples are obtained through multiple iterations to construct the knowledge graph, so that each processing can be based on the correct knowledge accumulated by the previous processing, the accumulation and propagation of errors in the early stage can be avoided, and the early detection and correction of errors can be realized. In this way, the knowledge graph generated finally can have higher accuracy and more rich semantic association.

[0015] Other features and advantages of the present disclosure will be described in detail in the following detailed description section. BRIEF DESCRIPTION OF DRAWINGS

[0016] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which a number of embodiments of the application are shown by way of illustrative example. In the drawings: Figure 1 A flow chart of a knowledge graph generation method according to an embodiment of the present disclosure is shown; Figure 2 An exemplary schematic diagram of the complete process of extracting initial triples in the knowledge graph generation method provided by the present disclosure is shown; Figure 3 An exemplary schematic diagram of the processing process based on the iterative-extraction-optimization framework in the knowledge graph generation method provided by the present disclosure is shown; Figure 4A block diagram of a knowledge graph generation apparatus is shown according to an embodiment of the present disclosure; Figure 5 A block diagram of an electronic device is shown according to an exemplary embodiment. DETAILED DESCRIPTION

[0017] The principles and spirits of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are given only to enable those skilled in the art to better understand and implement the present application, and in no way limit the scope of the present application. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.

[0018] Figure 1 A flowchart of a knowledge graph generation method is shown according to an embodiment of the present disclosure. As shown in Figure 1 The knowledge graph generation method provided by the present disclosure can include steps 11 to 13.

[0019] In step 11, the original text corpus to be processed is subjected to blocking processing to obtain a text block sequence.

[0020] The original text corpus can be an unstructured text corpus. By subjecting the original text corpus to blocking processing (i.e., segmentation processing), the original text corpus can be divided into an ordered text block sequence, which includes a plurality of text blocks.

[0021] In step 12, the text block sequence is subjected to iterative processing to determine the knowledge triple corresponding to each text block in the text block sequence, wherein each processing includes: determining the background information corresponding to the current text block of the present processing, the background information including the associated text blocks related to the semantics of the current text block, and the associated triples in the current knowledge base that have an association relationship with the current text block, the current knowledge base including the knowledge triples determined by each processing before the present processing in the iterative processing process; determining the knowledge triple corresponding to the current text block according to the current text block and the background information.

[0022] For the text block sequence, iterative processing can be performed, that is, each text block is processed in turn according to the order of the text blocks in the text block sequence to determine the knowledge triple corresponding to each text block. The knowledge triple can include a head entity, a relationship, and a tail entity.

[0023] In the processing process, for the text block to be processed at present (i.e., the current text block), the following steps can be performed to determine the knowledge triple corresponding to the text block: determine the background information corresponding to the current text block of the present processing; According to the current text block and the background information, determine the knowledge triple corresponding to the current text block.

[0024] The background information can include the associated text blocks related to the semantics of the current text block, and the associated triples in the current knowledge base that have an association relationship with the current text block. The current knowledge base can include the knowledge triples determined in each processing before the current processing in the iterative processing process, that is, each time a knowledge triple of a text block is determined through sequential processing, the knowledge triple can be stored in the knowledge base, and the knowledge base is updated in real time as the iterative processing proceeds, so that the knowledge base used each time is essentially the latest knowledge base at the time of processing, that is, the current knowledge base, which can ensure that the associated triples are comprehensive and accurate.

[0025] In a possible implementation, the associated text blocks can be determined by the following method: Determine the semantic vector corresponding to each text block in the text block sequence; According to the semantic vector, the local density of each text block is determined by using the density peak clustering algorithm, and the distance between the text block and the similar text block of the text block is determined for each text block, wherein the similar text block of the text block is the text block with higher density closest to the text block; According to the local density and distance corresponding to each text block, a semantic hierarchical network is generated, the semantic hierarchical network includes nodes corresponding to each text block respectively, and the neighbor node of each text block is the node corresponding to the text block with higher density closest to the text block; Determine the text block related to the semantics of the current text block in the semantic hierarchical network as the associated text block.

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

[0027] According to the semantic vector, the local density of each text block can be determined by using the density peak clustering algorithm (Density Peak Clustering, DPC), and the distance between the text block and its similar text block can be determined for each text block, wherein the similar text block of the text block is the text block with higher density closest to the text block, which is equivalent to determining the minimum distance of each text block to its higher density.

[0028] For example, the density of the i-th text block can be determined by the following formula: i wherein, ​​It is the first i The first text block and the first j The semantic distance of each text block 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 the semantic hierarchical network, according to the node corresponding to the current text block, the parent node, the child node and the sibling node of the node can be determined, wherein the text block corresponding to the parent node is the conceptual center of the current text block in semantics, can provide more general background information, the text block corresponding to the child node is subordinate to the current text block in semantics, can provide more specific and detailed supplementary information, and the text block corresponding to the sibling node shares a parent node with the current text block, can provide parallel or analogous context information. Based on this, at least one of the text blocks corresponding to the parent node, the text blocks corresponding to the child node and the text blocks corresponding to the sibling node can be determined as the associated text blocks.

[0035] Optionally, after determining the associated nodes, a certain degree of optimization processing can be performed to determine the associated text blocks with better quality. For example, a strategy combining balanced allocation and importance sorting can be used to determine the final associated text blocks: According to the total number of preset associated text blocks And the number of non-empty node categories Determine the basic quota of each category ; Within each category, the nodes corresponding to the text blocks can be arranged in descending order according to their importance scores (for example, ), and then the key nodes at the top of the sorting can be selected.

[0036] In this way, the richness of the associated text blocks can be ensured, and the diversity and high quality of the context sources can be improved.

[0037] In the above manner, 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 overall semantic space of the original text corpus, which can effectively expand the context association of the current text block and is conducive to extracting higher quality knowledge in the subsequent process.

[0038] In addition, the background information can also include associated triples associated with the current text block in the current knowledge base. In one possible implementation, the associated triples can be determined in the following manner: Extracting key entities and topic words from the current text block; Using the key entities and topic words as query conditions, searching in the current knowledge base to obtain associated triples associated with the current text block.

[0039] Optionally, the extraction of key entities and topic words can be implemented through a large language model (LLM). Subsequently, the extracted key entities and topic words can be used as query conditions to search in the current knowledge base to retrieve relevant knowledge triples as the associated triples associated with the current text block.

[0040] As described above, the current knowledge base is a set of triples determined by the knowledge triples determined by processing other text blocks before the current text block in the process of iteratively processing the sequence of text blocks corresponding to the original text corpus. Based on the extracted key entities and topic words, knowledge triples related to the key entities and topic words can be determined as the associated triples associated with the current text block. For example, if the current text block includes a key entity or topic word A, all triples containing A in the current knowledge base will be searched and used as the associated triples associated with the current text block.

[0041] In this way, all previously processed knowledge highly related to the topic of the current text block can be obtained from the current knowledge base as background information, which helps subsequent processing to more accurately understand the current text block and effectively avoids the problem of error accumulation and propagation.

[0042] After determining the background information corresponding to the current text block, the background information can be applied to the triple extraction of the current text block to improve the accuracy of triple extraction. Optionally, determining the knowledge triples corresponding to the current text block according to the current text block and the background information can include the following steps: performing entity recognition on the current text block through a first model to determine an entity list corresponding to the current text block; performing inter-entity relation extraction through a second model according to the entity list and the background information to determine candidate triples; performing correction processing on the candidate triples through a third model according to the candidate triples to determine initial triples; determining the knowledge triples corresponding to the current text block according to the initial triples.

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

[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 (such as parent nodes, child nodes, and sibling nodes) of the current text block are determined, and then the associated text blocks are determined; For the current text block, key entities and subject words are extracted, and associated triples are obtained by querying the current knowledge base; The associated text blocks and the associated triples are used as background information of the current text block to perform triple extraction. The triple extraction is divided into three stages, namely, an entity extraction stage based on a first model, a triple extraction stage based on a second model, and a triple correction stage based on a third model, so that initial triples can be obtained.

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

[0051] In another possible implementation, determining the knowledge triples corresponding to the current text block according to the initial triples can include the following steps: According to a preset filtering rule, the initial triples are filtered to obtain intermediate triples, and the filtering rule includes at least one of a syntax structure filtering rule, a confidence filtering rule, and a deduplication rule. According to a preset normalization rule, the intermediate triples are normalized to obtain normalized triples as the knowledge triples corresponding to the current text block, and the normalization rule includes at least one of a relationship standardization rule, a conflict detection and resolution rule, and a semantic fusion rule.

[0052] Although the initial triples obtained through the third model processing have been verified in quality, there may still be noise, redundancy, inconsistency, and the like from the whole, and the initial triples can be refined through the two-stage optimization process of the filtering rule and the normalization rule.

[0053] The filtering rule can include, but is not limited to, at least one of a syntax structure filtering rule, a confidence filtering rule, and a deduplication rule. After filtering processing based on the filtering rule, knowledge triples with non-standard format, insufficient information, and structural errors can be effectively removed, which is beneficial to improving the basic structure quality of the subsequent knowledge graph. The details of the filtering rule can be flexibly set according to actual needs.

[0054] For example, the syntax structure filtering rule can be used to standardize the text of the components of the knowledge triples (for example, remove redundant spaces, etc.), and remove structurally invalid knowledge triples (such as null triples, semantically empty triples, and unreasonable self-loops).

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

[0056] For example, the deduplication rule can be used to detect and remove completely duplicated knowledge triples, for example, each knowledge triple can be combined into a unique identifier according to the head entity, the relationship, and the tail entity, and only one of the identical identifiers is retained (for example, the one with the highest confidence).

[0057] After the initial triples are filtered according to the preset filtering rules, the filtered intermediate triples can be obtained. At this time, the intermediate triples can be further normalized according to the preset normalization rules. The normalization rules can include, but are not limited to, at least one of the relationship normalization rules, the conflict detection and resolution rules, and the semantic fusion rules. After normalization based on the normalization rules, the semantic consistency and cohesion of the subsequent generated knowledge graph can be improved.

[0058] For example, the relationship normalization rule can pre-set a set of predefined relationship diversification mapping rules to map similar relationship expressions (such as reference, follow, based on such synonymous or near-synonymous expressions) to the same relationship description method to unify the expression method of the relationship predicate.

[0059] For example, the conflict detection and resolution rule can be used to detect the mutual exclusion relationship (i.e., conflict) between knowledge triples and the resolution rule for the conflict (i.e., how to select knowledge triples with conflicts). For example, potential semantic conflicts can be detected by an entity pair grouping strategy to identify knowledge triples that may have mutual exclusion relationships for the same pair of entities, and the knowledge triple with the highest confidence can be retained as the final valid knowledge triple.

[0060] For example, the semantic fusion rule can be used to construct a strict identifier containing the entity type, for example, to generate a unique identifier based on the head entity name, the head entity type, the relationship, the tail entity name, and the tail entity type, to fuse semantic equivalent knowledge triples with the same unique identifier (or, only one is retained), which can more effectively avoid deep semantic redundancy.

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

[0062] Based on the above-described manner, each text block in the text block sequence can be processed respectively, and then the knowledge triple corresponding to the text block is obtained. Since the background information used each time is the latest, the quality of the knowledge triple each time can be effectively guaranteed, and problems such as error accumulation and error transmission can be avoided.

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

[0064] In step 13, according to the knowledge triple corresponding to each text block in the text block sequence, the knowledge graph corresponding to the original text corpus is determined.

[0065] In one possible implementation, the knowledge graph can be generated directly according to the knowledge triple corresponding to each text block.

[0066] In another possible implementation, the knowledge triple corresponding to each text block in the text block sequence can be screened, and the knowledge graph can be generated according to the screened knowledge triple. The screening rule can be set in advance for screening, and the screening rule can be flexibly set according to actual needs. For example, according to the semantic similarity between the knowledge triples corresponding to each text block in the text block sequence, only one knowledge triple is retained in two or more knowledge triples with a semantic similarity exceeding a specified threshold, so as to realize screening.

[0067] As can be seen from the above, in the present disclosure, an iterative-extraction-optimization framework is provided. In the iterative processing of each text block, the latest background information related to the text block is dynamically generated to assist in comprehensively determining the complex and long-distance relationship between entities in the text block. After obtaining the knowledge triple each time, the knowledge triple can be corrected and optimized in time to prevent errors from gradually accumulating and amplifying in the processing process. In addition, as the iteration proceeds, the background information is constantly enriched, which is conducive to discovering deeper and more implicit entity relationships in the original text corpus, and thus is conducive to constructing a knowledge graph that is more coherent and consistent in semantics.

[0068] For example, the iterative-extraction-optimization framework described in the present disclosure can be as shown in Figure 3 . Wherein: The original text corpus is processed to obtain a text block sequence, and the iteration processing is started according to the order of the text blocks in the text block sequence, and each time the current text block is processed; In the single-round iteration process of the current text block, the extractor is first used for named entity recognition, triple extraction (i.e., entity relationship extraction), and correction processing in three stages of extraction to obtain an initial triple. After the initial triplets are filtered and normalized by the optimizer in two stages, the knowledge triplets corresponding to the current text block are obtained. This iteration is complete, and termination judgment can be performed to determine whether the iteration is complete. If not, the next text block is processed by continuing the iteration. The obtained knowledge triplets are stored in the knowledge base. Some triplets in the knowledge base can be used as associated triplets in the background information to assist the triplet extraction of the extractor. When each text block in the text block sequence is processed, the termination judgment determines that the iteration is complete, and the iteration can be ended. The knowledge graph is determined according to the knowledge triplets.

[0069] According to the above technical solution, the original text corpus to be processed is divided into text blocks to obtain a text block sequence, and the text block sequence is iteratively processed to determine the knowledge triplets corresponding to each text block in the text block sequence. Then, the knowledge graph corresponding to the original text corpus is determined according to the knowledge triplets corresponding to each text block in the text block sequence. Each iteration includes determining the background information corresponding to the current text block, the background information including the associated text blocks related to the semantics of the current text block and the associated triplets in the current knowledge base that have an association with the current text block. The current knowledge base includes the knowledge triplets determined in the previous processing before the current processing in the iteration process. Then, the knowledge triplets corresponding to the current text block are determined according to the current text block and the background information. The associated text blocks related to the semantics of the current text block in the background information are equivalent to introducing the context of the global semantics, and the associated triplets determined based on the current knowledge base in the background information are equivalent to introducing the knowledge obtained in the historical processing process. Therefore, by introducing the background information to determine the knowledge triplets, the context association can be effectively expanded, the completeness and depth of the extracted knowledge can be improved, and the knowledge fragmentation can be effectively avoided. Moreover, the knowledge triplets of the current text block and its background information are determined, and multiple knowledge triplets are obtained through multiple iterations to construct the knowledge graph, so that each processing can be based on the correct knowledge accumulated in the previous processing, and the accumulation and propagation of errors in the process can be avoided, and the early detection and correction of errors can be realized. In this way, the knowledge graph generated finally has higher accuracy and more rich semantic association.

[0070] Figure 4 A block diagram of a knowledge graph generation device according to an embodiment of the present disclosure is shown. As shown in the figure, the device 40 can include: Figure 4 A first processing module 41 for dividing the original text corpus to be processed into text blocks to obtain a text block sequence; ​The second processing module 42 is configured to iteratively process the sequence of text blocks to determine a knowledge triple corresponding to each text block in the sequence of text blocks, wherein each processing comprises: determining background information corresponding to a current text block in the processing, the background information comprising associated text blocks semantically related to the current text block and associated triples in a current knowledge base associated with the current text block, the current knowledge base comprising knowledge triples determined in previous processing before the current processing in the iterative processing; and determining a knowledge triple corresponding to the current text block according to the current text block and the background information. The first determining module 43 is configured to determine a knowledge graph corresponding to the original text corpus according to the knowledge triple corresponding to each text block in the sequence of text blocks.

[0071] Optionally, the associated text blocks are determined by the following module: The second determining module is configured to determine a semantic vector corresponding to each text block in the sequence of text blocks. The third determining module is configured to determine a local density of each text block according to the semantic vector by using a density peak clustering algorithm, and determine a distance between the text block and a text block similar to the text block for each text block, wherein the text block similar to the text block is a text block with a higher density and closest to the text block. The generating module is configured to generate a semantic hierarchical network according to the local density and the distance of each text block, the semantic hierarchical network comprising a node corresponding to each text block, and a neighbor node of each text block being a node corresponding to a text block with a higher density and closest to the text block. The fourth determining module is configured to determine a text block semantically related to the current text block in the semantic hierarchical network as the associated text block.

[0072] Optionally, the fourth determining module comprises: The first determining submodule is configured to determine a parent node, a child node and a sibling node corresponding to the current text block in the semantic hierarchical network as an associated node. The second determining submodule is configured 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 module: The fifth determining module is configured to extract a key entity and a subject word from the current text block. The retrieving module is configured to perform retrieval in the current knowledge base with the key entity and the subject word as a query condition to obtain an associated triple associated with the current text block.

[0074] Optionally, the second processing module 42 comprises: a third determination sub-module, configured to perform entity recognition on the current text block by a first model to determine an entity list corresponding to the current text block; a fourth determination sub-module, configured to perform inter-entity relation extraction on the entity list and the background information by a second model to determine a candidate triple; a fifth determination sub-module, configured to correct the candidate triple by a third model according to the candidate triple to determine an initial triple; a sixth determination sub-module, configured to determine a knowledge triple corresponding to the current text block according to the initial triple; wherein the first model, the second model and the third model are large language models.

[0075] Optionally, the prompt word of the second model is used at least to indicate that the second model distinguishes direct relations, implicit relations and attribute relations between entities.

[0076] Optionally, the sixth determination sub-module comprises: a first processing sub-module, configured to filter the initial triple according to a preset filtering rule to obtain an intermediate triple after filtering, the filtering rule comprising at least one of a syntax structure filtering rule, a confidence filtering rule and a deduplication rule; a second processing sub-module, configured to normalize the intermediate triple according to a preset normalization rule to obtain a triple after normalization as the knowledge triple corresponding to the current text block, the normalization rule comprising at least one of a relation standardization rule, a conflict detection and resolution rule and a semantic fusion rule.

[0077] As to the apparatus in the above embodiments, the specific manners in which various modules perform operations have been described in detail in the embodiments of the method, and thus will not be described here in detail.

[0078] Based on the same inventive concept, the present disclosure further provides a computer readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the steps of the knowledge graph generation method provided by any of the embodiments of the present disclosure.

[0079] Based on the same inventive concept, the present disclosure further provides an electronic device comprising: a memory having a computer program stored thereon; a processor configured to execute the computer program in the memory to implement the steps of the knowledge graph generation method provided by any of the embodiments of the present disclosure.

[0080] Based on the same inventive concept, the present disclosure further provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the knowledge graph generation method provided by any of the embodiments of the present disclosure.

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

[0082] ​The processor 701 is configured to control overall operations of the electronic device 700 to complete all or part of the steps of the knowledge graph generation method described above. The memory 702 is configured to store various types of data to support operations of the electronic device 700, which can include, for example, instructions for operating any application or method on the electronic device 700, and application-related data, such as contact data, transmitted and received messages, pictures, audio, video, and the like. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, or an optical disk. The multimedia component 703 can include a screen and an audio component. The screen can be, for example, a touch screen, and the audio component is configured to output and / or input audio signals. For example, the audio component can include a microphone configured to receive external audio signals. The received audio signals can be further stored in the memory 702 or transmitted through the communication component 705. The audio component also includes at least one speaker configured to output audio signals. The I / O interface 704 provides an interface between the processor 701 and other interface modules, which can be a keyboard, a mouse, a button, and the like. The buttons can be virtual buttons or physical buttons. The communication component 705 is configured to perform wired or wireless communication between the electronic device 700 and other devices. The wireless communication, such as Wi-Fi, Bluetooth, near field communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them, so the corresponding communication component 705 can include a Wi-Fi module, a Bluetooth module, and an NFC module.

[0083] In an example embodiment, the electronic device 700 can 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 elements for executing the above-described knowledge graph generation method.

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

[0085] In another example embodiment, a computer program product is also provided, which contains a computer program capable of being executed by a processor, and the computer program, when executed by the processor, implements the steps of the above-described knowledge graph generation method.

[0086] The preferred embodiments of the present disclosure are described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details in the above-described embodiments. Within the technical concept scope of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.

[0087] In addition, it should be noted that each specific technical feature described in the above-described specific embodiments can be combined in any appropriate manner without contradiction. In order to avoid unnecessary repetition, various possible combinations are not described again in the present disclosure.

[0088] Furthermore, any combination of the various different embodiments of the present disclosure can also be made, as long as it does not deviate from the idea of the present disclosure, and it should also be considered as disclosed by the present disclosure.

Claims

1. A knowledge graph generation method, characterized in that, The method comprises: performing block processing on a to-be-processed original text corpus to obtain a text block sequence; performing iterative processing on the text block sequence to determine a knowledge triple corresponding to each text block in the text block sequence, wherein each processing comprises: determining background information corresponding to a current text block in the processing, the background information comprising associated text blocks related to semantics of the current text block and associated triples in a current knowledge base that have an association relationship with the current text block, the current knowledge base comprising knowledge triples determined in previous processing before the current processing in the iterative processing; and determining a knowledge triple corresponding to the current text block according to the current text block and the background information; determining a knowledge graph corresponding to the original text corpus according to the knowledge triple corresponding to each text block in the text block sequence.

2. The method of claim 1, wherein, The associated text blocks are determined by the following method: determining a semantic vector corresponding to each text block in the text block sequence; determining the local density of each text block using a density peak clustering algorithm according to the semantic vector, and determining the distance between the text block and its similar text blocks for each text block, wherein the similar text blocks of the text block are the text blocks with higher density closest to the text block; generating a semantic hierarchical network according to the local density and distance of each text block, the semantic hierarchical network comprising nodes corresponding to each text block, and the neighbor nodes of each text block being the nodes corresponding to the text blocks with higher density closest to the text block; determining text blocks related to semantics of the current text block in the semantic hierarchical network as the associated text blocks.

3. The method of claim 2, wherein, The determination of the text blocks related to semantics of the current text block in the semantic hierarchical network as the associated text blocks comprises: determining parent nodes, child nodes and sibling nodes corresponding to the current text block in the semantic hierarchical network as associated nodes; determining at least one of the text blocks corresponding to the associated nodes as the associated text blocks.

4. The method of claim 1, wherein, The associated triples are determined by the following method: extracting key entities and subject words from the current text block; performing retrieval in the current knowledge base with the key entities and the subject words as query conditions to obtain associated triples associated with the current text block.

5. The method of claim 1, wherein, The determination of the knowledge triple corresponding to the current text block according to the current text block and the background information comprises: performing entity recognition on the current text block by a first model to determine an entity list corresponding to the current text block; performing inter-entity relationship extraction by a second model according to the entity list and the background information to determine candidate triples; performing correction processing on the candidate triples by a third model to determine initial triples according to the candidate triples; determining the knowledge triple corresponding to the current text block according to the initial triples; wherein the first model, the second model and the third model are large language models respectively.

6. The method of claim 5, wherein, The prompt word of the second model is used at least to indicate that the second model distinguishes direct relations, implied relations and attribute relations between entities.

7. The method of claim 5, wherein, The determining, according to the initial triple, of the knowledge triple corresponding to the current text block comprises: According to a preset filtering rule, the initial triple is filtered to obtain a filtered intermediate triple, and the filtering rule comprises at least one of a syntax structure filtering rule, a confidence filtering rule and a deduplication rule; According to a preset normalization rule, the intermediate triple is normalized to obtain a normalized triple as the knowledge triple corresponding to the current text block, and the normalization rule comprises at least one of a relation standardization rule, a conflict detection and resolution rule and a semantic fusion rule.

8. A knowledge graph generation apparatus, characterized by comprising: The device comprises: A first processing module configured to perform block processing on a raw text corpus to be processed to obtain a text block sequence; A second processing module configured to perform iterative processing on the text block sequence to determine a knowledge triple corresponding to each text block in the text block sequence, wherein each processing comprises: determining background information corresponding to a current text block of the current processing, the background information comprising associated text blocks semantically related to the current text block and associated triples in a current knowledge base having an association relationship with the current text block, the current knowledge base comprising knowledge triples determined by each processing before the current processing in the iterative processing; and determining, according to the current text block and the background information, a knowledge triple corresponding to the current text block; A first determining module configured to determine a knowledge graph corresponding to the raw text corpus according to the knowledge triple corresponding to each text block in the text block sequence.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the steps of the method of any one of claims 1-7.

10. An electronic device, comprising: Comprise: A memory having a computer program stored thereon; A processor configured to execute the computer program in the memory to implement the steps of the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Knowledge graph construction system oriented to intelligent design of typical structural parts

    CN117892811A

  • Power industry knowledge graph construction method fused with large-scale language model

    CN118627604A

  • Knowledge graph open domain construction and RAG question and answer method and device and storage medium

    CN119416882A

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

    CN120296175A

  • Automatic construction method and system for dynamic mode knowledge graph

    CN120745784A