Table generation method and device, electronic equipment and storage medium

By automatically acquiring and generating table layout information, the problem of low efficiency and low accuracy of manual annotation of complex table images in the financial field is solved, achieving efficient and accurate table annotation and model training.

CN116311300BActive Publication Date: 2026-08-04BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2023-02-16
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

In existing technologies, the table image structure in the financial field is complex, and manual annotation is inefficient and inaccurate, which affects the model training effect.

Method used

By acquiring text content information and target page layout information, cell and text coordinate information are automatically generated, and target tables and their annotation data are automatically generated, avoiding manual annotation.

Benefits of technology

It improves the accuracy and efficiency of labeled data, is suitable for automatic labeling of complex tables, and supports model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116311300B_ABST
    Figure CN116311300B_ABST
Patent Text Reader

Abstract

The present disclosure discloses a table generation method and device, electronic equipment and storage medium, relates to the technical field of computers, and particularly relates to the technical field of optical character recognition. The specific implementation scheme is as follows: text content information and layout information of a target page are obtained, the layout information of the target page includes page parameter information, cell layout information and text layout information. Cell coordinate information is obtained according to the page parameter information, the cell layout information and the text layout information. Text coordinate information is obtained according to the text layout information and the cell coordinate information. A target table and annotation data corresponding to the target table are generated according to the cell coordinate information, the text coordinate information and the text content information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more particularly to the field of optical character recognition technology, specifically to a table generation method, apparatus, electronic device, and storage medium. Background Technology

[0002] Optical character recognition technology refers to the process of scanning text documents and then analyzing and processing image files to obtain text and layout information.

[0003] With the development of optical character recognition technology, a well-trained table structured model can be used to recognize and extract text data from table images. Training this table structured model requires a large number of sample table images and their labeled data. Summary of the Invention

[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for generating tables.

[0005] According to one aspect of this disclosure, a method for generating a table is provided, comprising:

[0006] Obtain text content information and target page layout information, including page parameter information, cell layout information, and text layout information. Based on the page parameter information, cell layout information, and text layout information, obtain cell coordinate information. Based on the text layout information and cell coordinate information, obtain text coordinate information. Based on the cell coordinate information, text coordinate information, and text content information, generate the target table and its corresponding annotation data.

[0007] According to another aspect of this disclosure, a table generation apparatus is provided, comprising: a first acquisition module, a second acquisition module, and a generation module. The first acquisition module is used to acquire text content information and layout information of a target page, the layout information of the target page including page parameter information, cell layout information, and text layout information. The first acquisition module is used to obtain cell coordinate information based on the page parameter information, cell layout information, and text layout information. The second acquisition module is used to obtain text coordinate information based on the text layout information and cell coordinate information. The generation module is used to generate a target table and corresponding annotation data based on the cell coordinate information, text coordinate information, and text content information.

[0008] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method as described above.

[0009] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method described above.

[0010] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described above.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0013] Figure 1 This illustration schematically shows an exemplary system architecture to which the table generation method and apparatus can be applied according to embodiments of the present disclosure;

[0014] Figure 2 A flowchart illustrating a table generation method according to an embodiment of the present disclosure is shown schematically;

[0015] Figure 3 This diagram illustrates the generation of cell coordinate information according to an embodiment of the present disclosure.

[0016] Figure 4 A schematic diagram of a cell in a table according to an embodiment of the present disclosure is shown.

[0017] Figure 5 This illustration shows a schematic diagram of the display effect of text in a cell according to the text layout method determined according to an embodiment of the present disclosure;

[0018] Figure 6 A schematic diagram of a table is shown according to some embodiments of the present disclosure;

[0019] Figure 7 A schematic diagram of a table with border lines is shown according to some embodiments of the present disclosure;

[0020] Figure 8A schematic diagram of a form with a stamp is shown according to some embodiments of the present disclosure;

[0021] Figure 9 A schematic diagram of a filtered table according to some embodiments of the present disclosure is shown;

[0022] Figure 10 A block diagram of a table generation apparatus according to an embodiment of the present disclosure is schematically shown; and

[0023] Figure 11 A block diagram of an electronic device suitable for implementing a table generation method according to an embodiment of the present disclosure is shown schematically. Detailed Implementation

[0024] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0025] In the process of recognizing and extracting information from table images using optical recognition technology, it is necessary not only to recognize the text in the table image, but also to recognize the table structure and perform structured processing of the row and column information of the recognition results.

[0026] Therefore, before training a model to recognize text and table structure in table images, it is necessary to collect a large number of sample table images and annotate the text and table structure in the sample table images to obtain labeled data. The model is then trained using the sample table images and labeled data.

[0027] However, in related technologies, manually annotating data is not only inefficient but also results in low accuracy, especially for tabular images in the financial field, such as balance sheets, cash flow statements, and profit and loss statements. These tables have complex structures, making manual annotation of data in these images extremely difficult. This directly impacts the effectiveness of model training.

[0028] In view of this, embodiments of this disclosure provide a table generation method, including:

[0029] The system retrieves text content information and target page layout information, including page parameter information, cell layout information, and text layout information. Based on these information, it obtains cell coordinate information. Similarly, it obtains text coordinate information based on the text layout information and cell coordinate information. Finally, it generates a target table and corresponding annotation data based on the cell coordinate information, text coordinate information, and text content. This system can generate complex tables applicable to the financial technology field and automatically generates corresponding annotation data simultaneously, eliminating the need for manual annotation.

[0030] Figure 1 The illustration schematically shows an exemplary system architecture to which the table generation method and apparatus can be applied according to embodiments of the present disclosure.

[0031] It is important to note that Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments, or scenarios. For example, in another embodiment, an exemplary system architecture for applying the table generation method and apparatus may include a terminal device, but the terminal device can implement the table generation method and apparatus provided by the embodiments of this disclosure without interacting with the server.

[0032] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the terminal devices 101, 102, and 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.

[0033] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (for example only).

[0034] Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0035] Server 105 can be a server that provides various services, such as a backend management server that supports the content browsed by users using terminal devices 101, 102, and 103 (for example only). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.

[0036] It should be noted that the table generation method provided in this embodiment can generally be executed by terminal devices 101, 102, or 103. Accordingly, the table generation device provided in this embodiment can also be disposed in terminal devices 101, 102, or 103.

[0037] Alternatively, the table generation method provided in this embodiment can generally be executed by server 105. Correspondingly, the table generation apparatus provided in this embodiment can generally be located in server 105. The table generation method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Correspondingly, the table generation apparatus provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105.

[0038] For example, when a user submits a form generation request online, terminal devices 101, 102, and 103 can obtain the text content information and target page layout information selected by the user from the database. They then send this information to server 105, which uses the page parameters, cell layout information, and text layout information to obtain cell coordinate information. Based on the text layout information and cell coordinate information, it obtains the text coordinate information. Finally, based on the cell coordinate information, text coordinate information, and text content information, it generates the target table and corresponding annotation data. Alternatively, a server or server cluster capable of communicating with terminal devices 101, 102, 103, and / or server 105 can analyze the target content and ultimately extract content of interest to the user.

[0039] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0040] Figure 2 A flowchart illustrating a table generation method according to an embodiment of the present disclosure is shown schematically.

[0041] like Figure 2As shown, the method includes operations S210 to S240.

[0042] In operation S210, text content information and target page layout information are obtained. The target page layout information includes page parameter information, cell layout information, and text layout information.

[0043] In operation S220, cell coordinate information is obtained based on page parameter information, cell layout information, and text layout information.

[0044] In operation S230, the text coordinate information is obtained based on the text layout information and cell coordinate information.

[0045] In operation S240, the target table and corresponding annotation data are generated based on cell coordinate information, text coordinate information, and text content information.

[0046] According to embodiments of this disclosure, the text content information can be table content information displayed in the cells of a table. For example, in an XX transaction list table, the table content information may include: account information, account name information, query start date information, query end date information, query time information, query teller information, currency information, transaction date information, accounting date, transaction location information, transaction type information, loan status information, transaction amount information, etc.

[0047] According to embodiments of this disclosure, the aforementioned text content information can be configured based on the content information of the actual table, and the configured text content information is stored as a candidate set of table content in the table header dictionary. This allows the required text content information to be obtained by traversing the table header dictionary.

[0048] According to embodiments of this disclosure, page parameter information may include page width information, page length information, number of page rows information, and number of page columns information.

[0049] According to embodiments of this disclosure, cell layout information may include column width ratio information and relative position information between cells. The column width ratio information is generally used to adjust the width of the row with the most columns in the table, using the smallest cell as a reference, with the width of other cells scaled according to the column width ratio information based on the width of the smallest cell. For example, a row may include three cells, with the column width ratios between these three cells being as follows: the column width ratio between the first cell and the smallest cell in the row is "2", the column width ratio between the second cell and the smallest cell in the row is "1.7", and the third cell is the smallest cell in the row.

[0050] For example, if the page width is 100, the page length is 300, and the page has 10 rows, with the row containing the most columns having 4 columns of cells, and the column width ratios from left to right are: the first cell has a column width ratio of "1", the second cell has a column width ratio of "1.5", the third cell has a column width ratio of "1", and the fourth cell has a column width ratio of "1.5", then the cell widths of that column would be 20, 30, 20, and 30 respectively.

[0051] According to embodiments of this disclosure, similarly, the height information of the smallest cell in a column can also be obtained based on the page length and the page row height ratio. The heights of other cells are scaled according to the row height ratio to obtain the height information of all cells in a column, which will not be elaborated here.

[0052] According to embodiments of this disclosure, the relative position information between cells can represent the relative position information between cells in one row and cells in other rows. For example, the first row may include 4 cells, namely CellA1, CellA2, CellA3, and CellA4. The second row may include 7 cells, namely CellB1, CellB2, CellB3, CellB4, CellB5, CellB6, and CellB7. The relative position relationship between cells can be represented as: CellA1(1,1), CellA2(2,3), CellA3(4,5), and CellA4(6,7).

[0053] According to embodiments of this disclosure, based on the relative positions of the cells, it can be determined that CellA1 and CellB1 are vertically aligned, meaning they have the same width. CellA2 spans across CellB2 and CellB3, meaning its width is equal to the sum of the widths of CellB2 and CellB3. This pattern continues, and will not be elaborated further here.

[0054] For example: The widths of the cells in the second row can be successively: the width of cell CellB1 is "10", the width of cell CellB2 is "15", the width of cell CellB3 is "10", the width of cell CellB4 is "5", the width of cell CellB5 is "20", the width of cell CellB6 is "20", and the width of cell CellB7 is "20". Based on the relative position relationship between the above cells, the width of cell CellA1 can be obtained as "10", the width of cell CellA2 can be obtained as "25", the width of cell CellA3 can be obtained as "25", and the width of cell CellA4 can be obtained as "40".

[0055] According to an embodiment of the present disclosure, the text layout information may include the arrangement manner of the text in the cell and the font size information of the text. The arrangement manner of the text in the cell may include top alignment arrangement, center alignment arrangement, bottom alignment arrangement, etc. in the cell. The font size information of the text may include the height information of the text, the width information of the text, etc.

[0056] According to an embodiment of the present disclosure, taking the arrangement manner of the text in the cell as top alignment arrangement as an example, and the text is arranged in a single line in the cell, then it can be determined that the height of the text is equal to the height of the cell.

[0057] For example: The width of the first cell CellA1 in the first row is "10", and the text height can be "5", and the coordinate information of cell CellA1 can be determined: "(0, 0), (10, 0), (0, 5), (10, 5)".

[0058] According to an embodiment of the present disclosure, taking the arrangement manner of the text in the cell as top alignment arrangement as an example, and the text is arranged in a single line in the cell. For example: The width of the text can be "1", and the text content information in the first cell CellA1 in the first row can be the two characters "account number", then the coordinates of the character "account" can be "(0, 0), (1, 0), (0, 5), (1, 5)". The coordinates of the character "number" can be "(1, 0), (2, 0), (1, 5), (2, 5)".

[0059] According to an embodiment of the present disclosure, the text content can be filled into the corresponding cell according to the text coordinate information, and then the target table can be obtained.

[0060] According to an embodiment of the present disclosure, the annotation data corresponding to the target table represents the structured annotation data of the combination of the text content information and the coordinate information of the cell where it is located. For example: The annotation data of cell CellA1 may include: the coordinate information of cell CellA1 and the text content information in cell CellA1.

[0061] According to embodiments of this disclosure, during the generation of the target table, the text content information may include table header information and random number information corresponding to the table header. For example, the table header information may be "account number", and the random number information corresponding to the table header may be "000XXX1111".

[0062] According to embodiments of this disclosure, by obtaining text content information and target page layout information, target tables with different cell layouts and text layouts can be flexibly generated, enabling the rapid generation of target tables for model training and corresponding annotation data. Since the annotation data is obtained directly during the generation of the target table, including cell coordinate information, text coordinate information, and text content information, the accuracy and efficiency of the annotation data are improved.

[0063] The following is for reference. Figures 3-9 In conjunction with specific embodiments, Figure 2 The method shown will be further explained.

[0064] Figure 3 A schematic diagram illustrating the generation of cell coordinate information according to an embodiment of the present disclosure is shown.

[0065] like Figure 3 As shown, in step 300, the minimum cell size information 3203 is obtained based on page parameter information 3201 and cell size ratio information 3202. Then, cell size information 3205 is obtained based on the minimum cell size information 3203 and relative position relationship information 3204. Next, the cell's layout position information on the target page 3206 is obtained based on cell size information 3205 and page parameter information 3201. Based on the cell's layout position information 3206 on the target page, multiple target cells located in the same row can be identified 3207. Based on line break information 3208, the number of lines of text within the cell 3209 is obtained. Based on the number of lines of text within the cell 3209, the height information 3210 of multiple target cells is obtained. Based on the multiple target cells located in the same row 3207 and the height information 3210 of multiple target cells, cell coordinate information 3211 is obtained.

[0066] According to embodiments of this disclosure, the cell size ratio information may include column width ratio information and row height ratio information. The following uses column width ratio information as an example to explain in detail the process of determining cell width information.

[0067] According to embodiments of this disclosure, the column width ratio information of a cell is generally set by selecting the row with the most columns in the target table. For example, if the page width is 100, the row with the most columns may include 3 columns of cells, and the column width ratio information is as follows: the column width ratio of the first column of cells can be "6", the column width ratio of the second column of cells can be "1", and the column width ratio of the third column of cells can be "3", resulting in a minimum cell width of 10.

[0068] According to embodiments of this disclosure, the relative positional relationship between cells can characterize the column width span information between the column containing a cell and the columns containing other cells. For example, cell A1 can be a cell located in the first row and first column, and cells B1 and B2 can be cells located in the second row and first column, respectively. If the column width of cell A1 spans the column widths of cells B1 and B2, then the relative positional relationship between cells can be expressed as: cell A1 (cell B1, cell B2). That is, the width of cell A1 is equal to the sum of the widths of cells B1 and B2.

[0069] Based on the minimum cell width and the relative positions of the cells, the cell width information can be obtained using formula (1):

[0070] Cell width = minimum cell width × SUM[column width ratio (column width span information)] (1)

[0071] For example: the minimum cell width is 10, the column width ratio of cell CellB1 is 2, the column width ratio of cell CellB2 is 1.5, and the column width span information is: cell CellA1(cell CellB1, cell CellB2), we can get the width of cell CellA1 as 35.

[0072] According to embodiments of this disclosure, the text layout information includes line break indicators for text within a cell. Based on cell width information, page parameter information, and text layout information, cell coordinate information is obtained, which may include the following operations:

[0073] Identify line break markers to obtain the number of lines the text will occupy within the cell. Based on the cell width and page parameters, determine the cell's position on the target page. Finally, based on the position and line count, obtain the cell's coordinates.

[0074] According to embodiments of this disclosure, in a real table, the text in each cell may be arranged across multiple lines. Therefore, the number of lines in a cell can be obtained by setting line break information for the text within the cell.

[0075] For example, in cell CellA1, the text content could be "Account / Card No:\nAccount / Card.No:", where "\n" represents a newline character.

[0076] According to an embodiment of this disclosure, by recognizing the line break identifier information, it can be determined that the above-mentioned text content information is arranged in 2 rows in cell CellA1.

[0077] According to embodiments of this disclosure, since the minimum cell width is set based on the row with the most columns, the widths of other cells are also obtained based on the column width span information between the cells and the cells in the row containing the minimum cell. Therefore, the cell layout position information on the target page can be obtained based on the cell width information and page parameter information.

[0078] For example, the row with the most columns can be row 6, and the column width information of other cells can be determined by the relative positional relationship between the cells in row 6. For example, if the column width span of the first cell in row 5 is (1, 2), it means that the column width of the first cell in row 5 is equal to the sum of the widths of the first and second cells in row 6. If the column width span of the first cell in row 4 is (1, 2, 3), it means that the column width of the first cell in row 4 is equal to the sum of the widths of the first to third cells in row 6.

[0079] According to embodiments of this disclosure, since the height of each cell currently only considers page parameter information and row height ratio, the height of cells in each row should be the same in a real table image. Therefore, based on determining the relative arrangement position of cells on the target page, the height information of cells in that row can be finally determined by combining the heights of multiple cells in the same row.

[0080] According to embodiments of this disclosure, obtaining cell coordinate information based on layout position information and layout row number information may include the following operations:

[0081] Based on the layout position information, obtain multiple target cells located in the same row. Based on the row number information, obtain the height information of multiple target cells. Based on the layout position information and height information, obtain the cell coordinate information.

[0082] For example, based on the layout information, multiple target cells located in the same row can be identified. For instance, the target cells could include three cells: CellM1, CellM2, and CellM3. The height of each cell can be determined based on the number of rows of text within it. For example, CellM1 has two rows of text, CellM2 has three rows, and CellM3 has two rows.

[0083] According to embodiments of this disclosure, obtaining the height information of multiple target cells based on the row number information can include the following operations:

[0084] Sort the row number information of multiple target cells to obtain the sorting result. Based on the sorting result, obtain the height information.

[0085] For example, sorting the above three cells according to the number of rows would result in: CellM2, CellM1, and CellM3. The height of the cell with the most rows of text in each row can be determined as the final height of all cells in that row. For example, if the height of CellM2 is 5, then the heights of CellM1 and CellM3 are also 5.

[0086] Figure 4 A schematic diagram of a cell in a table according to an embodiment of the present disclosure is shown.

[0087] like Figure 4 As shown, in cell 400, cells A through P can all represent cells that span the table header. The row with the most columns is cell Q, which represents the table header. Cell A's column width spans the widths of cells Q through V (6 cells in total). Cells B, F, J, and N have the same column width as cell Q. Cells C, G, K, and O have column widths equal to the sum of the column widths of cells R and S. Cells D, H, and L have column widths equal to the sum of the column widths of cells T and U. Cell P has the sum of the column widths of cells T, U, and V. Cells E, I, and M have column widths equal to the sum of the column widths of cell V. From top to bottom, from the row containing cell a1 to the row containing cell an, these are all cells containing the table body, and the structure of the table body cells is the same as the structure of the header cells.

[0088] According to embodiments of this disclosure, the text layout information includes information on the arrangement of text within a cell, text size information, and line break information within the cell. The above operation S230 may include the following operations:

[0089] Based on the layout information, determine the target strategy. Based on the line break information, obtain the number of lines the text will occupy within the cell. Based on the target strategy, obtain the text coordinates using the cell coordinates, text size, layout information, and number of lines.

[0090] According to embodiments of this disclosure, the text layout can include horizontal and vertical layout within a cell. Horizontal layout can include left alignment, center alignment, and right alignment. Vertical layout can include top alignment, center alignment, and bottom alignment. The text layout within a cell can include the following nine methods: left alignment + top alignment, left alignment + center alignment, left alignment + bottom alignment, center alignment + top alignment, center alignment + center alignment, center alignment + bottom alignment, right alignment + top alignment, right alignment + center alignment, and right alignment + bottom alignment.

[0091] Figure 5 The illustration shows a schematic diagram of the display effect of text in a cell according to the text layout method determined according to an embodiment of the present disclosure.

[0092] like Figure 5 As shown in Figure 5321, the text is arranged starting from the top left corner of the cell. The text is arranged starting from the middle of the cell when it is centered. The text is arranged starting from the bottom right corner of the cell when it is centered, with the last character positioned at the bottom right corner.

[0093] According to embodiments of this disclosure, the target strategy can characterize the calculation strategy for different text coordinates configured for different layouts.

[0094] According to embodiments of this disclosure, text size information includes text height information and text width information. Based on a target strategy, text coordinate information is obtained according to cell coordinate information, text size information, layout information, and number of rows, which may include the following operations:

[0095] Based on cell coordinates, text width, and layout information, the horizontal coordinate of the text is obtained. Based on the target strategy, the vertical coordinate of the text is obtained based on cell coordinates, text height, and number of rows. Finally, the overall text coordinates are obtained based on both the horizontal and vertical coordinates.

[0096] According to embodiments of this disclosure, a custom offset parameter threshold range can be configured based on the horizontal arrangement of text within a cell, for example: [0, 1]. When the text is left-aligned in the horizontal direction within the cell, the horizontal offset parameter can be determined to be 0. When the text is center-aligned in the horizontal direction within the cell, the horizontal offset parameter can be determined to be 0.5. When the text is right-aligned in the horizontal direction within the cell, the horizontal offset parameter can be determined to be 1.

[0097] According to embodiments of this disclosure, since the border lines of a real table occupy a certain width, to prevent text near the cell border lines from being partially covered, the aforementioned offset parameter threshold range can be changed as needed. For example, it can be changed to [0.2, 0.8].

[0098] According to embodiments of this disclosure, obtaining the horizontal coordinate information of the text based on offset parameter information, text width information, and cell coordinate information may include the following operations:

[0099] The cell width is obtained based on the coordinates of the left and right vertex. If the layout is determined to be center-aligned, the horizontal coordinate of the text is obtained based on the coordinates of the left vertex, the cell width, and the text width. If the layout is determined to be left-aligned, the horizontal coordinate of the text is obtained based on the coordinates of the left vertex and the offset parameter. If the layout is determined to be right-aligned, the horizontal coordinate of the text is obtained based on the coordinates of the right vertex, the text width, and the offset parameter.

[0100] According to embodiments of this disclosure, text width information can characterize the width information of all text content in the cell obtained according to a preset text font size.

[0101] According to embodiments of this disclosure, when the layout information is determined to be center-aligned, the horizontal coordinate information of the text can be obtained according to formula (2):

[0102] The horizontal coordinate of the text = the coordinate of the left vertex + the cell width / 2 - the text width / 2 (2)

[0103] For example, if the left corner of a cell has a horizontal coordinate of 0, the cell width can be 5, and the text width can be 3, then the starting horizontal coordinate of the text can be determined to be 1.

[0104] According to embodiments of this disclosure, when the layout information is determined to be left-aligned, the horizontal coordinate information of the text can be obtained according to formula (3):

[0105] The horizontal coordinate of the text = the coordinate of the left vertex + the offset parameter (3)

[0106] For example, the left vertex of a cell can have a horizontal coordinate of 0, and the offset parameter for a left-aligned layout can be 0.2, thus determining that the starting horizontal coordinate of the text is 0.2.

[0107] According to embodiments of this disclosure, when the layout information is determined to be right-aligned, the horizontal coordinate information of the text can be obtained according to formula (4):

[0108] Text x-coordinate = right vertex coordinate - text width - offset parameter (4)

[0109] For example, the right corner of the cell can be 5, the text width can be 3, and the offset parameter for the right-aligned layout can be 0.8, so the starting horizontal coordinate of the text can be determined to be 1.2.

[0110] According to an embodiment of this disclosure, when the starting coordinates of the text within a cell are determined, the horizontal coordinate of the next text can be obtained by shifting the starting coordinates horizontally to the right by the width of one character size.

[0111] According to embodiments of this disclosure, cell coordinate information may include the coordinates of the top-left vertex of the cell. Based on a target strategy, the vertical coordinate information of the text is obtained according to the cell coordinate information, text height information, and row number information. This may include the following operations:

[0112] Based on the cell coordinates, obtain the minimum cell height. Based on the top-left vertex coordinates, minimum cell height, text height, and number of rows, obtain the text's vertical coordinate.

[0113] For example, with the coordinates of each cell determined, the height of the smallest cell on the target page can be obtained; for instance, the smallest cell height could be 5. The text height can be 1, and the number of rows can include the number of rows of text within a cell and the maximum number of rows of text across multiple cells in the same row. For example, the number of rows of text within a cell could be 1, and the maximum number of rows of text across multiple cells in the same row could be 2. Based on different vertical text arrangement within the cells, different calculation strategies can be used to obtain the text's vertical coordinate information.

[0114] According to embodiments of this disclosure, when the layout information is determined to be top-aligned, the text vertical coordinate information can be obtained according to formula (5):

[0115] Text ordinate = ordinate of top left vertex + minimum cell height × maximum number of rows / 2 - text height × maximum number of rows / 2 (6)

[0116] For example: the ordinate of the top left vertex can be 0, the minimum cell height is 5, the maximum number of rows is 2, and the text height is 1, so the ordinate of the text can be determined to be 4.

[0117] According to embodiments of this disclosure, when the layout information is determined to be center-aligned, the text vertical coordinate information can be obtained according to formula (6):

[0118] Text ordinate = ordinate of top left vertex + minimum cell height × maximum number of rows / 2 - text height × number of rows of text in this cell / 2 (7)

[0119] For example: the ordinate of the top left vertex can be 0, the minimum cell height is 5, the maximum number of rows is 2, the text height is 1, and the number of rows of text in this cell is 1, so the ordinate of the text can be determined to be 4.5.

[0120] According to embodiments of this disclosure, when the layout information is determined to be bottom aligned, the text vertical coordinate information can be obtained according to formula (7):

[0121] Text ordinate = ordinate of top left vertex + minimum cell height × maximum number of rows / 2 - text height × maximum number of rows / 2 + minimum cell height × (maximum number of rows - number of rows of text in this cell) (7)

[0122] For example: the ordinate of the top left vertex can be 0, the minimum cell height is 5, the maximum number of rows is 2, the text height is 1, and the number of rows of text in this cell is 1, so the ordinate of the text can be determined to be 9.

[0123] According to embodiments of this disclosure, the above operation S240 may include the following operations:

[0124] Based on the text content, determine the target cells. Fill the target cells with the text content according to the text coordinates. Arrange the target cells on the target page according to the cell coordinates to generate the target table. Process the cell coordinates, text coordinates, and text content according to a predetermined data format to obtain the annotation data.

[0125] According to embodiments of this disclosure, the labeled data may include table content information and table structure information. For example, the text content information may be "account number," and the target cell may be determined as the first cell in the second row. Based on the text coordinate information, for example, "account number" is filled into the target cell with the starting x-coordinate of 0.2 and the starting y-coordinate of 1 for the first character. "Account number" is filled into the target cell with the starting x-coordinate of 0.5 and the starting y-coordinate of 1 for the second character. The target cells are then arranged on the target page according to the cell coordinate information to obtain the target table.

[0126] It should be noted that, in this embodiment of the disclosure, the coordinate information of the cell and the coordinate information of the text can both be pixel coordinate information.

[0127] According to embodiments of this disclosure, the aforementioned cell coordinate information, text coordinate information, and text content information can be stored according to a one-to-one mapping relationship and processed according to a predetermined data format, such as JSON format, to obtain labeled data.

[0128] Figure 6 A schematic diagram of a table is shown according to some embodiments of the present disclosure.

[0129] like Figure 6 As shown, in cell 600, the text in the first row is arranged with both horizontal and vertical center alignment. In each cell from the second row onwards, the text is arranged with horizontal left alignment and vertical center alignment. In the cells of the second row and rows 4-5, the text is arranged in two rows. In the first cell of the third row, the text is arranged in three rows.

[0130] It should be noted that, since the table generated in this embodiment is used as a sample table for model training, the text values ​​corresponding to "account number", "card number", "transaction amount", "transaction date" and other information in the table content are all random numbers.

[0131] To make the target table more closely resemble the captured table image, different table border lines can be added to the target table.

[0132] According to embodiments of this disclosure, the above table generation method may further include the following operations:

[0133] Obtain the table border line template. Based on the table border line template and the cell coordinate information, construct border lines on the target table to obtain the first table image.

[0134] According to embodiments of this disclosure, the target page can be a blank page constructed using Pillow image processing software. Alternatively, grayscale colors can be randomly added to the blank page to obtain first table images with different grayscale levels.

[0135] According to embodiments of this disclosure, the table border line template may include various line types, such as full-border lines, non-full-border lines, and dashed lines. The line type in the table border line template can be flexibly selected according to actual needs to construct border lines for cells in the target table, thus obtaining a first table image.

[0136] Figure 7 A schematic diagram of a table with border lines is shown according to some embodiments of the present disclosure.

[0137] like Figure 7 As shown in Figure 700, in rows 1 to 6, the cell borders are full-width linear. From row 7 to the last row, the cells include various border styles. For example, in the first cell of row 7, the left and top borders are solid lines, while the right and bottom borders are borderless. In the second cell of row 7, the left and bottom borders are borderless, the top border is a solid line, and the right border is a dashed line.

[0138] According to embodiments of this disclosure, the above table generation method may further include the following operations:

[0139] Obtain a set of seal image materials. Randomly select a target seal image from the set. Process the target seal image and the first table image to obtain the second table image.

[0140] According to embodiments of this disclosure, the set of seal material images may include seal template images in different scenarios simulating real table images. A target seal image T may be randomly selected from the seal template images, and the target seal image T and the first table image may be fused to obtain a second table image.

[0141] Figure 8A schematic diagram of a form with a stamp is shown according to some embodiments of the present disclosure.

[0142] like Figure 8 As shown, in 1100, the target seal image T is the seal of XX Company. The position of the target seal image T can be random. In other words, by changing the relative position of the target seal image T and the first table image, multiple second table images can be obtained, which can be used as sample table images for model training.

[0143] Since the stamps in the acquired real table images may be incomplete—for example, for a seal across the binding, only a portion of the stamp may be displayed on different pages of the table image—to improve the similarity between the second table image and the real table image, the target stamp image can be processed first, and then fused with the first table image.

[0144] According to embodiments of this disclosure, processing the target seal image and the first table image to obtain a second table image may include the following operations:

[0145] The target stamp image is cropped to obtain a partial stamp image. The background color in the partial stamp image is removed to obtain the target partial stamp image. The target partial stamp image and the first table image are processed to obtain the second table image.

[0146] Since real table images can be captured using image acquisition devices under different lighting conditions, different lighting conditions, different acquisition methods, and different acquisition devices can result in different table images when capturing the same table image information. To simulate table images captured under different acquisition environments, processing the target local seal image and the first table image to obtain a second table image can include the following operations:

[0147] The target partial stamp image and the first table image are fused together to obtain a table image with the target partial stamp. The table image with the target partial stamp is then filtered to obtain a second table image.

[0148] According to embodiments of this disclosure, the filtering process may include at least one of the following: Gaussian filtering, contour filtering, detail filtering, edge enhancement filtering, smoothing filtering, depth smoothing filtering, and unsharpening mask filtering. A table image with a target local stamp can be filtered once or multiple times using one or more filtering methods to obtain a second table image that can be used to simulate images obtained under different acquisition environments.

[0149] Figure 9 A schematic diagram of a filtered table is shown according to some embodiments of the present disclosure.

[0150] like Figure 9 As shown in Figure 900, the table image obtained by processing the table image with the target stamp using Gaussian filtering can simulate a real acquisition environment. It can be seen from Figure 900 that the font in the table image is relatively blurry. Using the filtered table image to train the table recognition model can effectively improve the model's training accuracy.

[0151] Figure 10 A block diagram of a form generation apparatus according to an embodiment of the present disclosure is shown schematically.

[0152] like Figure 10 As shown, the table generation device 1000 of this embodiment may include a first acquisition module 1010, a first obtaining module 1020, a second obtaining module 1030, and a generation module 1040.

[0153] The first acquisition module 1010 is used to acquire text content information and layout information of the target page. The layout information of the target page includes page parameter information, cell layout information, and text layout information. In some embodiments, the first acquisition module 1010 can be used to implement the operation S210 described above, which will not be elaborated here.

[0154] The first obtaining module 1020 is used to obtain cell coordinate information based on page parameter information, cell layout information, and text layout information. In some embodiments, the first obtaining module 1020 can be used to implement the operation S220 described above, which will not be elaborated here.

[0155] The second obtaining module 1030 is used to obtain text coordinate information based on text layout information and cell coordinate information. In some embodiments, the second obtaining module 1030 can be used to implement the operation S230 described above, which will not be elaborated here.

[0156] The generation module 1040 is used to generate a target table and the number of labels corresponding to the target table based on cell coordinate information, text coordinate information, and text content information. In some embodiments, the generation module 1040 can be used to implement the operation S240 described above, which will not be elaborated here.

[0157] According to embodiments of this disclosure, the cell layout information includes cell size ratio information and relative positional relationship information between cells. The first obtaining module may include: a first obtaining submodule, a second obtaining submodule, and a third obtaining submodule. The first obtaining submodule is used to obtain minimum cell size information based on page parameter information and cell size ratio information. The second obtaining submodule is used to obtain cell size information based on the minimum cell size information and relative positional relationship information. The third obtaining submodule is used to obtain cell coordinate information based on cell size information, page parameter information, and text layout information.

[0158] According to embodiments of this disclosure, the text layout information includes line break identifiers within the cell, and the third obtaining submodule may include: a recognition unit, a first obtaining unit, and a second obtaining unit. The recognition unit is used to recognize the line break identifiers to obtain the number of lines the text is arranged in within the cell. The first obtaining unit is used to obtain the cell's position information on the target page based on the cell size information and page parameter information. The second obtaining unit is used to obtain the cell coordinate information based on the position information and the number of lines.

[0159] According to embodiments of this disclosure, the second obtaining unit may include: a first obtaining subunit, a second obtaining subunit, and a third obtaining subunit. The first obtaining subunit is used to obtain multiple target cells located in the same row based on the arrangement position information. The second obtaining subunit is used to obtain the height information of the multiple target cells based on the row number information. The third obtaining subunit is used to obtain cell coordinate information based on the arrangement position information and the height information.

[0160] According to embodiments of this disclosure, the second obtaining subunit is used to sort the row number information of multiple target cells to obtain a sorting result. Height information is then obtained based on the sorting result.

[0161] According to embodiments of this disclosure, the text layout information includes information on the arrangement of text within a cell, text size information, and line break identifier information. The second obtaining module may include a first determining submodule, a fourth obtaining submodule, and a fifth obtaining submodule. The first determining submodule is used to determine a target strategy based on the arrangement information. The fourth obtaining submodule is used to obtain the number of lines of text within a cell based on the line break identifier information. The fifth obtaining submodule is used to obtain text coordinate information based on the target strategy, according to the cell coordinate information, text size information, arrangement information, and number of lines.

[0162] According to embodiments of this disclosure, the text size information includes text height information and text width information. The fifth obtaining submodule may include: a third obtaining unit, a fourth obtaining unit, and a fifth obtaining unit. The third obtaining unit is used to obtain the text's horizontal coordinate information based on cell coordinate information, text width information, and layout information. The fourth obtaining unit is used to obtain the text's vertical coordinate information based on the target strategy, according to the cell coordinate information, text height information, and number of rows. The fifth obtaining unit is used to obtain the text coordinate information based on the text's horizontal and vertical coordinate information.

[0163] According to embodiments of this disclosure, the third obtaining unit may include a determining subunit and a fourth obtaining subunit. The determining subunit is used to determine the horizontal offset parameter information of the text based on the layout information. The fourth obtaining subunit is used to obtain the horizontal coordinate information of the text based on the offset parameter information, the text width information, and the cell coordinate information.

[0164] According to embodiments of this disclosure, the cell coordinate information includes left vertex coordinate information and right vertex coordinate information. The fourth obtaining sub-unit is used to: obtain cell width information based on the left vertex coordinate information and right vertex coordinate information; when the layout information is determined to be center aligned, obtain the text horizontal coordinate information based on the left vertex coordinate information, cell width information, and text width information; when the layout information is determined to be left aligned, obtain the text horizontal coordinate information based on the left vertex coordinate information and offset parameter information; when the layout information is determined to be right aligned, obtain the text horizontal coordinate information based on the right vertex coordinate information, text width information, and offset parameter information.

[0165] According to embodiments of this disclosure, the fourth obtaining unit may include a fifth obtaining subunit and a sixth obtaining subunit. The fifth obtaining subunit is used to obtain the minimum cell height information based on the cell coordinate information. The sixth obtaining subunit is used to obtain the text vertical coordinate information based on the top-left vertex coordinate information, the minimum cell height information, the text height information, and the number of rows.

[0166] According to embodiments of this disclosure, the row number information includes the number of rows of text within a cell and the maximum number of rows of text within multiple cells in the same row; the sixth obtaining sub-unit is used to: when the layout method information is determined to be top aligned, obtain the text vertical coordinate information based on the top-left vertex coordinate information, the minimum cell height information, the text height information, and the maximum number of rows of text. When the layout method information is determined to be center aligned or bottom aligned, obtain the text vertical coordinate information based on the top-left vertex coordinate information, the minimum cell height information, the text height information, the number of rows of text within a cell, and the maximum number of rows of text.

[0167] According to embodiments of this disclosure, the generation module may include a second determining submodule, a filling submodule, a generating submodule, and a sixth obtaining submodule. The second determining submodule is used to determine the target cell based on text content information. The filling submodule is used to fill the text content information into the target cell according to text coordinate information. The generating submodule is used to arrange the target cells on the target page according to cell coordinate information to generate a target table. The sixth obtaining submodule is used to process the cell coordinate information, text coordinate information, and text content information according to a predetermined data format to obtain labeled data.

[0168] According to embodiments of this disclosure, the table generation apparatus may further include a second acquisition module and a third acquisition module. The second acquisition module is used to acquire a table border line template. The third acquisition module is used to construct border lines on a target table according to the table border line template and cell coordinate information, thereby obtaining a first table image.

[0169] According to embodiments of this disclosure, the table generation apparatus may further include a third acquisition module, a selection module, and a fourth acquisition module. The third acquisition module is used to acquire a set of seal material images. The selection module is used to randomly select a target seal image from the set of seal material images. The fourth acquisition module is used to process the target seal image and the first table image to obtain a second table image.

[0170] According to embodiments of this disclosure, the fourth obtaining module may include a seventh obtaining submodule, an eighth obtaining submodule, and a ninth obtaining submodule. The seventh obtaining submodule is used to crop the target seal image to obtain a partial seal image. The eighth obtaining submodule is used to remove the background color from the partial seal image to obtain a target partial seal image. The ninth obtaining submodule is used to process the target partial seal image and the first table image to obtain a second table image.

[0171] According to embodiments of this disclosure, the ninth obtaining submodule may include a sixth obtaining unit and a seventh obtaining unit. The sixth obtaining unit is used to fuse the target partial stamp image and the first table image to obtain a table image with the target partial stamp. The seventh obtaining unit is used to filter the table image with the target partial stamp to obtain a second table image.

[0172] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0173] According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method described above.

[0174] According to embodiments of the present disclosure, a non-transitory computer-readable storage medium stores computer instructions, wherein the computer instructions are used to cause a computer to perform the method described above.

[0175] According to an embodiment of this disclosure, a computer program product includes a computer program that, when executed by a processor, implements the method described above.

[0176] Figure 11 A schematic block diagram of an example electronic device 1100 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0177] like Figure 11 As shown, device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1102 or a computer program loaded from storage unit 1108 into random access memory (RAM) 1103. The RAM 1103 may also store various programs and data required for the operation of device 1100. The computing unit 1101, ROM 1102, and RAM 1103 are interconnected via bus 1104. Input / output (I / O) interface 1105 is also connected to bus 1104.

[0178] Multiple components in device 1100 are connected to I / O interface 1105, including: input unit 1106, such as keyboard, mouse, etc.; output unit 1107, such as various types of monitors, speakers, etc.; storage unit 1108, such as disk, optical disk, etc.; and communication unit 1109, such as network card, modem, wireless transceiver, etc. Communication unit 1109 allows device 1100 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0179] The computing unit 1101 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1101 performs the various methods and processes described above, such as the table generation method. For example, in some embodiments, the table generation method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1100 via ROM 1102 and / or communication unit 1109. When the computer program is loaded into RAM 1103 and executed by the computing unit 1101, one or more steps of the table generation method described above may be performed. Alternatively, in other embodiments, the computing unit 1101 may be configured to perform the table generation method by any other suitable means (e.g., by means of firmware).

[0180] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0181] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0182] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0183] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0184] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0185] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, distributed system servers, or servers incorporating blockchain technology.

[0186] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0187] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for generating a table, comprising: The text content information and the layout information of the target page are obtained. The layout information of the target page includes page parameter information, cell layout information, and text layout information. The cell layout information includes at least column width ratio information and relative position information between cells. The text layout information includes at least the text arrangement information in the cells, text size information, and text wrapping information within the cells. The column width ratio information represents the ratio between the width of other cells in the row with the most columns and the width of the smallest cell in the table. Based on the page parameter information, the column width ratio information and relative position information between cells in the cell layout information, and the line break information of text within the cell in the text layout information, the cell coordinate information is obtained; Based on the text layout information and the cell coordinate information, the text coordinate information is obtained; and Based on the cell coordinate information, the text coordinate information, and the text content information, a target table and corresponding annotation data are generated.

2. The method according to claim 1, wherein, The process of obtaining cell coordinate information based on the page parameter information, the column width ratio information and relative position information between cells in the cell layout information, and the line break information of text within the cell in the text layout information includes: Based on the page parameter information and the column width ratio information of the cell, the minimum cell width information is obtained; Based on the minimum cell width information and the relative position information, the cell width information is obtained; and The cell coordinate information is obtained based on the cell width information, the page parameter information, and the text layout information.

3. The method according to claim 2, wherein, The step of obtaining the cell coordinate information based on the cell width information, the page parameter information, and the text layout information includes: By identifying the line break identifier information, the number of lines in which the text is arranged within the cell can be obtained; Based on the cell width information and the page parameter information, the cell layout position information on the target page is obtained; and The cell coordinate information is obtained based on the layout position information and the layout row number information.

4. The method according to claim 3, wherein, The step of obtaining the cell coordinate information based on the layout position information and the layout row number information includes: Based on the arrangement position information, multiple target cells located in the same row are obtained; Based on the row number information, the height information of the multiple target cells is obtained; and The cell coordinate information is obtained based on the arrangement position information and the height information.

5. The method according to claim 4, wherein, The step of obtaining the height information of the multiple target cells based on the row number information includes: Sort the row number information of the multiple target cells to obtain the sorting result; and The height information is obtained based on the sorting result.

6. The method according to claim 1, wherein, The step of obtaining text coordinate information based on the text layout information and the cell coordinate information includes: Based on the layout information, a target strategy is determined; wherein, the target strategy represents the calculation strategy for different text coordinates configured for different layouts; Based on the line break information, the number of lines in which the text is arranged within the cell is obtained; and Based on the target strategy, the text coordinate information is obtained according to the cell coordinate information, the text size information, the layout information, and the number of layout rows.

7. The method according to claim 6, wherein, The text size information includes text height information and text width information. The process of obtaining the text coordinate information based on the target strategy, according to the cell coordinate information, the text size information, the layout method information, and the number of rows, includes: Based on the cell coordinate information, the text width information, and the layout information, the horizontal coordinate information of the text is obtained; Based on the target strategy, the text vertical coordinate information is obtained according to the cell coordinate information, the text height information, and the number of rows; and The text coordinate information is obtained based on the horizontal and vertical coordinate information of the text.

8. The method according to claim 7, wherein, The step of obtaining the horizontal coordinate information of the text based on the cell coordinate information, the text width information, and the layout information includes: Based on the layout information, determine the horizontal offset parameters of the text; and The horizontal coordinate information of the text is obtained based on the offset parameter information, the text width information, and the cell coordinate information.

9. The method according to claim 8, wherein, The cell coordinate information includes left vertex coordinate information and right vertex coordinate information. The step of obtaining the text horizontal coordinate information based on the offset parameter information, the text width information, and the cell coordinate information includes: Based on the coordinates of the left and right vertices, the cell width information is obtained; If the layout information is determined to be center aligned, the horizontal coordinate information of the text is obtained based on the coordinate information of the left vertex, the cell width information, and the text width information. If the layout information is determined to be left-aligned, the horizontal coordinate information of the text is obtained based on the left vertex coordinate information and the offset parameter information; and If the layout information is determined to be right-aligned, the horizontal coordinate information of the text is obtained based on the right vertex coordinate information, the text width information, and the offset parameter information.

10. The method according to claim 7, wherein, The cell coordinate information includes the coordinates of the top-left vertex of the cell. The step of obtaining the text ordinate information based on the target strategy, according to the cell coordinate information, the text height information, and the number of rows, includes: Based on the cell coordinate information, the minimum cell height information is obtained; and The vertical coordinate information of the text is obtained based on the coordinate information of the top left vertex, the height information of the minimum cell, the height information of the text, and the number of rows.

11. The method according to claim 10, wherein, The row number information includes the number of rows of text within a cell and the maximum number of rows of text within multiple cells in the same row; The step of obtaining the text ordinate information based on the top-left vertex coordinate information, the minimum cell height information, the text height information, and the number of rows includes: If the layout information is determined to be top aligned, the text vertical coordinate information is obtained based on the top left vertex coordinate information, the minimum cell height information, the text height information, and the maximum number of rows. as well as If the layout information is determined to be center-aligned or bottom-aligned, the vertical coordinate information of the text is obtained based on the coordinate information of the top left vertex, the minimum cell height, the text height, the number of rows of text within the cell, and the maximum number of rows.

12. The method according to claim 1, wherein, The step of generating a target table and corresponding annotation data based on the cell coordinate information, the text coordinate information, and the text content information includes: Based on the text content information, determine the target cell; Fill the target cell with the text content information according to the text coordinate information; The target cells are arranged on the target page according to the cell coordinate information to generate the target table; and The cell coordinate information, the text coordinate information, and the text content information are processed according to a predetermined data format to obtain the annotation data.

13. The method according to claim 1, further comprising: Get the table border line template; as well as According to the table border line template, and based on the cell coordinate information, border lines are constructed on the target table to obtain the first table image.

14. The method of claim 13, further comprising: Obtain a set of seal image materials; Randomly select a target seal image from the set of seal material images; as well as The target stamp image and the first table image are processed to obtain the second table image.

15. The method according to claim 14, wherein, The process of processing the target seal image and the first table image to obtain the second table image includes: The target seal image is cropped to obtain a partial seal image; The background color is removed from the partial seal image to obtain the target partial seal image; and The target partial stamp image and the first table image are processed to obtain the second table image.

16. The method according to claim 15, wherein, The process of processing the target partial seal image and the first table image to obtain the second table image includes: The target partial seal image and the first table image are fused together to obtain a table image with the target partial seal; and The table image with the target partial stamp is filtered to obtain the second table image.

17. A table generation apparatus, comprising: The first acquisition module is used to acquire text content information and the layout information of the target page. The layout information of the target page includes page parameter information, cell layout information, and text layout information. The cell layout information includes at least column width ratio information and relative position information between cells. The text layout information includes at least the text arrangement information in the cells, text size information, and line break information within the cells. The column width ratio information represents the ratio between the width of other cells in the row with the most columns and the width of the smallest cell in the table. The first obtaining module is used to obtain cell coordinate information based on the page parameter information, the column width ratio information in the cell layout information and the relative position information between cells, and the line break information of the text in the cell in the text layout information; The second obtaining module is used to obtain text coordinate information based on the text layout information and the cell coordinate information; and The generation module is used to generate a target table and corresponding annotation data based on the cell coordinate information, the text coordinate information, and the text content information.

18. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-16.

19. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-16.

20. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-16.