Method and system for intelligent slicing and association of multi-level documents driven by structural semantics

By constructing a document structure tree and an adaptive gating fusion mechanism, slice representation vectors with both semantic and structural information are generated, solving the problems of structural loss and ambiguous attribution in long document processing, and achieving efficient cross-document knowledge association and retrieval accuracy.

CN121808046BActive Publication Date: 2026-06-19INFORMATION SCI RES INST OF CETC

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INFORMATION SCI RES INST OF CETC
Filing Date
2026-03-10
Publication Date
2026-06-19

Smart Images

  • Figure CN121808046B_ABST
    Figure CN121808046B_ABST
Patent Text Reader

Abstract

This invention discloses a multi-level intelligent document slicing and association method and system driven by both structural and semantic factors, belonging to the field of data processing technology. The method first automatically constructs a document structure tree containing parent-child nesting relationships by jointly analyzing the document's format layout features and textual semantic features. It then traverses the document structure tree to generate document slices on a node-by-node basis, generating unique hierarchical path codes based on node positions. Subsequently, it generates semantic vectors for each slice in parallel, and maps the hierarchical path codes to structured position vectors using a neural network. Finally, it calculates fusion weights using an adaptive gating fusion mechanism, deeply fusing the semantic vectors and structured position vectors to obtain the final representation vector. This invention effectively solves the problems of structural parsing distortion, ambiguous attribution of title slices with the same name, and broken associations in existing technologies when processing long documents, significantly improving retrieval precision and the efficiency of large model applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer data processing technology, and in particular to a method and system for intelligent slicing and association of multi-level documents driven by both structural and semantic factors. Background Technology

[0002] With the deepening of digital transformation, the financial, legal, and industrial sectors have accumulated massive amounts of structured and semi-structured long documents (such as prospectuses, laws and regulations, and technical manuals). In order to leverage Large Language Models (LLMs) to extract value from these documents, a Retrieval Augmentation Generation (RAG) architecture is typically adopted. Its core preliminary step is to cut long documents into semantically coherent segments (chunks) and convert them into vectors to be stored in a database for retrieval.

[0003] Existing document slicing techniques mainly include rule-based slicing (such as slicing by character count or punctuation) and semantic-based slicing (such as using models to detect semantic transitions). Currently, the closest existing technology to this invention typically employs a combined strategy of "adaptive slicing based on heading level" and "semantic transition-based segmentation." This type of existing technology usually includes the following steps: first, preliminary physical slicing is performed based on the document's explicit headings (such as first-level headings and second-level headings); then, the number of slices is determined by calculating the information density of the text (such as TF-IDF weights) or the degree of topic variability (such as Jensen-Shannon divergence); finally, the slice boundaries are fine-tuned using a large language model to ensure semantic coherence, and the final slices are semantically vectorized from plain text.

[0004] However, the aforementioned existing technologies have significant drawbacks when processing long documents with deep nested hierarchies and complex logical structures:

[0005] First, there is distortion in structural parsing and loss of context. Existing technologies often treat documents as a flat text stream or only utilize shallow heading rules, failing to construct a complete logical structure tree of the document. This results in the inability to capture deep parent-child nesting relationships between headings. Once slices are generated, they become isolated text blocks, losing their hierarchical path information in the original document (such as "Chapter 1 - Section 2 - Technical Solution"), making the search results lack structured contextual support.

[0006] Second, there is ambiguity in subheading and search results. In practical applications, the same subheadings often appear in different chapters (for example, "Overview" and "Working Principle" may appear repeatedly in multiple chapters). Because the vectorization process of existing technologies only extracts the semantic features of the text content and does not incorporate structural positional information, subheadings with the same name in different locations highly overlap in the vector space. When users perform searches, the system cannot distinguish the true affiliation of these subheadings, resulting in confusing search results and a decrease in precision.

[0007] Third, cross-document knowledge connections are broken. Due to the lack of a unified structured reference system and semantic anchors that can summarize the main idea of ​​a chapter, existing technologies struggle to achieve accurate alignment and association of similar knowledge fragments between different documents, limiting the depth of application of multi-document joint analysis and knowledge fusion.

[0008] In summary, how to achieve deep integration of document structural information and content semantic information, and construct a slice representation that combines content recognition and location differentiation, is a technical challenge that urgently needs to be solved in the field of intelligent document processing. Summary of the Invention

[0009] The present invention aims to provide a method and system for intelligent slicing and association of multi-level documents driven by both structural and semantic factors, in order to overcome the shortcomings of the existing technology. The technical problem to be solved by the present invention is achieved through the following technical solutions.

[0010] The first aspect of this invention provides a multi-level document intelligent slicing and association method driven by both structural and semantic factors, comprising the following steps:

[0011] Step S1: Obtain the target document to be processed, and construct a document structure tree containing parent-child nesting relationships by jointly analyzing the document's format layout features and text semantic features;

[0012] Step S2: Traverse the document structure tree, generate document slices in units of tree nodes, and generate a unique hierarchical path code for each document slice based on the position of the tree node in the document structure tree;

[0013] Step S3: Encode the document slices into semantic vectors, and map the hierarchical path encoding into structured position vectors with the same dimension as the semantic vectors;

[0014] Step S4: Using a preset adaptive gating fusion mechanism, calculate the fusion weight of the semantic vector and the structured position vector, and fuse the two based on the fusion weight to obtain the final representation vector of the document slice, and establish a document index library based on the final representation vector.

[0015] In a preferred embodiment, the specific steps of constructing the document structure tree in step S1 include: extracting multimodal features of text blocks in the document using a pre-trained document understanding model, wherein the multimodal features include at least: text sequence, bounding box coordinates, font attributes, and indentation distance; identifying the node types of the text blocks using a classification model, wherein the node types include title nodes and body nodes; predicting the parent-child nesting relationship between title nodes using a graph neural network based on the visual layout features and semantic context features of the text blocks; and constructing the document structure tree with the document as the root node, title nodes as intermediate nodes, and body nodes as leaf nodes.

[0016] In a preferred embodiment, the specific rule for generating the hierarchical path code in step S2 is as follows: starting from the root node of the document structure tree, record the sequence numbers of all title nodes passed along the path to reach the node where the current slice is located; concatenate the sequence numbers in hierarchical order to generate an encoded string that uniquely identifies the logical position of the document slice.

[0017] In a preferred embodiment, step S3, mapping the hierarchical path encoding to a structured position vector, specifically includes: converting the hierarchical path encoding into an integer sequence; inputting the integer sequence into a preset multilayer perceptron model for feature mapping, and outputting the structured position vector; the output dimension of the multilayer perceptron model is configured to be consistent with the dimension of the semantic vector.

[0018] In a preferred embodiment, the final representation vector is obtained in step S4 using a preset adaptive gating fusion mechanism, and the specific calculation formula is as follows:

[0019] 3.

[0020] 4.

[0021] in, For the semantic vector, For the structured position vector, To integrate weighted gating values, This represents a vector concatenation operation. and For learnable parameters, It is the Sigmoid activation function. For element-wise multiplication, This is the final representation vector.

[0022] In a preferred embodiment, the method further includes the step of constructing semantic anchors for the title chain: extracting non-leaf nodes from the document structure tree, obtaining the title text of the non-leaf nodes and all the slice content under them; using a large language model to generate a summary of the non-leaf nodes to obtain a generalized semantic description, which serves as the semantic anchor; and establishing a mapping relationship library containing hierarchical path encoding, title text, and the semantic anchor.

[0023] In a preferred embodiment, the method further includes a retrieval disambiguation step: when a retrieval request is received and multiple similar slices are recalled, it is determined whether there are similar slices with the same title text but different hierarchical path codes; if so, the semantic anchor point and parent title information corresponding to the similar slice are retrieved from the mapping relationship library and output together with the similar slice to distinguish slice affiliation.

[0024] A second aspect of the present invention provides a multi-level document intelligent slicing and association system driven by both structural and semantic factors, comprising:

[0025] The structure tree construction module is used to obtain the target document to be processed and construct a document structure tree containing parent-child nesting relationships by jointly analyzing the document's format layout features and text semantic features.

[0026] The slicing and encoding module is used to traverse the document structure tree, generate document slices in units of tree nodes, and generate a unique hierarchical path code for each document slice based on the position of the tree node in the document structure tree.

[0027] The vector generation module is used to perform text encoding on the document slices to obtain semantic vectors, and to map the hierarchical path encoding into structured position vectors with the same dimension as the semantic vectors;

[0028] The vector fusion module is used to calculate the fusion weight of the semantic vector and the structured position vector using a preset adaptive gating fusion mechanism, and fuse the two based on the fusion weight to obtain the final representation vector of the document slice. A document index library is established based on the final representation vector for subsequent document retrieval or association analysis.

[0029] A third aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the above-described method when executing the program.

[0030] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements the above-described method.

[0031] Compared with the prior art, the present invention has the following significant advantages:

[0032] 1. This invention significantly improves the accuracy of structural parsing for complex and long documents, laying the foundation for high-quality document slicing. Existing technologies typically rely on shallow rules such as regular expressions or font size for segmentation, which are prone to failure for documents with irregular formatting or deep nesting. This invention employs multimodal joint parsing technology, comprehensively utilizing "visual layout features" (such as indentation and bounding boxes) and "textual semantic features" to accurately identify the parent-child nesting relationship between titles and their subordinate content, automatically reconstructing a high-fidelity document structure tree. This avoids slicing logic confusion caused by structural parsing distortion, ensuring that subsequent processing steps are based on the correct document skeleton.

[0033] 2. This invention completely resolves the issue of ambiguous attribution of title segments with the same name, significantly improving retrieval precision. Addressing the shortcomings of existing technologies that treat documents as flat text streams and extract only content semantic vectors, thus failing to distinguish between identical titles (such as "Overview" or "Technical Solution" appearing in multiple places) across different chapters, this invention innovatively proposes "hierarchical path encoding" and "structured position vectors." By designing a "position-semantic adaptive gating fusion mechanism," this invention ensures that the final segment representation vector simultaneously contains both "content semantics" and "precise structural position information." When processing documents containing numerous repeated titles (such as regulations and tenders), this invention can clearly distinguish content-similar segments based on positional differences, demonstrating a significant advantage in Top-1 retrieval accuracy.

[0034] 3. Accurate knowledge association and disambiguation across documents and levels are achieved. This invention constructs a "semantic anchor library" based on title chains, using a large language model to generate summary summaries for high-level titles. This mechanism not only provides rich context ("slice + parent summary + hierarchical path") during retrieval, greatly enhancing the interpretability of the results; but also, using semantic anchors as a hub, breaks down the isolation between documents, supporting automatic alignment and association of similar knowledge fragments between different documents (even if their underlying slice text is different, but their chapter themes are similar), providing powerful support for multi-document joint analysis.

[0035] 4. Enhanced performance and adaptability for downstream large-scale model applications (such as RAG). Compared to the isolated and fragmented text blocks generated by existing technologies, the slices output by this invention have uniform granularity, complete semantics, and carry clear contextual paths (such as "root node - first-level heading - second-level heading - current slice"). This structured input enables large language models to accurately understand the background and scope of application of segments when performing Retrieval Enhancement Generation (RAG) or question answering, thereby reducing "illusion" generation and improving the overall question answering quality and logical coherence of the system.

[0036] 5. It avoids dimensional redundancy and representation degradation caused by simple concatenation. Compared with alternatives that simply concatenate positional encoding and semantic vectors, the adaptive gating fusion mechanism of this invention not only controls the vector dimension and reduces storage and computational overhead, but more importantly, it realizes deep interaction between structural and semantic information at the feature level. This allows the model to dynamically adjust the weights of both based on content characteristics, thereby obtaining higher quality and more discriminative feature representations. Attached Figure Description

[0037] Figure 1 This is an overall architecture diagram of an embodiment of the present invention;

[0038] Figure 2 This is a flowchart of the multi-level document intelligent slicing and association method driven by structural semantics according to an embodiment of the present invention;

[0039] Figure 3 This is a schematic diagram of the automatic reconstruction process of the document structure tree according to an embodiment of the present invention;

[0040] Figure 4 This is a schematic diagram comparing the results of traditional semantic slicing with the structured slicing results of this invention;

[0041] Figure 5 This is a detailed flowchart of the hierarchical path encoding generation, structured position vector mapping, and dual-vector fusion in an embodiment of the present invention;

[0042] Figure 6 This is a flowchart of the search result disambiguation and visualization process based on title chain semantic anchors;

[0043] Figure 7 This is a structural diagram of the multi-level document intelligent slicing and association system module driven by structural semantics according to an embodiment of the present invention;

[0044] Figure 8 This is a schematic diagram of the hardware structure of an electronic device suitable for implementing embodiments of the present invention. Detailed Implementation

[0045] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are merely 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 should fall within the scope of protection of the present invention.

[0046] Example 1

[0047] like Figure 1As shown, this embodiment provides a multi-level document intelligent slicing and association system architecture driven by both structural and semantic factors. The system is based on a layered architecture design, with each layer communicating and interacting through data interfaces. Logically, the system mainly includes a data and resource layer, a core processing layer, a storage layer, a service and interface layer, and an application layer.

[0048] 1. Data and Resource Layer

[0049] The data and resource layer, located at the bottom of the system architecture, provides data input and algorithm support. Specifically, the data and resource layer includes a multi-source document library and a basic model and algorithm library. The multi-source document library is used to access and store raw document data to be processed. The formats of the raw document data include, but are not limited to, PDF documents, Word documents, HTML web page data, scanned images (OCR pre-processing), and structured database records. This multi-source heterogeneous data enters the system through a pre-defined data cleaning interface. The basic model and algorithm library integrates various artificial intelligence model components required for the operation of this system. Preferably, the basic model and algorithm library includes: pre-trained document understanding models (e.g., the LayoutLM series) for document layout analysis, vectorized algorithm models (e.g., BGE-M3 or BERT) for text feature extraction, and large language models (LLM) for high-level semantic understanding. These models provide basic computing power support for upper-layer data processing.

[0050] 2. Core Processing Layer

[0051] The core processing layer, located above the data and resource layer, is the main execution unit of the offline data processing chain. The core processing layer is primarily configured to transform unstructured documents into vector indexes rich in structured information. Specifically, the core processing layer includes a document parsing and structure tree construction module, an intelligent slicing and vectorization module, and a semantic anchor and knowledge base construction module.

[0052] Document parsing and structure tree construction module: This module connects to the multi-source document library and is used to obtain the original document input. This module is configured to jointly extract the visual layout features (such as indentation, font, and borders) and textual semantic features of the document using multimodal parsing technology, and predict the parent-child relationships between nodes based on graph neural networks (GNN), thereby reconstructing a "document structure tree" containing complete parent-child nested relationships.

[0053] Intelligent Slicing and Vectorization Module: This module is connected to the document parsing and structure tree construction module and receives the document structure tree output by it. This module is configured to traverse the document structure tree to generate slices and generate a unique hierarchical path code for each slice. Furthermore, this module utilizes a preset "adaptive gating fusion mechanism" to calculate the semantic vector and structured position vector of each slice separately, and then performs a weighted fusion of the two to output a final slice representation vector that combines semantic content and structural position information.

[0054] Semantic Anchors and Knowledge Base Construction Module: This module enhances the relevance of data. It utilizes a large language model to generate summaries of non-leaf nodes in the document structure tree, constructs semantic anchors for title chains, and calculates hierarchical alignment relationships between different documents, thereby forming cross-document related knowledge.

[0055] 3. Storage layer

[0056] The storage layer is used for persistent storage of processed data and provides efficient retrieval services. Specifically, the storage layer includes a vector index library and a knowledge base. The vector index library is mainly used to store the final slice representation vectors output by the intelligent slicing and vectorization modules. This library is typically built on a vector database (Vector DB) and supports high-dimensional approximate nearest neighbor (ANN) retrieval for massive datasets. The knowledge base is used to store document metadata information, document structure tree objects, title chain semantic anchors, and cross-document hierarchical alignment relationships. This knowledge base provides structured context support for subsequent ambiguity resolution and knowledge graph construction.

[0057] 4. Service and Interface Layer

[0058] The service and interface layer, located above the storage layer, serves as the system's external service window and encapsulates core algorithm capabilities. Specifically, the service and interface layer includes an intelligent retrieval and matching service module, an ambiguity detection and interpretation service module, a cross-document association service module, and a result visualization service module.

[0059] Intelligent retrieval and matching service module: used to respond to external query requests, vectorize the query statement and then retrieve it from the vector index library.

[0060] The ambiguity detection and explanation service module is configured to detect the existence of title slices with the same name in the search results. If they exist, it automatically uses semantic anchor information from the knowledge base to assist in disambiguation and generates explanatory descriptions.

[0061] Cross-document association service module: used to discover and output cross-document knowledge associations based on dual thresholds (vector similarity and anchor similarity).

[0062] Results visualization service module: used to encapsulate the retrieved slice data into a structured data package containing "hierarchical path + parent summary + slice text" for front-end display.

[0063] 5. Application Layer

[0064] The application layer resides at the top of the system architecture, directly facing end users or downstream business systems. Specifically, the application layer includes intelligent question-answering systems (such as the RAG chatbot), compliance document review systems, knowledge base construction and management platforms, and cross-document research and analysis tools. This layer implements functionalities for specific business scenarios by calling standard interfaces from the service and interface layer.

[0065] This embodiment achieves the transformation from multi-source heterogeneous documents to high-value structured knowledge through the collaborative work of a five-layer architecture. In particular, the gating fusion mechanism in the core processing layer and the dual-database design in the storage layer effectively solve the technical problems of structure loss and association breakage in the prior art.

[0066] Example 2

[0067] This embodiment is described in detail as follows: Figure 2 The processing flow shown includes the following steps:

[0068] Step S1: Multimodal joint parsing and document structure tree construction. Obtain the target document to be processed, and construct a document structure tree containing parent-child nesting relationships by jointly analyzing the document's format layout features and text semantic features.

[0069] When processing long documents (such as prospectuses, technical standards, and laws and regulations), accurately reconstructing the document's "skeleton" is a prerequisite for subsequent slicing without distortion. For example... Figure 3 As shown, this step specifically executes the following sub-steps: Multimodal feature extraction: The system receives the target document to be processed and calls a pre-trained document understanding model (such as LayoutLMv3 or a self-developed OCR engine). For each text block in the document, its multimodal features are extracted. This feature includes: Text features: the character sequence within the text block and its semantic embedding; Visual layout features: the bounding box coordinates of the text block on the page. This is used to determine its absolute position. Style features: font size, font weight, whether it is bold, color, etc. Typically, the font size of the title is significantly larger than the body text. Layout features: indentation distance, line spacing, numbering style (e.g., "1.1", "(a)", etc.). Node recognition and classification: Using a lightweight classification model (e.g., a binary classifier fine-tuned based on BERT), the above features are input. The system determines the node type for each text block. Node types mainly include: heading nodes (which can be further subdivided into first-level headings, second-level headings, etc.) and body text nodes (including paragraphs, tables, image captions, etc.). Noisy nodes such as headers, footers, and page numbers are filtered out. Parent-child relationship prediction (based on GNN): This is crucial for reconstructing the tree structure. Traditional methods relying solely on font size sorting are prone to errors (for example, the font size of an appendix title might be smaller than that of a first-level body text heading).

[0070] This embodiment constructs a fully connected graph or a K-nearest neighbor-based graph, treating all identified title nodes as graph nodes. Graph Neural Networks (GNNs), particularly Graph Attention Networks (GATs), are used to input the visual layout features and semantic context features of the nodes. The GNN model predicts whether a "parent-child" relationship exists between each pair of nodes. The prediction logic is as follows: the model learns implicit rules such as "nodes with larger font sizes and earlier positions are usually the parent nodes of nodes with smaller font sizes and later positions" and "titles with strong semantic generalization are the parent nodes of titles with detailed descriptions." Document structure tree generation: Based on the predicted parent-child relationships, a complete document structure tree is constructed, with the entire document as the root node, titles at each level as intermediate nodes, and the main text content as leaf nodes. Each node in the tree stores metadata: {node ID, title text, hierarchy depth, page position, and the main text content it governs}.

[0071] Step S2: Structured Slicing and Hierarchical Path Encoding. Traverse the document structure tree, generate document slices in units of tree nodes, and generate a unique hierarchical path code for each document slice based on the position of the tree node in the document structure tree;

[0072] Slice Generation: Traverse the document structure tree constructed in step S1. To ensure the semantic integrity of the slices, this embodiment preferably uses the leaf nodes of the tree as the basic slice unit. If the text under a certain leaf node is too long (e.g., exceeding 512 tokens), a sub-slice is performed, but all sub-slices share the same parent node information; if a certain leaf node is too short, it is merged with its sibling nodes. This slicing method strictly follows the logical boundaries when the author writes the document, avoiding abruptly cutting a complete paragraph in the middle. Hierarchical path encoding is one of the key innovations of this invention. For each generated document slice, the system generates a unique code based on its position in the structure tree. The encoding rule is to start from the root node, traverse downwards along the tree path, and record the "sibling number" of each title node passed through. For example, assuming a slice belongs to "Chapter 1 -> Section 2 -> Subsection 3", its path encoding string is Root-1-2-3. This code uniquely determines the coordinates of the slice in the entire document's logical space. Even if two slices contain exactly the same content (e.g., both are called "Technical Parameters"), their path encodings (e.g., Root-1-5 vs Root-3-2) will be completely different as long as they belong to different chapters.

[0073] Figure 4 This paper visually compares the process and effectiveness of traditional semantic slicing techniques with the structural semantic dual-driven slicing technique proposed in this invention when processing documents with the same title. In the traditional semantic slicing process, the system receives a document source containing "1 General Principles - 1.1 Definitions" and "2 Technical Requirements - 2.1 Definitions," and processes it through semantic similarity calculation and recursive merging. The slicing results generated by this method are flat plain text blocks; for example, slice 1 contains only the definition text under the General Principles, and slice 2 contains only the definition text under the Technical Requirements. Because these two slices are highly similar in text content (both involve "definitions"), their generated vector representations are also highly similar. During retrieval, the system cannot distinguish the chapters to which they belong, inevitably leading to confusion.

[0074] Figure 4 The lower half of the document illustrates the technical solution of this invention. This solution first constructs a document structure tree, clearly defining the parent-child nesting relationships of the root node (technical standard document), the first level (general principles, technical requirements), and the second level (various definitions and clauses), and generates a unique path code for each node (e.g., path 1.1, path 2.1). Subsequently, the system performs context-aware slicing along the structure tree nodes, resulting in "knowledge units" that are no longer isolated text blocks but rather carry rich metadata. For example, knowledge unit 1, in addition to containing the main text, is bound to the path code "1.1" and the parent semantic anchor "general terms in the general principles section"; knowledge unit 2 is bound to the path code "2.1" and the parent semantic anchor "specific terms in the technical requirements section".

[0075] This comparison clearly demonstrates the technical advantages of this invention. Compared to traditional methods, the knowledge units generated by this invention, by introducing "hierarchical path encoding" and "semantic anchor information," endow texts with similar content with clear structured coordinates and contextual semantics. This differentiated metadata allows two defined units to be clearly distinguished in the vector space, thereby completely resolving the retrieval ambiguity caused by titles with the same name and achieving accurate knowledge positioning and association.

[0076] Step S3: Dual Vectorization Mapping. The document slices are text-encoded to obtain semantic vectors, and the hierarchical path encoding is mapped to a structured position vector with the same dimension as the semantic vector.

[0077] To enable the neural network to process both content and structure simultaneously, this step performs parallel vectorization operations, such as... Figure 5 As shown: Semantic vector generation ( The input is the plain text content of the document slices, which is then input into the text embedding model. This embodiment preferably uses a domain-specific fine-tuned BGE-M3 or BERT-Large model. The input is a sequence of sliced ​​text. The output is a high-dimensional dense vector of dimension d. (For example, d=768 or 1024). This vector captures the semantic information of the slice (such as keywords, sentence meaning).

[0078] Structured position vector generation ( The process involves converting the "hierarchical path encoding" generated in step S2 into a computer-computable vector. The specific steps are as follows: Serialization: Converting the encoded string (e.g., Root-1-2-3) into an integer sequence. For parts insufficient to the maximum depth, pad with 0s. For example, [0, 1, 2, 3, 0, 0]. Feature mapping: To enable positional information to interact with semantic information in the same dimension, one-hot encoding cannot be used simply. This embodiment designs a pre-defined multilayer perceptron (MLP) model. The input layer receives an integer sequence P (or its embedding representation). The hidden layer contains at least two fully connected layers, and the activation function uses ReLU to extract non-linear features in the hierarchical structure (e.g., recognizing that 1.2.1 and 2.1.1, although different in absolute position, are similar in structural depth). The output dimension is strictly configured to be the same as the maximum depth. The dimension d is consistent (i.e., 768 dimensions). The output result is a structured location vector. .

[0079] Step S4: Adaptive Gated Fusion. Using a preset adaptive gated fusion mechanism, the fusion weights of the semantic vector and the structured position vector are calculated, and the two are fused based on the fusion weights to obtain the final representation vector of the document slice;

[0080] Simple vector concatenation or addition cannot handle the issue of varying importance of structure and semantics in different scenarios. For example, for unique texts like "Principles of Deep Learning," semantics is more important; while for general texts like "Overview" or "References," structural position is more important. Therefore, this embodiment designs a learnable adaptive gating fusion mechanism, with the specific calculation logic as follows: First, the semantic vectors are... and structured position vector By concatenating the vectors, we obtain a joint vector with a dimension of 2d. Then, through a linear transformation layer (by the parameter matrix) and bias vector (Definition) Mapping it to scalar space and processing it through the Sigmoid activation function compresses the value to the interval (0, 1), resulting in the gate value Gate. The mathematical formula is:

[0081]

[0082] in, The dimension is (If the output is also vector-gated) or (Scalar gating) In this embodiment, vector gating is preferably used, meaning that the Gate is also a d-dimensional vector, enabling fine-grained control over each dimension of the feature. The calculated Gate is used as a weight to perform a weighted summation of the two vectors:

[0083] in, This represents element-wise multiplication. When the model determines that the semantics of the current slice are highly discriminative, it will automatically learn a Gate value close to 1 to retain more elements. Information; when the meaning is ambiguous (e.g., only the word "method"), the Gate value decreases, and the model utilizes more information. The provided contextual location information is used to distinguish slices, resulting in the final representation vector. Its dimension remains d (768 dimensions). This vector is stored in a vector database (such as Milvus or Faiss) to build a document index library for subsequent document retrieval or association analysis.

[0084] To further enhance the interpretability and cross-document association capabilities of the search results, this embodiment also includes the construction and application of "title chain semantic anchors," the specific steps of which are as follows: Figure 6 As shown.

[0085] Anchor Point Construction (Offline Stage): Extract all non-leaf nodes (i.e., headings at all levels) from the structure tree in step S1. For each non-leaf node, obtain its own heading text and aggregate the text content of all its child nodes as context. Call the Large Language Model (LLM) and input the prompt word. An example prompt word is as follows: "As a chapter summary generator for professional domain documents, please generate a 100-150 word summary description based on the following chapter content. Requirements: accurately summarize the core theme, scope, and key information, and use concise and standardized language." The summary output by the LLM is the "semantic anchor." Store the triple {hierarchical path encoding, heading text, semantic anchor} into a relational database or key-value store to establish a mapping relational database.

[0086] Search disambiguation (online phase): When a user enters a query, the system calculates the query vector and compares it with the data in the database. Based on the similarity, the system recalls the Top-K slices. The system checks if there are slice clusters among the Top-K slices that have the same title text but different hierarchical path codes. For example, it recalls three slices that all belong to the "Technical Solution" section, but originate from Chapter 3 of Document A, Chapter 2 of Document B, and Chapter 5 of Document A, respectively. For detected ambiguous slices, the system retrieves the semantic anchors of their parents (and even grandparents) from the mapping database in real time based on their path codes.

[0087] The system no longer returns only the sliced ​​original text, but instead returns structured cards:

[0088] [Source]: Document A -> Chapter 3 System Architecture

[0089] [Chapter Summary (Anchor Point)]: This chapter mainly describes the system's hardware composition and network topology.

[0090] [Slice Content]: The specific technical solution is...

[0091] This presentation method allows users to immediately see that although the content of each slice is called "technical solution," one may be about hardware architecture while the other may be about software algorithms, thus achieving accurate disambiguation. Cross-document association: When constructing knowledge graphs or performing multi-document analysis, the system calculates the association score between any two slices.

[0092]

[0093] Set dual thresholds (e.g., vector similarity) And anchor point similarity A connection edge is established only when two slices are similar in local content and belong to similar higher-level chapters. This effectively avoids erroneous connections based on taking things out of context.

[0094] like Figure 7 As shown, the present invention also provides a multi-level document intelligent slicing and association system 700 driven by both structural and semantic principles. This system includes the following logical modules:

[0095] The structure tree construction module 701 is used to obtain the target document to be processed and construct a document structure tree containing parent-child nesting relationships by jointly analyzing the document's format layout features and text semantic features.

[0096] The slicing and encoding module 702 is used to traverse the document structure tree, generate document slices in units of tree nodes, and generate a unique hierarchical path code for each document slice based on the position of the tree node in the document structure tree.

[0097] The vector generation module 703 is used to perform text encoding on the document slice to obtain a semantic vector, and to map the hierarchical path encoding into a structured position vector with the same dimension as the semantic vector;

[0098] The vector fusion module 704 is used to calculate the fusion weight of the semantic vector and the structured position vector using a preset adaptive gating fusion mechanism, and fuse the two based on the fusion weight to obtain the final representation vector of the document slice. A document index library is established based on the final representation vector for subsequent document retrieval or association analysis.

[0099] Each module of the present invention can be implemented as a software component running on a computer system. Figure 8 A schematic diagram of the hardware structure of an electronic device suitable for implementing embodiments of the present invention is shown. The electronic device 800 includes: a processor 801, a memory 802, and a computer program stored in the memory and executable on the processor. The processor 801 and the memory 802 are connected via a bus 803. The processor 801 may be a central processing unit (CPU) or a graphics processing unit (GPU). When executing deep learning models (such as BERT encoding, GNN prediction, LLM summarization), a high-performance GPU from the NVIDIA Tesla or Ampere series is preferably used to accelerate matrix operations. The memory 802 includes random access memory (RAM) and read-only memory (ROM). It is used to store the operating system, document parsing engine, neural network model parameters, etc. (etc.) and the document structure tree object generated at runtime. Storage media: such as hard disks or SSDs, used for persistent storage of massive amounts of original documents, generated slice indexes, vector database files, and semantic anchor libraries. Network interface: used to connect to the Internet or local area network, receive user search requests, and return results.

[0100] In summary, this invention successfully solves three major challenges in long document processing: structural loss, ambiguous attribution, and broken associations. By introducing a "document structure tree" as the core intermediate representation and innovatively designing "hierarchical path encoding" and its "adaptive gating fusion mechanism" with semantic vectors, it not only improves the accuracy of the retrieval system but also provides high-quality, interpretable knowledge input for large-scale model applications such as RAG.

[0101] In the detailed description above, reference has been made to the accompanying drawings, which form part of this document. In the drawings, similar symbols typically identify similar parts unless the context otherwise indicates otherwise. The illustrated embodiments described in the detailed specification, drawings, and claims are not intended to be limiting. Other embodiments may be used and other changes may be made without departing from the spirit or scope of the subject matter presented herein.

[0102] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A structure-semantics dual-driven multi-level document intelligent slicing and association method, characterized in that, Includes the following steps: Step S1: Obtain the target document to be processed, and construct a document structure tree containing parent-child nesting relationships by jointly analyzing the document's format layout features and text semantic features; wherein, the step of constructing the document structure tree includes: constructing a fully connected graph or a K-nearest neighbor-based graph based on the graph attention network GAT, taking the identified title nodes as graph nodes, inputting the visual layout features and semantic context features of the nodes, and predicting whether there is a parent-child relationship between each pair of title nodes. Step S2: Traverse the document structure tree, generate document slices in units of tree nodes, and generate a unique hierarchical path code for each document slice based on the position of the tree node in the document structure tree; wherein, the hierarchical path code is generated by starting from the root node of the document structure tree, traversing down the tree path, recording the sibling index of each title node passed, and using the root node identifier as the starting position to obtain a unique encoding string that identifies the coordinates of the document slice in the entire document logical space; Step S3: Encode the document slices into semantic vectors, convert the hierarchical path encoding into an integer sequence, padding any part of the integer sequence that is less than the maximum depth with 0; input the integer sequence into a preset multilayer perceptron model for feature mapping, and output the structured position vector; the output dimension of the multilayer perceptron model is configured to be consistent with the dimension of the semantic vector; wherein, the multilayer perceptron model includes at least two fully connected layers, and the activation function is ReLU; Step S4: Using a preset adaptive gating fusion mechanism, calculate the fusion weights of the semantic vector and the structured position vector, and fuse them based on the fusion weights to obtain the final representation vector of the document slice. Establish a document index library based on the final representation vector. The calculation process of the adaptive gating fusion mechanism is as follows: wherein, is the semantic vector, is the structured location vector, is the fusion weight gating value, denotes a vector concatenation operation, and are learnable parameters, is a Sigmoid activation function, is an element-wise multiplication, is the final representation vector.

2. The method of claim 1, wherein, The specific steps for constructing the document structure tree in step S1 include: extracting multimodal features of text blocks in the document using a pre-trained document understanding model, wherein the multimodal features include at least: text sequence, bounding box coordinates, font attributes, and indentation distance; identifying the node types of the text blocks using a classification model, wherein the node types include title nodes and body nodes; predicting the parent-child nesting relationship between title nodes using a graph neural network based on the visual layout features and semantic context features of the text blocks; and constructing the document structure tree with the document as the root node, title nodes as intermediate nodes, and body nodes as leaf nodes.

3. The method of claim 1, wherein, The specific rules for generating hierarchical path codes in step S2 are as follows: starting from the root node of the document structure tree, record the sequence numbers of all title nodes passed along the path to reach the node where the current slice is located; concatenate the sequence numbers in hierarchical order to generate a unique encoded string that identifies the logical position of the document slice.

4. The method of claim 1, wherein, The method also includes the step of constructing semantic anchors for the title chain: extracting non-leaf nodes from the document structure tree, obtaining the title text of the non-leaf nodes and all the slice content under them; using a large language model to generate a summary of the non-leaf nodes to obtain a generalized semantic description, which serves as the semantic anchor; and establishing a mapping relationship library containing hierarchical path encoding, title text, and the semantic anchor.

5. The method of claim 4, wherein, The method also includes a retrieval disambiguation step: when a retrieval request is received and multiple similar slices are retrieved, it is determined whether there are similar slices with the same title text but different hierarchical path codes; if so, the semantic anchor point and parent title information corresponding to the similar slice are retrieved from the mapping relationship library and output together with the similar slice to distinguish slice affiliation.

6. A structure-semantics dual-driven multi-level document intelligent slicing and association system, characterized in that, include: The structure tree construction module is used to obtain the target document to be processed. By jointly analyzing the document's format layout features and text semantic features, it constructs a document structure tree containing parent-child nesting relationships. The structure tree construction module is based on the graph attention network GAT, constructs a fully connected graph or a graph based on K nearest neighbors, takes the identified title nodes as graph nodes, inputs the visual layout features and semantic context features of the nodes, and predicts whether there is a parent-child relationship between each pair of title nodes. The slicing and encoding module is used to traverse the document structure tree, generate document slices in units of tree nodes, and generate a unique hierarchical path code for each document slice based on the position of the tree node in the document structure tree; wherein, the hierarchical path code is generated by starting from the root node of the document structure tree, traversing down the tree path, recording the sibling index of each title node passed, and using the root node identifier as the starting position. A vector generation module is used to encode the document slices into semantic vectors and convert the hierarchical path encoding into an integer sequence, padding the integer sequence with zeros for any part that is less than the maximum depth; the integer sequence is input into a preset multilayer perceptron model for feature mapping, and the output is a structured position vector with the same dimension as the semantic vector; wherein, the multilayer perceptron model includes at least two fully connected layers and the activation function is ReLU; The vector fusion module is used to calculate the fusion weights of the semantic vector and the structured position vector using a preset adaptive gating fusion mechanism, and fuse the two based on the fusion weights to obtain the final representation vector of the document slice. A document index library is then established based on the final representation vector. The calculation process of the adaptive gating fusion mechanism is as follows: wherein, is the semantic vector, is the structured position vector, is the fusion weight gating value, denotes a vector concatenation operation, and are learnable parameters, is a Sigmoid activation function, is an element-wise multiplication, is the final representation vector.

7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 5.

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