Document segmentation method and system based on context marking and model cascading
By combining a hierarchical recursive strategy with wedge tags and a large language model, the cost and semantic structure problems of ultra-long document segmentation in existing technologies are solved, achieving efficient and accurate document segmentation and structured output, applicable to various document types.
Patent Information
- Application Number
- CN202511577464.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2026-01-16
AI Technical Summary
Existing document segmentation techniques struggle to balance semantic coherence, structural rationality, and low cost when processing extremely long documents. Existing methods suffer from high computational costs, reliance on document format consistency, or neglect of semantic structure.
We employ a document segmentation method based on context tagging and model cascading. By combining a hierarchical recursive strategy with lightweight wedge tags and a large language model, we can identify logical demarcation points and construct a hierarchical document structure, thereby reducing computational costs and improving semantic accuracy.
It achieves efficient and accurate document segmentation, generates structured document structures, reduces token costs by more than 99%, improves contextual relevance and adaptability, and is suitable for various document types.
Smart Images

Figure CN121351802A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to a document segmentation method and system based on context tagging and model cascading. Background Technology
[0002] With the widespread application of Large Language Models (LLM) and Retrieval Augmentation (RAG) technologies, efficiently and accurately processing ultra-long documents and unstructured data has become a significant challenge in the field of natural language processing. Most existing document segmentation techniques rely on fixed-size chunking, recursive chunking, or semantic chunking methods, but these methods have inherent limitations.
[0003] In existing technologies, fixed-size chunking methods segment text into fixed-length fragments. While computationally simple, these methods ignore the semantic structure of the document, easily leading to contextual breaks and affecting the accuracy of subsequent information retrieval and generation. Recursive chunking methods perform hierarchical segmentation by matching delimiters according to rules, but their effectiveness depends on the consistency of document format. They perform poorly on documents with non-standard formats, such as PDF-to-text conversions or complex legal clauses. Semantic chunking methods identify semantic topics by calculating embedding vectors, which can improve semantic coherence but are computationally expensive and perform poorly when handling heterogeneous content.
[0004] Furthermore, proxy-based segmentation methods attempt to automatically determine segmentation points using large language models, but due to the high computational cost of LLM, this method is economically infeasible when processing extremely long documents. In summary, existing technologies generally face a "trilemma of cost, structure, and semantics" when processing document segmentation, lacking a solution that can guarantee semantic coherence, reasonable structure, and low cost and high efficiency. Summary of the Invention
[0005] To address the aforementioned problems, the present invention aims to provide a document segmentation method and system based on context tagging and model cascading. By combining context tagging and a hierarchical model cascading strategy, it achieves efficient and accurate segmentation of extremely long documents, preserving the semantic coherence and structural hierarchy of the documents, and improving the information retrieval and generation performance in downstream tasks such as RAG systems. The above-mentioned objective of the present invention is achieved through the following technical solutions: This invention provides a document segmentation method based on context tagging and model concatenation, comprising: Step S1: Respond to the document splitting request, load the document to be processed, and initialize the splitting parameters; Step S2: In the current layer, call the large language model to analyze the current text segment to be processed, identify logical dividing points and generate wedge information containing dividing point markers and context; Step S3: Based on the wedge information, locate the absolute position of the segmentation point in the text segment and segment the text segment into several text sub-segments; Step S4: Repeat steps S2 and S3 for the text segment until the preset recursion termination condition is reached. Step S5: After the recursion is completed, aggregate the segmentation results of each layer to construct a hierarchical document structure with parent-child relationships, and output the final segmentation result.
[0006] Further, in step S1, in response to the document splitting request, the document to be processed is loaded and the splitting parameters are initialized, including, Receive a document splitting request and obtain the document identifier corresponding to the document splitting request; the document identifier can be a file path, file name, database number, Uniform Resource Locator URL, or hash value identifier; Load the document to be processed based on the document identifier and preprocess the document content. The preprocessing includes removing invalid characters, unifying the encoding format, and standardizing the text structure. The initialization segmentation parameters are used to control the execution process of recursive segmentation. The segmentation parameters include the number of context characters K, the maximum text block length max_token, the maximum number of recursive layers max_layer, and the model cascading configuration.
[0007] Furthermore, the model cascading configuration is used to configure large language models called at different recursive layers. The large language models include models with ultra-long context processing capabilities, models with deep semantic understanding capabilities, and lightweight models.
[0008] Further, in step S2, the large language model is invoked at the current layer to analyze the current text segment to be processed, identify logical demarcation points, and generate wedge information containing demarcation point markers and context, including: The large language model corresponding to the current layer is set in the model cascade configuration to perform semantic analysis on the text segment; Identify logical demarcation points in text segments based on semantic analysis results; For each logical demarcation point, wedge information is generated. The wedge information includes a demarcation marker, the context characters before and after the demarcation point determined based on the number of context characters K, and the corresponding logical title.
[0009] Further, in step S3, the text segment is divided into several sub-segments based on the absolute position of the segmentation point in the text segment according to the wedge information; The absolute position of the segmentation point is determined by matching the context characters in the wedge information within the text segment. The text segment is divided into several text sub-segments at the absolute position, and a corresponding node identifier and logical title are generated for each text sub-segment; Establish a parent-child relationship between the node identifier of the text sub-segment and the node identifier of the current text segment, and record the parent node identifier; The logical title, split point marker, and surrounding characters of each text segment are stored together as the updated wedge information.
[0010] Furthermore, in step S4, the recursion termination condition is that the current recursion level reaches the maximum recursion level max_layer or the length of the current text segment or text sub-segment is less than the maximum text block length max_token.
[0011] Further, in step S4, steps S2 and S3 are repeated for the text segment until a preset recursion termination condition is reached, including: Determine whether the current text segment meets the recursion termination condition; If the recursion termination condition is not met, then based on the model cascading configuration, the corresponding large language model is called to execute steps S2 and S3 for the text segment; When the recursion termination condition is met, the recursive segmentation terminates and the segmentation result of the current layer is output.
[0012] Furthermore, in step S5, after the recursion is completed, the segmentation results of each layer are aggregated to construct a hierarchical document structure with parent-child relationships, and the final segmentation result is output. Establish a hierarchical relationship based on the node identifier and parent node identifier of each layer to ensure that each text segment can be correctly associated with its parent node. The segmentation results from each layer are integrated in hierarchical order to construct a multi-level document tree structure, and the final segmentation result is output.
[0013] Based on the same inventive concept, this invention provides a document segmentation system based on context tagging and model concatenation, employing the document segmentation method described above, including: The response module is used to respond to document segmentation requests, load the document to be processed, and initialize the segmentation parameters. The segmentation parameters include the number of context characters K, the maximum text block length max_token, the maximum number of recursive layers max_layer, and the model cascading configuration. The processing module is used to call the large language model at the current layer to analyze the text segment to be processed, identify logical demarcation points and generate wedge information containing demarcation point markers and context; locate the absolute position of the demarcation point in the text segment according to the wedge information, and divide the text segment into several text sub-segments; repeat steps S2 and S3 on the text sub-segments until the preset recursion termination condition is reached. The results output module is used to aggregate the segmentation results of each level after the recursion is completed, construct a hierarchical document structure with parent-child relationships, and output the final segmentation result.
[0014] Furthermore, the processing module includes, The demarcation point identification unit is used to call the large language model corresponding to the current layer in the model cascade configuration to perform semantic analysis on the text segment; identify logical demarcation points in the text segment based on the semantic analysis results; and generate wedge information for each logical demarcation point. The wedge information includes a segmentation mark, the context characters before and after the segmentation point determined based on the number of context characters K, and the corresponding logical title. The segmentation unit is used to match the context characters in the wedge information in the text segment to determine the absolute position of the segmentation point; at the absolute position, the text segment is segmented into several text sub-segments, and a corresponding node identifier and logical title are generated for each text sub-segment; a parent-child relationship is established between the node identifier of the text sub-segment and the node identifier of the current text segment, and the parent node identifier is recorded; the logical title, segmentation point mark and the preceding and following context characters of each text sub-segment are stored together as the updated wedge information.
[0015] Compared with the prior art, the present invention has at least one of the following beneficial effects: This invention intelligently identifies and reproduces the inherent logical hierarchy of a document through a hierarchical recursive method, ultimately producing a structured document structure that significantly improves structural fidelity. Through a "wedge" mechanism, LLM outputs only tiny positioning markers, reducing token costs by over 99%, and optimizing overall costs by combining this with a model cascading strategy. Simultaneously, the generated text blocks are highly aligned with the semantic boundaries of the document, effectively solving the context fragmentation problem, providing higher-quality input for the RAG system, enhancing contextual relevance, and suppressing "model illusion." The system's high adaptability and scalability enable it to flexibly handle various document types, possessing strong potential for industrial applications. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the steps of the structured knowledge unit generation method based on semantic prediction of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0019] First Embodiment In the automated processing of long documents, existing technologies generally employ different segmentation methods (also known as "chunking") to divide extremely long texts into segments that can be processed by downstream models. The main methods and their limitations are as follows: (1) Fixed-size segmentation, which mechanically divides text into several segments according to a preset number of characters, words, or tokens, and introduces a certain amount of overlap between segments to maintain context. However, this method completely ignores the logical and semantic structure of the text, and is prone to being truncated before sentences, paragraphs, or complete ideas are finished, resulting in semantic incompleteness and context fragmentation. This seriously affects the retrieval effect and answer accuracy of subsequent Retrieval Augmentation Generation (RAG) systems, because the performance of RAG systems is highly dependent on whether the retrieved text blocks contain complete and coherent information.
[0020] (2) Standard recursive segmentation methods attempt to perform hierarchical segmentation using priority delimiters (such as paragraph marks, line breaks, periods, spaces, etc.). For example, the RecursiveCharacterTextSplitter in the LangChain library is based on this idea. Although this method can preserve the hierarchy to some extent in well-structured text, it essentially relies on heuristic rules. When encountering messy or complex scenarios, its effectiveness drops significantly or even fails completely. It can only recognize explicit format structures but cannot understand the semantic hierarchy of the content itself.
[0021] (3) Semantic and cohesive segmentation methods use sentence vector similarity or embedding clustering to identify topic transition points, thereby generating more semantically coherent segments. These methods are theoretically advanced, but their drawbacks are: calculating embeddings sentence by sentence and comparing them pairwise for long documents is computationally intensive and costly; they are unstable in handling heterogeneous content (tables, formulas, code segments); their performance varies greatly in different tasks, and may even disrupt the original order, affecting downstream applications that rely on text sequences, which is fatal for RAG applications that rely on information sequences.
[0022] The fundamental reason why existing document segmentation technologies struggle to simultaneously meet the requirements of structural fidelity, semantic coherence, and processing cost is that they mostly employ a single segmentation strategy, failing to flexibly adapt to different levels. To address this, the inventors borrowed a recursive hierarchical segmentation method, similar to "slicing a cake." First, lightweight wedge markers are introduced into the document, determining the segmentation point location by comparing contextually adjacent characters. This reduces output overhead by only outputting the positioning markers and eliminating the need to repeatedly generate the original text. Second, a multi-layered recursive strategy is employed during segmentation, proceeding from the outside in. The outer layer prioritizes large-granularity segmentation (e.g., chapters, sections) using models with lower computational costs, while the inner layer progressively calls higher-capacity models for finer-granular segmentation (e.g., paragraphs, clauses), until a preset maximum level or text block length threshold is met. This ensures structural integrity while achieving accurate recognition of complex semantics. Third, different scale models are selected as needed at different levels, improving the semantic accuracy of segmentation while controlling overall computational costs. After recursion is complete, the multi-level results are aggregated into a hierarchical document structure with parent-child relationships and output in a standardized format for easy access by downstream RAG systems or other business applications.
[0023] Through the above design, this invention effectively overcomes the triple dilemmas of cost, structure, and semantics inherent in existing methods, providing a scalable, industrial-grade solution for the efficient segmentation of ultra-long and complex documents. Specific implementation methods are as follows: This invention provides a document segmentation method based on context tagging and model concatenation, comprising: Step S1: Respond to the document splitting request, load the document to be processed, and initialize the splitting parameters; Step S2: In the current layer, call the large language model to analyze the current text segment to be processed, identify logical dividing points and generate wedge information containing dividing point markers and context; Step S3: Based on the wedge information, locate the absolute position of the segmentation point in the text segment and segment the text segment into several text sub-segments; Step S4: Repeat steps S2 and S3 for the text segment until the preset recursion termination condition is reached. Step S5: After the recursion is completed, aggregate the segmentation results of each layer to construct a hierarchical document structure with parent-child relationships, and output the final segmentation result.
[0024] Further, in step S1, in response to the document splitting request, the document to be processed is loaded and the splitting parameters are initialized, including, Receive a document splitting request and obtain the document identifier corresponding to the document splitting request; the document identifier can be a file path, file name, database number, Uniform Resource Locator URL, or hash value identifier; Load the document to be processed based on the document identifier and preprocess the document content. The preprocessing includes removing invalid characters, unifying the encoding format, and standardizing the text structure. The initialization segmentation parameters are used to control the execution process of recursive segmentation. The segmentation parameters include the number of context characters K, the maximum text block length max_token, the maximum number of recursive layers max_layer, and the model cascading configuration.
[0025] Specifically, the initialization step is used to set the segmentation parameters that control the recursive segmentation process. A unified interface is provided for users or systems to configure according to different document types and application requirements. Specifically, it includes: (1) Context character count K, which is used to determine the context range of the "wedge" marker, that is, to take K characters forward and backward in the context of the candidate segmentation point to assist the large language model in judging the logical boundary. By adjusting the size of K, a flexible balance can be made between segmentation accuracy and computational efficiency. (2) Maximum text block length max_token, as one of the recursion termination conditions, stipulates that when a text segment reaches this threshold, it is considered an atomic block and no further recursive segmentation is required. This parameter can effectively avoid over-segmentation and ensure that the generated text block has sufficient semantic integrity. (3) Maximum recursion layer max_layer, as the second recursion termination condition, defines the maximum number of layers that a document can be decomposed into. When this level is reached, even if the text block still exceeds max_token, no further deep segmentation will be performed, thus avoiding recursion falling into infinity or excessive consumption of computing resources; (4) The model cascading configuration is used to specify which large language model with what capabilities and scale is called at different recursion levels. For example, a lightweight model is used in the outer layer to quickly identify large-granular structures (such as chapters and sections), while a higher-capability model is called in the inner layer to accurately judge fine-granular semantic boundaries (such as clauses and sentences). This configuration supports flexible expansion and can be pre-set in the form of JSON or configuration files.
[0026] Furthermore, the model cascading configuration is used to configure large language models called at different recursive layers. These large language models include models with extensive context processing capabilities, models with deep semantic understanding capabilities, and lightweight models. For example, based on the current layer depth (current_layer), the corresponding LLM is selected from the preset model cascading configuration. For instance, layer 0 uses a model with extensive context processing capabilities, such as Doubao-1.5-pro-256k, while deeper layers use models with stronger semantic understanding capabilities, such as Deepseek-R1-461B-32K.
[0027] Further, in step S2, the large language model is invoked at the current layer to analyze the current text segment to be processed, identify logical demarcation points, and generate wedge information containing demarcation point markers and context, including: The large language model corresponding to the current layer is set in the model cascade configuration to perform semantic analysis on the text segment; Identify logical demarcation points in text segments based on semantic analysis results; For each logical demarcation point, wedge information is generated. The wedge information includes a demarcation marker, the context characters before and after the demarcation point determined based on the number of context characters K, and the corresponding logical title.
[0028] For example, a specific instruction can be constructed for the text segment prompting engine using a large language model. This instruction requires the LLM to analyze the current text segment and identify all top-level logical delimiters, such as finding the boundaries of a "chapter" in the text of an entire book, or the boundaries of a "section" in the text of a chapter. For each identified delimiter, the LLM is instructed to output structured data containing three parts of information: ① a special marker, such as... <wedge>. ② The K characters immediately before and after the marker, i.e. pre_context and post_context. ③ A concise title for the text block before this "wedge", which can be either an original extract or a model summary. The LLM returns a list, where each element is a set of {pre_context, post_context, title}. For each element in the list, the wedge is inserted by concatenating its pre_context and post_context, and a high-precision search is performed in the full original document to determine the absolute index position of the split point. This index, the current layer, the title, the parent node ID, and other information are stored in the global wedge information list.
[0029] According to all the wedge indices parsed in the previous step, the current text segment is divided into multiple smaller sub-segments. Then, for each new sub-segment, its text content is taken as input, the layer depth current_layer is incremented by 1, and the ID of the current node is passed in as the parent ID of the child node. The recursive function is called again.
[0030] Further, in step S3, according to the wedge information, the absolute position of the split point in the text segment is located, and the text segment is divided into several text sub-segments, including: Based on the context characters in the wedge information, the absolute position of the split point is determined by matching in the text segment; The text segment is divided into several text sub-segments at the absolute position, and the corresponding node identifier and logical title are generated for each text sub-segment; The node identifier of the text sub-segment and the node identifier of the current text segment are associated as parent and child, and the parent node identifier is recorded; The logical title, split point marker, and pre-post context characters of each text sub-segment are stored together as updated wedge information.
[0031] Further, in step S4, the recursive termination condition is that the current recursion level reaches the maximum recursion level max_layer or the length of the current text segment or text sub-segment is less than the maximum text block length max_token. This step is mainly used to prevent infinite recursion and potential stack overflow risk.
[0032] Further, in step S4, steps S2 and S3 are repeatedly performed on the text sub-segment until the preset recursive termination condition is reached, including, Determine whether the current text sub-segment meets the recursive termination condition; When the recursive termination condition is not met, the corresponding large language model is called based on the model cascade configuration to perform steps S2 and S3 on the text sub-segment; When the recursive termination condition is met, the recursive segmentation is terminated and the segmentation result of the current layer is output.
[0033] Specifically, regarding the execution of recursive logic in the document segmentation process, the following steps are included: According to the current processing depth, a corresponding large language model (LLM) is automatically selected from the model cascade configuration set in the initialization stage. In this way, lightweight models can be preferentially called in outer layers to reduce costs, while high-performance models can be called in inner layers to improve segmentation accuracy, achieving a dynamic balance between efficiency and accuracy. Based on the current text segment to be processed, an input instruction (Prompt) is constructed. According to the segmentation parameters, context information and boundary point marking rules are dynamically inserted to generate prompt content adapted to the current model, guiding the selected LLM to identify logical segmentation points in the target text segment. The large language model structure is used to manage the interaction with the selected large language model, responsible for sending the prompt content to the model and receiving the model output results. Standardization processing of the returned results is supported, such as extracting segmentation markers and context information, and converting them into "cleft" information that can be directly parsed by subsequent segmentation modules.
[0034] Further, in step S5, after the recursion is completed, the segmentation results of each layer are aggregated to construct a hierarchical document structure with parent-child relationships, and the final segmentation result is output; according to the node identifier and parent node identifier of each layer, the hierarchical relationship is established to ensure that each text segment can correctly associate its parent node; the segmentation results of each layer are integrated in hierarchical order to construct a multi-level document tree structure, and the final segmentation result is output. Specifically, after the recursive processing is completed, the segmentation results of each layer are aggregated and integrated in hierarchical order to construct a multi-level document tree structure. In this process, key information of each segmentation point, including index position, belonging level, logical title, and identification relationship between parent node and child node, is collected and integrated, and on this basis, the hierarchical document structure is uniformly formatted. Finally, all text segments and their hierarchical relationships are organized into a standardized output format, such as a multi-level JSON object, providing clear structure and complete semantics for downstream retrieval or semantic analysis tasks.
[0035] In addition, it is necessary to emphasize that one of the core innovations of the present application is the "wedge" and K-neighbor context mechanism. The main cost bottleneck of the existing proxy block idea is that the output of the LLM is the segmented text block itself, resulting in a huge number of output tokens. The "wedge" mechanism of the present application completely overturns this mode. The task of the LLM is no longer "copy and output text", but "identify and locate boundaries". The output of the LLM is designed as a lightweight "pointer", not the data itself. For each segmentation point, the LLM only needs to output a special token and a very short context around it (for example, when K=50, the total length of the context is only about 100 characters). Compared with outputting thousands of tokens of the entire text block, this way reduces the output cost of the LLM by several orders of magnitude (usually more than 99%). In addition, simply using text fragments (such as chapter titles) for positioning may be wrong due to text repetition or minor differences. The K-neighbor context (i.e. the K characters immediately before and after the segmentation point) used in the present application creates a high-probability unique "fingerprint" for each segmentation point. This positioning string composed of pre_context and post_context greatly improves the robustness and accuracy of finding the segmentation point position in the original document, effectively avoiding errors that may be caused by ambiguous matching. Therefore, the essence of this mechanism is to effectively decouple the expensive, deep-intelligence semantic decision-making task (completed by the LLM) and the cheap, purely mechanical text segmentation task (completed by the string operation of the traditional programming language), thereby minimizing the cost while ensuring intelligence.
[0036] The following three application examples further illustrate the improvement and application value of the present application in the prior art: Application Example 1: Processing of Financial Prospectus Unlike existing technologies that use fixed-size or heuristic recursive segmentation, this application combines model cascading with a "wedge" mechanism. This not only accurately identifies top-level sections such as "Abstract," "Use of Proceeds," and "Risk Factors" at the full-text level, but also progressively refines the segmentation to chapter and clause levels within the recursive hierarchy, ultimately outputting a hierarchical JSON structure with parent-child relationships. This overcomes the problems of coarse segmentation granularity and lack of structure awareness in existing methods. The main implementation method is as follows: a 500-page bond prospectus with a complex structure is selected as the processing object to demonstrate the practical application of this method. First, the system sets initial segmentation parameters, including: maximum recursive layer max_layer=3, maximum text block length max_token=3000, context character count K=25, and model cascading configuration. Layer 0 uses the Doubao-1.5-pro-256k model to identify the top-level part, Layer 1 uses the Qwen-2.5-72B-128k model to identify the main chapters, and Layer 2 uses the Deepseek-R1-461B-32K model to identify specific clauses and paragraphs.
[0037] The processing flow is as follows: Layer 0 processing: Using the complete prospectus as input, Doubao-1.5-pro-256k is called, prompting the model to identify the top-level components of the document. The model may return the following wedge information: Prologue 1: pre_context="...Proceeds from this bond issuance", post_context="Will be used for the following projects...", title="Use of Proceeds" Prologue 2: pre_context="...The main risks faced include", post_context="Market risk, credit risk...", title="Risk factors" Prologue 3: pre_context="...Terms and Conditions of this Bond Issue", post_context="As follows: Bond Name...", title="Terms and Conditions of this Bond Issue" By analyzing these wedges, the document is divided into several large text blocks, such as "Summary", "Use of Proceeds", "Risk Factors", and "Terms of This Bond Issue".
[0038] Layer 1 processing: Recursively calls the "Risk Factors" text block generated in the previous layer. At this point, `current_layer` is 1, and the system selects the Qwen-2.5-72B-128k model. The model is prompted to identify the main risk categories in the "Risk Factors" section. The model may return the following wedge information: Wedge 1.1 : pre_context="... Risks Related to the Issuer", post_context="Include, but are not limited to, operational risks...", title="Risks Related to the Issuer" Wedge 1.2: pre_context="... Risks Related to the Current Bonds", post_context="Include interest rate risk, liquidity...", title="Risks Related to the Current Bonds" Wedge 1.3: pre_context="... Risks Related to the Market Environment", post_context="Include macroeconomic policy changes...", title="Risks Related to the Market Environment" Layer 2 Processing: The "Risks Related to the Issuer" text block generated in the previous layer is recursively called again. At this time, the current_layer is 2, and the system selects the Deepseek-R1-461B-32K model. This model is prompted to separate each specific risk disclosure paragraph under this category. The model will generate a wedge at the end of each risk paragraph.
[0039] Termination and Output: When the recursion reaches max_layer (3 layers) or the text block is less than max_token (3000 tokens), the recursion stops. Finally, the hierarchical output builder integrates all the recorded wedge information into a JSON object, accurately reflecting the "part-section-clause" hierarchical structure of the prospectus.
[0040] Application Example 2: System Implementation Environment This application shows the deployment of the present solution in an industrial environment. The hardware environment includes one or more servers equipped with high-performance GPUs (such as NVIDIA A100 or H100), which can be used to load open-source large models locally or as clients to communicate with cloud large model APIs, and the memory capacity is sufficient to support the loading of ultra-long documents.
[0041] In terms of software environment, the system core is written in Python, which uses asyncio to implement concurrent asynchronous calls to LLM APIs; PostgreSQL supporting JSONB is used for storing and querying the final generated hierarchical results; the system provides RESTful APIs to allow users to submit document tasks and obtain structured segmentation results. This embodiment verifies the engineering and integrable implementation capability of the present invention, which can meet the different needs of cloud computing and local deployment.
[0042] Application Example 3: Parameter Tuning for New Document Types A batch of previously untreated technical patent documents are selected to demonstrate the adaptive tuning capability of the present scheme on new document types. First, 20-30 patent documents are randomly selected as the test set; then, an experimental matrix is constructed, and the K, max_token, max_layer, etc. parameter combinations are adjusted, and the test set is run through the segmentation method. Next, based on the artificial logical integrity evaluation and downstream RAG performance indicators, the segmentation results are comprehensively evaluated. Finally, the best parameter configuration is determined based on the evaluation results, such as K=25, max_token=4000, max_layer=4. This parameter configuration will be applied to the batch processing of this type of patent documents. By presetting the parameter table, the best model combination and parameter values can be configured for different document types (such as financial prospectuses, legal contracts, device manuals, and academic papers), enabling efficient processing of diverse documents. This embodiment demonstrates the high adaptability and scalability of the present invention.
[0043] Second embodiment Based on the same inventive concept, the present invention provides a document segmentation system based on context tagging and model cascading, which adopts the document segmentation method as described above, comprising, a response module for responding to a document segmentation request, loading the document to be processed and initializing the segmentation parameters; the segmentation parameters include the number of context characters K, the maximum text block length max_token, the maximum number of recursive layers max_layer, and the model cascading configuration; a processing module for calling a large language model at the current layer to analyze the current text segment to be processed, identifying logical division points and generating wedge information containing segmentation point markers and context; locating the absolute position of the segmentation point in the text segment according to the wedge information, and dividing the text segment into several text sub-segments; repeating steps S2 and S3 for the text sub-segments until the preset recursive termination condition is reached; a result output module for aggregating the segmentation results of each layer when the recursion is complete, constructing a hierarchical document structure with parent-child relationships, and outputting the final segmentation results.
[0044] Further, the processing module comprises, a division point identification unit for calling the large language model corresponding to the current layer set in the model cascading configuration to perform semantic analysis on the text segment; identifying the logical division points in the text segment according to the semantic analysis results; generating wedge information for each logical division point, which includes segmentation markers, context characters before and after the segmentation point determined based on the number of context characters K, and the corresponding logical title; The segmentation unit is configured to determine the absolute position of the segmentation point based on the matching of the context characters in the wedge information in the text segment; segment the text segment into several text sub-segments at the absolute position, and generate a corresponding node identifier and a logical title for each text sub-segment; establish a parent-child association relationship between the node identifier of the text sub-segment and the node identifier of the current text segment, and record the parent node identifier; store the logical title, the segmentation point mark and the front and rear context characters of each text sub-segment together as the updated wedge information.
[0045] Third embodiment The present embodiment aims to verify the technical effects and advantages of the document segmentation method based on the context marking and model cascade of the present scheme in practical application. By comparing and analyzing with the typical fixed-length segmentation method and the heuristic segmentation method based on font format in the prior art, the performance of the present scheme in segmentation accuracy, structure fidelity, semantic coherence and universality is evaluated, so as to objectively reflect the substantial progress of the present scheme in the field of intelligent document structured processing.
[0046] To ensure the universality and objectivity of the analysis, three representative and complex structured financial documents are selected as the samples to be processed. The document samples have been subjected to necessary de-sensitization processing (for example, anonymization operation on specific companies, places, times and other information). Since the technical scheme of the present application and the following comparative scheme do not depend on the type of the specific values, this processing does not affect the macro structure and semantic distribution of the document. Therefore, the document segmentation effect reproduced in the present analysis can be regarded as having the same effect in the real business scenario. The document samples include (1) a professional investor bond prospectus, with a total of about 442 pages; (2) a short-term financing bond base prospectus of a certain company, with a total of about 544 pages; (3) a medium-term note renewal prospectus of a certain company, with a total of about 160 pages. The contents of the above documents cover company information disclosure, financial data explanation, risk warning, bond terms, fund raising purposes and appendix materials, etc. at multiple levels, with complex chapter structure and significant differences in layout. Some chapters are interspersed with tables, numbered clauses and footnote explanations, which can fully reflect the main technical challenges faced by long documents in segmentation tasks, including ambiguous chapter boundaries, large semantic span, inconsistent format and mixed logical levels. The present embodiment processes and compares the above documents to verify the performance and advantages of the method of the present embodiment in complex document structure understanding, hierarchical segmentation accuracy and semantic boundary recognition.
[0047] The segmentation result of the technical scheme of the present application is fully consistent with the original directory structure of the document on all test samples, that is, the accuracy rate of segmentation reaches 100%. The specific beneficial effects are described as follows: (1) The deep semantic understanding ability of the large language model for long context is fully utilized, and the logical division points in the document are intelligently identified through the "wedge" marking mechanism. As shown in the test results, this method can accurately reproduce the hierarchical structure of the document (for example, "chapter > section > clause"), ensuring that the segmentation boundary is highly aligned with the logical boundary of the document, and fundamentally solving the problem of context fragmentation. (2) It does not depend on specific explicit formats of the document (such as fixed title font or HTML tags), but relies on the understanding of content semantics. Therefore, this scheme can effectively deal with documents of various formats, complex structures or heterogeneous content (such as PDF converted text, scanned OCR text), and has strong cross-document type processing capability. (3) A set of perfect segmentation parameters (such as context character number K, maximum text block length max_token, maximum recursion layer number max_layer) and model cascade configuration are provided. The implementer can dynamically select different combinations of large language models and subdivide strategies according to the complexity of the document to be processed, the characteristics of the field, and different requirements for cost and accuracy, achieving cost optimization and effect balance of "good steel used on the cutting edge".
[0048] The following is part of the segmentation result of the present scheme: (1) The first sample document is "Certain Professional Investor Bond Solicitation Statement" (about 442 pages), and the segmentation output includes "Risk Warning and Explanation", "Issuance Overview", "Mobilization Fund Use", "Issuer Basic Situation", "Financial and Accounting Information", and other chapter nodes. Each chapter is further subdivided into clauses, explanations and sub-chapters. To intuitively reflect the hierarchical segmentation capability of this method, the following lists the typical output structure of this document (JSON format after desensitization): { "Declaration": "", "Major Matters Warning": "", "Explanation": "", "First Section Risk Warning and Explanation": { "One, Investment Risks Related to This Bond": "", "Two, Related Risks of the Issuer": "" }, "Second Section Issuance Overview": { "One, Basic Situation of This Issuance": "", "Two, Subscriber Commitment": "" }, ... "Section 13: Documents for Reference": { "1. Content of Documents for Reference": "", "2. Location for Reference of Documents for Reference": "", "3. Website for Reference of Documents for Reference": "" } } (2) The second sample document is the "Base Prospectus of Short-term Financing Bond of Company A" (about 544 pages), which is a typical long structured document in the financial field. After processing by this method, the chapters of risk warning, issuance terms, financial status, credit situation, default and risk disposal, etc. are automatically extracted and organized in logical order. The following shows the de-sensitized segmentation results: { "Declaration and Commitment": "", "Important Warnings": { "1. Main Warnings of Issuer": "", "2. Warnings Related to Investor Protection Mechanism": "" }, "Chapter 1: Interpretation": "", "Chapter 2: Risk Warnings": { "1. Investment Risks of the Debt Financing Instrument": "", "2. Risks Related to the Issuer": "" }, "Chapter 3: Issuance Terms": "", "Chapter 4: Purpose of Funds Raised": "", ... "Chapter 12: Trustee Mechanism": "", "Chapter 13: Default, Risk Situations and Disposal": { "1. Default Events": "", "2. Default Responsibilities": "", "3. Repayment Risks": "", "4. Obligations of the Issuer": "", "5. Emergency Plan of the Issuer": "", "6. Basic Principles of Risk and Default Disposal": "", "7. Force Majeure": "", "8. Dispute Resolution": "", "9. Waiver": "" }, "Chapter 14: Institutions Related to the Issuance of the Debt Financing Instrument": "", "Chapter 15: Supplementary Documents and Inquiry Address": { "1. Supplementary Documents": "", "2. Inquiry Address": "" }, "Appendix: Main Financial Indicators Calculation Formula": "" } (3) The third sample document is "Certain Company Medium-term Note Renewal Prospectus" (about 160 pages). This document is relatively short in length, but the content structure is compact, containing modules such as issuance terms, fund use, corrections and updates, and related agencies. After processing by the method of the present invention, the system can accurately identify each chapter and its subordinate clauses, automatically build a complete hierarchical structure, and ensure that the segmentation results are highly consistent with the original document directory. To further illustrate the adaptability and stability of the method in different sizes and formats of documents, the following shows the segmentation results of the third sample document reference (after de-sensitization): { "Declaration and Commitment": "", "Important Notice": { "1. Supplementary Risk Notice": "", "2. Issuance Terms Notice": "", "3. Related Notice of Investor Protection Mechanism": "" }, "Chapter 1: Interpretation": "", "Chapter 2: Issuance Terms": { "1. Main Issuance Terms": "", "2. Issuance Arrangements": "" }, "Chapter 3: Fund Use": { "1. Main Purpose of Fund Raising": "", "2. Issuer's Commitment": "", "3. Debt Repayment Guarantee Measures and Sources": "" }, ... "Chapter 6: Relevant Agencies for the Issuance of the Current Debt Financing Instrument": "", "Chapter 7: Inquiry Method for the Base Prospectus": "" } II. To verify the actual improvement effect of the method of the present invention, this embodiment selects fixed-length segmentation as one of the comparison schemes to reflect the limitations of traditional methods.
[0049] As shown in the segmentation results below, the only advantage of the fixed-length segmentation method lies in its extremely simple implementation logic, requiring no complex calculations and thus providing the fastest processing speed. However, this method completely ignores the inherent logic and semantic structure of the text. Its segmentation results differ significantly from the original table of contents, demonstrating its poor performance at the semantic segmentation level and its inability to meet the requirements of high-quality downstream tasks (such as RAG). Its limitations are mainly reflected in: (1) Severe context fragmentation: This method is prone to forcibly truncating complete sentences, paragraphs, or logical ideas before they have finished, resulting in a complete semantic unit being split into two or more different text blocks. This makes each text block semantically incomplete, which seriously affects the downstream model's understanding and retrieval of information.
[0050] (2) Lack of logical attribution. Because this method does not segment according to the meaning of the article's chapters, the generated text blocks are difficult or impossible to know exactly what content of the original text they correspond to or which logical chapter they belong to, thus losing the document's structural information.
[0051] The following are partial results of fixed-length segmentation for reference: ① We will now select a portion of the output from the first sample document, "A Professional Investor's Bond Prospectus," as a reference. After being processed by a fixed-length segmentation algorithm, this sample document was mechanically divided into numerous equal-length text blocks. The system failed to recognize any logical hierarchy or chapter titles, simply using serial numbers (such as "Chapter 0," "Chapter 1," etc.) for simple numbering. It is evident that this method completely loses the document's structural features during the segmentation process; the hierarchical relationships between chapters and clauses cannot be recovered, resulting in severe semantic fragmentation of the text. This exemplifies the problems of "context fragmentation" and "structural loss" in existing technologies.
[0052] { Chapter 0: ·\n\nGroup\n(Address: Yellow River Red Carp Square)\nQilian Fish Eagle Professional Investor Bond Prospectus\nLead Underwriter\n\n(Pearl River Orange Grass Carp Building)\nJoint Lead Underwriter\nSigning Date: February 2024\nStatement\nThis prospectus is based on... "Risk Factors" and other relevant chapters.\nI. Basic Financial Information of the Issuer\nBefore the Issuance and Listing of this Bond", "Chapter 1": "The company's net assets at the end of the most recent period were RMB 233.063 billion (total equity in the consolidated financial statements as of [date]), and the debt-to-asset ratio was 66.15%. The issuer's average annual distributable profit for the most recent three fiscal years was RMB 360 million... Therefore, the company faces certain debt repayment pressure. If the company's profits and cash flow cannot be maintained at a reasonable level, it will affect the company's principal and interest repayment. VII. As of the end of September 2023, the issuer's assets with restricted ownership..." Chapter 2: The total amount was RMB 9.674 billion, accounting for 1.41% of the total assets at the end of the period. Of this, restricted cash amounted to RMB 2.826 billion, mainly consisting of statutory deposit reserves, performance bonds, bill deposits, and pre-sale housing payment supervision funds. Furthermore, as of the end of September 2023… The issuer promised that, considering the overall asset size and profitability, and adhering to the principle of optimizing the company's asset quality and financial performance, it would reasonably arrange the transfer time and the highways to be transferred, and gradually advance the transfer work. As of the end of September 2023, the issuer had transferred the equity of the Longlin-Baise Expressway, Yizhou-Hechi Expressway, Baise-Jingxi Expressway, Liujing-Qinzhou Port Expressway, Guanyang-Fenghuang Expressway, Cenxi-Shuiwen Expressway, and Sanjiang-Liuzhou Expressway to Tianshan Falcon Loan Repayment Center free of charge. The total assets transferred for the Longlin-Baise Expressway… ...... "Chapter 125": "If a party requests the issuer to provide additional collateral, and the collateral is reduced in value or lost due to changes in circumstances, resulting in its inability to cover the principal and interest of the defaulted bonds, ... the issuer shall immediately take the following remedial measures on the day following receipt of the request, and strive to reach a settlement with the bondholders on the breach of commitment through bondholder meetings or other means:\n(1) Provide and implement other settlement plans approved by the bondholders within 30 calendar days.\n(2) If a bondholder requests the issuer to implement remedial measures, the issuer shall inform the trustee and fulfill its information disclosure obligations within 2 trading days, and promptly disclose the progress of the implementation of the remedial measures."\n4.21 During the term of this bond, the trustee shall not transfer the entrusted "} ② The second sample document, "Basic Prospectus for Short-Term Financing Bonds of a Certain Company" (approximately 544 pages), was used as the test sample. After processing, the system mechanically cut the document into over a hundred independent segments according to a fixed text length threshold, failing to identify chapter titles, clause hierarchy, or logical subordination. The segmentation results show that this method can only output text blocks marked by sequence numbers (such as "Chapter 0", "Chapter 1", etc.), completely losing the original chapter structure and logical connections of the content. Furthermore, some sentences were truncated in the middle of the semantics, resulting in severe semantic fragmentation. When dealing with long, complex, and hierarchically nested prospectus-type documents, the fixed-length segmentation method struggles to maintain the integrity and readability of the content. The output is merely a mechanically segmented product of a continuous stream of characters, rather than semantic units that can be used in high-quality retrieval or question-answering systems. The following are some results of the fixed-length segmentation for reference: { "Chapter 0": "\n\nGroup\n Declarations and Commitments\nThis registration adopts the "regular issuance plan" model. This prospectus is a disclosure by the issuer in accordance with the M-table and products, industry, etc. ... regarding objections.\nThe person in charge of this company, the person in charge of accounting, and the person in charge of the accounting department guarantee that the financial information stated in this prospectus is true, accurate, complete, and timely.\nAnyone who acquires and holds shares of this company through subscription, transfer, or other legal means..." "Chapter 1": "By purchasing the debt financing instruments issued in this offering, you are deemed to have voluntarily accepted the stipulations regarding the rights and obligations outlined in this offering prospectus. This includes the trust management agreement, the rules of bondholders' meetings, and other relevant stipulations in the offering prospectus concerning the rights and obligations of the issuer, bondholders, bond trustee, or other institutions performing equivalent duties." ...... Chapter 114: "Where there is an agreement, it shall be followed.\nVII. Force Majeure\n(I) Force majeure refers to the situation after the announcement of this debt financing instrument plan, where the parties cannot foresee the impact of the default, and the lead underwriter has the right to suspend subsequent issuance matters and convene a bondholders' meeting to take all actions against the issuer to compensate for the losses suffered due to the issuer's default.
[0054] Chapter 115: (m) Download this basic prospectus.......Long-term interest-bearing liabilities = Long-term loans + Bonds payable + Long-term payables (interest-bearing items)\nTotal interest-bearing liabilities = Short-term interest-bearing liabilities + Long-term interest-bearing liabilities\nDate 2023\n\n\n\n"} ③ After processing, the third sample document was segmented into more than ten independent text blocks according to a fixed length threshold. Similarly, it failed to identify chapters, titles, or semantic boundaries, resulting in the complete loss of document structure information. The segmentation results show that this method breaks logical paragraphs such as "Declaration and Commitment," "Important Notes," "Issuance Terms," and "Use of Raised Funds" into several discontinuous text fragments. Chapter titles are often truncated to different blocks from the main text. For example, sections such as "Important Notes" and "Supplementary Risk Warnings" are split between "Chapter 1" and "Chapter 3," and the original hierarchical structure (such as "Chapter-Section-Article") cannot be reconstructed. This severely damages semantic continuity and logical attribution, making the output unsuitable for any subsequent semantic retrieval or question-answering tasks. This result further confirms that the fixed-length segmentation method, when faced with long financial texts containing multi-level titles, cross-references of clauses, and content update instructions, cannot preserve the document's logical hierarchy and contextual semantics, only providing superficial character segmentation, essentially destroying text parsingability and business relevance. The following are some results of the fixed-length segmentation for reference: "Chapter 1": "The person in charge and the person in charge of accounting work, and the person in charge of the accounting department guarantee that the financial information described in this prospectus is true, accurate, complete and timely. ...... (II) Supplementary Circumstances Notice\n1. Major Asset Restructuring\nBased on the circumstances already disclosed in the basic prospectus, this debt financing instrument does not involve any major asset restructuring that requires supplementary disclosure.\n2. Important Matters\n(1) According to the work arrangement, the issuer intends to transfer the Hechi-Baise, Chongzuo-Jingxi and Leye-Baise expressways to the Tianshan Falcon Loan Repayment Center. This matter has been reviewed and approved by the company's board of directors, but has not yet been approved by the competent authority, and the relevant agreements have not yet been signed." ...... "Chapter 16": "The debt ratio has decreased and the profitability indicators have improved.\n(5) The issuer will carry out follow-up work in accordance with the Rules of Bondholders' Meeting. ......The above transfer will be subject to creditor supervision and will be announced in a timely manner. If the transfer of the road assets has a significant impact on the issuer's operating conditions and may cause significant losses to investors, creditor protection measures will be initiated and a bondholders' meeting will be convened to protect the legitimate rights and interests of creditors.\nIn summary, the transfer will not have a significant adverse impact on the issuer's production and operation and the repayment of principal and interest on the current debt financing instruments.\nCredit Information\nRegarding the Basic Prospectus "Section","} Third, font-based segmentation methods are another existing technique that relies on heuristic rules. This method typically involves converting the document (such as Word or PDF) to HTML format, and then parsing specific tags in the HTML file (such as...). <h1>, < / h1> <h2>) or font style (e.g. font size, boldness) to determine the title, and build a chapter tree based on which to split. The following test results show the limitations: (1) Highly dependent on pre-prepared heuristic splitting conditions. For documents of different formats and different sources, different rules often need to be re-prepared, with poor universality. Therefore, the splitting rules used in the documents in the annex also have their own specific adjustments; (2) When facing complex or non-standard document structures (for example, titles of the same level use slightly different font sizes), the rules will become extremely difficult to develop and maintain, with high development and maintenance costs. (3) Dependent on the fidelity of the intermediate format, the effect is highly dependent on whether the format information (especially font and level) is completely preserved when the document is converted into HTML or other intermediate formats. (4) Completely dependent on the explicit format quality of the text, without using any semantic level information, resulting in its inability to handle text with chaotic formats but clear semantics.
[0055] ①Now select part of the output results of the first sample document as a reference. From the output structure, it can be seen that the heuristic splitting method based on font format can initially identify some chapter levels in this document, such as "Section 3 - Use of Funds Raised" "Section 4 - Basic Information of the Issuer" "Section 5 - Financial and Accounting Information", etc. However, the system has obvious errors in chapter boundary recognition and level assignment: on the one hand, the key chapters at the beginning of the document, such as "Risk Warning and Explanation" "Issuance Profile", are mistakenly merged into the "Beginning" node, resulting in incomplete directory hierarchy; on the other hand, in the "Section 5 - Financial and Accounting Information" section, the system mixes in "Credit Status" "Information Disclosure" "Investor Protection Mechanism" and other different chapter contents, reflecting the algorithm's inability to correctly distinguish the semantic levels between title styles and body text, resulting in chapter overlap and logical confusion. In addition, the system fails to accurately identify the relationship between chapter numbers and titles, with some nodes having isolated, repeated or missing numbers, such as "Issuer Equity Structure" "Management Discussion and Analysis". This shows that this method only relies on font style for level inference, lacking the ability to comprehensively judge the context semantics and structural dependency. Overall, although the output results show a certain level of hierarchy on the surface, their logical consistency and chapter integrity are severely compromised, making them unable to effectively support subsequent document semantic retrieval and knowledge slicing tasks. For reference: { "Beginning": { "One and the Related Investment Risks of This Bond": "", "Two Related Risks of the Issuer": "", "One Basic Situation of This Issuance": "", "Two Subscription Commitment": "" }, "Section 3 - Use of Funds Raised": { "Plan for the Use of Proceeds Raised": "", "Use of Proceeds from Previous Bond Issues": "", "Commitment for the Use of Proceeds from the Current Bond Issue": "" }, "Section IV - Issuer Profile": { "1. Issuer Overview": "", "2. Issuer History": "", "3. Equity Structure of the Issuer": "", "4. Equity Investment of the Issuer": "", "5. Governance Structure and Independence of the Issuer": "", "6. Basic Information of the Current Directors, Supervisors and Senior Management": "", "7. Main Business of the Issuer": "", "8. Media Queries": "", "9. Illegal and Irregular Activities and Penalties of the Issuer": "" }, "Section V - Financial and Accounting Information": { "1. Impact of Changes in Accounting Policies, Estimates and Adjustments on Financial Statements": "", "2. Changes in Scope of Consolidation": "", "3. Consolidated and Parent Financial Statements for the Reporting Period": "", "4. Main Financial Indicators for the Reporting Period": "", "5. Management Discussion and Analysis": "", "6. Interest-bearing Liabilities of the Company": "", "7. Related Parties and Related Party Transactions": "", "8. Significant or Commitment Matters": "", "9. Asset Pledge, Mortgage and Other Restrictive Arrangements": "", "1. Changes in Rating of the Main Parties and Reasons Therefor": "", "2. Main Matters in the Credit Rating Report": "", "3. Creditworthiness of the Issuer": "", "1. Information Disclosure Management System": "", "2. Periodic Reporting Disclosure": "", "3. Disclosure of Major Matters": "", "4. Disclosure of Principal and Interest Repayment": "", "1. Repayment Plan and Safeguards": "", "Second Default Events and Dispute Resolution Mechanism":, "Third Holders' Meeting Rules":, "Fourth Trustee":, "First Relevant Parties of the Offering":, "Second Conflict of Interest of the Issuer and Relevant Parties of the Offering":, }, "Section 12-Declaration of the Issuer's Lead Underwriter and Related Parties":, "Section 13-Exhibits": { "First Contents of Exhibits":, "Second Location of Exhibits":, "Third Website of Exhibits":, } } ②From the segmentation results, it can be seen that the second sample document based on the font format heuristic segmentation method can identify the main chapter hierarchy of the document to some extent, such as "Chapter 2 Risk Warning" "Chapter 6 Main Financial Status of the Issuer" "Chapter 7 Credit Status of the Issuer". However, this method still has significant problems in the integrity and hierarchy of the chapter structure. First, the "Chapter 5 Basic Situation of the Issuer" part only retains the last three subheadings, while the rest of the chapter content is completely missing, indicating that the system failed to correctly parse the same font size or smaller font changes in the title; second, meaningless nodes such as "section" "section-1" appear in the document, reflecting that the algorithm mistakenly identified HTML residual tags or placeholders as chapter titles, generating a pseudo-hierarchy structure. The results are as follows: { "Beginning":, "Declaration and Undertaking":, "Table of Contents":, "Important Notice":, "Chapter 1-Interpretation":, "Chapter 2-Risk Warning":, "Chapter 3-Issuance Terms":, "Chapter 4-Purpose of the Funds Raised":, "Chapter 5-Basic Situation of the Issuer": { "Section 10-Company Development Plan":, "Section 11-Industry Analysis":, "Section 12-Position and Competition of the Issuer in the Industry":, }, "section": {}, Chapter VI - Issuer's Key Financial Conditions: { "Basic Financial Information of the Issuer in Recent Years": "", "Analysis of the Financial Condition of the Second Issuer": "", "Status of Interest-Bearing Debts": "", "Four related party transactions": "", "Five Major Contingent Liabilities": "", "Six Restricted Assets": "", "Investment in Seven Derivative Financial Products": "", "Major Investment in Wealth Management Products": "", "Nine Overseas Investment Situation": "", "Ten Direct Debt Financing Plans": " }, Chapter Seven - Issuer's Creditworthiness: { "Rating of direct debt financing over the past three years": "", "Second Issuer's Bank Credit Line": "", "Debt Default Records of Three Companies": "", "Historical Record of Direct Debt Financing of the Four Companies": " }, Chapter 8 - Credit Enhancement of Debt Financing Instruments: {}, Chapter Nine - Taxes: { Value Added Tax (VAT): "", "Secondary Income Tax": "", "Stamp Duty": "", "Four Tax Offsets": " }, Chapter Ten - Information Disclosure Arrangements: {}, Chapter Eleven - Holders' Meeting Mechanism: { "Convening of the meeting of the three holders": "", "Participating Organizations at the Four Holders' Meeting": "", "Voting and resolutions of the five holders' meeting": "", "Six Others": "" }, Chapter Twelve - Trustee Mechanism: {}, Chapter Thirteen - Default Risk Situations and Handling: {}, "section-1": {}, "Chapter 14 - Issuer and other parties involved in the issuance of the debt securities": {}, "Chapter 15 - Documents on file and contact addresses": { "1. Documents on file": "", "2. Contact addresses": "" }, "Appendix - Calculation of key financial indicators": {} } ③From the segmentation results, it can be seen that the third sample document based on the font format heuristic segmentation method can identify some chapter titles to some extent, such as "Issuance terms" "Use of proceeds" "Chapter 5 Update on the Base Offering Prospectus" and extract some sub-titles. However, compared with the actual table of contents of the original document, the hierarchical structure and chapter organization of this method are obviously disordered. First, "Chapter 4 Error and Correction of the Base Offering Prospectus" is identified as an empty node, while "Chapter 5" contains a large number of irrelevant fields such as "section-113" "Figure 5-12" "Figure 5-13", which are all labels or table titles left over from the HTML parsing process and are mistakenly identified as text nodes. Second, the system failed to correctly distinguish the hierarchical relationship between chapter titles and table captions in the text, resulting in the presence of "Issuer financial and operating information Major important matters information disclosure check" "Figure 5-14 Issuer's recent consolidated profit and loss statement Part of the change in the subject" and other mixed structures in the output, showing serious logical disorder. In addition, the appearance of "section-27" "section-115" and other random nodes further indicates that heuristic rules are easily disturbed by HTML tags in complex document structures, and the output results have lost semantic coherence and hierarchical consistency. The results are as follows: { "Beginning": {}, "Declaration and Undertaking": {}, "Table of Contents": {}, "Important Notes": { "1. Supplementary risk warnings": "", "2. Issuance terms warning": "" }, "Explanation": {}, "Issuance Terms": { "1. Main issuance terms": "", "2. Issuance arrangements": "" }, "Use of Proceeds": { "1. Main purpose of proceeds": "", "2. Issuer's commitment": "", "Three Debt Service Guarantee Measures and Sources of Debt Service": " }, Chapter Four - Errors and Corrections in the Basic Prospectus: {}, "section-27": {}, Chapter 5 - Updates to the Basic Prospectus: { "Basic Information of the Issuer": "", "Issuer's Main Financial Information": "", "II. Updates on the Issuer's Recent Financial Situation in the Basic Prospectus": "", "Have the financial data for this reporting period been retrospectively adjusted or restated?": "", "none": "", "Financial Statements": "", "section-113": "", Key Financial Data and Indicators of the Issuer in the Third Quarter of 2023: "", "Chart 5-12 Changes in Key Financial Data of the Issuer in the Third Quarter of 2023": "", "section-114": "", "Financial data and indicators showing changes in the issuer's most recent issuance": "", "Chart 5-13 Changes in Certain Items of the Issuer's Recent Consolidated Balance Sheet": "", "section-115": "", "Chart 5-14 Changes in Certain Items of the Issuer's Recent Consolidated Income Statement": "", "section-116": "", "Chart 5-15 Changes in Certain Items of the Issuer's Recent Consolidated Cash Flow Statement": "", "Investigation of the Disclosure of Significant Financial and Operating Information by the Issuer": "", "III. Updates to Chapter VI - Issuer's Main Financial Condition and Chapter XI - Issuer's Asset Allocation and Related Circumstances of the Basic Prospectus": "", "Credit Information Section": "", "Four other": "" }, Chapter VI - Relevant Institutions Involved in the Issuance of This Debt Financing Instrument: {}, "section-117": {}, Chapter 7 - How to Access the Basic Prospectus: {} } The above merely describes the preferred embodiments of the present application, and the protection scope of the present application is not limited to the above-described embodiments. Any technical solution falling within the concept of the present application shall fall within the protection scope of the present application. It should be noted that, for ordinary skilled persons in the art, several improvements and refinements can be made without departing from the principles of the present application, and these improvements and refinements shall also be considered as falling within the protection scope of the present application.
[0056] It should be noted that the above-described embodiments can be freely combined as needed. The above merely describes the preferred embodiments of the present application, and it should be noted that, for ordinary skilled persons in the art, several improvements and refinements can be made without departing from the principles of the present application, and these improvements and refinements shall also be considered as falling within the protection scope of the present application.< / h2> < / wedge>
Claims
1. A document segmentation method based on context tagging and model cascading, characterized in that, Comprise: Step S1: in response to document segmentation request, load the document to be processed and initialize the segmentation parameters; Step S2: in the current layer, call large language model to analyze the current text segment to be processed, identify the logical division point and generate the wedge information containing the segmentation point mark and the context; Step S3: according to the wedge information, locate the absolute position of the segmentation point in the text segment, and divide the text segment into several text subsegments; Step S4: repeat steps S2 and S3 for the text subsegment until the preset recursive termination condition is reached; Step S5: after recursion, aggregate the segmentation results of each layer, build a hierarchical document structure with parent-child relationship, and output the final segmentation result.
2. The document segmentation method of claim 1, wherein, In step S1, in response to the document segmentation request, load the document to be processed and initialize the segmentation parameters, including, receive the document segmentation request, obtain the document identifier corresponding to the document segmentation request; The document identifier is file path, file name, database number, uniform resource locator URL or hash value identifier; According to the document identifier, load the document to be processed and preprocess the document content, which includes removing invalid characters, unifying coding format and normalizing text structure; Initialize the segmentation parameters to control the execution process of recursive segmentation, the segmentation parameters include context character number K, maximum text block length max_token, maximum recursive layer number max_layer and model cascade configuration.
3. The document segmentation method of claim 2, wherein, The model cascade configuration is used to configure the large language model called in different recursive layers, and the large language model includes a model with super long context processing capability, a model with deep semantic understanding capability and a lightweight model.
4. The document segmentation method of claim 3, wherein, In step S2, in the current layer, call large language model to analyze the current text segment to be processed, identify the logical division point and generate the wedge information containing the segmentation point mark and the context, including, Call the large language model corresponding to the current layer in the model cascade configuration to perform semantic analysis on the text segment; According to the semantic analysis result, identify the logical division point in the text segment; For each logical division point, generate the wedge information, which includes the segmentation mark, the context characters before and after the segmentation point determined based on the context character number K, and the corresponding logical title.
5. The document segmentation method of claim 3, wherein, In step S3, according to the wedge information, locate the absolute position of the segmentation point in the text segment, and divide the text segment into several text subsegments, including; Based on the context characters in the wedge information, match in the text segment to determine the absolute position of the segmentation point; Divide the text segment into several text subsegments at the absolute position, and generate the corresponding node identifier and the logical title for each text subsegment; Establish the parent-child association relationship between the node identifier of the text subsegment and the node identifier of the current text segment, and record the parent node identifier; Store the logical title, segmentation point mark and context characters before and after the segmentation point of each text subsegment together as the updated wedge information.
6. The document segmentation method of claim 4, wherein, In step S4, the recursive termination condition is that the current recursive layer number reaches the maximum recursive layer number max_layer or the length of the current text segment or text sub-segment is less than the maximum text block length max_token.
7. The document segmentation method of claim 5, wherein, In step S4, steps S2 and S3 are repeatedly performed on the text sub-segment until a preset recursive termination condition is reached, including, determining whether the current text sub-segment meets the recursive termination condition; when the recursive termination condition is not met, calling the corresponding large language model based on the model cascade configuration to perform steps S2 and S3 on the text sub-segment; when the recursive termination condition is met, terminating the recursive segmentation and outputting the segmentation result of the current layer.
8. The document segmentation method of claim 5, wherein, In step S5, after the recursion is completed, the segmentation results of each layer are aggregated to build a hierarchical document structure with parent-child relationships, and the final segmentation result is outputted; According to the node identifier and the parent node identifier of each layer, a hierarchical relationship is established to ensure that each text sub-segment can be correctly associated with its parent node; The segmentation results of each layer are integrated in hierarchical order to build a multi-level document tree structure, and the final segmentation result is outputted.
9. A document segmentation system based on context labeling and model cascading, employing the document segmentation method according to any one of claims 1 to 8, characterized in that, including, a response module for responding to a document segmentation request, loading a document to be processed and initializing segmentation parameters; the segmentation parameters include context character number K, maximum text block length max_token, maximum recursive layer number max_layer, and model cascade configuration; a processing module for calling a large language model at the current layer to analyze the current text segment to be processed, identifying logical division points and generating wedge information containing division point markers and context; locating the absolute position of the division point in the text segment according to the wedge information, and dividing the text segment into several text sub-segments; repeating steps S2 and S3 on the text sub-segment until a preset recursive termination condition is reached; a result output module for aggregating the segmentation results of each layer to build a hierarchical document structure with parent-child relationships when the recursion is completed, and outputting the final segmentation result.
10. The document segmentation system of claim 9, wherein, The processing module includes, a division point identification unit for calling the large language model corresponding to the current layer in the model cascade configuration to perform semantic analysis on the text segment; identifying the logical division points in the text segment according to the semantic analysis result; generating the wedge information for each logical division point, which includes the division marker, the context characters before and after the division point determined based on the context character number K, and the corresponding logical title; a segmentation unit for matching the context characters in the wedge information in the text segment to determine the absolute position of the division point; dividing the text segment into several text sub-segments at the absolute position, and generating a corresponding node identifier and the logical title for each text sub-segment; establishing a parent-child association relationship between the node identifier of the text sub-segment and the node identifier of the current text segment, and recording the parent node identifier; The logical title, the split point mark and the pre and post context characters of each of the text sub-segments are stored together as the updated wedge information.
Citation Information
Cited By
Space-time signal classification and interpretation system and method based on retrieval enhancement generation
CN121659038A