Knowledge graph post-processing methods, apparatuses, electronic devices, and storage media
By identifying and processing equivalent entities and relations in the knowledge graph, the problems of synonymous entity duplication and relation conflict are solved, thereby improving the structural consistency and query credibility of the knowledge graph.
Patent Information
- Application Number
- CN202611286629.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-24
- Publication Date
- 2026-11-17
Smart Images

Figure CN123115431A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to a knowledge graph post-processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Knowledge graphs organize data in a graph structure, and currently, large language models (LLMs) are often used to automatically extract and construct the graph.
[0003] Most current knowledge graph post-processing solutions either directly store the extracted data in a database or rely solely on exact string matching for simple deduplication. However, this approach fails to resolve semantic-level entity ambiguity, leading to the repetition of synonymous entities. Summary of the Invention
[0004] This invention provides a knowledge graph post-processing method, apparatus, electronic device, and storage medium to address the deficiencies in the prior art.
[0005] This invention provides a knowledge graph post-processing method, comprising: Candidate entity text pairs are determined from the knowledge graph to be processed, wherein the feature similarity between the entity texts in the candidate entity text pairs meets a preset condition; If the candidate entity text pairs express the same concept, then an equivalence association is established between the entity texts in the candidate entity text pairs. The equivalence association includes direct equivalence association and indirect equivalence association. The direct equivalence association is used to characterize the synonym relationship directly established between two entity texts, and the indirect equivalence association is used to characterize the synonym relationship obtained through other entity texts. Entity texts with equivalent associations are grouped into the same set to obtain an equivalent entity set, and canonical entity texts are determined from the equivalent entity set; In the knowledge graph, the relation edges of the remaining entity texts in the equivalent entity set, excluding the canonical entity text, are updated to be connected to the canonical entity text.
[0006] According to a knowledge graph post-processing method provided by the present invention, after updating to be connected with the canonical entity text, it further includes: Retrieve multiple candidate relation edges that connect text pairs of the same entity; Based on the contextual semantics expressed by the candidate relation edges, the candidate relation edges are divided into repeating relations that express the same meaning, semantically compatible complementary relations, and conflicting relations that contradict each other. Perform corresponding relation resolution operations on the repeating relation, the complementary relation, and the conflicting relation, respectively.
[0007] According to a knowledge graph post-processing method provided by the present invention, the step of performing corresponding relation resolution operations on the duplicate relations, the complementary relations, and the conflict relations respectively includes: Select the edge with the most source documents from the repeated relationships as the target relationship edge, and merge the remaining relationship edges in the repeated relationships into the target relationship edge; All complementary relationships are preserved simultaneously in the knowledge graph; Semantic analysis is performed on the conflicting relationships, and the semantically correct relationship edge is selected and retained from the conflicting relationships; if the semantically correct relationship edge cannot be determined through the semantic analysis, the relationship edge with the largest number of source documents is retained.
[0008] According to a knowledge graph post-processing method provided by the present invention, the step of updating the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity text in the knowledge graph includes: The outgoing edges that start from the remaining entity text are updated to start from the canonical entity text, and the incoming edges that end from the remaining entity text are updated to end from the canonical entity text. The connection formed between the remaining entity text and the canonical entity text is updated to a self-loop edge that starts from and ends at the canonical entity text. The update operations for the outgoing edge, the incoming edge, and the self-loop edge are all implemented synchronously within the same data writing process.
[0009] According to a knowledge graph post-processing method provided by the present invention, before determining candidate entity text pairs from the knowledge graph to be processed, the method further includes: Remove the surface character differences of type names in the knowledge graph, and group type names with the same surface character differences into the same type group; A first standard name is selected from the type names of the same type group based on the frequency of occurrence, and all type names in the same type group are replaced with the first standard name. Semantic analysis is performed on the remaining different type names in the knowledge graph after replacement, and type names with equivalent semantic meanings are grouped into the same semantic group; Based on the semantic analysis results, a second standard name is selected from the type names of the same semantic group, and all type names within the same semantic group are replaced with the second standard name.
[0010] According to a knowledge graph post-processing method provided by the present invention, the step of removing surface character differences in type names in the knowledge graph and grouping identical type names after removing surface character differences into the same type group includes: Remove leading and trailing whitespace characters from the type name in sequence, convert the letter characters in the type name to characters of a specified format, replace the specified connector in the type name with a space, and replace multiple consecutive spaces with a single space to obtain the normalized feature key corresponding to the type name; Type names with the same normalized feature key are grouped into the same type group.
[0011] According to a knowledge graph post-processing method provided by the present invention, before determining candidate entity text pairs from the knowledge graph to be processed, the method further includes: obtaining user identification information of the current operating user; Accordingly, determining candidate entity text pairs from the knowledge graph to be processed includes: Within the scope of the graph data carrying the user identification information, candidate entity text pairs are determined from the knowledge graph to be processed; Accordingly, updating the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity text in the knowledge graph includes: Within the graph data carrying the user identification information, the relation edges of the remaining entity texts in the equivalent entity set, excluding the canonical entity text, are updated to be connected to the canonical entity text.
[0012] According to a knowledge graph post-processing method provided by the present invention, the step of determining feature similarity includes: According to entity type, the multiple entity texts in the knowledge graph to be processed are divided into different type data blocks; If the number of entity texts in any type of data block does not exceed the preset number threshold, then all entity text pairs in the corresponding type of data block are traversed, the spatial distance between entity text pairs is calculated one by one, and the feature similarity between entity text pairs in the corresponding type of data block is determined based on the spatial distance. If the number of entity texts in any type of data block exceeds the preset threshold, the entity type is used as a range constraint, and local matching retrieval is performed in the corresponding type of data block based on the distance proximity mapping relationship in the vector space to obtain the feature similarity between entity text pairs in the corresponding type of data block.
[0013] According to a knowledge graph post-processing method provided by the present invention, after updating the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity text, the method further includes: In the knowledge graph, a temporary computation graph containing the current entity text and the edges of the association relationship is constructed, and community division is performed based on the temporary computation graph to obtain at least one entity community containing multiple entity texts; For a target entity community containing a preset threshold number of entity texts, extract the relation triples within the target entity community as context information; The context information is semantically summarized to generate a natural language summary corresponding to the target entity community; The natural language summary is combined with the entity text within the target entity community to construct an independent community node, and the community node is stored in the knowledge graph.
[0014] According to a knowledge graph post-processing method provided by the present invention, the step of dividing communities based on the temporary computation graph to obtain at least one entity community containing multiple entity texts includes: When the total number of entity texts in the temporary computation graph reaches the minimum scale threshold, the community division result of the previous round is used as the initial clustering benchmark, and based on the connection density of the relationship edges between entity texts in the temporary computation graph, the entity texts are clustered on the initial clustering benchmark to determine the community identifier corresponding to each entity text after division. The community identifier is recorded in the corresponding entity text, and entity texts with the same community identifier are aggregated to obtain the entity community; Specifically, after storing the community nodes in the knowledge graph, expired community nodes that no longer exist in the current round of community division are cleaned up from the knowledge graph.
[0015] The present invention also provides a knowledge graph post-processing apparatus, comprising: The selection unit is used to determine candidate entity text pairs from the knowledge graph to be processed, wherein the feature similarity between the entity texts in the candidate entity text pairs meets a preset condition; The establishment unit is used to establish an equivalence association between the entity texts in the candidate entity text pair if the candidate entity text pair expresses the same concept. The equivalence association includes direct equivalence association and indirect equivalence association. The direct equivalence association is used to characterize the synonym relationship directly established between two entity texts. The indirect equivalence association is used to characterize the synonym relationship obtained through other entity texts. A partitioning unit is used to partition entity texts that have equivalent associations into the same set to obtain an equivalent entity set, and to determine the canonical entity text from the equivalent entity set; The update unit is used to update the relation edges of the remaining entity texts in the equivalent entity set, excluding the canonical entity text, to be connected to the canonical entity text in the knowledge graph.
[0016] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the knowledge graph post-processing method as described above.
[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the knowledge graph post-processing method as described above.
[0018] The knowledge graph post-processing method, apparatus, electronic device, and storage medium provided by this invention select candidate entity text pairs with feature similarity that meet preset conditions from the knowledge graph to be processed. After confirming that they express the same concept, equivalent associations are established. Then, utilizing the logical transitivity of direct and indirect equivalent associations, all entity texts expressing synonymous concepts are accurately divided into the same equivalent entity set, thereby systematically establishing unified and standardized entity texts. On this basis, the relation edges of the remaining entity texts in this set are globally updated and redirected to the standardized entity texts. This invention eliminates entity redundancy and ambiguity problems caused by block extraction from large language models without manual annotation intervention, and aggregates scattered and overlapping associations onto standardized entity nodes, effectively improving the consistency of the underlying structure of the knowledge graph, redundancy removal, and the reliability of practical query applications. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating the knowledge graph post-processing method provided by the present invention.
[0021] Figure 2 This is a schematic diagram of the knowledge graph construction and post-processing process provided by the present invention.
[0022] Figure 3This is a schematic diagram of the knowledge graph post-processing device provided by the present invention.
[0023] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0025] Knowledge graphs (KGs) organize knowledge in a graph structure. In the education field, they can systematically integrate knowledge points and their relationships scattered in textbooks and courseware, providing support for personalized learning and intelligent Q&A. In recent years, LLMs, with their zero-shot capability, can directly extract entities and relations from unstructured text, opening up new paths for the automated construction of knowledge graphs. However, educational texts come from diverse sources, vary in expression, and are rich in subject-specific terminology. Large language models suffer from quality defects such as entity redundancy and ambiguity, relation conflicts, and inconsistent type naming when extracting data in chunks.
[0026] Current knowledge graph construction schemes mainly include rule-based or supervised learning methods, as well as zero-shot extraction methods based on large language models. Most of these schemes stop at extraction and writing, or perform only simple string matching and deduplication after construction. Due to the independent processing of text blocks and the diverse expressions of subject terminology, the constructed original graphs suffer from entity redundancy and ambiguity. That is, the same concept appears repeatedly in different forms, and the naming conventions for entity types and relation types are inconsistent; the same entity pair may have multiple overlapping, complementary, or even contradictory relations, causing relation conflicts; furthermore, the graph is merely a discrete network of entity relations, lacking a high-level semantic structure. In addition, because the above schemes do not perform systematic disambiguation, resolution, and clustering post-processing on the stored graphs, nor do they provide engineering methods for securely and efficiently performing post-processing under multi-tenant isolation conditions, the automatically constructed graphs are of low quality and difficult to apply directly.
[0027] To address this, the present invention provides a knowledge graph post-processing method, which aims to identify candidate entity pairs that satisfy feature similarity, accurately cluster synonymous entities and establish standardized entity text by utilizing the logical transitivity of direct and indirect equivalence associations, and then globally and uniformly redirect and update the remaining entity relationship edges within the equivalence set, thereby eliminating entity redundancy and ambiguity in the knowledge graph and standardizing the underlying network graph structure.
[0028] in, Figure 1 This is a flowchart illustrating the knowledge graph post-processing method provided by the present invention, as shown below. Figure 1 As shown, the method includes: Step 110: Determine candidate entity text pairs from the knowledge graph to be processed. The feature similarity between the entity texts in the candidate entity text pairs meets the preset conditions.
[0029] Here, the knowledge graph to be processed can be understood as raw graph data containing entities and relations extracted from unstructured text based on a large language model. In the education field, this could be raw knowledge graphs automatically extracted from educational texts such as textbooks and courseware. Because educational texts come from diverse sources and have varying expressions, large language models are prone to entity redundancy and ambiguity when processing them in chunks independently. Candidate entity text pairs are used to represent two entity texts in the graph that have similar features and are suspected of pointing to the same concept.
[0030] As an optional embodiment, feature similarity can be determined by calculating the spatial distance between the vector representations of entity texts. The preset condition can be that the feature similarity is greater than or equal to a set similarity threshold. For example, the cosine similarity threshold can be maliciously set to 0.85. When the cosine similarity between the vector representations of two entity texts is greater than or equal to 0.85, they are considered as candidate entity text pairs.
[0031] Step 120: If the candidate entity text pairs express the same concept, then establish an equivalence association between the entity texts in the candidate entity text pairs. The equivalence association includes direct equivalence association and indirect equivalence association. Direct equivalence association is used to characterize the synonym relationship directly established between two entity texts, and indirect equivalence association is used to characterize the synonym relationship obtained through other entity texts.
[0032] Specifically, expressing the same concept refers to two or more entity texts with different literal forms, but pointing to the same core thing or knowledge point in a specific discipline or business context. For example, in an educational context, entity text 1 "machine learning" and entity text 2 "machine learning" essentially express the same concept.
[0033] Equivalence association refers to the binding relationship between entity texts that are semantically equivalent or point to the same specific concept. Equivalence association includes direct equivalence association and indirect equivalence association. Direct equivalence association refers to the synonymous pointing relationship established between two entity texts through surface character matching or direct determination by a large language model. As an optional embodiment, a deep semantic confirmation of candidate entity text pairs can be performed by calling a large language model. For example, the candidate entity text pairs are input into the large language model, which determines whether the two entity texts in the candidate entity text pair point to the same concept and outputs a structured result containing Boolean judgment and brief reason. Once it is confirmed that they point to the same concept, a direct equivalence association is established between the two texts in the entity text pair.
[0034] Furthermore, indirect equivalence association refers to a deep synonym relationship derived from an existing direct equivalence association using the transitive closure property of logic. For example, if it has been confirmed that the entity text "ML" and the entity text "ml" have a direct equivalence association, and the large language model determines that the entity text "ML" and the entity text "machine learning" also have a direct equivalence association, then an indirect equivalence association can be automatically established between the entity text "ml" and the entity text "machine learning" through the transitive relationship of intermediate nodes.
[0035] Furthermore, considering that relying solely on pairwise direct comparisons of candidate entity text pairs may miss some semantically equivalent entities, leading to incomplete disambiguation, this embodiment, in order to achieve global deep deduplication, combines direct and indirect equivalence associations. It utilizes a disjoint-set data structure algorithm for transitive closure clustering derivation, connecting all entity texts with both direct and indirect equivalence associations into a unified equivalence relation network, thus avoiding fragmented synonymous expression nodes remaining in the knowledge graph.
[0036] Step 130: Divide entity texts with equivalent associations into the same set to obtain an equivalent entity set, and determine the canonical entity texts from the equivalent entity set.
[0037] Specifically, the equivalent entity set can be understood as a cluster group composed of all entity texts with synonymous relationships. The canonical entity text refers to the standard text selected from this cluster group that is most representative or has the richest information, and is used as the unique node representation retained in the post-processed knowledge graph.
[0038] As an optional implementation, all related entity texts with direct or indirect equivalence can be automatically clustered into the same cluster to obtain an equivalent entity set. For example, entity texts "ML", "ml", "machine learning", and "machine learning" can be uniformly merged into the same equivalent entity set to ensure that all scattered expressions pointing to the same concept are included.
[0039] Considering that the equivalent entity set contains various representations of different lengths and origins, to avoid inconsistent naming standards for knowledge points in the graph, this embodiment preferably adopts selection rules based on graph topological features to determine the standardized entity text. For example, within the equivalent entity set, the actual number of relation edges connected to each entity text in the original knowledge graph, as well as the character length of the corresponding name, can be counted. Standardized entity texts are selected according to the rule of having the most relations and the longest name, thereby ensuring that the knowledge nodes ultimately retained have the maximum information connectivity and the most complete contextual representation.
[0040] Step 140: In the knowledge graph, update the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity text.
[0041] Specifically, relation edges refer to directed line segments in a knowledge graph that connect different entity texts, representing business or logical relationships between knowledge points. The remaining entity texts are redundant merged nodes in the equivalent entity set that will be merged or removed from the graph structure.
[0042] As an optional implementation, the data update statements of the graph database can be used to traverse all the connections involved in the other entity texts and redirect the endpoints of all these connections to the reserved nodes corresponding to the canonical entity texts. For example, outgoing edges starting from other entity texts can be rewritten as outgoing edges starting from the canonical entity texts and pointing to the original target node; incoming edges ending from other entity texts can be rewritten as incoming edges pointing from the original starting node to the canonical entity texts.
[0043] Through the above steps, all related source document list information and topology are accumulated and transferred to the nodes where the canonical entity texts are located. After confirming that there are no residual relationship edges in the remaining entity texts, they can be deleted from the knowledge graph. The above process automatically purifies the original noisy graph containing entity redundancy and ambiguity into a high-quality knowledge graph with consistent structure and semantic redundancy removal without human intervention.
[0044] The knowledge graph post-processing method provided in this invention selects candidate entity text pairs with similarity that meet preset conditions from the knowledge graph to be processed. After confirming that they express the same concept, it establishes equivalent associations. Then, utilizing the logical transitivity of direct and indirect equivalent associations, it accurately classifies all entity texts expressing synonymous concepts into the same equivalent entity set, thereby systematically establishing unified and standardized entity texts. Based on this, the relation edges of the remaining entity texts in this set are globally updated and redirected to the standardized entity texts. This embodiment eliminates entity redundancy and ambiguity caused by block extraction from large language models without manual annotation intervention, aggregating scattered and overlapping relationships onto standardized entity nodes, effectively improving the consistency of the underlying knowledge graph structure, redundancy removal, and the reliability of practical query applications.
[0045] Based on the above embodiments, after updating to be connected with canonical entity text, the method further includes: Step 210: Obtain multiple candidate relation edges connecting text pairs of the same entity.
[0046] Specifically, candidate relation edges refer to all directed connections between the two entity nodes corresponding to the same entity text pair, including multiple relation connections in the same direction and bidirectional relation connections in opposite directions.
[0047] As an optional implementation, multiple candidate relation edges in the same direction can be extracted by querying all entity pairs that have more than one connection in the same direction. Simultaneously, by using lexicographical order of names and existence clauses to avoid Cartesian product expansion, all entity pairs with bidirectional connections can be queried to obtain bidirectional candidate relation edges in the opposite direction. Finally, the candidate relation edges in the same direction and the candidate relation edges in the opposite direction are used as candidate relation edges for the entity text pair.
[0048] Step 220: Based on the contextual semantics expressed by the candidate relation edges, divide the candidate relation edges into repeating relations that express the same meaning, semantically compatible complementary relations, and contradictory conflict relations.
[0049] After obtaining multiple candidate relation edges connecting the same entity text pairs, considering that these candidate relation edges may have diverse expressions or logical contradictions, directly using them without differentiation would affect the accuracy of graph reasoning. Therefore, this embodiment classifies candidate relation edges into repeating relations expressing the same meaning, semantically compatible complementary relations, and contradictory conflicting relations based on the contextual semantics expressed by the candidate relation edges.
[0050] Among them, a repetitive relationship refers to two edges that express the same meaning but have different surface forms. For example, the edges "use" and "adopt" express the same meaning but have different surface forms. A complementary relationship refers to two edges that are both correct and semantically compatible. For example, edge A is applied to B and edge B uses A. A conflicting relationship refers to two edges that contradict each other. For example, edge A is superior to B and edge B is superior to A coexist.
[0051] As an optional implementation, the vector cosine similarity of the different relation types involved in the candidate relation edges can be calculated pairwise. Type pairs with similarity greater than or equal to a set threshold are used as initial candidates. Then, a large language model is invoked in parallel using multiple threads. The large language model performs a three-class classification based on the contextual semantics expressed by the candidate relation edges, thereby dividing the candidate relation edges into repeating relations expressing the same meaning, semantically compatible complementary relations, and contradictory conflicting relations.
[0052] Step 230: Perform the corresponding relationship resolution operations on the duplicate relationship, complementary relationship and conflict relationship respectively.
[0053] After classifying candidate relation edges into repetitive relations expressing the same meaning, semantically compatible complementary relations, and contradictory conflicting relations, and considering that different types of relations have different impacts on graph quality, this embodiment adopts differentiated governance methods to eliminate logical errors. Specifically, it performs corresponding relation resolution operations on repetitive, complementary, and conflicting relations respectively. The relation resolution operation refers to dynamic adjustment actions such as merging, retaining, or deleting performed in the graph database based on the characteristics of the aforementioned types of relations.
[0054] As an optional implementation, based on the three-class classification results output by the large language model, corresponding relationship resolution operations can be performed on repetitive relationships, complementary relationships, and conflicting relationships respectively. For example, lines expressing the same meaning can be merged into one, and semantically compatible lines can be coexisted and retained. Thus, within the multi-tenant logical isolation boundary, the problem of contradictory relationships between the same entity pair can be resolved safely and efficiently, improving the practicality of automatically constructing the graph.
[0055] Based on any of the above embodiments, step 230 performs corresponding relationship resolution operations on repetitive relationships, complementary relationships, and conflicting relationships, including: Step 231: Select the edge with the most source documents from the repeated relationships as the target relationship edge, and merge the remaining relationship edges in the repeated relationships into the target relationship edge.
[0056] Specifically, a target relation edge refers to the single most representative relation edge among multiple relation edges expressing the same meaning, which is ultimately retained. This involves compiling a list of source documents for each relation edge in repeated relations, selecting the relation edge with the most source documents as the target relation edge, and merging the remaining relation edges in repeated relations from the graph database into a single relation edge. This eliminates structural redundancy while retaining the richest source supporting evidence.
[0057] Step 232: Simultaneously preserve all complementary relationships in the knowledge graph.
[0058] Given that multiple edges in complementary relationships are all correct and semantically compatible, enriching the association information between entities from different perspectives, arbitrary deletion would result in the loss of semantic knowledge. Therefore, all complementary relationships are preserved simultaneously in the knowledge graph.
[0059] Here, preserving all complementary relationships means not performing deletion or merging operations on these relationship edges, allowing them to legally coexist within the same entity text pair. As an optional implementation, when two relationship edges are determined to be complementary, both types of relationship edges are preserved during the write and update processes to maintain the semantic integrity and diversity of the knowledge graph.
[0060] Step 233: Perform semantic analysis on the conflicting relationships and select the semantically correct relationship edge from the conflicting relationships to retain; if the semantically correct relationship edge cannot be determined through semantic analysis, then retain the relationship edge with the most source documents.
[0061] Considering that conflicting relationships refer to mutually contradictory connections, retaining them simultaneously in a knowledge graph could lead to logical errors and knowledge illusions in subsequent graph reasoning. Therefore, to eliminate logical contradictions and improve the accuracy of the knowledge graph, semantic analysis is performed on conflicting relationships. Only the semantically correct relationship edge is selected and retained from among the conflicting relationships; if a semantically correct relationship edge cannot be determined through semantic analysis, the relationship edge with the most source documents is retained.
[0062] Here, semantic analysis refers to the process of judging the rationality of conflicting relationships by leveraging the knowledge reserves of an external model. Specifically, a large language model can be invoked to determine contradictory relationships. For example, when both relationships where edge A is superior to B and edge B is superior to A coexist, the large language model, based on its internal knowledge or contextual information, infers the semantically correct edge and proposes its retention. This correct edge is then retained, and the other conflicting edge is deleted. If the large language model cannot make a decision, a fallback mechanism is triggered, comparing the number of source documents for each conflicting edge and extracting the edge with the most source documents as the correct knowledge to retain. This approach not only effectively eliminates relationship conflicts in the graph but also ensures the robustness of the resolution process.
[0063] Based on any of the above embodiments, step 140 updates the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity texts in the knowledge graph, including: Step 141: Update outgoing edges that start with other entity texts to start with canonical entity texts, and update incoming edges that end with other entity texts to end with canonical entity texts.
[0064] Specifically, outgoing edges refer to relational connections in a directed graph of a knowledge graph that originate from the corresponding node of another entity text; incoming edges refer to relational connections that originate from the corresponding node of another entity text. In this process, two nodes, "other entity text" and "canonical entity text," can be locked in the graph database, and all edges of the other entity text can be redirected in batches according to relation type. Specifically, outgoing edges from other entity text to other nodes are rewritten as pointing from canonical entity text to that node, and incoming edges from other nodes to other entity text are rewritten as pointing to canonical entity text. During the redirection process, duplicate edges of the same type can be merged and their source document list information is accumulated to remove duplicates.
[0065] Step 142: Update the connection between the remaining entity text and the canonical entity text to a self-loop edge that starts from and ends at the canonical entity text. The update operations for outgoing edges, incoming edges, and self-loop edges are all implemented synchronously within the same data writing process.
[0066] After updating the outgoing and incoming edges to the canonical entity text, considering that there may already be connections between the remaining entity texts and the canonical entity text, or between the remaining entity texts themselves, directly discarding these internal connections would result in the loss of local feature semantics. Therefore, the connections formed between the remaining entity texts and the canonical entity text are updated to self-loop edges that start and end with the canonical entity text.
[0067] Here, a self-loop edge refers to a special relational edge where both the starting and ending points of the connection point to the same node (i.e., the canonical entity text). As an optional embodiment, internal connections involving other entity texts are identified, including connections where other entity texts point to themselves, other entity texts point to canonical entity texts, and canonical entity texts point to other entity texts. The starting and ending points of these connections are uniformly rewritten as canonical entity texts, thereby forming self-loop edges in the graph where canonical entity texts point to themselves, thus preserving the original logical imprint.
[0068] In addition, to ensure the security and consistency of graph data, update operations for outgoing edges, incoming edges, and self-loop edges are placed in the same data write process and take effect synchronously. The same data write process refers to a single write transaction with atomic characteristics in the graph database.
[0069] As an optional implementation, all the outgoing edge updates, incoming edge updates, self-loop edge updates, and the explicit deletion command after confirming that no residual edges remain in the remaining entity text are executed atomically within a single write transaction. If residual edges are found during deletion, the transaction rolls back with an error, serving as a strong check for correctness. Simultaneously, all dynamically concatenated relation type names in graph database query statements can be escaped to prevent injection attacks, thereby ensuring the efficiency and security of the merging process.
[0070] Based on any of the above embodiments, before determining candidate entity text pairs from the knowledge graph to be processed, the method further includes: S11. Remove the surface character differences of type names in the knowledge graph, and group the same type names into the same type group after removing the surface character differences.
[0071] Specifically, type names include entity type labels and relation type names in the knowledge graph. Surface character differences refer to variations in the superficial writing format of type names, such as capitalization, underscores, hyphens, leading and trailing spaces, and redundant spaces. The same type group refers to a set of type names that have consistent core character content after eliminating the above-mentioned superficial writing format differences.
[0072] As an optional implementation, a normalization key can be calculated for each type name, such as removing leading and trailing whitespace characters, converting to lowercase letters, converting underscores and hyphens to spaces, and merging consecutive spaces within the name. Then, type names with the same normalization key are grouped together, thus eliminating interference from surface inconsistencies. This stage does not require calling a large language model and has a time complexity of O(n).
[0073] S12. Select the first standard name from the type names in the same type group based on the frequency of occurrence, and replace all type names in the same type group with the first standard name.
[0074] Furthermore, considering that although the core characters are consistent within the same type group, various original surface writing forms are still retained, in order to achieve type unification at the underlying level of the graph database, this embodiment selects the first standard name from the type names of the same type group based on the frequency of occurrence, and replaces all type names in the same type group with the first standard name.
[0075] The frequency of occurrence refers to the actual number of times the type name is used in each node or relation edge of the current knowledge graph, and the first canonical name refers to the standard type identifier selected within the type group after deduplication rules. As an optional implementation, the actual frequency of each type name in the graph within the same type group can be counted, and the one with the highest frequency can be selected as the first canonical name. If there are cases where the frequency of occurrence is the same, the one with the longer name string length can be selected as the first canonical name, and then the remaining type names in the group can be uniformly renamed and replaced with the first canonical name in the graph database.
[0076] S13. Perform semantic analysis on the remaining different type names in the knowledge graph after replacement, and classify the type names with equivalent semantic meanings into the same semantic group.
[0077] While string deduplication can address surface-level character differences, it cannot handle deeper semantic equivalence issues, such as full names versus abbreviations, Chinese and English synonyms, and morphologically similar words. Therefore, this embodiment introduces a higher-dimensional semantic understanding mechanism. Specifically, this embodiment performs semantic analysis on the remaining different types of names in the knowledge graph after replacement processing, and groups semantically equivalent types of names into the same semantic group.
[0078] Here, semantic analysis refers to the process of parsing and matching the deep contextual meaning of text with the help of external intelligent models. The same semantic group refers to a set of type names that, although they are not spelled the same, express the same business meaning in a specific discipline.
[0079] As an optional implementation, all the different entity types and relation types remaining after deduplication can be input into a large language model. The large language model performs semantic analysis and clusters various derivative expressions of the same relation (such as full names and abbreviations, Chinese and English synonyms, etc.) to output semantically equivalent grouping results, thus completing the deep semantic normalization preparation of type names.
[0080] S14. Based on the semantic analysis results, select the second specification name from the type names of the same semantic group, and replace all type names in the same semantic group with the second specification name.
[0081] Specifically, the second canonical name refers to the most representative standard name assigned by the large language model for each semantic group based on its semantic understanding capabilities. As an optional implementation, when outputting groupings, the large language model provides a second canonical name and all member types contained within each semantic group. Upon receiving this result, a mandatory verification is performed to ensure that all type names returned by the large language model come from the original input list; that is, new types are not allowed to be created out of thin air, and each member is guaranteed to be mapped to at most one canonical name. After successful verification, the grouping result is applied as a renaming instruction to the graph database, uniformly replacing all members within the group with the second canonical name.
[0082] Based on any of the above embodiments, S13 removes the surface character differences of type names in the knowledge graph and groups the same type names into the same type group after removing the surface character differences, including: S131. Remove leading and trailing whitespace characters from the type name in sequence, convert letter characters in the type name to characters of the specified format, replace the specified connector in the type name with a space, and replace multiple consecutive spaces with a single space to obtain the normalized feature key corresponding to the type name.
[0083] Specifically, specified format characters typically refer to a uniform lowercase or uppercase letter form, used to eliminate comparison errors caused by case sensitivity. Specified hyphens are special symbols commonly used for word concatenation in naming, such as underscores or hyphens. Normalized feature keys refer to the standard strings that reflect the core character combinations of a given type, extracted after the aforementioned series of multi-dimensional string cleaning operations.
[0084] As an optional implementation, each type name in the graph database is read. First, invalid whitespace characters at the beginning and end are removed. Then, all letter characters within the name are converted to lowercase characters of the specified format. Next, all specified connectors such as underscores and hyphens in the type name are identified and rewritten as spaces. Finally, two or more consecutive spaces that may appear in the string are merged into a single space, thereby generating a normalized feature key that can represent the underlying character structure of the type name.
[0085] S132. Group type names with the same normalized feature key into the same type group.
[0086] After obtaining the normalized feature keys corresponding to the type names, considering that simply generating feature keys does not change the current discrete distribution of types in the graph, it is also necessary to group various variants belonging to the same core concept based on these feature keys, so as to define a clear set range for subsequent frequency statistics and renaming operations. Among them, the same type group is the set of type names with consistent spelling of underlying core words after the surface character features have been uniformly cleaned.
[0087] As an optional embodiment, a memory hash table or database index can be established with normalized feature keys as mapping keys. After the above cleaning and calculation, the names of various original types with the same normalized feature keys are uniformly included in the same type group corresponding to the key value.
[0088] Based on any of the above embodiments, before determining candidate entity text pairs from the knowledge graph to be processed, the method further includes: obtaining the user identification information of the current operating user.
[0089] Specifically, the current user refers to the specific tenant entity within the education resource management platform that is triggering a knowledge graph construction or processing task, such as an independent educational institution, teacher, or student. User identification information refers to an identity field parameter used to uniquely distinguish and define the data ownership and permissions of this user at the underlying graph database level. Specifically, upon receiving a graph processing request, the corresponding user identification information can be parsed and extracted from the request context, serving as a data isolation credential for subsequent operations.
[0090] After obtaining the user identifier information of the currently operating user, in order to prevent unauthorized access or recall entity data of other users from the source, candidate entity text pairs are determined from the knowledge graph to be processed, including: Within the scope of graph data carrying user identification information, candidate entity text pairs are identified from the knowledge graph to be processed.
[0091] Here, the scope of graph data carrying user identification information refers to the boundary of a local subgraph formed by nodes and connections whose attribute fields record the user identification information within the graph database. As an optional implementation, during the vector similarity calculation and retrieval stage, equivalence conditions based on user identification information can be passed as filtering parameters to the vector index to achieve pre-filtering of the data. Based on this, candidate entity text pairs are recalled and determined only within this graph data scope, thereby ensuring the isolation of multi-tenant data.
[0092] Considering that subsequent graph structure redirection involves write transactions, the lack of strict data scope constraints poses a risk of data corruption due to accidental deletion or incorrect connection of edges to other entities. Accordingly, in the knowledge graph, the relationship edges of entity texts other than the canonical entity text in the equivalent entity set are updated to connect to the canonical entity text, including: Within the graph data carrying user identification information, update the relation edges of the remaining entity texts in the equivalent entity set, excluding the canonical entity text, to be connected to the canonical entity text.
[0093] Here, updating relation edges within the graph data carrying user identification information refers to limiting the entire write operation—including node locking and renaming, relation connection transfer, etc.—to the current user's exclusive data subset. As an optional implementation, during graph traversal and relation redirection, a filtering condition is added to all matching clauses and optional matching clauses, stating that the node's owner is equal to the aforementioned user identification information, to achieve post-filtering. This post-filtering mechanism during the write phase ensures that the system only performs update connection operations on other entity texts and canonical entity texts belonging to the current user, preventing data leakage and ensuring the entire post-processing process is securely executed within the multi-tenant logical isolation boundary.
[0094] Based on any of the above embodiments, the step of determining feature similarity includes: S21. According to the entity type, divide the multiple entity texts in the knowledge graph to be processed into different type data blocks.
[0095] Specifically, entity type refers to the category attribute label assigned to a specific entity text in the knowledge graph, and type data block refers to an independent data partitioning unit containing only one specific category of entity text. Metadata queries can be used to retrieve the category label information of each entity text, grouping entity texts belonging to the same entity type together into independent blocks. This allows subsequent vector loading and similarity determination to be performed within entities of the same type, effectively narrowing the space for candidate comparison.
[0096] S22. If the number of entity texts in any type of data block does not exceed the preset number threshold, then traverse all entity text pairs in the corresponding type of data block, calculate the spatial distance between entity text pairs one by one, and determine the feature similarity between entity text pairs in the corresponding type of data block based on the spatial distance.
[0097] After dividing the multiple entity texts in the knowledge graph to be processed into different type data blocks according to entity type, considering the differences in the data size contained in different data blocks, matrix-based batch processing is the most efficient for sets with smaller data volumes. Therefore, if the number of entity texts in any type data block does not exceed a preset threshold, all entity text pairs in the corresponding type data block are traversed, and the spatial distance between entity text pairs is calculated one by one. Based on the spatial distance, the feature similarity between entity text pairs in the corresponding type data block is determined.
[0098] Here, the preset quantity threshold refers to a numerical indicator used to distinguish the size of data blocks. For example, the preset quantity threshold can be set to 5000. Spatial distance refers to the degree of proximity of the feature vectors corresponding to entity texts in the multidimensional feature space.
[0099] As an optional implementation, when the number of entity texts within a type data block does not exceed 5000, the vector data of the entities in that block is loaded into memory as needed, and the cosine similarity matrix is calculated using vectorized matrix operation logic. Specifically, each feature vector is first normalized to L2, and then the inner product is calculated as the spatial distance. After obtaining the similarity matrix, only the data of the upper triangular matrix is taken to avoid repeated calculations, and entity text pairs with corresponding values not lower than a set threshold are selected from it.
[0100] S23. If the number of entity texts in any type of data block exceeds a preset threshold, the entity type will be used as a range constraint, and local matching retrieval will be performed in the corresponding type of data block based on the distance proximity mapping relationship in the vector space to obtain the feature similarity between entity text pairs in the corresponding type of data block.
[0101] For massive data blocks of different types, continuing to use the global matrix calculation method described above would lead to an exponential increase in matrix dimensionality, resulting in memory crashes. Therefore, if the number of entity texts within any data block of a certain type exceeds a preset threshold, the entity type is used as a range constraint. Based on the distance-proximity mapping relationship in vector space, local matching and retrieval are performed within the corresponding data block of that type to obtain the feature similarity between entity text pairs within that data block. This avoids matrix size explosion and improves the processing efficiency of large-scale data.
[0102] Here, the range constraint refers to the rule that strictly filters and restricts the search range to the current target entity type when performing a retrieval operation; the distance proximity mapping relationship refers to the neighbor index logic built on multi-dimensional spatial distance in the underlying approximate retrieval algorithm; local matching retrieval refers to quickly finding local neighbor nodes with close distances by using a multi-dimensional index structure instead of performing global pairwise cross comparison operations.
[0103] As an optional implementation, when the number of entity texts in a type data block exceeds 5000, a parallel approximate nearest neighbor search algorithm with filtering attributes is used instead. In this search process, the entity type is passed as a filtering parameter, and the algorithm directly searches for the nearest target nodes to the current entity text in the high-dimensional space, thereby efficiently obtaining the feature similarity between entity text pairs within the corresponding type data block.
[0104] Based on any of the above embodiments, in the knowledge graph, after updating the relation edges of the remaining entity texts (excluding the canonical entity text) in the equivalent entity set to be connected to the canonical entity text, the method further includes: S31. Construct a temporary computation graph in the knowledge graph that contains the current entity text and the edges of the relationship, and divide the community based on the temporary computation graph to obtain at least one entity community containing multiple entity texts.
[0105] Specifically, a temporary computation graph refers to a subgraph projection structure extracted and isolated from the underlying graph database specifically for running graph algorithms; an entity community refers to a set of nodes with dense interactions and high internal correlations on the topological connections. Within the current user's data scope, this temporary computation graph can be constructed using conditional projections that only include the current user's entities and relationships, with a random suffix appended to the projection's name to ensure the safety of concurrent operations. Subsequently, a community detection algorithm is run on this temporary computation graph to perform clustering operations, thereby identifying regions where knowledge points are clustered at the topological level, resulting in at least one entity community containing multiple entity texts.
[0106] S32. For a target entity community containing a number of entity texts that reach a preset threshold, extract the relation triples within the target entity community as context information.
[0107] After dividing the community based on a temporary computational graph to obtain at least one entity community containing multiple entity texts, considering that the graph algorithm may include extremely small clusters with only a single node, these scattered groups lack high-level generalization, and processing them all would waste computational resources. Therefore, for target entity communities containing a preset threshold of entity texts, relation triples within the target entity community are extracted as contextual information. Here, the preset threshold is a lower bound indicator used to filter out invalid community sizes; for example, it can be set to 2. The target entity community refers to the set of valid clusters whose member size meets the threshold requirement. A relation triple is a data unit consisting of two entity nodes and a relation edge connecting these two nodes. Contextual information refers to structured data that reflects the internal knowledge logic of the community.
[0108] As an optional implementation, the number of entity texts contained in each entity community is determined, and scattered communities with fewer than 2 entity texts are filtered out. For target entity communities with 2 or more entity texts, all relation triples contained within them are pulled from the temporary computation graph and used as context information for subsequent understanding.
[0109] S33. Summarize the contextual information semantically and generate a natural language summary corresponding to the target entity community.
[0110] Considering that structured triple data alone cannot provide end users with an intuitive knowledge map, nor is it conducive to macro-level semantic retrieval, this embodiment performs semantic summarization of contextual information to generate natural language summaries corresponding to the target entity community, so as to convert them into human-readable continuous text.
[0111] Here, semantic summarization refers to the process of summarizing the core ideas of scattered structured data by leveraging the reasoning capabilities of external intelligent models; natural language summarization refers to a thematic summary paragraph expressed in everyday, coherent sentences.
[0112] In this process, a multi-threaded parallel call method can be used to input the above context information into the large language model. The large language model then uses 2 to 3 sentences to summarize the theme, common features of knowledge points, and core relationship links of the target entity community, thereby generating a natural language summary that reflects the overall picture of the local knowledge network.
[0113] S34. Combine the natural language summary with the entity text within the target entity community to construct independent community nodes, and store the community nodes in the knowledge graph.
[0114] Furthermore, considering that if the summary text is only stored in memory or the business layer, it cannot be directly retrieved by the semantic retrieval mechanism at the underlying graph database, nor can a long-term mapping be established with the original knowledge points on the physical graph, the natural language summary is combined with the entity text within the target entity community to construct independent community nodes, which are then stored in the knowledge graph. Here, an independent community node refers to a newly created graph node entity at the underlying knowledge graph, specifically designed to carry high-dimensional summary information.
[0115] As an optional implementation, the generated natural language summary is vectorized by the embedding model and then combined with metadata information such as the text names of member entities in the target entity community and the total number of entities and persistently written into the graph database, thereby constructing independent community nodes. This allows these high-level semantic summaries to be hit by vector semantic retrieval, thus providing the platform with reasoning support similar to that of a knowledge map.
[0116] Based on any of the above embodiments, in S31, community partitioning is performed based on a temporary computation graph to obtain at least one entity community containing multiple entity texts, including: S311. When the total number of entity texts in the temporary computation graph reaches the minimum scale threshold, the community division result of the previous round is used as the initial clustering benchmark. Based on the connection density of the relationship edges between entity texts in the temporary computation graph, the entity texts are clustered on the initial clustering benchmark to determine the community identifier corresponding to each entity text after division.
[0117] S312. Record the community identifier into the corresponding entity text, and aggregate the entity texts with the same community identifier to obtain the entity community.
[0118] Among them, after storing community nodes in the knowledge graph, expired community nodes that no longer exist in this round of community division are cleaned up from the knowledge graph.
[0119] Here, the minimum size threshold refers to the lower limit of the number of nodes used to pre-determine whether the temporary computation graph has value for community detection; the previous round of community partitioning results refers to the clustering status of each node established by the previous algorithm run before the current task is triggered; the initial clustering benchmark refers to the starting state of this algorithm operation. Relationship edge connection density is used to measure the tightness of the connections between nodes; the community identifier is a grouping number used to uniquely identify the specific community to which the entity text belongs.
[0120] The system can perform a preliminary judgment: when the total number of entity texts in the temporary computation graph reaches the minimum scale threshold of 10, the Leiden community detection algorithm is triggered. During the algorithm's operation, the previous community partitioning is used as a seed to establish the initial clustering benchmark, and the community granularity is controlled by a resolution parameter γ, where γ represents the numerical value controlling the granularity of community partitioning. The larger the value, the more detailed the community partitioning; in this embodiment, it can be set to 1.0. The modularity is continuously optimized based on the connection density of relational edges within the network until the partitioning stabilizes. Simultaneously, the number of communities and the modularity are returned as partitioning quality metrics, ultimately determining the community identifier corresponding to each entity text after partitioning.
[0121] After obtaining the entity communities and storing the community nodes they form in the knowledge graph, it's important to consider that the knowledge network topology will change as new data is continuously written to the knowledge graph and old data is merged and deleted. Some communities originally generated based on the historical topology may have disintegrated or lost their practical significance. Continuously retaining these communities could lead to errors in graph retrieval. Therefore, after storing the community nodes in the knowledge graph, expired community nodes that no longer exist in the current round of community partitioning are cleaned up.
[0122] Expired community nodes refer to useless community information nodes generated in the previous round but no longer existing and no longer matching the current graph structure after re-detection based on the latest graph structure in this round. As an optional implementation, after completing the persistent writing operation of new community nodes in this round, the historical community node set stored in the graph database is compared, and discarded nodes that did not appear in the results of this round are cleared and released. This ensures that the summarized community data remains highly consistent with the latest underlying details of the knowledge graph, thus providing accurate retrieval support for subsequent knowledge reasoning.
[0123] in, Figure 2 This is a schematic diagram of the knowledge graph construction and post-processing workflow provided by the present invention, such as... Figure 2 As shown, this process automatically extracts and writes knowledge graphs from educational texts into a graph database using a large language model, and performs systematic post-processing within user isolation boundaries. The specific process is as follows: First, the unstructured educational texts to be processed are obtained. Due to the diverse sources and varied expressions of the educational texts, they are processed by text segmentation to adapt to the independent processing windows of the large language model.
[0124] Then, based on the zero-shot capability of the large language model, parallel entity extraction and relation extraction are performed. To meet the differentiated needs of different disciplines and teaching scenarios, the extraction process provides three construction modes: free extraction, guided extraction, and strict constraint extraction.
[0125] Next, the extracted discrete entity-relation network data undergoes preliminary deduplication and merging, and the feature vectors corresponding to each entity text are obtained. After vectorization, deduplication and merging are performed again, and the constructed original graph is stored in the graph database (Neo4j).
[0126] Subsequently, after each knowledge construction task writes new entity text and before the graph is made available for user querying, the system automatically and instantly triggers incremental candidate entity text pair recall and equivalence association establishment operations to perform lightweight disambiguation on the newly added entities.
[0127] Finally, two branch tasks—deep cleaning and global optimization—are executed manually by the user or scheduled periodically, with the entire process strictly operating within the multi-tenant logical isolation boundary: On the one hand, a global post-processing mechanism is executed on the entire graph, which includes determining the entity disambiguation of the standardized entity text and updating the relation edge connection, performing corresponding relation resolution operations on duplicate relations, complementary relations and conflict relations respectively, and removing the surface character differences of type names and the type schema normalization of semantic grouping in the knowledge graph.
[0128] On the other hand, the graph algorithm clustering, which aims to compensate for the lack of high-level semantic structure in the automatic graph construction, is executed to construct a temporary computation graph for community division, and to perform semantic summarization of contextual information to generate natural language summaries corresponding to the target entity community.
[0129] Through the automated process described above without human intervention, the original noisy graph containing entity redundancy, ambiguity, and relationship conflicts is automatically purified into a high-quality knowledge graph with consistent structure, semantic redundancy removal, and clear hierarchy.
[0130] The knowledge graph post-processing apparatus provided by the present invention is described below. The knowledge graph post-processing apparatus described below and the knowledge graph post-processing method described above can be referred to in correspondence.
[0131] Based on any of the above embodiments Figure 3 This is a schematic diagram of the knowledge graph post-processing device provided by the present invention, as shown below. Figure 3 As shown, the device includes: Unit 310 is selected to determine candidate entity text pairs from the knowledge graph to be processed, wherein the feature similarity between entity texts in the candidate entity text pairs meets the preset conditions. Establishment unit 320 is used to establish an equivalence association between the entity texts in the candidate entity text pair if the candidate entity text pair expresses the same concept. The equivalence association includes direct equivalence association and indirect equivalence association. Direct equivalence association is used to characterize the synonym relationship directly established between two entity texts, and indirect equivalence association is used to characterize the synonym relationship obtained through other entity texts. The partitioning unit 330 is used to partition entity texts that have equivalent associations into the same set to obtain an equivalent entity set, and to determine the canonical entity text from the equivalent entity set; Update unit 340 is used to update the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity text in the knowledge graph.
[0132] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 4 As shown, the electronic device may include a processor 410, a communications interface 420, a memory 430, and a communication bus 440. The processor 410, communications interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions from the memory 430 to execute knowledge graph post-processing methods.
[0133] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0134] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the knowledge graph post-processing methods provided by the above methods.
[0135] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the knowledge graph post-processing methods provided by the methods described above.
[0136] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0137] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A knowledge graph post-processing method, characterized in that, include: Candidate entity text pairs are determined from the knowledge graph to be processed, wherein the feature similarity between the entity texts in the candidate entity text pairs meets a preset condition; If the candidate entity text pairs express the same concept, then an equivalence association is established between the entity texts in the candidate entity text pairs. The equivalence association includes direct equivalence association and indirect equivalence association. The direct equivalence association is used to characterize the synonym relationship directly established between two entity texts, and the indirect equivalence association is used to characterize the synonym relationship obtained through other entity texts. Entity texts with equivalent associations are grouped into the same set to obtain an equivalent entity set, and canonical entity texts are determined from the equivalent entity set; In the knowledge graph, the relation edges of the remaining entity texts in the equivalent entity set, excluding the canonical entity text, are updated to be connected to the canonical entity text.
2. The knowledge graph post-processing method according to claim 1, characterized in that, After updating to be concatenated with the canonical entity text, it also includes: Retrieve multiple candidate relation edges that connect text pairs of the same entity; Based on the contextual semantics expressed by the candidate relation edges, the candidate relation edges are divided into repeating relations that express the same meaning, semantically compatible complementary relations, and conflicting relations that contradict each other. Perform corresponding relation resolution operations on the repeating relation, the complementary relation, and the conflicting relation, respectively.
3. The knowledge graph post-processing method according to claim 2, characterized in that, The step of performing corresponding relation resolution operations on the repeating relation, the complementary relation, and the conflicting relation respectively includes: Select the edge with the most source documents from the repeated relationships as the target relationship edge, and merge the remaining relationship edges in the repeated relationships into the target relationship edge; All complementary relationships are preserved simultaneously in the knowledge graph; Semantic analysis is performed on the conflicting relationships, and the semantically correct relationship edge is selected and retained from the conflicting relationships; if the semantically correct relationship edge cannot be determined through the semantic analysis, the relationship edge with the largest number of source documents is retained.
4. The knowledge graph post-processing method according to any one of claims 1 to 3, characterized in that, In the knowledge graph, updating the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity text includes: The outgoing edges that start from the remaining entity text are updated to start from the canonical entity text, and the incoming edges that end from the remaining entity text are updated to end from the canonical entity text. The connection formed between the remaining entity text and the canonical entity text is updated to a self-loop edge that starts from and ends at the canonical entity text. The update operations for the outgoing edge, the incoming edge, and the self-loop edge are all implemented synchronously within the same data writing process.
5. The knowledge graph post-processing method according to any one of claims 1 to 3, characterized in that, Before identifying candidate entity-text pairs from the knowledge graph to be processed, the following steps are also included: Remove the surface character differences of type names in the knowledge graph, and group type names with the same surface character differences into the same type group; A first standard name is selected from the type names of the same type group based on the frequency of occurrence, and all type names in the same type group are replaced with the first standard name. Semantic analysis is performed on the remaining different type names in the knowledge graph after replacement, and type names with equivalent semantic meanings are grouped into the same semantic group; Based on the semantic analysis results, a second standard name is selected from the type names of the same semantic group, and all type names within the same semantic group are replaced with the second standard name.
6. The knowledge graph post-processing method according to claim 5, characterized in that, The step of removing surface character differences in type names from the knowledge graph and grouping identical type names into the same type group after removing surface character differences includes: Remove leading and trailing whitespace characters from the type name in sequence, convert the letter characters in the type name to characters of a specified format, replace the specified connector in the type name with a space, and replace multiple consecutive spaces with a single space to obtain the normalized feature key corresponding to the type name; Type names with the same normalized feature key are grouped into the same type group.
7. The knowledge graph post-processing method according to any one of claims 1 to 3, characterized in that, Before determining candidate entity text pairs from the knowledge graph to be processed, the process also includes: obtaining the user identification information of the current user. Accordingly, determining candidate entity text pairs from the knowledge graph to be processed includes: Within the scope of the graph data carrying the user identification information, candidate entity text pairs are determined from the knowledge graph to be processed; Accordingly, updating the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity text in the knowledge graph includes: Within the graph data carrying the user identification information, the relation edges of the remaining entity texts in the equivalent entity set, excluding the canonical entity text, are updated to be connected to the canonical entity text.
8. The knowledge graph post-processing method according to any one of claims 1 to 3, characterized in that, The steps for determining the feature similarity include: According to entity type, the multiple entity texts in the knowledge graph to be processed are divided into different type data blocks; If the number of entity texts in any type of data block does not exceed the preset number threshold, then all entity text pairs in the corresponding type of data block are traversed, the spatial distance between entity text pairs is calculated one by one, and the feature similarity between entity text pairs in the corresponding type of data block is determined based on the spatial distance. If the number of entity texts in any type of data block exceeds the preset threshold, the entity type is used as a range constraint, and local matching retrieval is performed in the corresponding type of data block based on the distance proximity mapping relationship in the vector space to obtain the feature similarity between entity text pairs in the corresponding type of data block.
9. The knowledge graph post-processing method according to any one of claims 1 to 3, characterized in that, In the knowledge graph, after updating the relation edges of the remaining entity texts in the equivalent entity set (excluding the canonical entity text) to be connected to the canonical entity text, the process further includes: In the knowledge graph, a temporary computation graph containing the current entity text and the edges of the association relationship is constructed, and community division is performed based on the temporary computation graph to obtain at least one entity community containing multiple entity texts; For a target entity community containing a preset threshold number of entity texts, extract the relation triples within the target entity community as context information. The context information is semantically summarized to generate a natural language summary corresponding to the target entity community; The natural language summary is combined with the entity text within the target entity community to construct an independent community node, and the community node is stored in the knowledge graph.
10. The knowledge graph post-processing method according to claim 9, characterized in that, The community partitioning based on the temporary computation graph, resulting in at least one entity community containing multiple entity texts, includes: When the total number of entity texts in the temporary computation graph reaches the minimum scale threshold, the community division result of the previous round is used as the initial clustering benchmark, and based on the connection density of the relationship edges between entity texts in the temporary computation graph, the entity texts are clustered on the initial clustering benchmark to determine the community identifier corresponding to each entity text after division. The community identifier is recorded in the corresponding entity text, and entity texts with the same community identifier are aggregated to obtain the entity community; Specifically, after storing the community nodes in the knowledge graph, expired community nodes that no longer exist in the current round of community division are cleaned up from the knowledge graph.
11. A knowledge graph post-processing device, characterized in that, include: The selection unit is used to determine candidate entity text pairs from the knowledge graph to be processed, wherein the feature similarity between the entity texts in the candidate entity text pairs meets a preset condition; The establishment unit is used to establish an equivalence association between the entity texts in the candidate entity text pair if the candidate entity text pair expresses the same concept. The equivalence association includes direct equivalence association and indirect equivalence association. The direct equivalence association is used to characterize the synonym relationship directly established between two entity texts. The indirect equivalence association is used to characterize the synonym relationship obtained through other entity texts. A partitioning unit is used to partition entity texts that have equivalent associations into the same set to obtain an equivalent entity set, and to determine the canonical entity text from the equivalent entity set; The update unit is used to update the relation edges of the remaining entity texts in the equivalent entity set, excluding the canonical entity text, to be connected to the canonical entity text in the knowledge graph.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the knowledge graph post-processing method as described in any one of claims 1 to 10.
13. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the knowledge graph post-processing method as described in any one of claims 1 to 10.
