Adaptive pdf document parsing method and system based on multi-dimensional quality perception

By employing a multi-dimensional quality-aware adaptive PDF document parsing method, and utilizing layout detection and graph attention networks to optimize document block processing, this method addresses the imbalance between parsing accuracy and computational cost in existing technologies. It achieves efficient document parsing and error correction, thereby improving the consistency and robustness of document parsing.

CN123033253APending Publication Date: 2026-11-03HANGZHOU ZHONGKE RUIJIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611159628.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-02
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing PDF document parsing systems struggle to balance parsing accuracy and computational cost when faced with hidden encoding obfuscation. Furthermore, existing error detection mechanisms are prone to misjudgment and severe distortion, ignoring the spatial relationships and hierarchical hierarchical relationships of document content, resulting in localized garbled text and wasting overall computational resources.

Method used

This paper adopts a multi-dimensional quality-aware adaptive PDF document parsing method. It uses a layout detection model to extract document block and bounding box information, combines glyph and encoding consistency test and semantic verification of local prediction entropy fluctuation, constructs a document block relationship graph and inputs it into a graph attention network, divides high-quality blocks, low-quality blocks and candidate pool, prioritizes the use of multimodal large model resources, and finally generates structured documents through sequence alignment algorithm.

Benefits of technology

It effectively identifies hidden coding defects, improves the consistency and robustness of parsing, reduces the false negative rate, achieves a balance between parsing accuracy and computational cost economy, ensures that limited computing resources are prioritized for low-quality document blocks with the greatest impact, and reduces overall inference overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123033253A_ABST
    Figure CN123033253A_ABST
Patent Text Reader

Abstract

The application discloses a multi-dimension quality perception-based adaptive PDF document analysis method and system, and relates to the technical field of document image processing. The method inputs a PDF document to be analyzed into a layout detection model to extract document block features and record a coordinate scaling matrix; performs character shape and coding consistency and predictive entropy semantic check fusion on the document block to output direct confidence; constructs a relation graph taking the document block as a node and inputs the graph attention network to aggregate neighbor node information to output comprehensive confidence; divides a document block quality interval according to the comprehensive confidence, combines estimated computing cost to calculate priority of a candidate pool and allocates a large model calling resource; and uses the scaling matrix to unify the large model output coordinate, sequentially aligns and splices a basic text extraction result of a high-quality block to generate a position label full-text structured document. The system is used to realize the method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of document image processing technology, specifically to an adaptive PDF document parsing method and system based on multi-dimensional quality perception. Background Technology

[0002] PDF document parsing has wide applications in document digitization, knowledge base construction, and intelligent retrieval. Currently, there are three main technical approaches in the industry: the traditional text extraction approach based on the built-in text objects in PDFs, the layout analysis and optical character recognition approach based on dedicated visual models, and the end-to-end recognition approach based on multimodal large models.

[0003] However, existing parsing systems face a trade-off between overhead and accuracy when dealing with documents containing hidden encoding obfuscation. On the one hand, traditional text extraction heavily relies on the standardization of document production, and is prone to garbled characters and paragraph fragmentation and semantic invalidation when faced with underlying mapping errors; visual model approaches can amplify errors and have limited generalization ability for long-tail elements; large model approaches face uncontrollable inference costs and model illusion risks in industrial production, and the generated text lacks strict fidelity to the original facts. On the other hand, existing error detection mechanisms mainly rely on statistical analysis of illegal characters for quality judgment, which is prone to misjudgment and outputting severely distorted dirty data when facing documents with anti-scraping obfuscation. At the same time, existing solutions mainly rely on page-level statistical rules for one-size-fits-all routing, processing each document block in isolation, ignoring the inherent semantic relationships such as spatial association and hierarchical subordination of document content, which makes local garbled characters easily waste overall computing power, and local misjudgments cannot be corrected by the global context. Therefore, it is still necessary to provide an adaptive PDF document parsing method based on multi-dimensional quality awareness to solve the balance problem between parsing accuracy and computing power. Summary of the Invention

[0004] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide an adaptive PDF document parsing method and system based on multi-dimensional quality perception to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides the following technical solution: an adaptive PDF document parsing method based on multi-dimensional quality perception, comprising the following steps: S1, rendering the PDF document to be parsed as a page image and inputting it into a layout detection model, extracting document blocks and their corresponding block category information and bounding box position information, and recording the scaling matrix from the PDF internal coordinate system to the pixel coordinate system; S2, performing glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations on the document blocks, and weightedly fusing the check results with the verification results to output a direct confidence score; S3, constructing a document block relationship graph with document blocks as nodes, and establishing spatial adjacency edges, reading order edges, hierarchical subordinate edges, and cross-page continuum edges between nodes by combining bounding box position information and block category information. S4. Direct confidence is used as the node feature input to the graph attention network, and a multi-head attention mechanism is used to aggregate neighbor node information to output a comprehensive confidence score; S5. Based on the comprehensive confidence score, the document block is divided into high-quality block, low-quality block and candidate pool. The priority score of the document block in the candidate pool is calculated by combining the importance weight, comprehensive confidence score and the estimated power cost, and the multimodal large model call resources are allocated in descending order of score; S6. For the document block that calls the multimodal large model, the structured text result output by the large model is unified to the internal coordinate system of the PDF by using the scaling matrix. The result is aligned with the basic text extraction result by the sequence alignment algorithm. The alignment result is spliced ​​with the basic text extraction result of the high-quality block according to the reading order to generate a full-text structured document with location tags.

[0006] Preferably, the specific process of rendering the PDF document to be parsed as a page image and inputting it into the layout detection model, extracting document blocks and their corresponding block category information and bounding box position information, and recording the scaling matrix from the PDF's internal coordinate system to the pixel coordinate system is as follows: Render the PDF document to be parsed as a page image and input it into the layout detection model, outputting document blocks within the page image; extract the block category information and bounding box position information of the document blocks. The block category information includes body paragraphs, titles, tables, formulas, headers and footers, and images. The bounding box position information includes coordinate parameters represented by the top-left corner coordinates and width and height, normalized to the page size; mark the page-crossing relationship of cross-page tables and cross-page paragraphs based on the bounding box position information, and record the scaling matrix for the transformation from the PDF's internal coordinate system to the pixel coordinate system.

[0007] Preferably, the specific process of performing glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations on document blocks, and weightedly fusing the check results and verification results to output direct confidence is as follows: Extract the original glyph index of characters within the document block and the corresponding expected Unicode code points in the mapping table; record the actual extracted Unicode code points; compare the proportion of inconsistent characters generated by the expected Unicode code points and the actual extracted Unicode code points to the total number of characters in the block; if this proportion exceeds a threshold, a hard encoding defect judgment is generated; rasterize the original glyph index into glyph images using a font engine; use a glyph classifier to identify the correct characters corresponding to the glyph images; and compare the correct characters with the mapping results in the mapping table to generate glyphs. The rasterization verification results are processed as follows: Text sequences initially extracted from the built-in text layer within document blocks are input into a pre-trained language model. The entropy value of the local predicted probability distribution is calculated using a sliding window mechanism. The local predicted entropy fluctuation is calculated based on the mean of the absolute values ​​of the entropy differences between adjacent windows. A semantic verification score is generated when the local predicted entropy fluctuation exceeds a pre-defined normal fluctuation threshold. A glyph and encoding consistency verification result is generated by combining the proportion of inconsistent characters to the total number of characters in the block and the noise density detection result. The proportion of inconsistent characters to the total number of characters in the block, the noise density detection result, and the semantic verification score are extracted and weighted to output a direct confidence score. A severe penalty is applied to the direct confidence score when encoding mapping spoofing or malicious obfuscation exists.

[0008] Preferably, the specific process of constructing a document block relationship graph with document blocks as nodes, and establishing spatial adjacency edges, reading order edges, hierarchical subordinate edges, and cross-page continuous edges between nodes by combining bounding box position information and block category information is as follows: Extract the projection overlap rate and geometric distance of adjacent document blocks based on bounding box position information; establish spatial adjacency edges when the preset conditions for projection overlap rate or distance are met; establish reading order edges based on the layout flow characteristics according to the sorting logic from left to right and from top to bottom; establish hierarchical subordinate edges based on the vertical relative positions of block category information and bounding box position information, combined with font size features; for document blocks on adjacent pages, extract the structural wireframe consistency features, coordinate space continuity features, and semantic coherence features contained in the document blocks; establish cross-page continuous edges when at least two feature matching conditions are met.

[0009] Preferably, the specific process of using direct confidence as the node feature input to the graph attention network and aggregating neighbor node information using a multi-head attention mechanism to output a comprehensive confidence is as follows: First, the embedding vectors of direct confidence, block category information, and text semantic feature vectors are concatenated to generate initial node feature vectors; second, embedding mapping is performed based on the association type of relation edges to generate relation type embedding vectors; third, in the propagation layer of the graph attention network, the initial node feature vectors and relation type embedding vectors are merged, and the attention coefficients between adjacent nodes are calculated using a learnable linear transformation matrix and a nonlinear activation function; fourth, the multi-head mechanism is invoked to independently aggregate neighbor node features, the hidden layer states output by the multi-head mechanism are concatenated, and the comprehensive confidence is output after mapping through a fully connected layer.

[0010] Preferably, the specific process of dividing document blocks into high-quality blocks, low-quality blocks, and a candidate pool based on comprehensive confidence, and calculating priority scores for document blocks in the candidate pool by combining importance weights, comprehensive confidence, and estimated computational cost, and allocating multimodal large model call resources in descending order of scores is as follows: Document blocks with comprehensive confidence higher than the upper boundary threshold are classified as high-quality blocks, document blocks with comprehensive confidence lower than the lower boundary threshold are classified as low-quality blocks, and document blocks between the boundary thresholds are placed in the candidate pool; importance weights are configured according to the block category information contained in the document blocks, and the estimated computational cost is calculated by extracting the pixel area of ​​the document blocks; a priority score evaluation index is constructed by fusing importance weights, quality unreliability corresponding to comprehensive confidence, and estimated computational cost; priority scores are calculated for document blocks in the candidate pool according to the priority score evaluation index and sorted in descending order, and multimodal large model call resources are allocated to document blocks in sequence under global computational resource constraints.

[0011] Preferably, for document blocks that call a multimodal large model, the specific process of unifying the structured text results output by the large model to the PDF's internal coordinate system using a scaling matrix is ​​as follows: obtain the structured text results output by the multimodal large model; extract the recorded scaling matrix and perform coordinate transformation operations on the position information of the structured text results; map the position information of the structured text results to position coordinates in the PDF's internal coordinate system, and generate structured text results that are consistent with the PDF's internal coordinate system.

[0012] Preferably, the specific process of generating a full-text structured document with location tags by aligning the sequence alignment algorithm with the basic text extraction results and splicing the aligned results with the basic text extraction results of high-quality blocks according to the reading order is as follows: The structured text results that are consistent with the internal coordinate system of the PDF are input into the sequence alignment algorithm, and the edit distance is output by comparing the structured text results with the basic text extraction results; when the edit distance exceeds a preset threshold, the structured text results are discarded, the basic text extraction results are used, and a label for manual review is marked; when the edit distance does not exceed the preset threshold, the content of the extracted structured text results is merged with the precise character-level position coordinates of the basic text extraction results to generate the alignment results; according to the reading order output by the page layout detection model, the alignment results are spliced ​​with the basic text extraction results of high-quality blocks to generate a full-text structured document with location tags.

[0013] The adaptive PDF document parsing system based on multi-dimensional quality perception executes the aforementioned adaptive PDF document parsing method based on multi-dimensional quality perception. It includes: a layout detection module, which renders the PDF document to be parsed as a page image and inputs it into the layout detection model, extracting document blocks and their corresponding block category information and bounding box position information, and recording the scaling matrix from the PDF's internal coordinate system to the pixel coordinate system; a quality perception module, which performs glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations on document blocks, and weightedly fuses the check results with the verification results to output a direct confidence score; and a graph attention module, which constructs a document block relationship graph with document blocks as nodes, and establishes spatial adjacency edges, reading order edges, and hierarchical subordination between nodes by combining bounding box position information and block category information. The system employs edge and cross-page continuous edges, using direct confidence scores as node features input to a graph attention network. A multi-head attention mechanism aggregates neighbor node information to output a comprehensive confidence score. A routing decision module divides document blocks into high-quality blocks, low-quality blocks, and a candidate pool based on the comprehensive confidence score. It calculates priority scores for document blocks in the candidate pool by combining importance weights, comprehensive confidence scores, and estimated power overhead, allocating multimodal large-scale model resources in descending order of scores. A text fusion module unifies the structured text output by the large-scale model to the PDF's internal coordinate system using a scaling matrix. It aligns the text with the basic text extraction results using a sequence alignment algorithm, and then concatenates the aligned results with the basic text extraction results of high-quality blocks according to the reading order, generating a full-text structured document with location tags.

[0014] The technical effects and advantages of this invention are as follows: (1) In the technical solution described in this invention, after obtaining the document block and bounding box position information through layout detection, the direct confidence level is obtained by performing glyph and encoding consistency checks on the document block and semantic verification weighted fusion based on local prediction entropy fluctuations. This changes the limitation of existing technologies that rely solely on the statistics of illegal characters for quality judgment, and can accurately identify anti-crawling obfuscated documents where the surface code points are legal but the actual semantics have been maliciously tampered with; glyph verification and semantic verification form a complementary double defense line, effectively intercepting various hidden encoding defects and malicious anti-crawling mappings, and significantly reducing the false negative rate of hidden encoding defects.

[0015] (2) In the technical solution described in this invention, a relational graph containing cross-page continuous edges and other related features is constructed using document blocks as nodes. The input graph attention network outputs a comprehensive confidence score, which is then combined with the estimated computational overhead to calculate the priority score of the candidate pool and allocate large model call resources. Finally, the scaling matrix and sequence alignment algorithm are used to fuse and generate a full-text structured document with location tags. Thus, the inherent semantic relationship is used to perform global context correction on local quality judgment, effectively eliminating isolated abnormal signals and local misjudgments, and improving the consistency and robustness of full document parsing. At the same time, it realizes the granular leap from page-level one-size-fits-all routing to block-level adaptive scheduling, ensuring that limited computing resources are prioritized for low-quality document blocks that have the greatest impact on the final parsing result. In the scenario of large-scale document library construction, the overall inference overhead is significantly reduced, and the optimal balance between parsing accuracy and computing power economy is achieved.

[0016] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0017] Figure 1 This is a flowchart of the adaptive PDF document parsing method based on multi-dimensional quality perception according to the present invention.

[0018] Figure 2 This is a flowchart of the adaptive PDF document parsing system based on multi-dimensional quality perception, as described in this invention. Detailed Implementation

[0019] Example 1; please refer to Figure 1This invention provides a technical solution: an adaptive PDF document parsing method based on multi-dimensional quality perception, comprising the following steps: S1, rendering the PDF document to be parsed as a page image and inputting it into a layout detection model, extracting document blocks and their corresponding block category information and bounding box position information, and recording the scaling matrix from the PDF's internal coordinate system to the pixel coordinate system; S2, performing glyph and encoding consistency checks and semantic checks based on local prediction entropy fluctuations on the document blocks, and weightedly fusing the check results with the verification results to output a direct confidence score; S3, constructing a document block relationship graph with document blocks as nodes, and establishing spatial adjacency edges, reading order edges, hierarchical subordinate edges, and cross-page continuous edges between nodes by combining bounding box position information and block category information. The direct confidence score is used as the node feature input to the graph attention network. A multi-head attention mechanism is used to aggregate neighbor node information and output a comprehensive confidence score. S4: Based on the comprehensive confidence score, the document blocks are divided into high-quality blocks, low-quality blocks, and a candidate pool. The priority score of the document blocks in the candidate pool is calculated by combining the importance weight, comprehensive confidence score, and estimated power cost. The multimodal large model call resources are allocated in descending order of the score. S5: For the document blocks that call the multimodal large model, the structured text results output by the large model are unified to the internal coordinate system of the PDF using a scaling matrix. The results are aligned with the basic text extraction results through a sequence alignment algorithm. The aligned results are spliced ​​with the basic text extraction results of the high-quality blocks according to the reading order to generate a full-text structured document with location tags.

[0020] In this implementation scheme, in step S1, the PDF document to be parsed is rendered page by page into page images and input into the layout detection model to extract various document blocks such as text paragraphs, titles, tables, and formulas, along with their corresponding block category information and bounding box position information. The main function of this step is to complete the basic structure decomposition of the page, providing fine-grained physical operation units for subsequent multi-dimensional quality perception and processing path selection. The scaling matrix refers to the mapping transformation parameters established during page rendering from the PDF's internal coordinate system to the pixel coordinate system. Recording the scaling matrix provides a unified spatial reference at the end of the parsing process, enabling precise and unified alignment of the results obtained from basic text extraction with the results output by the large model in subsequent steps.

[0021] Step S2 performs glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations on each document block extracted in the previous step. This step aims to overcome the shortcomings of conventional error detection mechanisms that rely on illegal character statistics, intercepting hidden encoding obfuscation phenomena where surface code points appear legitimate but the actual semantics have been tampered with by anti-scraping mechanisms. During the verification process, glyph rasterization refers to converting the original glyph index corresponding to a character into a grayscale glyph image using a font engine, and using a classifier to identify visually correct characters to detect hidden obfuscation where the mapping table itself has been maliciously tampered with. Local prediction entropy fluctuation refers to calculating the entropy change of the local prediction probability distribution of the text using a pre-trained language model in a sliding window manner. By detecting whether the mean of the absolute values ​​of the entropy differences between adjacent windows exceeds a pre-defined normal fluctuation threshold, it is determined whether semantic distortion exists. Finally, the weighted fusion of the various verification results outputs a direct confidence level reflecting the local evaluation state.

[0022] Step S3 utilizes bounding box location information and block category information to construct a document block relationship graph, including spatial adjacency edges, reading order edges, hierarchical subordinate edges, and cross-page continuous edges, with document blocks as nodes. The purpose of constructing this relationship graph and graph attention network is to overcome the limitations of processing individual document blocks in isolation. By leveraging the inherent spatial relationships and hierarchical subordinate relationships within the document, it performs global contextual correction on local quality judgments, improving the accuracy of misjudged nodes with low direct confidence but high consistency with surrounding high-quality blocks. Cross-page continuous edges are established to address the problem of content fragmentation across pages, ensuring at least two of the following conditions are met: structural wireframe consistency, coordinate space continuity, and semantic coherence. The graph attention network, acting as a confidence propagation medium, automatically learns the influence weights of different neighboring nodes on the confidence of the central node through a multi-head attention mechanism, thereby transforming local direct confidence into a comprehensive confidence that integrates the global context.

[0023] Steps S4 and S5 sequentially execute routing decisions based on computational constraints and the final text fusion and splicing. Step S4 enables block-level adaptive scheduling, ensuring that limited computational resources are prioritized for the lowest-quality regions that have the greatest impact on the parsing results, avoiding wasted computational resources. The priority score is a metric that quantifies the ratio of document block quality unreliability to repair computational overhead. It is calculated based on the importance weight of the block category, the overall confidence level, and the estimated cost of document block pixel area, and is used to allocate multimodal large model resources in descending order. Step S5 completes the merging of results from heterogeneous parsing paths. The sequence alignment algorithm refers to a comparison and fusion method based on the longest common subsequence or edit distance. After mapping the large model output to the PDF's internal coordinate system using a scaling matrix, the sequence alignment algorithm fuses the text content of the large model with the precise coordinates extracted from the basic text, ultimately splicing the text in the reading order to generate a full-text structured document with precise location labels.

[0024] Specifically, the process of rendering the PDF document to be parsed as a page image and inputting it into the layout detection model, extracting document blocks and their corresponding block category information and bounding box position information, and recording the scaling matrix from the PDF's internal coordinate system to the pixel coordinate system is as follows: The PDF document to be parsed is rendered as a page image and input into the layout detection model, outputting document blocks within the page image; the block category information and bounding box position information of the document blocks are extracted. The block category information includes body paragraphs, titles, tables, formulas, headers and footers, and images. The bounding box position information includes coordinate parameters represented by the top-left corner coordinates and width and height, normalized to the page size; based on the bounding box position information, the page-crossing relationship of cross-page tables and cross-page paragraphs is marked, and the scaling matrix for transforming the PDF's internal coordinate system to the pixel coordinate system is recorded.

[0025] In this implementation scheme, page rendering and layout detection serve to acquire document block and bounding box position information, providing fine-grained physical operation units for subsequent processing. Coordinate parameters normalized to the page size refer to the relative positional ratios obtained by converting the top-left corner coordinates and width and height values ​​according to the total page size, used to uniformly express positional characteristics at different resolutions. Page cross-relationship markers are used to associate table or paragraph content cut off by physical pagination. The scaling matrix records the mapping transformation parameters from the PDF's internal coordinate system to the image pixel coordinate system during page rendering, enabling the subsequent mapping of character-level bounding box coordinates obtained from the basic extraction path to the pixel coordinate system used for layout analysis, achieving precise alignment of the output results from the two parsing paths.

[0026] Specifically, the process of performing glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations on document blocks, and then weightedly fusing the check and verification results to output a direct confidence score, is as follows: Extract the original glyph indexes of characters within the document block and the corresponding expected Unicode code points in the mapping table; record the actual extracted Unicode code points; compare the proportion of inconsistent characters generated by the expected Unicode code points with the actual extracted Unicode code points to the total number of characters in the block; if this proportion exceeds a threshold, a hard encoding defect judgment is generated; rasterize the original glyph indexes into glyph images using a font engine; use a glyph classifier to identify the correct characters corresponding to the glyph images; and compare the correct characters with the mapping table results to generate glyphs. The rasterization verification results are processed as follows: Text sequences initially extracted from the built-in text layer within document blocks are input into a pre-trained language model. The entropy value of the local predicted probability distribution is calculated using a sliding window mechanism. The local predicted entropy fluctuation is calculated based on the mean of the absolute values ​​of the entropy differences between adjacent windows. A semantic verification score is generated when the local predicted entropy fluctuation exceeds a pre-defined normal fluctuation threshold. A glyph and encoding consistency verification result is generated by combining the proportion of inconsistent characters to the total number of characters in the block and the noise density detection result. The proportion of inconsistent characters to the total number of characters in the block, the noise density detection result, and the semantic verification score are extracted and weighted to output a direct confidence score. A severe penalty is applied to the direct confidence score when encoding mapping spoofing or malicious obfuscation exists.

[0027] In this implementation scheme, glyph rasterization refers to the process of rendering the original glyph index into a small-sized grayscale glyph image using a font engine. Semantic verification calculates the entropy value of the local predicted probability distribution based on a pre-trained language model using a sliding window approach. The semantic verification score is calculated as follows: ; Semantic validation score; The mean of the absolute values ​​of the entropy differences between the prediction probability distributions of adjacent windows; The normal fluctuation threshold was statistically defined using a stratified method on a large-scale clean corpus. Direct confidence levels were then calculated. ; Direct confidence of document blocks; The percentage of characters whose glyphs and encodings are inconsistent with each other out of the total number of characters; Noise density index calculated based on the percentage of characters or non-standard code points in the private usage area; , , Weighting coefficients that sum to one. A severe penalty is applied when glyph rasterization detects malicious obfuscation or semantic verification determines that encoding mapping spoofing exists. ; : Severe penalty factor.

[0028] Specifically, the process of constructing a document block relationship graph using document blocks as nodes, and establishing spatial adjacency edges, reading order edges, hierarchical subordinate edges, and cross-page continuous edges between nodes by combining bounding box position information and block category information is as follows: Extracting the projection overlap rate and geometric distance of adjacent document blocks based on bounding box position information, and establishing spatial adjacency edges when the preset conditions for projection overlap rate or distance are met; establishing reading order edges based on the layout flow features and the sorting logic from left to right and from top to bottom; establishing hierarchical subordinate edges based on the vertical relative positions of block category information and bounding box position information, combined with font size features; for document blocks on adjacent pages, extracting the structural wireframe consistency features, coordinate space continuity features, and semantic coherence features contained in the document blocks, and establishing cross-page continuous edges when at least two feature matching conditions are met.

[0029] In this implementation scheme, the purpose of constructing the document block relationship graph is to connect isolated blocks topologically using the spatial associations of document content and the inherent hierarchical relationships of layout. Projection overlap rate refers to the percentage of overlap between adjacent document blocks in the horizontal or vertical direction, which, together with geometric distance, serves as a geometric constraint parameter for determining spatial adjacency edges. The layout flow characteristics reflect the document sorting logic from left to right and from top to bottom, conforming to conventional reading habits. Hierarchical subordinate edges are established through the relative positions of vertical coordinates between document blocks and the association features of font size. For edge document blocks truncated on adjacent pages, cross-page continuous edges are jointly evaluated by extracting structural wireframe consistency features, calculating coordinate spatial continuity features from the coordinates of the center points of the bounding boxes of the two-page document blocks, and semantic coherence features derived from edge text analysis based on a language model. A content continuity association spanning physical pages is established when at least two of the above conditions are met.

[0030] Specifically, the process of using direct confidence as the node feature input to the graph attention network and aggregating neighbor node information using a multi-head attention mechanism to output a comprehensive confidence is as follows: First, the embedding vectors of direct confidence, block category information, and text semantic feature vectors are concatenated to generate initial node feature vectors. Second, embedding mapping is performed based on the association type of relation edges to generate relation type embedding vectors. Third, in the propagation layer of the graph attention network, the initial node feature vectors and relation type embedding vectors are merged, and the attention coefficients between adjacent nodes are calculated using a learnable linear transformation matrix and a nonlinear activation function. Fourth, the multi-head mechanism is invoked to independently aggregate neighbor node features, the hidden layer states output by the multi-head mechanism are concatenated, and the comprehensive confidence is output after mapping through a fully connected layer.

[0031] In this implementation, the graph attention network is used to propagate local quality signals between document block nodes, mapping and correcting them to the global confidence space through relation edges. The process of generating the initial feature vectors of nodes is as follows: ; : The initial feature vector of the i-th node; : The direct confidence scalar corresponding to the i-th node; : Embedding vector generated by block category label mapping; Text semantic feature vector; Vector concatenation operation. The process of calculating the attention coefficient between adjacent nodes is as follows: ; : The attention influence coefficient between node i and its neighbor node j in the l-th layer graph propagation; : The learnable attention weight vector of the l-th layer; The learnable linear transformation feature matrix of the l-th layer; : The hidden state vector output by node i in the previous propagation layer; : Embedded vector of the relationship type of the edge connecting node i and node j; N(i): Set of all neighboring nodes of node i; A nonlinear activation function with a small slope on the negative half-axis. The multi-head mechanism's independent aggregation and splicing process is as follows: ; The hidden layer node features calculated by the kth independent attention head; The non-linear activation function used at the multi-head output. The final output confidence score is determined by the fully connected layer mapping network. ; : The overall confidence parameter of the i-th document block after incorporating contextual quality information; : The learnable weight parameter matrix of the fully connected output layer; The final set of node features output after the L-layer graph network has completed propagation; : Parameters for calculating bias terms in the fully connected output layer.

[0032] Specifically, based on the overall confidence level, document blocks are divided into high-quality blocks, low-quality blocks, and a candidate pool. Priority scores are calculated for document blocks in the candidate pool based on importance weights, overall confidence levels, and estimated computational cost. The process of allocating multimodal large model resources in descending order of these scores is as follows: Document blocks with an overall confidence level higher than the upper boundary threshold are classified as high-quality blocks; those with an overall confidence level lower than the lower boundary threshold are classified as low-quality blocks; and document blocks between the boundary thresholds are placed in the candidate pool. Importance weights are configured based on the block category information contained in the document blocks, and the estimated computational cost is calculated by extracting the pixel area of ​​the document blocks. A priority score evaluation index is constructed by fusing the importance weights, the quality unreliability corresponding to the overall confidence level, and the estimated computational cost. Priority scores are calculated for document blocks in the candidate pool according to the priority score evaluation index and sorted in descending order. Under global computational resource constraints, document blocks are extracted sequentially and multimodal large model resources are allocated.

[0033] In this implementation scheme, the purpose of dividing the region based on comprehensive confidence level is to accurately allocate computing power to low-quality and high-value regions under global computing resource constraints, avoiding ineffective duplication of processing in high-quality regions. The calculation process for the estimated computing power cost is as follows: ; : Estimate the computational cost of calling the multimodal large model to process the current document block; : Document block pixel area; The average inference cost per unit pixel area for multimodal large models, based on empirical calibration. The calculation process for the priority score evaluation metric is as follows: ; : The priority score of a document block, used to quantify the ratio of the document block's quality unreliability to the cost of repair; Importance weights are assigned based on block category, with tables and formulas having a higher weight than main text paragraphs; The overall confidence score is calculated after correction using a graph attention network. All candidate blocks in the candidate pool are sorted in descending order of the scores obtained from the above formula. Within the limits of the computing power budget, multimodal large model resources are allocated sequentially. Document blocks exceeding the budget are directly extracted using the basic text extraction results.

[0034] Specifically, for document blocks that call the multimodal large model, the process of unifying the structured text results output by the large model to the PDF's internal coordinate system using the scaling matrix is ​​as follows: obtain the structured text results output by the multimodal large model; extract the recorded scaling matrix and perform coordinate transformation on the position information of the structured text results; map the position information of the structured text results to position coordinates in the PDF's internal coordinate system, and generate structured text results that are consistent with the PDF's internal coordinate system.

[0035] In this implementation, the coordinate transformation performed on the structured text results aims to eliminate spatial coordinate differences caused by heterogeneous parsing paths. After processing low-quality blocks using the multimodal large model, the content returned by the multimodal large model is based on the pixel spatial coordinate system after page rendering. The scaling matrix recorded in the previous page rendering and layout detection steps is extracted, and the pixel-level bounding box coordinates of the large model's returned results are inversely and uniformly mapped to the PDF's internal coordinate system. This provides a spatial reference point in the same reference system as the basic text extraction results for subsequent sequence alignment and fusion.

[0036] Specifically, the process of generating a full-text structured document with location tags by aligning the sequence alignment algorithm with the basic text extraction results, and then concatenating the aligned results with the basic text extraction results of high-quality blocks according to the reading order is as follows: The structured text results, which are consistent with the PDF's internal coordinate system, are input into the sequence alignment algorithm. The structured text results are compared with the basic text extraction results, and the edit distance is output. When the edit distance exceeds a preset threshold, the structured text results are discarded, and the basic text extraction results are used and marked with tags awaiting manual review. When the edit distance does not exceed the preset threshold, the content of the extracted structured text results is merged with the precise character-level position coordinates of the basic text extraction results to generate the alignment results. Following the reading order output by the layout detection model, the alignment results are concatenated with the basic text extraction results of high-quality blocks to generate a full-text structured document with location tags.

[0037] In this implementation scheme, the role of sequence alignment and splicing fusion is to fuse the high-quality text content generated by the multimodal large model with the precise character-level position coordinates provided by the basic text extraction. The sequence alignment algorithm can be based on the longest common subsequence, the edit distance, or word vector embedding similarity. The edit distance calculated by the alignment algorithm is used to measure the degree of difference between the large model's output text and the basic text extraction results. When the edit distance exceeds a preset threshold, it indicates that the large model's output difference is too large and there is a risk of model illusion. In this case, the large model's output content is discarded, and the basic extraction results are used instead, with a "for manual review" label applied. When the threshold is not exceeded, the structured text content is extracted and combined with the precise position coordinates of the basic extraction to complete the assembly and alignment. The preset threshold is dynamically labeled based on document block categories to reflect the technical design of differentiated fault tolerance for different categories (tables / formulas / body text). Finally, according to the streaming reading order obtained by the layout detection module, all document block results retained in all intervals are globally assembled to output a final full-text structured document with precise character-level position tags.

[0038] Example 2; please refer to Figure 2An adaptive PDF document parsing system based on multi-dimensional quality perception is used to execute the adaptive PDF document parsing method based on multi-dimensional quality perception described in the embodiments. It includes: a layout detection module, used to render the PDF document to be parsed as a page image and input it into the layout detection model, extract document blocks and their corresponding block category information and bounding box position information, and record the scaling matrix from the PDF's internal coordinate system to the pixel coordinate system; a quality perception module, used to perform glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations on the document blocks, and weightedly fuse the check results and verification results to output a direct confidence score; and a graph attention module, used to construct a document block relationship graph with document blocks as nodes, and establish spatial adjacency edges, reading order edges, and layer edges between nodes by combining bounding box position information and block category information. The system employs hierarchical subordinate edges and cross-page continuous edges, using direct confidence as node features input to the graph attention network. It leverages a multi-head attention mechanism to aggregate neighbor node information and output a comprehensive confidence score. The routing decision module divides document blocks into high-quality blocks, low-quality blocks, and a candidate pool based on the comprehensive confidence score. It calculates priority scores for document blocks in the candidate pool by combining importance weights, comprehensive confidence, and estimated power overhead, allocating multimodal large-scale model resources in descending order of scores. The text fusion module unifies the structured text output by the large-scale model to the PDF's internal coordinate system using a scaling matrix. It aligns the text with the basic text extraction results using a sequence alignment algorithm, and then concatenates the aligned results with the basic text extraction results of high-quality blocks according to the reading order, generating a full-text structured document with location tags.

[0039] In this implementation, the layout detection module is used to perform basic page structure decomposition, rendering the PDF document to be parsed as a page image and inputting it into the layout detection model. It identifies and extracts document blocks and their corresponding block category information and bounding box position information, while simultaneously recording the scaling matrix from the PDF's internal coordinate system to the pixel coordinate system, providing physical operation units for subsequent system processing. After obtaining document block features, the quality perception module performs glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations for each independent document block. The check results are weighted and fused with the verification results to calculate and output a direct confidence score reflecting the local evaluation state of the document block.

[0040] The graph attention module performs quality information propagation and correction across document blocks. Utilizing bounding box position and block category information extracted by the layout detection module, it establishes spatial adjacency edges, reading order edges, hierarchical subordinate edges, and cross-page continuous edges between document blocks, constructing a global document block relationship graph. After establishing topological relationships, the graph attention module configures the direct confidence scores generated by the quality perception module as node features input to the graph attention network. Through a multi-head attention mechanism, it aggregates neighbor node information between adjacent nodes, transforming independent confidence scores into a comprehensive confidence score that incorporates the global context, and then outputs it.

[0041] The routing decision module is used to perform adaptive parsing and routing of document blocks under global computing power constraints. Based on the comprehensive confidence score output by the graph attention module, document blocks are divided into three intervals: high-quality blocks, low-quality blocks, and a candidate pool. For document blocks included in the candidate pool, the routing decision module combines the importance weight of the document block, the comprehensive confidence score, and the estimated computing power cost to perform quantitative calculation to obtain a priority score. The candidate document blocks are then sorted in descending order according to their priority scores, and the multimodal large model's calling resources are allocated accordingly.

[0042] The text fusion module performs coordinate unification and data concatenation of the underlying parsing results. For document blocks processed by the multimodal large model, it extracts the scaling matrix recorded by the layout detection module and reverse maps the spatial positions of the structured text results returned by the large model to the PDF's internal coordinate system. After coordinate transformation, the text fusion module calls a sequence alignment algorithm to align and fuse the structured text results with the basic text extraction results. It then assembles the aligned results with the retained high-quality block basic text extraction results according to the original reading order, ultimately generating a position-labeled full-text structured document.

[0043] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. An adaptive PDF document parsing method based on multi-dimensional quality perception, characterized in that, Includes the following steps: S1. Render the PDF document to be parsed into a page image and input it into the layout detection model. Extract the document blocks and their corresponding block category information and bounding box position information, and record the scaling matrix from the PDF internal coordinate system to the pixel coordinate system. S2. Perform glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations on the document blocks, and output the direct confidence score by weighted fusion of the check results and the verification results. S3. Construct a document block relationship graph with document blocks as nodes. Combine bounding box position information and block category information to establish spatial adjacency edges, reading order edges, hierarchical subordinate edges and cross-page continuous edges between nodes. Use direct confidence as node feature input to the graph attention network and use a multi-head attention mechanism to aggregate neighbor node information and output comprehensive confidence. S4. Based on the comprehensive confidence score, divide the document blocks into high-quality blocks, low-quality blocks and candidate pools. Combine the importance weight, comprehensive confidence score and estimated power cost to calculate the priority score of the document blocks in the candidate pool. Allocate multimodal large model call resources in descending order of score. S5. For document blocks that call the multimodal large model, use the scaling matrix to unify the structured text results output by the large model to the internal coordinate system of the PDF, align them with the basic text extraction results through the sequence alignment algorithm, and splice the alignment results with the basic text extraction results of the high-quality blocks according to the reading order to generate a full-text structured document with location tags.

2. The adaptive PDF document parsing method based on multi-dimensional quality perception according to claim 1, characterized in that: The process of rendering the PDF document to be parsed as a page image and inputting it into the layout detection model, extracting document blocks and their corresponding block category information and bounding box position information, and recording the scaling matrix from the PDF's internal coordinate system to the pixel coordinate system is as follows: The PDF document to be parsed is rendered as a page image and input into the layout detection model, which outputs document blocks within the page image. Extract the block category information and bounding box position information of document blocks. The block category information includes body paragraphs, headings, tables, formulas, headers and footers, and images. The bounding box position information includes coordinate parameters expressed using the coordinates of the top left corner and the width and height, and normalized to the page size. The page-crossing relationship between cross-page tables and cross-page paragraphs is marked based on the bounding box position information, and the scaling matrix for the transformation from the PDF internal coordinate system to the pixel coordinate system is recorded.

3. The adaptive PDF document parsing method based on multi-dimensional quality perception according to claim 1, characterized in that: The specific process of performing glyph and encoding consistency checks and semantic verification based on local prediction entropy fluctuations on document blocks, and then weightedly fusing the check results with the verification results to output the direct confidence score is as follows: Extract the original glyph index of the characters in the document block and the corresponding expected Unicode code points in the mapping table, record the actual extracted Unicode code points, compare the proportion of inconsistent characters generated by the expected Unicode code points and the actual extracted Unicode code points to the total number of characters in the block, and generate a hard encoding defect judgment when the proportion exceeds the threshold. The original glyph index is rasterized into glyph images by the font engine. The glyph classifier is used to identify the correct characters corresponding to the glyph images. The correct characters are compared with the mapping results of the mapping table to generate glyph rasterization verification results. The text sequence initially extracted from the document block based on the built-in text layer is input into the pre-trained language model. The entropy value of the local prediction probability distribution is calculated through the sliding window mechanism. The local prediction entropy fluctuation is calculated based on the mean of the absolute values ​​of the entropy difference between adjacent windows. When the local prediction entropy fluctuation exceeds the pre-calibrated normal fluctuation threshold, a semantic verification score is generated. The glyph and encoding consistency test results are generated by combining the proportion of inconsistent characters to the total number of characters in the block and the noise density detection results. The proportion of inconsistent characters to the total number of characters in the block, the noise density detection results, and the semantic verification score are extracted and weighted to output the direct confidence score. When there is encoding mapping spoofing or malicious obfuscation, a severe penalty is imposed on the direct confidence score.

4. The adaptive PDF document parsing method based on multi-dimensional quality perception according to claim 1, characterized in that: The specific process of constructing a document block relationship graph using document blocks as nodes, and establishing spatial adjacency edges, reading order edges, hierarchical subordinate edges, and cross-page continuous edges between nodes by combining bounding box position information and block category information, is as follows: Combine the bounding box position information to extract the projection overlap rate and geometric distance of adjacent document blocks, and establish spatial adjacency edges when the preset conditions of projection overlap rate or distance are met. Based on the flow characteristics of the layout, a reading order edge is established according to the sorting logic from left to right and from top to bottom; Based on the vertical relative positions of block category information and bounding box position information, hierarchical subordinate edges are established in combination with font size features; For document blocks on adjacent pages, extract the structural wireframe consistency features, coordinate space continuity features, and semantic coherence features contained in the document blocks. Establish continuous edges across pages when at least two feature matching conditions are met.

5. The adaptive PDF document parsing method based on multi-dimensional quality perception according to claim 4, characterized in that: The specific process of using direct confidence scores as node features input to a graph attention network and leveraging a multi-head attention mechanism to aggregate neighbor node information and output a comprehensive confidence score is as follows: The initial feature vector of a node is generated by concatenating the embedding vectors of direct confidence and block category information with the text semantic feature vectors. Based on the association type of the relation edge, perform embedding mapping to generate relation type embedding vectors; In the propagation layer of the graph attention network, the initial feature vectors of nodes and the relation type embedding vectors are merged, and the attention coefficients between adjacent nodes are calculated through a learnable linear transformation matrix and a nonlinear activation function. The multi-head mechanism is invoked to independently aggregate the features of neighboring nodes, the hidden layer states output by the multi-head mechanism are concatenated, and the comprehensive confidence score is output after mapping through a fully connected layer.

6. The adaptive PDF document parsing method based on multi-dimensional quality perception according to claim 1, characterized in that: Based on the overall confidence score, document blocks are divided into high-quality blocks, low-quality blocks, and a candidate pool. Priority scores are calculated for document blocks in the candidate pool based on importance weights, overall confidence scores, and predicted power costs. The specific process of allocating multimodal large model resources in descending order of these scores is as follows: Document blocks with a comprehensive confidence score higher than the upper boundary threshold are classified as high-quality blocks, document blocks with a comprehensive confidence score lower than the lower boundary threshold are classified as low-quality blocks, and document blocks with a confidence score between the boundary thresholds are placed into the candidate pool. Based on the block category information contained in the document block, an importance weight is configured, and the pixel area of ​​the document block is extracted to calculate the estimated power cost. A priority score evaluation index is constructed by integrating importance weights, quality unreliability corresponding to comprehensive confidence levels, and estimated cost. The document blocks in the candidate pool are evaluated based on priority scores and sorted in descending order. Under the constraints of global computing resources, the document blocks are extracted in sequence and multimodal large model call resources are allocated.

7. The adaptive PDF document parsing method based on multi-dimensional quality perception according to claim 1, characterized in that: The specific process of unifying the structured text results output by the large multimodal model to the PDF's internal coordinate system using a scaling matrix for document blocks is as follows: Obtain structured text results from the output of a multimodal large model; Extract the scaling matrix of the records and perform coordinate transformation on the positional information of the structured text results; The location information of the structured text results is mapped and converted into location coordinates in the PDF's internal coordinate system, generating structured text results that are consistent with the PDF's internal coordinate system.

8. The adaptive PDF document parsing method based on multi-dimensional quality perception according to claim 1, characterized in that: The specific process of generating a position-labeled full-text structured document by aligning the sequence alignment algorithm with the basic text extraction results, and then concatenating the aligned results with the basic text extraction results of high-quality blocks in the reading order is as follows: The structured text results are input into a sequence alignment algorithm that is consistent with the internal coordinate system of the PDF. The edit distance between the structured text results and the basic text extraction results is compared. When the edit distance exceeds the preset threshold, the structured text results are discarded, and the basic text extraction results are used and labeled with tags to be manually reviewed. When the edit distance does not exceed the preset threshold, the content of the extracted structured text results is merged with the precise character-level position coordinates of the basic text extraction results to generate an alignment result; Based on the reading order output by the layout detection model, the splicing and alignment results are combined with the basic text extraction results of high-quality blocks to generate a full-text structured document with location tags.

9. An adaptive PDF document parsing system based on multi-dimensional quality perception, used to execute the adaptive PDF document parsing method based on multi-dimensional quality perception as described in any one of claims 1-8, characterized in that, include: The layout detection module is used to render the PDF document to be parsed as a page image and input it into the layout detection model, extract document blocks and their corresponding block category information and bounding box position information, and record the scaling matrix from the PDF's internal coordinate system to the pixel coordinate system. The quality awareness module is used to perform glyph and encoding consistency checks on document blocks and semantic verification based on local prediction entropy fluctuations. The test results and verification results are weighted and fused to output the direct confidence score. The graph attention module is used to construct a document block relationship graph with document blocks as nodes. It combines bounding box position information and block category information to establish spatial adjacency edges, reading order edges, hierarchical subordinate edges and cross-page continuous edges between nodes. It inputs the direct confidence as node features into the graph attention network and uses a multi-head attention mechanism to aggregate neighbor node information and output a comprehensive confidence. The routing decision module is used to divide document blocks into high-quality blocks, low-quality blocks, and a candidate pool based on the overall confidence level. It calculates priority scores for document blocks in the candidate pool by combining importance weights, overall confidence level, and estimated power cost, and allocates multimodal large model call resources in descending order of scores. The text fusion module is used to unify the structured text results output by the multimodal large model into the internal coordinate system of the PDF by using a scaling matrix on document blocks that call the large model. It then aligns the text with the basic text extraction results using a sequence alignment algorithm, and splices the aligned results with the basic text extraction results of high-quality blocks according to the reading order to generate a full-text structured document with location tags.