Tree structure-based knowledge base construction method, system and use method thereof

By constructing a knowledge base based on a tree structure, the problems of lost structural information, mismatched retrieval granularity, difficulty in knowledge tracing, and cumbersome updating and maintenance in vertical domains are solved, realizing efficient and accurate intelligent question answering and decision support, and meeting the needs of high-credibility applications.

CN122332574APending Publication Date: 2026-07-03GUANGXI LAND & RESOURCES PLANNING & DESIGN GRP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610425638.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-02
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing knowledge base technologies based on planar vector retrieval suffer from problems such as loss of structural information, mismatch of retrieval granularity, difficulty in knowledge tracing, insufficient utilization of associations, and cumbersome updates and maintenance in vertical domains, which limit the improvement of system performance.

Method used

We employ a tree-structured knowledge base construction method that transforms unstructured documents into a multi-granular, strongly correlated, and traceable domain knowledge base by simulating the structured organization of human knowledge. This includes document parsing, hierarchical tree initialization, semantic segmentation, multi-granular summary generation, and cross-node relationship enhancement. We then construct a knowledge graph and perform structured indexing.

Benefits of technology

It improves the accuracy, interpretability, and reasoning capabilities of intelligent systems in vertical domains, supports rapid updates, and meets the needs of high-reliability application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122332574A_ABST
    Figure CN122332574A_ABST
Patent Text Reader

Abstract

This invention proposes a method and system for constructing a knowledge base based on a tree structure. The method includes: document parsing and hierarchical tree initialization; semantic segmentation and leaf node generation, traversing nodes to divide long text content into a set of semantically independent text fragments, creating new leaf nodes for each text fragment, and using the corresponding nodes in the original document tree as their parent nodes to form a basic knowledge tree; bottom-up multi-granularity summary generation, starting from the leaf nodes of the basic knowledge tree, generating summaries for each internal node; cross-node relationship enhancement, forming an enhanced knowledge graph; structured indexing and persistence, constructing a searchable index for each node in the knowledge base. This invention maintains the logic and coherence of the input obtained by the large language model, thereby significantly improving the accuracy, professionalism, and logical consistency of the generated answers, effectively avoiding misinterpretation or logical contradictions caused by contextual fragmentation. It also improves the accuracy and efficiency of retrieval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer science and relates to artificial intelligence, natural language processing and information retrieval technology, and in particular to a knowledge base construction method and system based on a tree structure and its retrieval enhancement generation method. Background Technology

[0002] In specialized vertical fields such as natural resource surveys and monitoring, law, finance, and healthcare, leveraging artificial intelligence technologies, particularly large language models, to build efficient and reliable intelligent question-answering and decision support systems has become a hot topic in research and application. Retrieval-enhanced generative techniques, by introducing external knowledge sources into general-purpose large language models, alleviate the "illusion" problem of the model to some extent and improve its accuracy in answering questions within specialized domains. The key to this technology lies in its ability to construct a high-quality, easily searchable domain knowledge base.

[0003] Currently, mainstream domain knowledge base construction and retrieval solutions in the industry are generally based on the "vector retrieval" paradigm, and their standardized process can be summarized as follows: 1. Document preprocessing: Convert unstructured domain documents (such as PDF and Word) into plain text format.

[0004] 2. Text Chunking: Long texts are cut into a series of independent text segments (Chunks) by using a fixed-length sliding window or based on simple semantic boundaries (such as paragraphs).

[0005] 3. Vectorization and Indexing: Using a pre-trained text embedding model, each text segment is mapped to a high-dimensional dense vector (Embedding) and stored in a vector database (such as FAISS, Milvus) to build an index.

[0006] 4. Retrieval and Generation: When a user submits a query, the query text is also vectorized. The K most similar text fragments are retrieved from the vector database as "context" and input into the large language model along with the query to generate the final answer.

[0007] Although the above-mentioned planar vector retrieval-based schemes have been widely used, they have revealed the following fundamental flaws when dealing with complex, logically rigorous, and highly accurate and interpretable vertical domain knowledge, which seriously restricts further improvement of system performance: 1. Loss of Structural Information and Semantic Fragmentation: Existing text segmentation strategies are essentially indiscriminate planar cuts. This method crudely severs the inherent hierarchical organization (such as chapters, sections, articles, and clauses) and logical connections (such as general-to-specific, progressive, and citation) of documents. This results in the retrieved "context" being simply a collection of fragmented text snippets that may not be adjacent in the original document, or even come from different chapters. This loss of original structure disrupts the integrity and coherence of knowledge, making it difficult for large language models to understand the deep logic between fragments. This easily leads to logically contradictory, out-of-context, or incomplete answers, severely damaging the accuracy and professionalism of the responses.

[0008] 2. Mismatch between retrieval granularity and intent: Fixed-size text blocks cannot adapt to the diverse granularities of user queries. For example, for a macro-level question like "an overview of the land change survey process," the ideal answer should be based on chapter titles and summaries; for a micro-level question like "specific pixel requirements for evidence photos," it is necessary to locate specific clause descriptions. Existing solutions cannot dynamically perceive the granularity required by the query intent, and the returned results are often whole blocks of text containing the target information but mixed with a lot of irrelevant details, or conversely, key points are missed due to incomplete information within the block. This "granularity mismatch" leads to low retrieval efficiency and introduces an additional information filtering burden to large language models.

[0009] 3. Weaknesses in Knowledge Tracing and Explainability: While existing solutions can trace back to "text blocks" that provide context, these blocks are isolated, unstructured atomic units. The system cannot clearly reveal the complete derivation path and chain of evidence for the answer to the user. Users cannot know which chapter or specific clause the answer is based on, nor can they verify whether there are more relevant higher-level concepts or supplementary provisions. This "black box" approach to tracing severely weakens the system's credibility and practicality in serious professional scenarios.

[0010] 4. The problem of underutilization of inherent knowledge connections: Vector retrieval mainly relies on surface semantic similarity, making it difficult to capture and utilize the rich semantic relationships between knowledge units, such as: inclusion relationships (chapter contains paragraph), citation relationships (clause cites appendix), causal relationships (rules and exceptions), and sequential relationships (workflow steps). These relationships are crucial for complex reasoning and multi-hop question answering (e.g., "According to rule A, combined with case B, how should situation C be handled?"). Existing solutions lack explicit modeling of these relationships, resulting in insufficient system capabilities in complex scenarios requiring the integration of multiple related knowledge points.

[0011] 5. The cumbersome and inefficient nature of knowledge base updates and maintenance: Knowledge in vertical domains is constantly evolving. When a policy clause or technical specification is updated, under existing solutions, it is usually necessary to find all documents containing that clause, re-segment, vectorize, and re-index them. This process is computationally expensive and time-consuming, making it difficult to support real-time or incremental knowledge updates and failing to meet business requirements for timely knowledge updates.

[0012] In summary, existing knowledge base technologies based on planar vector retrieval, due to their inherent "unstructured" and "unrelated" characteristics, have become a technical bottleneck restricting the development of intelligent systems in vertical domains towards higher accuracy, stronger interpretability, and deeper reasoning capabilities. Therefore, there is an urgent need for a new generation of knowledge representation and retrieval architecture that can fundamentally solve the above-mentioned defects. Summary of the Invention

[0013] The purpose of this invention is to address the systemic shortcomings of existing planar vector retrieval schemes, as pointed out in the background art, such as loss of structural information, mismatch of retrieval granularity, difficulty in knowledge tracing, insufficient utilization of associations, and cumbersome updates and maintenance. This invention aims to provide a knowledge base construction and retrieval enhancement generation technology solution based on a tree structure. By simulating the structured organization of human knowledge, this invention transforms unstructured documents into a multi-granular, strongly associated, traceable, and easily evolving domain knowledge base. Based on this base, accurate, reliable, and transparent intelligent question answering can be achieved, thereby fundamentally improving the performance and credibility of AI applications in vertical domains.

[0014] The first aspect of this invention discloses a method for constructing a knowledge base based on a tree structure, the method comprising: Step S1: Document parsing and hierarchy tree initialization. The input document is parsed to extract text content and formatting information. Based on the formatting information, the document's title hierarchy structure is identified, and the titles are converted into tree node levels. And the initial original document tree is constructed using the title node as the skeleton. ; Step S2: Semantic segmentation and leaf node generation, traversing the original document tree. For each terminal node in the document tree, its long text content is divided into a set of semantically independent text fragments. A new leaf node is created for each text fragment, and the corresponding node in the original document tree is used as its parent node, thus forming a basic knowledge tree. ; Step S3: Bottom-up multi-granularity summary generation, from the aforementioned basic knowledge tree Starting from all leaf nodes, recursively generate summaries representing the content of their subtrees for each internal node, resulting in a complete knowledge tree with a summary attached to each node. ; Step S4: Enhance cross-node relationships in the complete knowledge tree The inherent father-son relationship edge set In addition, construct a supplementary relation edge set. To form an enhanced knowledge graph ; Step S5: Structured indexing and persistence, storing the complete knowledge tree. and the enhanced knowledge graph The structured data is persistently stored; a searchable index is built for each node in the knowledge base.

[0015] Furthermore, in step S1, an initial original document tree is constructed using the header node as its skeleton. include: The initial original document tree is constructed using the title node as its skeleton. , among which, nodes At least include node identifiers hierarchical Title text Belongs to the main text content And parent node and child node reference information.

[0016] Furthermore, in step S2, the long text content is divided into a set of semantically independent text fragments. A new leaf node is created for each text fragment, and the corresponding node in the original document tree is used as its parent node to form a basic knowledge tree. include: Its long text content Divide into a set of semantically independent text fragments ; for each text fragment Create a new leaf node and the original document tree The corresponding node As its parent node, it forms the basic knowledge tree. .

[0017] Furthermore, in step S3, a summary representing the content of its subtree is recursively generated upwards for each internal node, so that each node has a complete knowledge tree with a summary attached. Specifically, it includes: Recursively generate a summary representing the content of its subtree for each internal node; for any internal node... Let its direct child node set be Then its abstract Digest generation function The summary generated by aggregating its child nodes is expressed as follows:

[0018] in, This represents a text sequence concatenation operation; for leaf nodes... its abstract Its content text Or its simplified representation; This process yields a complete knowledge tree where each node is accompanied by a summary. .

[0019] Furthermore, in step 3, The summary generation function It is a sequence-to-sequence generation model based on the Transformer architecture. It encodes the input concatenated child node summary through an encoder and then generates the condensed summary text of the parent node through a decoder. During the model training phase, the summary generation function The optimization objective is to minimize the parent node summary it generates. Standard abstracts manually extracted from corresponding chapters of the original document Negative log-likelihood loss between , expressed as:

[0020] in, It is a standard summary The first in One word, This is the total word count of the abstract. It is the conditional probability predicted by the model.

[0021] Furthermore, in step S4, the supplementary relation edge set include: Cross-reference edges: Directed edges established between source and target nodes by parsing explicit cross-reference markers in the node text; Semantic relevance edges: These edges are formed by calculating the similarity of semantic vectors between nodes, and then identifying nodes where the similarity exceeds a preset threshold. Undirected edges are established between node pairs.

[0022] Furthermore, in step 4, the establishment of the semantically related edge specifically includes: for any two nodes Calculate its overall text representation and Embedded vector And calculate the cosine similarity. ;like Then in and Establish a weight between them The undirected edge.

[0023] Furthermore, in step S5, the index includes: a node-based overall text representation. vector index and inverted index based on text keywords .

[0024] Another aspect of the present invention provides a knowledge base system based on a tree structure, which includes a knowledge base construction module and a retrieval enhancement generation module, and the knowledge base system is constructed using the aforementioned method.

[0025] Another aspect of the present invention provides a method for using the aforementioned knowledge base, which includes the following steps: Step R1: Query parsing and preliminary retrieval, receiving user queries. Retrieve the initial set of candidate nodes most relevant to the query. ; Step R2: Structured context extension, to Starting from each node in the tree data structure and graph data structure, a multi-path traversal expansion is performed. The traversal expansion strategy includes: obtaining ancestor nodes upwards along the tree edges to provide background, obtaining descendant nodes downwards to provide details, and obtaining references and related nodes along the graph relationship edges to provide supplementary information. Step R3: Multi-granularity context assembly and answer generation. Based on the user query intent analysis results, select node information of different granularities for assembly: if it is a macro-level intent, select the summary of high-level nodes; if it is a micro-level intent, select the content of leaf nodes; and then assemble the selected information according to its position in the complete knowledge tree. The logical order of the text is sorted and combined into a structured prompt context, which is then input into a large language model along with the original user query to generate the final answer; Step R4: Answer tracing and output. Record the set of source node identifiers corresponding to each part of the context on which the answer is generated and output the answer and tracing information together.

[0026] In summary, the beneficial effects of the present invention are as follows: 1. Improvements to address the issues of structural information loss and semantic fragmentation: This invention constructs a knowledge tree that faithfully reflects the original hierarchical structure of a document. Furthermore, the system assembles context based on a tree structure during retrieval, fundamentally solving the problem of information fragmentation. The context retrieved and provided by the system is no longer isolated text blocks, but rather semantically complete knowledge units (such as complete chapters or semantic paragraphs) organized according to tree-like logical connections. This ensures that the input obtained by the large language model maintains the logic and coherence of the original knowledge, thereby significantly improving the accuracy, professionalism, and logical consistency of the generated answers, and effectively avoiding misinterpretation or logical contradictions caused by contextual fragmentation.

[0027] 2. Improvements to address the issue of inaccurate matching between search granularity and intent: This invention employs a bottom-up, multi-granularity summary generation technique (step S3) to assign different levels of abstraction to each node in the knowledge tree. During the retrieval response phase (step R3), the system intelligently analyzes the user's query intent and dynamically adapts the most suitable granularity of knowledge node information for assembly: for macro-level overview questions, it provides concise summaries of high-level nodes; for micro-level detailed questions, it provides detailed content of leaf nodes. This on-demand supply mechanism significantly improves the accuracy and efficiency of retrieval, reduces the burden on large language models to process redundant information, and ensures that the generated answers are both comprehensive and to the point.

[0028] 3. Improvements to address the issues of weak knowledge traceability and interpretability: Because each part of the context generated by the answer can be precisely located to a unique node in the knowledge tree (via node ID), this invention achieves unprecedented precision in tracing the source (step R4). The system can not only indicate which "document" the answer originates from, but also pinpoint the specific "chapter," "clause," or even "sentence." The output can include a clear tracing path (e.g., `Chapter 5 → Section 5.2 → Paragraph 3`), and even supports interactive user verification of the original text. This transforms the system's "black box" nature into a "glass box," greatly enhancing the interpretability, transparency, and user trust of the output, enabling it to meet the high credibility requirements of applications such as law enforcement, auditing, and healthcare.

[0029] 4. Improvement effects on addressing the problem of underutilization of the inherent connections within knowledge: This invention constructs an enhanced knowledge graph that includes semantic relationships such as references and relevance. (Step S4) The complex network relationships between knowledge units are explicitly characterized and stored. During retrieval (Step R2), the system can proactively explore along these relationship edges, automatically discovering and aggregating supplementary, causal, comparative, or referential knowledge related to the core question. This enables the system to effectively support complex multi-hop reasoning and comprehensive question answering (e.g., "According to rule A, combined with case B, how should it be handled under condition C?"), breaking through the limitations of traditional vector retrieval that relies solely on surface semantic similarity, and endowing the system with deeper domain cognition and reasoning capabilities.

[0030] 5. Improvements to address the cumbersome and inefficient nature of knowledge base updates and maintenance: This invention, based on tree-like and graph-like knowledge representations, naturally supports efficient local updates. When some knowledge changes, it is only necessary to locate and update the affected node subtree (step S8), and recursively update the summaries of its ancestor nodes, while adjusting the associated local relation edges and index entries. This incremental update mechanism avoids the huge overhead of full document reprocessing and global index reconstruction in traditional schemes, enabling the knowledge base to maintain timeliness at a lower cost and with a faster response time, thus better adapting to the rapidly evolving vertical domain knowledge environment. Attached Figure Description

[0031] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0032] Figure 1 This is a schematic diagram of the overall architecture of a tree-structured knowledge base construction and retrieval enhancement generation system provided in one embodiment of the present invention.

[0033] Figure 2 This is a detailed flowchart of the knowledge base construction method provided in one embodiment of the present invention.

[0034] Figure 3 This is a detailed schematic diagram of the semantic segmentation and leaf node generation steps provided in one embodiment of the present invention.

[0035] Figure 4 This is a schematic diagram illustrating the principle of a bottom-up summary generation process provided in one embodiment of the present invention.

[0036] Figure 5 This is a detailed flowchart of a retrieval enhancement generation method based on a tree-structured knowledge base, provided by an embodiment of the present invention.

[0037] Figure 6 This is a detailed schematic diagram of the structured context extension steps provided in an embodiment of the present invention. Detailed Implementation

[0038] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0039] An embodiment of the present invention provides a tree-structured knowledge base system and its construction method. Figure 1 shows a schematic diagram of the overall system architecture, including two core modules: a tree-structured knowledge base construction module and an online retrieval enhancement generation service module. The offline knowledge base construction module first receives the original domain document set, such as PDF and Word documents. Then, it sequentially processes the documents through document parsing and structure extraction units, tree initialization and semantic segmentation units, multi-granularity summarization generation units, and relation enhancement and index construction units, ultimately outputting a structured knowledge base. This knowledge base contains a knowledge tree. Enhanced Relationship Diagram (i.e., knowledge graph G) and composite index .in,

[0040] V represents the set of nodes in the complete knowledge tree T; E represents the inherent parent-child boundary set of the tree; Representation: Supplementary relation edge set, including reference relation edges, directed relation edges, and semantically related relation edges (undirected, with weights).

[0041] The online search enhancement generation service module is deployed on the application server. When a user submits a query through the client, the query processing engine calls the knowledge base index for initial retrieval, then performs structured expansion in the knowledge base through the graph traversal and context assembly engine to form high-quality prompt context. Finally, the large language model inference engine generates the answer, and the answer and its source are returned to the user through the source tracing and output module.

[0042] The two modules interact with each other through a shared structured knowledge base.

[0043] Following one embodiment of the present invention, a detailed process for constructing a knowledge base based on a tree structure is provided, as follows: Figure 2 As shown, the steps include: Step S1: Document parsing and hierarchy tree initialization. The input domain document is parsed to extract text content and formatting information. Based on the formatting information, the document's heading hierarchy structure is identified, and the heading hierarchy mapping function is used... Convert the headings into tree node levels And the initial original document tree is constructed using the title node as the skeleton. , among which, nodes At least include node identifiers hierarchical Title text Belongs to the main text content and parent and child node reference information; Preferably, based on the title level mapping function Convert the headings into tree node levels Specifically, this includes: based on the title format feature vector The title hierarchy mapping function is obtained through predefined or adaptively learned title hierarchy mapping rules. Map titles to tree node levels ,in The smaller the value, the higher the level (e.g.) Indicates a chapter-level heading. (This represents a section-level heading, and so on). The mapping rules... The determination is based on a comprehensive assessment of one or more formatting features, including font, font size, bolding, numbering mode, indentation, and alignment.

[0044] As mentioned earlier, the heading level mapping function These are custom logical mapping rules designed to parse document structure. They are defined as follows:

[0045] in: This represents the title format feature vector extracted from the document parser. ; This represents the title's level in the document tree, and is a positive integer (1, 2, 3, ...). For example, feature vector The constituent elements (including, but not limited to, the following):

[0046] Example of mapping rules (not exhaustive, can be configured according to specific document types):

[0047] Function properties: It is a heuristic rule function, a non-differentiable mathematical model. The mapping rules can be predefined (based on common document templates) or adaptively learned (based on format statistics of multiple documents from the same source). Output value It is discrete, and This means that the child node's level value is greater than that of the parent node.

[0048] Step S2: Semantic segmentation and leaf node generation, traversing the original document tree. For each end node in the text, its long text content is... Divide into a set of semantically independent text fragments ; for each text fragment Create a new leaf node and the original document tree The corresponding node As its parent node, it forms the basic knowledge tree. ; In a tree data structure, a terminal node is a node with no child nodes, i.e., a node with a degree of 0. In the technical solution of this invention, a terminal node specifically refers to: Original document tree In this context, there are nodes that contain only the main text and no subheadings. Basic Knowledge Tree In the process, the leaf nodes λ generated through semantic segmentation are the smallest granular knowledge units and no longer contain any child nodes.

[0049] Step S3: Bottom-up multi-granularity summary generation, from the aforementioned basic knowledge tree Starting from all leaf nodes, recursively generate a summary representing the content of its subtree for each internal node; for any internal node... Let its direct child node set be Then its abstract Digest generation function The summary generated by aggregating its child nodes is expressed as follows:

[0050] in, This represents a text sequence concatenation operation; for leaf nodes... its abstract Its content text Or its simplified representation; This process yields a complete knowledge tree where each node is accompanied by a summary. ; As mentioned earlier, an internal node is a non-leaf node, meaning a node that has at least one child node. In step S3, the digest generation function... The process is recursively applied to each internal node to generate a summary for it.

[0051] Every node: refers to all nodes in the knowledge tree T, including leaf nodes and internal nodes. The final result of step S3 is that each node has a summary attached. For leaf nodes, their summary Summ(λ) is either the content itself or a simplified version of it; For internal nodes, their summary Summ(u) is generated by the summary generation function. It is generated by aggregating the summaries of its child nodes.

[0052] Containment relationship: internal nodes All nodes. Internal nodes are "objects for which summaries are generated", and "each node has a summary" is the final state.

[0053] Step S4: Enhance cross-node relationships in the complete knowledge tree The inherent father-son relationship edge set In addition, construct a supplementary relation edge set. To form an enhanced knowledge graph The supplementary relation edge set include: Cross-reference edges: Directed edges established between source and target nodes by parsing explicit cross-reference markers in the node text; Semantic relevance edges: These edges are formed by calculating the similarity of semantic vectors between nodes, and then identifying nodes where the similarity exceeds a preset threshold. Undirected edges are established between pairs of nodes; Step S5: Structured indexing and persistence, storing the complete knowledge tree. and the enhanced knowledge graph The structured data is persistently stored; simultaneously, a searchable index is built for each node in the knowledge base, the index including at least: a text representation based on the node as a whole. vector index and inverted indexes based on text keywords Vector index and inverted index Both are composite indexes. .

[0054] Preferably, in step S2, the segmentation of long text content into semantically independent text segments is achieved using a semantic segmentation model based on text embedding. This model determines the segment boundaries by judging whether the cosine similarity of the embedding vectors between sentences is lower than a dynamic threshold.

[0055] Preferably, in step S3, the summary generation function Specifically, it is a sequence-to-sequence generation model based on the Transformer architecture, which encodes the input concatenated child node summary through an encoder and then generates the condensed summary text of the parent node through a decoder.

[0056] Preferably, during the model training phase, the summary generation function The optimization objective is to minimize the parent node summary it generates. Standard abstracts manually extracted from corresponding chapters of the original document Negative log-likelihood loss between , expressed as:

[0057] in, It is a standard summary The first in One word, This is the total word count of the abstract. It is the conditional probability predicted by the model.

[0058] Preferably, in step S4, the establishment of the semantically related edge specifically involves: for any two nodes Calculate its overall text representation and Embedded vector And calculate the cosine similarity. ;like Then in and Establish a weight between them The undirected edge.

[0059] Preferably, before step S5, step S4a is included: problem-node association enhancement. This applies to the complete knowledge tree. Selected node in Using a problem generation model Based on its text representation Generate a set of related questions and will The text representation is stored as an enhanced attribute of the node. It is composed of node title, summary and content: .

[0060] Preferably, the vector index constructed in step S5 has index objects that not only include the text representation of the nodes but also include each problem text in the associated problem set thereof. .

[0061] Preferably, the method further includes a dynamic update step: when it is detected that the domain document has changed, locate the affected node subtrees in the complete knowledge tree , update the content and summary of the nodes in , and recalculate the supplementary relationship edges associated with the nodes in and the corresponding entries in the vector index to achieve incremental update of the knowledge base. and the vector index .

[0062] According to the construction method of the above embodiments, the present invention provides a tree-structured knowledge base constructed based on the above method, which includes: a tree-shaped data structure representing the complete hierarchy and multi-granularity summary of the document ; a graph data structure recording the reference and semantic correlation relationships between nodes ; a composite index system that supports rapid retrieval of nodes based on semantics and keywords .

[0063] In another embodiment of the present invention, taking a document of "Technical Specifications for Natural Resources Survey and Monitoring" as an example, the specific steps of the above tree-structured knowledge base construction method are illustrated, and a complete conversion process from the original document to the structured knowledge base is given, including key links such as document parsing, tree construction, semantic segmentation, summary generation, relationship enhancement, and index construction. Specifically as follows: Step S1: Document parsing and hierarchical tree initialization.

[0064] The document parser uses a technology combining OCR and format parsing to process the input PDF document. Suppose a recognized title text is "5.2 Field Survey and Evidence Submission Requirements", and its format features include: font is "boldface", font size is "No. 4", and paragraph number is "5.2". Through a predefined mapping function , its level is determined (assuming that "Chapter 5" is ). The system creates a node , and its attributes are: : N00502, : 2, : "5.2 Requirements for Evidence Collection in Field Investigations" "During field investigations, suspected altered map features must be verified on-site. Evidence should include... (details follow)." Through recursive processing, an original document tree with chapters, sections, and clauses as its framework is constructed. Nodes are linked through parent and child pointers.

[0065] Step S2: Semantic segmentation and leaf node generation.

[0066] Figure 3 is a detailed schematic diagram of the semantic segmentation and leaf node generation steps. This figure shows how an end node (containing long text content) in the original document tree is transformed into multiple leaf nodes with independent semantics through a semantic segmentation model, thereby enriching the granularity of the knowledge tree.

[0067] As shown in Figure 3, the focus is on node N00502. This is a long text containing multiple requirements. A semantic segmentation model processes this paragraph, calculating the cosine similarity between adjacent sentences based on sentence embeddings (such as using Sentence-BERT). When the mean similarity between consecutive sentences falls below a dynamic threshold... (For example When ), it is considered a semantic paragraph boundary. Assuming this method will... It is divided into three semantically independent segments: .

[0068] The system then creates three leaf nodes:

[0069]

[0070]

[0071] The children property of node N00502 is updated to This process, executed on all terminal nodes, yields a richly detailed foundational knowledge tree. .

[0072] Step S3: Bottom-up multi-granularity summary generation.

[0073] Figure 4 is a schematic diagram of the bottom-up summary generation process. Taking a small subtree as an example, the figure shows how to recursively generate summaries for parent nodes starting from the content of leaf nodes, ultimately forming a knowledge representation covering multiple granular levels.

[0074] As shown in Figure 4, the summary generation process is recursive. First, for the leaf nodes... its initial summary Its content can be used directly (or with slight compression). For example,

[0075] Then, a summary is generated for the internal nodes. Taking node N00502 as an example, the summaries for its child nodes are already ready. Summary generation model (For example, a fine-tuned BART or T5 model) takes as input a concatenation of child node summaries:

[0076]

[0077]

[0078] Summary of model output node N00502:

[0079] Recursively recursively to the root node, ultimately forming a complete knowledge tree with multi-level summaries ranging from details to overviews. .

[0080] Step S4: Cross-node relationship enhancement. Relationship enhancement consists of two parts: 1. Reference Relationships: Parse node text and identify patterns such as "See Appendix C" and "Based on clause 3.1". For example, in leaf nodes... The text identifies the phrase "...the process refers to Article 4 of the Safety Specification". The system searches the knowledge base for a node whose title matches "Article 4 of the Safety Specification" (let's assume it's `N_Safe04`), and creates a record from... A directed reference edge pointing to `N_Safe04`.

[0081] 2. Semantic Relevance: A comprehensive representation for each node is provided using a text embedding model (such as `text-embedding-ada-002`). (title + summary + content) generates a vector Calculate the cosine similarity between all node pairs. Set a threshold If a similarity is found between node N00502 (regarding "evidence submission") and another node N00301 (regarding "internal review"). If the two are undirected and correlated, then an undirected edge with a weight of 0.85 is established between them.

[0082] All such additional edges constitute the complementary relation edge set. , and the side of the tree After merging, an enhanced knowledge graph is obtained. .

[0083] Step S5: Structured indexing and persistence.

[0084] Knowledge Tree and knowledge graph Store in a graph database (such as Neo4j) or a custom serialization format. Build two types of indexes simultaneously: Vector index : Vectors of all nodes Store the data in a vector database (such as Milvus) to create a fast similarity retrieval index.

[0085] Keyword Inverted Index For each node's title and content, perform word segmentation, remove stop words, extract keywords, and establish a mapping between "keywords and node ID list".

[0086] At this point, a structured knowledge base that supports complex queries has been built.

[0087] Another embodiment of the present invention provides a method for using the above-mentioned tree-structured knowledge base, namely, a detailed process of the retrieval enhancement generation method based on the above-mentioned tree-structured knowledge base. Referring to Figure 5, it shows a complete online service process from receiving user queries to performing contextual retrieval and expansion using knowledge trees and graphs, and then to multi-granularity information assembly, answer generation, and source tracing. It includes the following steps: Step R1: Query parsing and preliminary retrieval. Receive user queries. Using the composite index system Retrieve the initial set of candidate nodes most relevant to the query. ; Step R2: Structured context expansion. Starting from each node in the tree data structure Graph data structures Perform multi-path traversal expansion to obtain the complete set of related context nodes. The traversal expansion strategy includes: obtaining ancestor nodes upwards along the tree edges to provide background, obtaining descendant nodes downwards to provide details, and obtaining references and related nodes along the graph's relational edges to provide supplementary information. Preferably, in step R2, the multi-path traversal expansion adopts a graph search algorithm based on heuristic cost, wherein the cost weights for expanding from the current node to its parent node, child node, referencing node and related node are different, so as to prioritize obtaining the logically most closely related context.

[0088] Step R3: Multi-granularity context assembly and answer generation. Based on the query... The results of the intent analysis, from Then, node information of different granularities is selected for assembly: for macroscopic purposes, summaries of high-level nodes are mainly selected. For micro-level objectives, the content of leaf nodes should be selected. ; The selected information will be arranged according to its position in the tree The logical order within is used to sort and combine information into a structured prompt context. and combine it with the original query Inputting into a large language model Generate the final answer ; Step R4: Answer tracing and output. Record the generated answer. The context on which the process depends The set of source node identifiers corresponding to each part of the middle and the answer With traceability information Output them together.

[0089] Based on the above-described search enhancement generation method, another embodiment of the present invention simulates a user query scenario to demonstrate the online service process, as follows: Step R1: Query parsing and preliminary retrieval.

[0090] User input query "What should be done about providing evidence if bad weather prevents filming during fieldwork?"

[0091] The query processing engine first... Vectorization In vector index The search is performed, returning the Top-K (e.g., K=5) similar nodes. Simultaneously, keywords "bad weather," "unable to take photos," and "evidence" are extracted and added to the inverted index. Searching in the middle. Combining the two, we obtain the initial set of candidate nodes. Highly relevant nodes may include: ("Special Circumstances Handling Procedure"), N_Safe04 (Referenced Safety Specification).

[0092] Step R2: Structured Context Extension.

[0093] Figure 6 is a detailed schematic diagram of the structured context expansion steps. Taking a candidate node as an example, it illustrates how to perform upward (ancestor), downward (descendant), and traversal along relational edges (references, relatedness) on the knowledge tree T and relation graph G to aggregate and form a complete set of related context nodes. As shown in Figure 6, taking a candidate node... Starting with N_Safe04, perform a multi-path traversal: Traverse upwards (get background): from Find its parent node N00502 (“5.2 Field Investigation Evidence Requirements”), and then find “Chapter 5 Field Investigation”. This provides the institutional background of the problem.

[0094] Traverse downwards (to get details): It's already a leaf node with no child nodes. N_Safe04 may have lower-level terms; continue retrieving them.

[0095] Relationship edge traversal (obtaining associations): along The reference edge found N_Safe04 (already considered as a candidate). At the same time, the system found that N00502 has a related edge connecting to N00301 ("Supplementary Notes for In-house Audit"), and N00301 is also taken into consideration because it may contain alternative audit methods when fieldwork is not possible.

[0096] This guided graph traversal yields a complete set of relevant context nodes that cover background, details, and association specifications. .

[0097] Step R3: Multi-granularity context assembly and answer generation.

[0098] analyze This refers to the specific operational intent (microscopic). Therefore, in the assembly context... hour: Preferred Middle leaf node The detailed content of (such as child nodes of N_Safe04) serves as the core basis.

[0099] The summary of its parent node (N00502) serves as the main idea of ​​the paragraph.

[0100] Arranged in logical order: "According to Chapter 5 (Background) of the Technical Specifications, Section 5.2 stipulates (Main Point): [Insert]" [Detailed content]. Meanwhile, Article 4 of the relevant "Safety Specifications" requires: [Insert detailed content of N_Safe04]. Furthermore, the internal review process may consider: [Insert relevant content of N00301]".

[0101] Arranged and Input large language model (e.g., GPT-5) to generate structured, well-defined answers. .

[0102] Step R4: Answer tracing and output.

[0103] When generating answers, the system prompts the model to annotate source citations in the answers, or aligns the answer sentences with context fragments during post-processing. The system automatically records the set of source node IDs upon which the answer is based. The final output not only includes the text answer, but also allows users to interact with the front end to click and view the original text corresponding to any statement in the answer (from...). (Nodes such as N_Safe04) enable precise traceability.

[0104] The detailed description of the above embodiments fully illustrates the entire process of this invention, from knowledge structuring to intelligent retrieval and application.

[0105] Those skilled in the art will understand that modifications and variations can be made to the specific implementations of the above methods and systems without departing from the principles of the present invention. All such modifications and variations should fall within the scope of protection defined by the claims of this invention.

[0106] Compared with the shortcomings of the prior art detailed in the background section, the tree-structure-based knowledge base construction and retrieval enhancement generation and usage scheme provided by this invention, through its innovative technical approach, brings the following significant and directly corresponding beneficial effects: 1. Improvements to address the issues of "loss of structural information and semantic fragmentation": The input obtained by the large language model maintains the logic and coherence of the original knowledge, thereby significantly improving the accuracy, professionalism, and logical consistency of the generated answers, and effectively avoiding misinterpretation or logical contradictions caused by contextual fragmentation.

[0107] 2. Improvements to address the issue of "mismatch between retrieval granularity and intent": Improved retrieval accuracy and efficiency, reduced the burden on large language models to process redundant information, and enabled the generated answers to be both insightful and to the point.

[0108] 3. Improvements to address the "weak knowledge traceability and interpretability issues": Transforming the system's "black box" characteristics into a "glass box" greatly enhances the interpretability, transparency, and user trust of the output, enabling it to meet the high credibility requirements of application scenarios such as the judiciary, auditing, and healthcare.

[0109] 4. The improvement addresses the issue of "the lack of full utilization of the inherent connections between knowledge," breaking through the limitations of traditional vector retrieval that relies solely on surface semantic similarity, and endowing the system with deeper domain cognition and reasoning capabilities.

[0110] 5. Improvements to address the "cumbersome and inefficient knowledge base update and maintenance problem": This enables the knowledge base to maintain its timeliness at a lower cost and with a faster response time, thereby better adapting to the rapidly evolving knowledge environment in vertical domains.

[0111] In summary, this invention is not a simple optimization of existing technologies, but rather a systematic innovation across the entire knowledge chain, from knowledge representation and indexing to retrieval and generation, by introducing a core organizational paradigm of "tree structure." It addresses the pain points identified in the background section, delivering substantial and verifiable performance improvements in five key dimensions: accuracy, precision, interpretability, reasoning ability, and update efficiency. This provides a solid technical foundation for highly reliable intelligent applications in vertical industries.

[0112] Please note that the technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. The above embodiments only illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be pointed out that for those skilled in the art, several modifications and improvements can be made without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for constructing a knowledge base based on a tree structure, characterized in that, The method includes: Step S1: Document parsing and hierarchy tree initialization. The input document is parsed to extract text content and formatting information. Based on the formatting information, the document's title hierarchy structure is identified, and the titles are converted into tree node levels. And the initial original document tree is constructed using the title node as the skeleton. ; Step S2: Semantic segmentation and leaf node generation, traversing the original document tree. For each terminal node in the document tree, its long text content is divided into a set of semantically independent text fragments. A new leaf node is created for each text fragment, and the corresponding node in the original document tree is used as its parent node, thus forming a basic knowledge tree. ; Step S3: Bottom-up multi-granularity summary generation, from the aforementioned basic knowledge tree Starting from all leaf nodes, recursively generate summaries representing the content of their subtrees for each internal node, resulting in a complete knowledge tree with a summary attached to each node. ; Step S4: Enhance cross-node relationships in the complete knowledge tree The inherent father-son relationship edge set In addition, construct a supplementary relation edge set. To form an enhanced knowledge graph ; Step S5: Structured indexing and persistence, storing the complete knowledge tree. and the enhanced knowledge graph The structured data is persistently stored; a searchable index is built for each node in the knowledge base.

2. The method according to claim 1, characterized in that, In step S1, an initial original document tree is constructed using the header node as its skeleton. include: The initial original document tree is constructed using the title node as its skeleton. , among which, nodes At least include node identifiers hierarchical Title text Belongs to the main text content And parent node and child node reference information.

3. The method according to claim 1, characterized in that, In step S2, the long text content is divided into a set of semantically independent text fragments. A new leaf node is created for each text fragment, and the corresponding node in the original document tree is used as its parent node to form a basic knowledge tree. include: Its long text content Divide into a set of semantically independent text fragments ; for each text fragment Create a new leaf node and the original document tree The corresponding node As its parent node, it forms the basic knowledge tree. .

4. The method according to claim 1, characterized in that, In step S3, a summary representing the content of its subtree is recursively generated upwards for each internal node, so that each node has a complete knowledge tree with a summary attached. Specifically, it includes: Recursively generate a summary representing the content of its subtree for each internal node; for any internal node... Let its direct child node set be Then its abstract Digest generation function The summary generated by aggregating its child nodes is expressed as follows: ;in, This represents a text sequence concatenation operation; for leaf nodes... its abstract Its content text Or its simplified representation; This process yields a complete knowledge tree where each node is accompanied by a summary. .

5. The method according to claim 4, characterized in that, In step 3, The summary generation function It is a sequence-to-sequence generation model based on the Transformer architecture. It encodes the input concatenated child node summary through an encoder and then generates the condensed summary text of the parent node through a decoder. During the model training phase, the summary generation function The optimization objective is to minimize the parent node summary it generates. Standard abstracts manually extracted from corresponding chapters of the original document Negative log-likelihood loss between , expressed as: ; in, It is a standard summary The first in One word, This is the total word count of the abstract. It is the conditional probability predicted by the model.

6. The method according to claim 1, characterized in that, In step S4, the supplementary relation edge set include: Cross-reference edges: Directed edges established between source and target nodes by parsing explicit cross-reference markers in the node text; Semantic relevance edges: These edges are formed by calculating the similarity of semantic vectors between nodes, and then identifying nodes where the similarity exceeds a preset threshold. Undirected edges are established between node pairs.

7. The method according to claim 6, characterized in that, In step 4, the establishment of the semantically related edge specifically includes: for any two nodes Calculate its overall text representation and Embedded vector And calculate the cosine similarity. ;like Then in and Establish a weight between them The undirected edge.

8. The method according to claim 1, characterized in that, In step S5, the index includes: a node-based overall text representation. vector index and inverted index based on text keywords .

9. A tree-structured knowledge base, comprising a knowledge base construction module and a retrieval enhancement generation module, characterized in that, The knowledge base is constructed using the method described in any one of claims 1 to 8.

10. A method of using a knowledge base as described in claim 9, characterized in that... Includes the following steps: Step R1: Query parsing and preliminary retrieval, receiving user queries. Retrieve the initial set of candidate nodes most relevant to the query. ; Step R2: Structured context extension, to Starting from each node in the tree data structure and graph data structure, a multi-path traversal expansion is performed. The traversal expansion strategy includes: obtaining ancestor nodes upwards along the tree edges to provide background, obtaining descendant nodes downwards to provide details, and obtaining references and related nodes along the graph relationship edges to provide supplementary information. Step R3: Multi-granularity context assembly and answer generation. Based on the user query intent analysis results, select node information of different granularities for assembly: if it is a macro-level intent, select the summary of high-level nodes; if it is a micro-level intent, select the content of leaf nodes; and then assemble the selected information according to its position in the complete knowledge tree. The logical order of the text is sorted and combined into a structured prompt context, which is then input into a large language model along with the original user query to generate the final answer; Step R4: Answer tracing and output. Record the set of source node identifiers corresponding to each part of the context on which the answer is generated and output the answer and tracing information together.