A frameless line table accurate identification method based on a positioning algorithm

By using a positioning algorithm to obtain page objects and their structural information from PDF files, and identifying and locating table areas, the problem of low accuracy in recognizing borderless tables is solved, reducing costs and resource consumption, and improving processing efficiency.

CN116129454BActive Publication Date: 2026-02-10EAST MONEY INFORMATION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310072503.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-17
Publication Date
2026-02-10
Estimated Expiration
2043-01-17

AI Technical Summary

Technical Problem

The existing methods for recognizing borderless tables in PDF documents have low accuracy, high training or configuration costs, long processing time, and high computational resource consumption.

Method used

By using a positioning algorithm, the page objects and their structural information of the PDF file are obtained, the effective area of ​​the page is identified, the table area is located, the row and column positions are divided, and the table structure information is generated.

Benefits of technology

It improves the recognition accuracy of borderless tables, reduces training and configuration costs, and reduces processing time and computing resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116129454B_ABST
    Figure CN116129454B_ABST
Patent Text Reader

Abstract

The application discloses a kind of frameless line table accurate identification method based on positioning algorithm, any format table (frame line table, frameless line table, partial frame line table) in PDF format file can be converted into unified structured data format by the method disclosed in the application, to facilitate further application and processing.Compared with prior art, the application has the following characteristics:1) improve the recognition accuracy of frameless complex table;2) without complex configuration and labeling and training, low requirement for users;3) short processing time, low computing resource consumption;4) can adapt to various business scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for accurately recognizing borderless tables. For borderless tables in PDF documents, a precise positioning algorithm based on the text coordinates of the PDF content is used to accurately locate the row and column positions of the borderless table, thereby converting the borderless table into a table with borders. Background Technology

[0002] In today's world of increasingly sophisticated information systems, electronic documents have become a crucial means of presenting and acquiring information in people's work and daily lives. Tables, as a highly centralized and concise means of information expression, are widely used across various industries. To improve data flow efficiency and rapidly increase the value of data assets, there is a growing demand for the automatic and efficient identification, processing, and storage of tables, with increasingly stringent accuracy requirements.

[0003] PDF stands for Portable Document Format, an electronic file format designed by Adobe. It boasts high versatility and compatibility, ensuring data integrity during file transfer. It is also independent of operating systems and platforms, functioning across different devices and systems. Therefore, PDF has become a mainstream form of document transmission, with many research reports and company announcements published in PDF format. As a structured file format, a PDF document is composed of modules called "objects." The entire document resembles a tree structure, with each object representing a node. These objects include images, lines, characters / charts, and various other data attributes. The internal layout of a PDF is achieved through rendering based on the coordinates contained within the object information. This complex processing logic makes it difficult to directly extract text information from paragraphs or structured data from tables within a PDF.

[0004] Due to the closed nature of PDF files, parsing them is quite difficult. With the widespread use of PDFs in finance, scientific research, and education, automatically recognizing PDF documents and extracting useful data has become a significant concern. This is especially true in the financial sector, where company announcements and research reports are characterized by concentrated disclosures, large amounts of content (often exceeding 100 pages), high requirements for timeliness and accuracy, and complex structures. Much of the key information is stored in tables, which vary in style, layout, and internal structure. For example, financial statements, including those from banks and other financial institutions (PFD format), often use borderless tables, demanding extremely high parsing timeliness and accuracy. Common PDF parsing tools like PDFBox are based on text data reading and do not support table data well, failing to fully parse table rows and columns. Table formats in PDF documents include bordered tables, partially bordered tables, tables without borders, tables with color blocks as backgrounds, and tables constructed using non-standard methods such as fractional lines, vector graphics, and converted characters. Tables other than those with borders are generally referred to as borderless tables. During recognition, the diversity of table formats and structures leads to lower recognition accuracy. Furthermore, many tables lack borders or have only partial borders, making them unrecognizable based on the borders alone. Additionally, the presence of mixed, overlapping, or offset characters in the table content further reduces recognition accuracy. For tables with a large number of numbers and unclear cell separation, recognition errors are more severe. The main errors manifest as inaccurate data unit division, poor column differentiation, and merging of different columns in the recognition results, resulting in a high processing error rate.

[0005] Currently, the industry mainly uses the following two technical approaches for PDF table recognition:

[0006] A widely used technique is image- or visual OCR, which reconstructs table structures based on spatial regularities and certain rules. The main steps involve converting the corresponding table area in a PDF into an image, preprocessing the image using morphological methods (such as various erosion, dilation, and binarization techniques), detecting text blocks, blank blocks, or other morphological features in the preprocessed image, and reconstructing the table based on these features. Finally, OCR recognition technology is used to convert the image into recognizable elements. Then, based on the labeled table and text block models, a table and text block detection model is trained. During document post-processing, based on the recognized table positions, rows and columns are constructed for the text blocks within the table area according to the spatial positions of the elements. The recognized text blocks are then filled into the structure to complete the table recognition. This technique has relatively high accuracy for simple framed tables, but for frameless or partially framed tables, the lack of row and column lines means it can only learn from the image's color and other feature values, leading to a significant drop in accuracy. Even for bordered tables with relatively high recognition accuracy, the accuracy of the results can be significantly reduced due to recognition errors, because the tables in the PDF document need to be converted into images, and then the text content of the table items in the images is obtained through OCR recognition technology.

[0007] Because tables in PDF documents need to be converted into images before they can be processed by algorithms, image-based or visual OCR technology for table recognition is time-consuming and resource-intensive. Furthermore, since its model uses deep learning to determine table regions based on the entire table, its processing time and computational resource consumption are significant, and the accuracy of the converted results cannot be guaranteed. The converted results still require human review, making it unsuitable for scenarios with high accuracy requirements.

[0008] Another technical solution relies on manually configured templates to detect and reconstruct the structure of tables for specific business scenarios. Its main advantage is accuracy, but its disadvantage is poor versatility. Each table requires structural analysis by specialized business personnel, followed by the development of detection programs by professional programmers. Because it is deeply tied to the applicable business scenario, it requires extensive configuration and training, making it difficult to quickly adapt to scenarios with varied table styles and complex internal structures, hindering rapid deployment across different business scenarios. Furthermore, its templates are overly dependent on explicit separators and the relative positions of separators and text instances, making it difficult to apply to borderless tables.

[0009] This technology requires annotation by personnel familiar with domain knowledge and table characteristics for various table formats across different business scenarios. The coverage and accuracy of the annotation directly affect the accuracy of the final conversion result. For special examples not covered in the annotation, it is difficult to guarantee accuracy. If different business scenarios are added, re-annotation is required. When adding different business scenarios, or when the table format of existing business scenarios changes, not only is annotation by personnel familiar with domain knowledge and table characteristics necessary, but also training and programming by personnel familiar with the algorithm is required to achieve the conversion. Summary of the Invention

[0010] The technical problem this invention aims to solve is that existing PDF documents suffer from low accuracy, high training or configuration costs, long processing time, and high computational resource consumption when encountering borderless tables.

[0011] To achieve the above objectives, the technical solution of the present invention provides a method for accurate recognition of borderless tables based on a positioning algorithm, characterized by comprising the following steps:

[0012] Step 1: Obtain the PDF source file to be processed;

[0013] Step 2: Obtain the page objects and their structured information from the PDF source file, and generate one or more tables in the PDF file that need to be parsed according to the configuration. This includes the following steps:

[0014] Step 201: Read dictionary information from the PDF file and create a page object. The page object includes a page identifier and a page area. In addition to the coordinate information of the rectangular area of ​​this page, the page area also includes the upper and lower boundary information of the vertical coordinate of this page relative to the entire PDF file.

[0015] Step 202: Based on the page object, create element objects by collecting all the information of the PDF constituent objects for each page of the current page. The element objects include general attributes as well as unique attributes for different types of objects.

[0016] Step 203: Initially merge the character object collection in the element object collection according to the paragraph identifier to create a text object collection, and merge the character objects of the same paragraph into a text object in the text object collection;

[0017] Step 204: Obtain the corresponding text line information based on the vertical coordinate position of the text object, and divide the current page into multiple standard line areas. Each standard line area only records the start and end positions of the vertical coordinate of the line, and there is no overlap between the standard line areas. Each standard line area is a standard line object, and all text objects can be associated with the standard line object.

[0018] Step 205: Associate standard line objects with text objects. Multiple text objects can be associated within the same standard line, and multiple standard line objects can be associated with the same text object.

[0019] Step 206: Reorder and update the application objects to which the current page belongs. The application objects include page objects, standard line objects, and text objects.

[0020] Step 207: Traverse all pages of the PDF file and save the application object page by page;

[0021] Step 208: Identify the valid area of ​​the page, including the following steps:

[0022] Step 2081: Identify the number of rows in the header area, which includes the following steps:

[0023] Step 20811: Traverse all pages, read all text objects in the first line of each page, merge the text content corresponding to the text objects to obtain the text content of the first line, and identify the integer objects present in the first line of text.

[0024] Step 20812: Count the number of pages with similar first lines across all pages. If the proportion of similar pages to the total number of pages is greater than the threshold, then the first line can be confirmed as the header area.

[0025] Step 20813: Process the next line of text after the first line of text, and determine whether it belongs to the header area. Continue until the last line of the page is reached or the number of lines belonging to the header area is greater than the threshold. Then the processing ends and the number of lines in the header area of ​​each page is obtained. If the number of lines in the header area is greater than 0, the typical header identifier after merging all lines of text content in the header is obtained. If the number of lines in the header area is 0, then there is no header area.

[0026] Step 2082: Identify the row number in the footer area, which includes the following steps:

[0027] Step 20821: Traverse all pages, read all text objects in the best line of each page, merge the text content corresponding to the text objects to obtain the last line of text content, and identify the integer objects present in the last line of text.

[0028] Step 20822: Count the number of pages similar to the last row of the page. If the proportion of the last row to all pages is greater than the threshold, then the last row can be confirmed as the footer area.

[0029] Step 20824: Process the text above the last line of text and determine whether it belongs to the footer area. Continue until the first line of the page is reached or the number of lines belonging to the footer area is greater than the threshold. Then the processing ends and the number of lines in the footer area of ​​each page is obtained. If the number of lines in the footer area is greater than 0, the typical footer identifier after merging all the text content of the footer is obtained. If the number of lines in the footer area is 0, then there is no footer area.

[0030] Step 2083: Identify the attributes of each line on the current page, including header / footer / body text;

[0031] Step 209: Generate the table processing task for the PDF;

[0032] Step 3: Obtain the table configuration from the list of pending table tasks generated in Step 2, and locate the table area according to the configuration. This includes the following steps:

[0033] Step 301: Obtain the tasks to be processed from the task list in the pending table;

[0034] Step 302: Configure table area feature information, configure table start position features, and locate the start page and start row of the table to be processed;

[0035] Step 303: Locate the initial position of the table area, which includes the following steps:

[0036] Step 3031, locating the row object at the beginning of the table area, further includes the following steps:

[0037] Step 30311: Starting from the homepage, traverse the text content corresponding to the line object line by line to obtain the text content of the current standard line. During reading, only all lines in the main text area are processed.

[0038] Step 30312: Read the tag type to be converted from the configuration. In the standard line text content, based on the characteristics of the tag type, confirm whether there is a tag entity and its specific location. If there is a tag entity, replace the corresponding entity with the tag identifier.

[0039] Step 30313: Determine if the current row is the first row of the table's starting area:

[0040] If the text content of the current line after processing meets the configured starting position rules, then the current line is the first row of the table's starting area, and processing ends;

[0041] If the text content of the current line does not meet the configured starting position rule after processing, the next line of the current page will be taken as the current line and the judgment will continue. If the last line of the main text area of ​​the current page is reached, the first line of the main text area of ​​the next page will be taken as the current line and the process will jump to step 30312 to continue processing.

[0042] If the current page is the last line of the last main text page and the configured starting position rule still cannot be met, then the table area cannot be located and proceed to step 3032; otherwise, proceed to step 3034.

[0043] Step 3032: Locate the text object at the beginning of the table area and confirm the current starting row. This includes the following steps:

[0044] Step 30321: Starting from the homepage, traverse the text object content, processing only the text objects in the main text area;

[0045] Step 30322: Read the tag type to be converted from the configuration. In the standard line text content, based on the characteristics of the tag type, confirm whether there is a tag entity and its specific location. If there is a tag entity, replace the corresponding entity with the tag identifier.

[0046] Step 30323: When the text content meets the configured starting position rules, confirm the starting line:

[0047] If the text content of the current text object meets the configured starting position rules after processing, it can be confirmed that the starting position of the table is included in the row where the text object is located; then, based on the specific character position of the text content that meets the configuration rules, the corresponding standard row object is obtained and confirmed as the starting row;

[0048] If the current text object does not match the configured starting position rule, the next text object will be processed until the last text object in the body area.

[0049] Step 30324: If the starting position of the table area is not found on the current page, repeat step 30321 starting from the first text object in the main text area of ​​the next page.

[0050] If the location cannot be located after traversing all pages, proceed to step 3033 to handle the location failure case; otherwise, proceed to step 3034.

[0051] Step 3033: Return to the table range that could not be found;

[0052] Step 304: Confirm the coordinates of the table area, which includes the following steps:

[0053] Step 3041: Locate the first page and first row of the table;

[0054] Step 3042: Determine whether the starting page of the table includes the ending row, including the following steps:

[0055] Step 30421: Read each row of the table sequentially from the first row until the last row of the main text area of ​​the page;

[0056] Step 30422: Determine if the current row still belongs to the table range:

[0057] 1) If the number of associated text objects in the current row is greater than or equal to the number of associated text objects in the first row of the table, or greater than or equal to the number of associated text objects in the row above the current row, then the current row is confirmed as a table range, and the number of associated text objects in the current row is greater than 1.

[0058] 2) If the number of associated text objects in the current row exceeds the minimum column count threshold, confirm that the current row is a table area;

[0059] 3) When the first column of the current row belongs to the first row and first column area of ​​the table:

[0060] If the absolute difference between the left boundary coordinates of the first text object in the current row and the left boundary coordinates of the first text object in the first row is less than a threshold, and the right boundary coordinates of the first text object are less than the left boundary coordinates of the second text object in the first row, then the current row can be confirmed as a table area.

[0061] 4) When the first column of the current row is to the left of the first column of the first row of the table:

[0062] If the right boundary coordinate of the first text object in the current row is less than the left boundary coordinate of the first text object in the first row of the table, it means that the first cell in the first row and first column of the table is empty, and the current row is confirmed to be a table area.

[0063] 5) When the first column of the current row is located within any two consecutive columns of the first row of the table:

[0064] The first text object in the current row is taken as the first text object, and compared with the associated text objects in the first row of the table one by one: if its left boundary coordinate is greater than or equal to the left boundary coordinate of the first row text object, the first row text object is taken as the second text object; if the right boundary coordinate of the first text object is greater than or equal to any text object on the right side of the same row as the second text object, and the first text object spans multiple columns of the table, if the conditions are met, then the current row is confirmed as the table area.

[0065] Step 30423: If the current row is confirmed to be a table range, add the relevant information of the standard row object to the table object row collection, and set the row attribute to table-default row;

[0066] If the conditions listed in step 30422 are not met after execution, the current row is considered the end row of the table, and the subsequent step 3043 is skipped, and the cross-page table process is not processed.

[0067] Step 3043: Obtain the ending page and ending row when the table spans multiple pages, including the following steps:

[0068] Step 30431: Determine if a cross-table identifier exists.

[0069] Read the first line of the current page's main text area and obtain its corresponding text object content. Determine whether it contains a cross-table identifier based on the rule set. If the first line contains a cross-table identifier, set the attribute of the standard row containing the cross-table identifier to "other" and confirm that the current table has a cross-page situation.

[0070] Step 30432: Determine if there is duplicate header information when crossing pages. If so, it is assumed that a cross-page table exists.

[0071] The first row of the first page of the table area is used as the first row of the first table. If a cross-table identifier is found, the second row of the current page's main text area is set as the first row of the second table; otherwise, the first row of the current page's main text area is set as the first row of the second table. The text content of the first row of the first table and the first row of the second table are read separately, and their similarity is judged: if they are judged to be similar, the attribute of the first row of the first table is marked as a header row, and the attribute of the first row of the second table is marked as a duplicate header row; if they are judged not to be similar, it is considered that there is no duplicate header, and the processing ends.

[0072] If the number of duplicate header rows in the current table is greater than 0, proceed to step 30434; otherwise, proceed to step 30433.

[0073] Step 30433: Determine if the tables are the same across pages:

[0074] Read the first row of the current page's main text area and use it as the first row of the second table; read the last row of the previous page's table area and use it as the last row of the first table; obtain the number of text objects corresponding to the first row of the second table and the last row of the first table respectively: if the number of text objects is the same, it is confirmed that the current table has a cross-page table; if the number of text objects is different, iterate through each row of the first table to obtain the minimum and maximum number of text objects corresponding to the table; if the number of text objects in the first row of the second table is within the range of the number of text objects in the first table, it is confirmed that the current table has a cross-page table; if none of the above are true, it is considered that there is no cross-page table, the table's end page is set to the previous page of the current page, the end row is set to the last row of the first table, and the processing ends;

[0075] Step 30434: After determining that a table spanning multiple pages exists, confirm the cutoff page and cutoff row:

[0076] Starting from the non-repeating header row on the current page, repeat step 30422 to determine if the current row is the table's ending row; if the table's ending row still cannot be located, set the current page as the next page and repeat step 3043 until the ending row is confirmed; if the last page is reached or the difference between the current page and the table's starting page is equal to the maximum table page number threshold, then set the current page as the table's ending page and set the last row of the current page's text as the table's ending row;

[0077] Step 4: Based on the table area confirmed in Step 3, identify the text objects related to the table and obtain the coordinate information of the row and column areas of the table, thereby dividing the entire table into standard blocks of N rows * M columns; then create new cell objects, each cell object covering one or more blocks, and through the association between cell objects, row objects and text objects, convert PDF related element objects into table structured information without loss.

[0078] Step 5: Based on the row and column area information of the table confirmed in Step 4, confirm the row and column information of the valid cell objects in the table, and obtain one or more text objects related to the cell objects.

[0079] Preferably, step 203 includes the following steps:

[0080] Step 2031: Obtain the collection of character objects for each page and sort them, specifically including the following steps:

[0081] Step 20311: Traverse all PDF element objects on the current page and obtain the collection of all character objects within them;

[0082] Step 20312: Sort the collection of character objects according to their position coordinates. The sorting rule is to sort them from left to right and from top to bottom according to the points in the character object area.

[0083] Step 2032: Merge character objects from the same paragraph into a text object, specifically including the following steps:

[0084] Step 20321: Create a text collection, which includes text identifiers and character identifiers and the criteria for merging them. One text identifier can be associated with multiple character identifiers.

[0085] Step 20322: Read the first character object. If the current text collection is empty, add the identifier corresponding to the first character object to the current text collection.

[0086] Step 20323: Read the next character object of the first character object and use it as the second character object;

[0087] Step 20324: Determine if the second character object is the same paragraph as the current text collection.

[0088] When the second character is a character without specific meaning, it belongs to the current paragraph, and the second character object is added to the current text collection;

[0089] When the second character is a delimiter character, the segmentation rules based on the delimiter character are used to determine whether the segments are the same. Specific rules include:

[0090] Rule 1) When the second character is a newline character, the next character is a newline character; add the second character object to the current text collection, create a new text collection, update the next character object of the second character object to the first character object, and repeat step 20322.

[0091] Rule 2) When the second character is a space, further determine whether the current text set consists entirely of English words and their last character is not a space: if so, confirm that the second character object belongs to the current paragraph and add it to the current text set; if not, jump to step 20325.

[0092] If the second character is a normal character, proceed to step 20325;

[0093] Step 20325: Determine if the second character object is the same as the current text collection paragraph:

[0094] 1) Determine whether the second character object and the first character object belong to the same paragraph based on their font and font size. If they are not the same paragraph, create a new text collection, update the second character object to the first character object, and repeat step 20322 until all character objects on the page are traversed and a text object collection is created.

[0095] 2) Determine whether the second character object and the first character object belong to the same paragraph based on their positions. If they are not in the same paragraph, create a new text collection, update the second character object to the first character object, and repeat step 20322 until all character objects on the page are traversed and a text object collection is created.

[0096] 3) When the second character object and the first character object are close in distance, they can be identified as the same paragraph. Add the second character object to the current text collection, read the next character object of the second character object and use it as the first character object. Repeat step 20322 until all character objects on the page are traversed and a text object collection is created.

[0097] Preferably, in step 20324, the method for determining whether the current text set consists entirely of English words is as follows: traverse all character objects in the current text set, concatenate their contents, and if they all fall within the range of English words + numbers + punctuation marks, then they are considered to be English words.

[0098] Preferably, after obtaining the text object set through step 203, for each text object in the text object set, the annotation character objects in the text object are identified by the difference between the annotation and the main text position, and the main text and the annotations above and below in the same paragraph are merged into the same text object. Specifically, this includes the following steps:

[0099] Step A1: Read the first text object, obtain its last character object as the first character object, and then read the second text object sequentially;

[0100] Step A2: Based on the relative position of the second text object and the first text object, determine whether the second text object is a superscript or subscript:

[0101] If the absolute difference between the lower boundary coordinates of the second text object and the center ordinate of the first character object is less than the second text object being located in the upper half of the character object, then it can be considered as the upper annotation of the first text object, and proceed to step A3;

[0102] If the absolute difference between the center ordinate of the first character object and the upper boundary coordinate of the second text object is less than the second text object being located in the lower half of the character object, then it can be considered as the subscript of the first text object, and proceed to step A3;

[0103] If neither of the above two situations occurs, then the second text object is not an index or subscript. Set the second text object as the first text object and repeat step A1 until all text objects in the text object collection are traversed.

[0104] Step A3, merge superscripts and subscripts and related text objects, including the following steps:

[0105] Step A301: Read the third text object sequentially;

[0106] Step A302: Obtain the difference in ordinate between the first text object and the third text object;

[0107] Step A304: Determine whether the third text object and the first text object belong to the same paragraph:

[0108] If the difference in the vertical coordinates between the first text object and the third text object is greater than the set threshold, then they belong to different paragraphs. The first text object and the second text object are merged into a new text object, and the elements associated with the second text object are marked as superscripts / subscripts.

[0109] If the difference between the ordinates of the first and third text objects is less than or equal to the set threshold, then the first, second, and third text objects will be merged into a new text object, and the elements associated with the second text object will be marked as superscripts / subscripts.

[0110] Step A305: Set the third text object as the first text object, and repeat step A1 until all text objects in the text object collection are traversed.

[0111] Preferably, step 204 includes the following steps:

[0112] Step 2041: By traversing the vertical coordinate information of all text objects on the page, establish the initial row object for the current page. All text objects can be associated with the row object.

[0113] If the absolute value of the difference between the upper / lower boundary coordinates of the text object and the upper / lower boundary coordinates of the current line object is less than the threshold, it is confirmed that the associated line object of the text object already exists. At this time, if the upper / lower boundary coordinates of the current line object are less than the upper / lower boundary coordinates of the text object, they are updated to the upper / lower boundary coordinates of the text object.

[0114] If the absolute value of the difference between the upper / lower boundary coordinates of the text object and the upper / lower boundary coordinates of all line objects is greater than the threshold, then a new line object is created, and the upper / lower boundary coordinates of the line object are updated to the upper / lower boundary coordinates of the text object.

[0115] Step 2042: Traverse all row objects on the current page and merge row objects with too small an interval, including the following steps:

[0116] Step 20421: Sort the row objects according to their lower boundary coordinates from smallest to largest, and write them into the row array;

[0117] Based on the traversal of the row array, obtain the line spacing between row objects, and obtain the minimum effective line spacing and the maximum effective line spacing. The effective line spacing is calculated by counting the number of times all line spacings appear on the current page, dividing it by the total number of line spacings * 100, and taking the maximum and minimum values ​​of the line spacings with a proportion greater than the threshold as the minimum effective line spacing and the maximum effective line spacing.

[0118] Step 20422: Read the row array, take the first row object as the first row, and set the upper boundary coordinates of the first row as the upper boundary coordinates of the page area;

[0119] Step 20423: Determine whether the first row needs to be merged with the second row:

[0120] Read the row objects after the first row in the row array and treat them as the second row; check if the line spacing of the first row is less than the minimum valid line spacing. If it is less, merge the first row and the second row.

[0121] Step 20424: Obtain the coordinates of the upper boundary of the first row.

[0122] Read the row objects before the first row in the row array, treat them as the third row, and set the upper boundary coordinate of the first row to the lower boundary coordinate of the third row + 1;

[0123] Step 20425: Treat the row objects after the first row as the first row, jump to step 20423, and continue until the last row of the row array.

[0124] Preferably, step 205 includes the following steps:

[0125] Step 2051: Based on the text object region, identify the associated standard line, specifically including the following steps:

[0126] Step 20511: Based on the lower boundary coordinates of the text object, find the standard line area where it is located and use it as the ending line;

[0127] Step 20512: Based on the upper boundary coordinates of the text object, find the standard line area where it is located and use it as the starting line;

[0128] Step 20513: Update the start and end lines of the text object identifier. If the start line is shorter than the end line, it means that the current text object covers multiple lines.

[0129] Step 2052: Split the character objects in the text object according to the standard line, specifically including the following steps:

[0130] Step 20521: In the current text object, create an array of lines based on the start and end lines;

[0131] Step 20522: If the text object is associated with only a single standard line, then create a new line object, write the starting line information into the line object, and obtain the text area of ​​the line object, which is consistent with the text object area;

[0132] If a text object is associated with multiple standard lines, then obtain the complete set of character objects associated with the text object, record the line where the character object is located based on the lower boundary coordinate of each character object, sort the lines where the character objects are located in the character object set from top to bottom, and sort the same lines from left to right according to the left boundary coordinate of the characters, and write the line objects into the line array from the start line to the end line;

[0133] Step 2053: Traverse all text objects on the current page and associate all text objects with the standard line. Sort the text objects from top to bottom according to the terminating line, and within the same terminating line, sort them from smallest to largest according to the left boundary coordinate of the text object;

[0134] Based on the current page's standard line object, iterate from top to bottom to obtain an array of all text objects associated with the standard line; merge the text regions in the text objects associated with the standard line that are the same as the current line to obtain the standard line text region, where the standard line text region is less than or equal to the line region, and the part of the line region not covered by the line text region is blank or contains other element objects; based on the merged line text regions, obtain the text region of the current page.

[0135] Step 2054: Merge multi-line text objects. Merge multi-line text objects with the same text block on the page into a single text object. This includes the following steps:

[0136] Step 20541: Set the current text object as the first text object;

[0137] Step 20542: Obtain the second text object and the third text object, where:

[0138] The second text object is the text object whose left boundary coordinates are similar to those of the first text object, which is located below the first text object on the vertical axis and is the closest to it; the absolute difference between the left boundary coordinates of the first text object and the left boundary coordinates of the second text object is less than the first threshold.

[0139] The third text object is the text object whose left boundary coordinates are close to those of the second text object, which is located below the second text object on the vertical axis and is the closest to it.

[0140] Step 20543: Determine whether the first text object and the second text object need to be merged, including the following steps:

[0141] Read the text area of ​​the first text object's ending line as the first line area, and the text area of ​​the second text object's starting line as the second line area;

[0142] If the lower boundary coordinates of the first text object and the upper boundary coordinates of the second text object are greater than the maximum effective line spacing of the current page, and the first text object and the second text object are not in the same paragraph, then there is no need to merge them. In this case, the number of occurrences of all line spacings on the current page is counted, and the count is divided by the total number of line spacings * 100. The line spacings with a proportion greater than the second threshold are taken as the maximum effective line spacing.

[0143] If the auxiliary character information of the text objects in the first row area is mostly different from that of the text objects in the second row area, then the first text objects and the second text objects are not from the same paragraph and do not need to be merged.

[0144] If the absolute difference between the right boundary coordinates of the first text object region and the right boundary coordinates of the second text object region is less than or equal to the third threshold, then the first text object and the second text object are the same paragraph text and need to be merged.

[0145] If the difference between the right boundary coordinates of the first text object region and the right boundary coordinates of the second text object region is greater than the third threshold, and the difference between the left boundary coordinates of the second text object and the left boundary coordinates of the first text object is less than or equal to the fourth threshold, or the difference between the left boundary coordinates of the third text object and the left boundary coordinates of the second text object is less than or equal to the fourth threshold, then the second text object and the first text object are the same paragraph and need to be merged, and the second text object and the third text object are not the same paragraph and do not need to be merged.

[0146] If both the first and second line regions are associated with only a single text object, and at least one text object has a width greater than the fifth threshold, then the second text object and the first text object are the same paragraph and need to be merged.

[0147] If none of the above conditions are met, the first text object and the second text object are not in the same paragraph and do not need to be merged.

[0148] Step 20544: If the result of step 20543 is that the first text object and the second text object are in the same paragraph and need to be merged, then merge the character object information associated with the two objects into the first text object, execute step 2052 to re-break the lines, and delete the second text object.

[0149] Step 20545: Take the next text object of the first text object as the first text object, and repeat step 20541 until it is the last text object of the current page; if there is text object merging, sort all text objects of the current page from top to bottom according to the terminating line, and sort the text objects in the same terminating line according to the left boundary coordinate of the text object from smallest to largest.

[0150] Step 2055: Segment the text object based on paragraph features, specifically including the following steps:

[0151] Step 20551: Obtain all text objects processed in step 2055;

[0152] Step 20552: Read each line of the current text object, take the current line as the first line, and take the next line as the second line;

[0153] Step 20553: Determine whether the current text object needs to be segmented according to the rules.

[0154] Rule 1) Read the left boundary coordinates of the second line. If the difference between the left boundary coordinates of the second line and the left boundary coordinates of the current page text area is greater than the threshold, or the difference between the left boundary coordinates of the first line and the left boundary coordinates of the second line is greater than the threshold, then the current line meets the new paragraph indentation mark and it can be determined that the second line is a new text paragraph.

[0155] Rule 2) Read the right boundary coordinate information of the second line. If the difference between the right boundary coordinate of the current page text area and the second line is greater than the threshold, or the difference between the right boundary coordinate of the first line and the second line is greater than the threshold, then it is determined that the current line has ended and the next line after the second line belongs to a new text paragraph.

[0156] Rule 3) When Rule 1) is not satisfied, determine whether the characters conform to the segmentation rules based on the regular expression configured by the business characteristics. If the current line conforms to the regular expression rules, it can be determined that the current line belongs to a new text segment.

[0157] Step 20554: After executing step 20553, if a new text paragraph needs to be created, write the current text object from its starting line to the line preceding the paragraph's starting line into the current text object, and create a new text object. Write the current text object from its starting line to its last line into the new text object, and use this new text object as the current text object. Then return to step 20552, and continue until the current text object is the last text object on the current page. If the current text object does not need to be segmented, use the next text object as the current text object. Execute step 20552 until the current text object is the last text object on the current page.

[0158] Preferably, step 2083 includes the following steps:

[0159] Step 20831: If the number of rows in the header area of ​​the current page is greater than 0, then traverse downwards from the first row of the current page to the number of rows in the header area, and merge the text content of one or more row objects obtained; identify the integer objects in the merged text content and compare them with typical header identifiers: if they are similar, then confirm that this part of the row objects is the header area; if they are not similar, then consider that there is no header area on this page.

[0160] If the number of rows in the footer area of ​​the current page is greater than 0, traverse upwards from the last row of the current page to the number of rows in the footer area, and merge the text content of one or more row objects obtained; identify the integer objects in the merged text content and compare them with typical footer identifiers: if they are similar, confirm that this part of the row objects is the footer area; if they are not similar, consider that there is no footer area on this page.

[0161] Step 20832: Traverse all standard line objects on the current page and set all line objects in areas without headers / footers to body text;

[0162] Step 20833: Traverse all text objects on the current page and determine the text object attributes based on the standard line attributes corresponding to their associated lines.

[0163] Preferably, step 3041 includes the following steps:

[0164] Step 30411: Starting from the first page and first row of the table area, read line by line in the main text area of ​​this page;

[0165] Step 30412: Locate the starting row of the table in the starting page of the table area:

[0166] Determine if the number of text objects associated with the current row is greater than the minimum column count threshold. If the number of text objects is less than the minimum column count threshold: determine if the ratio of the text area width of the first text object in the current row to the page width is less than or equal to the maximum column width ratio threshold to confirm whether it is the starting row of the table; then, read the nearest N rows downwards from the current row to obtain the number of objects and the first text object of each row; in the N rows, check if there is any standard row object whose associated text object count is greater than the threshold, or if the ratio of the width of all text objects in any standard row to the page width is less than the maximum column width ratio threshold. If any of the above conditions are met, the current row can be confirmed as the starting row of the table.

[0167] If the current row does not meet the above conditions, continue traversing the current page's main text rows until a row that matches the characteristics is found as the starting row of the table or the end row of the main text area is reached;

[0168] If the starting row of the table is not found on the current page, continue searching on the next page. If the table is not found after traversing N pages, return "Table not found range".

[0169] Preferably, if the area where the table is located still cannot be confirmed after executing steps S301 to S304, a task is initiated to notify a human to confirm the table area.

[0170] Preferably, step 4 includes the following steps:

[0171] Step 401: Obtain the row containing the most columns in the table and confirm the default column width;

[0172] Step 402: Associate the table range text object with the standard column;

[0173] Step 403: Adjust the coordinates of the standard column based on the position difference between the text object and the standard column;

[0174] Step 4031: Process text objects outside the left margin of the standard column:

[0175] Iterate through all text objects, find the set of text objects whose right boundary coordinates are less than the left boundary coordinates of the first column of the standard column, and obtain the minimum left boundary coordinates and maximum right boundary coordinates of all text objects associated with the first column of the standard column; take the text objects outside the left boundary of the table as the first text objects, and the text objects associated with the first column of the standard column in the same row as the second text objects;

[0176] If the absolute difference between the right boundary coordinate of the first text object and the minimum left boundary coordinate of the first column text is greater than the threshold, then a new first column object is added, with the left boundary coordinate being the left boundary coordinate of the first text object and the right boundary coordinate being the original left boundary coordinate of the first column - 1. Then proceed to step 402 to update the standard column information again.

[0177] If the second text object exists and it cannot be merged with the first text object based on its position, then a new first column object is added, with its left boundary coordinates being the left boundary coordinates of the first text object and its right boundary coordinates being the left boundary coordinates of the previous first column - 1. Then proceed to step 402 to update the standard column information again.

[0178] If a second text object exists and can be merged with the first text object based on its position, then the first text object is also associated with the standard first column, and the left boundary coordinates of the standard first column are updated to the left boundary coordinates of the first text object.

[0179] If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object associated with the standard first column is less than the threshold, then a new first column object is added, with the left boundary coordinate of the first text object being the left boundary coordinate of the first text object, and the right boundary coordinate being the original first column left boundary coordinate - 1; proceed to step 402 to update the standard column information again;

[0180] If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object associated with the standard first column is greater than the threshold, the first text object is associated with the standard first column, and the left boundary coordinate of the standard first column is set as the left boundary coordinate of the first text object.

[0181] The next text object outside the left boundary of the table is taken as the first text object, and the process continues until there are no more text objects outside the left boundary of the table.

[0182] Step 4032: Process text objects outside the right boundary of the standard column.

[0183] Iterate through all text objects, find the set of text objects whose left boundary coordinates are greater than the right boundary coordinates of the last column of the standard column, and obtain the minimum left boundary coordinates and maximum right boundary coordinates of all text objects associated with the last column of the standard column; take the text objects outside the right boundary of the table as the first text objects, and the text objects associated with the last column of the standard column in the same row as the second text objects;

[0184] If the absolute difference between the left boundary coordinate of the first text object and the maximum right boundary coordinate of the last text is greater than the threshold, then a new last text object is added, with its left boundary coordinate being the right boundary coordinate of the last text object + 1, and its right boundary coordinate being the right boundary coordinate of the first text object. Then proceed to step 402 to update the standard column information again.

[0185] If the second text object exists and it cannot be merged with the first text object based on its position, then a new last column object is added, with its left boundary coordinates being the right boundary coordinates of the last column + 1 and its right boundary coordinates being the right boundary coordinates of the first text object. Then proceed to step 402 to update the standard column information again.

[0186] If a second text object exists and can be merged with the first text object based on its position, then the first text object is also associated with the standard last column, and the right boundary coordinates of the standard last column are updated to the right boundary coordinates of the first text object.

[0187] If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the associated text object in the last column of the standard is less than the threshold, then a new last column object is added. The left boundary coordinate of the new last column object is the right boundary coordinate of the last column + 1, and the right boundary coordinate is the right boundary coordinate of the first text object. Proceed to step 402 to update the standard column information again.

[0188] If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object associated with the first standard column is greater than the threshold, the first text object will be associated with the last standard column, and the right boundary coordinate of the last standard column will be set as the right boundary coordinate of the first text object.

[0189] The next text object outside the right boundary of the table is taken as the first text object, and the process continues until there are no more text objects outside the right boundary of the table.

[0190] Step 4033: Process the gap between two adjacent columns to determine whether a new column needs to be added, including the following steps:

[0191] Step 40331: Take the first standard column as the first column, and the standard column closest to the right of the first standard column as the second column;

[0192] Step 40332: Merge the blank areas between adjacent columns into the first column:

[0193] If the difference between the left boundary coordinate of the second column and the right boundary coordinate of the first column is less than the minimum column width threshold, the third column is merged into the first column, and the process jumps to step 40334; if it is greater than the minimum column width threshold, a new virtual column is created as the third column, with the left boundary coordinate of the third column being the right boundary coordinate of the first column + 1, and the right boundary coordinate being the left boundary coordinate of the second column - 1.

[0194] Obtain the text object coverage areas of the first and second columns respectively, and use them as the first and second column text areas. The text area is obtained by traversing all text objects associated with the column to obtain the entire area covered by the text content. Traverse the table text objects that are not associated with the standard column, and add the text objects whose center horizontal coordinate is located in the third column area, and whose left boundary coordinate is greater than the right boundary coordinate of the first column and whose right boundary coordinate is less than the left boundary coordinate of the second column to the third column text object array. If there are no text objects in the third column, merge the third column into the first column, and jump to step 40334.

[0195] Step 40333: Based on the text areas of each column, determine whether to add the virtual column as a new standard column:

[0196] Iterate through the array of text objects in the third column, and use the first text object as the current text object:

[0197] If the current text object is completely located in the virtual column area, and the sum of the horizontal coordinates of the first and second column text areas is less than the threshold, the third column will be added as a standard column object, and the process will proceed to step 402 to update the standard column information.

[0198] If the horizontal coordinate of the center of the current text object is within the third column area, and the sum of the horizontal coordinates of the first and second column text areas is less than the threshold, the third column will be added as a standard column object, and the process will proceed to step 402 to update the standard column information.

[0199] If the above conditions are not met, take the next text object in the third column of the text object array as the current text object, and repeat step 40332 until the last text object in the array.

[0200] Step 40334: Merge the third column into the standard column:

[0201] After traversing step 40333, the third column of text objects array is obtained again, and the third column of text area is obtained based on the text objects in the array; the overlap rate between the third text area and the first and second text areas is obtained, and the larger of the two overlap rates is taken: if it is greater than the minimum merging overlap rate threshold, the third column is merged into the standard column with the larger overlap rate, and the process proceeds to step 402 to update the standard column information again.

[0202] Step 40335: Process unassociated text objects in the third column area:

[0203] After processing steps 40331 to 40334, if a third column region still exists, a new array of text objects for the third column is obtained. If the number of text objects in the array is greater than or equal to 1, the first text object in the array is taken as the third text. The text objects associated with the first column in the same row as the third text are taken as the first text, and the text objects associated with the second column are taken as the second text. If neither the first nor the second text exists, and if the overlap rate between the third text and both the first and second column text regions is greater than the minimum overlap threshold, the third text is a cross-column text and is associated with both the first and second columns. Otherwise, the third text is associated with the column with the larger overlap width. If only one of the first or second text exists, the third text is associated with the column associated with the text object.

[0204] Take the next object in the third column of the text object array as the third text, and continue the above process until the last object in the array. Count the number of associations between the third column of the text object array and the first and second columns, and merge the third column into the column with the larger number of associations. If the number of associations is the same, merge it into the first column by default.

[0205] Step 40336: Traverse the processed adjacent columns:

[0206] Set the second column as the first column, set the right standard column object closest to the second column as the second column, and jump to step 40332 to continue processing until the second column is the rightmost standard column.

[0207] Step 4034: Adjust the x-coordinates of adjacent columns.

[0208] Preferably, step 402 includes the following steps:

[0209] Step 4021: Read the text objects in the current page's table area sequentially and use them as the first text object;

[0210] Step 4022: Iterate through the column objects according to the standard columns to obtain the first standard column, and use the right column of the first standard column as the second standard column and the left column as the third standard column;

[0211] Step 4023: Based on the horizontal axis coordinate relationship between the first text object and the first standard column object, confirm whether the first text pair is associated with the first standard column object. If the first text object belongs to the first standard column, proceed to step 4025; otherwise, execute step 4024.

[0212] Step 4024: If the first text object does not belong to the first standard column, take the next standard column as the first standard column, jump to step 4022 and repeat the operation until the last standard column object;

[0213] Step 4025: Take the next object in the table text area of ​​the current page as the first object, jump to step 4021, and continue until the last object on the current page.

[0214] Preferably, step 4034 includes the following steps:

[0215] Step 40341: Use the first standard column as the first column and the second standard column as the second column;

[0216] Step 40342: Obtain the text object coverage areas of the first and second columns respectively, as the first and second column text areas. The text area is obtained by traversing all text objects associated with the column to obtain the entire area covered by the text content; obtain the overlapping part of the first and second text areas, which is the third text area; obtain the column overlap rate, which is the width of the third text area / the width of the first text area * 100%.

[0217] If the column overlap rate is greater than the overlap threshold, it is necessary to determine whether the two columns can be merged: Read the associated text of the first column and the associated text of the second column row by row. If neither column in the current row is associated with a text object, it can be merged; if both are associated with text objects, they cannot be merged; if the number of rows that cannot be merged is less than the threshold, merge the first column and the second column, and go to step 402 to update the standard column information again.

[0218] For columns that cannot be merged, adjust the column width to the optimal value:

[0219] Divide the third text region N into equal parts and establish virtual column separators and associated result arrays; adjust the column widths of the first and second columns according to each virtual column separator, and calculate the sum of the number of associated text objects in step 402 and store it in the associated result array; select the virtual separator of the number of associated text objects as the new column boundary; after processing, go to step 402 to update the standard column information again.

[0220] When the right boundary coordinate of the first column is greater than the left boundary coordinate of the second column, there is no overlap between the two columns, and no processing is required.

[0221] Step 40343: Traverse the processed adjacent columns:

[0222] Set the second column as the first column, set the rightmost standard column object closest to the second column as the second column, and jump to step 40342 to continue processing until the second column is the rightmost standard column.

[0223] Preferably, step 5 includes the following steps:

[0224] Step 5011: Obtain the array of text objects that are already associated with the standard columns in the table, and create an array of cell objects;

[0225] Step 5012: Take the first text object as the second text, create a second cell object, associate the second text with the cell object, and add it to the cell object array:

[0226] Create a new unit object as the second unit object, and associate the second text object with the second unit object; read the unit object array and use the obtained unit object as the first unit; determine whether the first unit object and the second unit object have overlapping table areas: if they overlap, determine whether they can be merged based on the text object information associated with the second unit object; if they can be merged, merge the text content of the first unit object with the text content of the second unit object, associate the second text object with the first unit object, and update the row and column information of the first unit object based on the coordinate area of ​​the merged text object; if they cannot be merged, change the status of the second unit object to pending confirmation - duplicate text, add the second unit object to the unit object array, and change the status of the first unit from normal to pending confirmation - duplicate text; record in the table object that both the first unit object and the second unit object are set as pending confirmation unit identifiers;

[0227] If there is no table area overlap, read the next cell in the cell object array as the first cell object, and check if there is table area overlap until the last cell object in the array; if there is no table area overlap, add the second cell object to the cell object array.

[0228] Step 5013: Take the next text object in the text object array as the second text, and repeat steps 5011 to 5012 until the last text object in the text object array.

[0229] Step 502: Process unassociative text objects, specifically including the following steps:

[0230] Step 5021: Obtain an array of text objects in the table that are not associated with standard columns, take the first text object as the second text, and obtain the standard row area and standard column area it covers based on the coordinate area of ​​the second text.

[0231] Step 5022: Process according to the position of the second text and the standard column:

[0232] When the text object does not belong to the table object:

[0233] If there are no other text objects within the same standard row area as the second text, or if no other text objects are associated with the standard column, it is necessary to further determine whether there are any text objects associated with the standard column within the next N rows. If none are found, it is confirmed that this row does not belong to the table object. Set the end page and end row of the table to the row above the first row of the second text, and delete the row objects in the cell array that are greater than or equal to the first row of the second text. The process ends here.

[0234] When a text object spans multiple columns:

[0235] If the left and right boundary coordinates of the second text are located in different standard column areas on the horizontal axis, then the text object is considered to span multiple columns. Therefore, a virtual column is created as the third column, and the multiple standard columns covered by the second text area are merged into the third column. The positions of the second text and the third column are compared to obtain the association method of the second text aligning with the third column. A new second unit is created, associated with the second text, and the relevant column and row information covered by the second text is written.

[0236] The second unit is compared with the existing units in the unit array to determine if there is any overlap between the standard row and standard column areas. If there is overlap, the status of the second unit is set to pending confirmation - overlapping area, and the status of all units involving overlapping areas is set to pending confirmation - overlapping area. The identifier of the pending confirmation unit is recorded in the table object. If there is no overlap, the second unit is added to the unit object array.

[0237] Step 5023: Take the next text object in the text object array as the second text, and execute steps 5021 to 5022 until the last text object.

[0238] Preferably, after step 5, the method further includes: step 6, if it is determined that the table involves multiple pages, merging one or more cross-page tables.

[0239] Preferably, step 6 includes the following steps:

[0240] Step 601: Based on steps 4 and 5, convert the information from the first page area of ​​the table into the first table object;

[0241] Step 602: Obtain the next page corresponding to the table, and read it into the second table object according to steps 4 and 5;

[0242] Step 603: Determine whether the first table object and the second table object belong to the same table, which further includes the following steps:

[0243] Step 6031: There are duplicate headers in the same table. Delete all cells corresponding to the duplicate headers in the second table and jump to step 605.

[0244] Step 6032: If the number of standard columns in the second table is different from that in the first table, and they are not the same table, proceed to step 604.

[0245] Step 6033: Determine the coverage area of ​​the standard columns in the second table and the first table:

[0246] Read the standard column of the second table sequentially: if its horizontal coordinate area exceeds the nearest left and right column area of ​​the corresponding column in the first table, then the two columns are considered to be different columns, confirm that they are not the same table, and jump to step 604.

[0247] If it does not exceed the nearest left and right column area of ​​the corresponding column of the first table, obtain the coverage area of ​​it and the corresponding column of the first table. If the proportion is less than the threshold, it is considered that the two are not the same column. If it is confirmed that they are not the same table, jump to step 604. Wherein, the coverage area proportion = (right boundary coordinate of the coverage area - left boundary coordinate of the coverage area) * 100 / (right boundary coordinate of column N of the second table - left boundary coordinate of column N of the second table).

[0248] If the columns are determined to be in the same column, read the next standard column of the second table sequentially until the last column, and then end the processing.

[0249] Step 6034: Traverse the standard columns of the first table and compare them with the corresponding column areas of the second table. The judgment logic is the same as in step 6033. If it is determined that they are not the same column, confirm that they are not the same table, and jump to step 604.

[0250] Step 6035: Determine the text content characteristics of the columns in the first and second tables:

[0251] Obtain the column attributes of each column in the first table and the second table. Iterate through each column in the second table to determine whether the current column attribute is compatible with the corresponding column attribute in the first table. If they are not compatible, they are considered to be different columns. Confirm that they are not the same table and jump to step 604.

[0252] Step 6036: If steps 6031 to 6035 are all negative, then it can be determined that the two tables need to be merged, and the process jumps to step 605.

[0253] Step 604: If the tables are not the same, there is no need to merge them;

[0254] Step 605: Merge the second table object into the first table object.

[0255] The method disclosed in this invention can convert tables of any format (with borders, without borders, or partially bordered) in PDF files into a unified structured data format, facilitating further application and processing. Compared with existing technologies, this invention has the following characteristics:

[0256] 1) Improve the recognition accuracy of complex tables without borders.

[0257] This invention targets borderless tables in PDF documents. It employs a precise positioning algorithm based on the text coordinates within the PDF content to accurately locate the row and column positions of borderless tables, thereby converting them into bordered tables. Since it does not convert the PDF table into an image and then use image recognition technology to deduce the table based on image features, the algorithm does not rely on the table's borders or image feature information during construction. Based on the algorithm disclosed in this invention, it can accurately locate the rows and columns of tables regardless of whether they are bordered, borderless, or partially bordered, and can guarantee the accuracy of identifying the table items. Simultaneously, it can restore tables in PDF documents to a structured data format, including additional information such as color, font, font size, and subscripts / superscripts. It also adds row and column coordinate information, transforming the original borderless table into standard structured data. During processing, it ensures an accuracy rate of over 98% for different business scenarios and table formats. Even tables with special cases such as misaligned or overlapping cells due to formatting errors can be submitted to business personnel for processing.

[0258] 2) No complex configuration, annotation, or training is required, and the requirements for users are low.

[0259] This invention requires minimal user expertise; users do not need complex training in domain and technical knowledge, nor do they need to perform complex configurations, label sample data, or undergo training. Users only need simple configuration to quickly and accurately extract data from any business scenario and in tabular format. For different business scenarios, no retraining is required; simply specifying new table region features is sufficient for use.

[0260] 3) Short processing time and low computational resource consumption.

[0261] This invention is based on precise text positioning in PDF content, eliminating the need to convert the entire PDF table into an image and then process it using image recognition technology. This reduces errors caused by conversion, effectively improves processing speed, and significantly reduces the consumption of computing resources.

[0262] 4) Adaptable to various business scenarios

[0263] For different business scenarios, no separate training or programming is required, and the accuracy will not decrease due to different scenarios. Attached Figure Description

[0264] Figure 1 This is an exemplary system architecture diagram of the present invention;

[0265] Figure 2 This is a flowchart illustrating one embodiment of the PDF parsing wireless table method according to embodiments of this application;

[0266] Figure 3 This is a flowchart illustrating the process of parsing the PDF file corresponding to step S302 in an embodiment of the present invention.

[0267] Figure 4 This is a description of the structure of the PDF object output after step S302 in this embodiment of the invention;

[0268] Figure 5 This is a flowchart illustrating the process of reading the dictionary object and element object corresponding to step 3021 in this embodiment of the invention.

[0269] Figure 6 This is a flowchart illustrating step 3022 of the present invention, which involves creating a text object.

[0270] Figure 7 This is a flowchart illustrating step S30222 of the present invention, which merges character objects of the same paragraph into a text object.

[0271] Figure 8 This is a flowchart illustrating the process of merging annotation information in the text in step S30223 of this embodiment of the invention.

[0272] Figure 9 This is a flowchart illustrating step S3023 of the present invention, which confirms the initial position of the row object.

[0273] Figure 10 This is a flowchart illustrating the association between the line object and the text object in step S3024 of this embodiment of the invention.

[0274] Figure 11 This is a schematic diagram of the process for identifying the valid area of ​​the page in step S3027 of this embodiment of the invention;

[0275] Figure 12 A consolidated financial statement of a Hong Kong-listed company.

[0276] Figure 13 This is a schematic diagram of the process for locating the table area in step S303 of this embodiment of the invention;

[0277] Figure 14 This is a schematic diagram of the process for locating the initial position of the table area in step S3033 of this embodiment of the invention;

[0278] Figure 15 This is a schematic diagram of the process for confirming the coordinates of the table area in step S3034 of this embodiment of the invention;

[0279] Figure 16 This is a flowchart illustrating the process of locating the starting row;

[0280] Figure 17 It indicated Figure 17 : Determine the starting row case;

[0281] Figure 18 This is a flowchart illustrating the process of locating the cutoff line.

[0282] Figure 19 This indicates that the first row and first column area is located on the left side of the first row and first column of the table;

[0283] Figure 20 This indicates that the first column of a row is located within any two consecutive columns of the first row of the table;

[0284] Figure 21 This indicates the end of the table example;

[0285] Figure 22 This is a schematic diagram of the table parsing process in steps S304-S306 of this embodiment of the invention;

[0286] Figure 23 A diagram showing the structure of the table object and its relationship with the PDF object;

[0287] Figure 24 This illustrates a case study for determining the maximum number of columns in a table.

[0288] Figure 25 This is a schematic diagram illustrating the process of associating text objects in the table in step S3042 of this embodiment with standard columns.

[0289] Figure 26 This illustrates an example of left alignment between the current text object and the current standard column;

[0290] Figure 27 This illustrates an example of right alignment between the first text object and the first standard column;

[0291] Figure 28 This indicates that the central axis of the current text object is within the current standard column;

[0292] Figure 29 This is a schematic diagram of the process of adjusting the standard column of the table in step S3043 in an embodiment of the present invention;

[0293] Figure 30 This indicates that the character object is located outside the left border of the table;

[0294] Figure 31 This indicates that the character object is located outside the right boundary of the table;

[0295] Figure 32 This indicates that the text object belongs entirely to the virtual column's horizontal coordinate area;

[0296] Figure 33 This indicates that the horizontal axis of the text object belongs to the virtual column's horizontal axis region and intersects with at least one adjacent column.

[0297] Figure 34This illustrates how the third column is merged into the standard column based on its intersection with adjacent columns;

[0298] Figure 35 This indicates that if the overlap rate is less than the threshold, or if the overlap rate is greater than the threshold, the elements cannot be merged.

[0299] Figure 36 This is a schematic diagram of the process for confirming the position of a table cell in step S305 of this embodiment of the invention;

[0300] Figure 37 This illustrates a case where the table header spans multiple columns;

[0301] Figure 38 This is a schematic diagram of the process of merging multiple pages of tables in step S307 of this embodiment of the invention;

[0302] Figure 39 This indicates coverage of multiple columns;

[0303] Figure 40 This illustrates the processing results of the annual consolidated financial statements of listed companies in Hong Kong, China. Detailed Implementation

[0304] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.

[0305] In this invention, the term "full-line table" means a table in a PDF file with complete lines, where each table cell has closed horizontal and vertical lines to identify the area where the table is located.

[0306] In this invention, the term "borderless table" refers to all tables in a PDF file that are not fully bordered, including partially bordered tables, borderless tables, tables with color blocks as backgrounds, and tables constructed using non-standard methods such as fractional lines, vector graphics, and converted characters. Partially bordered tables have only some lines, such as only some horizontal or vertical lines, and some table cells are not completely enclosed by these lines. Borderless tables are tables without any lines, including tables that use color blocks or space between text to position cells, and tables that position cells entirely based on the text within the table.

[0307] In this invention, the term "OCR" stands for Optical Character Recognition. It refers to the process by which a processing device determines the shape of an image by detecting dark and light patterns, and then uses character recognition methods to translate the text shapes in the image into computer text. The main steps are to first convert the original image file into a black-and-white dot matrix image file, and then convert it into processable text information based on its characteristics.

[0308] In this invention, the term "regular expression" means that the source string is transformed by configuring a "rule string" that conforms to the industry's common regular expression rules. The transformation mainly implements the filtering logic.

[0309] In this invention, the term "region" refers to the effective rectangular area covered by the object, including: left boundary coordinates (left, the difference between the leftmost edge of the object and the leftmost edge of the current page); right boundary coordinates (right, the difference between the rightmost edge of the object and the leftmost edge of the current page); top boundary coordinates (top, the difference between the top edge of the object and the top edge of the current page); bottom boundary coordinates (bottom, the difference between the bottom edge of the object and the bottom edge of the current page); width (width, the difference between the right boundary and the left boundary of the object); height (height, the difference between the bottom boundary and the top boundary of the object); and midpoint coordinates (midX and midY), obtained by taking the center point of the rectangular area and obtaining its x and y coordinates. Currently, objects containing region coordinate information include character objects, image objects, text objects, row objects, column objects, cell objects, table objects, page objects, etc.

[0310] The table information extraction method provided in this application can be applied to scenarios involving extracting table information from PDF files, such as extracting financial statement data from announcements of Hong Kong-listed companies. The following is a brief introduction to the application scenarios of a frameless table accurate recognition method based on a positioning algorithm disclosed in this embodiment:

[0311] PDF is a common electronic document format, primarily used for document display and printing. The storage structure of a PDF file includes various objects such as images, lines, frames, and characters, each with different data attributes. The internal layout of a PDF is achieved based on the coordinates contained within the object information, and the processing logic is complex.

[0312] This invention primarily addresses the conversion of tabular information stored in non-image formats. Current PDF table extraction technologies mainly target tables with full borders. This can be achieved by analyzing the border and character objects within the PDF storage structure to identify the table area, locating the table based on the positional relationship between characters and table borders, or by using image processing techniques to locate the table lines and areas. The table content is then converted into structured data based on these areas. However, these methods struggle with partially bordered and borderless tables, especially when there are inconsistent formats or cells spanning multiple columns. Determining the position of each cell solely based on the table borders can lead to recognition failures or errors.

[0313] Specifically, for borderless tables in PDF files, the lack of complete row and column border position information makes it difficult to accurately locate the row and column positions of cells. Furthermore, when correct recognition cannot be guaranteed, there is a lack of effective prompts to facilitate correction by business personnel. Significant technical challenges exist in improving the accuracy of wireless table recognition and in transferring unrecognizable table cells to manual recognition. This is because data storage in PDF files is unstructured; for text objects, PDF files only store characters and their positions, without the concept of tables. What appears as a table to the human eye is, in its underlying storage, a collection of separate text and framed object data obtained through complex processing of coordinate positions. Due to the lack of table lines, automated processing programs struggle to determine the table content area, as well as the row and column positions, and to convert the text content within that area into structured table data cells. Moreover, when encountering complex header information or overlapping cell content positions, interference can occur in cell content extraction, easily leading to errors or failures in recognition.

[0314] Meanwhile, when processing PDF tables, many solutions first convert the table into an image, then determine the position of the table cells based on the image's features, and finally convert the image into text based on the table cells. This process involves many steps, each of which can introduce errors, leading to an increased error rate in the final result. Furthermore, the numerous processing steps also result in significant processing latency and require substantial computational and memory resources.

[0315] Finally, current frameless table recognition solutions cannot adapt a single solution to complex tables in different scenarios and display formats. Furthermore, they lack effective methods to correct for issues such as mixed, overlapping, or offset characters in the table content. In summary, the recognition results cannot guarantee accuracy, still requiring manual review and cannot be automatically published to the next stage. Some conversion solutions designed for specific scenarios must be tightly coupled with the business context, requiring extensive configuration and annotation training to ensure accuracy.

[0316] By applying the method provided by this invention, the location of table cells (row and column areas) in any borderless table within a PDF file can be automatically identified without configuration, annotation, or training, thus enabling the automatic extraction of borderless tables from PDFs. In particular, for announcement PDFs such as financial statements (non-scanned format) of domestic and international listed companies that are primarily table-based, the method provided in this application can completely convert various forms of tables into structured data, restore the original PDF file's display information, and support multiple conversion formats such as XML, HTML, EXCEL, and database output.

[0317] Figure 1 This illustration shows the system architecture used in this embodiment, including a task center server cluster, a PDF parsing server cluster, a table analysis server cluster, and a storage / database server cluster, all of which are connected to each other via a wired network.

[0318] like Figure 2 As shown, the method for accurate recognition of borderless tables based on a positioning algorithm disclosed in this embodiment includes the following steps:

[0319] Step S301: Obtain the PDF source file to be processed and obtain its corresponding category and other information.

[0320] The task processing service cluster configures the PDF file types and PDF file paths to be processed based on the information of the PDF tasks to be processed (which can be obtained from the tasks to be processed, read from the local configuration file, or read through the network interface, etc.).

[0321] PDF file types group PDF files with consistent table processing workflows together, such as annual reports and quarterly reports of Hong Kong listed companies. PDF file types can be obtained from the classification of the website where the PDF was published, or through regular expression matching based on the PDF file's disclosure name.

[0322] The PDF file path list can contain one or more PDF files. The system reads the corresponding PDF source file based on the PDF file path via a wired network. The PDF source file can be the original PDF file disclosed by a listed company, or it can be a PDF file after the business personnel have manually annotated it through the table area configuration module. The system then processes the annotated areas in the PDF source file based on the annotation results.

[0323] Step S302: Based on the PDF file, obtain the structured information of the page objects and their contained element objects, text objects, etc., and generate one or more table tasks that need to be parsed in the PDF file according to the configuration.

[0324] In this embodiment of the invention, a PDF file refers to a file that conforms to the international PDF standard (ISO 32000) published by Adobe and the ISO organization. (1 / 2) The PDF file is not encrypted, and the structured information of various elements within it can be obtained. The PDF parsing service cluster obtains element set information page by page from the PDF source file. Each element set has a unique identifier, records its type, and different types of element sets have different structures. Combined with the positioning algorithm, the structured information of business objects such as pages, text, and lines is obtained, and the above object set information is saved as a JSON format file for storage, page by page.

[0325] Using existing open-source tools like PDFbox to obtain information about corresponding text objects will not yield complete information about the PDF object. For example, the output text object only contains text content and location information, but lacks detailed information such as font, font size, and color. To ensure accurate recognition, all information about the stored element objects is obtained based on the underlying storage structure of the PDF. Then, according to the positioning algorithm, it is associated with page objects, line objects, text objects, etc., making it easy to find relevant information about each element in the PDF during further processing.

[0326] In this embodiment of the invention, character objects from the PDF are primarily obtained, and their content and related attributes are stored in a JSON structure file. It is worth noting that, in addition to character objects, various other PDF-supported objects, such as line objects and graph objects, can also be obtained. By converting the PDF source file into a structured object file, pagination, sorting, and indexing can be implemented as needed, improving processing efficiency while reducing the consumption of memory and other resources.

[0327] Based on PDF page objects and element objects, element objects can be merged into business objects, such as text objects and line objects, according to their content and attributes. The associated attributes of related objects are saved, and the object content and related attributes are stored in a JSON structure file. This aggregation of business objects allows different applications to process them based on their content and attributes, and to locate related element objects, further improving processing efficiency. Note that in addition to text objects and line objects, other business objects such as line objects, region objects, and table of contents objects can be created based on different element objects to meet the needs of different applications.

[0328] Specifically, combined Figure 3 The detailed implementation process of step S302 mainly includes the following steps:

[0329] Step S3021: Read the dictionary object and element objects, such as Figure 5 As shown, the specific steps include:

[0330] Step S30211: Read dictionary (Catalog) information from the PDF file and create a page object.

[0331] A PDF file mainly consists of four parts: a header, a body, a cross-reference table, and a footer. The header primarily stores the version number of the PDF specification that the PDF file follows. During processing, it will first confirm whether it is a version supported by this embodiment of the invention, and then determine the reading method for other content of the PDF based on the version.

[0332] Based on the current version, the file end is read to obtain the cross-reference table address declared in the file end, dictionary information is obtained, and security information such as encryption of the PDF file is read to confirm that the current PDF is not encrypted and that various element object related information can be copied.

[0333] After confirming that the PDF file can be parsed, page objects can be constructed from the root page tree based on the dictionary information. Page objects mainly include initial information such as page identifiers and page regions. In addition to the coordinates of the rectangular area of ​​the current page, the page region also includes the upper and lower boundary information of its vertical coordinates relative to the entire PDF file.

[0334] Step S30212: Based on the page objects, read the indirect objects in the PDF page by page and create element objects.

[0335] Based on the addresses of the cross-reference tables stored in the dictionary, information about the constituent objects in a PDF file can be read in content flow order. Content flow order refers to the order in which the PDF depicts page information, generally from top to bottom and from left to right.

[0336] According to the set of page objects, traverse and read all the information of the PDF composition objects on the current page, and write them into the element object array. The element objects include common attributes such as unique identifier, object type, belonging page, and region coordinates, and will also store the specific attributes of different types of objects. The main element objects include various types such as line objects, character objects, and picture objects. In addition to character content and character region information, the character object will also save additional attribute information such as font, font size, color, and whether it is bold. In addition to coordinates, the straight line object will also include additional attribute information such as color and width.

[0337] To improve access efficiency, according to business needs, the object types to be extracted can also be configured. Or filter or convert according to the characteristics of a certain type of object. Such as filtering image objects with too small areas.

[0338] Through the preprocessing of the original information, common noise objects that may cause parsing errors can be merged or filtered, improving the efficiency and accuracy of subsequent processing.

[0339] Step S30213: Supplement the attribute information of the element object

[0340] In addition to the information saved by the objects in the PDF, the element objects will also save common attributes such as the belonging page identifier and the content stream sequence number, as well as the attribute information supplemented and expanded according to the element object type. For example, for character objects, character type attributes can also be supplemented. Match the content of the character object with the configured special character array. If it belongs to the special character set, obtain the character type according to the set configuration information. If it is not found in the special character set, the character type is set to a common character. The special character array includes two attributes: character content and character type. The character type includes characters without specific meanings such as punctuation marks and meaningless auxiliary words (of, de...), and separator characters such as spaces, line breaks, and paragraphs. The special character array can be continuously supplemented according to specific business needs. According to business needs, more extended attribute information can be supplemented for different types of element objects.

[0341] Step S30214: Save the PDF element information page by page

[0342] Save the set of element objects belonging to the current page page by page in a structured format file. When searching for relevant element object content or attributes and other information through business objects later, the retrieval efficiency can be improved.

[0343] Step S3022: Create a text object according to the set of character objects in the same paragraph.

[0344] The object information obtained from the underlying storage structure of a PDF is not necessarily ordered according to its position coordinates, and does not include structured information such as tables of contents, titles, and lines. To facilitate further processing, this invention first merges the character object set in the element set according to paragraph identifiers to create a text object set.

[0345] like Figure 6 As shown, step S3022 specifically includes the following steps:

[0346] Step S30221: Obtain the collection of character objects for each page and sort them, specifically including the following steps:

[0347] Step S302211: Traverse the PDF element objects on the current page and obtain a collection of all character objects. Since PDF element objects include not only character objects, when processing text objects, it is necessary to first create a character object array and write the identifiers of all character objects located within the current page into the array.

[0348] Step S302212: Sort according to the position coordinates of the character objects

[0349] Sort the array of character objects according to the sorting rule: sort from left to right and top to bottom based on the coordinates of the character object's region. The coordinates of the page character objects are less than or equal to the coordinates of the page region.

[0350] Step S30222: Merge character objects of the same paragraph into a text object.

[0351] Character objects stored in PDF files are stored character-by-character. To facilitate subsequent business processing, characters from the same paragraph need to be merged into a single text object. Character merging is primarily based on position coordinates and paragraph characteristics to determine whether different character objects belong to the same paragraph. If they do, they are merged into a single text object.

[0352] like Figure 7 As shown, the specific implementation process of step S30222 is as follows:

[0353] Step S302221: Create a text collection array

[0354] A text set includes text identifiers and character identifiers, as well as the criteria for merging them. A text identifier can be associated with multiple character identifiers.

[0355] Step S302222: Read the first character object

[0356] If the current text collection is empty, the identifier corresponding to the first character object will be added to the current text collection.

[0357] Step S302223: Read the next character object of the first character object as the second character object, and continue until there is no next character object on the current page, at which point the processing ends.

[0358] Step S302224: Determine if the second character object is the same paragraph as the current text collection.

[0359] When the second character is a character without specific meaning, it cannot be the first character of a paragraph and should belong to the current paragraph. The second character object is added to the current text collection.

[0360] When the second character is a delimiter character, it is necessary to determine whether they are the same paragraphs according to the delimiter character segmentation rules;

[0361] When the second character is a newline character, the next character is a newline character; add the second character object to the current text collection, create a new text collection, update the next character object of the second character object to the first character object, and repeat step S302222.

[0362] When the second character is a space, it is necessary to further determine whether the current text set consists entirely of English words and whether the last character is not a space. If the conditions are met, the second character object is confirmed to belong to the current paragraph and added to the current text set. If the conditions are not met, the process jumps to step S302225, where determining whether the current text set consists entirely of English words involves: traversing all character objects in the current text set, concatenating their contents, and if they all fall within the range of English + numbers + punctuation marks, then they are considered to be English words.

[0363] When the second character is a normal character, proceed to step S302225.

[0364] Step S302225: Based on character position information and font information, determine whether the second character object is the same paragraph as the current text collection.

[0365] 1) Determine if the paragraphs are the same based on the font and font size of the second character object and the first character object.

[0366] Determine if the font and font size of the second character object are the same or similar to those of the first character object. If the fonts are different or the font size difference exceeds the set error threshold, then the two are considered not to belong to the same paragraph. The default font size error threshold can be set to a difference of 2, or it can be adjusted according to business needs. If it is confirmed that they do not belong to the same paragraph, create a new text collection, update the second character object to the first character object, and repeat step S302222.

[0367] 2) Determine if the paragraphs are the same based on the positions of the second character object and the first character object.

[0368] Obtain the difference between the x-coordinate and y-coordinate of the second character object and the first character object. If the difference in either the x-coordinate or y-coordinate is greater than a threshold, the two are considered not to belong to the same paragraph. The coordinate difference is calculated based on the midpoint coordinates of the two character objects, using the difference between their x-coordinates on the x-axis and y-axis. The x-coordinate threshold is set to a multiple of the current character object's width, and the y-coordinate threshold is set to a multiple of the current character object's height by default. It can be set to 1.1 times, or adjusted according to business needs. If it is confirmed that they do not belong to the same paragraph, create a new text collection, update the second character object to the first character object, and repeat step S302222.

[0369] 3) When the second character object is close to the first character object, it can be determined that they are the same paragraph, and the second character object is added to the current text collection.

[0370] Step S302226: Traverse all character objects on this page and create a collection of text objects.

[0371] After processing all character objects on this page, text objects will be created based on the text collection array, and their associated character objects will be merged and written. The character object merging operation includes writing the page identifier, merging the contents of related character object collections, and obtaining all coordinate information of the rectangular area of ​​the text object after coordinate merging.

[0372] After creating the text objects, sort them from left to right and from top to bottom according to the bottom left coordinate of the text objects.

[0373] Step S30223: Merge the annotation information in the text.

[0374] During step S30222, in scenarios where the text includes superscript and subscript annotations, the text may be misidentified as new text objects due to significant differences in font size and position compared to the main text, resulting in the same text being divided into multiple text objects. In step S30223, the annotation character objects in the text are identified based on the positional differences between the annotations and the main text, and the main text and superscript and subscript annotations in the same text are merged into a single text object.

[0375] like Figure 8 As shown, the specific implementation process of step S30223 includes the following steps:

[0376] Step S302231: Read the first text object, obtain its last character object as the first character object, and read the second text object sequentially.

[0377] Step S302232: Based on the relative position of the second text object and the first text object, determine whether the second text object is a superscript or subscript.

[0378] If the absolute difference between the lower boundary coordinates of the second text object and the center ordinate of the first character object is less than a threshold, meaning the second text object is located in the upper half of the character object, then it can be considered a top label of the first text object. The threshold can be set to 3 pixels or adjusted according to business needs.

[0379] If the absolute difference between the center coordinate of the first character object and the upper boundary coordinate of the second text object is less than a threshold, meaning the second text object is located in the lower half of the character object, then it can be considered a subscript of the first text object. The threshold can be set to 3 pixels or adjusted according to business needs.

[0380] If neither of the above two conditions applies, then the second text object is not a subscript or superscript, and the second text object is set as the first text object. Repeat step S302231.

[0381] Step S302233: Merge superscripts, subscripts, and related text objects

[0382] When a second text object is confirmed as a label, it is necessary to determine whether its adjacent text objects can be merged into the same text object, including the following steps.

[0383] Step S3022331: Read the third text object sequentially;

[0384] Step S3022332: Obtain the difference in ordinates between the first text object and the third text object. The difference in ordinates is the difference between the midpoints of the two text objects in the ordinate direction.

[0385] Step S3022333: Determine whether the third text object and the first text object belong to the same paragraph:

[0386] If the difference in the ordinate between the first and third text objects is greater than the set threshold, they belong to different paragraphs. The threshold can be set to 3 pixels or adjusted according to business needs. The first and second text objects are merged into a new text object, and the elements associated with the second text object are marked as superscripts / subscripts.

[0387] If the difference between the ordinates of the first and third text objects is less than or equal to the set threshold, then the first, second, and third text objects will be merged into a new text object, and the elements associated with the second text object will be marked as superscripts / subscripts.

[0388] Step S3022334: Set the third text object as the first text object, and repeat step S3022331.

[0389] Step S3023: Confirm the initial position of the row object.

[0390] After organizing the text objects on the page, the corresponding text line information can be obtained based on the vertical coordinate position of the text objects.

[0391] like Figure 9 As shown, the specific implementation process of step S3023 includes the following steps:

[0392] Step S30231: Obtain the initial row object of the current page.

[0393] By iterating through the vertical coordinates of all text objects on the page, a line object is created, and all text objects can be associated with the line object.

[0394] The specific implementation process of step S30231 includes the following steps:

[0395] Step S30231: Traverse all text objects on the current page and create an array of line objects for the current page.

[0396] If the absolute value of the difference between the lower boundary coordinates of the text object and the lower boundary coordinates of the current line object is less than the threshold, it is confirmed that the associated line object of the text object already exists. If the lower boundary coordinates of the current line object are less than the lower boundary coordinates of the text object, they are updated to the lower boundary coordinates of the text object. The default threshold is 3 pixels, but this threshold can be adjusted according to business needs.

[0397] If the absolute value of the difference between the lower boundary coordinates of the text object and the lower boundary coordinates of all line objects is greater than the threshold, then a new line object is created, and the lower coordinates of the line object are updated to the lower boundary coordinates of the text object.

[0398] Furthermore, in this embodiment, the operation described in step S30231, which determines the line coordinate position based on the lower boundary coordinate of the text object, can also be based on the upper boundary coordinate of the text object as the criterion for determining the line coordinate.

[0399] Step S30232: Merge row objects with too small an interval.

[0400] If adjacent row objects have overlapping areas or their intervals are too small, they can be considered as the same row, and the two adjacent rows need to be merged into the same row object.

[0401] The specific implementation process of step S30232 includes the following steps:

[0402] Step S302321: Sort the row objects according to their lower boundary coordinates from smallest to largest, and write them into the row array.

[0403] By iterating through the row array, the line spacing between row objects is obtained, which is the difference between the lower boundary coordinate of the current row and the upper boundary coordinate of the next row. The minimum and maximum effective line spacing are also determined. The effective line spacing is calculated by counting the occurrences of all line spacings on the current page, dividing by the total number of occurrences multiplied by 100, and taking the maximum and minimum values ​​of the line spacings with a percentage greater than a threshold. The default threshold can be set to 50%, but this threshold can be adjusted according to business needs.

[0404] Step S302322: Obtain the coordinates of the upper boundary of the first row.

[0405] Read the row array, taking the first row as the first row. The upper boundary coordinates of the first row are the coordinates of the upper boundary of the page area.

[0406] Step S302323: Determine whether the first row needs to be merged with the second row.

[0407] Read the row objects following the first row from the row array and treat them as the second row. Check if the line spacing of the first row is less than the minimum valid line spacing. If it is, merge the first and second rows. That is, update the bottom boundary coordinates of the first row to the bottom boundary coordinates of the second row, update the line spacing of the first row to the line spacing of the second row, and delete the second row.

[0408] Step S302324: Obtain the coordinates of the upper boundary of the first row.

[0409] Read the rows preceding the first row from the row array and treat them as the third row. Set the upper bound coordinate of the first row to the lower bound coordinate of the third row + 1.

[0410] Step S302325: Treat the row objects after the first row as the first row, jump to step S302323, and continue until the last row of the row array.

[0411] Explanation: After the above processing, the current page is divided into multiple standard line regions. Each standard line region only records the start and end positions of the line's vertical coordinate, and there is no overlap between standard line regions. In addition to character objects, each standard line region also includes blank areas and non-character objects. Step S33024 associates line objects with text objects; multiple text objects can be associated within the same line, and multiple line objects can be associated with the same text object.

[0412] Step S3024: Associate the line object with the text object.

[0413] Steps S3021 to S3023 obtain all text objects and standard line objects in the current page. The same standard line object area may contain one or more text objects; the same text object may also cover one or more all or part of the standard line area. The association between the standard line objects and the text objects is confirmed by analyzing the overlap between the text object and standard line object areas.

[0414] Through processing, the set of character objects associated with each standard line object in the text object area can be obtained, and the specific area of ​​each line associated with the current text object can be obtained, which can adapt to the processing of complex multi-line text scenarios. In the case of complex page structure or complex table format, by accurately locating each line object within the text object and associating it with the set of character objects in the PDF, lossless restoration of complex attribute information in the PDF, including fonts, superscripts and subscripts, can be achieved.

[0415] like Figure 10 As shown, the specific implementation process of step S3024 includes the following steps:

[0416] Step S30241: Based on the text object region, identify the associated standard line, specifically including the following steps:

[0417] Step S302411: Based on the lower boundary coordinates of the text object, find the standard line area where it is located and use it as the ending line.

[0418] Step S302412: Based on the upper boundary coordinates of the text object, find the standard line area where it is located and use it as the starting line.

[0419] Step S302413: Update the start and end lines of the text object identifier. If the start line is shorter than the end line, the current text object covers multiple lines.

[0420] Note: If a text object covers multiple lines, it is necessary to parse each standard line object line by line based on the character object collection associated with the text object, and update the information of each line object to which the text object belongs.

[0421] Step S30242: Split character objects in the text object according to standard lines, specifically including the following steps:

[0422] Step S302421: In the current text object, create an array of lines based on the starting and ending lines.

[0423] Step S302422: Associate a single line with a text object

[0424] If a text object is associated with only a single standard line, create a new line object, write the starting line information into the line object, including the text object content, all character objects associated with the text object, etc., and obtain the text area of ​​the line object, which is consistent with the text object area.

[0425] Step S302423: Associate multiple lines with a text object

[0426] If a text object is associated with multiple standard lines, then the entire character array associated with the text object is obtained. The line containing each character is recorded based on the lower boundary coordinates of each character object. The character array is sorted from top to bottom, and for identical lines, it is sorted from left to right according to the left boundary coordinates of the characters. From the starting line to the ending line, the line objects are written into the line array, including all the text content corresponding to the line, the set of character identifiers associated with the line, and the text area covered by the line.

[0427] Step S30243: Traverse all text objects on this page and associate them with the standard line.

[0428] Traverse all text objects on this page, repeating steps S30241 to S30242 to complete the association of all text objects with the standard line. Sort the text objects from top to bottom according to the terminating line, and within the same terminating line, sort them from smallest to largest according to the left boundary coordinate of the text object.

[0429] Based on the current page's standard line object, traverse from top to bottom to obtain an array of all text objects associated with the standard line. Merge the text regions in the text objects associated with the standard line that are identical to the current line to obtain the standard line text region. The standard line text region is less than or equal to the line region; any part of the line region not covered by the line text region is blank or contains other element objects. Merge the line text regions to obtain the current page text region.

[0430] Step S30244: Merge multi-line text objects. Merge multi-line text objects with the same text block on the page into a single text object. This includes the following steps:

[0431] Step S302441: Obtain the current text object as the first text object.

[0432] Step S302442: Obtain the second text object and the third text object.

[0433] The second text object is the one whose left boundary coordinates are close to those of the first text object, and which is located below the first text object on the vertical axis. The absolute difference between the left boundary coordinates of the first and second text objects is less than a first threshold, which is by default twice the average character width of the first text object (considering scenarios such as a 2-character first-line indentation in paragraphs). The first threshold can also be adjusted according to business needs. The ending line of the second text object is greater than the starting line of the first text object, and the difference is minimal. The third text object is the one whose left boundary coordinates are close to those of the second text object, and which is located below the second text object on the vertical axis.

[0434] Step S302443: Determine whether the first text object and the second text object need to be merged.

[0435] Read the text area of ​​the first text object up to the end of the first text object as the first line area, and the text area of ​​the second text object up to the beginning of the second text object as the second line area.

[0436] If the lower boundary coordinates of the first text object and the upper boundary coordinates of the second text object are greater than the maximum effective line spacing on the current page, then the first and second text objects are not in the same paragraph and do not need to be merged. The maximum effective line spacing is calculated by counting the occurrences of all line spacings on the current page, dividing that number by the total number of line spacing occurrences multiplied by 100, and taking the maximum value of the line spacings that account for a percentage greater than the second threshold. The second threshold can be set to 50% by default, but it can also be adjusted according to business needs.

[0437] If the font and font size of the text objects in the first row area are mostly different from those in the second row area, and the first and second text objects are not in the same paragraph, they do not need to be merged.

[0438] If the absolute difference between the right boundary coordinates of the first text object region and the right boundary coordinates of the second text object region is less than or equal to the third threshold, the first and second text objects are considered to be the same paragraph and should be merged. The third threshold is set to 1 times the average character width of the first text object by default (to account for scenarios where the presence of English letters or numbers causes misalignment at the end of lines), but it can also be adjusted according to business needs.

[0439] If the difference between the right boundary coordinates of the first text object region and the right boundary coordinates of the second text object region is greater than the third threshold, and the difference between the left boundary coordinates of the second text object and the left boundary coordinates of the first text object is less than or equal to the fourth threshold, or the difference between the left boundary coordinates of the third text object and the left boundary coordinates of the second text object is less than or equal to the fourth threshold, then the second text object and the first text object are the same paragraph and need to be merged. The second text object and the third text object are not the same paragraph. The fourth threshold defaults to 0.5 times the average character width of the second text object, but it can be adjusted according to business needs.

[0440] If both the first and second line areas are associated with only a single text object, and at least one text object has a width greater than the fifth threshold, and the second text object and the first text object belong to the same paragraph, they need to be merged. The fifth threshold is set to 80% by default, but can be adjusted according to business needs.

[0441] If none of the above conditions are met, the first text object and the second text object are not from the same paragraph and do not need to be merged.

[0442] Step S302444: If the processing result of step S302443 is that the first text object and the second text object are in the same paragraph, they need to be merged. The character object information associated with the two objects is merged into the first text object, and step S30242 is executed to re-break the lines. Delete the second text object.

[0443] Step S302445: Take the next text object of the first text object as the first text object, and repeat step S302441 until the last text object of the current page is obtained. If text objects are merged, sort all text objects on the current page from top to bottom according to the terminating line, and sort the text objects within the same terminating line according to the left boundary coordinates of the text objects from smallest to largest.

[0444] Step S30245: Segment the text object based on paragraph features, specifically including the following steps:

[0445] Step S302451: Perform a splitting operation based on the text object array processed in step S30244.

[0446] Step S302452: Traverse the array of text objects, read each line of the current text object, and take the current line as the first line and the next line as the second line. Continue until there is no next line after the current line, then the processing ends.

[0447] Step S302453: Determine whether the current text object needs to be segmented according to the rules.

[0448] Rule 1: Read the left boundary coordinates of the second line. If the difference between the second line and the left boundary coordinates of the current page's text area is greater than a threshold, or the difference between the second line and the left boundary coordinates of the first line is greater than a threshold, then the current line meets the new paragraph indentation flag, and it can be determined that the second line constitutes a new text paragraph. The threshold defaults to 1 times the average character width of the current text object, but can be adjusted according to business needs.

[0449] Rule 2: Read the right boundary coordinates of the second line. If the difference between the right boundary coordinates of the current page's text area and the second line is greater than a threshold, or the difference between the right boundary coordinates of the first line and the second line is greater than a threshold, then the current line is considered to have ended. The next line after the second line constitutes a new text paragraph. The threshold is set to 1 times the average width of the current text object by default, but can be adjusted according to business needs.

[0450] Rule 3: When Rule 1 is not satisfied, the regular expression configured based on business characteristics can be used to determine whether characters conform to the segmentation rules. For example, for patent-related PDFs, the starting character can be configured to conform to the [numeric] format. If the current line conforms to the regular expression rule, it can be determined that a new text paragraph begins from the current line.

[0451] Step S302454: After executing step S302453, if a new text paragraph needs to be created, write the current text object from its starting line to the line preceding the paragraph's starting line into the current text object. Add the new text object to the array, and write the current text object from the paragraph's starting line to its final line into the new object, using it as the current text object. If the current text object does not need to be segmented, use the next text object as the current text object. Execute step S302452 until the current text object becomes the last text object on the current page.

[0452] Note: Segmentation rules can be used to create a rule template library. Business users can select one or more segmentation rules based on the characteristics of the PDF file and business needs, and can confirm their processing priority to adapt to the segmentation requirements of different business scenarios.

[0453] Step S30246: Update the text object and the standard line object, and reorder them.

[0454] After all text objects on this page have been processed, process each text object individually according to step S30242, update the relationship between the text objects and the standard line objects, and reorder them.

[0455] Step S3025: Update and save the relevant application object information on this page.

[0456] Based on the processing results, the objects, line objects, and text objects of the current page are reordered and relevant information such as the area is updated.

[0457] Step S3026: Traverse all pages and execute steps S3022 to S3025 to save the application objects page by page to the structured file.

[0458] Traverse all pages and execute steps S3021 to S3025. Based on the position of PDF element objects, merge element objects of the same type according to business rules to obtain the corresponding application objects. Application objects include page objects, line objects, and text objects, etc. Update all application objects for the current page and save them to a structured file. For scenarios with a large number of PDF pages and high processing efficiency requirements, multi-threading can be used to process and save different PDF pages in parallel. After all pages have been saved, proceed to the next step of processing.

[0459] Step S3027: Identify the valid area of ​​the page.

[0460] In PDF files, headers and footers appear on every page when pagination occurs. Because header and footer information is treated as text when recognizing tables, this can easily lead to errors. Furthermore, in scenarios where text content spans multiple pages or multi-page tables, the presence of headers and footers, along with other noise, can also cause misjudgments. Therefore, it's necessary to first identify whether headers / footers exist and, based on application needs, determine whether to filter the text objects corresponding to headers / footers.

[0461] like Figure 11 As shown, the specific implementation process of step S3027 includes the following steps:

[0462] Step S30271: Identify the number of rows in the header area, specifically including the following steps:

[0463] Step S302711: Traverse all pages, read all text objects in the first line of each page, merge the text content corresponding to the text objects in ascending order of left coordinate, and obtain the text content of the first line.

[0464] Step S302712: Identify integer objects present in the first line of text and replace them with labels <integer1>, <integer2>, ...

[0465] Since the page numbers change on each page of a PDF, the integers need to be replaced with labels during recognition to avoid recognition errors caused by different labels on the current page.

[0466] Step S302713: Count the number of pages with similar first rows across all pages. If the percentage of similar pages is greater than a threshold, the first row can be confirmed as a header area. The default threshold is 95%, but it can be adjusted according to business needs. (The threshold is not set to 100% primarily to ensure compatibility with scenarios where a few pages in a PDF file lack header information.)

[0467] Step S302714: Continue processing the second line of text to determine whether it belongs to the header area.

[0468] Step S302715: Processing ends if the last line of the page is reached or the number of lines exceeds the threshold. The default threshold is 3 lines, but it can be adjusted according to business needs.

[0469] Through the above processing, the number of rows in the header area is obtained. If the number of rows in the header area is greater than 0, the typical header identifier (an integer object replaced with a label) after merging all the text content of the header rows needs to be obtained. If it is 0, then there is no header area.

[0470] Step S30272: Identify the number of rows in the footer area, specifically including the following steps:

[0471] Step S302721: Traverse all pages, read all text objects in the first line of each page, merge the text content corresponding to the text objects in ascending order of left coordinate, and obtain the text content of the last line.

[0472] Step S302722: Identify integer objects present in the last line of text and replace them with labels <integer1>, <integer2>, ...

[0473] Since the page numbers change on each page of a PDF, the integers need to be replaced with labels during recognition to avoid recognition errors caused by different labels on the current page.

[0474] Step S302723: Count the number of pages similar to the last row of the page. If its percentage of all pages is greater than the threshold, then the last row can be confirmed as the footer area. The default threshold is 95%, but it can be adjusted according to business needs.

[0475] Step S302724: Continue processing the second-to-last line of text to determine if it belongs to the footer area.

[0476] Step S302725: If the current behavior is the first row of the page or the number of rows exceeds the threshold, the processing ends. The default threshold is 3 rows, but it can be adjusted according to business needs.

[0477] Through the above processing, the number of rows in the footer area is obtained. If the number of rows in the footer area is greater than 0, the typical footer identifier (an integer object replaced with a label) after merging all the text content of the footer rows needs to be obtained. If it is 0, then there is no footer area.

[0478] Step S30273: Identify the attributes of each line on the current page, including header / footer / body text, specifically including the following steps:

[0479] Step S302731: If the header row number is greater than 0, traverse downwards from the first row of the current page to the header row number, merging one or more line object text contents. Identify integer objects in the merged text content, replace them with tags, and compare them with typical header identifiers. If similar, confirm that this part of the line object is the header area. If not similar, consider that this page has no header area.

[0480] If the number of rows in the footer area is greater than 0, traverse upwards from the last line of the current page to the footer area line number, obtaining one or more line objects of text content which are then merged. Identify integer objects within the merged text content, replace them with tags, and compare them with typical footer identifiers. If similar, confirm that this portion of the line objects is the footer area. If not similar, it is assumed that this page has no footer area.

[0481] Step S302732: Traverse all standard line objects on the current page and set all line objects in areas without headers / footers to body text.

[0482] Step S302733: Traverse all text objects on the current page and determine the text object attributes (header / footer / body text) based on the standard line attributes corresponding to its associated lines.

[0483] Step S302734: Save the updated structured file of the application object.

[0484] Step S30274: Traverse and process all pages of the application object.

[0485] Step S3028: Generate the table processing task for the PDF.

[0486] After parsing all pages of the PDF, a list of tables to be processed is read based on the PDF source file type. This list is configured by business personnel according to different PDF source file types. A single PDF file type can include one or more tables to be processed, and different processing priorities can be configured for each table. When generating the business list, tables with the same priority are merged into the same task and written to the task list. Task information includes the PDF source file name, PDF source file type, PDF source file path, table identifier (multiple tables allowed), processing priority, and processing status (default: pending).

[0487] Further explanation: By reading the structured files of PDF application objects and element objects, there is no need to repeatedly access the PDF source file, improving processing and conversion efficiency and reducing the consumption of computing resources on the processing service cluster. At the same time, it avoids the problem of lost attribute information such as object fonts caused by common PDF conversion tools, resulting in an inability to display the file identically to the original PDF.

[0488] Through task scheduling, high-priority tables can be processed first, reducing processing delays for important business tables. Multiple tables with the same priority within the same PDF will be processed uniformly, avoiding processing delays caused by multiple reads. Meanwhile,

[0489] Alternatively, allocating more computing resources to high-priority tasks can enhance their parallel processing capabilities, ensuring timely table conversion during peak financial disclosure periods. If necessary, prioritizing the processing of one or more types of PDF files, or implementing parallel parsing of different pages within the same PDF file, can further reduce the processing latency of PDF table parsing.

[0490] After processing in step S302, the structure of the output PDF object is as follows: Figure 4 As shown.

[0491] Step S303: Obtain the configuration of the table to be processed from the list of table tasks to be processed generated in S302, and locate the area where the table is located according to the configuration.

[0492] This embodiment is as follows: Figure 12 The consolidated financial statements of Hong Kong-listed companies shown below are used as an example for analysis and explanation, combined with... Figure 13 Step S303 specifically includes the following steps:

[0493] Step S3031: Obtain the tasks to be processed from the task list.

[0494] The processing service cluster scans the list of currently unprocessed tasks and retrieves the tasks to be processed based on priority. It also obtains information such as the corresponding file paths from the task information.

[0495] Further explanation: When multiple tables from the same PDF file need to be processed simultaneously, different processing service clusters can handle the same PDF character object collection file based on their priority. By allocating more computing resources to high-priority processing service clusters, timely processing can be ensured. Without asynchronous scheduling, all tables in the same PDF file must be processed before the next PDF file can be processed. This leads to increased delays for high-priority tables due to waiting for processing, and such delays are more pronounced during peak periods such as the release of numerous announcements by listed companies during their interim reports.

[0496] PDF object collection files are paginated to store structured data of element objects and application objects. This enables the association and sorting of different objects, significantly improving processing speed compared to processing PDF source files, while also reducing the consumption of computing resources and memory on the processing service cluster.

[0497] For business scenarios where latency is not a major concern, the same PDF file can be processed serially without relying on task scheduling.

[0498] Step S3032: Configure table area feature information.

[0499] The first step in configuring table feature information is to define the table start position feature, which locates the first page and first row of the table to be processed. This feature can be configured with one or more positive characteristic conditions using regular expressions, as well as AND / OR relationships between these conditions. During configuration, it's only necessary to ensure that the start position precedes the table area to be processed; it doesn't need to be precise down to the row preceding the first row. During configuration, object tags, such as integer objects or date objects, can be configured to transform specific integer or date information into uniform tag identifiers, improving matching accuracy. Language conversions, such as Simplified / Traditional Chinese conversion, can also be configured, converting the configured strings and saving them to adapt to PDF files in different languages.

[0500] In the current instance, it is possible to configure the table to include "Comprehensive Financial Status Table" as the starting position identifier, and to set the simplified / traditional conversion to change the keywords to traditional characters.

[0501] In addition, it is necessary to configure whether manual annotation is required when the table area cannot be located.

[0502] Step S3033: Locate the initial position of the table area, such as... Figure 14 As shown, the specific steps include:

[0503] Step S30331: Locate the row object at the beginning of the table range, further including the following steps:

[0504] Step S303311: Starting from the homepage, traverse the text content corresponding to each line object line by line.

[0505] Obtain the text content of the current standard line. When reading, filter the header and footer areas and process only all lines in the body text area.

[0506] Step S303312: Based on the configured tag conversion, replace the entity portion of the text content of the standard line object with tags.

[0507] The system reads the tag types to be converted from the configuration and checks the standard line text content to determine if a tag entity exists and its specific location based on the characteristics of the tag type. If a tag entity exists, the tag identifier replaces the corresponding entity.

[0508] By configuring special entity objects such as integers, floating-point numbers, and dates to replace their specific content with label identifiers, the complexity of configuration can be reduced to meet the needs of more complex business scenarios.

[0509] Step S303313: Determine if the current row is the first row of the table's starting area:

[0510] If the processed text content of the current row meets the configured starting position rules, then the current row is the first row of the table's starting area, and the processing ends.

[0511] If the text content of the current line does not meet the configured starting position rules after processing, the next line of the current page will be taken as the current line. If the last line of the main text area of ​​the current page is reached, the first line of the main text area of ​​the next page will be taken as the current line. Proceed to step S303312 to continue processing.

[0512] Step S303314: If the current page is the last line of the last main text page, the configured starting position rule still cannot be met, and the table area cannot be located.

[0513] Step S30332: Locate the text object at the beginning of the table area and confirm the current starting row.

[0514] If the starting position of the table area is not found after executing step S30331, it may be because the marked content is truncated by a line break, making it impossible to locate. You can search again based on the text object.

[0515] The specific implementation process of step S30332 is as follows:

[0516] Step S303321: Start by traversing the content of the text object from the homepage.

[0517] Only text objects within the main text area are processed; text objects in the header and footer are filtered out. For multi-line text objects, the concatenated result of removing line breaks and other concatenation elements from each line's text content is used as the text object content.

[0518] Step S303322: Based on the configured tag conversion, replace the corresponding entity part in the text object content with the tag.

[0519] Step S303323: When the text content meets the configured start position rule, confirm the starting line.

[0520] If the processed text content of the current text object meets the configured starting position rules, then the starting position of the table can be confirmed to be included in the row containing this text object. Then, based on the specific character positions in the text object's content that conform to the configured rules, its corresponding standard row object is obtained and confirmed as the starting row. Through the above processing, feature text that spans multiple lines can also be located.

[0521] Step S303324: If the current text object does not match, continue processing the next text object until the last text object in the main text area.

[0522] Step S303325: If the starting position of the table area is not found on the current page, then start from the first text object in the main text area of ​​the next page and repeat step S303321.

[0523] Step S303326: If the location cannot be located after traversing all pages, proceed to step S30333 to handle the location failure situation.

[0524] Step S30333: If the corresponding keyword location cannot be found in the above steps, return to the table area that cannot be found.

[0525] Step S3034: Confirm the coordinates of the table area, such as... Figure 15 As shown, the specific steps include:

[0526] Step S30341: Locate the starting page and starting row of the table, further including the following steps:

[0527] Step S303411: Starting from the first page and first row of the table area, read line by line in the text area of ​​this page.

[0528] Step S303412: Locate the starting row of the table in the starting page of the table area.

[0529] Read the current row and determine whether it is the starting row of the table based on table feature rules. The steps for determining table feature rules are as follows: Figure 16 As shown:

[0530] First, determine if the number of text objects associated with the current row exceeds the minimum column count threshold. The minimum column count threshold is typically set to 1, but can also be configured by the business logic. For borderless tables, the header usually exceeds one column. If it does, it can be confirmed as the starting row of the table.

[0531] If the number of text objects is less than the minimum column count threshold, the next step is to determine whether the ratio of the text area width of the first text object in the current row to the page width is less than or equal to the maximum column width ratio threshold. The maximum column width ratio threshold is generally set to 60%, but can be adjusted according to business needs. Verifying the width of the first column header further confirms whether it is the starting row of the table. Then, the most recent N rows are read downwards from the current row to obtain the number of objects and the first text object in each row. Within these N rows, is there any standard row whose associated text object count is greater than the threshold, or any standard row whose width of all text objects and the ratio of their width to the page width are less than the maximum column width ratio threshold? If any of these conditions are met, the current row can be confirmed as the starting row of the table. The default value for reading N rows downwards is 3 rows, but this can be adjusted according to actual needs. To avoid identification errors, in addition to judging based on the first row of the rule table, it is also necessary to judge based on the characteristics of the rows below. Because the table content area may have special scenarios such as all columns except the first column being empty, or the first column of the header being missing, judgment cannot be based solely on the corresponding column count.

[0532] like Figure 17 In actual disclosure cases, it can be seen that the first row of the table marked with a box is a single column. Its width is less than the maximum column width percentage. Moreover, the number of related objects in the three rows below it is greater than 1, which meets the characteristics of a table, so it is determined to be the starting row of the table.

[0533] Step S303413: If the current row does not meet the above conditions, continue to traverse the current page's main text rows until a row that meets the characteristics is found as the starting row of the table, or the end row of the main text area is reached.

[0534] Step S303414: If the starting row of the table is not found on the current page, continue searching on the next page.

[0535] If the table is not found after traversing N pages, a "Table not found" return value will be returned. N is set to 2 pages by default, but can be adjusted according to business needs.

[0536] Step S30342: Locate whether the end row is included on the first page of the table, such as... Figure 18 As shown, it includes the following steps:

[0537] Step S303421: Read line by line from the beginning of the table until the end of the main text area of ​​the page.

[0538] Step S303422: Determine whether the current row still belongs to the table range.

[0539] When disclosing a table, various missing items may occur in the table header or table content, resulting in different column numbers for different rows. For frameless tables, judging the table content solely based on the column number can easily lead to misjudgment of the table area. To avoid errors, it is necessary to combine relative position areas for judgment. The judgment criteria adopted in this embodiment include:

[0540] 1) The current row and column number is greater than or equal to the number of columns in the first row or greater than or equal to the number of columns in the previous row.

[0541] If the number of associated text objects in the current row is greater than or equal to the number of associated text objects in the first row of the table, or greater than or equal to the number of associated text objects in the row above this row, then this row is confirmed to be a table range, and the number of associated text objects in the current row is greater than 1.

[0542] 2) The current row and column count is greater than or equal to the minimum column count threshold.

[0543] If the number of associated text objects in the current row exceeds the minimum column count threshold, confirm that the current row is a table area.

[0544] 3) When the first column of the current row belongs to the first row and first column area of ​​the table.

[0545] If the absolute difference between the left boundary coordinates of the first text object in the current row and the left boundary coordinates of the first text object in the first row is less than a threshold, and the right boundary coordinate of the first text object is less than the left boundary coordinate of the second text object in the first row, then the current row can be considered a table area. The default threshold is 1.5 times the average character width of the text objects (considering the indentation scenario of the first column indicator), but it can also be adjusted according to business needs.

[0546] 4) The current row and first column area is located on the left side of the first row and first column of the table.

[0547] like Figure 19 As shown, if the right boundary coordinate of the first text object in the current row is less than the left boundary coordinate of the first text object in the first row of the table, it means that the first cell in the first row and first column of the table is empty, thus confirming that this row is a table area.

[0548] 5) The first column of the current row is located within any two consecutive columns of the first row of the table.

[0549] like Figure 20As shown, the first text object in the current row is taken as the first text object and compared one by one with the associated text objects in the first row of the table. If its left boundary coordinate is greater than or equal to the left boundary coordinate of the first row text object, the first row text object is taken as the second text object. If the right boundary coordinate of the first text object is greater than or equal to any text object on the right side of the same row as the second text object, and the first text object spans multiple columns of the table, then if the conditions are met, the current row is confirmed as the table area.

[0550] Step S303423: If the current row is confirmed to be a table area, add the relevant information of the standard row object to the table object row collection, and set the row attribute to table-default row.

[0551] Step S303424: If the conditions listed in step S303422 are not met after execution, the current row is considered the end row of the table.

[0552] like Figure 21 As shown, it can be determined that the table has ended. Therefore, the subsequent step S30343 is skipped, and the cross-page table process is not processed.

[0553] Step S30343: Obtain the ending page and ending row when the table spans multiple pages.

[0554] If the end row of the table area cannot be obtained after executing step S30342, set the next page of the current page as the current page, indicating that the table involves multiple pages. Set all standard rows in the text area after the first row of the table's starting page as the table's row. For table objects associated with multiple pages, it is necessary to locate the end page and end row of the table across pages, and mark duplicate table headers that appear across pages so that the cross-page tables can be merged in subsequent processing.

[0555] The specific implementation process of step S30343 is as follows:

[0556] Step S303431: Determine if a cross-table identifier exists.

[0557] Read the first line of the current page's main text area and obtain its corresponding text object content. Determine if a cross-table identifier exists based on the rule set. The rule set includes one or more regular expressions; if any rule is satisfied, a cross-table identifier is determined. For example, it may contain keywords such as "continued" or "continued table". If the first line contains a cross-table identifier, set the attribute of the standard row containing the cross-table identifier to "other" and confirm that the current table spans multiple pages.

[0558] Step S303432: Determine if there is duplicate header information when crossing pages.

[0559] When a table header is repeated across pages, the table header information will be displayed repeatedly on the next page. When processing tables that span pages, it is necessary to first determine whether there is duplicate header information. If so, it is assumed that a table that spans pages exists.

[0560] The first row of the first page of the table area is set as the first row of the first table. If step S303431 determines that a cross-table identifier exists, the second row of the current page's main text area is set as the first row of the second table. Otherwise, the first row of the current page's main text area is set as the first row of the second table. The text content of the first row of the first table and the first row of the second table are read separately, and their similarity is determined. If they are determined to be similar, the attribute of the first row of the first table is marked as a header row, and the attribute of the first row of the second table is marked as a duplicate header row. If they are determined to be dissimilar, it is assumed that there is no duplicate header, and the process ends.

[0561] If the first row of the first table is found to be similar to the first row of the second table, read the next row of both tables and determine if their text content is similar. If similar, set it as the header row and repeat the header row, respectively. Repeat the above operation until the two are no longer similar, or until the last row of the current page's main text area is reached. Record the number of repeating header rows in the current table, and the process ends.

[0562] If the number of duplicate header rows in the current table is greater than 0, proceed to step S303434.

[0563] Step S303433: Determine if the tables are the same across pages.

[0564] After executing steps 303431-303432, if the number of duplicate header rows in the current table is 0 and it is not confirmed that the current table has a cross-page table, it is necessary to determine whether the current table can be merged with the previous table.

[0565] Read the first row of the current page's text area and use it as the first row of the second table. Read the last row of the previous page's table area and use it as the last row of the first table. Obtain the corresponding text object counts for each. If the text object counts are the same, it confirms that the current table spans multiple pages. If the text object counts are different, iterate through each row of the first table to obtain the minimum and maximum text object counts for that table. If the text object count of the first row of the second table falls within the range of the text object counts of the first table, it confirms that the current table spans multiple pages. If neither of the above applies, it is assumed that there is no spanning table. Set the table's end page to the previous page and the end row to the last row of the first table, and the process ends.

[0566] Note: The above judgment of whether the current table spans multiple pages may be inaccurate. We will correct the error after accurately locating the table in subsequent processing.

[0567] Step S303434: After determining that there is a table spanning multiple pages, confirm the end page and end row.

[0568] After steps S303431-S303433, if it is confirmed that the current table spans multiple pages, then starting from the non-duplicate header row on the current page, repeat step S303422 to determine whether the current row is the table's ending row.

[0569] If the table's ending row is still not located, set the current page as the next page and repeat step S30343 until the ending row is confirmed. If the last page of the PDF is reached, or the difference between the current page and the table's starting page is equal to the maximum table page number threshold (the threshold is set to 9999 by default, with no limit), then set the current page as the table's ending page, and set the last line of the current page's text as the table's ending row.

[0570] Step S3035: Initiate the task and notify the operator to confirm the table area.

[0571] If the table location cannot be identified after executing steps S3031-S3034, the PDF may not disclose the corresponding table, or the recognition program may be unable to locate the table area due to recognition errors. If the table cannot be recognized in the configuration, manual processing will be initiated, and a task will be launched to notify business personnel to manually mark the table area.

[0572] Steps S304-S307 involve parsing the target table, such as... Figure 22 As shown, when parsing a table, the current page is parsed first. If the table spans multiple pages, each page within the table range is parsed first, and then it is determined whether the tables on different pages are the same table. If they are determined to be the same table, they need to be merged. The specific steps are as follows:

[0573] Step S304: Based on the area where the table is located as confirmed in S303, identify the text objects related to the table, and obtain the area coordinate information of the table's rows and columns through their coordinates and other information.

[0574] Steps S301-S303 confirm the table's start page, start row, end page, and end row. By traversing the table area's row object information and filtering out noise signals such as headers, footers, and duplicate column headers, all text object information is sorted from left to right and top to bottom. Each text object needs to be associated with a cell object in the table. For example... Figure 23 The diagram illustrates the relationship between table objects, table cell objects, and application page objects, row objects, text objects, and element objects.

[0575] The specific implementation process of step S304 is as follows:

[0576] Step S3041: Obtain the row containing the most columns in the table and confirm the default column width.

[0577] Iterate through the valid rows in the table (after removing duplicate headers and other invalid rows), and obtain the row object with the most columns, i.e., the row with the most associated text objects, as the maximum column count. If multiple row objects have the same number of columns, select the row object with the smaller y-coordinate. Create a new array of standard column objects based on the row object containing the maximum column count. Iterate through the text objects of the row object from left to right, and use the left and right boundary coordinates of the text objects as the default left and right boundary coordinates of the standard column objects. See the specific example below. Figure 24 .

[0578] Step S3042: Associate the table range text object with a standard column, such as... Figure 25 As shown, the specific steps include:

[0579] Step S30421: Read the text objects in the current page table area in sequence and use them as the first text object.

[0580] Step S30422: Iterate through the column objects by standard column to obtain the first standard column, and use the right column of the first standard column as the second standard column and the left column as the third standard column.

[0581] Step S30423: Based on the horizontal axis coordinate relationship between the first text object and the first standard column object, confirm whether the first text pair is associated with the first standard column object.

[0582] Scenario 1: The first text object is left-aligned with the first standard column.

[0583] like Figure 26 As shown, when the absolute difference between the left boundary coordinates of the first text object and the left boundary coordinates of the first standard column is less than or equal to a threshold, and the absolute difference between the right boundary coordinates of the first text object and the left boundary coordinates of the second standard column is less than or equal to a threshold, it can be confirmed that the association between the current first text object and the first standard column is left alignment. The threshold can be set to 3 pixels by default, or it can be adjusted according to the actual situation of different tables.

[0584] If the left boundary coordinate of the first standard column is greater than the left boundary coordinate of the first text object, then the left boundary coordinate of the first standard column is set to the left boundary coordinate of the first text object. If the left boundary coordinate of the first standard column is less than or equal to the right boundary coordinate of the second standard column, then the left boundary coordinate of the first standard column is set to the right boundary coordinate of the second standard column + 1.

[0585] If the right boundary coordinate of the first standard column is less than the right boundary coordinate of the first text object, then the right boundary coordinate of the first standard column is set to the right boundary coordinate of the first text object. If the right boundary coordinate of the first standard column is greater than or equal to the left boundary coordinate of the third standard column, then the right boundary coordinate of the first standard column is set to the left boundary coordinate of the third standard column - 1.

[0586] Scenario 2: The first text object is right-aligned with the first standard column.

[0587] like Figure 27 As shown, if the absolute difference between the left boundary coordinate of the first text object and the right boundary coordinate of the first column is less than or equal to the threshold, and the absolute difference between the left boundary coordinate of the first text object and the right boundary coordinate of the third standard column is less than or equal to the threshold, it can be confirmed that the association between the current first text object and the first standard column is right alignment.

[0588] If the right boundary coordinate of the first standard column is less than the right boundary coordinate of the first text object, then the right boundary coordinate of the first standard column is set to the right boundary coordinate of the first text object. If the right boundary coordinate of the first standard column is greater than or equal to the left boundary coordinate of the second standard column, then the right boundary coordinate of the first standard column is set to the left boundary coordinate of the second standard column - 1.

[0589] If the left boundary coordinate of the first standard column is greater than the left boundary coordinate of the first text object, then the left boundary coordinate of the first standard column is set to the left boundary coordinate of the first text object. If the left boundary coordinate of the first standard column is less than or equal to the right boundary coordinate of the third standard column, then the left boundary coordinate of the first standard column is set to the right boundary coordinate of the third standard column + 1.

[0590] Scenario 3: The central axis of the first text object is within the first standard column.

[0591] like Figure 28 As shown, if the absolute difference between the center x-coordinate (left boundary coordinate + right boundary coordinate / 2) of the first text object and the left boundary coordinate of the first standard column is less than the threshold, or the absolute difference between the center x-coordinate and the right boundary coordinate of the first standard column is less than the threshold, it can be confirmed that the current text object belongs to the first standard column.

[0592] If the left boundary coordinate of the first standard column is greater than the left boundary coordinate of the first text object, then the left boundary coordinate of the first standard column is set to the left boundary coordinate of the first text object. If the left boundary coordinate of the first standard column is less than or equal to the right boundary coordinate of the third standard column, then the left boundary coordinate of the first standard column is set to the right boundary coordinate of the third standard column + 1.

[0593] If the right boundary coordinate of the first standard column is less than the right boundary coordinate of the first text object, then the right boundary coordinate of the first standard column is set to the right boundary coordinate of the first text object. If the right boundary coordinate of the first standard column is greater than or equal to the left boundary coordinate of the second standard column, then the right boundary coordinate of the first standard column is set to the left boundary coordinate of the second standard column - 1.

[0594] Determine if the absolute difference between the x-coordinate of the center axis of the first object and the x-coordinate of the center axis of the first standard column is less than or equal to a threshold. If it is, the association basis is center alignment. If not, check if the absolute difference between the left boundary coordinate of the first text object and the left boundary coordinate of the first standard column is less than or equal to a threshold, and also if the absolute difference between the right boundary coordinate of the first text object and the right boundary coordinate of the first standard column is less than or equal to a threshold. If both conditions are met, the association basis is set to include text. If not, the association basis is set to include the center axis coordinate of the text.

[0595] If the first text object belongs to the first standard column, proceed to step S30425; otherwise, execute step S30424.

[0596] Step S30424: If the first text object does not belong to the first standard column, take the next standard column as the first standard column, jump to step S30422 and repeat the operation until the last standard column object.

[0597] Step S30425: Take the next object in the table text area of ​​this page as the first object, jump to step S30421, and continue until the last object of this page.

[0598] To further explain, the above algorithm establishes standard column objects based on the coordinates of the text objects belonging to the table. By observing the overlap between the standard columns and the text objects, the width of the standard columns and the coordinates of the blank areas between them are initially determined. This algorithm has high accuracy for standard multi-row, multi-column wireless tables. However, it is prone to recognition errors for complex tables such as tables with missing items (some rows or columns lack text objects), irregular tables (multiple rows or columns of merged cells), and non-standard tables (text from different columns overlaps in different rows). To improve recognition accuracy, step S3043 optimizes the algorithm for non-standard tables. Currently, the operation only processes text objects belonging to a single column; text objects spanning multiple columns will be handled in later steps.

[0599] Step S3043: Adjust the coordinates of the standard column based on the position difference between the text object and the standard column.

[0600] After step S3042, the coordinates of some text objects belonging to the standard columns may overlap with those of other columns, or some text objects may be entirely or partially outside the standard column area. For example... Figure 29 As shown, by optimizing the column width of the standard column in step S3042, more accurate column width coordinates of the standard column are obtained.

[0601] like Figure 29 As shown, the specific implementation process of step S3043 includes the following steps:

[0602] Step S30431: Process text objects outside the left boundary of the standard column.

[0603] likeFigure 30 As shown, iterate through all text objects to find the set of text objects whose right boundary coordinates are less than the left boundary coordinate of the first column of the standard column. Then, obtain the minimum left boundary coordinate and the maximum right boundary coordinate of all text objects associated with the first column of the standard column.

[0604] The text object outside the left margin of the table is designated as the first text object, and the text object associated with the first standard column in the same row is designated as the second text object.

[0605] If the absolute difference between the right boundary coordinate of the first text object and the minimum left boundary coordinate of the first column text is greater than the threshold, then a new first column object is added, with its left boundary coordinate being the left boundary coordinate of the first text object and its right boundary coordinate being the original left coordinate of the first column - 1. Then proceed to step S3042 to update the standard column information again.

[0606] If a second text object exists and cannot be merged with the first text object based on its position, a new first column object is added. Its left boundary coordinates are the same as the left boundary coordinates of the first text object, and its right boundary coordinates are the same as the left boundary coordinates of the previous first column object minus 1. Then, proceed to step S3042 to update the standard column information. The rules for determining whether the first and second text objects can be merged include whether they have the same format (font, font size, etc.), whether the horizontal coordinate interval of the text area is less than a threshold, and whether the text content characteristics are consistent (e.g., both are numbers). The default interval threshold is set to 1 times the average character width of the first and second text objects, but this can be adjusted according to the actual situation of different tables.

[0607] If a second text object exists and can be merged with the first text object based on its position, then the first text object is also associated with the standard first column, and the left boundary coordinates of the standard first column are updated to the left boundary coordinates of the first text object.

[0608] If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object already associated with the standard first column is less than a threshold, then a new first column object is added. The left boundary coordinate is the left boundary coordinate of the first text object, and the right boundary coordinate is the original left boundary coordinate of the first column minus 1. Proceed to step S3042 to update the standard column information again. The area overlap rate can be set to 70% by default, or it can be adjusted according to the actual situation of different tables.

[0609] If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object associated with the standard first column is greater than the threshold, the first text object is associated with the standard first column, and the left boundary coordinate of the standard first column is set as the left boundary coordinate of the first text object.

[0610] The next text object outside the left boundary of the table is taken as the first text object, and the process continues until there are no more text objects outside the left boundary of the table.

[0611] Step S30432: Process text objects outside the right boundary of the standard column.

[0612] like Figure 31 As shown, iterate through all text objects to find the set of text objects whose left boundary coordinates are greater than the right boundary coordinates of the last column of the standard column. Then, obtain the minimum left boundary coordinate and the maximum right boundary coordinate of all text objects associated with the last column of the standard column.

[0613] The text object outside the right boundary of the table is designated as the first text object, and the text object associated with the last standard column in the same row is designated as the second text object.

[0614] If the absolute difference between the left boundary coordinate of the first text object and the maximum right boundary coordinate of the last text object is greater than the threshold, then a new last text object is added, with its left boundary coordinate being the right boundary coordinate of the last text object plus 1, and its right boundary coordinate being the right boundary coordinate of the first text object. Then proceed to step S3042 to update the standard column information again.

[0615] If the second text object exists and it cannot be merged with the first text object based on its position, then a new last column object is added. The left boundary coordinate is the right boundary coordinate of the last column + 1, and the right boundary coordinate is the right boundary coordinate of the first text object. Proceed to step S3042 to update the standard column information again.

[0616] If a second text object exists and can be merged with the first text object based on its position, then the first text object is also associated with the standard last column, and the right boundary coordinates of the standard last column are updated to the right boundary coordinates of the first text object.

[0617] If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the associated text object in the last column of the standard is less than the threshold, then a new last column object is added. The left boundary coordinate of the new last column object is the right boundary coordinate of the last column + 1, and the right boundary coordinate is the right boundary coordinate of the first text object. Proceed to step S3042 to update the standard column information again.

[0618] If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object associated with the first standard column is greater than the threshold, the first text object will be associated with the last standard column, and the right boundary coordinate of the last standard column will be set as the right boundary coordinate of the first text object.

[0619] The next text object outside the right boundary of the table is taken as the first text object, and the process continues until there are no more text objects outside the right boundary of the table.

[0620] Step S30433: Process the gap between two adjacent columns to determine whether a new column needs to be added, including the following steps:

[0621] Step S304331: Take the first standard column as the first column and the standard column closest to the right of the first standard column as the second column.

[0622] Step S304332: Merge the blank areas between adjacent columns into the first column.

[0623] If the difference between the left boundary coordinate of the second column and the right boundary coordinate of the first column is less than the minimum column width threshold, the third column is merged into the first column; that is, the right boundary coordinate of the first column is set as the right boundary coordinate of the third column, and the process jumps to step S304334. If the difference is greater than the minimum column width threshold, a new virtual column is created as the third column. The left boundary coordinate of the third column is the right boundary coordinate of the first column + 1, and the right boundary coordinate is the left boundary coordinate of the second column - 1. The minimum column width threshold can be set by default to the smaller value between the average character width of the first column * 2 and the minimum column width of all standard columns, or it can be modified according to the actual situation of different tables.

[0624] Obtain the text object coverage areas of the first and second columns respectively, and use them as the first and second column text areas. The text area is obtained by traversing all text objects associated with the column, obtaining the entire area covered by the text content. Traverse the table text objects not associated with standard columns, and add text objects whose center x-coordinate is located in the third column area, and whose left boundary coordinate is greater than the right boundary coordinate of the first column, and whose right boundary coordinate is less than the left boundary coordinate of the second column, to the third column text object array. If there are no text objects in the third column, merge the third column into the first column, that is, set the right boundary coordinate of the first column to the right boundary coordinate of the third column, and jump to step S304334.

[0625] Step S304333: Determine whether a new standard column object needs to be added.

[0626] Based on the text regions in each column, determine whether to add the virtual column as a new standard column. Iterate through the array of text objects in the third column and take the first text object as the current text object.

[0627] Scenario 1: The text object belongs entirely to the virtual column x-axis area.

[0628] like Figure 32 As shown, if the current text object is entirely located within the virtual column area, and the sum of the overlap rates between its x-coordinate and the x-coordinates of the first and second text areas is less than a threshold, the third column needs to be added as a standard column object. Proceed to S3042 to update the standard column information. The default minimum overlap rate threshold is 30%, but it can be adjusted according to the actual situation.

[0629] Scenario 2: The center x-coordinate of the text object is located in the third column area and intersects with at least one adjacent column.

[0630] like Figure 33As shown, if the horizontal coordinate of the current text object's center is within the third column area, and the sum of the horizontal coordinates of the first and second column text areas is less than a threshold, the third column needs to be added as a standard column object. Proceed to step S3042 to update the standard column information.

[0631] If the above conditions are not met, take the next text object in the third column of the text object array as the current text object, and repeat step S304332 until the last text object in the array.

[0632] Step S304334: Merge the third column into the standard column.

[0633] like Figure 34 As shown, after traversing step S304333, the third column of text objects array is obtained again, and the third column of text area is obtained based on the text objects in the array.

[0634] Obtain the overlap rate between the third text region and the first and second text regions. Take the larger of the two overlap rates; if it exceeds the minimum merge overlap rate threshold, merge the third column into the standard column with the larger overlap rate. Proceed to step S3042 to update the standard column information. The default minimum merge overlap rate threshold can be set to 50%, but it can be adjusted according to the actual situation. Proceed to step S3042 to update the standard column information.

[0635] Step S304335: Process unassociated text objects in the third column area

[0636] After processing steps S304331 to S304334, if a third column region still exists, obtain a new array of text objects for the third column. If the number of text objects in the array is greater than or equal to 1, use the first text object in the array as the third text.

[0637] The first text is the text object associated with the first column in the same row as the third text, and the second text object is the text object associated with the second column. If neither the first nor the second text exists, and if the overlap rate between the third text and both the first and second column text areas is greater than the minimum overlap threshold, the third text is considered a cross-column text and is associated with both the first and second columns; otherwise, the third text is associated with the column with the larger overlap area. The minimum overlap threshold is set to 20% by default and can be adjusted according to actual needs. If only one of the first or second text exists, the third text is associated with the column not associated with any text object.

[0638] The next object in the third column of the text object array is treated as the third text, and the above process continues until the last object in the array. The number of associations between the third column of the text object array and the first and second columns is counted, and the third column is merged into the column with the higher number of associations. If the number of associations is the same, it is merged into the first column by default.

[0639] Step S304336: Traverse the adjacent columns after processing.

[0640] Set the second column as the first column, set the rightmost standard column object closest to the second column as the second column, and jump to step S304332 to continue processing until the second column is the rightmost standard column.

[0641] Step S30434: Adjust the x-coordinates of adjacent columns, specifically including the following steps.

[0642] Step S304341: Use the first standard column as the first column and the second standard column as the second column.

[0643] Step S304342: Obtain the text object coverage areas of the first and second columns respectively, as the first column text area and the second column text area. The text area is obtained by traversing all text objects associated with the column to obtain the entire area covered by the text content. Obtain the overlapping part of the first and second text areas, which is the third text area. Obtain the column overlap rate, which is the width of the third text area / the width of the first text area * 100%.

[0644] Scenario 1: If the column overlap rate is greater than the threshold, merge the first column and the second column.

[0645] If the column overlap rate exceeds the overlap threshold, it is necessary to determine whether the two columns can be merged. The overlap threshold is set to 70% by default, but can be adjusted according to the actual situation. To determine whether two columns can be merged, read the associated text of the first column and the associated text of the second column row by row. If neither column in the current row is associated with a text object, they can be merged. If both are associated with text objects, they cannot be merged. If the number of rows that cannot be merged is less than the threshold, merge the first column and the second column, and proceed to step S3042 to update the standard column information again. The threshold for the number of rows that cannot be merged is set to 1 by default, but can also be adjusted according to the actual situation.

[0646] Scenario 2: Columns that cannot be merged; adjust column width to optimal.

[0647] like Figure 35 As shown, the third text region N is divided into equal parts, and virtual column separators and associated result arrays are established. Based on each virtual column separator, the column widths of the first and second columns are adjusted. In step S3042, the sum of the number of associated text objects is calculated and stored in the associated result array. The virtual separator representing the number of associated text objects is selected as the new column boundary. After processing, the process proceeds to step S3042 to update the standard column information.

[0648] Scenario 3: The first and second columns do not overlap.

[0649] When the right boundary coordinate of the first column is greater than the left boundary coordinate of the second column, there is no overlap between the two columns, and no processing is required.

[0650] Step S304343: Traverse the processed adjacent columns

[0651] Set the second column as the first column, set the rightmost standard column object closest to the second column as the second column, and jump to step S304342 to continue processing until the second column is the rightmost standard column.

[0652] Through the above processing, the standard row and column coordinates of the table can be finally confirmed, dividing the entire table into standard blocks of N rows * M columns. New cell objects are created, each covering one or more blocks. By associating cell objects with row and text objects, PDF-related element objects can be converted into structured table information without loss of quality.

[0653] To further explain, for borderless tables, the lack of horizontal and vertical lines makes accurate positioning of the table area a challenge. Furthermore, for complex tables, issues such as missing headers, inconsistent alignment of cell content, and missing columns in different rows can easily lead to recognition errors, especially with non-standard tables (where adjacent columns overlap in different rows). To improve accuracy, this processing step determines whether to add columns based on the text objects in the blank areas between columns, correcting the missing column issue in step S3042 caused by missing columns in different rows. Additionally, for non-standard tables where adjacent columns overlap in different rows, the column overlap problem caused by non-standard table layout is resolved by optimizing the coordinates of the column separators. The recognition and processing of special format tables with multiple merged columns will be performed in step S305.

[0654] Step S305: Based on the row and column area information of the table confirmed in step S304, confirm the row and column information of the valid cell objects in the table, and obtain one or more text objects related to the cell objects.

[0655] like Figure 35 As shown, the specific implementation process of step S305 is as follows: Figure 35 As shown:

[0656] Step S3051: Create a table cell object, which specifically includes the following steps:

[0657] Step S30511: Obtain the array of text objects in the table that are associated with the standard columns, and create an array of cell objects.

[0658] Step S30512: Take the first text object as the second text, create a second cell object, associate the second text with the cell object, and add it to the cell array.

[0659] Step S30513: Add the second text to the cell object.

[0660] Create a new cell object as the second cell and associate the second text with it. Read the cell object array and use the obtained cell object as the first cell. Determine if the first and second cells have overlapping table areas. If they overlap, determine if they can be merged based on the text object information associated with the second cell. If they can be merged, merge the text content of the first and second cells, associate the second text with the first cell, and update the row and column information of the first cell object based on the coordinate area of ​​the merged text object. If they cannot be merged, change the status of the second cell to 1: Pending Confirmation - Duplicate Text, and add the second cell to the cell object array. Change the status of the first cell from 0: Normal to 1: Pending Confirmation - Duplicate Text. Record in the table object that both the first and second cells are set as the Pending Confirmation cell identifier.

[0661] If there is no table area overlap, read the next cell from the cell object array as the first cell, and check if there is table area overlap again, until the last cell of the array. If there is no table area overlap, add the second cell to the cell object array.

[0662] Step S30514: Take the next text in the text object array as the second text, and repeat steps S30511 to S30513 until the last text object in the text object array.

[0663] Step S3052: Process unassociable text objects, specifically including the following steps:

[0664] Step S30521: Obtain an array of text objects in the table that are not associated with standard columns.

[0665] Take the first text object as the second text, and obtain the standard row area and standard column area it covers based on the coordinate area of ​​the second text.

[0666] Step S30522: Process according to the position of the second text and the standard column.

[0667] Scenario 1: The text object does not belong to the table object.

[0668] If no other text objects exist within the same standard row area as the second text, or if no other text objects are associated with a standard column, then it is necessary to further determine whether any text objects are associated with a standard column within the next N rows. The default value for N rows is 3, but this can be adjusted according to the actual situation. If none are found, then it is confirmed that this row does not belong to a table object. Set the end page and end row of the table to the row above the first row of the second text, and delete all row objects in the cell array that are greater than or equal to the first row of the second text. The processing is then complete.

[0669] Scenario 2: Text object area spans multiple columns

[0670] like Figure 36 As shown, the second text spans multiple columns. If the left and right boundary coordinates of the second text lie in different standard column areas on the horizontal axis, then the text object is considered to span multiple columns. Text objects spanning multiple columns mainly exist in table headers; in complex tables, table content cells spanning multiple rows or columns may also appear. A virtual column is created as the third column, merging the multiple standard columns covered by the second text area into the third column. Following step S3042, the positions of the second text and the third column are compared to obtain the association method of the second text aligning with the third column. A new second cell is created, associated with the second text, and the relevant column and row information covered by the second text is written.

[0671] The second cell is compared with existing cells in the cell array to determine if there is any overlap between standard row and standard column areas. If overlap exists, the status of the second cell is set to bit 2: Pending Confirmation - Area Overlap, and the status of all cells involving the overlapping area is set to: 2: Pending Confirmation - Area Overlap. The identifier of the cell to be confirmed is recorded in the table object. If no area overlap exists, the second cell is added to the cell array.

[0672] Step S30523: Take the next text object in the text object array as the second text, and execute steps S30521 to S30522 until the last text object.

[0673] Step S30524: If there are one or more cells to be confirmed in the table that cannot be automatically converted, a task will be generated for manual confirmation of the cell content.

[0674] Step S306: If it is determined that the table involves multiple pages, merge one or more cross-page tables, such as... Figure 38 As shown, the specific steps include:

[0675] Step S3061: Read the first table

[0676] According to steps S304-S305, the information of the first page area of ​​the table is converted into the first table object. If there is no cross-page, or if it is confirmed during processing that the table ends on this page, the processing ends.

[0677] Step S3062: Obtain the next page corresponding to the table, and read it into the second table according to steps S304-S305.

[0678] Step S3063: Determine whether the first table and the second table belong to the same table, which further includes the following steps:

[0679] Step S30631: Duplicate headers exist, indicating the same table exists.

[0680] If a duplicate header is identified in step S303, confirm that the first table and the second table are the same table, delete all cells corresponding to the duplicate header in the second table, and jump to step S3065.

[0681] Step S30632: Determine based on the standard column count of the second table and the first table.

[0682] The second table has a different number of standard columns than the first table, so they are not the same table. Proceed to step S3065.

[0683] Step S30633: Determine based on the coverage area of ​​the standard columns in the second table and the first table.

[0684] Read the standard columns of the second table sequentially. If the horizontal coordinate area of ​​the column exceeds the nearest left and right column areas of the corresponding column in the first table, that is, exceeds the two adjacent columns of the first table, then the two columns are considered to be different columns. Confirm that they are not the same table and jump to step S3065.

[0685] If it does not exceed the nearest left and right column areas of the corresponding column in the first table, obtain the area covered by it and the corresponding column in the first table, and check if its percentage is less than a threshold. The threshold is set to 70% by default. The covered area is as follows: Figure 38 As shown in the dark area, if the coverage area ratio is less than the threshold, it is considered that the two are not in the same column. If it is confirmed that they are not in the same table, jump to step S3064, where the coverage area ratio = (right boundary coordinates of the coverage area - left boundary coordinates of the coverage area) * 100 / (right boundary coordinates of column N of the second table - left boundary coordinates of column N of the second table).

[0686] If the columns are determined to be in the same column, read the next standard column of the second table sequentially until the last column, then end the processing.

[0687] The detailed calculation formula is as follows:

[0688] If the left boundary coordinate of column N in the second table is greater than or equal to the right boundary coordinate of column N-1 in the first table, then: the left boundary coordinate of the covered area = the right boundary coordinate of column N-1 in the first table + 1; otherwise: the left boundary coordinate of the covered area = the left boundary coordinate of column N in the second table.

[0689] If the right boundary coordinate of column N in the second table is less than or equal to the left boundary coordinate of column N+1 in the first table, then: the right boundary coordinate of the covered area = the left boundary coordinate of column N+1 in the first table - 1; otherwise: the left boundary coordinate of the covered area = the right boundary coordinate of column N in the second table.

[0690] Step S30634: Determine based on the standard column coverage area of ​​the first table object and the second table object.

[0691] Traverse the standard columns of the first table and compare them with the corresponding column areas of the second table. The judgment logic is the same as in step S30633. If it is determined that they are not the same column, confirm that they are not the same table, and jump to step S3064.

[0692] Step S30635: Determine the text content characteristics of the columns in the first and second tables.

[0693] This function retrieves the column attributes of each column in both the first and second tables. After filtering the header rows, the function reads the text content associated with each cell in the column in row order and determines if the column has a specific characteristic based on the content. For example, if most cells are in date format, the column attribute is confirmed to be date type. Common column attributes include character, numeric, integer, date, company name, person name, etc. When calculating column attributes, items spanning multiple columns are excluded to avoid errors.

[0694] Iterate through each column of the second table to determine if the current column attribute is compatible with the corresponding column attribute of the first table. If they are not compatible, they are considered to be different columns, confirming that they are not the same table, and then proceed to step S3064.

[0695] Step S30636: If none of the above applies, it can be determined that the two tables need to be merged, and the process jumps to step S3065.

[0696] Step S3064: If the tables are not the same, no merging is required.

[0697] Update the first table object, keeping the table's end page unchanged, and move the table's end row to the last line of the main text on the previous page. Processing complete.

[0698] Step S3065: Merge the second table object into the first table object

[0699] Append the information from the second table to the first table. (Delete the cells corresponding to duplicate table headers)

[0700] Based on the standard column information in the first table, perform steps S304-S305 to reconstruct the data.

[0701] If the table is not yet finished, the updated table is used as the first table, the next page of the table area is read as the second table, and the process jumps to step S3061 until the final page of the table area is reached or the current page of the table is confirmed to be finished.

[0702] Step S307: If manual intervention is required during the processing of steps S301-S306, a task is generated to notify human intervention for review or correction.

[0703] During steps S01-S06, due to the lack of clear dividing lines in the wireless table, special scenarios such as layout errors may occur, resulting in the same cell area being associated with multiple text objects, or overlapping cell areas of different text objects. In such cases, the table will be marked as requiring manual processing, and a corresponding task will be generated. When relevant personnel enter the editing interface, the PDF file and the relevant table areas, along with the automatically converted table, will be displayed simultaneously, with problematic table cells highlighted in red. Personnel can select a specific text object as cell content or edit the cell manually, entering new content.

[0704] The conversion of the annual consolidated financial statements of Hong Kong listed companies is achieved through steps S304-S306. See details for the results. Figure 39 As shown, this method achieves lossless restoration of tables within PDF files without relying on table borders or element object information. It converts tables in a PDF file into structured table information without configuration or training. The table information includes table object information, column object information, and cell object information, and can be associated with text objects, row objects, page objects, and PDF element objects obtained from PDF file parsing, achieving complete restoration of all information belonging to the table. Based on the converted structured table information, various output formats can be achieved, including JSON files, Excel files, data tables, and HTML files.

[0705] The above algorithm fully supports table formats such as borderless tables, partially bordered tables, and fully bordered tables. It also supports complex table formats, such as tables with multiple header rows, merged cells, missing cells, tables spanning multiple pages, and misaligned columns. Without any configuration, it can completely restore the table content. In addition to adding table borders, restoring cell content, it can also restore the cell display position (left-aligned / center-aligned / right-aligned / unordered), special display information such as font and font size, and complete information such as superscript and subscript. It can also locate the element objects in the original PDF file.

[0706] For wireless tables with layout errors, such as misaligned columns, the system can accurately identify the affected area and provide detailed information such as the position of elements in the original PDF file, making it easier for business personnel to handle and correct these special cases.

[0707] Throughout the processing, it primarily relies on the structured file of the main object storage after PDF parsing, without the need for complex image conversion and recognition processing, nor does it require reading the PDF source file. It can achieve parallel processing of different tables in the same PDF file. Compared with mainstream machine learning algorithms, it has the advantages of high accuracy, no need for training and configuration, fast processing speed, and low resource consumption.

Claims

1. A method for accurate recognition of borderless tables based on a positioning algorithm, characterized in that, Includes the following steps: Step 1: Obtain the PDF source file to be processed; Step 2: Obtain the page objects and their structured information from the PDF source file, and generate one or more tables in the PDF file that need to be parsed according to the configuration. This includes the following steps: Step 201: Read dictionary information from the PDF file and create a page object. The page object includes a page identifier and a page area. In addition to the coordinate information of the rectangular area of ​​this page, the page area also includes the upper and lower boundary information of the vertical coordinate of this page relative to the entire PDF file. Step 202: Based on the page object, create element objects by collecting all the information of the PDF constituent objects for each page of the current page. The element objects include general attributes as well as unique attributes for different types of objects. Step 203: Initially merge the character object collection in the element object collection according to the paragraph identifier to create a text object collection, and merge the character objects of the same paragraph into a text object in the text object collection; Step 204: Obtain the corresponding text line information based on the vertical coordinate position of the text object, and divide the current page into multiple standard line areas. Each standard line area only records the start and end positions of the vertical coordinate of the line, and there is no overlap between the standard line areas. Each standard line area is a standard line object, and all text objects can be associated with the standard line object. Step 205: Associate standard line objects with text objects. Multiple text objects can be associated within the same standard line, and multiple standard line objects can be associated with the same text object. Step 206: Reorder and update the application objects to which the current page belongs. The application objects include page objects, standard line objects, and text objects. Step 207: Traverse all pages of the PDF file and save the application object page by page; Step 208: Identify the valid area of ​​the page, including the following steps: Step 2081: Identify the number of rows in the header area, which includes the following steps: Step 20811: Traverse all pages, read all text objects in the first line of each page, merge the text content corresponding to the text objects to obtain the text content of the first line, and identify the integer objects present in the first line of text. Step 20812: Count the number of pages with similar first lines across all pages. If the proportion of similar pages to the total number of pages is greater than the threshold, then the first line can be confirmed as the header area. Step 20813: Process the next line of text after the first line of text, and determine whether it belongs to the header area. Continue until the last line of the page is reached or the number of lines belonging to the header area is greater than the threshold. Then the processing ends and the number of lines in the header area of ​​each page is obtained. If the number of lines in the header area is greater than 0, the typical header identifier after merging all lines of text content in the header is obtained. If the number of lines in the header area is 0, then there is no header area. Step 2082: Identify the row number in the footer area, which includes the following steps: Step 20821: Traverse all pages, read all text objects in the last line of each page, merge the text content corresponding to the text objects to obtain the last line of text content, and identify the integer objects present in the last line of text. Step 20822: Count the number of pages similar to the last row of the page. If the proportion of the last row to all pages is greater than the threshold, then the last row can be confirmed as the footer area. Step 20824: Process the text above the last line of text and determine whether it belongs to the footer area. Continue until the first line of the page is reached or the number of lines belonging to the footer area is greater than the threshold. Then the processing ends and the number of lines in the footer area of ​​each page is obtained. If the number of lines in the footer area is greater than 0, the typical footer identifier after merging all the text content of the footer is obtained. If the number of lines in the footer area is 0, then there is no footer area. Step 2083: Identify the attributes of each line on the current page, including header / footer / body text; Step 209: Generate the table processing task for the PDF; Step 3: Obtain the table configuration from the list of pending table tasks generated in Step 2, and locate the table area according to the configuration. This includes the following steps: Step 301: Obtain the tasks to be processed from the task list in the pending table; Step 302: Configure table area feature information, configure table start position features, and locate the start page and start row of the table to be processed; Step 303: Locate the initial position of the table area, which includes the following steps: Step 3031, locating the row object at the beginning of the table area, further includes the following steps: Step 30311: Starting from the homepage, traverse the text content corresponding to the line object line by line to obtain the text content of the current standard line. During reading, only all lines in the main text area are processed. Step 30312: Read the tag type to be converted from the configuration. In the standard line text content, based on the characteristics of the tag type, confirm whether there is a tag entity and its specific location. If there is a tag entity, replace the corresponding entity with the tag identifier. Step 30313: Determine if the current row is the first row of the table's starting area: If the text content of the current line after processing meets the configured starting position rules, then the current line is the first row of the table's starting area, and processing ends; If the text content of the current line does not meet the configured starting position rule after processing, the next line of the current page will be taken as the current line and the judgment will continue. If the last line of the main text area of ​​the current page is reached, the first line of the main text area of ​​the next page will be taken as the current line and the process will jump to step 30312 to continue processing. If the current page is the last line of the last main text page and the configured starting position rule still cannot be met, then the table area cannot be located and proceed to step 3032; otherwise, proceed to step 3034. Step 3032: Locate the text object at the beginning of the table area and confirm the current starting row. This includes the following steps: Step 30321: Starting from the homepage, traverse the text object content, processing only the text objects in the main text area; Step 30322: Read the tag type to be converted from the configuration. In the standard line text content, based on the characteristics of the tag type, confirm whether there is a tag entity and its specific location. If there is a tag entity, replace the corresponding entity with the tag identifier. Step 30323: When the text content meets the configured starting position rules, confirm the starting line: If the text content of the current text object meets the configured starting position rules after processing, it can be confirmed that the starting position of the table is included in the row where the text object is located; then, based on the specific character position of the text content that meets the configuration rules, the corresponding standard row object is obtained and confirmed as the starting row; If the current text object does not match the configured starting position rule, the next text object will be processed until the last text object in the body area. Step 30324: If the starting position of the table area is not found on the current page, repeat step 30321 starting from the first text object in the main text area of ​​the next page; If the location cannot be located after traversing all pages, proceed to step 3033 to handle the location failure case; otherwise, proceed to step 3034. Step 3033: Return to the table range that could not be found; Step 304: Confirm the coordinates of the table area, which includes the following steps: Step 3041: Locate the first page and first row of the table; Step 3042: Determine whether the starting page of the table includes the ending row, including the following steps: Step 30421: Read each row from the beginning of the table until the last row of the main text area of ​​the page; Step 30422: Determine if the current row still belongs to the table range: 1) If the number of associated text objects in the current row is greater than or equal to the number of associated text objects in the first row of the table, or greater than or equal to the number of associated text objects in the row above the current row, then the current row is confirmed as a table range, and the number of associated text objects in the current row is greater than 1. 2) If the number of associated text objects in the current row exceeds the minimum column count threshold, confirm that the current row is a table area; 3) When the first column of the current row belongs to the first row and first column area of ​​the table: If the absolute difference between the left boundary coordinates of the first text object in the current row and the left boundary coordinates of the first text object in the first row is less than a threshold, and the right boundary coordinates of the first text object are less than the left boundary coordinates of the second text object in the first row, then the current row can be confirmed as a table area. 4) When the first column of the current row is to the left of the first column of the first row of the table: If the right boundary coordinate of the first text object in the current row is less than the left boundary coordinate of the first text object in the first row of the table, it means that the first cell in the first row and first column of the table is empty, and the current row is confirmed to be a table area. 5) When the first column of the current row is located within any two consecutive columns of the first row of the table: The first text object in the current row is taken as the first text object, and compared with the associated text objects in the first row of the table one by one: if its left boundary coordinate is greater than or equal to the left boundary coordinate of the first row text object, the first row text object is taken as the second text object; if the right boundary coordinate of the first text object is greater than or equal to any text object on the right side of the same row as the second text object, and the first text object spans multiple columns of the table, if the conditions are met, then the current row is confirmed as the table area. Step 30423: If the current row is confirmed to be a table range, add the relevant information of the standard row object to the table object row collection, and set the row attribute to table-default row; If the conditions listed in step 30422 are not met after execution, the current row is considered to be the end row of the table, and the subsequent step 3043 is skipped, and the cross-page table process is not processed. Step 3043: Obtain the ending page and ending row when the table spans multiple pages, including the following steps: Step 30431: Determine if a cross-table identifier exists. Read the first line of the current page's main text area and obtain its corresponding text object content. Determine whether it contains a cross-table identifier based on the rule set. If the first line contains a cross-table identifier, set the attribute of the standard row containing the cross-table identifier to "other" and confirm that the current table has a cross-page situation. Step 30432: Determine if there is duplicate header information when crossing pages. If so, it is assumed that a cross-page table exists. The first row of the first page of the table area is used as the first row of the first table. If a cross-table identifier is found, the second row of the current page's main text area is set as the first row of the second table; otherwise, the first row of the current page's main text area is set as the first row of the second table. The text content of the first row of the first table and the first row of the second table are read separately, and their similarity is judged: if they are judged to be similar, the attribute of the first row of the first table is marked as a header row, and the attribute of the first row of the second table is marked as a duplicate header row; if they are judged not to be similar, it is considered that there is no duplicate header, and the processing ends. If the number of duplicate header rows in the current table is greater than 0, proceed to step 30434; otherwise, proceed to step 30433. Step 30433: Determine if the tables are the same across pages: Read the first row of the current page's main text area and use it as the first row of the second table; read the last row of the previous page's table area and use it as the last row of the first table; obtain the number of text objects corresponding to the first row of the second table and the last row of the first table respectively: if the number of text objects is the same, it is confirmed that the current table has a cross-page table; if the number of text objects is different, iterate through each row of the first table to obtain the minimum and maximum number of text objects corresponding to the table; if the number of text objects in the first row of the second table is within the range of the number of text objects in the first table, it is confirmed that the current table has a cross-page table; if none of the above are true, it is considered that there is no cross-page table, the table's end page is set to the previous page of the current page, the end row is set to the last row of the first table, and the processing ends; Step 30434: After determining that a table spanning multiple pages exists, confirm the cutoff page and cutoff row: Starting from the non-repeating header row on the current page, repeat step 30422 to determine if the current row is the table's ending row; if the table's ending row still cannot be located, set the current page as the next page and repeat step 3043 until the ending row is confirmed; if the last page is reached or the difference between the current page and the table's starting page is equal to the maximum table page number threshold, then set the current page as the table's ending page and set the last row of the current page's text as the table's ending row; Step 4: Based on the table area confirmed in Step 3, identify the text objects related to the table and obtain the coordinate information of the row and column areas of the table, thereby dividing the entire table into standard blocks of N rows * M columns; then create new cell objects, each cell object covering one or more blocks, and through the association between cell objects, row objects and text objects, convert PDF related element objects into table structured information without loss. Step 5: Based on the row and column area information of the table confirmed in Step 4, confirm the row and column information of the valid cell objects in the table, and obtain one or more text objects related to the cell objects.

2. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, Step 203 includes the following steps: Step 2031: Obtain the collection of character objects for each page and sort them, specifically including the following steps: Step 20311: Traverse all PDF element objects on the current page and obtain the collection of all character objects within them; Step 20312: Sort the collection of character objects according to their position coordinates. The sorting rule is to sort them from left to right and from top to bottom according to the points in the character object area. Step 2032: Merge character objects from the same paragraph into a text object, specifically including the following steps: Step 20321: Create a text collection, which includes text identifiers and character identifiers and the criteria for merging them. One text identifier can be associated with multiple character identifiers. Step 20322: Read the first character object. If the current text collection is empty, add the identifier corresponding to the first character object to the current text collection. Step 20323: Read the next character object of the first character object and use it as the second character object; Step 20324: Determine if the second character object is the same paragraph as the current text collection. When the second character is a character without specific meaning, it belongs to the current paragraph, and the second character object is added to the current text collection; When the second character is a delimiter character, the segmentation rules based on the delimiter character are used to determine whether the segments are the same. Specific rules include: Rule 1) When the second character is a newline character, the next character is a newline character; add the second character object to the current text collection, create a new text collection, update the next character object of the second character object to the first character object, and repeat step 20322. Rule 2) When the second character is a space, further determine whether the current text set consists entirely of English words and their last character is not a space: if so, confirm that the second character object belongs to the current paragraph and add it to the current text set; if not, jump to step 20325. If the second character is a normal character, proceed to step 20325; Step 20325: Determine if the second character object is the same as the current text collection (paragraph): 1) Determine whether the second character object and the first character object belong to the same paragraph based on their font and font size. If they are not the same paragraph, create a new text collection, update the second character object to the first character object, and repeat step 20322 until all character objects on the page are traversed and a text object collection is created. 2) Determine whether the second character object and the first character object belong to the same paragraph based on their positions. If they are not in the same paragraph, create a new text collection, update the second character object to the first character object, and repeat step 20322 until all character objects on the page are traversed and a text object collection is created. 3) When the second character object and the first character object are close in distance, they can be identified as the same paragraph. Add the second character object to the current text collection, read the next character object of the second character object and use it as the first character object. Repeat step 20322 until all character objects on the page are traversed and a text object collection is created.

3. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 2, characterized in that, In step 20324, the method for determining whether the current text set consists entirely of English words is as follows: traverse all character objects in the current text set, concatenate their contents, and if they all fall within the range of English words + numbers + punctuation marks, then they are considered to be English words.

4. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, After obtaining the text object set through step 203, for each text object in the text object set, the annotation character objects in the text object are identified by the difference between the annotation and the main text position, and the main text and the annotations above and below in the same paragraph are merged into the same text object. Specifically, this includes the following steps: Step A1: Read the first text object, obtain its last character object as the first character object, and then read the second text object sequentially; Step A2: Based on the relative position of the second text object and the first text object, determine whether the second text object is a superscript or subscript: If the absolute difference between the lower boundary coordinates of the second text object and the center ordinate of the first character object is less than the second text object being located in the upper half of the character object, then it can be considered as the upper annotation of the first text object, and proceed to step A3; If the absolute difference between the center ordinate of the first character object and the upper boundary coordinate of the second text object is less than the second text object being located in the lower half of the character object, then it can be considered as the subscript of the first text object, and proceed to step A3; If neither of the above two situations occurs, then the second text object is not an index or subscript. Set the second text object as the first text object and repeat step A1 until all text objects in the text object collection are traversed. Step A3, merge superscripts and subscripts and related text objects, including the following steps: Step A301: Read the third text object sequentially; Step A302: Obtain the difference in ordinate between the first text object and the third text object; Step A304: Determine whether the third text object and the first text object belong to the same paragraph: If the difference in the vertical coordinates between the first text object and the third text object is greater than the set threshold, then they belong to different paragraphs. The first text object and the second text object are merged into a new text object, and the elements associated with the second text object are marked as superscripts / subscripts. If the difference between the ordinates of the first and third text objects is less than or equal to the set threshold, then the first, second, and third text objects will be merged into a new text object, and the elements associated with the second text object will be marked as superscripts / subscripts. Step A305: Set the third text object as the first text object, and repeat step A1 until all text objects in the text object collection are traversed.

5. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, Step 204 includes the following steps: Step 2041: By traversing the vertical coordinate information of all text objects on the page, establish the initial row object for the current page. All text objects can be associated with the row object. If the absolute value of the difference between the upper / lower boundary coordinates of the text object and the upper / lower boundary coordinates of the current line object is less than the threshold, it is confirmed that the associated line object of the text object already exists. At this time, if the upper / lower boundary coordinates of the current line object are less than the upper / lower boundary coordinates of the text object, they are updated to the upper / lower boundary coordinates of the text object. If the absolute value of the difference between the upper / lower boundary coordinates of the text object and the upper / lower boundary coordinates of all line objects is greater than the threshold, then a new line object is created, and the upper / lower boundary coordinates of the line object are updated to the upper / lower boundary coordinates of the text object. Step 2042: Traverse all row objects on the current page and merge row objects with too small an interval, including the following steps: Step 20421: Sort the row objects according to their lower boundary coordinates from smallest to largest, and write them into the row array; Based on the traversal of the row array, obtain the line spacing between row objects, and obtain the minimum effective line spacing and the maximum effective line spacing. The effective line spacing is calculated by counting the number of times all line spacings appear on the current page, dividing it by the total number of line spacings * 100, and taking the maximum and minimum values ​​of the line spacings with a proportion greater than the threshold as the minimum effective line spacing and the maximum effective line spacing. Step 20422: Read the row array, take the first row object as the first row, and set the upper boundary coordinates of the first row as the upper boundary coordinates of the page area; Step 20423: Determine whether the first row needs to be merged with the second row: Read the row objects after the first row in the row array and treat them as the second row; check if the line spacing of the first row is less than the minimum valid line spacing. If it is less, merge the first row with the second row. Step 20424: Obtain the coordinates of the upper boundary of the first row; Read the row objects before the first row in the row array, treat them as the third row, and set the upper boundary coordinate of the first row to the lower boundary coordinate of the third row + 1; Step 20425: Treat the row objects after the first row as the first row, jump to step 20423, and continue until the last row of the row array.

6. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, Step 205 includes the following steps: Step 2051: Based on the text object region, identify the associated standard line, specifically including the following steps: Step 20511: Based on the lower boundary coordinates of the text object, find the standard line area where it is located and use it as the ending line; Step 20512: Based on the upper boundary coordinates of the text object, find the standard line area where it is located and use it as the starting line; Step 20513: Update the start and end lines of the text object identifier. If the start line is shorter than the end line, it means that the current text object covers multiple lines. Step 2052: Split the character objects in the text object according to the standard line, specifically including the following steps: Step 20521: In the current text object, create an array of lines based on the start and end lines; Step 20522: If the text object is associated with only a single standard line, then create a new line object, write the starting line information into the line object, and obtain the text area of ​​the line object, which is consistent with the text object area; If a text object is associated with multiple standard lines, then obtain the complete set of character objects associated with the text object, record the line where the character object is located based on the lower boundary coordinate of each character object, sort the lines where the character objects are located in the character object set from top to bottom, and sort the same lines from left to right according to the left boundary coordinate of the characters, and write the line objects into the line array from the start line to the end line; Step 2053: Traverse all text objects on the current page, complete the association of all text objects with the standard line, sort the text objects from top to bottom according to the terminating line, and sort the text objects in the same terminating line according to the left boundary coordinate of the text object from smallest to largest. Based on the current page's standard line object, traverse from top to bottom to obtain an array of all text objects associated with the standard line; merge the text regions in the text objects associated with the standard line that are the same as the current line to obtain the standard line text region, where the standard line text region is less than or equal to the line region, and the part of the line region not covered by the line text region is blank or contains other element objects; based on the merged line text regions, obtain the text region of the current page; Step 2054: Merge multi-line text objects. Merge multi-line text objects with the same text block on the page into a single text object. This includes the following steps: Step 20541: Set the current text object as the first text object; Step 20542: Obtain the second text object and the third text object, where: The second text object is the text object whose left boundary coordinates are similar to those of the first text object, which is located below the first text object on the vertical axis and is the closest to it; the absolute difference between the left boundary coordinates of the first text object and the left boundary coordinates of the second text object is less than the first threshold. The third text object is the text object whose left boundary coordinates are close to those of the second text object, which is located below the second text object on the vertical axis and is the closest to it. Step 20543: Determine whether the first text object and the second text object need to be merged, including the following steps: Read the text area of ​​the first text object's ending line as the first line area, and the text area of ​​the second text object's starting line as the second line area; If the lower boundary coordinates of the first text object and the upper boundary coordinates of the second text object are greater than the maximum effective line spacing of the current page, and the first text object and the second text object are not in the same paragraph, then there is no need to merge them. In this case, the number of occurrences of all line spacings on the current page is counted, and the count is divided by the total number of line spacings * 100. The line spacings with a proportion greater than the second threshold are taken as the maximum effective line spacing. If the auxiliary character information of the text objects in the first row area is mostly different from that of the text objects in the second row area, then the first text objects and the second text objects are not from the same paragraph and do not need to be merged. If the absolute difference between the right boundary coordinates of the first text object region and the right boundary coordinates of the second text object region is less than or equal to the third threshold, then the first text object and the second text object are the same paragraph text and need to be merged. If the difference between the right boundary coordinates of the first text object region and the right boundary coordinates of the second text object region is greater than the third threshold, and the difference between the left boundary coordinates of the second text object and the left boundary coordinates of the first text object is less than or equal to the fourth threshold, or the difference between the left boundary coordinates of the third text object and the left boundary coordinates of the second text object is less than or equal to the fourth threshold, then the second text object and the first text object are the same paragraph and need to be merged, and the second text object and the third text object are not the same paragraph and do not need to be merged. If both the first and second line regions are associated with only a single text object, and at least one text object has a width greater than the fifth threshold, then the second text object and the first text object are the same paragraph and need to be merged. If none of the above conditions are met, the first text object and the second text object are not from the same paragraph and do not need to be merged. Step 20544: If the result of step 20543 is that the first text object and the second text object are in the same paragraph and need to be merged, then merge the character object information associated with the two objects into the first text object, execute step 2052 to re-break the lines, and delete the second text object. Step 20545: Take the next text object of the first text object as the first text object, and repeat step 20541 until it is the last text object of the current page; if there is text object merging, sort all text objects of the current page from top to bottom according to the terminating line, and sort the text objects in the same terminating line according to the left boundary coordinate of the text object from smallest to largest. Step 2055: Segment the text object based on paragraph features, specifically including the following steps: Step 20551: Obtain all text objects processed in step 2055; Step 20552: Read each line of the current text object, take the current line as the first line, and take the next line as the second line; Step 20553: Determine whether the current text object needs to be segmented according to the rules. Rule 1) Read the left boundary coordinates of the second line. If the difference between the left boundary coordinates of the second line and the left boundary coordinates of the current page text area is greater than the threshold, or the difference between the left boundary coordinates of the first line and the left boundary coordinates of the second line is greater than the threshold, then the current line meets the new paragraph indentation mark and it can be determined that the second line is a new text paragraph. Rule 2) Read the right boundary coordinate information of the second line. If the difference between the right boundary coordinate of the current page text area and the second line is greater than the threshold, or the difference between the right boundary coordinate of the first line and the second line is greater than the threshold, then it is determined that the current line has ended and the next line after the second line belongs to a new text paragraph. Rule 3) When Rule 1) is not satisfied, determine whether the characters conform to the segmentation rules based on the regular expression configured by the business characteristics. If the current line conforms to the regular expression rules, it can be determined that the current line belongs to a new text segment. Step 20554: After executing step 20553, if a new text paragraph needs to be created, write the current text object from the beginning line to the line above the paragraph's beginning line into the current text object, and create a new text object. Write the current text object from the paragraph's beginning line to the last line into the new text object, and use it as the current text object. Then return to step 20552, until the current text object is the last text object of the current page. If the current text object does not need to be segmented, use the next text object as the current text object, execute step 20552, until the current text object is the last text object of the current page.

7. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, Step 2083 includes the following steps: Step 20831: If the number of rows in the header area of ​​the current page is greater than 0, then traverse down from the first row of the current page to the number of rows in the header area, and merge the text content of one or more row objects obtained; identify the integer objects in the merged text content and compare them with typical header identifiers: if they are similar, then confirm that this part of the row objects is the header area; if they are not similar, then consider that there is no header area on this page. If the number of rows in the footer area of ​​the current page is greater than 0, traverse upwards from the last row of the current page to the number of rows in the footer area, and merge the text content of one or more row objects obtained; identify the integer objects in the merged text content and compare them with typical footer identifiers: if they are similar, confirm that this part of the row objects is the footer area; if they are not similar, consider that there is no footer area on this page. Step 20832: Traverse all standard line objects on the current page and set all line objects in areas without headers / footers to body text; Step 20833: Traverse all text objects on the current page and determine the text object attributes based on the standard line attributes corresponding to their associated lines.

8. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, Step 3041 includes the following steps: Step 30411: Starting from the first page and first row of the table area, read line by line in the main text area of ​​this page; Step 30412: Locate the starting row of the table in the starting page of the table area: Determine if the number of text objects associated with the current row is greater than the minimum column count threshold. If the number of text objects is less than the minimum column count threshold: determine if the ratio of the text area width of the first text object in the current row to the page width is less than or equal to the maximum column width ratio threshold to confirm whether it is the starting row of the table; then, read the nearest N rows downwards from the current row to obtain the number of objects and the first text object of each row; in the N rows, check if there is any standard row object whose associated text object count is greater than the threshold, or if the ratio of the width of all text objects in any standard row to the page width is less than the maximum column width ratio threshold. If any of the above conditions are met, the current row can be confirmed as the starting row of the table. If the current row does not meet the above conditions, continue traversing the current page's main text rows until a row that matches the characteristics is found as the starting row of the table or the end row of the main text area is reached; If the starting row of the table is not found on the current page, continue searching on the next page. If the table is not found after traversing N pages, return "Table not found range".

9. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, If the table area still cannot be confirmed after executing steps 301 to 304, a task is initiated to notify a human to confirm the table area.

10. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, Step 4 includes the following steps: Step 401: Obtain the row containing the most columns in the table and confirm the default column width; Step 402: Associate the table range text object with the standard column; Step 403: Adjust the coordinates of the standard column based on the position difference between the text object and the standard column; Step 4031: Process text objects outside the left margin of the standard column: Iterate through all text objects, find the set of text objects whose right boundary coordinates are less than the left boundary coordinates of the first column of the standard column, and obtain the minimum left boundary coordinates and maximum right boundary coordinates of all text objects associated with the first column of the standard column; take the text objects outside the left boundary of the table as the first text objects, and the text objects associated with the first column of the standard column in the same row as the second text objects; If the absolute difference between the right boundary coordinate of the first text object and the minimum left boundary coordinate of the first column text is greater than the threshold, then a new first column object is added, with the left boundary coordinate being the left boundary coordinate of the first text object and the right boundary coordinate being the original left boundary coordinate of the first column - 1. Then proceed to step 402 to update the standard column information again. If the second text object exists and it cannot be merged with the first text object based on its position, then a new first column object is added, with its left boundary coordinates being the left boundary coordinates of the first text object and its right boundary coordinates being the left boundary coordinates of the previous first column - 1. Then proceed to step 402 to update the standard column information again. If a second text object exists and can be merged with the first text object based on its position, then the first text object is also associated with the standard first column, and the left boundary coordinates of the standard first column are updated to the left boundary coordinates of the first text object. If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object associated with the standard first column is less than the threshold, then a new first column object is added, with the left boundary coordinate of the first text object being the left boundary coordinate of the first text object, and the right boundary coordinate being the original first column left boundary coordinate - 1; proceed to step 402 to update the standard column information again; If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object associated with the standard first column is greater than the threshold, the first text object is associated with the standard first column, and the left boundary coordinate of the standard first column is set as the left boundary coordinate of the first text object. The next text object outside the left boundary of the table is taken as the first text object, and the process continues until there are no more text objects outside the left boundary of the table. Step 4032: Process text objects outside the right boundary of the standard column. Iterate through all text objects, find the set of text objects whose left boundary coordinates are greater than the right boundary coordinates of the last column of the standard column, and obtain the minimum left boundary coordinates and maximum right boundary coordinates of all text objects associated with the last column of the standard column; take the text objects outside the right boundary of the table as the first text objects, and the text objects associated with the last column of the standard column in the same row as the second text objects; If the absolute difference between the left boundary coordinate of the first text object and the maximum right boundary coordinate of the last text is greater than the threshold, then a new last text object is added, with its left boundary coordinate being the right boundary coordinate of the last text object + 1, and its right boundary coordinate being the right boundary coordinate of the first text object. Then proceed to step 402 to update the standard column information again. If the second text object exists and it cannot be merged with the first text object based on its position, then a new last column object is added, with its left boundary coordinates being the right boundary coordinates of the last column + 1 and its right boundary coordinates being the right boundary coordinates of the first text object. Then proceed to step 402 to update the standard column information again. If a second text object exists and can be merged with the first text object based on its position, then the first text object is also associated with the standard last column, and the right boundary coordinates of the standard last column are updated to the right boundary coordinates of the first text object. If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the associated text object in the last column of the standard is less than the threshold, then a new last column object is added. The left boundary coordinate of the new last column object is the right boundary coordinate of the last column + 1, and the right boundary coordinate is the right boundary coordinate of the first text object. Proceed to step 402 to update the standard column information again. If the second text object does not exist, and the overlap rate between the horizontal coordinate area of ​​the first text object and the horizontal coordinate area of ​​the text object associated with the first standard column is greater than the threshold, the first text object will be associated with the last standard column, and the right boundary coordinate of the last standard column will be set as the right boundary coordinate of the first text object. The next text object outside the right boundary of the table is taken as the first text object, and the process continues until there are no more text objects outside the right boundary of the table. Step 4033: Process the gap between two adjacent columns to determine whether a new column needs to be added, including the following steps: Step 40331: Take the first standard column as the first column, and the standard column closest to the right of the first standard column as the second column; Step 40332: Merge the blank areas between adjacent columns into the first column: If the difference between the left boundary coordinate of the second column and the right boundary coordinate of the first column is less than the minimum column width threshold, the third column is merged into the first column, and the process jumps to step 40334; if it is greater than the minimum column width threshold, a new virtual column is created as the third column, with the left boundary coordinate of the third column being the right boundary coordinate of the first column + 1, and the right boundary coordinate being the left boundary coordinate of the second column - 1. Obtain the text object coverage areas of the first and second columns respectively, and use them as the first and second column text areas. The text area is obtained by traversing all text objects associated with the column to obtain the entire area covered by the text content. Traverse the table text objects that are not associated with the standard column, and add the text objects whose center horizontal coordinate is located in the third column area, and whose left boundary coordinate is greater than the right boundary coordinate of the first column and whose right boundary coordinate is less than the left boundary coordinate of the second column to the third column text object array. If there are no text objects in the third column, merge the third column into the first column, and jump to step 40334. Step 40333: Based on the text areas of each column, determine whether to add the virtual column as a new standard column: Iterate through the array of text objects in the third column, and use the first text object as the current text object: If the current text object is completely located in the virtual column area, and the sum of the horizontal coordinates of the first and second column text areas is less than the threshold, the third column will be added as a standard column object, and the process will proceed to step 402 to update the standard column information. If the horizontal coordinate of the center of the current text object is within the third column area, and the sum of the horizontal coordinates of the first and second column text areas is less than the threshold, the third column will be added as a standard column object, and the process will proceed to step 402 to update the standard column information. If the above conditions are not met, take the next text object in the third column of the text object array as the current text object, and repeat step 40332 until the last text object in the array. Step 40334: Merge the third column into the standard column: After traversing step 40333, the third column of text objects array is obtained again, and the third column of text area is obtained based on the text objects in the array; the overlap rate between the third text area and the first and second text areas is obtained, and the larger of the two overlap rates is taken: if it is greater than the minimum merging overlap rate threshold, the third column is merged into the standard column with the larger overlap rate, and the process proceeds to step 402 to update the standard column information again. Step 40335: Process unassociated text objects in the third column area: After processing steps 40331 to 40334, if a third column region still exists, a new array of text objects for the third column is obtained. If the number of text objects in the array is greater than or equal to 1, the first text object in the array is taken as the third text. The text objects associated with the first column in the same row as the third text are taken as the first text, and the text objects associated with the second column are taken as the second text. If neither the first nor the second text exists, and if the overlap rate between the third text and both the first and second column text regions is greater than the minimum overlap threshold, the third text is a cross-column text and is associated with both the first and second columns. Otherwise, the third text is associated with the column with the larger overlap width. If only one of the first or second text exists, the third text is associated with the column associated with the text object. Take the next object in the third column of the text object array as the third text, and continue the above process until the last object in the array. Count the number of associations between the third column of the text object array and the first and second columns, and merge the third column into the column with the more associations. If the number of associations is the same, it will be merged into the first column by default. Step 40336: Traverse the processed adjacent columns: Set the second column as the first column, set the right standard column object closest to the second column as the second column, and jump to step 40332 to continue processing until the second column is the rightmost standard column. Step 4034: Adjust the x-coordinates of adjacent columns.

11. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 10, characterized in that, Step 402 includes the following steps: Step 4021: Read the text objects in the current page's table area sequentially and use them as the first text object; Step 4022: Iterate through the column objects according to the standard columns to obtain the first standard column, and use the right column of the first standard column as the second standard column and the left column as the third standard column; Step 4023: Based on the horizontal axis coordinate relationship between the first text object and the first standard column object, confirm whether the first text pair is associated with the first standard column object. If the first text object belongs to the first standard column, proceed to step 4025; otherwise, execute step 4024. Step 4024: If the first text object does not belong to the first standard column, take the next standard column as the first standard column, jump to step 4022 and repeat the operation until the last standard column object; Step 4025: Take the next object in the table text area of ​​the current page as the first object, jump to step 4021, and continue until the last object on the current page.

12. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 10, characterized in that, Step 4034 includes the following steps: Step 40341: Use the first standard column as the first column and the second standard column as the second column; Step 40342: Obtain the text object coverage areas of the first and second columns respectively, as the first and second column text areas. The text area is obtained by traversing all text objects associated with the column to obtain the entire area covered by the text content; obtain the overlapping part of the first and second text areas, which is the third text area; obtain the column overlap rate, which is the width of the third text area / the width of the first text area * 100%. If the column overlap rate is greater than the overlap threshold, it is necessary to determine whether the two columns can be merged: Read the associated text of the first column and the associated text of the second column row by row. If neither column in the current row is associated with a text object, it can be merged; if both are associated with text objects, they cannot be merged; if the number of rows that cannot be merged is less than the threshold, merge the first column and the second column, and go to step 402 to update the standard column information again. For columns that cannot be merged, adjust the column width to the optimal value: Divide the third text region N into equal parts and establish virtual column separators and associated result arrays; adjust the column widths of the first and second columns according to each virtual column separator, and calculate the sum of the number of associated text objects in step 402 and store it in the associated result array; select the virtual separator of the number of associated text objects as the new column boundary; after processing, go to step 402 to update the standard column information again. When the right boundary coordinate of the first column is greater than the left boundary coordinate of the second column, there is no overlap between the two columns, and no processing is required. Step 40343: Traverse the processed adjacent columns: Set the second column as the first column, set the rightmost standard column object closest to the second column as the second column, and jump to step 40342 to continue processing until the second column is the rightmost standard column.

13. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 10, characterized in that, Step 5 includes the following steps: Step 5011: Obtain the array of text objects that are already associated with the standard columns in the table, and create an array of cell objects; Step 5012: Take the first text object as the second text, create a second cell object, associate the second text with the cell object, and add it to the cell object array: Create a new unit object as the second unit object, and associate the second text object with the second unit object; read the unit object array and use the obtained unit object as the first unit; determine whether the first unit object and the second unit object have overlapping table areas: if they overlap, determine whether they can be merged based on the text object information associated with the second unit object; if they can be merged, merge the text content of the first unit object with the text content of the second unit object, associate the second text object with the first unit object, and update the row and column information of the first unit object based on the coordinate area of ​​the merged text object; if they cannot be merged, change the status of the second unit object to pending confirmation - duplicate text, add the second unit object to the unit object array, and change the status of the first unit from normal to pending confirmation - duplicate text; record in the table object that both the first unit object and the second unit object are set as pending confirmation unit identifiers; If there is no table area overlap, read the next cell in the cell object array as the first cell object, and check if there is table area overlap until the last cell object in the array; if there is no table overlap, add the second cell object to the cell object array. Step 5013: Take the next text object in the text object array as the second text, and repeat steps 5011 to 5012 until the last text object in the text object array. Step 502: Process unassociative text objects, specifically including the following steps: Step 5021: Obtain an array of text objects in the table that are not associated with standard columns, take the first text object as the second text, and obtain the standard row area and standard column area it covers based on the coordinate area of ​​the second text. Step 5022: Process according to the position of the second text and the standard column: When the text object does not belong to the table object: If there are no other text objects within the same standard row area as the second text, or if no other text objects are associated with the standard column, it is necessary to further determine whether there are any text objects associated with the standard column within the next N rows. If none are found, it is confirmed that this row does not belong to the table object. Set the end page and end row of the table to the row above the first row of the second text, and delete the row objects in the cell array that are greater than or equal to the first row of the second text. The process ends here. When a text object spans multiple columns: If the left and right boundary coordinates of the second text are located in different standard column areas on the horizontal axis, then the text object is considered to span multiple columns. Therefore, a virtual column is created as the third column, and the multiple standard columns covered by the second text area are merged into the third column. The positions of the second text and the third column are compared to obtain the association method of the second text aligning with the third column. A new second unit is created, associated with the second text, and the relevant column and row information covered by the second text is written. The second unit is compared with the existing units in the unit array to determine if there is any overlap between the standard row and standard column areas. If there is overlap, the status of the second unit is set to pending confirmation - overlapping area, and the status of all units involving overlapping areas is set to pending confirmation - overlapping area. The identifier of the pending confirmation unit is recorded in the table object. If there is no overlap, the second unit is added to the unit object array. Step 5023: Take the next text object in the text object array as the second text, and execute steps 5021 to 5022 until the last text object.

14. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 1, characterized in that, The process after step 5 includes step 6: if it is determined that the table involves multiple pages, merge one or more cross-page tables.

15. The method for accurate recognition of borderless tables based on a positioning algorithm as described in claim 14, characterized in that, Step 6 includes the following steps: Step 601: Based on steps 4 and 5, convert the information from the first page area of ​​the table into the first table object; Step 602: Obtain the next page corresponding to the table, and read it into the second table object according to steps 4 and 5; Step 603: Determine whether the first table object and the second table object belong to the same table, which further includes the following steps: Step 6031: There are duplicate headers in the same table. Delete all cells corresponding to the duplicate headers in the second table and jump to step 605. Step 6032: If the number of standard columns in the second table is different from that in the first table, and they are not the same table, proceed to step 604. Step 6033: Determine the coverage area of ​​the standard columns in the second table and the first table: Read the standard column of the second table sequentially: if its horizontal coordinate area exceeds the nearest left and right column area of ​​the corresponding column in the first table, then the two columns are considered to be different columns, confirm that they are not the same table, and jump to step 604. If it does not exceed the nearest left and right column area of ​​the corresponding column of the first table, obtain the coverage area of ​​it and the corresponding column of the first table. If the proportion is less than the threshold, it is considered that the two are not the same column. If it is confirmed that they are not the same table, jump to step 604. Wherein, the coverage area proportion = (right boundary coordinate of the coverage area - left boundary coordinate of the coverage area) * 100 / (right boundary coordinate of column N of the second table - left boundary coordinate of column N of the second table). If the columns are determined to be in the same column, read the next standard column of the second table sequentially until the last column, and then end the processing. Step 6034: Traverse the standard columns of the first table and compare them with the corresponding column areas of the second table. The judgment logic is the same as in step 6033. If it is determined that they are not the same column, confirm that they are not the same table, and jump to step 604. Step 6035: Determine the text content characteristics of the columns in the first and second tables: Obtain the column attributes of each column in the first table and the second table. Iterate through each column in the second table to determine whether the current column attribute is compatible with the corresponding column attribute in the first table. If they are not compatible, they are considered to be different columns. Confirm that they are not the same table and jump to step 604. Step 6036: If steps 6031 to 6035 are all negative, then it can be determined that the two tables need to be merged, and the process jumps to step 605. Step 604: If the tables are not the same, there is no need to merge them; Step 605: Merge the second table object into the first table object.

Citation Information

Patent Citations

  • A method for extracting table information in a PDF file

    CN109635268A

  • Form recognition method and device in image, electronic equipment and storage medium

    CN111814722A