Document directory identification method and system, electronic equipment and storage medium

By employing multi-model parallel analysis and dual-channel character extraction, the problems of high rule base maintenance cost and poor adaptability in PDF document directory recognition are solved, achieving efficient recognition and accurate extraction of complex format documents and generating a complete tree-like hierarchical directory structure.

CN121545167APending Publication Date: 2026-02-17TONGFANG KNOWLEDGE DIGITAL PUBLISHING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511732388.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-02-17

Smart Images

  • Figure CN121545167A_ABST
    Figure CN121545167A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of document processing, and discloses a document directory identification method and system, electronic equipment and a storage medium, and the method comprises the steps: obtaining a to-be-processed document, and converting the to-be-processed document into an image set page by page according to a page number sequence; executing multi-model analysis on each page of image in parallel, and outputting a semantic block set; performing fusion processing to generate a semantic block complete set, extracting catalog-related semantic blocks from the semantic block complete set, acquiring characters, collecting the characters to corresponding semantic blocks, recombining the characters into logic lines in each semantic block according to a reading sequence, and identifying a text title from the semantic block complete set; constructing a directory typesetting feature library based on the directory related semantic chunks, performing similarity matching on the extracted contents of the directory chapter semantic chunks and the text titles, and calculating the matching confidence; and based on a directory typesetting feature library and the matching confidence, correcting classification errors of the related semantic chunks of the directory, calculating a hierarchical relationship of the directory, generating a tree-shaped hierarchical directory structure, and outputting the tree-shaped hierarchical directory structure. The method is high in adaptability and expansibility, and can meet engineering application requirements.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of document processing, and in particular relates to a document directory recognition method and system, an electronic device and a storage medium. BACKGROUND

[0002] With the acceleration of the digitalization process, PDF documents have become the main format of information carriers such as academic literature, technical manuals, and electronic books. Accurate recognition of the directory structure in PDF documents is of great value for applications such as quick navigation of document content, knowledge graph construction, and intelligent retrieval.

[0003] Current PDF directory recognition techniques mainly fall into two categories: one is the traditional rule-based method, which extracts text and coordinates using a PDF parsing engine, and then uses pre-defined keywords, page number patterns, and font rules for heuristic judgment; the other is the single deep learning-based end-to-end method, which uses target detection or document analysis models to process page images, combined with OCR technology to extract directory elements and construct a hierarchical structure. However, these solutions have obvious shortcomings in practical applications:

[0004] The traditional rule-based method relies on fixed format assumptions and has poor adaptability to complex formats such as multi-column directories, mixed layouts, and embedded charts. The rule library maintenance cost is high and has poor scalability. Single deep learning models have difficulty in balancing fine-grained positioning accuracy and macro-level layout understanding, leading to frequent false positives and negatives, and incomplete information extraction. The character extraction method is severely mismatched with the document type, either unable to handle scanned PDFs or causing layout information loss and coordinate deviation when using OCR on native PDFs.

[0005] More importantly, existing technologies lack systematic modeling of directory layout rules, typically outputting model detection results without classification error correction and hierarchical relationship verification mechanisms based on layout semantics, making it difficult to meet engineering application requirements.

[0006] Therefore, the present application provides a document directory recognition method to solve the above technical problems. SUMMARY

[0007] The present application aims to provide a document directory recognition method, system, electronic device, and storage medium to solve the technical problems of high rule library maintenance cost, poor adaptability and scalability, and difficulty in meeting engineering application requirements in existing technologies.

[0008] To solve the above technical problems, the present application provides a document directory recognition method, comprising:

[0009] Obtaining a document to be processed, and converting the document into an image set page by page in page order;

[0010] Parallelly performing multi-model analysis on each page image, each model independently divides semantic blocks and identifies types of layout elements, and outputs a set of semantic blocks;

[0011] Performing fusion processing on the set of semantic blocks output by each model, performing confidence weighted fusion on the class labels of the semantic blocks with overlapping positions, cross-completing the uncovered areas, generating a full set of semantic blocks, and extracting directory related semantic blocks from the full set of semantic blocks, wherein the directory related semantic blocks include a directory title;

[0012] Obtaining characters through a double-channel character extraction strategy, grouping the characters into corresponding semantic blocks, reorganizing the semantic blocks into logical lines in reading order, and identifying a main title from the full set of semantic blocks;

[0013] Based on the directory related semantic blocks, constructing a directory layout feature library, performing similarity matching between the extracted directory title semantic block content and the main title, and calculating a matching confidence;

[0014] Based on the directory layout feature library and the matching confidence, correcting classification errors of the directory related semantic blocks, calculating directory hierarchical relationships, generating a tree-shaped hierarchical directory structure, and outputting the tree-shaped hierarchical directory structure.

[0015] In some embodiments, obtaining a document to be processed, and converting the document into a set of images in page order further includes:

[0016] Analyzing the page structure of the document, and establishing a page sequence in the natural order of page numbers;

[0017] Converting each page into a digital image in a preset format, and keeping the original layout unchanged;

[0018] Adjusting the image resolution to a preset numerical range;

[0019] Establishing a correspondence between the images and the page numbers, and generating a complete set containing all the page images.

[0020] In some embodiments, parallelly performing multi-model analysis on each page image, each model independently divides semantic blocks and identifies types of layout elements, and outputs a set of semantic blocks, further includes:

[0021] Inputting each page image into multiple deep learning models simultaneously;

[0022] Each model independently performs semantic block detection, and outputs boundary coordinate position information of the semantic blocks;

[0023] Each model independently identifies types of layout elements of the semantic blocks, and outputs class labels and corresponding confidence scores;

[0024] Integrate the semantic block information output by each model to generate a set of semantic blocks with a unified data structure.

[0025] In some specific embodiments, the semantic block sets output by each model are fused. Based on the confidence-weighted fusion of semantic block category labels with overlapping positions, the uncovered areas are cross-completed to generate a complete set of semantic blocks. Directory-related semantic blocks are extracted from the complete set of semantic blocks, wherein the directory-related semantic blocks include the directory titles, and further include:

[0026] For the positional overlap semantic blocks output by each model, a weighted fusion is performed based on the confidence score to determine the final category label;

[0027] For regions not detected by individual models, cross-completion is performed using the detection results of other models;

[0028] Extract directory blocks, directory entries, and directory category information from the complete set of semantic blocks;

[0029] Extract semantic blocks related to table of contents titles, authors, and page numbers.

[0030] In some specific embodiments, characters are obtained through a dual-channel character extraction strategy, the characters are grouped into corresponding semantic blocks, and within each semantic block they are reorganized into logical lines according to reading order. The main text title is then identified from the complete set of semantic blocks. This further includes:

[0031] The document content stream is traversed by the parsing engine to extract the encoding, font attributes, and coordinate information of embedded characters;

[0032] When the parsing engine cannot extract valid characters, the optical character recognition channel is activated to perform recognition within the semantic block boundary area.

[0033] Based on the intersection ratio between the character bounding box and the semantic block coordinate box, a two-level aggregation strategy is used to assign characters to the corresponding semantic blocks;

[0034] Within each semantic block, characters are rearranged in a pre-defined reading direction order to form logical lines.

[0035] In some specific embodiments, a directory layout feature library is constructed based on the directory-related semantic blocks, and the extracted directory title semantic block content is matched with the main text title for similarity, and the matching confidence is calculated, further including:

[0036] Calculate the horizontal alignment type features of the directory semantic blocks, including left alignment, right alignment, justified alignment, and center alignment patterns;

[0037] Extract the font type and font size distribution features of the semantic blocks in the directory;

[0038] The frequency characteristics and arrangement order patterns of the combination of title, author, and page number in the statistical catalog entries;

[0039] Calculate the string similarity between the semantic block text of the table of contents title and the title of the main text, and obtain the matching confidence based on the edit distance algorithm.

[0040] In some specific embodiments, based on the directory layout feature library and the matching confidence, classification errors of directory-related semantic blocks are corrected, directory hierarchy relationships are calculated, a tree-like hierarchical directory structure is generated and output, further including:

[0041] Based on the matching confidence level, the successfully matched directory title semantic blocks are marked as directory entries of the first confidence level;

[0042] Directory entries that have issues such as overlapping locations, crossing column boundaries, missing key information, or overlapping spatial locations are marked as second confidence level directory entries.

[0043] The entries in the second confidence level directory are verified according to the directory layout feature library. Entries that meet the layout features are retained and their confidence levels are adjusted, while those that do not meet the features are removed.

[0044] Based on the confidence level and layout characteristics of the final retained directory entries, the hierarchical inclusion relationship between directory entries and directory categories is calculated, and a tree-like directory structure is constructed.

[0045] Based on the same concept, the present invention also provides a document directory recognition system, comprising:

[0046] The document acquisition and conversion module is configured to acquire the document to be processed and convert the document into an image set page by page in page number order.

[0047] The semantic block set output module is configured to perform multi-model analysis in parallel on each page image. Each model independently divides semantic blocks and identifies the page element types, and outputs a semantic block set.

[0048] The directory-related semantic block extraction module is configured to fuse the semantic block sets output by each model, and based on the confidence-weighted fusion of semantic block category labels with overlapping positions, perform cross-completion on uncovered areas to generate a complete set of semantic blocks, and extract directory-related semantic blocks from the complete set of semantic blocks, wherein the directory-related semantic blocks include the directory titles;

[0049] The dual-channel character extraction module is configured to acquire characters through a dual-channel character extraction strategy, collect the characters into corresponding semantic blocks, reorganize them into logical lines in the reading order within each semantic block, and identify the main text title from the entire set of semantic blocks;

[0050] The matching confidence calculation module is configured to construct a directory layout feature library based on the directory-related semantic blocks, perform similarity matching between the extracted directory title semantic block content and the main text title, and calculate the matching confidence.

[0051] The directory structure output module is configured to correct classification errors of directory-related semantic blocks based on the directory layout feature library and the matching confidence, calculate the directory hierarchy, generate a tree-like hierarchical directory structure, and output it.

[0052] Based on the same concept, the present invention also provides an electronic device, including: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of a document directory recognition method.

[0053] Based on the same concept, the present invention also provides a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of a document directory identification method.

[0054] Compared with existing technologies, its advantages are as follows:

[0055] This invention discloses a document directory recognition method, system, electronic device, and storage medium. Through an architecture that analyzes pages in parallel using multiple models and fuses the output results, it combines the complementary advantages of fine-grained element detection and document layout understanding, thereby improving the completeness of semantic block segmentation and the accuracy of page element type recognition, and enhancing the adaptability to complex document layouts.

[0056] Employing a dual-channel character extraction strategy that combines a PDF parsing engine with optical character recognition, it can adaptively process both native and scanned PDFs. While preserving the accurate layout information of native PDFs, it is also compatible with the character recognition requirements of image documents, thus improving the coverage and coordinate accuracy of character extraction.

[0057] By statistically analyzing the alignment patterns, font attributes, frequency of occurrence, and arrangement order of semantic blocks in the directory, a quantitative directory layout feature library is constructed, providing a reliable prior knowledge base and decision-making basis for subsequent directory entry verification and hierarchical relationship calculation.

[0058] A similarity matching mechanism between the table of contents titles and the main text titles is introduced. By calculating the matching confidence score, a semantic association between the table of contents and the main text content is established, providing an objective judgment standard for the authenticity verification and error correction of the table of contents entries.

[0059] The design incorporates a multi-level post-processing workflow based on a typography feature library and matching confidence levels. This workflow can automatically identify and correct incorrectly categorized directory entries, accurately calculate the hierarchical inclusion relationship between directory entries and columns, and improve the accuracy and completeness of the final output tree-like hierarchical directory structure. Attached Figure Description

[0060] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0061] Figure 1 This is a flowchart illustrating some specific embodiments of the document directory recognition method of the present invention;

[0062] Figure 2 This is one of the flowcharts illustrating another embodiment of the document directory recognition method of the present invention;

[0063] Figure 3 This is a second flowchart illustrating another embodiment of the document directory recognition method of the present invention;

[0064] Figure 4 This is a schematic diagram of the structure of a document directory recognition system according to some specific embodiments of the present invention;

[0065] Figure 5 This is a schematic diagram of the structure of an electronic device according to some specific embodiments of the present invention;

[0066] In the diagram, 710 is the processor; 720 is the memory; 730 is the input device; and 740 is the output device. Detailed Implementation

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

[0068] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “said,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms, and “multiple” generally includes at least two unless the context clearly indicates otherwise.

[0069] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0070] It should be understood that although the terms first, second, third, etc., may be used in the embodiments of this application, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, first may also be referred to as second without departing from the scope of the embodiments of this application, and similarly, second may also be referred to as first.

[0071] Depending on the context, the words “if” or “suppose” as used here can be interpreted as “when” or “in response to determination” or “in response to detection.” Similarly, depending on the context, the phrases “if determination” or “if detection (of the stated condition or event)” can be interpreted as “when determination” or “in response to determination” or “when detection (of the stated condition or event)” or “in response to detection (of the stated condition or event).”

[0072] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the article or device that includes said element.

[0073] It should be noted that any symbols and / or numbers present in the specification that are not marked in the accompanying drawings are not reference numerals.

[0074] Reference Figure 1 A document directory identification method, comprising:

[0075] S101, Obtain the document to be processed, and convert the document into an image set page by page in page number order;

[0076] S102, perform multi-model analysis on each page image in parallel, each model independently divides semantic blocks and identifies page element types, and outputs a set of semantic blocks;

[0077] S103, the semantic block sets output by each model are fused, and the semantic block category labels with overlapping positions are fused based on confidence weighting. The uncovered areas are cross-completed to generate a complete set of semantic blocks. Directory-related semantic blocks are extracted from the complete set of semantic blocks, wherein the directory-related semantic blocks include the directory titles.

[0078] S104, characters are obtained through a dual-channel character extraction strategy, the characters are grouped into corresponding semantic blocks, and logical lines are reorganized in the reading order within each semantic block. The main text title is then identified from the complete set of the semantic blocks.

[0079] S105, construct a directory layout feature library based on the directory-related semantic blocks, perform similarity matching between the extracted directory title semantic block content and the main text title, and calculate the matching confidence.

[0080] S106. Based on the directory layout feature library and the matching confidence, correct the classification errors of the directory-related semantic blocks, calculate the directory hierarchy, generate a tree-like hierarchical directory structure and output it.

[0081] Specifically, in this embodiment of the invention, the document to be processed is converted into a set of digital images page by page in page number order by a document parsing engine; multiple deep learning models are executed in parallel for each page image, and each model independently completes semantic block segmentation and page element type identification, outputting a set of semantic blocks containing coordinate positions, category labels, and confidence scores; the semantic block sets output by each model are fused, and the category labels of overlapping semantic blocks are fused using a confidence-weighted strategy, and the uncovered areas are improved through a cross-completion mechanism to generate a complete set of semantic blocks, from which table of contents-related semantic blocks containing the table of contents title are extracted; a dual-channel character extraction process is initiated, prioritizing the acquisition of embedded characters through the parsing engine. When character information fails to be parsed, the optical character recognition channel is activated. Based on the spatial relationship between characters and semantic blocks, two-level aggregation is performed. Within each semantic block, characters are reorganized into logical lines according to the reading order. At the same time, the main text title is identified from the entire set of semantic blocks. Then, a table of contents layout feature library is constructed based on the statistical alignment pattern, font attributes, frequency of occurrence, and arrangement order features of the table of contents related semantic blocks. The matching confidence is obtained by calculating the string similarity between the table of contents titles and the main text titles. Based on the table of contents layout feature library and the matching confidence, multi-level post-processing is performed to correct the classification errors of the table of contents related semantic blocks, calculate the hierarchical relationship between table of contents entries and columns, generate a tree-like hierarchical table of contents structure with parent-child node relationships, and output it.

[0082] In some applications, the document to be processed is acquired, and the document is converted into an image set page by page in page number order. This includes parsing the page structure of the document and establishing a page sequence according to the natural order of the page numbers; converting each page into a digital image in a preset format while maintaining the original layout; adjusting the image resolution to a preset range; establishing a correspondence between images and page numbers; and generating a complete set containing images of all pages.

[0083] Understandably, the process involves reading the page structure information of the document to be processed through a document parsing interface and establishing a complete page sequence according to the natural order of page numbers. An image conversion engine is then used to convert each page into a digital image in a preset format, preserving the original document's layout features, including text placement, image distribution, and blank space distribution. Image resolution adjustment is then performed to uniformly adjust the resolution of each page image to a preset range to ensure image quality meets subsequent processing requirements. Finally, a precise correspondence is established between the image sequence and the original page numbers, generating a complete image set containing all page images while maintaining the original page number order, providing a complete input data foundation for subsequent processing stages.

[0084] In some applications, multi-model analysis is performed in parallel on each page of images. Each model independently divides semantic blocks and identifies the types of layout elements, outputting a set of semantic blocks. This includes inputting each page of images into multiple deep learning models simultaneously; each model independently performs semantic block detection and outputs the boundary coordinates of the semantic blocks; each model independently identifies the layout element types of the semantic blocks and outputs category labels and corresponding confidence scores; and the semantic block information output by each model is integrated to generate a set of semantic blocks with a unified data structure.

[0085] Understandably, each page's image is simultaneously input into multiple heterogeneous deep learning models for parallel processing; each model independently performs semantic block detection based on its specific network architecture, outputting precise boundary coordinates of the semantic blocks; each model synchronously identifies the layout element types of each semantic block, outputting category labels and corresponding confidence scores, including table of contents blocks, table of contents entries, table of contents columns, table of contents titles, table of contents authors, table of contents page numbers, main text titles, and main text paragraphs; the data integration module performs format unification processing on the semantic block information output by each model, generating a set of semantic blocks with a standardized data structure. This data structure contains three core fields: coordinate position, category label, and confidence score, ensuring seamless integration of subsequent processing steps.

[0086] In some applications, the semantic block sets output by each model are fused. Based on confidence scores, the category labels of overlapping semantic blocks are fused. Uncovered areas are cross-completed to generate a complete set of semantic blocks. Directory-related semantic blocks are extracted from the complete set of semantic blocks. The directory-related semantic blocks include the title of the directory. The overlapping semantic blocks output by each model are weighted and fused based on confidence scores to determine the final category labels. For areas not detected by individual models, cross-completed using the detection results of other models is performed. Directory blocks, directory entries, and directory section information are selected from the completed set of semantic blocks. Semantic block content related to the title of the directory, the author of the directory, and the page number of the directory is extracted.

[0087] Understandably, confidence analysis is performed on the overlapping semantic blocks output by each model, and a weighted fusion algorithm is used to determine the final category label based on the confidence scores of each semantic block. For document regions that are not detected by individual models, the detection results of other models in these regions are used for cross-completion to ensure the integrity of the page coverage. From the complete set of completed semantic blocks, core structural information such as table of contents blocks, table of contents entries, and table of contents columns are selected based on predefined table of contents features. From these table of contents-related semantic blocks, the semantic block content of three key elements—table of contents title, table of contents author, and table of contents page number—is accurately extracted to provide dedicated input data for subsequent character extraction and typesetting feature analysis.

[0088] In some applications, characters are obtained through a dual-channel character extraction strategy, grouped into corresponding semantic blocks, and reorganized into logical lines in reading order within each semantic block. The main text title is identified from the entire set of semantic blocks, including traversing the document content stream through a parsing engine to extract the encoding, font attributes, and coordinate information of embedded characters. When the parsing engine cannot extract valid characters, the optical character recognition channel is activated to perform recognition within the semantic block boundary area. Based on the intersection ratio between the character bounding box and the semantic block coordinate box, a two-level grouping strategy is used to assign characters to corresponding semantic blocks. Within each semantic block, characters are reorganized into logical lines according to a preset reading direction order.

[0089] Understandably, the parsing engine traverses the document content stream to fully extract the encoding information, font attributes, and precise coordinate positions of embedded characters. When the parsing engine cannot obtain valid character content, it automatically activates the optical character recognition channel to perform recognition operations within the boundary areas of the divided semantic blocks. Based on the spatial relationship between the character bounding box and the semantic block coordinate box, a two-level aggregation strategy is used to allocate characters. Characters with an intersection ratio higher than a preset threshold are directly allocated to the corresponding semantic blocks, and the remaining characters are allocated to the corresponding semantic blocks according to the principle of maximum intersection ratio. Within each semantic block, the character sequence is reorganized according to the reading direction from left to right and from top to bottom to form logical lines that conform to reading habits. At the same time, the main text title elements are identified from the complete set of semantic blocks based on page layout features and text features, providing a basis for comparison in subsequent similarity matching.

[0090] In some applications, a table of contents layout feature library is constructed based on the table of contents related semantic blocks. The extracted table of contents title semantic block content is matched with the main text title for similarity, and the matching confidence is calculated. This includes calculating the horizontal alignment type features of the table of contents semantic blocks, including left alignment, right alignment, justified alignment, and center alignment modes; extracting the font type and font size distribution features of the table of contents semantic blocks; statistically analyzing the frequency features and arrangement order of the combination of title, author, and page number in the table of contents entries; calculating the string similarity between the table of contents title semantic block text and the main text title; and obtaining the matching confidence based on the edit distance algorithm.

[0091] Understandably, by analyzing the spatial relationships of semantic blocks in the directory, horizontal alignment type features are calculated, including identifying four basic patterns: left alignment, right alignment, justified alignment, and center alignment, and their distribution patterns. Simultaneously, font type and font size features of the semantic blocks are extracted to establish a statistical model of font and font size distribution. Furthermore, the frequency of combinations of the three elements—title, author, and page number—in the directory entries and their arrangement within the entries are statistically analyzed. In the similarity matching stage, the string similarity between the directory title semantic block text and the main text title text is calculated. The degree of difference between the two strings is measured based on the edit distance algorithm, and the similarity calculation result is quantified into a matching confidence level, providing a quantitative basis for subsequent directory entry verification.

[0092] In some applications, based on the directory layout feature library and the matching confidence level, classification errors of directory-related semantic blocks are corrected, directory hierarchy relationships are calculated, and a tree-like hierarchical directory structure is generated and output. This includes marking successfully matched directory title semantic blocks as first-confidence-level directory entries based on the matching confidence level; marking directory entries with positional overlap, crossing column boundaries, missing key information, or spatial overlap as second-confidence-level directory entries; verifying second-confidence-level directory entries according to the directory layout feature library, retaining entries that conform to the layout features and adjusting their confidence levels, and removing those that do not conform; and calculating the hierarchical inclusion relationship between directory entries and directory categories based on the confidence level and layout features of the finally retained directory entries, thus constructing a tree-like directory structure.

[0093] Understandably, based on the matching confidence level, successfully matched semantic blocks of directory titles are marked as first-confidence-level directory entries; directory entries with issues such as overlapping position coordinates, spanning multiple column boundaries, missing key title information, or spatial overlap are marked as second-confidence-level directory entries; second-confidence-level directory entries are verified according to the directory layout feature library, and entries that conform to preset font features, alignment patterns, frequency of occurrence, and arrangement order features are retained and their confidence scores are adjusted accordingly, while entries that do not conform to preset layout features are removed; based on the confidence scores and layout feature parameters of the finally retained directory entries, the hierarchical inclusion relationship between directory entries and directory sections is calculated by analyzing the spatial position relationship, font hierarchy differences, and logical inclusion relationship between directory entries and directory sections, and finally a tree-like hierarchical directory structure with a clear parent-child node relationship is constructed and structured data in a standardized format is output.

[0094] The following is combined Figure 2 and Figure 3 Another embodiment of the document directory recognition method of the present invention is described below:

[0095] This embodiment includes:

[0096] The process involves converting each page of a PDF document into an image set; analyzing pages in parallel using multiple models and independently dividing them into semantic blocks; fusing the results of multiple models and extracting table of contents information; extracting characters through dual channels and recombining them into logical lines; generating a table of contents layout feature library based on statistical layout features; calculating confidence scores by matching the similarity between table of contents titles and main text titles; correcting errors and calculating hierarchical relationships based on the feature library and confidence scores; and generating and outputting a tree-like hierarchical table of contents structure.

[0097] In this embodiment, multi-model parallel analysis of the page and independent division of semantic blocks means: multi-model analysis is performed in parallel on each page image. Each model takes the image as input, independently divides the semantic blocks and identifies the page element types, and outputs a homogeneous semantic block data structure. This structure includes coordinate position, category label and confidence score. Heterogeneous deep learning models are used to improve detection robustness.

[0098] In this embodiment, fusing the results of multiple models and extracting catalog-related information means: for the positional overlapping semantic blocks output by each model, the category labels are fused based on confidence weighting, cross-completion is performed on the areas not covered by individual models, a complete set of semantic blocks is generated, and catalog blocks, catalog entries, catalog columns, catalog titles, catalog authors, and catalog page numbers are extracted from this complete set.

[0099] In this embodiment, dual-channel character extraction and recombination into logical lines refers to: the first channel calling the PDF parsing engine to traverse the content stream and extract the encoding, font, and precise coordinates of the embedded characters; the second channel activating when the first channel has no valid output, performing OCR recognition according to the semantic block boundaries; and the characters from both channels being recombinated in two levels according to the intersection ratio between their bounding boxes and the semantic block coordinate boxes. In the first level, characters with an intersection ratio higher than a preset threshold are determined to belong to the corresponding semantic block. In the second level, the remaining characters are allocated according to the principle of maximizing the intersection ratio, and recombined into logical lines in each semantic block according to the reading order.

[0100] In this embodiment, the statistical typesetting feature generation of the table of contents typesetting feature library refers to the following: the generated table of contents typesetting feature library includes: horizontal alignment type features, obtained by calculating the distribution of left / right / two-sided / center alignment patterns of the table of contents semantic blocks; font and font size features, constructed by extracting the font type and font size distribution of the table of contents semantic blocks; table of contents item occurrence frequency features, which count the frequency of combination patterns of article titles, authors, and page numbers contained in table of contents items on different pages; and table of contents occurrence order features, which record the arrangement order of article titles, authors, and page numbers within table of contents items.

[0101] In this embodiment, the confidence score for similarity matching between the table of contents title and the main text title refers to: calculating the string similarity between the semantic block text of the table of contents title and the section title of the main text. This similarity is based on edit distance. The string similarity is used as the matching confidence score to establish a mapping relationship between the semantic block of the table of contents title and the title, thereby realizing the semantic association between the table of contents and the main text.

[0102] In this embodiment, the error correction and hierarchical relationship calculation based on the feature library and confidence level refers to the following steps: The first sub-step marks the successfully matched semantic blocks of the table of contents titles as high-confidence table of contents entries based on the matching confidence level; the second sub-step marks entries with overlapping table of contents frames, entries that cross column boundaries in double-column tables of contents, entries that lack key title information, and entries with overlapping spatial positions as low-confidence entries; the third sub-step analyzes the low-confidence entries based on the layout feature library, retains those that meet the font, alignment, frequency, and order features and lowers their confidence level, and deletes those that do not meet the features; the fourth sub-step calculates the hierarchical relationship between the table of contents entries and the table of contents columns based on the final confidence level and layout features of the retained entries.

[0103] In this embodiment, generating a tree-like hierarchical directory structure means that the generated tree-like hierarchical directory structure is a nested data structure in memory, with column nodes as parent nodes recursively containing child column nodes or directory entry nodes, and directory entry nodes as final-level nodes storing key-value pairs of article title, author, and printing page number, supporting multi-level nested columns or flat structure output without columns.

[0104] The following description of this embodiment is based on the cited scenario:

[0105] like Figure 2 As shown, the PDF document is converted into an image set page by page: using a PDF parsing engine, images are extracted from the PDF on a page-by-page basis to generate an image set. The parsing engine used in this application example is MuPDF.

[0106] Multi-model parallel analysis of the page and independent division of semantic blocks: Each model takes an image as input, independently performs semantic block division and page element type recognition, and outputs an isomorphic semantic block data structure, which includes coordinate position, category label and confidence level.

[0107] like Figure 3 As shown, this embodiment uses a dual-model approach, employing both a fine-grained element detection model and a document layout understanding model. The model was fine-tuned by annotating 15,805 PDFs, totaling 111,241 pages. The model outputs semantic block results.

[0108] The results of multiple models are fused and directory-related information is extracted: Category labels are fused based on confidence weights for overlapping semantic blocks output by each model; cross-completion is performed for areas not covered by individual models to generate a complete set of semantic blocks. In the directory recognition scenario, directory blocks, entries, sections, titles, authors, and page numbers related to the directory are selected and used from this complete set of semantic blocks.

[0109] In this embodiment, a primary-secondary fusion strategy is adopted: the refined output of the fine-grained element detection model is the primary driver, while the global analysis of the document layout understanding model is the auxiliary driver. Specifically, when the detection results of the two models for the same semantic block are consistent, the final confidence is improved through a confidence-weighted fusion mechanism; when the detection results are inconsistent, the semantic block information of the document layout understanding model is introduced to supplement, verify, and correct the local detection results of the fine-grained element detection model, thereby fully leveraging the complementary advantages of the two models and improving the overall recognition accuracy.

[0110] The system employs a dual-channel approach to extract characters and reassemble them into logical lines: The first channel uses a PDF parsing engine to traverse the content stream and extract the encoding, font, and precise coordinates of embedded characters; the second channel activates when the first channel has no valid output and performs OCR recognition based on semantic block boundaries. Characters from both channels are then grouped in two levels based on the intersection ratio between their bounding boxes and semantic block coordinate frames. In the first level, characters with an intersection ratio higher than a preset threshold are identified as belonging to their corresponding semantic blocks. In the second level, remaining characters that were not grouped are assigned to intersecting semantic blocks based on the principle of maximizing the intersection ratio, ensuring no character is omitted. Finally, within each semantic block, characters are reassembled into logical lines according to the reading order, achieving both compatibility and accuracy in character extraction.

[0111] A table of contents layout feature library is generated by statistically analyzing four key features from identified semantic blocks related to the table of contents: horizontal alignment type features, obtained by calculating the distribution of left / right / justified / center alignment patterns; font and size features, constructed by extracting the distribution of font type and size; frequency of table of contents entries, statistically analyzing the frequency of combinations of article titles, authors, and page numbers in table of contents entries across different pages; and order of table of contents entries, recording the arrangement pattern of article titles, authors, and page numbers within table of contents entries. This feature library quantifies and models prior knowledge of table of contents layout, providing a basis for decision-making in subsequent validation.

[0112] Similarity matching and confidence calculation of table of contents titles and main text titles: The extracted semantic block content of the table of contents titles is matched with the PDF main text titles for string similarity: The edit distance similarity between the semantic block text of the table of contents titles and the main text section titles is calculated, and this similarity is used as the matching confidence score to establish the mapping relationship between the semantic block of the table of contents titles and the titles, so as to realize the semantic association between the table of contents and the main text content.

[0113] Correcting errors and calculating hierarchical relationships based on feature library and confidence level: Four-level post-processing operations are performed based on the typesetting feature library and matching confidence level: First, based on matching confidence level, successfully matched table of contents title semantic blocks are marked as high-confidence table of contents entries; Second, table of contents entries with overlapping table of contents frames, entries spanning column boundaries in double-column tables of contents, missing key title information, or overlapping spatial positions are marked as low-confidence entries; Third, low-confidence table of contents entries are validated based on the typesetting feature library, retaining those that meet font, alignment, frequency, and order features and lowering their confidence level, while deleting those that do not; Fourth, based on the final confidence level and typesetting features of the retained entries, the hierarchical relationship between table of contents entries and table of contents sections is calculated, achieving automatic correction of classification errors and accurate calculation of hierarchical structure.

[0114] Generate and output a tree-like hierarchical directory structure: Based on the optimized semantic blocks and their classification results, a tree-like hierarchical directory structure is generated. This structure is a nested data structure in memory, supporting multi-level nested categories or a flat structure without categories: category nodes recursively contain child categories or directory entries as parent nodes; directory entry nodes are the last-level nodes, storing key-value pairs of article title, author, and printing page number. The final output format can be flexibly adapted to JSON, XML, or custom tree structures to meet diverse application needs.

[0115] For the purpose of simplicity, the method steps disclosed in the above embodiments are described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0116] like Figure 4 As shown, the present invention also provides a document directory recognition system, comprising:

[0117] The document acquisition and conversion module 201 is configured to acquire the document to be processed and convert the document into an image set page by page in page number order.

[0118] The semantic block set output module 202 is configured to perform multi-model analysis in parallel on each page image. Each model independently divides semantic blocks and identifies the page element type, and outputs a semantic block set.

[0119] The directory-related semantic block extraction module 203 is configured to perform fusion processing on the semantic block sets output by each model, and perform cross-completion on the uncovered areas based on the confidence-weighted fusion of semantic block category labels with overlapping positions to generate a complete set of semantic blocks. The directory-related semantic blocks are extracted from the complete set of semantic blocks, wherein the directory-related semantic blocks include the directory titles.

[0120] The dual-channel character extraction module 204 is configured to acquire characters through a dual-channel character extraction strategy, collect the characters into corresponding semantic blocks, reorganize them into logical lines in the reading order within each semantic block, and identify the main text title from the entire set of semantic blocks;

[0121] The matching confidence calculation module 205 is configured to construct a directory layout feature library based on the directory-related semantic blocks, perform similarity matching between the extracted directory title semantic block content and the main text title, and calculate the matching confidence.

[0122] The directory structure output module 206 is configured to correct classification errors of directory-related semantic blocks, calculate directory hierarchy relationships, generate a tree-like hierarchical directory structure, and output it based on the directory layout feature library and the matching confidence.

[0123] It is worth noting that although only some basic functional modules are disclosed in the embodiments of this invention, it does not mean that the composition of this system is limited to the above-mentioned basic functional modules. On the contrary, what this embodiment intends to express is that, based on the above-mentioned basic functional modules, those skilled in the art can arbitrarily add one or more functional modules in combination with existing technology to form an infinite number of embodiments or technical solutions. That is to say, this system is open rather than closed. The fact that this embodiment only discloses a few basic functional modules should not be considered as the scope of protection of the claims of this invention being limited to the disclosed basic functional modules. At the same time, for the convenience of description, the above device is described separately according to its functions as various units and modules. Of course, in implementing this invention, the functions of each unit and module can be implemented in one or more software and / or hardware.

[0124] like Figure 5 As shown, the present invention also provides an electronic device, including: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of a document directory recognition method.

[0125] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. For example... Figure 5The structure shown in this embodiment of the invention includes an electronic device comprising one or more processors 710 and a memory 720; the processors 710 in this electronic device may be one or more. Figure 5 Taking a processor 710 as an example; a memory 720 is used to store one or more programs; the one or more programs are executed by the one or more processors 710, so that the one or more processors 710 implement a document directory recognition method as described in any one of the embodiments of the present invention.

[0126] The electronic device may also include an input device 730 and an output device 740.

[0127] The processor 710, memory 720, input device 730, and output device 740 in this electronic device can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.

[0128] The memory 720 in this electronic device serves as a computer-readable storage medium, capable of storing one or more programs. These programs can be software programs, computer-executable programs, or modules, such as the program instructions / modules corresponding to the document directory recognition method provided in this embodiment of the invention. The processor 710 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the memory 720, thereby implementing the document directory recognition method described in the above embodiment.

[0129] The memory 720 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 720 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 720 may further include memory remotely located relative to the processor 710, which can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0130] Input device 730 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the electronic device. Output device 740 may include display devices such as a display screen.

[0131] The present invention also provides a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of a document directory identification method.

[0132] Specifically, the computer storage medium in this embodiment of the invention can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be—but is not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A document directory recognition method, characterized in that, include: Obtain the document to be processed, and convert the document into an image set page by page in page number order; Multi-model analysis is performed in parallel on each page of images. Each model independently divides semantic blocks and identifies the types of page elements, and outputs a set of semantic blocks. The semantic block sets output by each model are fused. Based on the confidence weighted fusion of semantic block category labels with overlapping positions, the uncovered areas are cross-completed to generate a complete set of semantic blocks. Directory-related semantic blocks are extracted from the complete set of semantic blocks, wherein the directory-related semantic blocks include the directory titles. Characters are obtained through a dual-channel character extraction strategy, and the characters are grouped into corresponding semantic blocks. Within each semantic block, they are reorganized into logical lines according to the reading order, and the main text title is identified from the entire set of semantic blocks. A table of contents layout feature library is constructed based on the aforementioned table of contents related semantic blocks. The extracted table of contents title semantic block content is matched with the main text title for similarity, and the matching confidence is calculated. Based on the directory layout feature library and the matching confidence, the classification errors of the directory-related semantic blocks are corrected, the directory hierarchy is calculated, a tree-like hierarchical directory structure is generated and output.

2. The document directory recognition method according to claim 1, characterized in that, Obtain the document to be processed, and convert the document into an image set page by page in page number order, further including: Analyze the document's page structure and establish a page sequence according to the natural order of page numbers; Each page is converted into a digital image in a preset format, while maintaining the original layout. Adjust the image resolution to a preset value range; Establish the correspondence between images and page numbers, and generate a complete set containing images for all pages.

3. The document directory recognition method according to claim 1, characterized in that, Multi-model analysis is performed in parallel on each page of images. Each model independently divides semantic blocks and identifies the types of layout elements, outputting a set of semantic blocks, which further includes: Each page of images is simultaneously fed into multiple deep learning models; Each model independently performs semantic block detection and outputs the boundary coordinates of the semantic blocks. Each model independently identifies the layout element type of the semantic block and outputs the category label and the corresponding confidence score; Integrate the semantic block information output by each model to generate a set of semantic blocks with a unified data structure.

4. The document directory recognition method according to claim 1, characterized in that, The semantic block sets output by each model are fused. Based on the confidence-weighted fusion of semantic block category labels with overlapping positions, cross-completion is performed on uncovered areas to generate a complete semantic block set. Directory-related semantic blocks are extracted from this complete set, wherein the directory-related semantic blocks include directory titles, and further include: For the positional overlap semantic blocks output by each model, a weighted fusion is performed based on the confidence score to determine the final category label; For regions not detected by individual models, cross-completion is performed using the detection results of other models; Extract directory blocks, directory entries, and directory category information from the complete set of semantic blocks; Extract semantic blocks related to table of contents titles, authors, and page numbers.

5. The document directory recognition method according to claim 1, characterized in that, Characters are obtained through a dual-channel character extraction strategy, grouped into corresponding semantic blocks, and reorganized into logical lines according to reading order within each semantic block. The main text title is then identified from the complete set of semantic blocks. Further steps include: The document content stream is traversed by the parsing engine to extract the encoding, font attributes, and coordinate information of embedded characters; When the parsing engine cannot extract valid characters, the optical character recognition channel is activated to perform recognition within the semantic block boundary area. Based on the intersection ratio between the character bounding box and the semantic block coordinate box, a two-level aggregation strategy is used to assign characters to the corresponding semantic blocks; Within each semantic block, characters are rearranged in a pre-defined reading direction order to form logical lines.

6. The document directory recognition method according to claim 1, characterized in that, Based on the aforementioned table of contents-related semantic blocks, a table of contents layout feature library is constructed. The extracted table of contents title semantic block content is then matched with the main text titles for similarity, and the matching confidence score is calculated. This further includes: Calculate the horizontal alignment type features of the directory semantic blocks, including left alignment, right alignment, justified alignment, and center alignment patterns; Extract the font type and font size distribution features of the semantic blocks in the directory; The frequency characteristics and arrangement order patterns of the combination of title, author, and page number in the statistical catalog entries; Calculate the string similarity between the semantic block text of the table of contents title and the title of the main text, and obtain the matching confidence based on the edit distance algorithm.

7. The document directory recognition method according to claim 1, characterized in that, Based on the directory layout feature library and the matching confidence score, the classification errors of directory-related semantic blocks are corrected, the directory hierarchy is calculated, a tree-like hierarchical directory structure is generated and output, and the process further includes: Based on the matching confidence level, the successfully matched directory title semantic blocks are marked as directory entries of the first confidence level; Directory entries that have issues such as overlapping locations, crossing column boundaries, missing key information, or overlapping spatial locations are marked as second confidence level directory entries. The entries in the second confidence level directory are verified according to the directory layout feature library. Entries that meet the layout features are retained and their confidence levels are adjusted, while those that do not meet the features are removed. Based on the confidence level and layout characteristics of the final retained directory entries, the hierarchical inclusion relationship between directory entries and directory categories is calculated, and a tree-like directory structure is constructed.

8. A document directory recognition system, characterized in that, include: The document acquisition and conversion module is configured to acquire the document to be processed and convert the document into an image set page by page in page number order. The semantic block set output module is configured to perform multi-model analysis in parallel on each page image. Each model independently divides semantic blocks and identifies the page element types, and outputs a semantic block set. The directory-related semantic block extraction module is configured to fuse the semantic block sets output by each model, and based on the confidence-weighted fusion of semantic block category labels with overlapping positions, perform cross-completion on uncovered areas to generate a complete set of semantic blocks, and extract directory-related semantic blocks from the complete set of semantic blocks, wherein the directory-related semantic blocks include the directory titles; The dual-channel character extraction module is configured to acquire characters through a dual-channel character extraction strategy, collect the characters into corresponding semantic blocks, reorganize them into logical lines in the reading order within each semantic block, and identify the main text title from the entire set of semantic blocks; The matching confidence calculation module is configured to construct a directory layout feature library based on the directory-related semantic blocks, perform similarity matching between the extracted directory title semantic block content and the main text title, and calculate the matching confidence. The directory structure output module is configured to correct classification errors of directory-related semantic blocks based on the directory layout feature library and the matching confidence, calculate the directory hierarchy, generate a tree-like hierarchical directory structure, and output it.

9. An electronic device, characterized in that, include: The system includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the method according to any one of claims 1 to 7.