Electronic book directory recognition and reconstruction method and system based on large language model and storage medium
By using multimodal feature fusion based on a large language model and the Transformer model, an e-book catalog tree is dynamically constructed, solving the problems of insufficient recognition accuracy and poor compatibility in existing technologies, and realizing intelligent e-book catalog recognition and reconstruction.
Patent Information
- Application Number
- CN202511707216.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-02-17
AI Technical Summary
Existing technologies have insufficient accuracy in recognizing complex layouts, mixed text and graphics, and non-standard structured e-book catalogs. They cannot dynamically handle hierarchical relationships, have poor generalization ability, require manual verification, and have poor compatibility.
We employ a large language model-based approach, dynamically constructing an ebook catalog tree through multimodal feature fusion and a Transformer model. We utilize cross-attention and self-attention mechanisms to understand the contextual dependencies between titles and generate a structured catalog.
It achieves intelligent recognition and reconstruction of complex e-book catalogs, improves recognition accuracy and adaptability, reduces the need for manual verification, and generates a reasonable and robust catalog structure.
Smart Images

Figure CN121543583A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of catalog recognition, specifically relating to an e-book catalog recognition and reconstruction method, system, and storage medium based on a large language model. Background Technology
[0002] Automated identification of e-book catalogs is a core requirement for digital publishing and knowledge retrieval. Existing technologies (such as Adobe Acrobat and Calibre) often rely on preset templates or simple rules, which have the following drawbacks: PDF recognition accuracy is insufficient: Traditional OCR technology has a high error rate in recognizing e-book tables of contents with complex layouts (multi-column, mixed text and images, scanned documents), and cannot distinguish between the main text and the table of contents. Secondly, it cannot perform dynamic processing, for example, it cannot dynamically correct hierarchical relationships based on context (such as "1.1.1" being mistakenly labeled as "1.1").
[0003] Semantic understanding is lacking: Existing technologies rely on fixed rules (such as page number matching and title formatting), making it difficult to handle non-standard directory structures (such as no page numbers and chaotic hierarchical nesting), resulting in poor compatibility. For example, they cannot adapt to unstructured e-books such as academic papers and ancient books.
[0004] Poor generalization ability: It performs poorly in extracting catalogs from cross-language (mixed Chinese and English), multi-font, and low-quality scanned documents, requiring manual secondary verification, manual annotation of catalog areas, or correction of recognition errors. Summary of the Invention
[0005] The purpose of this invention is to provide an electronic book catalog recognition and reconstruction method, system and storage medium based on a large language model, which aims to achieve intelligent recognition and reconstruction of electronic book catalog structures.
[0006] This invention is mainly achieved through the following technical solutions: An eBook catalog recognition and reconstruction method based on a large language model includes the following steps: Step S1: Based on the original PDF ebook, perform multimodal parsing of the PDF document, filter out candidate title items, construct a multimodal feature vector for each candidate title item, and construct a candidate title sequence based on the reading order of the original document; The multimodal feature vector includes text semantic features, visual style features, and structural pattern features; the visual style features include font attributes and layout features, and the structural pattern features include numbering patterns and special symbols. Step S2: Multimodal feature fusion; For the multimodal feature vector of each candidate title item in the candidate title sequence, based on cross attention, the text semantic features, visual style features and structural pattern features are fused by hierarchical attention. Step S3: Input the fused candidate title sequence from step S2 into the large language model to semantically understand the contextual dependencies between titles, perform hierarchical prediction on the candidate title sequence, and obtain the hierarchical sequence; Step S4: Based on the hierarchical sequence predicted in step S3, dynamically construct a directory tree using a stack data structure; Step S5: Output a structured directory.
[0007] To better realize the present invention, step S1 further includes the following steps: Step S11: Extract text blocks of all table of contents items from the original PDF ebook; Step S12: For each text block, extract and construct a multimodal feature vector; (1) Extracting semantic features of the text: The BERT model is used to obtain the deep semantic representation of the text and output a 768-dimensional semantic vector T_semantic; (2) Extract visual style features: Extract font attributes and layout features, and encode them into 4-dimensional vectors V_font and V_layout respectively; the font attributes include font size, font weight and font style, and the layout features include horizontal indentation distance, vertical position and text block width and height; (3) Extract structural pattern features: identify numbering patterns and detect special symbols, and encode them as one-hot vector S_pattern and 3-dimensional vector S_symbol; Step S13: Calculate the directory confidence based on the text semantic features, visual style features, and structural pattern features of the text blocks; based on the set dynamic threshold, filter out non-directory content and retain text blocks with high confidence as candidate title items; Step S14: Arrange all candidate headings in the natural reading order in which they appear in the PDF eBook to form a candidate heading sequence.
[0008] To better realize the present invention, step S2 further includes the following steps: Step S21: Feature vector construction; Align textual semantic features with visual style features; then, use a projection layer to map textual semantic features, visual style features, and structural pattern features to a unified semantic space; Step S22: Cross-modal attention fusion; A cross-attention mechanism is used to calculate the interaction weights between text semantic features and visual style features; The contribution of text semantic features, visual style features, and structural pattern features is dynamically adjusted through gated fusion units; Generate a unified multimodal feature representation.
[0009] To better implement this invention, further, in step S3, based on the Transformer large model, hierarchical prediction of the candidate title sequence is performed, including the following steps: Step S31: Enhance sequence coding; (1) Input the fused candidate title sequence from step S2 into the Transformer encoder; (2) Add location encoding and page encoding to enhance contextual understanding; (3) Establish global dependencies between titles based on the self-attention mechanism; Step S32: Multi-task joint prediction; Hierarchical classification task: Take the context vector of each title item output by the Transformer encoder, pass it through a classification layer, and output the predicted hierarchy of each title item, predicting the hierarchical label of each title; Relationship prediction task: Calculate the probability of parent-child relationships between titles; Continuity verification task: Check the continuity of numbering and structural integrity; Step S33: Gathering contextual evidence; Analyze the semantic similarity of adjacent headings; Check for consistency in visual style; Verify the logical consistency of the structure numbering.
[0010] To better realize the present invention, step S4 further includes the following steps: Step S41: Initialize the root node and empty stack structure; Step S42: Traverse the titles of each prediction level in sequence, dynamically adjust the stack state, and build parent-child relationships; If the current title is more hierarchical than the top title, then the current title is added to the stack as a child node of the top title. When the level of the current title is equal to or shallower than the level of the top title, elements are continuously popped from the stack until the level of the top title is shallower than the current title; then, the current title is added to the stack as a sibling node of the top title.
[0011] To better implement the present invention, step S4 further includes: Step S43: Dynamic hierarchical adjustment mechanism, hierarchical smoothing; (1) When high semantic similarity is detected but inconsistent levels are detected, level correction is performed to ensure the gradual nature of level changes; (2) When the visual style is consistent but the prediction level is different, adjust the isolated level outliers and unify the level labels; (3) Constrain the hierarchical jump range, eliminate abnormal hierarchical jumps, and avoid abnormal structures; Step S44: Optimize parent node selection; (1) Select the most suitable parent node based on the probability of parent-child relationship; (2) Perform semantic relevance and visual consistency correction; verify the semantic relevance between sibling nodes, check the logical inclusion relationship between parent and child nodes, and ensure the semantic rationality of the directory structure; (3) For directories that do not have obvious numbers but are distinguished by indentation or font, the correct parent-child relationship is inferred based on the style pattern learned by the Transformer large model to ensure the overall structure of the directory tree is reasonable.
[0012] To better implement the present invention, step S4 further includes step S45: structural integrity verification. (1) Check the continuity of the inspection number and identify missing items; (2) Verify the correctness of the page references; (3) Ensure the actual correspondence between the table of contents and the main text.
[0013] To better implement the present invention, step S5 further includes step S51: multi-format directory output: (1) Generate structured directory data in JSON format; (2) Output the standard EPUB NCX directory file; (3) Generate a text table of contents in Markdown format; (4) Provide a visual directory tree diagram.
[0014] This invention is mainly achieved through the following technical solutions: An e-book catalog recognition and reconstruction system based on a large language model is implemented based on the above-mentioned e-book catalog recognition and reconstruction method based on a large language model. It includes a multimodal parsing module, a multimodal feature fusion module, a large language model prediction module, a catalog tree structure construction and optimization module, and a catalog output module arranged from front to back. The multimodal parsing module is used to perform multimodal parsing of PDF documents and process them to obtain a sequence of candidate titles; The multimodal feature fusion module is used to perform hierarchical attention fusion of text semantic features, visual style features and structural pattern features based on cross attention for multimodal feature vectors; The large language model prediction module is used to perform hierarchical prediction on the candidate title sequence based on the large language model to obtain the hierarchical sequence. The directory tree structure construction and optimization module is used to dynamically construct a directory tree based on a stack data structure and perform hierarchical smoothing, semantic coherence checking, and structural integrity verification. The directory output module is used to output a structured directory.
[0015] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method for electronic book catalog recognition and reconstruction based on a large language model.
[0016] The beneficial effects of this invention are as follows: This invention integrates the semantic understanding capabilities of a large language model with multimodal feature parsing of PDFs to achieve end-to-end ebook catalog recognition. Specifically, this invention performs multimodal feature fusion and visualizes the key features through attention weights, automatically adjusting feature importance for different types of ebooks. When a certain feature is missing, other features can still support the decision, demonstrating good interpretability, adaptability, and robustness. Secondly, this invention utilizes the global attention mechanism of Transformer to understand the contextual dependencies between titles, thereby intelligently inferring the hierarchical structure of multi-level catalogs, rather than relying on fixed rule matching. Attached Figure Description
[0017] Figure 1 This is a flowchart of the electronic book catalog recognition and reconstruction method based on a large language model according to the present invention. Detailed Implementation Example 1:
[0018] An eBook catalog recognition and reconstruction method based on a large language model integrates the semantic understanding capabilities of the large language model with PDF multimodal feature parsing to achieve end-to-end eBook catalog recognition. Figure 1 As shown, it includes the following steps: (1) Input the original PDF e-book into the PDF multimodal parsing engine, filter to obtain candidate title items, construct a multimodal feature vector for each candidate title item, and construct a candidate title sequence based on the reading order of the original document; the multimodal feature vector includes text semantic features, visual style features and structural pattern features; 1) Textual semantic features; Extraction method: A pre-trained BERT model is used to obtain a deep semantic representation of the text; where: The input is the original title text (e.g., "1.2 Research Background"). The output is a 768-dimensional semantic vector T_semantic∈R^768.
[0019] 2) Visual style characteristics; a1. Font attributes: Font size (normalized to the 0-1 range); Font weight (binarization: regular / bold); Font styles (italic, underline, etc.); It is encoded as a 4-dimensional vector V_font∈R^4.
[0020] a2. Layout features: Horizontal indentation distance (relative to the left margin of the page); Vertical position (Y coordinate on the page); Text block width and height; Encoded as a 4-dimensional vector V_layout∈R^4.
[0021] 3) Structural pattern characteristics; a1. Numbering Pattern Recognition: Regular expressions can be used to match common numbering patterns (such as "1.1", "Chapter 2", "§3.2"). Extract the numbering hierarchy information; Encoded as a one-hot vector S_pattern∈R^8 (supporting 8 common patterns); a2. Special character detection: Detect special symbols (such as "·", "★", etc.) before and after the title. "); It is encoded as a 3-dimensional vector S_symbol∈R^3.
[0022] (2) Multimodal feature fusion; For the multimodal feature vector of each candidate title item in the candidate title sequence, based on cross attention, the text semantic features, visual style features and structural pattern features are fused by hierarchical attention; 1) Fusion Strategy: Layered Attention Fusion; The input features are: T_semantic (768 dimensions): Text semantics; V_font (4D): Font style; V_layout (4-dimensional): Layout position; S_pattern (8-dimensional): Numbering pattern; S_symbol (3D): Special symbol.
[0023] 2) Fusion process: a1. Low-level feature concatenation: V_low=Concat(V_font, V_layout, S_pattern, S_symbol)∈R^19; a2. Feature projection: V_proj=ReLU(W_l·V_low+b_l)∈R^128; a3. Cross-attention fusion: Query: Q = W_q·T_semantic; Key: K = W_k·V_proj; Value: V = W_v·V_proj; Attention weights: ; Fusion output: F_fused = α·V.
[0024] 4. Residual connection: F_final = LayerNorm(T_semantic + F_fused) ∈ R^768.
[0025] Where: V_low is: low-level feature concatenation vector; R stands for: Real number space representation; V_proj represents the projected visual feature vector. ReLU stands for: Modified Linear Unit Activation Function; Concat is a vector concatenation operation. W_l is: the low-level feature projection weight matrix; b_l represents the low-level feature projection bias term. Q stands for: query vector; W_q represents the query transformation weight matrix; W_k is the key transformation weight matrix; W_v is the value transformation weight matrix; F_final represents the final fused feature vector.
[0026] The above-mentioned technological advantages are: Interpretability: Visualize the key features the model focuses on through attention weights; Adaptability: Automatically adjusts feature importance for different types of ebooks; Robustness: When a certain feature is missing, other features can still support the decision.
[0027] (3) Semantic understanding and hierarchical reasoning of the large language model; The above-fused candidate title sequence is input into the large language model for semantic understanding and hierarchical reasoning; The contextual dependencies between titles are semantically understood, thereby inferring the hierarchical structure of the multi-level directory; (4) Dynamic directory tree construction and optimization; (5) Output: Structured directory (JSON / XML / EPUB).
[0028] Preferably, a Transformer large model is used to perform hierarchical prediction on the candidate title sequence in order to dynamically adjust the directory tree structure. The working principle of the Transformer large model for hierarchical prediction is as follows: The directory recognition problem is transformed into a sequence-to-tree generation problem. Utilizing the global attention mechanism of the Transformer, the contextual dependencies between headings are understood, thereby intelligently inferring the hierarchical structure of multi-level directories, rather than relying on fixed rule matching. Specifically, the steps include: Step 1: Input serialization and representation construction; 1. Generation of candidate title sets; (1) Extract all possible text blocks from the PDF that could be table of contents items, such as "Chapter 1", "1.1 Introduction", "1.2 Background", etc.; (2) For each candidate title, construct a multimodal feature vector, which includes: Text semantic embedding: Obtaining deep semantic representations of title text through models such as BERT; Visual style features: font size, bold, italics, indentation, etc.; Layout position features: (x, y) coordinates on the page, used to determine the order of elements.
[0029] 2. Serializing input: Arrange all candidate titles in their natural reading order in the PDF, forming a sequence: [Item1, Item2, ..., Item...]. n ]; where Item n It is the multimodal feature vector of the nth candidate title.
[0030] Step 2: Encoding and Contextual Understanding of Transformers; (1) The sequence is input into the encoder of the Transformer; (2) The attention mechanism starts working: each title item will perform "attention" calculations with all other title items in the sequence; (3) Key role: For example, when the model is processing "1.2 Background", it will simultaneously pay attention to the preceding "Chapter 1 Introduction" and the following "1.2.1 Historical Development". Through this global perspective, the model can learn: The relationship between "Chapter 1" and "1.1" is that of father and son; "1.1" and "1.2" are siblings; The word "background" should semantically belong to the broader category of "introduction".
[0031] Step 3: Hierarchical prediction and dynamic generation of tree structure; This is the most crucial part; the model makes predictions and decisions for each title item in the sequence.
[0032] 1. Hierarchical Depth Prediction: (1) Pass the context vector of each title item output by the Transformer encoder through a classification layer (such as a fully connected layer + Softmax).
[0033] (2) Output the predicted level of each heading item, such as: Level 0 (non-table of contents), Level 1 (chapter), Level 2 (section), Level 3 (subsection), etc.
[0034] 2. Dynamic tree structure adjustment: The model does not predict the hierarchy of each heading in isolation, but rather performs joint reasoning based on the context of the entire sequence. Its dynamic adjustment capability is reflected in: (1) Correcting isolated errors: If a heading has a font size like Level 2, but based on the semantics and hierarchy of the headings before and after it, it should be more like Level 1, the model will tend to correct it to Level 1.
[0035] (2) Handling missing or abnormal numbers: When there is a jump in numbering (such as going directly from "1.1" to "1.3"), the model can determine whether the numbering is wrong or a section is indeed missing based on the content, and maintain a reasonable hierarchical structure.
[0036] (3) Inferring implicit relationships: For directories that are not explicitly numbered but are distinguished by indentation or font, the model can infer the correct parent-child relationship by learning the style pattern.
[0037] 3. Relationship building: Based on the predicted hierarchical sequence, a stack data structure is used to dynamically construct the directory tree. The algorithm logic can be briefly described as follows: (1) Initialize an empty stack; (2) Iterate through the titles of each predicted level in order: When the current title is more hierarchical than the top title, the current title becomes a child node of the top title and is pushed onto the stack. When the level of the current title is equal to or shallower than the level of the top title, elements are continuously popped from the stack until the level of the top title is shallower than the current title. Then, the current title is added to the stack as a sibling node of the top title (or a child node of a higher-level node).
[0038] Specifically, specific examples are as follows: (1) Input sequence (after feature extraction): ["Chapter 1 Introduction", "1.1 Research Background", "1.2 Research Content", "1.2.1 Technical Route", "Chapter 2 Relevant Theories"]; (2) Model reasoning process: 1) Upon seeing "Chapter 1", it is predicted to be Level 1, and as a child node of the root node, it is pushed onto the stack. Stack: [Chapter 1]; 2) Upon seeing "1.1", its level (Level 2) is deeper than the top of the stack (Level 1), so it becomes a child node of "Chapter 1" and is pushed onto the stack. Stack: [Chapter 1, 1.1]; 3) Upon seeing "1.2", its level (Level 2) is the same as the top of the stack (Level 2). Pop "1.1" from the top of the stack. Now the top of the stack is "Chapter 1" (Level 1). "1.2" becomes a child node of "Chapter 1" and is pushed onto the stack. Stack: [Chapter 1, 1.2]; 4) Upon seeing "1.2.1", its level (Level 3) is deeper than the top of the stack (Level 2), so it becomes a child node of "1.2" and is pushed onto the stack. Stack: [Chapter 1, 1.2, 1.2.1]; 5) Upon seeing "Chapter 2", its level (Level 1) is shallower than the top of the stack (Level 3). Pop these entries continuously until the stack is empty or the top level of the stack is even shallower. Pop "1.2.1", "1.2", and "Chapter 1". Now the stack is empty, and "Chapter 2" is pushed onto the stack as a child node of the new root node.
[0039] (3) The final generated directory tree structure: Chapter 1 Introduction (Level 1); 1.1 Research Background (Level 2); 1.2 Research Content (Level 2); 1.2.1 Technical Approach (Level 3); Chapter 2 Related Theories (Level 1). Example 2:
[0040] An eBook catalog recognition and reconstruction method based on a large language model includes the following steps: Step 1: Multimodal feature extraction from PDF documents; 1. Document structure analysis; Use a PDF parsing library (such as PyMuPDF) to extract text blocks, image blocks, and their coordinate information; Identify the page layout structure, including columns, header, and footer areas; Record the font attributes, position coordinates, and page number of each text block.
[0041] 2. Visual style feature extraction; Calculate the font size, weight, and style characteristics of the text block; Extract layout features such as indentation distance, alignment, and line spacing; Analyze the visual salience of text blocks, such as bolding, centering, and special symbols.
[0042] 3. Extraction of semantic features from text; Use the BERT model to obtain a deep semantic representation of the title text; Identify common heading patterns (numbering patterns, chapter identifiers); Extract keyword features and identify directory-related terms.
[0043] Step 2: Detection and filtering of candidate regions in the catalog; 1. Multimodal scoring mechanism; The confidence score of the directory is calculated by combining textual semantics, visual style, and layout features. Set a dynamic threshold to filter non-table of contents (body text, header and footer). Retain text blocks with high confidence as candidate title items.
[0044] 2. Serialization and sorting processing; Sort the candidate items by page order and vertical position; Construct a sequence of candidate titles while maintaining the original document's reading order; Record the multimodal feature vector of each candidate.
[0045] Step 3: Multimodal feature fusion and encoding; 1. Feature vector construction; Align textual semantic features (768-dimensional BERT vectors) with visual features (19-dimensional vectors such as font and layout); Projection layers are used to map features from different modalities to a unified semantic space.
[0046] 2. Cross-modal attention fusion; A cross-attention mechanism is used to calculate the interaction weights between text and visual features; The contribution of each modal feature is dynamically adjusted through a gated fusion unit. Generate a unified multimodal feature representation (768-dimensional fusion vector).
[0047] Step 4: Hierarchical reasoning based on a large language model; 1. Enhanced sequence coding; The fused feature sequence is input into the Transformer encoder; Adding location encoding and page encoding enhances contextual understanding; Establish global dependencies between titles through a self-attention mechanism.
[0048] 2. Multi-task joint prediction; Hierarchical classification task: Predict the hierarchical label (L1-L4) for each title; Relationship prediction task: Calculate the probability of parent-child relationships between titles; Continuity verification task: Check the continuity of numbering and structural integrity.
[0049] 3. Gathering contextual evidence; Analyze the semantic similarity of adjacent headings; Check the consistency pattern of visual styles; Verify the logical consistency of the structure numbering.
[0050] Step 5: Dynamic directory tree construction; 1. Stack-based tree construction algorithm; Initialize the root node and an empty stack structure; Process each predicted title in sequence; The stack state is dynamically adjusted based on the hierarchical relationship to build parent-child relationships.
[0051] 2. Dynamic hierarchical adjustment mechanism; When high semantic similarity is detected but inconsistent hierarchical levels, hierarchical correction is performed; When visual styles are consistent but prediction levels differ, use unified level labels; Constrain the range of hierarchical jumps to avoid abnormal structures.
[0052] 3. Optimized parent node selection; Select the most suitable parent node based on relationship score; Consider semantic relevance and visual consistency; Ensure the overall structure of the directory tree is reasonable.
[0053] Step 6: Post-processing optimization and verification; 1. Hierarchical smoothing; Eliminate abnormal hierarchical jumps (such as jumping directly from L1 to L3). Adjust isolated hierarchical outliers; Ensure that changes in hierarchy are gradual.
[0054] 2. Semantic coherence check; Verify the semantic correlation between sibling nodes; Check the logical inclusion relationship between parent and child nodes; Ensure the semantic rationality of the directory structure.
[0055] 3. Structural integrity verification; Check the continuity of the inspection numbers and identify missing entries; Verify the correctness of the page references; Ensure that the table of contents corresponds to the actual content.
[0056] Step 7: Generate structured output; 1. Multi-format directory output; Generate structured directory data in JSON format; Output the standard EPUB NCX directory file; Generate a text table of contents in Markdown format; Provides a visual directory tree diagram.
[0057] 2. Metadata appended; Record the table of contents generation time, total number of chapters, and maximum depth; Save confidence scores and quality assessment metrics; Provide version information and processing parameters.
[0058] Step 8: Quality assessment and feedback optimization; 1. Automated quality assessment; Calculate the hierarchical prediction accuracy and structural integrity score; Assess semantic coherence and visual consistency; Generate an overall quality score report.
[0059] 2. User feedback collection; Record user modifications to the generated directory; Analyze common error patterns and correction strategies; Construct an incremental training dataset.
[0060] 3. Continuous model optimization; Fine-tune the prediction model based on user feedback data; Update and dynamically adjust the rule base; Optimize the feature fusion weight parameters.
[0061] Step 9: System Integration and Deployment; 1. API service encapsulation; Provide a RESTful API interface to receive PDF documents; Returns structured directory data; Supports both batch processing and real-time processing modes.
[0062] 2. Performance-optimized configuration; To achieve parallel processing of model inference; Configure GPU to accelerate computing; Optimize memory usage and response time.
[0063] 3. Exception handling mechanism; Fault tolerance mechanism for handling damaged PDF documents; Enhancement processing of low-quality scanned documents; Timeout processing and resource release guarantees.
[0064] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications or equivalent changes made to the above embodiments based on the technical essence of the present invention shall fall within the protection scope of the present invention.
Claims
1. A method for recognizing and reconstructing e-book catalogs based on a large language model, characterized in that, Includes the following steps: Step S1: Based on the original PDF ebook, perform multimodal parsing of the PDF document, filter out candidate title items, construct a multimodal feature vector for each candidate title item, and construct a candidate title sequence based on the reading order of the original document; The multimodal feature vector includes text semantic features, visual style features, and structural pattern features; the visual style features include font attributes and layout features, and the structural pattern features include numbering patterns and special symbols. Step S2: Multimodal feature fusion; For the multimodal feature vector of each candidate title item in the candidate title sequence, based on cross attention, the text semantic features, visual style features and structural pattern features are fused by hierarchical attention. Step S3: Input the fused candidate title sequence from step S2 into the large language model to semantically understand the contextual dependencies between titles, perform hierarchical prediction on the candidate title sequence, and obtain the hierarchical sequence; Step S4: Based on the hierarchical sequence predicted in step S3, dynamically construct a directory tree using a stack data structure; Step S5: Output a structured directory.
2. The method for e-book catalog recognition and reconstruction based on a large language model according to claim 1, characterized in that, Step S1 includes the following steps: Step S11: Extract text blocks of all table of contents items from the original PDF ebook; Step S12: For each text block, extract and construct a multimodal feature vector; (1) Extracting semantic features of the text: The BERT model is used to obtain the deep semantic representation of the text and output a 768-dimensional semantic vector T_semantic; (2) Extract visual style features: Extract font attributes and layout features, and encode them into 4-dimensional vectors V_font and V_layout respectively; the font attributes include font size, font weight and font style, and the layout features include horizontal indentation distance, vertical position and text block width and height; (3) Extract structural pattern features: identify numbering patterns and detect special symbols, and encode them as one-hot vector S_pattern and 3-dimensional vector S_symbol; Step S13: Calculate the directory confidence based on the text semantic features, visual style features, and structural pattern features of the text blocks; based on the set dynamic threshold, filter out non-directory content and retain text blocks with high confidence as candidate title items; Step S14: Arrange all candidate headings in the natural reading order in which they appear in the PDF eBook to form a candidate heading sequence.
3. The method for e-book catalog recognition and reconstruction based on a large language model according to claim 1, characterized in that, Step S2 includes the following steps: Step S21: Feature vector construction; Align textual semantic features with visual style features; then, use a projection layer to map textual semantic features, visual style features, and structural pattern features to a unified semantic space; Step S22: Cross-modal attention fusion; A cross-attention mechanism is used to calculate the interaction weights between text semantic features and visual style features; The contribution of text semantic features, visual style features, and structural pattern features is dynamically adjusted through gated fusion units; Generate a unified multimodal feature representation.
4. The method for e-book catalog recognition and reconstruction based on a large language model according to claim 1, characterized in that, In step S3, based on the Transformer large model, hierarchical prediction of the candidate title sequence is performed, including the following steps: Step S31: Enhance sequence coding; (1) Input the fused candidate title sequence from step S2 into the Transformer encoder; (2) Add location encoding and page encoding to enhance contextual understanding; (3) Establish global dependencies between titles based on the self-attention mechanism; Step S32: Multi-task joint prediction; Hierarchical classification task: Take the context vector of each title item output by the Transformer encoder, pass it through a classification layer, and output the predicted hierarchy of each title item, predicting the hierarchical label of each title; Relationship prediction task: Calculate the probability of parent-child relationships between titles; Continuity verification task: Check the continuity of numbering and structural integrity; Step S33: Gathering contextual evidence; Analyze the semantic similarity of adjacent headings; Check for consistency in visual style; Verify the logical consistency of the structure numbering.
5. The method for e-book catalog recognition and reconstruction based on a large language model according to claim 1 or 4, characterized in that, Step S4 includes the following steps: Step S41: Initialize the root node and empty stack structure; Step S42: Traverse the titles of each prediction level in sequence, dynamically adjust the stack state, and build parent-child relationships; If the current title is more hierarchical than the top title, then the current title is added to the stack as a child node of the top title. When the level of the current title is equal to or shallower than the level of the top title, elements are continuously popped from the stack until the level of the top title is shallower than the current title; then, the current title is added to the stack as a sibling node of the top title.
6. The method for e-book catalog recognition and reconstruction based on a large language model according to claim 5, characterized in that, Step S4 further includes: Step S43: Dynamic hierarchical adjustment mechanism, hierarchical smoothing; (1) When high semantic similarity is detected but inconsistent levels are detected, level correction is performed to ensure the gradual nature of level changes; (2) When the visual style is consistent but the prediction level is different, adjust the isolated level outliers and unify the level labels; (3) Constrain the hierarchical jump range, eliminate abnormal hierarchical jumps, and avoid abnormal structures; Step S44: Optimize parent node selection; (1) Select the most suitable parent node based on the probability of parent-child relationship; (2) Perform semantic relevance and visual consistency correction; verify the semantic relevance between sibling nodes, check the logical inclusion relationship between parent and child nodes, and ensure the semantic rationality of the directory structure; (3) For directories that do not have obvious numbers but are distinguished by indentation or font, the correct parent-child relationship is inferred based on the style pattern learned by the Transformer large model to ensure the overall structure of the directory tree is reasonable.
7. The method for e-book catalog recognition and reconstruction based on a large language model according to claim 6, characterized in that, Step S4 further includes step S45: Structural integrity verification. (1) Check the continuity of the inspection number and identify missing items; (2) Verify the correctness of the page references; (3) Ensure the actual correspondence between the table of contents and the main text.
8. The method for e-book catalog recognition and reconstruction based on a large language model according to claim 1, characterized in that, Step S5 includes step S51: Multi-format directory output: (1) Generate structured directory data in JSON format; (2) Output the standard EPUB NCX directory file; (3) Generate a text table of contents in Markdown format; (4) Provide a visual directory tree diagram.
9. An eBook catalog recognition and reconstruction system based on a large language model, implemented based on the eBook catalog recognition and reconstruction method based on a large language model as described in any one of claims 1-8, characterized in that, It includes, from front to back, a multimodal parsing module, a multimodal feature fusion module, a large language model prediction module, a directory tree structure construction and optimization module, and a directory output module; The multimodal parsing module is used to perform multimodal parsing of PDF documents and process them to obtain a sequence of candidate titles; The multimodal feature fusion module is used to perform hierarchical attention fusion of text semantic features, visual style features and structural pattern features based on cross attention for multimodal feature vectors; The large language model prediction module is used to perform hierarchical prediction on the candidate title sequence based on the large language model to obtain the hierarchical sequence. The directory tree structure construction and optimization module is used to dynamically construct a directory tree based on a stack data structure and perform hierarchical smoothing, semantic coherence checking, and structural integrity verification. The directory output module is used to output a structured directory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the electronic book catalog recognition and reconstruction method based on a large language model as described in any one of claims 1-8.