A PDF document content recognition method, device, equipment and storage medium

By differentially analyzing text regions in PDF documents, identifying and concatenating semantically similar sentence units, the problem of paragraph structure and semantic coherence in PDF document content recognition is solved, generating semantically coherent paragraph text.

CN122049924BActive Publication Date: 2026-06-09SHENZHEN ISSMART SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN ISSMART SCI & TECH CO LTD
Filing Date
2026-04-20
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing PDF document content recognition technologies cannot effectively distinguish sentence boundaries, resulting in fragmented text fragments that lose paragraph structure and semantic coherence, thus affecting the performance of downstream tasks.

Method used

By obtaining the access link of the PDF document, the document is downloaded and then parsed differently according to the page type. Text regions are identified and sentence units are divided. Cosine similarity is used to divide the sentence units into semantically similar text blocks, and then the blocks are spliced ​​together in the original order to generate paragraph text.

Benefits of technology

It achieves semantic coherence and structural integrity in text extraction from PDF documents, improving the comprehensibility of document content and the effectiveness of downstream tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122049924B_ABST
    Figure CN122049924B_ABST
Patent Text Reader

Abstract

The application provides a PDF document content recognition method and device, equipment and a storage medium, the method comprises the following steps: obtaining an access link of an unanalyzed document; downloading a target PDF document from an object storage service according to the access link; when the content area corresponding to the page type in the target PDF document is a text area, the content area is divided into a text area, a table area and an image area according to the page type corresponding to each content area; when the content area is a text area, the original text character sequence is extracted from the text area, and the semantic coherent paragraph text is generated by similarity calculation on the original text character sequence. Based on the cosine similarity, the application automatically divides the sentences with similar semantics in the text area into the same text block, so that the document analysis obtains semantic coherent and complete text content, solves the problem of broken text paragraphs after document recognition, and effectively improves the semantic coherence of the document content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of document recognition technology, and in particular to a method, apparatus, device and storage medium for recognizing PDF document content. Background Technology

[0002] Current PDF document content recognition technologies mainly fall into two categories: the first directly parses the structured text in the PDF using code (such as libraries like pdfminer and PyPDF2), extracts the text content, and stores it quantitatively; the second targets scanned or image-based PDFs, using Optical Character Recognition (OCR) to convert images into text. While these methods have some processing capability for text-intensive PDFs, they still suffer from the following significant drawbacks: traditional PDF text extraction tools can only output character sequences according to the physical order of the pages, failing to distinguish sentence boundaries and unable to automatically combine semantically related sentences into logically complete paragraphs. The extraction results are often fragmented text snippets or entire pages of plain text, losing the original paragraph structure and semantic coherence, leading to a significant decline in the effectiveness of downstream tasks (such as retrieval, summarization, and question answering). Summary of the Invention

[0003] This application provides a method, apparatus, device, and storage medium for PDF document content recognition, which addresses the problem in related technologies that the extracted text loses the original paragraph structure and semantic coherence after PDF document content recognition.

[0004] The first aspect of this application provides a method for recognizing the content of a PDF document, the method comprising:

[0005] When an unparsed document is detected in the database, obtain the access link for the unparsed document;

[0006] Download the target PDF document from the object storage service using the access link provided;

[0007] Document parsing is performed based on the content areas of different page types in the target PDF document. When the content area of ​​the corresponding page type in the target PDF document is a text area, the original text character sequence in the text area is divided into multiple independent text sentence units. The text sentence units are divided into several semantically similar text blocks according to the cosine similarity between the text sentence units. The blocks are then concatenated according to the original order of the original text character sequence to generate the corresponding content parsing result.

[0008] The structural information of the pages in the target PDF document and the content parsing results are uniformly encapsulated to output a page-level intermediate structured document.

[0009] Optionally, in a first implementation of the first aspect of this application, after the step of downloading the target PDF document from the object storage service according to the access link, the method further includes:

[0010] Using a single page in the target PDF document as a processing unit, the vector graphics, text outlines and embedded images in the target PDF document are rendered into corresponding page images through pixel matrix transformation and anti-aliasing smoothing.

[0011] The page image is subjected to size normalization and resolution alignment to obtain the processed page image;

[0012] The processed page image is subjected to content feature analysis, and the orientation of the processed page image is corrected based on the analysis results to obtain a standardized image.

[0013] Optionally, in the second implementation of the first aspect of this application, after the steps of performing content feature analysis on the processed page image and performing orientation correction on the processed page image based on the analysis results to obtain a standardized image, the method further includes:

[0014] By constructing a feature map, grid cell prediction is performed on the standardized image to obtain the boundary coordinates, class probabilities, and confidence scores of different content regions in the standardized image.

[0015] The content region with the best confidence score is retained by removing the content region with repeated boundary coordinates through non-maximum suppression.

[0016] The page type corresponding to each content area is determined based on the category probability of the content area with the best confidence level.

[0017] Optionally, in the third implementation of the first aspect of this application, the step of parsing the document based on the content regions of different page types in the target PDF document includes:

[0018] When the content area is a table-type area, feature recognition is performed on the table-type area, and corresponding cell boundary detection is performed based on the recognition results to extract the structured table data of the table-type area;

[0019] When the content region is an image region, cross-modal feature fusion and text generation are performed on the image region according to a preset text template, and the semantic representation text corresponding to the content of the region is output.

[0020] Optionally, in the fourth implementation of the first aspect of this application, the step of dividing the original text character sequence in the text class region into multiple independent text sentence units, dividing the text sentence units into several semantically similar text blocks according to the cosine similarity between the text sentence units, and concatenating them according to the original order of the original text character sequence to generate the corresponding content parsing result includes:

[0021] Sentence boundary recognition is performed on the original text character sequence, and the original text character sequence is divided into multiple independent text sentence units based on punctuation marks and line breaks.

[0022] The text sentence units are converted into corresponding sentence vectors through vector space mapping;

[0023] Using the previously processed text block as the current block, determine the maximum cosine similarity value between the sentence vector to be processed and all sentence vectors in the current block, as well as the minimum cosine similarity value between all sentence vectors in the current block;

[0024] If the minimum cosine similarity value is less than the maximum cosine similarity value, then the text sentence unit corresponding to the sentence vector to be processed is added to the current block;

[0025] If the minimum cosine similarity value is not less than the maximum cosine similarity value, then a new text block is created and the sentence vector to be processed is used as the starting unit.

[0026] All text sentence units belonging to the same text block are connected in their original order, and paragraph separators are inserted between adjacent text sentence units to generate semantically coherent paragraph text.

[0027] Optionally, in the fifth implementation of the first aspect of this application, the step of performing feature recognition on the table-like region, performing corresponding cell boundary detection based on the recognition result, and extracting the structured table data of the table-like region includes:

[0028] The table-like region is subjected to feature recognition, the image features of the table-like region are extracted, and the table-like region is determined to be a bordered table type or a borderless table type based on the preset classification rules.

[0029] If the table-type area is a bordered table type, then the table-type area is subjected to table line detection and cell boundary segmentation to determine the cell boundaries;

[0030] If the table-like region is a borderless table type, then the row and column structure of the table is identified, and the row and column dividing lines are inferred by combining the image features and spatial position relationships;

[0031] Text recognition is performed on the independent cell regions divided by the cell boundaries or row and column dividing lines to obtain the cell text content, and the row and column coordinate relationship between each cell is established based on the row and column topology structure formed by the cell boundaries or row and column dividing lines.

[0032] The cell text content is associated with and encoded with the corresponding row and column coordinates to generate structured table data.

[0033] Optionally, in the sixth implementation of the first aspect of this application, the step of performing cross-modal feature fusion and text generation on the image region according to a preset text template, and outputting the semantic representation text corresponding to the content of the region, includes:

[0034] Obtain image data corresponding to the image class region and generate instruction text based on a preset text template; pair the image data and the instruction text to generate a cross-modal processing input pair.

[0035] Visual feature encoding is performed on the image data in the cross-modal processing input pair to extract multi-level visual feature vectors, and semantic encoding is performed on the instruction text to generate text feature vectors.

[0036] The association weights between the visual feature vector and the text feature vector are calculated using an attention mechanism.

[0037] The visual feature vector and the text feature vector are weighted and fused based on the association weights to generate the text sequence of the image region.

[0038] The logical relationships between sentences in the text sequence are analyzed, and the sentences are reorganized into paragraphs based on the analysis results to generate semantically coherent semantic representation text.

[0039] A second aspect of this application provides a PDF document content recognition device, which is used to implement a PDF document content recognition method. The PDF document content recognition device includes:

[0040] The acquisition module is used to acquire the access link of the unparsed document when an unparsed document is detected in the database;

[0041] The download module is used to download the target PDF document from the object storage service based on the access link;

[0042] The parsing module is used to parse the document based on the content areas of different page types in the target PDF document. When the content area of ​​the corresponding page type in the target PDF document is a text area, the original text character sequence in the text area is divided into multiple independent text sentence units. The text sentence units are divided into several semantically similar text blocks according to the cosine similarity between the text sentence units, and then concatenated according to the original order of the original text character sequence to generate the corresponding content parsing result.

[0043] The output module is used to encapsulate the structural information of the pages in the target PDF document with the content parsing results in a unified manner, and output a page-level intermediate structured document.

[0044] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the processor is configured to execute a computer program stored in the memory, and when the processor executes the computer program, it implements the steps of the PDF document content recognition method provided in the first aspect of this application.

[0045] The fourth aspect of this application provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the steps of the PDF document content recognition method provided in the first aspect of this application.

[0046] In summary, according to the PDF document content recognition method, apparatus, device, and storage medium provided in this application, when an unparsed document is detected in the database, the access link of the unparsed document is obtained; the target PDF document is downloaded from the object storage service according to the access link; the document is parsed according to the content areas of different page types in the target PDF document; when the content area of ​​the corresponding page type in the target PDF document is a text area, the original text character sequence in the text area is divided into multiple independent text sentence units; the text sentence units are divided into several semantically similar text blocks according to the cosine similarity between the text sentence units; and the blocks are concatenated according to the original order of the original text character sequence to generate the corresponding content parsing result; the structural information of the pages in the target PDF document and the content parsing result are uniformly encapsulated to output a page-level intermediate structured document. This application divides the original text character sequence in the text region into independent sentence units, and automatically divides semantically similar sentences into the same text block based on cosine similarity. Then, it splices the blocks together in the original order to generate paragraph text, so that the document can be parsed to extract semantically coherent and complete text content. This solves the problem of fragmented text paragraphs after PDF document recognition and effectively improves the semantic coherence of document content. Attached Figure Description

[0047] Figure 1 A flowchart illustrating the PDF document content recognition method provided in this application embodiment;

[0048] Figure 2 A schematic diagram of the program modules of the PDF document content recognition device provided in the embodiments of this application;

[0049] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0050] To make the inventive objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0051] To address the issue that the extracted text after PDF document content recognition in related technologies loses the original paragraph structure and semantic coherence, this application provides a PDF document content recognition method, such as... Figure 1 This is a flowchart illustrating the PDF document content recognition method provided in this embodiment. The PDF document content recognition method includes the following steps:

[0052] Step 110: When an unparsed document is detected in the database, obtain the access link for the unparsed document.

[0053] Specifically, when an unparsed document is detected in the database, the system periodically scans and compares the status fields or identifier information in the document management database to determine if there are any PDF document records that have not yet undergone content recognition processing. Upon detecting a record that meets the criteria, the system reads the access address information associated with that document from the corresponding document metadata. This access address typically points to a specific storage location within the object storage service.

[0054] Step 120: Download the target PDF document from the object storage service using the access link.

[0055] Specifically, based on the obtained access link, a connection is established with the object storage service using a standardized file transfer interface, and the target PDF document is downloaded completely to the local processing environment according to the path pointed to in the access link. During the download process, a file integrity verification mechanism can be used to verify the consistency of the download results, ensuring that the PDF document is not damaged or missing during transmission. By storing the document locally, the network latency issues caused by frequent access to remote storage during parsing can be avoided. At the same time, it provides stable and efficient data read and write conditions for computationally intensive operations such as image rendering, content recognition, and structural analysis, thereby improving overall parsing efficiency and processing reliability.

[0056] Step 130: Perform document parsing based on the content areas of different page types in the target PDF document. When the content area of ​​the corresponding page type in the target PDF document is a text area, divide the original text character sequence in the text area into multiple independent text sentence units. Divide the text sentence units into several semantically similar text blocks based on the cosine similarity between the text sentence units, and concatenate them according to the original order of the original text character sequence to generate the corresponding content parsing result.

[0057] Specifically, after downloading the document, the system differentiates the content across different pages of the target PDF document based on their varying characteristics. Each content area is then processed using a tailored parsing method, allowing text-intensive areas, table areas, and image / chart areas to be identified using different technical approaches. Text areas focus on character-level and semantic-level information extraction, table areas emphasize structural relationships and data unit recognition, while image areas utilize cross-modal feature fusion to achieve semantic understanding. This differentiated parsing mechanism avoids the information loss issues that arise with single parsing methods in complex page scenarios, resulting in more comprehensive and accurate content analysis. When a content area is identified as text, the original text character sequence is directly extracted from the corresponding page description information. The original text character sequence refers to the character order information without rearrangement or rewriting, fully reflecting the original text content and its arrangement on the page. Building upon this foundation, sentence boundaries are delineated from the original text character sequence. Cosine similarity is calculated for each sentence in the semantic space, and sentences with high semantic relevance are grouped into the same text unit based on the original order of the original text character sequence. Cosine similarity measures the degree of semantic closeness between different sentences; a higher value indicates stronger consistency in theme or intended expression. By continuously comparing the cosine similarity between the sentences to be processed and the formed text units, semantically coherent paragraph text is generated without relying on fixed formatting rules.

[0058] Step 140: Unify the structural information of the pages in the target PDF document with the content parsing results, and output a page-level intermediate structured document.

[0059] Specifically, the structural information corresponding to each page in the target PDF document is uniformly encapsulated with the aforementioned content parsing results to form a page-level intermediate structured document. This encapsulation process integrates the page number, the spatial relationship of the content area, the area type identifier, and the corresponding parsing semantic information, so that each page of the document has a clear and traceable representation at both the structural and semantic levels.

[0060] In an optional embodiment of this example, after the step of downloading the target PDF document from the object storage service according to the access link, the method further includes: using a single page in the target PDF document as a processing unit, rendering the vector graphics, text outlines, and embedded images in the target PDF document through pixel matrix transformation and anti-aliasing smoothing to generate a corresponding page image; performing size normalization and resolution alignment processing on the page image to obtain a processed page image; performing content feature analysis on the processed page image, and performing orientation correction on the processed page image based on the analysis results to obtain a standardized image.

[0061] In this embodiment, when parsing PDF content using a single page as the processing unit, page description information is read page by page from the target PDF document. Vector graphics, text outlines, and embedded images contained on the page are uniformly incorporated into the visualization processing flow. Vector graphics refer to lines and shapes described by mathematical paths and geometric instructions; text outlines refer to the outline curve information of characters on the page; and embedded images are image content directly stored in bitmap form. To enable content with different presentation formats to be analyzed within the same processing framework, the above information is converted into a pixel matrix representation, that is, color values ​​are assigned to each pixel position in a fixed two-dimensional coordinate grid, thereby forming a complete page image. Anti-aliasing smoothing is introduced during this conversion process. By weighting the transition of adjacent pixel colors in the edge region, the jagged edge phenomenon is reduced, making the text strokes and graphic boundaries more continuous and clear. For example, in a company's annual business analysis report, a single page contains a line chart, title text, and explanatory paragraphs. Anti-aliasing processing can prevent breaks in the edges of the lines and text strokes, thereby ensuring the stability of subsequent feature analysis. After the page image is generated, size normalization and resolution alignment processing are performed on the page image. Size normalization maps images from different sources and with varying page sizes to a unified aspect ratio, preventing inconsistencies in feature scale due to page size differences. Resolution alignment adjusts the pixel density of images to a preset level, ensuring that the same content has a similar level of detail across different pages. For example, in the same industry analysis report, some pages may originate from horizontally formatted chart pages, while others may come from vertically formatted explanatory pages. After size normalization and resolution alignment, the coordinate axis ticks and body text on different pages will present a consistent visual proportion in the image, thus avoiding misjudgment. After obtaining the processed page images, further content feature analysis is performed to determine the overall orientation of the page. Content feature analysis involves detecting the distribution of lines, the direction of text arrangement, and the center of gravity distribution of graphic structures in the image to identify whether the page is rotated, inverted, or tilted. Orientation correction, based on the analysis results, adjusts the angle of the page image to ensure that the text arrangement direction is consistent with the reading direction. For example, in a scanned version of a financial report, some pages may appear to be rotated 90 degrees counterclockwise due to scanning orientation deviation. By analyzing the arrangement direction of the table rows and columns and the arrangement trend of the title text on the page, it can be determined that the page has an orientation abnormality, and the image can be rotated and corrected accordingly. The standardized image obtained after orientation correction is consistent in both spatial structure and visual orientation.

[0062] In one optional implementation of this embodiment, after performing content feature analysis on the processed page image and correcting the orientation of the processed page image based on the analysis results to obtain a standardized image, the method further includes: predicting grid cells on the standardized image by constructing a feature map to obtain the boundary coordinates, category probabilities, and confidence scores of different content regions in the standardized image; removing content regions with duplicate boundary coordinates by non-maximum suppression and retaining the content region with the best confidence score; and determining the page type corresponding to each content region based on the category probability of the content region with the best confidence score.

[0063] In this embodiment, after obtaining a standardized image with consistent orientation and uniform scale, spatial structure analysis is performed on the image to identify the distribution of different content regions on the page. To achieve this goal, the standardized image is mapped into a multi-layer feature map. The feature map is a two-dimensional data representation obtained by performing multiple spatial transformations on the original image. Each location not only retains pixel-level information but also incorporates the shape, texture, and layout features of the surrounding area, so that regions with similar semantic attributes in the image exhibit similar numerical distributions on the feature map. The feature map is then divided into regularly arranged grid cells, each corresponding to a local region on the page, and content region prediction is performed within that local region. The prediction process revolves around three core results: boundary coordinates, category probability, and confidence score. The boundary coordinates describe the spatial location of the content region on the page, the category probability measures the likelihood that the region belongs to a certain content type, and the confidence score comprehensively reflects the reliability of the prediction result. In the specific execution process, each grid cell generates several candidate region descriptions based on local information extracted from the feature map. These candidate region descriptions provide the coordinate positions of the top-left and bottom-right corners of the rectangular boundary, and assign corresponding probability values ​​to each content type. For example, in a company's annual analysis report, chart areas often have obvious line structures and regular shapes, while the main text area presents continuous text blocks. Different candidate regions will show significant differences in category probabilities. Due to spatial overlap between adjacent grid cells, multiple candidate regions may point to the same actual content area, resulting in highly overlapping boundary coordinates. To avoid duplicate identification, a non-maximum suppression mechanism is introduced to filter candidate regions. Non-maximum suppression prioritizes retaining regions with higher confidence values ​​among multiple candidate regions with high boundary overlap, and successively eliminates regions with overlap exceeding a set threshold and low confidence, ensuring that each actual content area corresponds to only one boundary description in the final result. Through this filtering process, each valid content area on the page corresponds to a boundary coordinate result with the best confidence, and based on this result, combined with category probability information, the type of content area is determined. Category probabilities reflect the degree of matching of a region across different content types. By comparing the probability values ​​of each category, the type with the highest probability is selected as the page type identifier for that region. For example, in the same analysis report, if a rectangular region has a significantly higher probability for text type than for image type and table type, the system can identify that region as a text region; while another rectangular region has a higher probability for image type and is identified as an image region. Through this process, various content regions on the page are not only clearly divided in spatial location but also clearly labeled in semantic attributes, thus providing a reliable basis for subsequent differentiated analysis based on content region type and ensuring the completeness and consistency of page structure understanding.

[0064] In one optional implementation of this embodiment, the step of parsing the document based on the content areas of different page types in the target PDF document includes: when the content area is a table-type area, performing feature recognition on the table-type area, performing corresponding cell boundary detection based on the recognition results, and extracting the structured table data of the table-type area; when the content area is an image-type area, performing cross-modal feature fusion and text generation on the image-type area based on a preset text template, and outputting the semantic representation text corresponding to the area content.

[0065] In this embodiment, after completing the spatial positioning and type determination of the page content area, the content in the page is further differentiated based on the page type information corresponding to each content area, so that areas with different semantic attributes enter the matching parsing path. In this context, page type refers to the expressive function of the content area on the page, such as continuous text descriptions, data sets presented in row-column relationships, or visual content that carries information in graphic form. Through this differentiation process, the content areas in the page are clearly divided into text areas, table areas, and image areas, thereby avoiding information loss or semantic distortion caused by processing different forms of content with a single parsing method. When a content area is identified as a table area, the focus is on identifying the data structure features contained within it. The feature recognition process for table areas analyzes the distribution of lines within the area, the rules of cell boundaries, and the consistency of row and column arrangement of text to determine whether there is a clear cell division relationship within the area. Based on the recognition results, cell boundary detection is performed within the area to determine the spatial range of each data unit, and the text content within the cell is further extracted. Then, based on the horizontal and vertical arrangement relationship between cells, a row-column correspondence is constructed, thereby forming structured table data. For example, in an annual business analysis report, a table displaying quarterly revenue, after cell boundary recognition, can clearly distinguish between the quarterly name column and the numerical column, while maintaining the correspondence between each data unit on the row and column coordinates. When a content area is identified as an image area, a preset text template is introduced to provide semantic guidance. The preset text template is an instructional text used to describe the parsing objectives and output requirements, guiding the system to focus on the key information conveyed in the image. In this process, the visual features contained in the image and the semantic constraints expressed by the text template are simultaneously input into the parsing process. Through cross-modal feature fusion, visual and linguistic information are combined to generate textual results that describe the meaning of the image content. Cross-modal feature fusion refers to the correlation modeling of information from different sources in the same semantic space, enabling trends, proportions, or structural relationships in images to be transformed into textual expressions. For example, in the bar chart page of an annual business analysis report, after this processing, image areas can output semantic text representing the trends and comparisons of quarterly performance changes, thus transforming information originally presented only in visual form into searchable and understandable linguistic content.

[0066] In one optional implementation of this embodiment, the steps of dividing the original text character sequence in the text region into multiple independent text sentence units, dividing the text sentence units into several semantically similar text blocks based on the cosine similarity between the text sentence units, and concatenating them according to the original order of the original text character sequence to generate the corresponding content parsing result include: performing sentence boundary recognition on the original text character sequence; dividing the original text character sequence into multiple independent text sentence units based on punctuation and line break features; converting the text sentence units into corresponding sentence vectors through vector space mapping; and using the previously processed text... This segment is the current segment. The maximum cosine similarity value between the sentence vector to be processed and all sentence vectors within the current segment, as well as the minimum cosine similarity value among all sentence vectors within the current segment, are determined. If the minimum cosine similarity value is less than the maximum cosine similarity value, the text sentence unit corresponding to the sentence vector to be processed is added to the current segment. If the minimum cosine similarity value is not less than the maximum cosine similarity value, a new text segment is created, with the sentence vector to be processed as the starting unit. All text sentence units belonging to the same text segment are connected in their original order, and paragraph separators are inserted between adjacent text sentence units to generate semantically coherent paragraph text.

[0067] In this embodiment, after extracting the original text from the text-type region, sentence boundary recognition processing is required on the obtained original text character sequence. The original text character sequence maintains the original arrangement order of characters on the page, which includes both continuous text and line breaks caused by layout. Sentence boundary recognition is accomplished by analyzing the punctuation and line break features in the character sequence. Punctuation marks indicate the natural pauses in semantic expression, while line breaks reflect the page layout's division of text. Combining their distribution relationship, the character sequence is divided into multiple relatively independent text sentence units, ensuring that each unit has a complete semantic meaning. For example, in the explanatory section of an annual business analysis report, a description may be split into multiple lines due to page width limitations. By identifying the relationship between periods and line breaks, each complete business description can be accurately reconstructed. After obtaining the text sentence units, each sentence is mapped to a vector space to generate a corresponding sentence vector. A vector space is an abstract space that represents semantic features in numerical form. Sentence vectors encode the meaning of words in a sentence and their combination relationships, so that semantically similar sentences exhibit a small distance or a high cosine similarity in the space. Through this mapping process, text originally existing in character form is transformed into an expression form that can be used for numerical calculations. After sentence vector generation, the already processed text block is used as the current block, and the sentence vector to be processed is introduced for comparison. A text block refers to a set of several semantically related sentence units, used to represent a relatively complete semantic paragraph. By calculating the cosine similarity between the sentence vector to be processed and all sentence vectors in the current block, and taking the maximum cosine similarity value, this value reflects the degree of association between the sentence to be processed and the closest semantic content in the current block. At the same time, the cosine similarity between each pair of sentence vectors in the current block is calculated, and the minimum cosine similarity value is taken, which reflects the lower limit of semantic consistency within the block. By introducing these two values ​​simultaneously, the belonging relationship of new sentences can be determined while maintaining the semantic stability within the block. When the minimum cosine similarity value within the current block is less than the maximum cosine similarity value between the sentence vector to be processed and the sentence vectors within the block, it indicates that the sentence to be processed has a strong semantic connection with at least one sentence in the block and will not significantly reduce the overall semantic consistency of the block. Therefore, the sentence is merged into the current block. Conversely, when the minimum cosine similarity value is not less than the maximum cosine similarity value, it indicates that the semantics within the current block are relatively concentrated, and the degree of connection between the sentence to be processed and the block is insufficient to support the merging operation. In this case, the system will use the sentence as the starting unit to create a new text block. For example, in an annual business analysis report, after a description of changes in the market environment, a description of changes in financial indicators appears immediately. The two parts are clearly distinguishable in terms of theme, and the above comparison mechanism can automatically divide them into different text blocks.After all sentences are grouped into blocks, all text sentence units belonging to the same text block are connected in their original order of appearance, and paragraph separators are inserted between adjacent sentences. This process preserves the original reading order of the text while clearly defining paragraph boundaries, thus generating semantically coherent and structurally clear paragraph text.

[0068] It should be noted that before the text is segmented into blocks, after the text is converted into vector representations sentence by sentence, the semantic structure no longer depends on the literal form, but is reflected through the spatial relationships between vectors. Each sentence corresponds to a position in high-dimensional space, and this position is determined by semantics; sentences with similar meanings are close in space. Relying solely on the original vectors presents a problem: some sentences, due to weak context, do not fully express their information and thus deviate from their true semantic position in space. To address this deviation, a semantic graph propagation mechanism is introduced. Specifically, each sentence is treated as a node, and connections are established between nodes based on similarity. When two sentences are semantically close, an edge is created between them. Subsequently, a finite number of rounds of information diffusion occur, with each node receiving semantic information from its neighbors and adjusting its own vector. This process can be understood as a sentence expressing its own semantics while also absorbing the semantic features of similar sentences, thus making the expression more stable. For example, in a text about "online shopping experience," the phrases "smooth payment process" and "no lag at checkout" differ slightly in their original expression. However, after propagation, they become closer because they both point to the semantic region of "good payment experience." After obtaining the corrected sentence vectors, the similarity calculation within a block no longer simply treats all sentences equally but introduces a position-aware mechanism. Text has a natural sequential structure, and adjacent sentences are often semantically more related, while sentences that are far apart, even if expressing similar content, may not belong to the same semantic segment. Therefore, when the current sentence participates in block segmentation, only sentences within a certain range around it are considered, and this range is controlled by a window. Each sentence within the window receives different levels of importance based on two factors: semantic proximity and distance from the current sentence. These two factors can be used to calculate the weight assigned to each sentence. Semantic proximity is reflected by the angle between vectors (i.e., cosine similarity); the closer they are, the more similar their content. Distance is reflected by the difference in the sentence's position in the original text; the greater the distance, the weaker its influence, and the smaller its weight. To make the distribution of similarity more controllable, a moderating factor is introduced. This factor affects whether the differences between similarities are amplified or compressed, controlling the smoothness of the similarity distribution and thus changing the final weight distribution. For example, when the moderating factor is inversely proportional to cosine similarity, a smaller moderating factor further amplifies the weights of highly similar sentences, resulting in a sharper distribution and making the block more sensitive to semantically related sentences; a larger moderating factor makes the weights of each sentence more uniform, leading to a more conservative block distribution. After uniform adjustment, the weights of all sentences within the window form a distribution with a fixed sum, used for subsequent weighted calculations. Within the same block, a key indicator also needs to be considered: the least similar sentence pairs within the block.This metric reflects the semantic boundaries within a segment. If the semantic difference between two sentences is significant, it indicates that the current segment is approaching its capacity limit. For example, in the scenario of "online shopping experience," if a segment contains both "smooth product browsing" and "severe logistics and delivery delays," the semantic difference between the two will be identified as a low similarity, thus indicating that cross-topic issues have emerged within the segment.

[0069] When a new sentence arrives, it needs to be determined whether it should be included in the current chunk. Again, based on a position-aware weighted mechanism, the new sentence is compared one by one with existing sentences in the window, and the one with the closest semantics is selected as a representative. This representative reflects the highest degree of fit between the new sentence and the current chunk. If this highest degree of fit still cannot compensate for the semantic differences already existing within the chunk, then further expansion of the chunk will lead to semantic mixing, and a new text chunk should be created. Conversely, if the new sentence is highly consistent with a sentence in the chunk, it indicates that the chunk still has room for expansion. Even if there are other slightly different sentences in the chunk, the new sentence can still be absorbed because the local semantics remain consistent. The final chunking decision relies on semantic drift detection. During text expansion, the theme may abruptly change or gradually transition. To identify this change, it is necessary to continuously record the similarity trend in the most recent text segment and smooth this trend to form a stable reference baseline. The similarity of the current sentence is compared with this baseline. If the deviation increases significantly, it indicates that the semantics have changed; this change is no longer a local fluctuation but a structural shift. The deviation is standardized to obtain a comparable value, which is used to determine whether the current sentence belongs to a new semantic stage. Once this value exceeds a set range, a new chunk boundary is triggered directly, and other conditions are no longer compared. If no significant drift occurs, the aforementioned similarity comparison logic is entered, and the attribution relationship is determined by comparing the "highest fit between the new sentence and the chunk" and the "weakest connection within the chunk".

[0070] In one optional implementation of this embodiment, the steps of performing feature recognition on table-like regions, detecting cell boundaries based on the recognition results, and extracting structured table data from the table-like regions include: performing feature recognition on table-like regions, extracting image features of the table-like regions, and determining whether the table-like regions belong to bordered or borderless table types based on preset classification rules; if the table-like regions belong to bordered table types, then performing table line detection and cell boundary segmentation to determine cell boundaries; if the table-like regions belong to borderless table types, then recognizing the row and column structure of the table, and inferring row and column dividing lines based on image features and spatial position relationships; performing text recognition on independent cell regions divided based on cell boundaries or row and column dividing lines to obtain cell text content, and establishing row and column coordinate relationships between cells based on the row and column topology structure formed by cell boundaries or row and column dividing lines; and associating and encoding the cell text content with the corresponding row and column coordinate relationships to generate structured table data.

[0071] In this embodiment, after a content area on the page is determined to be a table-like area, feature recognition processing is performed on that area to extract image features that reflect the structural characteristics of the table. In this context, image features refer to information expressions that describe the distribution of lines, edge continuity, text arrangement patterns, and geometric alignment within the area. By comprehensively analyzing the horizontal and vertical line density, the number of line intersections, and the alignment of text in the horizontal and vertical directions within the table-like area, it is determined whether the area has clearly visible boundary lines. The preset classification rule is a judgment logic established based on the above features, used to distinguish whether the table relies on explicit lines to divide the unit structure. When there are continuous and regularly distributed straight lines in the area, and the line intersections can form a stable grid structure, the area is determined to be a bordered table type; when the area lacks complete lines, but the text shows a clear alignment relationship in the row and column directions, it is determined to be a borderless table type. For example, in an annual business analysis report, a table displaying quarterly revenue data, if divided into units by complete horizontal and vertical lines, conforms to the characteristics of a bordered table; while a table displaying departmental indicator comparisons, if its structure is only indicated by text alignment, conforms to the characteristics of a borderless table. When a table-like area is determined to be a bordered table, further table line detection processing is performed. By analyzing pixel brightness variations and edge continuity in the image, horizontal and vertical dividing lines are identified. The goal of table line detection is to clarify the specific location of the lines in space and determine the cell boundary range through the intersection relationships between the lines. Cell boundary segmentation, based on the identified lines, treats the closed or semi-closed areas enclosed by the lines as independent data units, thus obtaining clear cell division results. When a table-like area is determined to be a borderless table, the cell division position is inferred by identifying the table's row and column structure. Row and column structure recognition determines the row distribution by analyzing the vertical spacing changes of text blocks, and simultaneously determines the column distribution range by combining the horizontal alignment relationships of text blocks. Spatial relationships play a crucial role in this process. By comparing the center and edge positions of adjacent text blocks, potential row and column dividing lines are inferred, thus constructing an implicit table structure without border lines. For example, in the same annual business analysis report, although the department performance comparison table does not have borders, the department names and corresponding indicators are visually arranged in a regular pattern. The implicit row and column boundaries can be inferred through alignment analysis. After determining the cell boundaries or row and column dividing lines, the table area is divided into multiple independent cell areas, and text recognition processing is performed on each cell area to extract its text content. The output of text recognition maintains a one-to-one correspondence with the spatial position of the corresponding cell, ensuring that each piece of text can be accurately mapped to its row and column.Subsequently, based on the overall structure formed by cell boundaries or row and column dividing lines, the row and column coordinate relationships between cells are established. These relationships describe the relative position of a cell within the table, such as its row and column number, thus fully preserving the table's structural semantics. After obtaining the cell text content and its row and column coordinate relationships, the two are associatively encoded, creating a unified data representation of the text content and its structural position within the table. Associative encoding refers to storing text values ​​in combination with their corresponding row and column indices, giving the table data a clear structural description capability at the logical level. Through this process, tables that originally existed only in visual form are transformed into structured table data, accurately reflecting the correspondence between various indicators in the annual business analysis report.

[0072] In one optional implementation of this embodiment, the step of performing cross-modal feature fusion and text generation on image-type regions according to a preset text template, and outputting semantic representation text corresponding to the region content, includes: acquiring image data corresponding to the image-type regions and generating instruction text based on the preset text template; pairing the image data and instruction text to generate cross-modal processing input pairs; performing visual feature encoding on the image data in the cross-modal processing input pairs to extract multi-level visual feature vectors, and performing semantic encoding on the instruction text to generate text feature vectors; calculating the association weight between the visual feature vectors and text feature vectors through an attention mechanism; performing weighted fusion on the visual feature vectors and text feature vectors based on the association weights to generate a text sequence of image-type regions; analyzing the logical relationships between sentences in the text sequence, and performing paragraph reorganization operations on the sentences based on the analysis results of the logical relationships to generate semantically coherent semantic representation text.

[0073] In this embodiment, after a content area is identified as an image region, image data corresponding to that region is extracted from the page-level structured information. This image data maintains the complete visual representation of the region on the page, including its graphic shape, color distribution, text annotations, and spatial layout. Simultaneously, instruction text is generated based on a preset text template. The preset text template is a set of structured statements describing the parsing objectives and output requirements in natural language, clarifying the focus of image understanding, such as emphasizing descriptions of data relationships, trend changes, or structural composition. By pairing image data with instruction text, cross-modal processing input pairs are constructed, allowing visual information and linguistic constraints to be perceived simultaneously within the same processing context, thus avoiding information deviation caused by a lack of semantic guidance in the image parsing process. For example, in an annual business analysis report, the instruction text for a bar chart displaying quarterly revenue changes explicitly requires attention to the trend over time and the numerical comparison between different quarters. After generating the cross-modal processing input pairs, visual feature encoding is performed on the image data within them. Visual feature encoding refers to transforming the colors, shapes, edge distributions, and spatial structural relationships in an image into multi-level numerical representations, enabling the image content to participate in subsequent calculations in vector form. These multi-level visual feature vectors reflect information at both the local detail level and the overall structural level, such as the height differences of individual bars and the arrangement trends of a group of bars over time. Simultaneously, the system performs semantic encoding on the instruction text, transforming the meanings of words, syntactic relationships, and instruction intent into text feature vectors. These text feature vectors express the semantic emphasis of the instruction text in the numerical space, allowing the visual parsing process to revolve around a clear understanding objective. After obtaining the visual and text feature vectors, an attention mechanism is used to calculate the correlation between them. This attention mechanism is a computational method used to measure the correlation between different information fragments; its core lies in assigning weight values ​​to the correspondence between visual and text features. Through this mechanism, the system can identify which visual features in the image have a stronger correlation with the semantic points in the instruction text and assign them higher weights. For example, in the analysis of a quarterly revenue bar chart, visual features related to changes in bar height will have a higher association weight with semantic expressions such as "growth" and "decline" in the instruction text, while visual features related to background decoration will be assigned a lower weight, thus reducing their impact on the final result. After the association weights are calculated, the visual feature vector and the text feature vector are weighted and fused based on these weights. Weighted fusion refers to combining different features according to their association weights, so that visual information and linguistic information form a unified expression in the same semantic space. The fusion result is presented in the form of a text sequence, which consists of several sentences, each sentence corresponding to a linguistic description of a key information point in the image.For example, the numerical changes in a bar chart for each year or quarter are transformed into sentence fragments describing the growth rate or comparative relationships, thus giving the image content a readable linguistic expression. After generating the text sequence, the logical relationships between the sentences in the text sequence are further analyzed. Logical relationship analysis focuses on the connections between sentences at the causal, comparative, progressive, or parallel levels. By identifying the degree of semantic coherence between sentences, it determines which sentences should be grouped into the same semantic unit. Based on the analysis results, paragraph reorganization is performed on the sentences, organizing sentences with similar or mutually supporting expressions into the same paragraph, forming a semantically clear and coherent text representation.

[0074] It should be noted that before the image enters the semantic parsing process, the image data corresponding to the image category region is first acquired, and the resolution, number of pixels, and color information scale of this image data are evaluated. This evaluation process is used to determine whether there is redundant visual information in the current image data while maintaining its semantic expressiveness. Redundant visual information refers to parts that contribute little to the overall semantics of the image but occupy a lot of data space at the pixel level, such as large background areas, repeating color blocks, or overly high-precision gradient details. By analyzing the pixel distribution and content density of the image, the system can identify image regions or the entire image suitable for compression processing. After completing the evaluation, the image is compressed using resolution downsampling and image quality compression. Resolution downsampling reduces the number of pixels in the image while maintaining the clarity of the main structure and key content, thereby reducing the data scale required for subsequent parsing. Image quality compression reduces the amount of image data by adjusting the expression precision of color and brightness information in the image, while avoiding significant impact on key edges, text annotations, or data graphics. The compression process is constrained by semantic recognizability, ensuring that the chart structure, data trends, and key visual elements in the image can still be effectively distinguished and understood after compression. After image compression, the compressed image data and corresponding semantic parsing instructions are sent to the parsing process. Due to the significant reduction in image data size, the computational resources, processing time, and related call costs required during parsing decrease simultaneously, thus achieving cost control at the overall system level. Simultaneously, by analyzing image content features before compression, excessive loss of key semantic information is avoided, ensuring that the parsing results remain stable and consistent in trend judgment, structural understanding, and semantic expression. Through these methods, this technical solution effectively reduces resource consumption and operating costs in the multimodal parsing process while ensuring the quality of image semantic parsing, improving the system's sustainable operation capability in large-scale PDF document processing scenarios.

[0075] After completing page-level content parsing, the output results from different parsing paths need to be aggregated. Paragraph text generated from text-based regions, structured table data generated from table-based regions, and semantically represented text generated from image-based regions are all organized according to the page dimension and associated with their corresponding document identifiers. By combining page numbers, region location identifiers, and content type identifiers, it can be ensured that each parsing result retains a clear source after storage, preventing semantic content from becoming detached from the original document structure.

[0076] In terms of storage structure design, a unified data representation format is adopted to encapsulate different types of parsing results. This representation format standardizes the expression of content type, semantic text, structural information, and spatial location information through field-based descriptions, ensuring a consistent organizational form for text semantics, tabular semantics, and image semantics at the data level. For tabular data, structured information and corresponding semantic descriptions are retained simultaneously, allowing numerical relationships and semantic interpretations to coexist. For image semantic results, the key information carried by the image is expressed in natural language form, while retaining its page and region identifiers. Through this unified encapsulation method, parsing results of different modalities can be managed by the same storage and access mechanism, avoiding the data fragmentation problem caused by distributed storage. After completing the unified storage of parsing results, the content undergoes vectorization preparation. Vectorization preparation does not directly generate vectors but rather organizes and cleans the stored content into semantic units, making it suitable for the vector representation process. This processing includes deduplication, standardization, and length control of the semantic text, ensuring that the text content maintains semantic integrity while meeting the input requirements for vector representation. By organizing text paragraphs, table semantic descriptions, and image semantic text into content units with consistent semantic granularity, problems such as uneven semantic granularity or information redundancy can be avoided in vector representation. During vectorization preparation, the parsed content is bound to corresponding document metadata, including document source, page location, and content type identifier. Through this binding method, the generated semantic vectors can not only be used for cosine similarity calculation or semantic retrieval, but also accurately locate specific pages and content areas of the original document when retrieval results are returned. This technical solution provides a high-quality, scalable data foundation for semantic vector construction, retrieval applications, and content generation through unified storage and standardized organization of multimodal parsing results, enabling the full utilization of multimodal parsing results in real-world business scenarios.

[0077] According to the PDF document content recognition method provided in this application, when an unparsed document is detected in the database, an access link to the unparsed document is obtained; the target PDF document is downloaded from the object storage service based on the access link; the document is parsed according to the content areas of different page types in the target PDF document to obtain the content parsing results; the structural information of the pages in the target PDF document and the content parsing results are uniformly encapsulated to output a page-level intermediate structured document. This application automatically triggers the parsing process after the document is entered into the database and adopts differentiated parsing paths based on page content types, enabling the complete recognition and unified expression of text information, tabular data, and image semantics in the PDF document. This overcomes the problem of missing chart information caused by relying solely on text parsing or character recognition, and significantly improves the parsing completeness and semantic accuracy of complex PDF documents.

[0078] Figure 2 This application provides a PDF document content recognition device, which can be used to implement the PDF document content recognition method in the foregoing embodiments. For example... Figure 2 As shown, the PDF document content recognition device mainly includes:

[0079] The acquisition module 10 is used to obtain the access link of the unparsed document when an unparsed document is detected in the database;

[0080] Download module 20 is used to download the target PDF document from the object storage service based on the access link;

[0081] The parsing module 30 is used to parse the document according to the content area of ​​different page types in the target PDF document. When the content area of ​​the corresponding page type in the target PDF document is a text area, the original text character sequence in the text area is divided into multiple independent text sentence units. The text sentence units are divided into several semantically similar text blocks according to the cosine similarity between the text sentence units, and then spliced ​​according to the original order of the original text character sequence to generate the corresponding content parsing result.

[0082] Output module 40 is used to encapsulate the structural information of the pages in the target PDF document with the content parsing results in a unified manner, and output a page-level intermediate structured document.

[0083] In an optional embodiment of this example, the acquisition module is further configured to: take a single page in the target PDF document as a processing unit, render the vector graphics, text outlines and embedded images in the target PDF document through pixel matrix transformation and anti-aliasing smoothing to generate a corresponding page image; perform size normalization and resolution alignment processing on the page image to obtain a processed page image; perform content feature analysis on the processed page image, and perform orientation correction on the processed page image based on the analysis results to obtain a standardized image.

[0084] In an optional implementation of this embodiment, the acquisition module is further configured to: predict grid cells in the standardized image by constructing a feature map, and obtain the boundary coordinates, class probabilities, and confidence scores of different content regions in the standardized image; remove content regions with duplicate boundary coordinates by non-maximum suppression, and retain the content region with the best confidence score; and determine the page type corresponding to each content region based on the class probability of the content region with the best confidence score.

[0085] In one optional implementation of this embodiment, the parsing module is specifically used for: when the content area is a table-like area, performing feature recognition on the table-like area, performing corresponding cell boundary detection based on the recognition results, and extracting structured table data of the table-like area; when the content area is an image-like area, performing cross-modal feature fusion and text generation on the image-like area based on a preset text template, and outputting the semantic representation text corresponding to the area content.

[0086] In an optional implementation of this embodiment, the parsing module is further configured to: perform sentence boundary recognition on the original text character sequence, and divide the original text character sequence into multiple independent text sentence units based on punctuation and newline features; convert the text sentence units into corresponding sentence vectors through vector space mapping; take the previously processed text block as the current block, determine the maximum cosine similarity value between the sentence vector to be processed and all sentence vectors in the current block, and the minimum cosine similarity value between all sentence vectors in the current block; if the minimum cosine similarity value is less than the maximum cosine similarity value, add the text sentence unit corresponding to the sentence vector to be processed to the current block; if the minimum cosine similarity value is not less than the maximum cosine similarity value, create a new text block and use the sentence vector to be processed as the starting unit; connect all text sentence units belonging to the same text block in the original order, and insert paragraph separators between adjacent text sentence units to generate semantically coherent paragraph text.

[0087] In an optional implementation of this embodiment, the parsing module is further configured to: perform feature recognition on the table-like region, extract the image features of the table-like region, and determine whether the table-like region belongs to a bordered table type or a borderless table type based on preset classification rules; if the table-like region belongs to a bordered table type, then perform table line detection and cell boundary segmentation on the table-like region to determine the cell boundaries; if the table-like region belongs to a borderless table type, then identify the row and column structure of the table, and infer the row and column dividing lines based on image features and spatial position relationships; perform text recognition on the independent cell regions divided based on cell boundaries or row and column dividing lines, obtain the cell text content, and establish the row and column coordinate relationship between each cell based on the row and column topology structure formed by the cell boundaries or row and column dividing lines; and associate and encode the cell text content with the corresponding row and column coordinate relationship to generate structured table data.

[0088] In an optional implementation of this embodiment, the parsing module is further configured to: acquire image data corresponding to the image-type region and generate instruction text based on a preset text template; pair the image data and instruction text to generate a cross-modal processing input pair; perform visual feature encoding on the image data in the cross-modal processing input pair to extract multi-level visual feature vectors, and perform semantic encoding on the instruction text to generate a text feature vector; calculate the association weight between the visual feature vector and the text feature vector through an attention mechanism; perform weighted fusion of the visual feature vector and the text feature vector based on the association weight to generate a text sequence of the image-type region; analyze the logical relationship between sentences in the text sequence, and perform paragraph reorganization operation on the sentences based on the analysis results of the logical relationship to generate a semantically coherent semantic representation text.

[0089] According to the PDF document content recognition device provided in this application, when an unparsed document is detected in the database, an access link to the unparsed document is obtained; the target PDF document is downloaded from the object storage service based on the access link; the document is parsed according to the content areas of different page types in the target PDF document to obtain the content parsing results; the structural information of the pages in the target PDF document and the content parsing results are uniformly encapsulated to output a page-level intermediate structured document. This application automatically triggers the parsing process after the document is entered into the database and adopts differentiated parsing paths based on page content types, enabling the complete recognition and unified expression of text information, tabular data, and image semantics in the PDF document. This overcomes the problem of missing chart information caused by relying solely on text parsing or character recognition, significantly improving the parsing completeness and semantic accuracy of complex PDF documents.

[0090] According to the scheme provided in this application Figure 3An electronic device is provided as an embodiment of this application. This electronic device can be used to implement the PDF document content recognition method in the foregoing embodiments, and mainly includes:

[0091] The system includes a memory 301, a processor 302, and a computer program 303 stored on the memory 301 and executable on the processor 302. The memory 301 and the processor 302 are connected via communication. When the processor 302 executes the computer program 303, it implements the PDF document content recognition method described in the foregoing embodiments. The number of processors can be one or more.

[0092] The memory 301 can be a high-speed random access memory (RAM) or a non-volatile memory, such as a disk storage device. The memory 301 is used to store executable program code, and the processor 302 is coupled to the memory 301.

[0093] Furthermore, embodiments of this application also provide a computer-readable storage medium, which may be disposed in the electronic device described in the above embodiments, and the computer-readable storage medium may be as described above. Figure 3 The memory in the illustrated embodiment.

[0094] The computer-readable storage medium stores a computer program that, when executed by a processor, implements the PDF document content recognition method described in the foregoing embodiments. Furthermore, the computer-readable storage medium can also be a USB flash drive, external hard drive, read-only memory (ROM), RAM, magnetic disk, or optical disk, or any other medium capable of storing program code.

[0095] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0096] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0097] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for recognizing the content of a PDF document, characterized in that, include: When an unparsed document is detected in the database, obtain the access link for the unparsed document; Download the target PDF document from the object storage service using the access link provided; Document parsing is performed based on the content areas of different page types in the target PDF document. When the content area of ​​the corresponding page type in the target PDF document is a text area, the original text character sequence in the text area is divided into multiple independent text sentence units. The text sentence units are divided into several semantically similar text blocks according to the cosine similarity between the text sentence units. The blocks are then concatenated according to the original order of the original text character sequence to generate the corresponding content parsing result. The structural information of the pages in the target PDF document and the content parsing results are uniformly encapsulated to output a page-level intermediate structured document; The steps of dividing the original text character sequence in the text region into multiple independent text sentence units, dividing the text sentence units into several semantically similar text blocks based on the cosine similarity between the text sentence units, and concatenating them according to the original order of the original text character sequence to generate the corresponding content parsing result include: Sentence boundary recognition is performed on the original text character sequence, and the original text character sequence is divided into multiple independent text sentence units based on punctuation marks and line breaks. The text sentence units are converted into corresponding sentence vectors through vector space mapping; Using the previously processed text block as the current block, determine the maximum cosine similarity value between the sentence vector to be processed and all sentence vectors in the current block, as well as the minimum cosine similarity value between all sentence vectors in the current block; If the minimum cosine similarity value is less than the maximum cosine similarity value, then the text sentence unit corresponding to the sentence vector to be processed is added to the current block; If the minimum cosine similarity value is not less than the maximum cosine similarity value, then a new text block is created and the sentence vector to be processed is used as the starting unit. All text sentence units belonging to the same text block are connected in their original order, and paragraph separators are inserted between adjacent text sentence units to generate semantically coherent paragraph text.

2. The PDF document content recognition method according to claim 1, characterized in that, Following the step of downloading the target PDF document from the object storage service according to the access link, the method further includes: Using a single page in the target PDF document as a processing unit, the vector graphics, text outlines and embedded images in the target PDF document are rendered into corresponding page images through pixel matrix transformation and anti-aliasing smoothing. The page image is subjected to size normalization and resolution alignment to obtain the processed page image; The processed page image is subjected to content feature analysis, and the orientation of the processed page image is corrected based on the analysis results to obtain a standardized image.

3. The PDF document content recognition method according to claim 2, characterized in that, After the steps of performing content feature analysis on the processed page image and correcting the orientation of the processed page image based on the analysis results to obtain a standardized image, the method further includes: By constructing a feature map, grid cell prediction is performed on the standardized image to obtain the boundary coordinates, class probabilities, and confidence scores of different content regions in the standardized image. The content region with the best confidence score is retained by removing the content region with repeated boundary coordinates through non-maximum suppression. The page type corresponding to each content area is determined based on the category probability of the content area with the best confidence level.

4. The PDF document content recognition method according to claim 1, characterized in that, The step of parsing the document based on the content regions of different page types in the target PDF document further includes: When the content area is a table-type area, feature recognition is performed on the table-type area, and corresponding cell boundary detection is performed based on the recognition results to extract the structured table data of the table-type area; When the content region is an image region, cross-modal feature fusion and text generation are performed on the image region according to a preset text template, and the semantic representation text corresponding to the content region is output.

5. The PDF document content recognition method according to claim 4, characterized in that, The steps of performing feature recognition on the table-like region, performing corresponding cell boundary detection based on the recognition results, and extracting structured table data from the table-like region include: The table-like region is subjected to feature recognition, the image features of the table-like region are extracted, and the table-like region is determined to be a bordered table type or a borderless table type based on the preset classification rules. If the table-type area is a bordered table type, then the table-type area is subjected to table line detection and cell boundary segmentation to determine the cell boundaries; If the table-like region is a borderless table type, then the row and column structure of the table is identified, and the row and column dividing lines are inferred by combining the image features and spatial position relationships; Text recognition is performed on the independent cell regions divided by the cell boundaries or row and column dividing lines to obtain the cell text content, and the row and column coordinate relationship between each cell is established based on the row and column topology structure formed by the cell boundaries or row and column dividing lines. The cell text content is associated with and encoded with the corresponding row and column coordinates to generate structured table data.

6. The PDF document content recognition method according to claim 4, characterized in that, The step of performing cross-modal feature fusion and text generation on the image region based on a preset text template, and outputting the semantic representation text corresponding to the content region, includes: Obtain image data corresponding to the image class region and generate instruction text based on a preset text template; pair the image data and the instruction text to generate a cross-modal processing input pair. Visual feature encoding is performed on the image data in the cross-modal processing input pair to extract multi-level visual feature vectors, and semantic encoding is performed on the instruction text to generate text feature vectors. The association weights between the visual feature vector and the text feature vector are calculated using an attention mechanism. The visual feature vector and the text feature vector are weighted and fused based on the association weights to generate the text sequence of the image region. The logical relationships between sentences in the text sequence are analyzed, and the sentences are reorganized into paragraphs based on the analysis results to generate semantically coherent semantic representation text.

7. A PDF document content recognition device, characterized in that, The PDF document content recognition device is used to implement the PDF document content recognition method according to claim 1, and the PDF document content recognition device includes: The acquisition module is used to acquire the access link of an unparsed document when an unparsed document is detected in the database; The download module is used to download the target PDF document from the object storage service based on the access link; The parsing module is used to parse the document based on the content areas of different page types in the target PDF document. When the content area of ​​the corresponding page type in the target PDF document is a text area, the original text character sequence in the text area is divided into multiple independent text sentence units. The text sentence units are divided into several semantically similar text blocks according to the cosine similarity between the text sentence units, and then concatenated according to the original order of the original text character sequence to generate the corresponding content parsing result. The output module is used to encapsulate the structural information of the pages in the target PDF document with the content parsing results in a unified manner, and output a page-level intermediate structured document. The parsing module is specifically used to perform sentence boundary recognition on the original text character sequence, divide the original text character sequence into multiple independent text sentence units based on punctuation and line break features; convert the text sentence units into corresponding sentence vectors through vector space mapping; take the previously processed text block as the current block, determine the maximum cosine similarity value between the sentence vector to be processed and all sentence vectors in the current block, and the minimum cosine similarity value between all sentence vectors in the current block; if the minimum cosine similarity value is less than the maximum cosine similarity value, then add the text sentence unit corresponding to the sentence vector to be processed to the current block; if the minimum cosine similarity value is not less than the maximum cosine similarity value, then create a new text block and use the sentence vector to be processed as the starting unit; connect all text sentence units belonging to the same text block in their original order, and insert paragraph separators between adjacent text sentence units to generate semantically coherent paragraph text.

8. An electronic device, characterized in that, Includes memory and processor, of which: The processor is used to execute computer programs stored in the memory; When the processor executes the computer program, it implements the steps in the PDF document content recognition method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps in the PDF document content recognition method according to any one of claims 1 to 6.