Method, device and medium for mining PDF tables in PDF files

By setting target keywords and configuration information in the PDF file, parsing the PDF file to determine feature rows and columns, the PDF table content extraction without identifying table segments is achieved, and the traditional method of identifying table segments is solved. and extraction difficulties improve the accuracy of extraction.

CN114201620BActive Publication Date: 2025-01-14SHANGHAI SUNTIME INFORMATION TECHN CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111554602.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2025-01-14
Estimated Expiration
2041-12-17

AI Technical Summary

Technical Problem

When mining PDF tables in PDF files, traditional methods need to identify table line segments, and the accuracy of extracting mixed, superimposed, and offset table content is not high, so it is impossible to accurately extract the content in the cell, especially when the table line segment is hidden or In the case of irregularity.

Method used

By setting target keywords and related configuration information, the PDF file is parsed to obtain text information, determine feature rows and feature columns, and obtain the cell content of the PDF table based on these features, without relying on obvious table segment recognition.

Benefits of technology

It realizes the accurate extraction of complex table content without identifying table segments, and improves the accuracy of table recognition and content extraction, especially when the table format is not standardized or the content is mixed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114201620B_ABST
    Figure CN114201620B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to a method, device and medium for mining a PDF table in a PDF file, wherein the method includes setting a target keyword and configuration information associated with the target keyword for a PDF table; parsing the PDF file to obtain text information in the PDF file; determining first text information based on the configuration information and the obtained text information; determining second text information based on a predefined position of the target keyword in the first text information and the first text information; verifying whether the second text information belongs to a feature row of the PDF table based on the extracted features of the PDF table to determine the feature row of the PDF table; determining a feature column of the PDF table based on the target keyword and the first text information; and obtaining text information of a cell of the PDF table according to the determined feature row and feature column.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure generally relate to the field of data processing, and more particularly to a method, a computing device, and a computer-readable storage medium for mining PDF tables in a PDF file. Background Art

[0002] PDF (Portable Document Format) is an electronic document format developed by Adobe, which has the characteristics of being independent of the operating system platform. PDF is a layout document, and the pages are relatively independent, so that the document layout can be accurately described and the document layout can be displayed. However, PDF does not record the logical structure of the document. Therefore, a solution for mining PDF tables in PDF files is needed. Mining PDF tables in PDF files includes identifying the table structure of the PDF table and extracting table data based on the identified table structure.

[0003] Traditional methods for mining PDF tables include: identifying table lines and table contents in PDF tables separately; and extracting tables through image processing. In the first method, table lines may be drawn with path operators, which may be represented as formula fraction lines, vector graphics, curved characters and other elements, while table contents include various character tables, which are often mixed with other contents on the page and are not easy to mine. For the second method, it is necessary to identify the table lines through images, so as to determine the table frame and extract the area inside the frame, and finally perform OCR recognition on the image of the area inside the frame.

[0004] In traditional solutions for mining PDF tables, table recognition is based on prominent table segments. If the table hides its table segments or the table segments are presented in an irregular way, traditional table mining solutions often cannot accurately recognize the table. At the same time, for table contents that include mixed, superimposed, offset characters, etc., the accuracy of direct reading is not high.

[0005] In summary, the traditional solution for mining PDF tables in PDF files has the following shortcomings: it must rely on table identification segments to identify cells and cannot accurately extract the contents in the cells of the PDF table. Summary of the invention

[0006] To address the above problems, the present disclosure provides a method, a computing device, and a computer-readable storage medium for mining PDF tables in PDF files, which can accurately extract complex table contents without identifying table identification segments.

[0007] According to a first aspect of the present disclosure, a method for mining a PDF table in a PDF file is provided, comprising: setting a target keyword and configuration information associated with the target keyword for a PDF table; parsing the PDF file to obtain text information in the PDF file; determining first text information based on the configuration information and the obtained text information; determining second text information based on a predefined position of the target keyword in the first text information and the first text information; verifying whether the second text information belongs to a feature row of the PDF table based on the extracted features of the PDF table to determine the feature row of the PDF table; determining a feature column of the PDF table based on the target keyword and the first text information; and obtaining text information of a cell of the PDF table according to the determined feature row and feature column.

[0008] According to a second aspect of the present disclosure, a computing device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method of the first aspect of the present disclosure.

[0009] In a third aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute the method of the first aspect of the present disclosure.

[0010] In some embodiments, verifying whether the second text information belongs to a feature row of a PDF table includes: if the second text information conforms to the features of the PDF table, determining that the second text information belongs to the feature row of the PDF table; and if the second text information does not conform to the features of the PDF table, adjusting a predefined position of the target keyword in the first text information so as to redetermine the second text information.

[0011] In some embodiments, determining the second text information includes: determining the right horizontal coordinate, upper vertical coordinate and lower vertical coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information; in the first text information, determining text information that satisfies at least one of the following items as candidate text information: being located to the right of the right horizontal coordinate of the target keyword; having an upper vertical coordinate that differs from the upper vertical coordinate of the target keyword by a first threshold; having a lower vertical coordinate that differs from the lower vertical coordinate of the target keyword by a first threshold; and extracting, from the determined candidate text information, text information that is on the same page as the target keyword and is different from the target keyword as the second text information.

[0012] In some embodiments, determining the second text information includes: determining the left horizontal coordinate, right horizontal coordinate and lower vertical coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information; in the first text information, determining text information that satisfies at least one of the following as candidate text information: being relatively below the lower vertical coordinate of the target keyword; having an upper vertical coordinate that differs from the lower vertical coordinate of the target keyword by a second threshold; having a left horizontal coordinate and a right horizontal coordinate that intersect with the interval from the left horizontal coordinate to the right horizontal coordinate of the target keyword; in the determined candidate text information, extracting text information that is on the same page as the target keyword, different from the target keyword, and does not conform to the characteristics of the PDF table as middle characters; and determining the second text information based on the extracted middle characters.

[0013] In some embodiments, determining the second text information includes: determining the length, width, lower vertical coordinate and right horizontal coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information; in the first text information, determining text information that satisfies at least one of the following items as candidate text information: the lower vertical coordinate of the target keyword is relatively below; the right horizontal coordinate of the target keyword is relatively to the right; has a horizontal coordinate and a vertical coordinate within a range consisting of a third threshold multiple of the width of the target keyword and a fourth threshold multiple of the length of the target keyword; and, from the determined candidate text information, extracting text information that is on the same page as the target keyword, different from the target keyword and satisfies the characteristics of the PDF table as the second text information.

[0014] In some embodiments, determining the second text information includes: determining the upper vertical coordinate and the left horizontal coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information; in the first text information, determining text information that satisfies at least one of the following items as candidate text information: being located relatively above the upper vertical coordinate of the target keyword; being located relatively to the right of the target keyword; having a left horizontal coordinate that differs from the left horizontal coordinate of the target keyword by a fifth threshold range; and extracting, from the determined candidate text information, text information that is on the same page as the target keyword, is different from the target keyword, satisfies the characteristics of the PDF table, and has a field length within a sixth threshold range as the second text information.

[0015] In some embodiments, determining the second text information includes: sorting the determined second text information; verifying whether the sorted second text information has a text string; and if the sorted second text information has a text string, removing the text string and all text after the text string on the horizontal axis.

[0016] In some embodiments, verifying whether the second text information belongs to a feature row of the PDF table includes: determining a regular expression expressing the feature based on a feature in the feature row of the PDF table; verifying whether the second text information conforms to the regular expression; and if the second text information conforms to the regular expression, determining that the row where the second text information is located is a feature row of the PDF table.

[0017] In some embodiments, determining the feature columns of the PDF table further includes: determining the left horizontal coordinate and the right horizontal coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information; determining, in the first text information, text information whose left horizontal coordinate and right horizontal coordinate have an intersection with the interval from the left horizontal coordinate to the right horizontal coordinate of the target keyword; and extracting, from the determined text information, text information that is on the same page as the target keyword, is different from the target keyword, and does not include predetermined special characters; and determining the extracted text information as the feature columns of the PDF table.

[0018] In some embodiments, obtaining text information of cells of the PDF table based on the determined feature rows and feature columns also includes: determining the vertical axis coordinate and horizontal axis coordinate of the PDF table based on the determined left horizontal coordinate and right horizontal coordinate of the feature rows of the PDF table and the upper vertical coordinate and lower vertical coordinate of the feature columns of the PDF table; and obtaining cells of the PDF table based on the vertical axis coordinate and horizontal axis coordinate of the PDF table.

[0019] In some embodiments, acquiring cells of a PDF table based on the vertical axis coordinates and horizontal axis coordinates of the PDF table includes: determining the left horizontal coordinate, right horizontal coordinate, upper vertical coordinate, and lower vertical coordinate of all text information in the feature rows and feature columns of the PDF table based on the feature rows and feature columns of the PDF table; and acquiring text information that satisfies at least one of the following as text information of a cell of the PDF table: a left horizontal coordinate having a difference of the seventh threshold value from the left horizontal coordinate of all text information in the feature row; a right horizontal coordinate having a difference of the seventh threshold value from the right horizontal coordinate of all text information in the feature row; an upper vertical coordinate having a difference of the eighth threshold value from the upper vertical coordinate of all text information in the feature column; and a lower vertical coordinate having a difference of the eighth threshold value from the lower vertical coordinate of all text information in the feature row.

[0020] In some embodiments, the above method also includes: determining the feature row as a year information row; determining the feature column as an indicator identification column; and determining the text information located to the right of the indicator identification column and having the same row position information as the indicator identification and located below the year information row and having the same column position information as the year information row as a numerical value associated with the year information and the indicator identification.

[0021] In some embodiments, the above method also includes: constructing an organization key feature array regarding multiple organizations associated with the PDF form, the organization key feature array including: the number of key features associated with the organization, the key features and the weights corresponding to the key features; based on the organization key feature array, searching for text information extracted based on the PDF form to determine the number of times the key features associated with the organization appear; and based on the calculated number of times the key features associated with the organization appear, generating an organization weight sequence for determining the target associated organization of the PDF form.

[0022] In some embodiments, determining the target associated institution of the PDF form also includes: determining the institution corresponding to the maximum value in the institution weight sequence; determining whether the number of institutions corresponding to the maximum value is 1; in response to determining that the number of institutions corresponding to the maximum value is 1, determining that the institution corresponding to the maximum value is the target associated institution of the PDF form; and in response to determining that the number of institutions corresponding to the maximum value is greater than 1, determining that the target associated institution is not identified.

[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements.

[0025] Figure 1 An example diagram showing a PDF form used according to an embodiment of the present disclosure.

[0026] Figure 2 A schematic diagram of a system 200 for implementing a method for mining a PDF table in a PDF file according to an embodiment of the present disclosure is shown.

[0027] Figure 3 A flowchart of a method 300 for mining a PDF table in a PDF file according to an embodiment of the present disclosure is shown.

[0028] Figure 4 A flowchart of a method 400 for verifying whether second text information belongs to a feature row of a PDF table according to an embodiment of the present disclosure is shown.

[0029] Figure 5 A flowchart of a method 500 for determining second text information according to an embodiment of the present disclosure is shown.

[0030] Figure 6 A schematic diagram showing first text information including a target keyword according to an embodiment of the present disclosure is shown.

[0031] Figure 7 A flowchart of a method 700 for determining second text information according to an embodiment of the present disclosure is shown.

[0032] Figure 8 A schematic diagram showing first text information including a target keyword according to an embodiment of the present disclosure is shown.

[0033] Fig. 9 A flowchart of a method 900 for determining second text information according to an embodiment of the present disclosure is shown.

[0034] Fig.10 A schematic diagram showing first text information including a target keyword according to an embodiment of the present disclosure is shown.

[0035] Fig.11 A flowchart of a method 1100 for determining second text information according to an embodiment of the present disclosure is shown.

[0036] Fig.12 A schematic diagram showing first text information including a target keyword according to an embodiment of the present disclosure is shown.

[0037] Fig.13 A flowchart of a method 1300 for determining second text information according to an embodiment of the present disclosure is shown.

[0038] Fig.14 A flowchart of a method 1400 for verifying whether second text information belongs to a feature row of a PDF table according to an embodiment of the present disclosure is shown.

[0039] Fig.15 A flowchart of a method 1500 for determining feature columns of a PDF table according to an embodiment of the present disclosure is shown.

[0040] Fig.16 A flowchart of a method 1600 for acquiring cell information of a PDF table according to determined characteristic rows and characteristic columns according to an embodiment of the present disclosure is shown.

[0041] Fig.17A flowchart of a method 1700 for acquiring cells of a PDF table based on the vertical axis coordinate and the horizontal axis coordinate of the PDF table according to an embodiment of the present disclosure is shown.

[0042] Fig.18 A flowchart of a method 1800 for mining a PDF table in a PDF file according to an embodiment of the present disclosure is shown.

[0043] Fig.19 A flowchart of a method 1900 for mining a PDF table in a PDF file according to an embodiment of the present disclosure is shown.

[0044] Fig. 20 A flowchart of a method 2000 for determining a target association organization of a PDF form according to an embodiment of the present disclosure is shown.

[0045] Fig.21 A block diagram of an electronic device 2100 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0046] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0047] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0048] As described above, tables with hidden table segments or tables constructed in irregular ways such as fractional lines, vector diagrams, and curved characters cannot be mined by traditional methods for mining PDF tables in PDF files. Without accurate identification of table segments, traditional table mining solutions may not be able to accurately extract table content. Since PDF tables do not have a unified format, table content may have mixed, overlapping, and offset characters. Directly reading the table content will cause data cross-cell confusion. At the same time, the confusion of data reading of several cells may be chained to the mining process of adjacent cells, and finally lead to mining errors or invalid processing of the overall table content. This is particularly prominent in tables in the financial field (for example, income statements, balance sheets, and cash flow statements) where there are a large number of numbers and the cell separation is not obvious.

[0049] Figure 1 FIG. 2 shows an example diagram of a PDF table used according to an embodiment of the present disclosure. Figure 1 As shown, in the PDF tables that are processed daily, for aesthetic reasons, the PDF tables do not contain separator lines, and the data is not separated by obvious cell separator lines. In this case, although some PDF parsing tools in the prior art can parse PDF files into readable data, they cannot match the various types of data in the table with the table logic, which causes the read data to be confused. This is more obvious in financial tables that are mainly data-based (income statements, balance sheets, cash flow statements, etc.).

[0050] by Figure 1 For example, directly parsing the income statement and balance sheet in the table may cause multiple problems. For example, the different positions of the table name (table header) may cause confusion in table identification. Figure 1 In the table, the table name of the income statement ("income statement" text information) is on the next line of the year information row, while the table name of the balance sheet ("balance sheet" text information) is one table below the year information row. The income statement and balance sheet, which actually belong to two separate tables, may be merged into one whole table. Secondly, the data of the income statement and balance sheet may not correspond to the corresponding actual year (2019A) and forecast year (2020E, 2021E, 2022E). The parsing tool of some parsed PDF files can parse the table into cells such as "operating cost", "2019A", "1,064", etc., but it still cannot correspond the cell "1,064" to the year cell "2019A" above it and the corresponding indicator identification cell "operating income".

[0051] Due to the mismatch between the upper and lower cells, the data loses the corresponding additional information and becomes meaningless garbage data. This situation may be more serious in tables that include more complex strings. For example, in a cell with long data including line breaks, only part of the data may be read, while the other part of the data is directly lost.

[0052] In order to at least partially solve one or more of the above problems and other potential problems, an exemplary embodiment of the present disclosure proposes a solution for mining PDF tables in PDF files. In the solution of the present disclosure, a variety of table keywords in different positions are defined, so that the characteristic rows of the PDF table are determined by the defined table keywords. Based on the characteristic rows of the PDF table, characteristic columns can also be determined. After determining the characteristic rows and characteristic columns of the PDF table, the characteristic rows and characteristic columns can be combined into a table structure to extract the data in the table and retain the actual meaning of each data.

[0053] The present invention can locate each data cell by the determined feature rows and feature columns without relying on an obvious table structure or logical framework, so that the PDF table can be accurately mined into data with a regular structure, for example, the PDF table can be mined into Excel data forms, XML files, YAML files, etc.

[0054] In addition, the present disclosure also provides corresponding methods for further processing the mined data (for example, deep data mining, organization identification, etc.), thereby improving the sophistication of the mined data.

[0055] Figure 2 FIG. 2 is a schematic diagram of a system 200 for implementing a method for mining PDF tables in a PDF file according to an embodiment of the present disclosure. Figure 2 As shown in FIG. 2 , the system 200 includes a computing device 210, a PDF file management device 230, and a network 240. The computing device 210 and the PDF file management device 230 can perform data exchange through the network 240 (eg, the Internet).

[0056] The PDF file management device 230 can, for example, perform conventional management of PDF files, such as collecting and storing PDF files. The PDF file management device 230 can also send the managed PDF files to the computing device 210. The PDF file management device 230 is, for example, but not limited to: a desktop computer, a laptop computer, a netbook computer, a tablet computer, a web browser, an e-book reader, a personal digital assistant (PDA), and a wearable computer (such as a smart watch and an activity tracker device) that can perform PDF file reading and modification. The PDF file management device 230 can be configured to store PDF files, send PDF files to the computing device 210 via the network 240, and receive PDF files processed by the computing device 210.

[0057] Regarding the computing device 210, it is used, for example, to receive a PDF file from a PDF file management device 230 via a network 240; and mine a PDF table for the received PDF file. The computing device 210 can also determine the target association mechanism of the PDF table based on the mined PDF table, and determine the numerical value associated with the year data and the indicator identifier. The computing device 210 can have one or more processing units, including dedicated processing units such as GPU, FPGA and ASIC, and general processing units such as CPU. In addition, one or more virtual machines can also be running on each computing device 210. In some embodiments, the computing device 210 and the PDF file management device 230 can be integrated together or separately set. In some embodiments, the computing device 210 includes, for example, a keyword setting unit 212, a PDF parsing unit 214, a first text determination unit 216, a second text determination unit 218, a second text verification unit 220, a feature column determination unit 222, a text information acquisition unit 224, and an additional operation unit 226.

[0058] The keyword setting unit 212 may be configured to set a target keyword and configuration information associated with the target keyword for a PDF form.

[0059] The PDF parsing unit 214 may be configured to parse a PDF file so as to obtain text information in the PDF file.

[0060] The first text determining unit 216 may be configured to determine the first text information based on the configuration information and the acquired text information.

[0061] The second text determining unit 218 may be configured to determine the second text information based on a predefined position of the target keyword in the first text information and the first text information.

[0062] The second text verification unit 220 may be configured to verify whether the second text information belongs to a feature row of the PDF table based on the extracted features of the PDF table, so as to determine the feature row of the PDF table.

[0063] The feature column determining unit 222 may be configured to determine the feature columns of the PDF table based on the target keyword.

[0064] The text information acquisition unit 224 may be configured to acquire text information of cells of the PDF table according to the determined characteristic rows and characteristic columns.

[0065] The additional operation unit 226 may be configured to perform additional operations such as determining a target association mechanism of the PDF form and determining a value associated with the year data and the indicator identifier.

[0066] Units 212-224 can retrieve table text information in a PDF file based on table keywords. After the associated table text information is preliminarily parsed, the coordinates of each text information are determined in a plane coordinate system. The characteristic row in the table, such as the year information row, is determined based on the position of the table keyword. If the characteristic row is not found based on the position of the table keyword, the position of the table keyword is adjusted until the characteristic row of the table is determined. At the same time, the table characteristic column can be determined based on the position of the table keyword. Based on the acquired characteristic rows and characteristic columns, the position of each text information can be obtained by combination, thereby accurately mining the PDF table in the PDF file.

[0067] Based on the PDF forms mined by units 212 to 224, the additional operation unit 226 can also perform various operations on the mined forms. The processing includes but is not limited to determining the target association mechanism of the PDF form, determining the values ​​associated with the year data and the indicator identifier, etc. After the above processing is completed on the PDF file, the processed PDF form can be transmitted to the PDF file management device 230 via the network 240.

[0068] Some of the examples below will be Figure 1 The PDF table shown is used as an example to illustrate the working principle of the technical solution of the present disclosure. However, it can be understood that the PDF table applicable to the present disclosure can be expressed in many different forms, not limited to Figure 1 The form of the table.

[0069] The following combination Figure 1 , Figure 2 A method 300 for mining PDF tables in a PDF file is described. Figure 3Various paths and sequences are shown for the purpose of overall presenting the working principle of the method for mining PDF tables in PDF files, but some of these paths and sequences are not necessary for implementing the following examples. The various methods involved in the technical solution of the present disclosure may be executed in different sequences and paths.

[0070] In the context of the present disclosure, text information may also be referred to as text blocks, text boxes, and the like, which represent characters or continuous strings parsed by PDF text parsing tools commonly used in the art. A cell refers to the smallest constituent unit in the table structure of a PDF table, which includes text information.

[0071] In the context of the present disclosure, the text information in the PDF file is located by the pixel coordinates of the PDF file. The pixel coordinate values ​​of the text information can be the horizontal coordinate values ​​and the vertical coordinate values ​​in the coordinate system established by the pixels of the PDF file. In the field of PDF file processing, the top left corner of the PDF file is usually taken as the origin, the right side of the PDF file is taken as the horizontal axis positive direction, and the bottom side of the PDF file is taken as the vertical axis positive direction.

[0072] It can be understood that, based on the corresponding coordinate transformation, similar plane coordinate systems established with other points as origins can also be applied to the method for mining PDF tables in PDF files provided by the present disclosure.

[0073] Figure 3 FIG. 3 is a flowchart of a method 300 for mining PDF tables in a PDF file according to an embodiment of the present disclosure. The method 300 may be performed as follows: Figure 2 The computing device 210 shown may also be executed in Fig.21 The method 300 is executed at the electronic device 2100 shown. It should be understood that the method 300 may further include additional blocks not shown and / or may omit the blocks shown, and the scope of the present disclosure is not limited in this respect.

[0074] In step 302 , the computing device 210 sets a target keyword and configuration information associated with the target keyword for a PDF form.

[0075] In some examples, the target keywords may be different types of keywords set by the user according to needs. Taking financial tables as an example, the target keywords may be table names such as "balance sheet", "income statement", "cash flow statement", etc. These keywords are usually associated with the PDF tables desired by the user. However, the relative positions of these target keywords and PDF tables are not fixed.

[0076] In some examples, the target keyword (table name) is usually located relatively to the right of the characteristic row (e.g., the year information row) of the PDF table. In some examples, the target keyword (table name) is usually located relatively above or relatively to the upper right of the characteristic row (e.g., the year information row) of the PDF table. In some examples, the target keyword (table name) is usually located relatively below or relatively to the lower right of the characteristic row (e.g., the year information row) of the PDF table. The above situations will be described in detail below.

[0077] After setting the target keyword for the PDF form, the computing device 210 sets the associated configuration information for the target keyword. The configuration information is used to filter the PDF file, thereby avoiding missing the PDF form and avoiding obtaining noise information about the form. The configuration information associated with the target keyword includes but is not limited to PDF form filtering conditions such as the positive filtering name and the negative filtering name of the form name. The positive filtering name can be a name that is similar to the PDF form name and should be retained, while the negative filtering name is a name that is similar to the PDF form name but should be eliminated. Taking the target keyword "balance sheet" as an example, the positive filtering name can be "balance sheet", "balance sheet", etc., and the negative filtering name can be "asset table", "liability sheet", "asset-liability ratio", etc. A variety of different configuration information can be set for a target keyword.

[0078] By setting the target keyword and the configuration information associated with the target keyword, the table area of ​​the PDF table can be accurately identified in the following methods and steps, and the table information in the PDF text can be retained as much as possible while eliminating the table noise.

[0079] In step 304 , the computing device 210 parses the PDF file to obtain text information in the PDF file.

[0080] In some examples, the computing device 210 may directly use or indirectly call a commonly used PDF processing tool in the art to parse all text information of the PDF file where the PDF table is located, so as to be subsequently processed into a corresponding PDF table and cell content.

[0081] In some examples, the computing device 210 may also only parse all text information on the page where the target keyword is located in the PDF file or text information within a predetermined range around the target keyword (e.g., 300 coordinate pixels above and below the target keyword) to speed up parsing and acquiring text information in the PDF file. The predetermined range of parsing can be adjusted by the user based on experience in table processing.

[0082] The commonly used PDF processing tools used in the present disclosure may include any code, software, or library file that can parse PDF text, such as a software package or software library that can be called by a programming language such as Python or Java, including but not limited to software libraries such as PDFminer and Camelot.

[0083] It should be noted that using the commonly used processing tools in the field of PDF processing to obtain multiple text blocks in the table area only obtains the text content of the text blocks, that is, recognizes them as characters or strings that can be processed. The processing tools do not recognize the table logic of the PDF table, for example, they cannot recognize the association between the text contents of multiple text blocks in the table.

[0084] By parsing the PDF file, the text information in the PDF file can be preliminarily obtained, thereby accelerating the speed and accuracy of extracting the characteristic rows and columns of the table and the corresponding unit block text information in the subsequent steps.

[0085] At step 306 , the computing device 210 determines first text information based on the configuration information and the acquired text information.

[0086] In some examples, based on the target keyword and configuration information determined in step 302 and the text information in the PDF file parsed in step 304 , the computing device 210 performs data preprocessing and extraction to determine the first text information.

[0087] Data preprocessing can be based on user-defined preset conditions and preset characters for data cleaning. Preset conditions include text processing conditions such as blank line merging and same-page retention. Preset characters can include preset exclusion characters and preset retention characters. Preset exclusion characters include, for example, meaningless characters such as line breaks and space characters. Preset retention characters include, for example, characters with actual meanings such as numeric characters and text characters.

[0088] Data preprocessing also includes searching for target keywords in text information in the PDF file according to the configuration information. The search may optionally include filtering and retaining positively similar target keywords according to the positive screening name in the configuration information, and removing negatively similar target keywords according to the negative screening name. After the relevant processing in step 306, the computing device 210 may obtain the first text information, wherein the first text information includes the target keyword (and similar target keywords).

[0089] By determining the first text information, the PDF table in the PDF file can be preprocessed, so that the second text information of the PDF table can be determined more quickly and accurately.

[0090] At step 308 , the computing device 210 determines second text information based on the predefined position of the target keyword in the first text information and the first text information.

[0091] In some examples, the user can set a default predefined position and multiple predefined positions for the target keyword in the first text information. For example, the user can set the default predefined position of the target keyword to the upper left relative to the feature line (e.g., the year information line) of the PDF table and set multiple predefined positions. The predefined positions include, but are not limited to, the left front of the target keyword relative to the feature line of the PDF table, the lower left of the target keyword relative to the feature line of the PDF table, the upper left of the feature line of the PDF table, etc. The predefined positions can be flexibly set by the user according to the characteristics of the PDF table and are not limited to the above-mentioned positions.

[0092] The computing device 210 may retrieve the target keyword in the first text information, thereby determining the second text information of the PDF form according to the possible predefined position of the target keyword. The second text information should be text information belonging to a feature row of the PDF form. For example, if the feature row of the PDF form is a year information row, the second text information should be one or more year characters or year strings, for example, 2020, 2020A, etc.

[0093] According to various possible predefined positions of the target keyword, this step may have various execution modes. The following will specifically describe the mode of determining the second text information of the PDF form by way of example.

[0094] By determining the second text information of the PDF table, possible characteristic rows of the PDF table can be found, and thus the vertical position coordinates of each cell in the PDF table can be determined based on the characteristic rows.

[0095] In step 310 , the computing device 210 verifies whether the second text information belongs to a feature row of the PDF table based on the extracted features of the PDF table, so as to determine the feature row of the PDF table.

[0096] In some examples, the user can set different features for the extracted PDF table to verify the feature row of the PDF table. For example, when the feature row of the PDF table is a year feature row, a regular expression of the year can be set to identify the year feature.

[0097] According to the characteristics of the PDF table, the computing device 210 can verify whether the second text information belongs to the characteristic row of the PDF table. For example, the computing device 210 can verify whether the extracted year character or string (second text information) belongs to the year information row (characteristic row) of the PDF table. If the second text information belongs to the characteristic row of the PDF table, the row where the second text information is located can be determined as the characteristic row of the PDF table. Otherwise, the computing device 210 will return to step 308, readjust the predefined position of the target keyword, and redetermine the second text information.

[0098] The following will describe in detail the method of verifying whether the second text information belongs to a characteristic row of a PDF table by way of example.

[0099] In step 312 , the computing device 210 determines a feature column of the PDF table based on the target keyword and the first text information.

[0100] In some examples, since the predefined position of the target keyword is related to the feature column of the PDF table, the feature column of the PDF table is determined according to the determined predefined position of the target keyword and the acquired first text information. The feature column of the PDF table may be, for example, the first column of the table, i.e., the indicator identification column.

[0101] Based on the determined feature columns, the horizontal position coordinates of the cells in the PDF table may be determined.

[0102] The method of determining the characteristic columns of the PDF table will be described in detail below.

[0103] In step 314 , the computing device 210 obtains text information of cells of the PDF table according to the determined characteristic rows and characteristic columns.

[0104] In some examples, based on the characteristic rows and characteristic columns determined in step 308 and step 312 , the horizontal coordinates and the vertical coordinates of the cells of the PDF table may be determined in the horizontal coordinates and the vertical coordinates.

[0105] By combining the horizontal coordinate and the vertical coordinate, and optionally adding a threshold adjustment range, the position and size of the text information corresponding to each cell of the PDF table can be determined, so that the text information of the cells of the PDF table can be accurately obtained through the PDF file parsing tool.

[0106] The following describes in detail how to obtain text information of cells in a PDF table.

[0107] Figure 4 FIG. 4 is a flowchart of a method 400 for verifying whether the second text information belongs to a characteristic row of a PDF table according to an embodiment of the present disclosure. The method 400 may be performed as follows: Figure 2The computing device 210 shown may also be executed in Fig.21 The method 400 is performed at the electronic device 2100. The method 400 may correspond to step 310 in the method 300.

[0108] In step 402 , the computing device 210 performs a judgment, and if the second text information meets the characteristics of the PDF table, determines that the second text information belongs to the characteristic row of the PDF table.

[0109] In some examples, the computing device 210 performs a judgment on the second text information. If the second text information meets the characteristics of the PDF table, it is determined that the second text information belongs to the characteristic row of the PDF table. The characteristics of the PDF table can be determined by the user based on the experience of PDF table processing. For example, for financial tables, the characteristics of the PDF table can include a year information row. Therefore, features can be defined for the year information row in the financial table, such as a regular expression for the year information.

[0110] The user can design a regular expression for the year (for example, the regular expression "^(19|20)\d{2}$" which can represent all years from 1900 to 2099) to determine whether the second text information conforms to the characteristics of the PDF table. Special regular expressions can also be configured to match cells. Special year regular expressions can match years with suffix letters, for example, "2022E" with the letter "E" is identified as the predicted year 2022.

[0111] If the second text information meets the characteristics (regular expression) of the PDF table, it is determined that the second text information belongs to the characteristic row of the PDF table in step 308 of the method 300. The method 300 will continue to execute step 312.

[0112] In step 404 , the computing device 210 performs a determination, and if the second text information does not conform to the characteristics of the PDF form, adjusts the predefined position of the target keyword in the first text information to redefine the second text information.

[0113] In some examples, if the second text information does not meet the above characteristics of the PDF form (e.g., regular expression), step 310 in method 300 will return to step 308 to readjust the predefined position of the target keyword in the first text information. Since there are multiple different predefined positions in the first text information, the computing device 210 will re-determine the second text information in step 308 according to the target keywords at different predefined positions, and repeatedly iterate multiple predefined positions until the second text information meets the characteristics of the PDF form.

[0114] If the second text information obtained according to the target keywords in multiple different predefined positions cannot meet the characteristics of the PDF form, the mining of the form is abandoned, and an error is reported when uploading or the form is transferred to manual processing.

[0115] By combining steps 402 and 404 of method 400 with step 308 of method 300, the position of the target keyword in the first text information can be iteratively determined, thereby determining accurate second text information according to the determined position. The characteristic row of the PDF table can be located with the help of the second text information.

[0116] As described in method 300 , the target keyword exists in a plurality of different predefined positions in the first text information, so in the following methods 500 - 1100 , a method is provided on how to determine the second text information by iterating different predefined positions of the target keyword.

[0117] Figure 5 FIG. 5 is a flow chart showing a method 500 for determining second text information according to an embodiment of the present disclosure. The method 500 may be performed as follows: Figure 2 The computing device 210 shown may also be executed in Fig.21 The method 500 is performed at the electronic device 2100. The method 500 may correspond to step 308 in the method 300.

[0118] In some examples, the position of the target keyword in the first text information may be predefined to be at the leftmost side relative to the undetermined second text information or feature line, that is, the second text information is in the same position as the target keyword.

[0119] In step 502 , the computing device 210 determines the right horizontal coordinate, the upper vertical coordinate, and the lower vertical coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information.

[0120] Figure 6 FIG. 1 shows a schematic diagram of first text information including a target keyword according to an embodiment of the present disclosure. Figure 6 As shown, in this PDF form, the target keyword ("Financial Statement (million yuan)") is located on the far left of the right row of the PDF form feature (year information row). The feature of the PDF form (year information) can be found after the target keyword. With the help of the feature of the PDF form, the second text information of the PDF form (for example, "2019A") can be determined. Therefore, the computing device 210 can determine the right horizontal coordinate, upper vertical coordinate, and lower vertical coordinate of the target keyword ("Financial Statement (million yuan)") in the pixel coordinate system of the PDF file. With the help of the above three coordinates, the second text information to the right of the target keyword can be determined.

[0121] In step 504, the computing device 210 determines, in the first text information, text information that satisfies at least one of the following items as candidate text information: being located to the right of the right horizontal coordinate of the target keyword; having an upper vertical coordinate that differs from the upper vertical coordinate of the target keyword by a first threshold; having a lower vertical coordinate that differs from the lower vertical coordinate of the target keyword by a first threshold.

[0122] In some examples, since the target keyword is on the leftmost side of the first text information, the computing device 210 can determine the second text information in the area on the right relative to the right horizontal coordinate of the target keyword. Since the second text information (e.g., year information) may have a certain pixel difference with the target keyword in the longitudinal axis. Therefore, when determining the second text information, a threshold range with a certain pixel value can be set on the longitudinal axis. For example, the threshold range can be determined as 5 pixels in the longitudinal axis. For example, in the longitudinal axis, all text information whose upper longitudinal coordinate is less than 5 pixels from the upper longitudinal coordinate of the target keyword and whose lower longitudinal coordinate is less than 5 pixels from the lower longitudinal coordinate of the target keyword can be determined as the candidate second text information, and verified in the next step.

[0123] It should be noted that the threshold range can be adjusted according to the size of the text information in the PDF table. For example, 1 pixel, 3 pixels, or a pixel interval of 1-10 pixels can be used as the threshold range.

[0124] In step 506 , the computing device 210 extracts text information that is on the same page as the target keyword and is different from the target keyword from the determined candidate text information as the second text information.

[0125] In some examples, the computing device 210 filters the text information determined in step 504 according to some other additional conditions. The other additional conditions may include that the second text information should be on the same page as the target keyword, the text information in the second text information is different from the target keyword, etc.

[0126] Exemplary pseudo code for determining the second text information is provided herein.

[0127] if abs(pi['y0']-table_key['y0'])<=5and abs(pi['y1']-table_key['y1'])<=5\

[0128] and pi['page_number']==table_key['page_number']\

[0129] and pi['number']! =table_key['number']\

[0130] and pi['x1']>table_key['x0']

[0131] In the pseudo code, parameters y0 and y1 represent the upper and lower vertical coordinates, parameters x0 and x1 represent the right and left horizontal coordinates, page_number represents the page number, number represents the text length, table_key represents the target keyword, and pi represents the second text information to be matched.

[0132] Therefore, the multiple conditions in the pseudocode correspond respectively to the upper vertical coordinate and lower vertical coordinate of the second text information being within a threshold range from the upper vertical coordinate and lower vertical coordinate of the target keyword; the second text information and the target keyword are on the same page; the second text information and the target keyword are different; and the right horizontal coordinate of the target keyword is smaller than the left horizontal coordinate of the second text information.

[0133] It should be noted that what is shown above is only a pseudo code of the traversal operation, and the traversal operation can be implemented in any programming language based on the pseudo code.

[0134] By respectively executing the above steps and the conditions corresponding to the above steps, the computing device 210 can determine the second text information to the right of the target keyword according to the position of the target keyword, and then determine the characteristic row of the PDF table. The second text information will be verified in the above verification step.

[0135] Figure 7 FIG. 7 is a flowchart of a method 700 for determining second text information according to an embodiment of the present disclosure. The method 700 may be performed as follows: Figure 2 The computing device 210 shown may also be executed in Fig.21 The method 700 is performed at the electronic device 2100. The method 700 may correspond to step 308 in the method 300.

[0136] In some examples, the position of the target keyword in the first text information may be predefined to be above a line relative to the undetermined second text information or feature, that is, the second text information is located in a line below the target keyword.

[0137] In step 702 , the computing device 210 determines the left horizontal coordinate, the right horizontal coordinate, and the bottom vertical coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information.

[0138] Figure 8 FIG. 1 shows a schematic diagram of first text information including a target keyword according to an embodiment of the present disclosure. Figure 8As shown, in this PDF table, the target keyword ("Financial statements and main financial ratios") is located above the PDF table feature row (year information row). The feature row of the PDF table can be found below the target keyword. With the help of the characteristics of the PDF table, it can be determined that there is an intermediate character ("Financial statements (million yuan)") before the second text information of the PDF table (for example, "2019A"). Therefore, the computing device 210 can determine the left horizontal coordinate, right horizontal coordinate and lower vertical coordinate of the target keyword ("Financial statements (million yuan)") in the pixel coordinate system of the PDF file. With the help of the above three coordinates, the middle character below the target keyword can be determined, and then the second text information after the middle character can be found.

[0139] In step 704, the computing device 210 determines, in the first text information, text information that satisfies at least one of the following items as candidate text information: being relatively below the lower vertical coordinate of the target keyword; having an upper vertical coordinate that differs from the lower vertical coordinate of the target keyword by a second threshold; having a left horizontal coordinate and a right horizontal coordinate that intersect with the interval from the left horizontal coordinate to the right horizontal coordinate of the target keyword.

[0140] In some examples, since the target keyword is located in the upper middle of the first text information, the computing device 210 can determine the middle character in the area relatively below the lower ordinate of the target keyword, and then determine the second text information to the right of the middle character. Since the middle character (e.g., "Financial Statement (million yuan)") is contained in the horizontal axis of the target keyword and may have a certain pixel difference with the target keyword in the vertical axis. Therefore, the position of the middle character can be determined based on the horizontal axis and a threshold value with a certain pixel value configured on the vertical axis. For example, the horizontal axis coordinate of the middle character may have an intersection with the horizontal axis coordinate of the target keyword, and the lower ordinate coordinate of the middle character has a certain threshold range relative to the upper ordinate of the target keyword. For example, the lower ordinate of the target keyword differs from the upper ordinate of the middle character by less than 100 pixels. By determining the middle character of the feature line, the text information to the right of the middle character can be determined as the second text information, and verified in the next step.

[0141] It should be noted that the threshold range can be adjusted according to the size of the text information in the PDF table. For example, the difference less than 50 pixels, the difference less than 150 pixels, and the difference less than 200 pixels can all be used as the threshold range.

[0142] At step 706 , the computing device 210 extracts text information that is on the same page as the target keyword, is different from the target keyword, and does not conform to the features of a PDF table as middle characters from the determined candidate text information.

[0143] In some examples, computing device 210 filters the text information determined in step 504 according to some other additional conditions. Other additional conditions may include being on the same page as the target keyword, being different from the target keyword, and not conforming to the characteristics of the PDF table (e.g., regular expressions for year information), etc.

[0144] Example pseudo code for determining the middle character is provided here.

[0145]

[0146] In the pseudocode, parameters y0 and y1 represent the upper and lower vertical coordinates, parameters x0 and x1 represent the right and left horizontal coordinates, page_number represents the page number, number represents the text length, and text represents the text.

[0147] Therefore, the multiple conditions in the pseudocode correspond to the intersection of the interval of the left horizontal coordinate and the right horizontal coordinate of the middle character and the interval of the left horizontal coordinate and the right horizontal coordinate of the target keyword; the middle character and the target keyword are on the same page; the middle character is different from the target keyword; the middle character does not conform to the regular expression of the year information (a feature of the PDF table); the difference between the lower vertical coordinate of the target keyword and the upper vertical coordinate of the middle character is less than 100 pixels.

[0148] It should be noted that what is shown above is only a pseudo code of the traversal operation, and the traversal operation can be implemented in any programming language based on the pseudo code.

[0149] At step 708 , the computing device 210 determines second text information based on the determined candidate middle characters.

[0150] By means of the middle character, the upper ordinate and lower ordinate interval of the middle character can be determined as the characteristic row of the PDF table. The text information in the upper ordinate and lower ordinate interval of the middle character and to the right of its horizontal axis coordinate can be determined as the second text information.

[0151] By respectively executing the above steps and the conditions corresponding to the above steps, the computing device 210 can determine the middle character associated with the second text information below the target keyword through the position of the target keyword, and then determine the characteristic row of the PDF table through the second text information. The second text information will be verified in the above verification step.

[0152] Fig. 9 FIG. 9 is a flowchart of a method 900 for determining second text information according to an embodiment of the present disclosure. The method 900 may be performed as follows: Figure 2 The computing device 210 shown may also be executed in Fig.21The method 900 is executed at the electronic device 2100. The method 900 may correspond to step 308 in the method 300.

[0153] In some examples, the position of the target keyword in the first text information can be predefined at the upper left relative to the undetermined second text information or feature line, that is, the second text information is at the lower right position of the target keyword. However, in this case, the second text information can be directly determined without the aid of intermediate characters.

[0154] At step 902 , the computing device 210 determines the length, width, lower vertical coordinate, and right horizontal coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information.

[0155] Fig.10 FIG. 1 shows a schematic diagram of first text information including a target keyword according to an embodiment of the present disclosure. Figure 6 As shown, in this PDF table, the target keyword ("Balance Sheet (million yuan)") is located on the upper right side of the PDF table feature row (year information row). The features of the PDF table (year information) can be found in the lower right corner after the target keyword. With the help of the features of the PDF table, the second text information of the PDF table (for example, "2019A") can be determined. Therefore, the computing device 210 can determine the length, width, lower vertical coordinate and right horizontal coordinate of the target keyword ("Balance Sheet (million yuan)") in the pixel coordinate system of the PDF file. With the help of the above four values, a range for searching the second text information to the right of the target keyword can be determined.

[0156] In step 904, the computing device 210 determines, in the first text information, text information that satisfies at least one of the following items as candidate text information: the vertical coordinate below the target keyword is relatively below; the horizontal coordinate to the right of the target keyword is relatively to the right; and the horizontal coordinate and the vertical coordinate are within a range consisting of a third threshold multiple of the width of the target keyword and a fourth threshold multiple of the length of the target keyword.

[0157] In some examples, since the target keyword is located in the upper left corner of the first text information, the computing device 210 may determine the second text information in an area that is relatively below the lower vertical coordinate of the target keyword and relatively to the right of the right horizontal coordinate of the target keyword. The determined area may be determined based on a certain threshold multiple of the length and width of the target keyword. For example, the determined width of the determined area range may be a threshold of 2 times the width of the target keyword, and the determined length may be a threshold of 3 times the length of the target keyword. Fig.10Taking the box in as an example, the area range is determined to be a rectangle with the target keyword as the center, a width that is twice the width of the target keyword, and a length that is three times the length of the target keyword.

[0158] It is noted that the threshold determination range can be adjusted according to the size of the text information in the PDF form. For example, different multiple thresholds and threshold combinations of 2 times, 3 times, and 5 times can be used to determine the area range.

[0159] In step 906 , the computing device 210 extracts text information that is on the same page as the target keyword, is different from the target keyword, and satisfies the regular expression of the characteristics of the PDF table from the determined candidate text information as the second text information.

[0160] In some examples, the computing device 210 filters the text information determined in step 904 according to some other additional conditions. The other additional conditions may include that the second text information should be on the same page as the target keyword, the text information in the second text information is different from the target keyword, etc.

[0161] Exemplary pseudo code for determining the second text information is provided herein.

[0162] if pi['y0']>pi3['y1']\

[0163] and pi['x1'] <pi3['x1']\

[0164] and pi['page_number']==pi3['page_number']\

[0165] and pi['number']! =pi3['number']\

[0166] and pi['y0']-pi3['y0']<=(pi['y1']-pi['y0'])*2\

[0167] and pi3['x0']-pi['x0']<=(pi['x1']-pi['x0'])*3\

[0168] and len(re.findall(r'20[0-2][0-9]',pi3['text'].replace(",")))>0

[0169] In the pseudocode, parameters y0 and y1 represent the upper and lower vertical coordinates, parameters x0 and x1 represent the right and left horizontal coordinates, page_number represents the page number, number represents the text length, and text represents the text.

[0170] Therefore, the multiple conditions in the pseudo code correspond to the following: the lower ordinate of the target keyword is greater than the upper ordinate of the second text information; the right abscissa of the target keyword is less than the left abscissa of the second text information; the second text information is on the same page as the target keyword; the second text information is different from the target keyword; the second text information conforms to the regular expression of the characteristics of the PDF table; and the second text information is located within a determined range of 2 times the width of the target keyword and 3 times the width of the target keyword ( Fig.10 in the box).

[0171] It should be noted that what is shown above is only a pseudo code of the traversal operation, and the traversal operation can be implemented in any programming language based on the pseudo code.

[0172] By respectively executing the above steps and the conditions corresponding to the above steps, the computing device 210 can determine the second text information at the lower right of the target keyword according to the position of the target keyword, and then determine the characteristic row of the PDF table. The second text information will be verified in the above verification step.

[0173] Fig.11 FIG. 1 is a flowchart of a method 1100 for determining second text information according to an embodiment of the present disclosure. The method 1100 may be performed as follows: Figure 2 The computing device 210 shown may also be executed in Fig.21 The method 1100 is performed at the electronic device 2100. The method 1100 may correspond to step 308 in the method 300.

[0174] In some examples, the position of the target keyword in the first text information may be predefined at the lower left relative to the undetermined second text information or feature line, that is, the second text information is at the upper right position of the target keyword.

[0175] In step 1102 , the computing device 210 determines the upper vertical coordinate and the right horizontal coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information.

[0176] Fig.12 FIG. 1 shows a schematic diagram of first text information including a target keyword according to an embodiment of the present disclosure. Fig.12As shown, in this PDF form, the target keyword ("balance sheet") is located at the lower left of the PDF form feature row (year information row). The features of the PDF form (year information) can be found in the upper right corner after the target keyword. With the help of the features of the PDF form, the second text information of the PDF form (for example, "2019A") can be determined. Therefore, the computing device 210 can determine the upper vertical coordinate, left horizontal coordinate, and right horizontal coordinate of the target keyword ("balance sheet (million yuan)") in the pixel coordinate system of the PDF file. With the help of the above three values, the second text information can be determined in the upper right corner of the target keyword.

[0177] In step 1104, the computing device 210 determines, in the first text information, text information that satisfies at least one of the following items as candidate text information: located relatively above the upper vertical coordinate of the target keyword; located relatively to the right of the right horizontal coordinate of the target keyword; and having a left horizontal coordinate that differs from the left horizontal coordinate of the target keyword by a fifth threshold range.

[0178] In some examples, since the target keyword is at the lower left of the first text information, the computing device 210 may determine the second text information in an area relatively above the upper ordinate of the target keyword and relatively to the right of the right abscissa of the target keyword. The left abscissa of the second text information differs from the left abscissa of the target keyword by a threshold range of 0.4 times the width of the PDF file.

[0179] It is noted that the threshold range can be adjusted according to the size of the text information in the PDF table. For example, 0.1 times, 0.5 times, and 1 times the width of the PDF file can all be used as the threshold range.

[0180] In step 1106 , the computing device 210 extracts text information that is on the same page as the target keyword, different from the target keyword, meets the characteristics of the PDF form, and has a field length within a sixth threshold range as the second text information from the determined candidate text information.

[0181] In some examples, the computing device 210 filters the text information determined in step 904 according to some other additional conditions. Other additional conditions may include that the second text information should be on the same page as the target keyword, meet the characteristics of the PDF form (e.g., meet the regular expression), the text information in the second text information is different from the target keyword, the field length is within 8 characters, etc. It is noted that the sixth threshold can be adjusted according to the length of the text information. For example, 5 characters, 6 characters, etc. representing the length of the year can be used as the sixth threshold.

[0182] Exemplary pseudo code for determining the second text information is provided herein.

[0183] if pi4['y0']>pi['y1']\

[0184] and pi['x1'] <pi4['x0']\

[0185] and pi4['x0']-pi['x0']<=pi['page_width']*0.4\

[0186] and pi['page_number']===pi4['page_number']\

[0187] and pi['number']! =pi4['number']\

[0188] and len(pi4['text'])<=8\

[0189] and len(re.findall(r'20[0-2][0-9]',pi4['text'].replace(",")))>0

[0190] In the pseudocode, parameters y0 and y1 represent the upper and lower vertical coordinates, parameters x0 and x1 represent the right and left horizontal coordinates, page_number represents the page number, number represents the text length, and text represents the text.

[0191] Therefore, the multiple conditions in the pseudocode correspond to the lower vertical coordinate of the target keyword being greater than the lower vertical coordinate of the second text information, the difference between the left horizontal coordinate of the target keyword and the left horizontal coordinate of the second text information being less than 0.4 times the width of the PDF file; the second text information and the target keyword being on the same page; the second text information and the target keyword being different; the length of the text characters being less than 8 characters; and the second text information conforming to the regular expression of the characteristics of the PDF table.

[0192] It should be noted that what is shown above is only a pseudo code of the traversal operation, and the traversal operation can be implemented in any programming language based on the pseudo code.

[0193] By respectively executing the above steps and the conditions corresponding to the above steps, the computing device 210 can determine the second text information at the upper right of the target keyword according to the position of the target keyword, and then determine the characteristic row of the PDF table. The second text information will be verified in the above verification step.

[0194] Fig.13A flow chart of a method 1300 for determining second text information according to an embodiment of the present disclosure is shown. In order to avoid mining multiple second text information in the above process of determining the second text information, the determined second text information may be processed optionally.

[0195] At step 1302 , computing device 210 optionally sorts the determined second text information.

[0196] In some examples, the computing device 210 may sort the determined second text information. The sorting may use a commonly used sorting algorithm in the art, such as bubble sort, quick sort, and the like.

[0197] In step 1304 , the computing device 210 verifies whether the sorted second text information contains a text string.

[0198] In some examples, the computing device 210 may search the sorted second text information to see if there are any text characters or text strings in the sorted second text information. Generally speaking, if only one second text information of a form is determined, the second text information should satisfy the regular expression of the characteristics of the PDF form (year information), and no text characters such as Chinese characters should appear.

[0199] If a text character such as a Chinese character appears, the determined second text information is considered to include second text information of other tables. The computing device 210 may remove the text string and all text after the text string on the horizontal axis.

[0200] At step 1306 , if the extracted text information contains a text string, the computing device 210 removes the text string and all text after the text string on the horizontal axis.

[0201] It is noted that in method 1300 , steps 1304 and 1306 may be performed on the second text information without performing step 1302 , ie, the sorting step.

[0202] Through the method 1300 , it can be ensured that the mining method for PDF tables only mines out related individual tables without involving other tables.

[0203] Fig.14 A flowchart of a method 1400 for verifying whether second text information belongs to a feature row of a PDF table according to an embodiment of the present disclosure is shown.

[0204] At step 1402 , the computing device 210 determines a regular expression that expresses a feature based on the feature in the feature row of the PDF table.

[0205] In some examples, the characteristic row of the PDF table may be a year information row, so the other regular expressions may be year information. Therefore, a regular expression may be set based on the year information. For example, a regular expression "^(19|20)\d{2}$" representing all years from 1900 to 2099 may be set to determine whether the second text information meets the characteristics of the PDF table.

[0206] You can also configure special regular expressions to match cells. Special year regular expressions can match years with suffix letters, such as identifying "2022E" with the letter "E" as the forecast year 2022.

[0207] At step 1404 , the computing device 210 verifies whether the second text information complies with the regular expression.

[0208] In some examples, computing device 210 may verify whether the second text information belongs to a feature line according to the regular expression determined in step 1402 .

[0209] In step 1406, if the second text information conforms to the regular expression, the row where the second text information is located is determined to be a characteristic row of the PDF table.

[0210] If the second text information belongs to a characteristic row, the row where the second text information is located is determined to be a characteristic row (year information row) of the PDF table. If it does not meet the regular expression, the computing device will redetermine the second text information according to steps 308-312 in method 300.

[0211] Through the method 1400 , it is possible to verify whether the second text information determined in the previous step conforms to the characteristics of the PDF table, thereby determining the characteristic row of the PDF table.

[0212] Fig.15 A flowchart of a method 1500 for determining feature columns of a PDF table according to an embodiment of the present disclosure is shown.

[0213] At step 1502 , the computing device 210 determines a left horizontal coordinate and a right horizontal coordinate of the target keyword in a pixel coordinate system of the PDF file based on a predefined position of the target keyword in the first text information.

[0214] In some examples, computing device 210 may determine the left horizontal coordinate and the right horizontal coordinate of the target keyword in the pixel coordinate system of the PDF file based on the predefined position of the target keyword in the first text information. The left horizontal coordinate and the right horizontal coordinate will be used to locate the feature column of the PDF table.

[0215] In step 1504 , the computing device 210 determines, in the first text information, text information having a left abscissa and a right abscissa that intersect with the interval from the left abscissa to the right abscissa of the target keyword.

[0216] In some examples, since the feature column of a PDF table usually has an intersection with the target keyword of the PDF table, the text information of the left and right abscissas that intersect with the left and right abscissas intervals of the target keyword can be defined as the text information of the feature column.

[0217] At step 1506 , the computing device 210 extracts text information that is on the same page as the target keyword, is different from the target keyword, and does not include predetermined special characters from the determined text information.

[0218] In some examples, the computing device 210 filters the text information determined in step 1504 according to some other additional conditions. The other additional conditions may include that the feature column should be on the same page as the target keyword, does not contain numbers, does not contain specific characters (e.g., "-"), the text information in the second text information is different from the target keyword, etc.

[0219] Exemplary pseudo code for determining feature columns of a PDF table is provided herein.

[0220] if pi['page_number']==col_name['page_number']\

[0221] and pi['number']! =col_name['number']\

[0222] and(

[0223] (pi['x0']<=col_name['x0']and pi['x1']>=col_name['x1'])

[0224] or(pi['x0']>=col_name['x0']and pi['x1']<=col_name['x1'])

[0225] or(pi['x0']<=col_name['x0']and pi['x1']<col_name['x1']and pi['x1']> col_name['x0'])

[0226] or(pi['x0']>col_name['x0']and pi['x0']<col_name['x1']and pi['x1']> =col_name['x1'])

[0227] or(pi['x0']>=col_name['x0']and(pi['x1']-col_name['x1'])<=50)

[0228] )\

[0229] and col_name['y0']>pi['y1']\

[0230] and pi['text'].replace(",")not in'-'\

[0231] and(check_no_number(get_col_value_after(pi['text']).replace(","))

[0232] and get_col_value_after(pi['text']).replace(",")! =”)

[0233] In the pseudocode, parameters y0 and y1 represent the upper and lower vertical coordinates, parameters x0 and x1 represent the right and left horizontal coordinates, page_number represents the page number, number represents the text length, and text represents the text.

[0234] Therefore, the multiple conditions in the pseudocode correspond respectively to the horizontal axis interval of the text information of the feature column being within the horizontal axis interval of the target keyword; the lower vertical axis of the target keyword being smaller than the upper vertical axis of the text information of the feature column; the text information of the feature column and the target keyword being on the same page; the text information of the feature column not containing numbers; the text information of the feature column not containing special symbols (such as “-”); the text information of the feature column being different from the target keyword.

[0235] It should be noted that what is shown above is only a pseudo code of the traversal operation, and the traversal operation can be implemented in any programming language based on the pseudo code.

[0236] At step 1508 , the computing device 210 determines the extracted text information as a feature column of the PDF table.

[0237] In some examples, computing device 210 determines the text information determined in step 1506 as a feature column of a PDF table in the PDF file. Figure 4 , Figure 8In the schematic diagrams, the feature column of the PDF table may be the first column of the PDF table, that is, the index identification column. Note that the feature column determined in the method 1500 also includes the vertical coordinates of each text information therein.

[0238] The determined feature columns may be combined with the feature rows determined in the above steps to determine a PDF table.

[0239] Fig.16 A flowchart of a method 1600 for acquiring cell information of a PDF table according to determined characteristic rows and characteristic columns according to an embodiment of the present disclosure is shown.

[0240] In step 1602, the computing device 210 determines the vertical axis coordinate and the horizontal axis coordinate of the PDF table based on the determined left horizontal coordinate and right horizontal coordinate of the characteristic row of the PDF table and the upper vertical coordinate and lower vertical coordinate of the characteristic column of the PDF table;

[0241] In some examples, computing device 210 can obtain the size of the entire PDF table, that is, the vertical axis coordinate and the horizontal axis coordinate of the PDF table, by calculating the difference between the upper horizontal coordinate and the lower horizontal coordinate of the text information in the feature row (e.g., the year information row) and the difference between the upper vertical coordinate and the lower vertical coordinate of the text information in the feature column (e.g., the indicator identification column).

[0242] In step 1604 , the computing device 210 obtains cells of the PDF table based on the vertical axis coordinate and the horizontal axis coordinate of the PDF table.

[0243] In some examples, the computing device 210 may combine the left horizontal coordinate and the right horizontal coordinate of the text information in the determined feature row (e.g., the year information row) of the PDF table and the upper vertical coordinate and the lower vertical coordinate of the text information in the feature column (e.g., the indicator identification column). Through the combination of the four coordinates, the size of each cell in the PDF table, that is, the vertical axis coordinate and the horizontal axis coordinate of the cell or text information of the PDF table, may be determined.

[0244] Fig.17 A flowchart of a method 1700 for acquiring cells of a PDF table based on the vertical axis coordinate and the horizontal axis coordinate of the PDF table according to an embodiment of the present disclosure is shown.

[0245] In step 1702 , the computing device 210 determines the left horizontal coordinate, right horizontal coordinate, upper vertical coordinate, and lower vertical coordinate of all text information in the feature rows and feature columns of the PDF table based on the feature rows and feature columns of the PDF table.

[0246] In some examples, computing device 210 can determine the left horizontal coordinate, right horizontal coordinate, top vertical coordinate, and bottom vertical coordinate of the text information therein based on the feature rows (e.g., year information rows) and feature columns (e.g., indicator data columns) determined in methods 1500 and 1600.

[0247] In step 1704, the computing device 210 obtains text information of a cell of a PDF table that satisfies at least one of the following items: having a left horizontal coordinate that differs from the left horizontal coordinate of all the text information of the feature row by the seventh threshold value; having a right horizontal coordinate that differs from the right horizontal coordinate of all the text information of the feature row by the seventh threshold value; having an upper vertical coordinate that differs from the upper vertical coordinate of all the text information of the feature column by the eighth threshold value; having a lower vertical coordinate that differs from the lower vertical coordinate of all the text information of the feature row by the eighth threshold value.

[0248] In some examples, the computing device 210 may obtain the left horizontal coordinate, right horizontal coordinate, upper vertical coordinate, and lower vertical coordinate of the feature row (e.g., year information row) and feature column (e.g., indicator data column) when obtaining the table information of the PDF table, and add a certain threshold range to it to ensure that the size of each cell is larger than the size of the text information therein. For example, 15 pixels may be added to the left horizontal coordinate and the right horizontal coordinate, and 5 pixels may be added to the upper vertical coordinate and the lower vertical coordinate. This means that the text information 15 pixels outside the original left horizontal coordinate, 15 pixels outside the right horizontal coordinate, 5 pixels outside the upper vertical coordinate, and 5 pixels outside the lower vertical coordinate can all be determined as the text information of this cell.

[0249] It is noted that the threshold value can be adjusted according to the size of the text information in the PDF table. For example, different threshold values ​​and threshold value combinations of 2 pixels, 5 pixels, and 10 pixels can be used as the threshold values ​​on the ordinate and abscissa.

[0250] Exemplary pseudo code for determining feature columns of a PDF table is provided herein.

[0251] if gl['page_number']==tcl['page_number']\

[0252] and(abs(year_cell['x0']-gl['x0'])<=15or abs(year_cell['x1']-gl['x1'])<=15)\

[0253] and((abs(tcl['y0']-gl['y0'])<=5and abs(tcl['y1']-gl['y1'])<=5)ortcl['y0'] <gl['y1']<tcl['y1'])

[0254] In the pseudocode, parameters y0 and y1 represent the upper and lower vertical coordinates, parameters x0 and x1 represent the right and left horizontal coordinates, and page_number represents the page number.

[0255] Therefore, the multiple conditions in the pseudocode correspond to adding a threshold of 15 pixels to the left and right horizontal coordinates; adding a threshold of 5 pixels to the upper and lower vertical coordinates; and the text information of the feature column is on the same page as the target keyword.

[0256] It should be noted that what is shown above is only a pseudo code of the traversal operation, and the traversal operation can be implemented in any programming language based on the pseudo code.

[0257] By means of method 1700, the text information in the determined cells of the PDF table and within the cell threshold range can be obtained as the text information of the cell. The cells can also accurately correspond to the corresponding feature rows and feature columns by means of the horizontal coordinates and the vertical coordinates, so that the obtained text information retains its actual meaning.

[0258] The present disclosure also provides a plurality of methods for further processing the mined PDF tables.

[0259] Fig.18 A flowchart of a method 1800 for mining PDF tables in a PDF file according to an embodiment of the present disclosure is shown. In the table shown above, the table information is often strongly correlated with the year and indicator identification of the row and column where it is located. The year information and indicator identification information of the table can be mined through the method 1800 for mining table information.

[0260] In step 1802, the computing device 210 determines the feature row as a year information row.

[0261] by Figure 1 For example, the text information of the year information row may include "Financial Statements (million yuan)", [2019A], [2020E], [2021E], [2022E]", etc.

[0262] At step 1804 , the computing device 210 determines the feature column as an indicator identification column.

[0263] by Figure 1 For example, the text information of the indicator identification column may include "income statement", "operating income, operating cost", etc.

[0264] In step 1806, the computing device 210 determines the text information located to the right of the indicator identification column and having the same row position information as the indicator identification and located below the year information row and having the same column position information as the year information row as a numerical value associated with the year information and the indicator identification.

[0265] by Figure 1 For example, the first column ("Financial Statement (100 million yuan)" and below) can be considered as the indicator identification column, the first column to the right is the data column, and the row where "2019A" is located is identified as the year information row, so the data "1,064" corresponding to "Operating Cost" and "2019A" can be considered as the operating cost of the enterprise in 2019. In the above way, each number in the PDF table can be matched with the year data and indicator identification, thereby retaining its actual meaning through table mining.

[0266] Fig.19 A flowchart of a method 1900 for mining PDF tables in a PDF file according to an embodiment of the present disclosure is shown. Since PDF files issued by institutions (e.g., financial institutions) have strong performance characteristics, the institution associated with the PDF table (e.g., the financial institution that wrote the PDF file) can be determined through the institution mining method.

[0267] In step 1902 , the computing device 210 constructs an organization key feature array for multiple organizations associated with the PDF form, the organization key feature array including: the number of key features associated with the organization, the key features, and the weights corresponding to the key features.

[0268] Specifically, users can pre-set the number of key features associated with an institution, key features, and weights corresponding to the key features. For example, for a securities company, users can set three key features for it, namely, company name, company registered office address, and company logo, and assign corresponding weights to the corresponding features, such as company name with a weight of 1, company registered office address with a weight of 3, and company logo with a weight of 5. The higher the weight, the more relevant the feature is to the institution.

[0269] At step 1904, the computing device 210 searches the text information extracted from the PDF table based on the organization key feature array to determine the number of occurrences of the key features associated with the organization. After the key features are set, the text information extracted from the PDF file can be searched, and the method of extracting information can be as described above. Through text search, the number of occurrences of the key features associated with the organization can be determined.

[0270] In step 1906, the computing device 210 generates an institution weight sequence based on the calculated number of occurrences of the key features associated with the institution, so as to determine the target associated institution of the PDF form. After obtaining the key features, feature weights, and feature occurrences, an institution weight sequence can be generated. By sorting the institution weight sequence, the institution associated with the PDF form is mined. For example, if the first in the institution weight sequence is a securities company, it can be considered that the PDF file is associated with the securities company, for example, the file is written by a securities company.

[0271] Fig. 20 The flowchart of method 2000 for determining a target association organization of a PDF form according to an embodiment of the present disclosure is shown. Method 2000 corresponds to step 1906 in method 1900 .

[0272] In step 2002, the computing device 210 determines the organization corresponding to the maximum value in the organization weight sequence. By using the method in method 1100, the organization weight sequence of the PDF file can be obtained, and the organization corresponding to the maximum value in the sequence can be determined.

[0273] In step 2004, the computing device 210 determines whether the number of organizations corresponding to the maximum value is 1, that is, whether there are more than one organization corresponding to the maximum value, for example, there are two or more identical maximum values, corresponding to two or more different organizations respectively.

[0274] In step 2006, the computing device 210 determines that the organization corresponding to the maximum value is the target association organization of the PDF form in response to determining that the number of organizations corresponding to the maximum value is 1. In the case where there is only one maximum value, the organization corresponding to the maximum value is the target association organization of the PDF form.

[0275] In step 2008, the computing device 210 determines that the target associated organization is not identified in response to determining that the number of organizations corresponding to the maximum value is greater than 1. If there are multiple identical maximum values ​​and the organizations corresponding to the maximum values ​​are different, the target associated organization of the PDF form cannot be determined. Further methods (such as manual identification) are required to determine the target associated organization of the PDF form.

[0276] Fig.21 2 shows a schematic block diagram of an example electronic device 2100 that can be used to implement an embodiment of the present disclosure. Figure 2The computing device 210 shown can be implemented by an electronic device 2100. As shown, the electronic device 2100 includes a central processing unit (CPU) 2101, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 2102 or computer program instructions loaded from a storage unit 2108 to a random access memory (RAM) 2103. In the random access memory 2103, various programs and data required for the operation of the electronic device 2100 can also be stored. The central processing unit 2101, the read-only memory 2102, and the random access memory 2103 are connected to each other via a bus 2104. An input / output (I / O) interface 2105 is also connected to the bus 2104.

[0277] Multiple components in the electronic device 2100 are connected to the input / output interface 2105, including: an input unit 2106, such as a keyboard, a mouse, a microphone, etc.; an output unit 2107, such as various types of displays, speakers, etc.; a storage unit 2108, such as a disk, an optical disk, etc.; and a communication unit 2109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 2109 allows the device 2100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0278] The various processes and processing described above, such as methods 300, 400, 500, 700, 900, 1100, 1300, 1400, 1500, 1600, 1700, 1800, 1900, and 2000, may be performed by the central processing unit 2101. For example, in some embodiments, methods 300, 400, 500, 700, 900, 1100, 1300, 1400, 1500, 1600, 1700, 1800, 1900, and 2000 may be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 2108. In some embodiments, part or all of the computer program may be loaded and / or installed onto the device 2100 via the read-only memory 2102 and / or the communication unit 2109. When the computer program is loaded into the random access memory 1303 and executed by the central processing unit 2101, one or more actions of the methods 300, 400, 500, 700, 900, 1100, 1300, 1400, 1500, 1600, 1700, 1800, 1900 and 2000 described above may be performed.

[0279] The present disclosure relates to methods, apparatuses, systems, electronic devices, computer-readable storage media and / or computer program products. The computer program products may include computer-readable program instructions for executing various aspects of the present disclosure.

[0280] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0281] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge computing devices. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.

[0282] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0283] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0284] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0285] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0286] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0287] Those skilled in the art should understand that the present invention is not limited to the above-mentioned embodiments, and the present invention can be implemented in many other forms without departing from its purpose and scope. Therefore, the examples and embodiments shown are regarded as illustrative rather than restrictive, and the present invention may cover various modifications and substitutions without departing from the spirit and scope of the present invention as defined in the appended claims.

Claims

1. A method for mining a PDF table in a PDF file, comprising: Setting a target keyword and configuration information associated with the target keyword for a PDF form; Parsing the PDF file to obtain text information in the PDF file; Determining first text information based on the configuration information and the acquired text information; determining second text information based on a predefined position of the target keyword in the first text information and the first text information; Based on the extracted features of the PDF table, verify whether the second text information belongs to a feature row of the PDF table so as to determine the feature row of the PDF table, which includes determining that the second text information belongs to the feature row of the PDF table if the second text information meets the features of the PDF table, and adjusting a predefined position of the target keyword in the first text information if the second text information does not meet the features of the PDF table so as to redetermine the second text information, which includes determining a regular expression expressing the features based on the features in the feature row of the PDF table, verifying whether the second text information meets the regular expression, and determining that the row where the second text information is located is the feature row of the PDF table if the second text information meets the regular expression; Based on the target keyword and the first text information, determining a feature column of the PDF table, including determining a left horizontal coordinate and a right horizontal coordinate of the target keyword in a pixel coordinate system of the PDF file based on a predefined position of the target keyword in the first text information, determining text information having a left horizontal coordinate and a right horizontal coordinate that intersect with an interval from the left horizontal coordinate to the right horizontal coordinate of the target keyword in the first text information, extracting text information that is on the same page as the target keyword, is different from the target keyword, and does not include a predetermined special character from the determined text information, and determining the extracted text information as a feature column of the PDF table; as well as The text information of the cells of the PDF table is obtained according to the determined characteristic rows and characteristic columns.

2. The method according to claim 1, wherein determining the second text information comprises: Based on a predefined position of the target keyword in the first text information, determining a right horizontal coordinate, an upper vertical coordinate, and a lower vertical coordinate of the target keyword in a pixel coordinate system of the PDF file; In the first text information, text information that satisfies at least one of the following items is determined as candidate text information: The right abscissa of the target keyword is relatively to the right; having an upper ordinate that differs from an upper ordinate of the target keyword by a first threshold; having a lower ordinate that differs from the lower ordinate of the target keyword by a first threshold; as well as Among the determined candidate text information, text information that is on the same page as the target keyword and different from the target keyword is extracted as the second text information.

3. The method of claim 1, wherein determining the second text information comprises: Based on a predefined position of the target keyword in the first text information, determining a left horizontal coordinate, a right horizontal coordinate, and a lower vertical coordinate of the target keyword in a pixel coordinate system of the PDF file; In the first text information, text information that satisfies at least one of the following items is determined as candidate text information: Located relatively below the lower vertical coordinate of the target keyword; having an upper ordinate that differs from a lower ordinate of the target keyword by a second threshold value; A left abscissa and a right abscissa having an intersection with the interval from the left abscissa to the right abscissa of the target keyword; Extracting, from the determined candidate text information, text information that is on the same page as the target keyword, is different from the target keyword, and does not conform to the characteristics of the PDF table as middle characters; as well as Based on the extracted middle characters, second text information is determined.

4. The method of claim 1, wherein determining the second text information comprises: Determining, based on a predefined position of the target keyword in the first text information, a length, a width, a lower ordinate, and a right abscissa of the target keyword in a pixel coordinate system of the PDF file; In the first text information, text information that satisfies at least one of the following items is determined as candidate text information: The lower vertical coordinate of the target keyword is relatively lower; The right abscissa of the target keyword is located at the relative right; having a horizontal axis and a vertical axis within a range consisting of a third threshold multiple of a width of the target keyword and a fourth threshold multiple of a length of the target keyword; as well as From the determined candidate text information, text information that is on the same page as the target keyword, is different from the target keyword, and satisfies the characteristics of the PDF form is extracted as the second text information.

5. The method of claim 1, wherein determining the second text information comprises: Based on a predefined position of the target keyword in the first text information, determining an upper vertical coordinate and a left horizontal coordinate of the target keyword in a pixel coordinate system of the PDF file; In the first text information, text information that satisfies at least one of the following items is determined as candidate text information: Located relatively above the upper vertical coordinate of the target keyword; The right abscissa of the target keyword is relatively to the right; having a left abscissa that differs from the left abscissa of the target keyword by a fifth threshold range; as well as Among the determined candidate text information, text information that is on the same page as the target keyword, is different from the target keyword, satisfies the characteristics of the PDF form, and has a field length within a sixth threshold range is extracted as the second text information.

6. The method according to any one of claims 2 to 5, wherein determining the second text information comprises: sorting the determined second text information; Verifying whether a text string exists in the sorted second text information; as well as If the sorted second text information contains a text string, the text string and all texts after the text string on the horizontal axis are removed.

7. The method according to claim 1, wherein acquiring text information of cells of the PDF table according to the determined characteristic rows and characteristic columns further comprises: Determine the vertical axis coordinate and the horizontal axis coordinate of the PDF table based on the determined left horizontal coordinate and right horizontal coordinate of the characteristic row of the PDF table and the upper vertical coordinate and lower vertical coordinate of the characteristic column of the PDF table; as well as A cell of the PDF table is obtained based on the vertical axis coordinate and the horizontal axis coordinate of the PDF table.

8. The method according to claim 7, wherein acquiring the cells of the PDF table based on the vertical axis coordinate and the horizontal axis coordinate of the PDF table comprises: Based on the characteristic rows and characteristic columns of the PDF table, determining the left abscissa, the right abscissa, the upper ordinate, and the lower ordinate of all text information in the characteristic rows and characteristic columns of the PDF table; and The text information that satisfies at least one of the following items is obtained as the text information of the cell of the PDF table: having a left abscissa that differs from the left abscissas of all text information of the feature row by a seventh threshold; having a right abscissa that differs from the right abscissas of all text information of the feature row by a seventh threshold; having an upper ordinate that differs from the upper ordinates of all text information in the feature column by an eighth threshold; The lower ordinate has a lower ordinate that differs from the lower ordinates of all text information of the feature row by an eighth threshold.

9. The method according to claim 1, further comprising: Determine the characteristic row as a year information row; Determine the feature column as an indicator identification column; as well as The text information located to the right of the indicator identification column and having the same row position information as the indicator identification and located below the year information row and having the same column position information as the year information row is determined as a numerical value associated with the year information and the indicator identification.

10. The method according to claim 1, further comprising: Constructing an organization key feature array for a plurality of organizations associated with the PDF form, the organization key feature array comprising: the number of key features associated with the organization, the key features, and weights corresponding to the key features; Based on the organization key feature array, searching the text information extracted based on the PDF form to determine the number of occurrences of the key features associated with the organization; and Based on the calculated number of occurrences of the key features associated with the institution, an institution weight sequence is generated for determining a target associated institution of the PDF form.

11. The method of claim 10, wherein determining a target affiliate of the PDF form further comprises: Determine the institution corresponding to the maximum value in the sequence of institution weights; Determine whether the number of institutions corresponding to the maximum value is 1; In response to determining that the number of institutions corresponding to the maximum value is 1, determining the institution corresponding to the maximum value to be a target associated institution of the PDF form; and In response to determining that the number of institutions corresponding to the maximum value is greater than 1, it is determined that the target-associated institution is not identified.

12. A computing device comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.

13. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method of any one of claims 1-11.

Citation Information

Patent Citations

  • Periodical literature table extraction method based on text state characteristics

    CN110968667A

  • Table identification method and device

    CN111062259A

  • Method for extracting key information from research report and related equipment

    CN112990110A