Semantic graph and structure graph fused entity relationship automatic generation method

By constructing semantic graphs and structural graphs, calculating correlation degrees and generating undirected relation pairs, high-quality entity relations are automatically generated. This solves the problem of knowledge graph annotation relying on manual annotation by experts, automates the coverage and updating of massive dynamic data, and improves the interpretability and applicability of knowledge graphs.

CN121860016APending Publication Date: 2026-04-14CENTRAL SOUTH UNIVERSITY OF FORESTRY AND TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-10
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In existing knowledge graph technologies, entity relationship annotation relies heavily on manual annotation by experts, which makes it difficult to cover massive and dynamically changing data, and easily leads to problems such as inconsistent annotation standards and delayed updates.

Method used

By constructing semantic graphs and structural graphs, the semantic relevance between keywords and text paragraph structures is calculated, undirected relation pairs are generated, entity sets are automatically filtered, and triples are constructed based on textual evidence to form a semantic association knowledge graph, reducing the reliance on manual annotation.

Benefits of technology

It enables the automated generation of high-quality entity relationships, avoids inconsistent annotation standards and lag in updates, and improves the interpretability and applicability of knowledge graphs, especially with higher accuracy and efficiency in long documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121860016A_ABST
    Figure CN121860016A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of knowledge graphs, and provides a semantic graph and structure graph fused entity relationship automatic generation method, which comprises the following steps: constructing a semantic graph according to text content, and constructing a structure graph according to a text structure; calculating the semantic association degree between each keyword vector and each text paragraph structure vector; performing semantic association degree sorting on keywords related to each text paragraph structure to construct an association degree matrix; calculating the semantic correlation between every two keywords, and constructing a plurality of undirected relation pairs according to the semantic correlation so as to automatically screen and generate an entity set in the semantic correlation knowledge graph; based on the text evidence and each undirected relation pair, performing relation calculation on two keywords in each undirected relation pair to construct a semantic association knowledge graph; a large model hint project for relationship discovery is improved based on a high quality relationship sample library. According to the method, entity relationship automatic labeling can be carried out on massive and dynamically changing text contents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge graph technology, and in particular to an automatic entity relationship generation method that integrates semantic graphs and structural graphs. Background Technology

[0002] Artificial intelligence (AI) is a science that studies and develops theories, methods, technologies, and application systems to simulate, extend, and expand human intelligence, aiming to enable machines to perceive, think, learn, make decisions, and even create like humans. Question-answering robots are one of the most typical and direct applications of AI technology, embodying AI's core capabilities in perception, cognition, and interaction.

[0003] Knowledge graphs are a crucial branch and infrastructure of artificial intelligence. They describe entities (such as people, places, and concepts) and their complex relationships in a structured way, forming a vast semantic network. Knowledge graphs enhance the generalization ability and interpretability of machine learning models by injecting domain knowledge (such as improving the rationality of recommendation systems). Meanwhile, their own construction and updates rely on AI technologies such as natural language processing for automated implementation. Both mutually empower each other, jointly propelling artificial intelligence towards higher levels of understanding the world, logical reasoning, and autonomous decision-making.

[0004] A knowledge graph is a semantic network that describes the objective world using a graph structure. Essentially, it's a knowledge base describing concepts, entities, and their relationships, and a major manifestation of knowledge engineering in the field of artificial intelligence. It organizes data using triples, and its construction process includes knowledge extraction, fusion, and processing, and it's applied in multiple fields such as semantic search, intelligent question answering, and recommendation systems.

[0005] The basic unit of a knowledge graph is a triple, which is divided into two categories: The first type is entity-relationship-entity, such as: Xiaoming (entity) - graduated from (relationship) - University A (entity); The second type is entity-attribute-value, such as: Xiaoming (entity)-height (attribute)-1.9 meters (attribute value).

[0006] The triplet in a knowledge graph is the most basic unit of knowledge representation. Through a concise graph structure (node-edge-node), it transforms fragmented information into discrete facts that are understandable and processable by machines, serving as the core data carrier for building large-scale semantic networks. The core function of the triplet is to achieve the standardization and structured representation of knowledge. It transforms unstructured natural language descriptions (such as "Xiaoming graduated from University A") into a unified, computer-manipulable data form. This standardization enables knowledge to be efficiently stored in graph databases and supports complex queries, association analysis, and logical reasoning based on graph traversal. The triplet model, through discrete fact units, provides clear semantic boundaries and machine-readable association paths for knowledge, forming the foundation for achieving knowledge computability.

[0007] Triples are the basic operational units for knowledge graphs to achieve higher cognitive functions. The entity relation definitions of each triple in a knowledge graph are a decisive factor in the effectiveness of knowledge graph applications, directly affecting the system's reliability, interpretability, and practical value. In the construction of knowledge graph triples, the core relationship definition and directional annotation typically require deep involvement from domain experts. Experts determine the relationship types between entities (e.g., "treatment," "cause," "belong to") based on their professional knowledge and industry consensus, and clarify the semantic direction of the relationships (e.g., the orientation of the employment relationship in "company-employee-employee") to ensure the accuracy and logical consistency of knowledge. This manual annotation method is authoritative in terms of accuracy, domain adaptability, and ontology construction, but it also brings significant technical drawbacks: This method heavily relies on expert subjective judgment and limited time, resulting in high annotation costs, low efficiency, and difficulty in scaling. Furthermore, manual annotation struggles to cover massive and dynamically changing data (e.g., medical literature or news information), easily leading to inconsistent annotation standards and delayed updates, thus limiting the application and development of knowledge graphs in real-time and open domains.

[0008] Therefore, existing knowledge graph technologies suffer from a high reliance on manual annotation by experts for entity relationship labeling, making it difficult to cover massive and dynamically changing data, and easily leading to problems such as inconsistent annotation standards and delayed updates. Summary of the Invention

[0009] The main objective of this invention is to provide an automatic entity relationship generation method that integrates semantic graphs and structural graphs. This method aims to address the problems in existing knowledge graph technologies, such as the heavy reliance on manual annotation by experts, difficulty in covering massive and dynamically changing data, and the tendency for inconsistent annotation standards and delayed updates.

[0010] To achieve the above objectives, this invention provides an automatic entity relation generation method that fuses semantic graphs and structural graphs, comprising the following steps: A semantic graph is constructed based on the text content, and a structure graph is constructed based on the text structure. The semantic graph includes a set of candidate entities extracted from the text content, and each candidate entity in the candidate entity set is a keyword vector. The structure graph includes a set of paragraph vectors extracted from the text structure, and the paragraph vector set includes multiple text paragraph structure vectors. Based on the semantic graph and the structure graph, calculate the semantic correlation between each keyword vector and the structure vector of each text paragraph; The keywords related to the structure of each text paragraph are ranked according to their semantic relevance in order to construct a relevance matrix; Based on the semantic relevance of keywords related to the structure of each text paragraph in the relevance matrix, the semantic relevance between each pair of keywords is calculated. Several undirected relation pairs are constructed according to the magnitude of semantic relevance to automatically filter and generate entity sets in the semantic relevance knowledge graph. In each undirected relation pair, two semantically related keywords are used as an entity pair. Based on textual evidence and various undirected relation pairs, the relationship between the two keywords within each undirected relation pair is calculated to construct a triplet with complete textual evidence and a semantic association knowledge graph. Traceable textual evidence based on triples obtained by fusing semantic graphs and structural graphs is used to extract high-confidence triples with complete textual evidence to build a high-quality relation sample library. This high-quality relation sample library is then used to improve large model hinting engineering for relation discovery.

[0011] Optionally, the step of constructing a semantic graph based on the text content includes: Extract multiple keywords from the text content based on its features to form a keyword set; The keyword set is processed into a text vectorization set to obtain a keyword vector set, which is then used as the candidate entity set.

[0012] Optionally, the step of constructing a structure graph based on the text structure includes: Extract multiple text paragraph structures from the text content based on text structure features to form a text paragraph structure set; The text paragraph structure set is vectorized to obtain a paragraph vector set.

[0013] Optionally, the step of extracting multiple text paragraph structures from the text content based on text structural features to form a set of text paragraph structures includes: Establish a structural model to describe the text structure; Define the relationships between text paragraph structures at each level in the structural model; Based on the structural model, the text content is automatically divided into multiple text paragraph structures to form a set of text paragraph structures.

[0014] Optionally, the step of extracting multiple text paragraph structures from the text content based on text structural features to form a set of text paragraph structures includes: Establish a tree-structured model to describe the text structure; Define the structural hierarchy of each text paragraph in the tree structure model; Define the connection relationships between adjacent text paragraph structural levels in a tree structure model; Based on the hierarchical structure and connection relationships of each text paragraph in the tree structure model, the text content is automatically divided into multiple text paragraph structures to form a set of text paragraph structures.

[0015] Optionally, the step of calculating the relationship between two keywords within each undirected relation pair based on textual evidence and each undirected relation pair to construct a triplet and semantic association knowledge graph with complete textual evidence includes: Text block segmentation and text vectorization are performed based on textual evidence to form a vector database; Undirected relation pairs are retrieved from a vector database using text vectors to learn and infer the relationship type between the two keywords in each undirected relation pair through few-shot learning. Based on undirected relation pairs and the relation type of the two keywords in each undirected relation pair, construct a semantic association knowledge graph.

[0016] Optionally, the semantic relevance can be calculated using the following formula: ; in, For the i-th keyword, This represents the structure of the j-th text paragraph; This represents the degree of relevance between the i-th keyword and the structure of the j-th text paragraph.

[0017] Optionally, the semantic relevance between any two keywords can be calculated using the following formula: ; in, The semantic relevance between the i-th keyword and the specified text paragraph structure. The semantic relevance between the l-th keyword and the specified text paragraph structure. The semantic relevance between the i-th keyword and the l-th keyword in relation to the structure of a specified text paragraph.

[0018] Optionally, the step of constructing several undirected relation pairs based on the magnitude of semantic relevance to automatically filter and generate the entity set in the semantic association knowledge graph includes: Based on the semantic relevance between keywords related to the structure of each text paragraph, a Top-n filter is performed to construct several undirected relation pairs; Based on each undirected relation pair, the entity set in the semantic association knowledge graph is automatically generated.

[0019] Optionally, after the step of calculating the relationship between the two keywords within each undirected relation pair based on textual evidence and each undirected relation pair to construct a triplet and semantic association knowledge graph with complete textual evidence, the method further includes: Retrieve the query content input into the query system as text content; Based on the undirected relation pairs in the semantic association knowledge graph constructed for the query content, and the relationship between the two entities within each undirected relation pair, the query content is semantically vectorized. Based on the semantic vectorization results, target text retrieval is performed; Based on the retrieved target text, construct the response text for the query.

[0020] The technical solution of this invention helps to solve the problems in existing knowledge graph technologies, such as the heavy reliance on expert manual annotation for entity relationship labeling, difficulty in covering massive and dynamically changing data, and the tendency for inconsistent annotation standards and delayed updates. Specifically, in this invention, a semantic graph is constructed based on the text content to obtain a set of candidate entities extracted from the text content. Each keyword vector in the candidate entity set is considered as a candidate entity. A structure graph is constructed based on the text structure, including text paragraph structure vectors extracted from the text structure. Based on the semantic graph and the structure graph, the semantic relevance between each keyword vector and each text paragraph structure vector is calculated. The keywords related to each text paragraph structure are then sorted by semantic relevance to construct a relevance matrix. Based on the semantic relevance ranking of keywords related to each text paragraph structure in the relevance matrix, the semantic relevance between every two keywords is calculated, thereby constructing several undirected relation pairs based on the magnitude of semantic relevance. This achieves automatic filtering and generation of entity sets in the semantic relation knowledge graph. Furthermore, based on textual evidence and each undirected relation pair, the relationship between the two keywords within each undirected relation pair is calculated to construct triples with complete textual evidence and the semantic relation knowledge graph. Therefore, this invention can construct a semantic association knowledge graph from massive and dynamically changing text content without relying on manual annotation, thereby avoiding problems such as inconsistent annotation standards and delayed annotation updates. Attached Figure Description

[0021] Figure 1 This is a flowchart illustrating the automatic entity relationship generation method that integrates semantic graphs and structural graphs in the first embodiment of the present invention. Figure 2This is a schematic diagram of the process for generating undirected relation pairs in this invention.

[0022] The objectives, features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0023] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0024] In the following description, the use of suffixes such as "unit," "component," or "element" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "unit," "component," or "element" may be used interchangeably.

[0025] Please see Figures 1 to 2 The first embodiment of the present invention provides a method for automatically generating entity relationships by fusing semantic graphs and structural graphs, comprising the following steps: Step S10: Construct a semantic graph based on the text content and a structure graph based on the text structure. The semantic graph includes a set of candidate entities extracted from the text content, and each candidate entity in the candidate entity set is a keyword vector. The structure graph includes a set of paragraph vectors extracted from the text structure, and the paragraph vector set includes multiple text paragraph structure vectors. Step S20: Based on the semantic graph and the structure graph, calculate the semantic correlation between each keyword vector and the structure vector of each text paragraph. Step S30: Sort the keywords related to the structure of each text paragraph according to their semantic relevance to construct a relevance matrix; Step S40: Sort the semantic relevance of keywords related to the structure of each text paragraph in the relevance matrix, calculate the semantic relevance between each pair of keywords, and construct several undirected relation pairs according to the size of semantic relevance to automatically filter and generate the entity set in the semantic relevance knowledge graph. In each undirected relation pair, two semantically related keywords are used as an entity pair. Step S50: Based on the textual evidence and each undirected relation pair, perform relation calculation on the two keywords within each undirected relation pair to construct a triplet with complete textual evidence and a semantic association knowledge graph. Step S60: Based on the triplet traceable textual evidence obtained by fusing semantic graph and structural graph, the extracted high-confidence triplets with complete textual evidence are used to construct a high-quality relation sample library, and the large model hinting project for relation discovery is improved based on the high-quality relation sample library.

[0026] The technical solution of this invention helps to solve the problems in existing knowledge graph technologies, such as the heavy reliance on expert manual annotation for entity relationship labeling, difficulty in covering massive and dynamically changing data, and the tendency for inconsistent annotation standards and delayed updates. Specifically, in this invention, a semantic graph is constructed based on the text content to obtain a set of candidate entities extracted from the text content. Each keyword vector in the candidate entity set is considered as a candidate entity. A structure graph is constructed based on the text structure, including text paragraph structure vectors extracted from the text structure. Based on the semantic graph and the structure graph, the semantic relevance between each keyword vector and each text paragraph structure vector is calculated. The keywords related to each text paragraph structure are then sorted by semantic relevance to construct a relevance matrix. Based on the semantic relevance ranking of keywords related to each text paragraph structure in the relevance matrix, the semantic relevance between every two keywords is calculated, thereby constructing several undirected relation pairs based on the magnitude of semantic relevance. This achieves automatic filtering and generation of entity sets in the semantic relation knowledge graph. Furthermore, based on textual evidence and each undirected relation pair, the relationship between the two keywords within each undirected relation pair is calculated to construct triples with complete textual evidence and the semantic relation knowledge graph. Therefore, this invention can construct a semantic association knowledge graph from massive and dynamically changing text content without relying on manual annotation, thereby avoiding problems such as inconsistent annotation standards and delayed annotation updates.

[0027] In this invention, cross-graph semantic association is calculated by constructing semantic graphs and structural graphs, thereby establishing cross-modal associations between semantic graph nodes (entities) and structural graph nodes (text paragraph structures).

[0028] Constructing a relevance matrix organizes all calculated relevance values ​​into a single matrix, where rows correspond to candidate entities and columns to text paragraph structures. For each text paragraph structure, its corresponding column vector is extracted, and all relevance values ​​in that column are sorted (e.g., in descending order). This sorting clearly indicates which entities are semantically most relevant and important within a specific structural context.

[0029] For a set of entities within the same text paragraph structure, this invention focuses not only on their individual relevance to the text paragraph structure but also on the strength of their relevance to each other within the same text paragraph structure. This invention calculates the semantic relevance between pairs of entities based on their ranking position and relevance value in the relevance matrix. Higher relevance indicates a greater likelihood of semantic association between the entities corresponding to the two keywords within the common context defined by the text paragraph structure. In other words, the numerical value of the semantic relevance between each keyword vector and each text paragraph structure vector characterizes the degree of relevance between the core semantics of the entity and the theme expressed by the text paragraph structure.

[0030] For each text paragraph structure, this invention filters candidate entities based on calculated semantic relevance to retain entity pairs with high relevance. Thus, this invention obtains multiple sets of undirected relation pairs, which indicate that, based on the division of the text paragraph structure, the entities identified by the two keywords have high semantic relevance within a specific logical section.

[0031] Furthermore, for each undirected relation pair, this invention also needs to determine the nature of the relationship between them (e.g., "cause," "treat," "belong to"). Specifically, this invention retrieves text fragments (sentences or paragraphs) in the original text content that simultaneously contain both entities as textual evidence. Using this evidence, combined with a pre-trained language model or a specialized relation classification model, few-sample relation type inference is performed. Since undirected relation pairs have already been constructed through semantic relevance filtering, this invention significantly reduces the number of irrelevant entity pairs that need to be judged and provides the location of the most relevant contextual evidence, thereby significantly improving the efficiency and accuracy of relation classification.

[0032] The final confirmed entity pairs and their relationship types are stored in the graph database in the form of standard triples. Based on these, nodes and edges are continuously iterated and expanded to eventually form a complete semantic association knowledge graph.

[0033] Furthermore, this invention calculates the relationship between the two keywords within each undirected relation pair based on textual evidence and each undirected relation pair, in order to construct triples with complete textual evidence. The complete textual evidence refers to the source of the text paragraph structure from which the two entities and the relation in the triple accurately and clearly correspond, as well as the corresponding original text content.

[0034] Furthermore, the traceable textual evidence obtained from the fusion of semantic graph and structural graph can be used to extract high-confidence triples with complete textual evidence. These triples can be used to build a high-quality relation sample library, and the large model hinting project for relation discovery can be improved based on the high-quality relation sample library, so as to continuously iterate and optimize the model and improve the model's relation discovery capability and accuracy.

[0035] Through the aforementioned dual-image fusion mechanism, this invention has the following significant advantages compared to existing technologies that require manual annotation by experts: First, improved accuracy: By effectively filtering out noisy associations between unrelated text paragraphs through text structure, the generated candidate entity pairs are more likely to have real semantic relationships.

[0036] Second, efficiency optimization: Grouping and pre-filtering based on the structural context of text paragraphs avoids a large amount of unnecessary calculations and reduces computational complexity.

[0037] Third, enhanced interpretability: The generated triples can be traced back to the text paragraph structure from which they originate (e.g., the relation is supported by the fourth paragraph of the text content) and original text evidence, which enhances the credibility and interpretability of the knowledge graph (many end-to-end black-box models in the existing technology (such as some deep learning-based relation extraction models) directly output triples, but cannot provide a clear and reliable explanation, that is, they cannot explain which part of the original text the relation is inferred from, so the credibility is unknown).

[0038] Fourth, it has wide applicability: especially for long documents with a clear logical structure, such as scientific and technological literature, financial reports, and patent documents, it has wider applicability and accuracy.

[0039] In the first embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, and in the second embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, the step S10 of constructing a semantic graph based on text content includes: Step S11: Extract multiple keywords from the text content based on the text content features to form a keyword set; Step S12: The keyword set is processed into a text vectorization set to obtain a keyword vector set, which is then used as the candidate entity set.

[0040] Specifically, the input raw text content is segmented using an embedded model to identify core keywords in the text content as candidate entities to form a candidate entity set. These extracted candidate entities are used to construct entities for the knowledge graph after filtering.

[0041] Each keyword in the candidate entity set is encoded into a keyword vector, and all keyword vectors constitute the candidate entity node set in the semantic graph.

[0042] In the first embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, and in the third embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, the step S10 of constructing a structural graph based on the text structure includes: Step S13: Extract multiple text paragraph structures from the text content based on text structure features to form a text paragraph structure set; Step S14: Vectorize the set of text paragraph structures to obtain a set of paragraph vectors.

[0043] Structure diagrams are constructed to represent the physical and logical organization of text content.

[0044] Specifically, when constructing the structure graph, text structure parsing is performed first to analyze the structural composition of the text content. The structure of the text content is then used for feature encoding to convert it into text paragraph structure vectors. Each identified text paragraph structure (which can be a chapter, paragraph, or statement within a paragraph) is considered a text paragraph structure level. In this invention, not only are the nodes of each text paragraph structure level recorded, but the corresponding labels for each text paragraph structure level are also recorded. Furthermore, each text paragraph structure level is encoded into a text paragraph structure vector using a language model, thereby establishing a paragraph vector set through these text paragraph structure vectors. Therefore, the structure graph contains hierarchical relationships such as parallel levels and adjacent levels, forming a tree-like or graph-like topological structure.

[0045] In the third embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, and in the fourth embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, step S13 includes: Step S131: Establish a structural model to describe the text structure; Step S132: Define the relationships between text paragraph structures at each level in the structural model; Step S133: Based on the structural model, the text content is automatically divided into multiple text paragraph structures to form a set of text paragraph structures.

[0046] Specifically, the purpose of step S131 is to establish a structural model for describing the structure of text, specifically to establish a formal, machine-understandable organizational framework for unstructured raw text streams.

[0047] Typical types of structural models include, but are not limited to: (1) Tree-like hierarchical model: In this model, root nodes can describe different hierarchical units of the text paragraph structure, such as "section," "chapter," "section," "subsection," "paragraph," or sentences within a paragraph, which do not directly contain the main text content but serve as logical aggregations of nodes. Additionally, leaf nodes can represent content units that carry the actual text content.

[0048] (2) Sequence-block model: This model treats text content as a linear structure consisting of different functional blocks arranged in sequence.

[0049] Block types include "Title", "Author Information", "Abstract", "Introduction", "Methods", "Results", "Discussion", "References", and "Appendix".

[0050] It focuses on the sequence order and functional role transitions between blocks, rather than a strict hierarchical containment relationship. A "Results" block is usually followed by a "Discussion" block.

[0051] (3) Graph Relationship Model: This model is suitable for hypertext or documents with complex cross-reference relationships. Nodes represent an independent text unit (such as a chapter or a comment box). Edges represent containment relationships and can also represent various semantic relationships such as "citation", "reference", "see also", and "comparison".

[0052] In the fourth embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, and in the fifth embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, step S13 includes: Step S134: Establish a tree structure model to describe the text structure; Step S135: Define the structural hierarchy of each text paragraph in the tree structure model; Step S136: Define the connection relationships between adjacent text paragraph structural levels in the tree structure model; Step S137: Based on the hierarchical structure and connection relationship of each text paragraph in the tree structure model, the text content is automatically divided into multiple text paragraph structures to form a set of text paragraph structures.

[0053] In one specific embodiment of the present invention, a tree-like hierarchical model is adopted as the default structural model to obtain the hierarchical organization of text content and to provide a clear contextual structure for subsequent calculations.

[0054] Specifically, the relationships between text paragraphs at each level in the structural model are defined, injecting specific semantics and constraint rules into the established abstract model, and clarifying the connection and interaction methods between different levels and units.

[0055] In a tree-structured hierarchical model, the core relationships include the containment relationship between upper and lower levels, and the order relationship between levels within the same hierarchy.

[0056] The hierarchical relationship defines the scope of the context. The parent node (paragraph 3) provides a shared, high-level semantic topic for all its child nodes (sentence 1 of paragraph 3, sentence 2 of paragraph 3, sentence 3 of paragraph 3). In subsequent computations, entities within child nodes can inherit the topic context of the parent node.

[0057] Hierarchical relationships define the narrative flow. Nodes with the same hierarchical relationship (such as paragraphs 1, 2, and 3) are usually at the same granularity, and their content presents a contrasting, parallel, or progressive relationship. In the calculation of relevance, entities within nodes at the same level may have strong contrasting or complementary relationships.

[0058] Based on the structural model, the text content is automatically segmented into multiple text paragraph structures to form a set of text paragraph structures. The original text is parsed into a series of structured text units with hierarchical labels according to predefined models and rules.

[0059] The automatic segmentation process includes the following sub-steps: Signal detection and analysis: Input raw text and run a parser based on rules, regular expressions, or machine learning models to detect formatting, style, and semantic signals defined in the model.

[0060] The detected titles and text blocks are assigned to a virtual tree structure based on their signal strength (such as font size and numbering depth) and logical nesting rules.

[0061] It determines whether the currently detected text paragraph structure is a substructure of the previous text paragraph structure, a structure at the same level, or a higher-level text paragraph structure that needs to be traced back. Ultimately, a tree structure is generated, where each node contains a node ID, and may further include: level depth, structure type, title text, start / end position, and the original text content to which it belongs.

[0062] Traverse the constructed tree structure and extract each leaf node (i.e., the paragraph or list item containing the actual text content) as an independent text paragraph structure unit.

[0063] For each text paragraph structure, this invention not only records its corresponding original text, but also its complete context path. This context path will be transformed into part of a text structure vector in subsequent steps, so that the vector not only encodes the semantics of the text paragraph, but also implies its positional information and functional role in the overall document logic.

[0064] Through precise execution of this embodiment, the present invention achieves an intelligent transformation from unstructured text strings to organized text trees. This transformation enables subsequent text structure vectors to carry richer information—that is, the logical architecture of the document—far exceeding the semantics of pure text. This provides a computable basis for subsequent calculation of semantic-structural correlation, allowing the document's organizational form to effectively intervene in and guide the discovery of associations among knowledge units.

[0065] In the first embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, and in the sixth embodiment of the automatic entity relation generation method based on the fusion of semantic graph and structural graph of the present invention, step S50 includes: Step S51: Perform text block segmentation and text vectorization based on text evidence to form a vector database; Step S52: Perform text vector retrieval on the vector database for undirected relation pairs to learn and infer the relationship type of the two keywords in each undirected relation pair through few-shot learning; Step S53: Based on the undirected relation pairs and the relation type of the two keywords in each undirected relation pair, construct a triplet and semantic association knowledge graph with complete textual evidence.

[0066] In this embodiment, textual evidence is evidentiary text that can support or explain potential relationships between entities. The textual evidence is intelligently segmented to ensure that each segment represents a relatively complete semantic unit. The resulting text after segmentation is vectorized to facilitate subsequent sample learning and inference.

[0067] Undirected relation pairs are retrieved from a vector database using text vectors. This allows for few-shot learning to infer the relationship type between the two keywords in each undirected relation pair. This step combines precise evidence retrieval with few-shot learning, reducing the reliance on large-scale labeled data.

[0068] Specifically, as a concrete embodiment of the present invention, for each undirected relation pair, the system can automatically construct a query vector. This query can be simply obtained by concatenating or averaging the vectors of the two entity names. A better approach is to construct a prompt statement and quantify it, for example: What is the relationship between [Entity A] and [Entity B]? Input the query vector into a vector database and perform a similarity search. The database will return the Top-K text block vectors most similar to the query vector, along with their corresponding original text fragments. These returned text blocks constitute the most relevant textual evidence supporting the entity's relational assessment.

[0069] Then, the system performs relational reasoning based on a small sample of relationships retrieved from the evidence, including: Relation schema library preparation: Predefine a set of relation types (e.g., "cause", "treat", "belong to", "be located at"). For each relation type, provide a small number (e.g., 3-5) of extracted example triples as cue samples, for example, for "treat", the example is "(aspirin, treat, headache)".

[0070] Context building and reasoning: For each undirected entity pair, it is combined with the retrieved Top-K evidence text fragments and examples of all relation types in the relation pattern library to form a structured cue context, which is then input into a large language model.

[0071] Based on the provided evidence and a limited number of examples, the model performs contextual learning, infers, and outputs the most probable relationship type. Then, following the same reasoning method, it learns the relationships between the two entities within all undirected entity pairs. Thus, through the scheme of this embodiment, a semantic association knowledge graph is constructed based on undirected relationship pairs and the relationship type of the two keywords in each undirected relationship pair.

[0072] For each undirected relation pair whose relation type has been derived, a standard knowledge graph triple is generated. All generated high-confidence triples are then imported into a graph database in batches. In the graph database, the two entities in the undirected relation pair become nodes, and the relation type becomes the directed or undirected edge connecting the two nodes (based on relation attributes). Source evidence attributes are attached to each triple edge, recording the text block ID and original text fragment supporting the relation, thus achieving knowledge traceability.

[0073] The constructed initial knowledge graph can serve as new background knowledge and be fed back to the system front end.

[0074] For example, when processing new documents, existing graph entities can be used for entity linking, linking mentions in the new document to existing nodes in the graph, thereby continuously expanding and enriching the attributes and relationships of existing entities, and realizing the self-growth of the knowledge graph.

[0075] Specifically, the semantic relevance is calculated using the following formula: ; in, For the i-th keyword, This represents the structure of the j-th text paragraph; This represents the degree of relevance between the i-th keyword and the structure of the j-th text paragraph.

[0076] Therefore, based on the semantic relevance calculation formula, the semantic relevance between the i-th keyword and each text paragraph structure can be calculated. The semantic relevance between the i-th keyword and the 1st, 2nd, ..., jth text paragraph structures, ..., until the last text paragraph structure is used as the i-th row of a matrix. Each row of the matrix is ​​then sorted according to its semantic relevance, thus constructing the relevance matrix. Therefore, the relevance matrix can be used to determine the text paragraph structure with the highest semantic relevance to each keyword.

[0077] The semantic relevance between any two keywords can be calculated using the following formula: ; in, The semantic relevance between the i-th keyword and the specified text paragraph structure. The semantic relevance between the l-th keyword and the specified text paragraph structure. The semantic relevance between the i-th keyword and the l-th keyword in relation to the structure of a specified text paragraph.

[0078] The two keywords most relevant to the same text paragraph structure can be identified as the same undirected relation pair. ,in, For the i-th keyword, This is the l-th keyword.

[0079] In the first to sixth embodiments of the automatic entity relation generation method based on the semantic graph and structural graph fusion of the present invention, and in the seventh embodiment of the automatic entity relation generation method based on the semantic graph and structural graph fusion of the present invention, step S40, which involves constructing several undirected relation pairs based on the magnitude of semantic relevance to automatically filter and generate an entity set in a semantic association knowledge graph, includes: Step S41: Based on the semantic relevance between the keywords related to the structure of each text paragraph, perform Top-n filtering to construct several undirected relation pairs; Step S42: Automatically generate the entity set in the semantic association knowledge graph based on each undirected relation pair.

[0080] In the first to sixth embodiments of the automatic entity relation generation method based on the semantic graph and structural graph fusion of the present invention, in the eighth embodiment of the automatic entity relation generation method based on the semantic graph and structural graph fusion of the present invention, after step S50, the method further includes: Step S60: Obtain the query content input into the query system as text content; Step S70: Based on each undirected relation pair in the semantic association knowledge graph constructed for the query content, and the relationship between the two entities within each undirected relation pair, the query content is semantically vectorized. Step S80: Based on the semantic vectorization results, perform target text retrieval; Step S90: Based on the retrieved target text, construct the response text for the query content.

[0081] Specifically, in existing technologies, query systems vectorize the input query text. This vectorization process only converts the text content into computer-recognizable semantics, extracts keywords from the vectorized text, and uses these keywords to search for target content. However, this search based solely on keywords fails to understand the semantics of the query content, resulting in a large number of irrelevant search results. Combining these numerous irrelevant results with certain logic often yields responses that fail to match the query objective.

[0082] In this embodiment, the query content is used as the text content. A semantic association knowledge graph is constructed to extract each undirected relation pair in the query content, as well as the relationship between the two entities within each undirected relation pair. The query content is then semantically vectorized, thereby achieving the interpretation of the text content. Based on this, when retrieving target content, the search method shifts from searching based on a single keyword to a precise target content search based on undirected relation pairs and the relationship between the two entities within each pair. This ensures that the search target is the retrieval result obtained under the joint constraints of the undirected relation pairs and the relationship between the two entities, resulting in highly relevant retrieval results that avoid introducing irrelevant results. Furthermore, the retrieved highly relevant target content is processed into response text according to preset logic, thereby improving the accuracy of the query.

[0083] Similarly, the technical solution of the present invention can be applied to various query systems, knowledge base management systems, decision query systems, question and answer systems, etc.

[0084] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms, or by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, 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 is stored in a readable storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to enter the methods described in the various embodiments of the present invention.

[0085] In the description of this specification, references to terms such as "one embodiment," "another embodiment," "other embodiments," or "first embodiment to Xth embodiment," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, method steps, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0086] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0087] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0088] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A method for automatically generating entity relationships by fusing semantic graphs and structural graphs, characterized in that, Includes the following steps: A semantic graph is constructed based on the text content, and a structure graph is constructed based on the text structure. The semantic graph includes a set of candidate entities extracted from the text content, and each candidate entity in the candidate entity set is a keyword vector. The structure graph includes a set of paragraph vectors extracted from the text structure, and the paragraph vector set includes multiple text paragraph structure vectors. Based on the semantic graph and the structure graph, calculate the semantic correlation between each keyword vector and the structure vector of each text paragraph; The keywords related to the structure of each text paragraph are ranked according to their semantic relevance in order to construct a relevance matrix; Based on the semantic relevance of keywords related to the structure of each text paragraph in the relevance matrix, the semantic relevance between each pair of keywords is calculated. Several undirected relation pairs are constructed according to the magnitude of semantic relevance to automatically filter and generate entity sets in the semantic relevance knowledge graph. In each undirected relation pair, two semantically related keywords are used as an entity pair. Based on textual evidence and various undirected relation pairs, the relationship between the two keywords within each undirected relation pair is calculated to construct a triplet with complete textual evidence and a semantic association knowledge graph. Traceable textual evidence based on triples obtained by fusing semantic graphs and structural graphs is used to extract high-confidence triples with complete textual evidence to build a high-quality relation sample library. This high-quality relation sample library is then used to improve large model hinting engineering for relation discovery.

2. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to claim 1, characterized in that, The step of constructing a semantic graph based on text content includes: Extract multiple keywords from the text content based on its features to form a keyword set; The keyword set is processed into a text vectorization set to obtain a keyword vector set, which is then used as the candidate entity set.

3. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to claim 1, characterized in that, The step of constructing a structure graph based on the text structure includes: Extract multiple text paragraph structures from the text content based on text structure features to form a text paragraph structure set; The text paragraph structure set is vectorized to obtain a paragraph vector set.

4. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to claim 3, characterized in that, The step of extracting multiple text paragraph structures from the text content based on text structural features to form a text paragraph structure set includes: Establish a structural model to describe the text structure; Define the relationships between text paragraph structures at each level in the structural model; Based on the structural model, the text content is automatically divided into multiple text paragraph structures to form a set of text paragraph structures.

5. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to claim 4, characterized in that, The step of extracting multiple text paragraph structures from the text content based on text structural features to form a text paragraph structure set includes: Establish a tree-structured model to describe the text structure; Define the structural hierarchy of each text paragraph in the tree structure model; Define the connection relationships between adjacent text paragraph structural levels in a tree structure model; Based on the hierarchical structure and connection relationships of each text paragraph in the tree structure model, the text content is automatically divided into multiple text paragraph structures to form a set of text paragraph structures.

6. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to claim 1, characterized in that, The step of calculating the relationship between two keywords within each undirected relation pair based on textual evidence and each undirected relation pair, in order to construct a triplet and semantic association knowledge graph with complete textual evidence, includes: Text block segmentation and text vectorization are performed based on textual evidence to form a vector database; Undirected relation pairs are retrieved from a vector database using text vectors to learn and infer the relationship type between the two keywords in each undirected relation pair through few-shot learning. Based on undirected relation pairs and the relation type of the two keywords in each undirected relation pair, construct a triplet and semantic association knowledge graph with complete textual evidence.

7. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to claim 1, characterized in that, Calculate semantic relevance using the following formula: ; in, For the i-th keyword, This represents the structure of the j-th text paragraph; This represents the degree of relevance between the i-th keyword and the structure of the j-th text paragraph.

8. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to claim 1, characterized in that, The semantic relevance between any two keywords can be calculated using the following formula: ; in, The semantic relevance between the i-th keyword and the specified text paragraph structure. The semantic relevance between the l-th keyword and the specified text paragraph structure. The semantic relevance between the i-th keyword and the l-th keyword in relation to the structure of a specified text paragraph.

9. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to any one of claims 1 to 8, characterized in that, The step of constructing several undirected relation pairs based on the magnitude of semantic relevance to automatically filter and generate entity sets in the semantic association knowledge graph includes: Based on the semantic relevance between keywords related to the structure of each text paragraph, a Top-n filter is performed to construct several undirected relation pairs; Based on each undirected relation pair, the entity set in the semantic association knowledge graph is automatically generated.

10. The method for automatically generating entity relationships by fusing semantic graphs and structural graphs according to any one of claims 1 to 8, characterized in that, Following the step of calculating the relationship between two keywords within each undirected relation pair based on textual evidence and each undirected relation pair to construct a triplet and semantic association knowledge graph with complete textual evidence, the method further includes: Retrieve the query content input into the query system as text content; Based on the undirected relation pairs in the semantic association knowledge graph constructed for the query content, and the relationship between the two entities within each undirected relation pair, the query content is semantically vectorized. Based on the semantic vectorization results, target text retrieval is performed; Based on the retrieved target text, construct the response text for the query.