Document paragraph content merging and segmenting method based on combined tree structure

By adopting the paragraph hierarchical merge and segmentation method of combining tree structure in the document content segmentation method, the problem of incomplete semantics of document blocks in the prior art is solved, and more efficient document content segmentation and organization are achieved.

CN119918505AActive Publication Date: 2025-05-02SHANGHAI ICEKREDIT INC
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510413265.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-05-02
Estimated Expiration
2045-04-03

AI Technical Summary

Technical Problem

When the existing document content segmentation method uses the paragraph hierarchy structure, there are problems in identifying the content that does not fully comply with the document order, is too fine in granularity, and information loss and semantic separation.

Method used

The document paragraph content merging and segmentation method based on a combination tree structure is adopted. By traversing the document content line by line, identifying the title level, and using the paragraph title to organize the grouping list and content structure tree, dynamically merge and pruning, and semantic rich document blocks are generated.

Benefits of technology

The semantic integrity and richness of document blocks are realized, information loss and semantic separation are avoided, and the accuracy and effect of document content segmentation are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918505A_ABST
    Figure CN119918505A_ABST
Patent Text Reader

Abstract

The invention designs a document paragraph content merging and segmenting method based on a combined tree structure. The document paragraph content merging and segmenting method comprises the steps that S1, document content is obtained through a document analysis tool; s2, traversing document contents line by line to obtain a line text content list secs; distributing a title hierarchy for each row of content, and obtaining a hierarchy identification result list level; s3, generating a paragraph title organization grouping list cks by utilizing the obtained line text content list secs, the hierarchy identification result list level and a processing depth defined by a program; s4, grouping the title path information according to a paragraph title organization grouping list cks, and constructing a paragraph title information group cks-group; s5, organizing the paragraph title information group cks-group into a content structure tree form; s6, pruning and merging the content structure tree, and merging the text content on a larger level; and S7, processing the pruned content structure tree, and generating document block content of the current file. According to the method and the device, the to-be-matched document blocks with rich and complete semantics can be efficiently constructed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of data processing, and in particular relates to a document paragraph content merging and segmenting method based on a combined tree structure. Background Art

[0002] In the current retrieval-augmented generation (RAG) intelligent question-answering application, one of the prerequisites is to segment the content of the documents uploaded by users. The current mainstream document content segmentation schemes include fixed-length segmentation, sliding window segmentation, paragraph recognition segmentation, or semantic segmentation model segmentation. Few schemes consider segmentation using the paragraph hierarchy structure to which the content itself belongs. Existing document content paragraph hierarchy identification and merging schemes are only based on heuristic title rules and binary search methods to complete content identification at each paragraph level.

[0003] The recognition content of the existing paragraph hierarchy scheme does not completely comply with the content order of the document, and there is a long-tail disorder. In addition, when the heuristic title rules are not fully covered, the division granularity is too fine, resulting in a certain degree of information loss and semantic fragmentation in the document blocks obtained by subsequent content segmentation.

[0004] The commonly used solution at present is: the paragraph content merging and segmenting method is a method that combines heuristic rule title recognition and traditional segmentation. The general steps of this method are: Step S1, the computer uses a file parsing tool to traverse the text file line by line to obtain the file content, and stores the content line by line to obtain a line text list, and the order id of the line text appearance is synchronously retained; Step S2, the computer traverses the above line text list in order according to the pre-defined title recognition rule group, obtains the title level to which each line text belongs, and organizes the order of appearance of the line text according to the level to which the line text belongs. For example, the pre-defined title recognition rule group has a total of 5 recognition rules, then the finest level obtained by the text that hits the rule is 5, and the line text that does not hit the recognition rule is uniformly assigned to level 6 (that is, the line text is not a title, but a simple content text). Finally, a hierarchical information dictionary is obtained, the key of the dictionary is the title level, and the value of the dictionary is the line text sequence id contained in the level; Step S3, the computer program uses the hierarchical information dictionary obtained above to find the paragraph title of each line text at each level in a sequential and cyclical manner according to a certain backtracking depth. During the loop, according to the current line text sequence id and the line text sequence id list of the parent level, the paragraph line text id to which the current line text belongs is obtained by using a binary search algorithm; Step S4, the computer program starts the above loop from the lowest level (6 in the above example) until the set backtracking depth is reached (assuming the backtracking depth is 3, the program only loops through the line texts at levels 6, 4, and 5 to find the paragraph level to which the line texts at these levels belong), then the paragraph level path of each line text can be obtained. Step S5, the computer program organizes all the line text contents according to the paragraph level path, that is, splices the line text contents belonging to the same paragraph level together, and then segments the text content in a fixed length manner to obtain the final document block.

[0005] However, in the above method, when the paragraph level obtained by rule identification is directly used to organize the text content, due to the limitations of rule coverage and the possible non-uniqueness of the row text order id attribution (that is, the current row text may be both the paragraph title of a row text and the text content of the current level), the document block obtained by the existing method cannot completely comply with the order of the content in the original document; and directly using the paragraph level obtained by rule identification to organize and segment the text content, due to the deviation between the pre-defined rules and the title distribution of the actual parsed file, the row text content at some paragraph levels is too fine, and the contextual information and semantics of the final document block content are missing; finally, when the file content is divided by a fixed-length segmentation method to obtain the final document block, the first / last sentence of the current document block may be separated, thereby making the semantic information of the current document block incomplete.

[0006] Therefore, how to design a better method for merging and segmenting paragraph-level content to obtain document blocks with more complete and rich semantics has become a current design difficulty. Summary of the invention

[0007] In order to solve the above problems, this application designs a document paragraph content merging and segmenting method based on a combined tree structure, so as to combine the hierarchical recognition effect of heuristic title rules, sentence-level content segmentation and dynamic paragraph hierarchical content based on tree structure, and efficiently construct a semantically rich and complete document block to be matched.

[0008] A document paragraph content merging and segmenting method based on a combined tree structure comprises the following steps: Step S1, using a document parsing tool to obtain document content; Step S2, traverse the document content line by line to obtain a line text content list secs; assign a title level to each line content, and obtain a level recognition result list levels; Step S3, using the line text content list secs obtained in step S2, the level recognition result list levels and the processing depth depth defined by the program, to generate a paragraph title organization grouping list cks; Step S4, grouping the title path information according to the paragraph title organization group list cks, and constructing the paragraph title information group cks-group; Step S5, organizing the paragraph title information group cks-group into a content structure tree format; Step S6, pruning and merging the content structure tree, merging text content at a larger level; Step S7: Process the pruned content structure tree to generate the document block content of the current file.

[0009] Preferably, step S2 comprises: Step S21, traverse the document content line by line to obtain a line text content list secs; Step S22, sequentially traverse each line of text content, use a predefined regular expression set to perform title level recognition on each line of text, and store the recognition results in the level recognition result list levels.

[0010] Preferably, the specific method of step S22 includes: Step S221, combining K title recognition regular expressions into a regular expression group; Step S222, initialize a nested list of size K+1; Step S223, using a regular expression group to match each line of text; If the regular expression successfully matches the line of text, the line of text is assigned to the level corresponding to the regular expression, and the order of the line of text is added to the level recognition result list levels; If the regular expression does not match the line of text, the line of text is assigned to the default last level K+1, and the order of the line of text is added to the level recognition result list levels.

[0011] Preferably, in step S3, the method of generating the paragraph title organization group list cks comprises: Step S31, reverse the content of the level recognition result list levels, and start recognizing the parent level title to which the line text belongs from the text of the last level k+1; Step S32, traversing each level and each line of text in the level in the level recognition result list levels until the level reaches a specified depth; Step S33: Use a binary search algorithm to find all previous levels [l i ] to find the current level levels[l j ] the parent title paragraph corresponding to the line text; and change the order of the current line text to r idi , and the text order corresponding to the parent title paragraph r idk Composite tuple (r idk , r idi ), add it to the paragraph title organization grouping list cks, and initialize the paragraph title organization grouping list cks; Step S34, comparing the line texts recorded in the paragraph title organization grouping list cks with the content in the line text content list secs, to find out the line texts that have not been processed; Step S35: For each unprocessed line of text, use a binary search algorithm to determine its parent title and fill it into the paragraph title organization group list cks.

[0012] Preferably, in step S4, the dictionary keys of the paragraph title information group cks-group are all identified title paths, and the dictionary values ​​of the paragraph title information group cks-group are the text content contained in the paragraph title path.

[0013] Preferably, the specific method of step S5 includes: Step S51, initialize a multi-way content tree structure MultiWayTree, wherein the node elements in the tree are dictionaries, if the node is a non-leaf node, i.e., a title element, the value of the dictionary is a subtitle node, if the node is a leaf node, the value of the dictionary is a row text content list; the key of the dictionary is the title content; Step S52, traverse the paragraph title information group cks-group, insert the title path and the corresponding line text content into the content tree MultiWayTree. During the insertion process, in order to ensure the validity of the node order, according to the line id of the current line text and the line ids already stored under the current path and the line id list of the adjacent path, it is determined whether the insertion of the current line text will affect the orderliness, and whether to continue adding to the current path.

[0014] Preferably, the specific method of step S6 includes: Step S61: Depth-first traverse each path of the content structure tree, calculate the current path depth, and use all path depths of the current subtree to calculate the median of the path depths, and record the median; Step S62: For paths whose path depth exceeds the median, pruning and content merging are performed.

[0015] Preferably, the specific method of step S7 includes: Step S71, traverse the pruned structure tree, process each branch, and generate a description text of the paragraph chapter according to the title and paragraph text content stored in the node; Step S72: Use a sentence-level segmentation scheme to segment the description text of the paragraphs and chapters into blocks to obtain the final content of all document blocks of the file.

[0016] The advantages and effects of this application are as follows: The present application designs a document paragraph content merging and segmenting method based on a combined tree structure, including: S1, using a document parsing tool to obtain document content; S2, traversing the document content line by line to obtain a line text content list secs; assigning a title level to each line of content, and obtaining a level recognition result list levels; S3, using the above-obtained line text content list secs, the level recognition result list levels and the program-defined processing depth depth, to generate a paragraph title organization grouping list cks; S4, according to the paragraph title organization grouping list cks, grouping the title path information, and constructing a paragraph title information group cks-group; S5, organizing the paragraph title information group cks-group into a content structure tree form; S6, pruning and merging the content structure tree, merging text content at a larger level; S7, processing the pruned content structure tree, and generating the document block content of the current file. The present application can efficiently construct a semantically rich and complete document block to be matched.

[0017] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application so that it can be implemented in accordance with the contents of the specification, and to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the following is a detailed description of the preferred embodiments of the present application in conjunction with the accompanying drawings as follows.

[0018] Based on the detailed description of the specific embodiments of the present application in combination with the accompanying drawings below, those skilled in the art will become more aware of the above and other objects, advantages and features of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings without creative work. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, each element or part is not necessarily drawn according to the actual scale.

[0020] Figure 1 A flowchart of a document paragraph content merging and segmenting method based on a combined tree structure designed for this application; Figure 2 Reference pseudo code for step S3 designed for this application; Figure 3 This is an example diagram of node ids that are merged in order for this application; Figure 4 An example diagram of document block content with path depth median merging and sentence-level segmentation designed for this application. DETAILED DESCRIPTION

[0021] To make the purpose, technical scheme and advantages of the embodiment of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiment of the present application. Obviously, the described embodiment is a part of the embodiment of the present application, rather than all of the embodiments. In the following description, specific details such as specific configuration and components are provided only to help fully understand the embodiments of the present application. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. In addition, for clarity and brevity, the description of known functions and structures is omitted in the embodiment.

[0022] It should be understood that the references to "one embodiment" or "this embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "one embodiment" or "this embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0023] In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplicity and clarity, and does not in itself indicate the relationship between the various embodiments and / or settings discussed.

[0024] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist at the same time. The term " / and" in this article describes another type of association object relationship, indicating that there can be two relationships. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship.

[0025] The term "at least one" in this article is merely a description of the association relationship of associated objects, indicating that there may be three relationships. For example, at least one of A and B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0026] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusions.

[0027] Example 1: Please refer to Figure 1 This embodiment mainly introduces a document paragraph content merging and segmenting method based on a combined tree structure, including the following steps: Step S1, using a document parsing tool to obtain document content; Step S2, traverse the document content line by line, obtain the line text content list secs; assign a title level to each line content, and obtain the level recognition result list levels; specifically: assign each line text to a different level according to the recognition rule (heuristic title rule), and record the line text and the corresponding level into a list; Step S3, using the line text content list secs obtained in step S2, the level recognition result list levels and the processing depth depth defined by the program, to generate a paragraph title organization grouping list cks; Step S4, grouping the title path information according to the paragraph title organization group list cks, and constructing the paragraph title information group cks-group; Step S5, organizing the paragraph title information group cks-group into a content structure tree format; Step S6, pruning and merging the content structure tree, merging text content at a larger level; Step S7: Process the pruned content structure tree to generate the document block content of the current file.

[0028] Furthermore, the step S2 includes: Step S21, traverse the document content line by line to obtain a line text content list secs; Step S22, sequentially traverse each line of text content, use a predefined regular expression set to perform title level recognition on each line of text, and store the recognition results in the level recognition result list levels.

[0029] Furthermore, the specific method of step S22 includes: Step S221, combining K title recognition regular expressions into a regular expression group; Step S222, initialize a nested list of size K+1; Step S223, using a regular expression group to match each line of text; If the regular expression successfully matches the line of text, the line of text is assigned to the level corresponding to the regular expression, and the order of the line of text is added to the level recognition result list levels; If the regular expression does not match the line of text, the line of text is assigned to the default last level K+1, and the order of the line of text is added to the level recognition result list levels.

[0030] Specifically, assuming that the order of the current line of text is r-id i ; (If the current line of text is the first line of text, r-id i is 0), then the following matches are possible: If the regular expression successfully matches the line text (that is, the title pattern defined by the regular expression can be matched in the current line text, such as: the regular expression "title\d" can match "title 1"), then the line text is assigned to the level corresponding to the regular expression - the order of the current line text is added to the list levels[l j ]middle; If no hit is found, the row text is assigned to the default last level K+1 - the order of the current row text is added to the list levels[K+1].

[0031] For further information, please refer to Figure 2 , Figure 2 Reference pseudo code of step S3 designed for this application; in step S3, the method of generating the paragraph title organization group list cks includes: Step S31, reverse the content of the level recognition result list levels, and start recognizing the parent level title to which the line text belongs from the text of the last level k+1; Step S32, traversing each level and each line of text in the level in the level recognition result list levels until the level reaches a specified depth; For hierarchical traversal, depth controls the hierarchical depth d≤depth of parent title recognition, that is, at which levels of line text will the program recognize the parent title - assuming that depth is 3, the program will only recognize the parent title of line text belonging to levels k+1, k and k-1. This is done to introduce a controllable method to avoid introducing the title as ordinary content text into the final result.

[0032] Step S33: Use a binary search algorithm to find all previous levels [l i ] to find the current level levels[l j ] the parent title paragraph corresponding to the line text; and change the order of the current line text to r idi , and the text order corresponding to the parent title paragraph r idk Composite tuple (r idk , r idi ), add it to the paragraph title organization grouping list cks, and initialize the paragraph title organization grouping list cks; For the unprocessed line text, a binary search algorithm is used to search for the previous levels [l i ],(l i< l j ) to find the parent heading paragraph of the current line of text.

[0033] Specifically, according to the order of the current line of text idi , use the binary search algorithm to find r idi In levels[l i ] can be inserted into the position jj. Using the size comparison property of the binary search algorithm, the program will levels[l i]The line text at position jj is added to the parent title list involved in the current line text as the parent title of the current line text.

[0034] Step S34, comparing the line texts recorded in the paragraph title organization grouping list cks with the content in the line text content list secs, to find out the line texts that have not been processed; Step S35: For each unprocessed line of text, use a binary search algorithm to determine its parent title and fill it into the paragraph title organization group list cks.

[0035] For each unprocessed line of text, a binary search is performed to determine the parent title to which it belongs and fill it into cks. The final content of cks is as follows: cks[i]=[(s a ,s b ), ...], where s b The order of the rows traversed by the loop, s a The text content of the line.

[0036] Furthermore, in step S4, the dictionary keys of the paragraph title information group cks-group are all identified title paths, and the dictionary values ​​of the paragraph title information group cks-group are the text content contained in the paragraph title path.

[0037] Traverse cks to build the paragraph title information group cks-group, where the dictionary keys are all recognized title paths (consisting of all parent titles s in cks[i] a ), the value of the dictionary is the text content contained in the paragraph title path.

[0038] Note: cks[i]=[(s a ,s b ),..., (s a+n ,s b+n )] as an example, s a+1 to a+n The text content of the lines constitutes the title path, s a It is the paragraph content under the title path.

[0039] Furthermore, the specific method of step S5 includes: Step S51, initialize a multi-way content tree structure MultiWayTree, wherein the node elements in the tree are dictionaries, if the node is a non-leaf node, i.e., a title element, the value of the dictionary is a subtitle node, if the node is a leaf node, the value of the dictionary is a row text content list; the key of the dictionary is the title content; Step S52, traverse the paragraph title information group cks-group, insert the title path and the corresponding line text content into the content tree MultiWayTree. During the insertion process, in order to ensure the validity of the node order, according to the line id of the current line text and the line ids already stored under the current path and the line id list of the adjacent path, it is determined whether the insertion of the current line text will affect the orderliness, and whether to continue adding to the current path.

[0040] Furthermore, the specific method of step S6 includes: Step S61: Depth-first traverse each path of the content structure tree, calculate the current path depth, and use all path depths of the current subtree to calculate the median of the path depths, and record the median; Step S62: For paths whose path depth exceeds the median, pruning and content merging are performed.

[0041] Furthermore, the specific method of step S7 includes: Step S71, traverse the pruned structure tree, process each branch, and generate a description text of the paragraph chapter according to the title and paragraph text content stored in the node; Step S72: Use a sentence-level segmentation scheme to segment the description text of the paragraphs and chapters into blocks to obtain the final content of all document blocks of the file.

[0042] Through this step, the sentence-level content segmentation scheme can alleviate the problem of semantic fragmentation of document blocks to a certain extent. The mainstream document segmentation scheme does not consider the integrity of sentences in the document block - there is a phenomenon of mid-sentence cutting, which leads to the problem of incomplete / fragmented semantic information of the embedding obtained by the document block. The sentence-level content segmentation scheme can ensure that the sentences in each document block are complete. Combined with the overlap (block content overlap) technology, it can better ensure the integrity of the semantic information of the document block.

[0043] An example of the analysis results of this method in a paper proposal report in Baidu Library: Please refer to Figure 3 , Figure 3 This is an example of node ids for ordered merging. Figure 4 This is an example of document block content after path depth median merging and sentence-level segmentation. Figure 4 It can be seen that the present application not only ensures the richness of context information in the document block but also preserves the integrity of the sentence.

[0044] The present application designs a document paragraph content merging and segmenting method based on a combined tree structure, including: S1, using a document parsing tool to obtain document content; S2, traversing the document content line by line to obtain a line text content list secs; assigning a title level to each line of content, and obtaining a level recognition result list levels; S3, using the above-obtained line text content list secs, the level recognition result list levels and the program-defined processing depth depth, to generate a paragraph title organization grouping list cks; S4, according to the paragraph title organization grouping list cks, grouping the title path information, and constructing a paragraph title information group cks-group; S5, organizing the paragraph title information group cks-group into a content structure tree form; S6, pruning and merging the content structure tree, merging text content at a larger level; S7, processing the pruned content structure tree, and generating the document block content of the current file. The present application can efficiently construct a semantically rich and complete document block to be matched.

[0045] The above description is only the preferred embodiment of the present invention, which does not limit the protection scope of the present invention. For those skilled in the art, the present invention can be modified and varied in various ways. Within the spirit and principle of the present invention, any change, modification, replacement, integration and parameter change of these embodiments by conventional substitution or capable of achieving the same function without departing from the principle and spirit of the present invention shall fall within the protection scope of the present invention.

Claims

1. A document paragraph content merging and segmenting method based on a combined tree structure, characterized in that: The following steps are involved: Step S1, using a document parsing tool to obtain document content; Step S2, traverse the document content line by line to obtain a line text content list secs; assign a title level to each line content, and obtain a level recognition result list levels; Step S3, using the line text content list secs obtained in step S2, the level recognition result list levels and the processing depth depth defined by the program, to generate a paragraph title organization grouping list cks; Step S4, grouping the title path information according to the paragraph title organization group list cks, and constructing the paragraph title information group cks-group; Step S5, organizing the paragraph title information group cks-group into a content structure tree format; Step S6, pruning and merging the content structure tree, merging text content at a larger level; Step S7: Process the pruned content structure tree to generate the document block content of the current file.

2. According to the method for merging and segmenting document paragraph contents based on a combined tree structure according to claim 1, it is characterized in that: The step S2 comprises: Step S21, traverse the document content line by line to obtain a line text content list secs; Step S22, sequentially traverse each line of text content, use a predefined regular expression set to perform title level recognition on each line of text, and store the recognition results in the level recognition result list levels.

3. A document paragraph content merging and segmenting method based on a combined tree structure according to claim 2, characterized in that: The specific method of step S22 includes: Step S221, combining K title recognition regular expressions into a regular expression group; Step S222, initialize a nested list of size K+1; Step S223, using a regular expression group to match each line of text; If the regular expression successfully matches the line of text, the line of text is assigned to the level corresponding to the regular expression, and the order of the line of text is added to the level recognition result list levels; If the regular expression does not match the line of text, the line of text is assigned to the default last level K+1, and the order of the line of text is added to the level recognition result list levels.

4. The method for merging and segmenting document paragraph contents based on a combined tree structure according to claim 1, characterized in that: In step S3, the method of generating the paragraph title organization group list cks includes: Step S31, reverse the content of the level recognition result list levels, and start recognizing the parent level title to which the line text belongs from the text of the last level k+1; Step S32, traversing each level and each line of text in the level in the level recognition result list levels until the level reaches a specified depth; Step S33: Use a binary search algorithm to find all previous levels [l i ] to find the current level levels[l j ] the parent title paragraph corresponding to the line text; and change the order of the current line text to r idi , and the text order corresponding to the parent title paragraph r idk Composite tuple (r idk , r idi ), add it to the paragraph title organization grouping list cks, and initialize the paragraph title organization grouping list cks; Step S34, comparing the line texts recorded in the paragraph title organization grouping list cks with the content in the line text content list secs, to find out the line texts that have not been processed; Step S35: For each unprocessed line of text, use a binary search algorithm to determine its parent title and fill it into the paragraph title organization group list cks.

5. The method for merging and segmenting document paragraph contents based on a combined tree structure according to claim 1, characterized in that: In the step S4, the dictionary keys of the paragraph title information group cks-group are all the identified title paths, and the dictionary values ​​of the paragraph title information group cks-group are the text content contained in the paragraph title path.

6. The method for merging and segmenting document paragraph contents based on a combined tree structure according to claim 1, characterized in that: The specific method of step S5 includes: Step S51, initialize a multi-way content tree structure MultiWayTree, wherein the node elements in the tree are dictionaries, if the node is a non-leaf node, i.e., a title element, the value of the dictionary is a subtitle node, if the node is a leaf node, the value of the dictionary is a row text content list; the key of the dictionary is the title content; Step S52, traverse the paragraph title information group cks-group, insert the title path and the corresponding line text content into the content tree MultiWayTree. During the insertion process, in order to ensure the validity of the node order, according to the line id of the current line text and the line ids already stored under the current path and the line id list of the adjacent path, it is determined whether the insertion of the current line text will affect the orderliness, and whether to continue adding to the current path.

7. The method for merging and segmenting document paragraph contents based on a combined tree structure according to claim 1, characterized in that: The specific method of step S6 includes: Step S61: Depth-first traverse each path of the content structure tree, calculate the current path depth, and use all path depths of the current subtree to calculate the median of the path depths, and record the median; Step S62: For paths whose path depth exceeds the median, pruning and content merging are performed.

8. The method for merging and segmenting document paragraph contents based on a combined tree structure according to claim 1, characterized in that: The specific method of step S7 includes: Step S71, traverse the pruned structure tree, process each branch, and generate a description text of the paragraph chapter according to the title and paragraph text content stored in the node; Step S72: Use a sentence-level segmentation scheme to segment the description text of the paragraphs and chapters into blocks to obtain the final content of all document blocks of the file.

Citation Information

Patent Citations

  • Document title tree construction method and device, electronic equipment and storage medium

    CN111460083A

  • User feature extraction method and device based on text list

    CN112036572A

  • Document processing method and device, computer program product and readable storage medium

    CN116136958A

  • Document structure analysis method and device, terminal equipment and storage medium

    CN118734830A

  • Method for segmenting and complementing complete semantic paragraphs from PDF file based on article structure tree

    CN118966236A