WO2019075969A1 - 表格信息结构化提取方法、电子设备及计算机可读存储介质 - Google Patents

表格信息结构化提取方法、电子设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2019075969A1
WO2019075969A1 PCT/CN2018/076167 CN2018076167W WO2019075969A1 WO 2019075969 A1 WO2019075969 A1 WO 2019075969A1 CN 2018076167 W CN2018076167 W CN 2018076167W WO 2019075969 A1 WO2019075969 A1 WO 2019075969A1
Authority
WO
WIPO (PCT)
Prior art keywords
cell
line
text content
page
text
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2018/076167
Other languages
English (en)
French (fr)
Inventor
苏晓明
汪伟
肖京
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2019075969A1 publication Critical patent/WO2019075969A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets

Definitions

  • the present application relates to the field of computer information technology, and in particular, to a table information structured extraction method, an electronic device, and a computer readable storage medium.
  • the present application provides a table information structured extraction method, an electronic device, and a computer readable storage medium, which can identify a table by analyzing location information and tag information of a table text content in a specified document (eg, a PDF document). For example, the newline situation and the cross-page situation in the PDF annual report form, and the structured data extraction and storage of the table in which the line break situation and the cross-page situation occur.
  • a specified document eg, a PDF document
  • the present application provides an electronic device including a memory and a processor, and the memory stores a table information structured extraction system operable on the processor, the table
  • the information structured extraction system is implemented by the processor to implement the following steps:
  • a line feed situation and a cross-page situation are identified from the table of the specified document;
  • the form information is stored and stored in a row according to the first reshaping rule
  • the form information is stored and stored in a row according to the second reshaping rule.
  • the first reshaping rule comprises: storing characters with the same upper edge coordinates as the same line, and storing the left side characters with the same coordinates as the same column;
  • the second reshaping rule includes:
  • the splicing table is formed by splicing the text content of the previous table after deleting the footer and the text content of the next table after deleting the header;
  • the characters with the same upper edge coordinates in the stitched table are stored as the same row, and the characters with the same coordinates on the left side in the stitched table are stored as the same column.
  • the header of the previous page where the previous table is deleted and the header of the next page of the next table are:
  • the range and header range delete the footer of the previous page and the header of the next page;
  • the determining rule of the footer range of the previous page is: selecting the first proportion content of the page length of the previous page according to the order from bottom to top, and using the selected first proportion content as the previous page. Footer range;
  • the rule of determining the header range of the next page is: selecting the second proportion content of the page length of the next page according to the order from top to bottom, and using the selected second proportion content as the page of the next page Eyebrow range.
  • the line feed situation includes in-line line breaks and end-of-line line breaks;
  • the identification of the inline inline includes:
  • the cell is determined to be the same line, and the cell whose cell position between the first occurrence of the cell position and the last occurrence of the cell position is different is the cell that is wrapped in the line.
  • the identification of the line endings includes:
  • the text content location information of the remaining cell is obtained, where the text content location information of the remaining cell includes the text content of the remaining cell Edge coordinate
  • the text content of the remaining cells is merged into the current line, and it is determined that the remaining cells are the end-of-line cells of the current line.
  • the present application further provides a method for extracting form information, which is applied to an electronic device, and the method includes:
  • a line feed situation and a cross-page situation are identified from the table of the specified document;
  • the form information is stored and stored in a row according to the first reshaping rule
  • the form information is stored and stored in a row according to the second reshaping rule.
  • the first reshaping rule comprises: storing characters with the same upper edge coordinates as the same line, and storing the left side characters with the same coordinates as the same column;
  • the second reshaping rule includes:
  • the splicing table is formed by splicing the text content of the previous table after deleting the footer and the text content of the next table after deleting the header;
  • the characters with the same upper edge coordinates in the stitched table are stored as the same row, and the characters with the same coordinates on the left side in the stitched table are stored as the same column.
  • the header of the previous page where the previous table is deleted and the header of the next page of the next table are:
  • the range and header range delete the footer of the previous page and the header of the next page;
  • the determining rule of the footer range of the previous page is: selecting the first proportion content of the page length of the previous page according to the order from bottom to top, and using the selected first proportion content as the previous page. Footer range;
  • the rule of determining the header range of the next page is: selecting the second proportion content of the page length of the next page according to the order from top to bottom, and using the selected second proportion content as the page of the next page Eyebrow range.
  • the identification of the spread situation comprises:
  • the present application further provides a computer readable storage medium storing a table information structured extraction system, the form information structured extraction system being configurable by at least one processor Executing to cause the at least one processor to perform the steps of the table information structured extraction method as described above.
  • the electronic device, the table information structured extraction method and the computer readable storage medium proposed by the present application can be identified by analyzing the location information and the tag information of the table text content in the specified document (such as a PDF document).
  • the line break situation and the cross-page situation in the form (such as the PDF annual report form), and the structured data extraction and storage of the table in which the line break situation and the cross-page situation occur.
  • the method does not need to convert PDF files into structured documents such as word and excel, and has high data extraction efficiency, high recall rate and high accuracy under large-scale data sets, and facilitates subsequent horizontal comparison analysis, vertical alignment analysis and data modeling. .
  • 1 is a schematic diagram of an optional hardware architecture of an electronic device of the present application
  • FIG. 2 is a schematic diagram of a program module of an embodiment of a table information structured extraction system in an electronic device of the present application
  • FIG. 3 is a schematic diagram of an implementation process of an embodiment of a structured information extraction method of a form in the present application.
  • first, second and the like in the present application are for the purpose of description only, and are not to be construed as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. .
  • features defining “first” and “second” may include at least one of the features, either explicitly or implicitly.
  • the technical solutions between the various embodiments may be combined with each other, but must be based on the realization of those skilled in the art, and when the combination of the technical solutions is contradictory or impossible to implement, it should be considered that the combination of the technical solutions does not exist. Nor is it within the scope of protection required by this application.
  • FIG. 1 it is a schematic diagram of an optional hardware architecture of the electronic device 2 of the present application.
  • the electronic device 2 may include, but is not limited to, a memory 21, a processor 22, and a network interface 23 that can communicate with each other through a system bus. It is pointed out that FIG. 1 only shows the electronic device 2 with the components 21-23, but it should be understood that not all illustrated components are required to be implemented, and more or fewer components may be implemented instead.
  • the electronic device 2 may be a computing device such as a rack server, a blade server, a tower server, or a rack server.
  • the electronic device 2 may be an independent server or a server cluster composed of multiple servers. .
  • the memory 21 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), a random access memory (RAM), a static Random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like.
  • the memory 21 may be an internal storage unit of the electronic device 2, such as a hard disk or memory of the electronic device 2.
  • the memory 21 may also be an external storage device of the electronic device 2, such as a plug-in hard disk equipped on the electronic device 2, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card, etc.
  • the memory 21 may also include both an internal storage unit of the electronic device 2 and an external storage device thereof.
  • the memory 21 is generally used to store an operating system installed in the electronic device 2 and various types of application software, such as program codes of the table information structured extraction system 20, and the like. Further, the memory 21 can also be used to temporarily store various types of data that have been output or are to be output.
  • the processor 22 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments.
  • the processor 22 is typically used to control the overall operation of the electronic device 2, such as performing control and processing related to data interaction or communication with the electronic device 2.
  • the processor 22 is configured to run program code or process data stored in the memory 21, such as running the table information structured extraction system 20 and the like.
  • the network interface 23 may comprise a wireless network interface or a wired network interface, which is typically used to establish a communication connection between the electronic device 2 and other electronic devices.
  • the network interface 23 is configured to connect the electronic device 2 to an external data platform through a network, and establish a data transmission channel and a communication connection between the electronic device 2 and an external data platform.
  • the network may be an intranet, an Internet, a Global System of Mobile communication (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, or a 5G network.
  • Wireless or wired networks such as the Internet, Bluetooth, Wi-Fi, etc.
  • FIG. 2 it is a program module diagram of an embodiment of the table information structured extraction system 20 in the electronic device 2 of the present application.
  • the table information structured extraction system 20 may be divided into one or more program modules, and the one or more program modules are stored in the memory 21 and processed by one or more processes.
  • the processor (which is the processor 22 in this embodiment) is executed to complete the application.
  • the table information structured extraction system 20 can be divided into an acquisition module 201, an identification module 202, and a storage module 203.
  • a program module as referred to in the present application refers to a series of computer program instruction segments capable of performing a specific function, which is more suitable than the program to describe the execution process of the form information structured extraction system 20 in the electronic device 2. The function of each program module 201-203 will be described in detail below.
  • the obtaining module 201 is configured to acquire location information and tag information of each line of text in a specified document (such as a PDF document).
  • a specific character recognition tool such as a pdf2html tool
  • the specific text recognition tool can parse the PDF document into a text file (such as an XML file), and at the same time parse the position information and label information of each line of text in each line of the PDF document.
  • the position information of each line of text includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of each line of text.
  • each row of the table in the specified document is stored in an adjacent position, that is, sequentially stored according to position information of each line of text (such as left edge coordinates).
  • the label information of each line of text includes, but is not limited to, a page number of each line of text in the specified document (eg, a PDF document) (ie, a serial number of a page where each line of text is located), a page length, a page width, and the like.
  • the identification module 202 is configured to identify a line feed situation and a cross-page situation from the table of the specified document according to the location information and the tag information of each line of text.
  • the recognizing the line feed situation from the table of the specified document includes the following steps A1-A2.
  • the table in the specified document can be located by the specific rule of the specified document. For example, if the specified document is a PDF annual report, the annual report is published with a clear format requirement, and the specific form can be judged according to an annual report rule similar to the following:
  • the table title When introducing major customers and suppliers, the table title will be set to "Main sales customers and major suppliers", so this title is followed by a specific form from the customer supplier. According to the title keyword of the specific table, the table introducing the specific content can be positioned to facilitate subsequent analysis. Similarly, other forms in the PDF Annual Report have similar formats.
  • (A2) sequentially reading a line of text in the specific table according to the location information of the specific table, and identifying a cell that is wrapped in the line from the line of text according to the position information of the line of the line.
  • the first row can be read from the left side of the particular table, and the first row can be read according to the table length of the particular table, and the last row of the particular table can be read according to the table width of the particular table.
  • each line of text of the specific table includes a plurality of cells, such as a first cell, a second cell, a third cell, and a fourth cell.
  • the line feed situation includes inline and end of line wrapping.
  • the line break in the line means that there is a line break in the inner cell of a line of text of the specific table.
  • the end of line wrapping means that there is a line break in the tail cell of a line of text of the particular table.
  • the cell that recognizes the inline inline from the line of characters according to the position information of the line of characters includes the following steps A21-A22.
  • (A21) obtaining the position information of the text content of each cell in the line of text, wherein the position information of the text content of each cell includes, but is not limited to, the left edge coordinate and the upper edge coordinate of the text content of each cell Coordinate information such as text width and text length.
  • the form information line-feeding identification further includes the step of: (A3) identifying, from the current line of text, the cells at the end of the line according to the position information of the current line of text.
  • the cell that identifies the end of line break from the current line of text according to the position information of the current line of characters includes the following steps A31-A33.
  • the text content position information of the remaining cells includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of the text content of the remaining cells.
  • the text content of the remaining cells is merged into the next line, and it is determined that the remaining cells are the end-of-line cells of the next line.
  • the cell that identifies the end of line break from the current line of text according to the position information of the current line of characters may further include the following steps A34-A36.
  • the text content position information of the remaining cell includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of the text content of the remaining cells.
  • the text content of the remaining cells is merged into the previous row, and it is determined that the remaining cells are the end-of-line cells of the previous row.
  • steps A1-A2, A21-A22, and A31-A36 are described by taking the case where the form information is changed in a specific form of the PDF file (such as a customer supplier form), and those skilled in the art can It is to be understood that, in other embodiments, the form information line-recognition method may also perform a line-change situation identification for all forms of the PDF file, and details are not described herein.
  • the recognizing the spread situation from the table of the specified document includes the following steps B1-B3 (method 1).
  • the location information of the previous form text content includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of each line of text of the previous table, and The left side of each column of the previous table is along the coordinates.
  • the label information of the previous form text content includes, but is not limited to, the page number of each line of the previous form in the specified document (such as a PDF document) (ie, the serial number of the page where each line of text is located), the page length, and the page width. Wait.
  • the location information of the next table text content includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of each line of the next table, and each column of the next table The left side along the coordinates and so on.
  • the label information of the next form text content includes, but is not limited to, the page number of each line of the next form in the specified document (such as a PDF document) (ie, the serial number of the page where each line of text is located), the page length, and the page width. Wait.
  • (B2) Align the coordinates of the left edge of each column of text in the next table with the coordinates of the left edge of each column of text in the previous table. For example, compare the left edge coordinate of the first column of the next table with the left edge coordinate of the first column of the text of the previous table, and compare the left edge coordinate of the second column of the next table with the second column of the previous table. The left edge of the text along the coordinates, and so on.
  • next form and the previous form are the same form in which the cross-page case exists. If the page number of each line of text in the next table is the same as the page number of each line of the previous form, it is determined that the next form and the previous form are the same form in which there is no cross-page case, that is, the next form and the previous form are located. The same form on the same page.
  • the left edge coordinate of each column of text in the next table and the left edge coordinate of each column of text corresponding to the previous table are less than a preset threshold (eg, 2 pixel unit values) Then, it is determined that the left edge coordinate of each column of text in the next table is the same as the left edge coordinate of each column of text corresponding to the previous table.
  • a preset threshold eg, 2 pixel unit values
  • steps B1-B3 are described by taking the case where the table information is spread across two adjacent tables (the former table and the next table) of the PDF file.
  • the above table information cross-page identification can also be used to identify a cross-page situation for a specific form of a PDF file (such as a financial form) (method 2), and the second method includes the following steps B4-B5.
  • the location information of the specific form text content includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of each line of the specific table.
  • the tag information of the specific form text content includes, but is not limited to, the page number of each line of the specified form (such as a PDF document) of the specified form (ie, the serial number of the page where the line of text is located), the page length, the page width, and the like.
  • a specific table in the specified document can be located by the specific rule of the specified document. For example, if the specified document is a PDF annual report, the annual report is issued with a clear format requirement, and the specific form can be judged according to an annual report rule similar to the following.
  • the table title When introducing major customers and suppliers, the table title will be set to "Main sales customers and major suppliers", so this title is followed by a specific form from the customer supplier. According to the title keyword of the specific table, the table introducing the specific content can be positioned to facilitate subsequent analysis. Similarly, other specific forms in the PDF Annual Report have similar formats.
  • the page number of each line of the specific table is different, it is determined that the specific table has a cross-page situation (ie, the previous table and the next table in which the specific table is located on different pages are identified). If the page number of each line of the specific table is the same, it is determined that there is no spread situation in the specific form.
  • the storage module 203 is configured to: when the line-feeding situation is recognized from the table of the specified document, store the table information in a branch according to the first reshaping rule (to extract and store the table data in a branch) and store the column (column) The tabular data is extracted and stored) to form structured tabular data.
  • the first reshaping rule includes: storing characters with the same upper edge coordinates as the same row (stored in a branch), and storing the characters with the same coordinates on the left side as the same column (separate column storage) .
  • the storage module 203 is further configured to: when the cross-page situation is recognized from the table of the specified document, store the table information in a row according to the second reshaping rule, and store the table data to form structured table data.
  • the second reshaping rule comprises:
  • the characters with the same upper edge coordinates in the stitched table are stored as the same row (stored in the branch), and the characters with the same coordinates on the left side in the stitched table are stored in the same column (separated column storage).
  • deleting the footer of the previous page of the previous table and the header of the next page of the next table include: according to the label information of the previous page and the next page, and the specific rules of the specified document, The footer range of the previous page and the header range of the next page in the specified document are located, and the footer of the previous page and the header of the next page are deleted according to the footer range and the header range determined by the positioning.
  • the label information of the previous page includes, but is not limited to, the page number of the previous page, the page length, the page width, and the like; the label information of the next page includes, but is not limited to, the page number and page of the next page. Length, page width, etc.
  • the specific rules of the specified document include, but are not limited to, the first ratio of the length of the page occupied by the footer of the previous page (such as 8%), and the second ratio of the length of the page of the header of the next page (such as 9%). ). It can be understood that the first ratio and the second ratio may also be the same.
  • the determining rule of the footer range of the previous page is: selecting the first proportion content of the page length of the previous page according to the order from bottom to top, and using the selected first proportion content as the front The footer range of a page.
  • the determining rule of the header range of the next page is: selecting the second proportion content of the page length of the next page according to the order from top to bottom, and using the selected second proportion content as the next page The header range.
  • the tabular information structured extraction system 20 is further configured to perform lateral alignment analysis and longitudinal alignment analysis on the stored structured tabular data.
  • the horizontal alignment analysis includes: comparing structured form data (such as accounts receivable data) of different companies in the same industry within the same time range (such as one year), in order to analyze debt situation, capital status, etc. of different companies.
  • the longitudinal alignment analysis includes: comparing structured data (such as accounts receivable data) of the same company in different time ranges (such as nearly three years), in order to analyze the company's debt situation, capital status and other business information. (such as changes in accounts receivable).
  • the form information structured extraction system 20 can identify the form (such as the PDF annual report form by analyzing the position information and the tag information of the form text content in the specified document (such as a PDF document).
  • the line break situation and the spread situation in the case, and the structured data extraction and storage of the table in which the line break situation and the spread situation occur.
  • the method does not need to convert PDF files into structured documents such as word and excel, and has high data extraction efficiency, high recall rate and high accuracy under large-scale data sets, and facilitates subsequent horizontal comparison analysis, vertical alignment analysis and data modeling. .
  • the present application also proposes a method for structured extraction of form information.
  • FIG. 3 it is a schematic flowchart of an implementation manner of an embodiment of the method for extracting information in the form of the present application.
  • the order of execution of the steps in the flowchart shown in FIG. 3 may be changed according to different requirements, and some steps may be omitted.
  • Step S31 Acquire location information and label information of each line of text in a specified document (such as a PDF document).
  • a specific character recognition tool such as a pdf2html tool
  • the specific text recognition tool can parse the PDF document into a text file (such as an XML file), and at the same time parse the position information and label information of each line of text in each line of the PDF document.
  • the position information of each line of text includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of each line of text.
  • each row of the table in the specified document is stored in an adjacent position, that is, sequentially stored according to position information of each line of text (such as left edge coordinates).
  • the label information of each line of text includes, but is not limited to, a page number of each line of text in the specified document (eg, a PDF document) (ie, a serial number of a page where each line of text is located), a page length, a page width, and the like.
  • Step S32 identifying a line feed situation and a cross-page situation from the table of the specified document according to the position information and the tag information of each line of text.
  • the recognizing the line feed situation from the table of the specified document includes the following steps A1-A2.
  • the table in the specified document can be located by the specific rule of the specified document. For example, if the specified document is a PDF annual report, the annual report is published with a clear format requirement, and the specific form can be judged according to an annual report rule similar to the following:
  • the table title When introducing major customers and suppliers, the table title will be set to "Main sales customers and major suppliers", so this title is followed by a specific form from the customer supplier. According to the title keyword of the specific table, the table introducing the specific content can be positioned to facilitate subsequent analysis. Similarly, other forms in the PDF Annual Report have similar formats.
  • (A2) sequentially reading a line of text in the specific table according to the location information of the specific table, and identifying a cell that is wrapped in the line from the line of text according to the position information of the line of the line.
  • the first row can be read from the left side of the particular table, and the first row can be read according to the table length of the particular table, and the last row of the particular table can be read according to the table width of the particular table.
  • each line of text of the specific table includes a plurality of cells, such as a first cell, a second cell, a third cell, and a fourth cell.
  • the line feed situation includes inline and end of line wrapping.
  • the line break in the line means that there is a line break in the inner cell of a line of text of the specific table.
  • the end of line wrapping means that there is a line break in the tail cell of a line of text of the particular table.
  • the cell that recognizes the inline inline from the line of characters according to the position information of the line of characters includes the following steps A21-A22.
  • (A21) obtaining the position information of the text content of each cell in the line of text, wherein the position information of the text content of each cell includes, but is not limited to, the left edge coordinate and the upper edge coordinate of the text content of each cell Coordinate information such as text width and text length.
  • the form information line-feeding recognition method further comprises the step of: (A3) identifying, from the current line of text, a cell that is wrapped at the end of the line according to the position information of the current line of text.
  • the cell that identifies the end of line break from the current line of text according to the position information of the current line of characters includes the following steps A31-A33.
  • the text content position information of the remaining cells includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of the text content of the remaining cells.
  • the text content of the remaining cells is merged into the next line, and it is determined that the remaining cells are the end-of-line cells of the next line.
  • the cell that identifies the end of line break from the current line of text according to the position information of the current line of characters may further include the following steps A34-A36.
  • the text content position information of the remaining cells includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of the text content of the remaining cells.
  • the text content of the remaining cells is merged into the previous row, and it is determined that the remaining cells are the end-of-line cells of the previous row.
  • steps A1-A2, A21-A22, and A31-A36 are described by taking the case where the form information is changed in a specific form of the PDF file (such as a customer supplier form), and those skilled in the art can It is to be understood that, in other embodiments, the form information line-recognition method may also perform a line-change situation identification for all forms of the PDF file, and details are not described herein.
  • the recognizing the spread situation from the table of the specified document includes the following steps B1-B3 (method 1).
  • the location information of the previous form text content includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of each line of text of the previous table, and The left side of each column of the previous table is along the coordinates.
  • the label information of the previous form text content includes, but is not limited to, the page number of each line of the previous form in the specified document (such as a PDF document) (ie, the serial number of the page where each line of text is located), the page length, and the page width. Wait.
  • the location information of the next table text content includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of each line of the next table, and each column of the next table The left side along the coordinates and so on.
  • the label information of the next form text content includes, but is not limited to, the page number of each line of the next form in the specified document (such as a PDF document) (ie, the serial number of the page where each line of text is located), the page length, and the page width. Wait.
  • (B2) Align the coordinates of the left edge of each column of text in the next table with the coordinates of the left edge of each column of text in the previous table. For example, compare the left edge coordinate of the first column of the next table with the left edge coordinate of the first column of the text of the previous table, and compare the left edge coordinate of the second column of the next table with the second column of the previous table. The left edge of the text along the coordinates, and so on.
  • next form and the previous form are the same form in which the cross-page case exists. If the page number of each line of text in the next table is the same as the page number of each line of the previous form, it is determined that the next form and the previous form are the same form in which there is no cross-page case, that is, the next form and the previous form are located. The same form on the same page.
  • the left edge coordinate of each column of text in the next table and the left edge coordinate of each column of text corresponding to the previous table are less than a preset threshold (eg, 2 pixel unit values) Then, it is determined that the left edge coordinate of each column of text in the next table is the same as the left edge coordinate of each column of text corresponding to the previous table.
  • a preset threshold eg, 2 pixel unit values
  • steps B1-B3 are described by taking the case where the table information is spread across two adjacent tables (the former table and the next table) of the PDF file.
  • the above-mentioned form information cross-page identification method can also perform cross-page situation recognition for a specific form of a PDF file (such as a financial form) (method 2), and the second method includes the following steps B4-B5.
  • the location information of the specific form text content includes, but is not limited to, coordinate information such as left edge coordinates, upper edge coordinates, text width, and text length of each line of the specific table.
  • the tag information of the specific form text content includes, but is not limited to, the page number of each line of the specified form (such as a PDF document) of the specified form (ie, the serial number of the page where the line of text is located), the page length, the page width, and the like.
  • a specific table in the specified document can be located by the specific rule of the specified document. For example, if the specified document is a PDF annual report, the annual report is issued with a clear format requirement, and the specific form can be judged according to an annual report rule similar to the following.
  • the table title When introducing major customers and suppliers, the table title will be set to "Main sales customers and major suppliers", so this title is followed by a specific form from the customer supplier. According to the title keyword of the specific table, the table introducing the specific content can be positioned to facilitate subsequent analysis. Similarly, other specific forms in the PDF Annual Report have similar formats.
  • the page number of each line of the specific table is different, it is determined that the specific table has a cross-page situation (ie, the previous table and the next table in which the specific table is located on different pages are identified). If the page number of each line of the specific table is the same, it is determined that there is no spread situation in the specific form.
  • Step S33 when the linefeed situation is identified from the table of the specified document, the table information is stored in a branch according to the first reshaping rule (the table data is extracted and stored in a branch) and stored in a column (the table data is extracted and stored separately) ), forming structured tabular data.
  • the first reshaping rule includes: storing characters with the same upper edge coordinates as the same row (stored in a branch), and storing the characters with the same coordinates on the left side as the same column (separate column storage) .
  • Step S34 when the cross-page situation is identified from the table of the specified document, the form information is stored and stored in a row according to the second reshaping rule to form structured form data.
  • the second reshaping rule comprises:
  • the characters with the same upper edge coordinates in the stitched table are stored as the same row (stored in the branch), and the characters with the same coordinates on the left side in the stitched table are stored in the same column (separated column storage).
  • deleting the footer of the previous page of the previous table and the header of the next page of the next table include: according to the label information of the previous page and the next page, and the specific rules of the specified document, The footer range of the previous page and the header range of the next page in the specified document are located, and the footer of the previous page and the header of the next page are deleted according to the footer range and the header range determined by the positioning.
  • the label information of the previous page includes, but is not limited to, the page number of the previous page, the page length, the page width, and the like; the label information of the next page includes, but is not limited to, the page number and page of the next page. Length, page width, etc.
  • the specific rules of the specified document include, but are not limited to, the first ratio of the length of the page occupied by the footer of the previous page (such as 8%), and the second ratio of the length of the page of the header of the next page (such as 9%). ). It can be understood that the first ratio and the second ratio may also be the same.
  • the determining rule of the footer range of the previous page is: selecting the first proportion content of the page length of the previous page according to the order from bottom to top, and using the selected first proportion content as the front The footer range of a page.
  • the determining rule of the header range of the next page is: selecting the second proportion content of the page length of the next page according to the order from top to bottom, and using the selected second proportion content as the next page The header range.
  • the table information structured extraction method further comprises the step of performing lateral alignment analysis and longitudinal alignment analysis on the stored structured table data.
  • the horizontal alignment analysis includes: comparing structured form data (such as accounts receivable data) of different companies in the same industry within the same time range (such as one year), in order to analyze debt situation, capital status, etc. of different companies.
  • the longitudinal alignment analysis includes: comparing structured data (such as accounts receivable data) of the same company in different time ranges (such as nearly three years), in order to analyze the company's debt situation, capital status and other business information. (such as changes in accounts receivable).
  • the table information structured extraction method proposed by the present application can identify the table (such as PDF by analyzing the position information and the tag information of the table text content in the specified document (such as a PDF document).
  • the method does not need to convert PDF files into structured documents such as word and excel, and has high data extraction efficiency, high recall rate and high accuracy under large-scale data sets, and facilitates subsequent horizontal comparison analysis, vertical alignment analysis and data modeling. .
  • the present application further provides a computer readable storage medium (such as a ROM/RAM, a magnetic disk, an optical disk), where the computer readable storage medium stores a form information structured extraction system 20,
  • the table information structured extraction system 20 can be executed by at least one processor 22 to cause the at least one processor 22 to perform the steps of the table information structured extraction method as described above.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present application which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)
  • Document Processing Apparatus (AREA)

Abstract

一种表格信息结构化提取方法,该方法包括步骤:获取指定文档(如PDF文档)中每行文字的位置信息和标签信息(S31);根据每行文字的位置信息和标签信息,从该指定文档的表格中识别出换行情形和跨页情形(S32);当从该指定文档的表格中识别出换行情形时,则根据第一重塑规则将表格信息进行分行存储和分列存储(S33);当从该指定文档的表格中识别出跨页情形时,则根据第二重塑规则将表格信息进行分行存储和分列存储(S34)。通过该方法可以进行结构化数据提取和存储。

Description

表格信息结构化提取方法、电子设备及计算机可读存储介质
本申请要求于2017年10月16日提交中国专利局、申请号为201710962303.5、发明名称为“表格信息结构化提取方法、电子设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及计算机信息技术领域,尤其涉及一种表格信息结构化提取方法、电子设备及计算机可读存储介质。
背景技术
现有针对PDF年报中的表格信息抽取,一般是基于OCR技术。但是,在出现换行、换页、特殊字符干扰情况下,OCR技术无法还原和重塑原始表格信息,及进一步的结构化整合,并对使用者造成理解上的困难,也不利于后续的信息比对。故,现有技术中的表格信息提取方法设计不够合理,亟需改进。
发明内容
有鉴于此,本申请提出一种表格信息结构化提取方法、电子设备及计算机可读存储介质,通过分析指定文档(如PDF文档)中表格文字内容的位置信息和标签信息,可以识别出表格(如PDF年报表格)中的换行情形和跨页情形,并对出现换行情形和跨页情形的表格进行结构化数据提取并存储。
首先,为实现上述目的,本申请提出一种电子设备,所述电子设备包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的表格信息结构化提取系统,所述表格信息结构化提取系统被所述处理器执行时实现如下步骤:
获取指定文档中每行文字的位置信息和标签信息;
根据每行文字的位置信息和标签信息,从该指定文档的表格中识别出换行情形和跨页情形;
当从该指定文档的表格中识别出换行情形时,则根据第一重塑规则将表格信息进行分行存储和分列存储;及
当从该指定文档的表格中识别出跨页情形时,则根据第二重塑规则将表格信息进行分行存储和分列存储。
优选地,所述第一重塑规则包括:将上边沿坐标相同的文字存储为同一行,将左边沿坐标相同的文字存储为同一列;
所述第二重塑规则包括:
删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉;
将删除页脚后的前一表格文字内容与删除页眉后的下一表格文字内容进行拼接形成拼接表格;及
将所述拼接表格中上边沿坐标相同的文字存储为同一行,并将所述拼接表格中左边沿坐标相同的文字存储为同一列。
优选地,所述删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉包括:
根据前一页面和下一页面的标签信息、及该指定文档的特定规则,对该指定文档中前一页面的页脚范围和下一页面的页眉范围进行定位,并根据定位确定的页脚范围和页眉范围删除前一页面的页脚和下一页面的页眉;
其中,前一页面的页脚范围的确定规则为:依据从下至上的顺序,选取所述前一页面的页面长度的第一比例内容,将选取的第一比例内容作为所述前一页面的页脚范围;及
下一页面的页眉范围的确定规则为:依据从上至下的顺序,选取所述下一页面的页面长度的第二比例内容,将选取的第二比例内容作为所述下一页面的页眉范围。
优选地,所述换行情形包括行内换行和行尾换行;
其中,所述行内换行的识别包括:
获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的文字内容位置信息包括每个单元格的文字内容的上边沿坐标;及
从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置和最后一次出现的单元格位置,将第一次出现的单元格位置到最后一次出现的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
优选地,所述行尾换行的识别包括:
若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息,其中,所述剩余单元格的文字内容位置信息包括所述剩余单元格的文字内容的上边沿坐标;
计算所述剩余单元格的文字内容上边沿坐标与当前行及下一行所有单元格的文字内容上边沿坐标的距离,或计算所述剩余单元格的文字内容上边沿坐标与当前行及上一行所有单元格的文字内容上边沿坐标的距离;及
若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
此外,为实现上述目的,本申请还提供一种表格信息结构化提取方法,该方法应用于电子设备,所述方法包括:
获取指定文档中每行文字的位置信息和标签信息;
根据每行文字的位置信息和标签信息,从该指定文档的表格中识别出换行情形和跨页情形;
当从该指定文档的表格中识别出换行情形时,则根据第一重塑规则将表格信息进行分行存储和分列存储;及
当从该指定文档的表格中识别出跨页情形时,则根据第二重塑规则将表格信息进行分行存储和分列存储。
优选地,所述第一重塑规则包括:将上边沿坐标相同的文字存储为同一行,将左边沿坐标相同的文字存储为同一列;
所述第二重塑规则包括:
删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉;
将删除页脚后的前一表格文字内容与删除页眉后的下一表格文字内容进行拼接形成拼接表格;及
将所述拼接表格中上边沿坐标相同的文字存储为同一行,并将所述拼接表格中左边沿坐标相同的文字存储为同一列。
优选地,所述删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉包括:
根据前一页面和下一页面的标签信息、及该指定文档的特定规则,对该指定文档中前一页面的页脚范围和下一页面的页眉范围进行定位,并根据定位确定的页脚范围和页眉范围删除前一页面的页脚和下一页面的页眉;
其中,前一页面的页脚范围的确定规则为:依据从下至上的顺序,选取所述前一页面的页面长度的第一比例内容,将选取的第一比例内容作为所述前一页面的页脚范围;及
下一页面的页眉范围的确定规则为:依据从上至下的顺序,选取所述下一页面的页面长度的第二比例内容,将选取的第二比例内容作为所述下一页面的页眉范围。
优选地,所述跨页情形的识别包括:
针对该指定文档中相邻的前一表格和下一表格,获取前一表格文字内容的位置信息、标签信息和下一表格文字内容的位置信息、标签信息;
比对下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标;
当下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标都相同时,比对下一表格每行文字的页码与前一表格每行文字的页码;及
若下一表格每行文字的页码与前一表格每行文字的页码存在不同,则判定下一表格与前一表格为存在跨页情形的同一表格。
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质存储有表格信息结构化提取系统,所述表格信息结构化提取系统可被至少一个处理器执行,以使所述至少一个处理器执行如上述的表格信息结构化提取方法的步骤。
相较于现有技术,本申请所提出的电子设备、表格信息结构化提取方法及计算机可读存储介质,通过分析指定文档(如PDF文档)中表格文字内容的位置信息和标签信息,可以识别出表格(如PDF年报表格)中的换行情形 和跨页情形,并对出现换行情形和跨页情形的表格进行结构化数据提取并存储。该方法无需将PDF文件转化为word、excel等结构化文档,数据提取效率高,大规模数据集下召回率和准确率较高,且利于后续横向比对分析、纵向比对分析及数据建模。
附图说明
图1是本申请电子设备一可选的硬件架构的示意图;
图2是本申请电子设备中表格信息结构化提取系统一实施例的程序模块示意图;
图3为本申请表格信息结构化提取方法一实施例的实施流程示意图。
附图标记:
电子设备 2
存储器 21
处理器 22
网络接口 23
表格信息结构化提取系统 20
获取模块 201
识别模块 202
存储模块 203
流程步骤 S31-S34
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。
进一步需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或 者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
首先,本申请提出一种电子设备2。
参阅图1所示,是本申请电子设备2一可选的硬件架构的示意图。本实施例中,所述电子设备2可包括,但不限于,可通过系统总线相互通信连接存储器21、处理器22、网络接口23。需要指出的是,图1仅示出了具有组件21-23的电子设备2,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
其中,所述电子设备2可以是机架式服务器、刀片式服务器、塔式服务器或机柜式服务器等计算设备,该电子设备2可以是独立的服务器,也可以是多个服务器所组成的服务器集群。
所述存储器21至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述存储器21可以是所述电子设备2的内部存储单元,例如该电子设备2的硬盘或内存。在另一些实施例中,所述存储器21也可以是所述电子设备2的外部存储设备,例如该电子设备2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器21还可以既包括所述电子设备2的内部存储单元也包括其外部存储设备。本实施例中,所述存储器21通常用于存储安装于所述电子设备2的操作系统和各类应用软件,例如所述表格信息结构化提取系统20的程序代码等。此外,所述存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。
所述处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制所述电子设备2的总体操作,例如执行与所述电子设备2进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器22用于运行所述存储器21中存储的程序代码或者处理数据,例如运行所述的表格信息结构化提取系统20等。
所述网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在所述电子设备2与其他电子设备之间建立通信连接。例如,所述网络接口23用于通过网络将所述电子设备2与外部数据平台相连,在所述电子设备2与外部数据平台之间的建立数据传输通道和通信连接。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、 Wi-Fi等无线或有线网络。
至此,己经详细介绍了本申请各个实施例的应用环境和相关设备的硬件结构和功能。下面,将基于上述应用环境和相关设备,提出本申请的各个实施例。
参阅图2所示,是本申请电子设备2中表格信息结构化提取系统20一实施例的程序模块图。本实施例中,所述的表格信息结构化提取系统20可以被分割成一个或多个程序模块,所述一个或者多个程序模块被存储于所述存储器21中,并由一个或多个处理器(本实施例中为所述处理器22)所执行,以完成本申请。例如,在图2中,所述的表格信息结构化提取系统20可以被分割成获取模块201、识别模块202、以及存储模块203。本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述所述表格信息结构化提取系统20在所述电子设备2中的执行过程。以下将就各程序模块201-203的功能进行详细描述。
所述获取模块201,用于获取指定文档(如PDF文档)中每行文字的位置信息和标签信息。在本实施例中,可以使用特定的文字识别工具(如pdf2html工具)获取该指定文档中每行文字的位置信息和标签信息。该特定的文字识别工具可以将PDF文档解析为文本文件(如XML文件),同时解析出每行文本在PDF文档中每行文字的位置信息和标签信息。
优选地,在本实施例中,每行文字的位置信息包括,但不限于,每行文字的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。其中,该指定文档中表格的每一行存储在相邻位置,即依据每行文字的位置信息(如左边沿坐标)依次存储。进一步地,每行文字的标签信息包括,但不限于,每行文字在所述指定文档(如PDF文档)的页码(即每行文字所在页面的序号)、页面长度、页面宽度等。
所述识别模块202,用于根据每行文字的位置信息和标签信息,从该指定文档的表格中识别出换行情形和跨页情形。
具体而言,所述从该指定文档的表格中识别出换行情形包括如下步骤A1-A2。
(A1)定位该指定文档中的特定表格,获取该特定表格的位置信息,如该特定表格的左边沿坐标、表格宽度(表格高度)、和表格长度等。在本实施例中,可以通过该指定文档的特定规则,对该指定文档中的表格进行定位。例如,若该指定文档为PDF年报,则年报发布有明确的格式要求,可以根据类似下述的年报规则对特定表格进行判断:
如介绍主要客户和供应商时,表格标题会设为“主要销售客户和主要供应商情况”,因此这一标题后面就是客户供应商的特定表格。根据特定表格的标题关键词,则可以对介绍特定内容的表格进行定位,方便后续的解析。同理,PDF年报中的其它表格都有类似的格式。
(A2)根据该特定表格的位置信息依次读取该特定表格中的一行文字,并根据该行文字的位置信息从该行文字中识别出行内换行的单元格。在本实施例中,可以从该特定表格的左边沿坐标开始,根据该特定表格的表格长度读取第一行,并根据该特定表格的表格宽度直至读取到该特定表格的最后一行。
优选地,在本实施例中,该特定表格的每行文字包括多个单元格,如第1单元格、第2单元格、第3单元格、第4单元格。更具体而言,所述换行情形包括行内换行和行尾换行。所述行内换行是指:在该特定表格的一行文字的内部单元格中存在换行情形。所述行尾换行是指:在该特定表格的一行文字的尾部单元格中存在换行情形。
优选地,在本实施例中,所述根据该行文字的位置信息从该行文字中识别出行内换行的单元格包括如下步骤A21-A22。
(A21)获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的文字内容位置信息包括,但不限于,每个单元格的文字内容的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。
(A22)从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置和最后一次出现的单元格位置(即找到相同上边沿坐标第一次出现的单元格位置和最后一次出现的单元格位置),将第一次出现的单元格位置到最后一次出现的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
优选地,在其它实施例中,所述表格信息换行识别还包括步骤:(A3)根据当前行文字的位置信息从当前行文字中识别出行尾换行的单元格。
具体而言,所述根据当前行文字的位置信息从当前行文字中识别出行尾换行的单元格包括如下步骤A31-A33。
(A31)若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息。其中,所述剩余单元格的文字内容位置信息包括,但不限于,所述剩余单元格的文字内容的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。
(A32)计算所述剩余单元格的文字内容上边沿坐标与当前行(如第一行)及下一行(如第二行)所有单元格的文字内容上边沿坐标的距离。
(A33)若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
进一步地,若距离最小值出现在下一行,则将所述剩余单元格的文字内容并入下一行,并判定所述剩余单元格为下一行的行尾换行单元格。
需要说明的是,在其它实施例中,所述根据当前行文字的位置信息从当前行文字中识别出行尾换行的单元格还可以包括如下步骤A34-A36。
(A34)若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩 余单元格的文字内容位置信息。其中,所述剩余单元格的文字内容位置信息包括,但不限于,所述剩余单元格的文字内容的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。
(A35)计算所述剩余单元格的文字内容上边沿坐标与当前行(如第二行)及上一行(如第一行)所有单元格的文字内容上边沿坐标的距离。
(A36)若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
进一步地,若距离最小值出现在上一行,则将所述剩余单元格的文字内容并入上一行,并判定所述剩余单元格为上一行的行尾换行单元格。
需要说明的是,上述步骤A1-A2、A21-A22、A31-A36是以在PDF文件的特定表格(如客户供应商表格)中识别出表格信息换行情形为例进行说明,本领域技术人员可以理解,在其它实施例中,上述表格信息换行识别方法也可以针对PDF文件的所有表格进行换行情形识别,在此不再赘述。
进一步地,所述从该指定文档的表格中识别出跨页情形包括如下步骤B1-B3(方法一)。
(B1)针对该指定文档中相邻的前一表格和下一表格,获取前一表格文字内容的位置信息、标签信息和下一表格文字内容的位置信息、标签信息。
优选地,在本实施例中,所述前一表格文字内容的位置信息包括,但不限于,前一表格每行文字的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息,及前一表格每列文字的左边沿坐标等。所述前一表格文字内容的标签信息包括,但不限于,前一表格每行文字在所述指定文档(如PDF文档)的页码(即每行文字所在页面的序号)、页面长度、页面宽度等。
进一步地,所述下一表格文字内容的位置信息包括,但不限于,下一表格每行文字的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息,及下一表格每列文字的左边沿坐标等。所述下一表格文字内容的标签信息包括,但不限于,下一表格每行文字在所述指定文档(如PDF文档)的页码(即每行文字所在页面的序号)、页面长度、页面宽度等。
(B2)比对下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标。举例而言,比对下一表格第1列文字的左边沿坐标与前一表格第1列文字的左边沿坐标,比对下一表格第2列文字的左边沿坐标与前一表格第2列文字的左边沿坐标,依此类推。
(B3)当下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标都相同时(代表下一表格与前一表格为同一表格),则比对下一表格每行文字的页码与前一表格每行文字的页码。举例而言,第一页的页尾包括前一表格,第二页的页首包括下一表格,其中,下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标都相同,则判定下一表格与前一表格为同一表格。
若下一表格每行文字的页码与前一表格每行文字的页码存在不同,则判定下一表格与前一表格为存在跨页情形的同一表格。若下一表格每行文字的页码与前一表格每行文字的页码都相同,则判定下一表格与前一表格为不存在跨页情形的同一表格,即下一表格与前一表格为位于同一页面的同一表格。
优选地,在本实施例中,若下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标之间的差值都小于预设阈值(如2个像素单位值),则判定下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标都相同。
需要说明的是,上述步骤B1-B3(方法一)是以在PDF文件的相邻两个表格(前一表格和下一表格)中识别出表格信息跨页情形为例进行说明,本领域技术人员可以理解,在其它实施例中,上述表格信息跨页识别也可以针对PDF文件的特定表格(如财务表格)进行跨页情形识别(方法二),方法二包括如下步骤B4-B5。
(B4)定位该指定文档中的特定表格,获取该特定表格文字内容的位置信息和标签信息。其中,该特定表格文字内容的位置信息包括,但不限于,该特定表格每行文字的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。该特定表格文字内容的标签信息包括,但不限于,该特定表格每行文字在所述指定文档(如PDF文档)的页码(即每行文字所在页面的序号)、页面长度、页面宽度等。
具体而言,可以通过该指定文档的特定规则,对该指定文档中的特定表格进行定位。例如,若该指定文档为PDF年报,则年报发布有明确的格式要求,可以根据类似下述的年报规则对特定表格进行判断。
如介绍主要客户和供应商时,表格标题会设为“主要销售客户和主要供应商情况”,因此这一标题后面就是客户供应商的特定表格。根据特定表格的标题关键词,则可以对介绍特定内容的表格进行定位,方便后续的解析。同理,PDF年报中的其它特定表格都有类似的格式。
(B5)根据该特定表格文字内容的位置信息(如上边沿坐标)依次读取该特定表格的每行文字(如上边沿坐标相同的文字为同一行),并根据该特定表格文字内容的标签信息获取每行文字的页码。
若该特定表格每行文字的页码存在不同,则判定该特定表格存在跨页情形(即识别出该特定表格位于不同页面的前一表格和下一表格)。若该特定表格每行文字的页码都相同,则判定该特定表格不存在跨页情形。
所述存储模块203,用于当从该指定文档的表格中识别出换行情形时,则根据第一重塑规则将表格信息进行分行存储(分行提取表格数据并存储)和分列存储(分列提取表格数据并存储),形成结构化的表格数据。
优选地,在本实施例中,所述第一重塑规则包括:将上边沿坐标相同的文字存储为同一行(分行存储),将左边沿坐标相同的文字存储为同一列(分 列存储)。
所述存储模块203,还用于当从该指定文档的表格中识别出跨页情形时,则根据第二重塑规则将表格信息进行分行存储和分列存储,形成结构化的表格数据。
优选地,在本实施例中,所述第二重塑规则包括:
删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉;
将删除页脚后的前一表格文字内容与删除页眉后的下一表格文字内容进行拼接形成拼接表格(即形成同一页的表格);及
将所述拼接表格中上边沿坐标相同的文字存储为同一行(分行存储),并将所述拼接表格中左边沿坐标相同的文字存储为同一列(分列存储)。
具体而言,所述删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉包括:根据前一页面和下一页面的标签信息、及该指定文档的特定规则,对该指定文档中前一页面的页脚范围和下一页面的页眉范围进行定位,并根据定位确定的页脚范围和页眉范围删除前一页面的页脚和下一页面的页眉。
其中,所述前一页面的标签信息包括,但不限于,前一页面的页码、页面长度、页面宽度等;所述下一页面的标签信息包括,但不限于,下一页面的页码、页面长度、页面宽度等。该指定文档的特定规则包括,但不限于,前一页面的页脚所占页面长度的第一比例(如8%)、下一页面的页眉所占页面长度的第二比例(如9%)。可以理解,所述第一比例和第二比例也可以相同。
进一步地,所述前一页面的页脚范围的确定规则为:依据从下至上的顺序,选取所述前一页面的页面长度的第一比例内容,将选取的第一比例内容作为所述前一页面的页脚范围。所述下一页面的页眉范围的确定规则为:依据从上至下的顺序,选取所述下一页面的页面长度的第二比例内容,将选取的第二比例内容作为所述下一页面的页眉范围。
优选地,在其它实施例中,所述表格信息结构化提取系统20还用于:针对存储的结构化表格数据进行横向比对分析和纵向比对分析。
其中,所述横向比对分析包括:比对同一时间范围内(如同一年)同一行业不同公司的结构化表格数据(如应收账款数据),以便分析不同公司的债务情况、资金状况等经营信息。所述纵向比对分析包括:比对同一公司在不同时间范围内(如近三年)的结构化表格数据(如应收账款数据),以便分析该公司的债务情况、资金状况等经营信息(如应收账款变化)。
通过上述程序模块201-203,本申请所提出的表格信息结构化提取系统20,通过分析指定文档(如PDF文档)中表格文字内容的位置信息和标签信息,可以识别出表格(如PDF年报表格)中的换行情形和跨页情形,并对出 现换行情形和跨页情形的表格进行结构化数据提取并存储。该方法无需将PDF文件转化为word、excel等结构化文档,数据提取效率高,大规模数据集下召回率和准确率较高,且利于后续横向比对分析、纵向比对分析及数据建模。
此外,本申请还提出一种表格信息结构化提取方法。
参阅图3所示,是本申请表格信息结构化提取方法一实施例的实施流程示意图。在本实施例中,根据不同的需求,图3所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。
步骤S31,获取指定文档(如PDF文档)中每行文字的位置信息和标签信息。在本实施例中,可以使用特定的文字识别工具(如pdf2html工具)获取该指定文档中每行文字的位置信息和标签信息。该特定的文字识别工具可以将PDF文档解析为文本文件(如XML文件),同时解析出每行文本在PDF文档中每行文字的位置信息和标签信息。
优选地,在本实施例中,每行文字的位置信息包括,但不限于,每行文字的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。其中,该指定文档中表格的每一行存储在相邻位置,即依据每行文字的位置信息(如左边沿坐标)依次存储。进一步地,每行文字的标签信息包括,但不限于,每行文字在所述指定文档(如PDF文档)的页码(即每行文字所在页面的序号)、页面长度、页面宽度等。
步骤S32,根据每行文字的位置信息和标签信息,从该指定文档的表格中识别出换行情形和跨页情形。
具体而言,所述从该指定文档的表格中识别出换行情形包括如下步骤A1-A2。
(A1)定位该指定文档中的特定表格,获取该特定表格的位置信息,如该特定表格的左边沿坐标、表格宽度(表格高度)、和表格长度等。在本实施例中,可以通过该指定文档的特定规则,对该指定文档中的表格进行定位。例如,若该指定文档为PDF年报,则年报发布有明确的格式要求,可以根据类似下述的年报规则对特定表格进行判断:
如介绍主要客户和供应商时,表格标题会设为“主要销售客户和主要供应商情况”,因此这一标题后面就是客户供应商的特定表格。根据特定表格的标题关键词,则可以对介绍特定内容的表格进行定位,方便后续的解析。同理,PDF年报中的其它表格都有类似的格式。
(A2)根据该特定表格的位置信息依次读取该特定表格中的一行文字,并根据该行文字的位置信息从该行文字中识别出行内换行的单元格。在本实施例中,可以从该特定表格的左边沿坐标开始,根据该特定表格的表格长度读取第一行,并根据该特定表格的表格宽度直至读取到该特定表格的最后一行。
优选地,在本实施例中,该特定表格的每行文字包括多个单元格,如第1单元格、第2单元格、第3单元格、第4单元格。更具体而言,所述换行情形包括行内换行和行尾换行。所述行内换行是指:在该特定表格的一行文字的内部单元格中存在换行情形。所述行尾换行是指:在该特定表格的一行文字的尾部单元格中存在换行情形。
优选地,在本实施例中,所述根据该行文字的位置信息从该行文字中识别出行内换行的单元格包括如下步骤A21-A22。
(A21)获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的文字内容位置信息包括,但不限于,每个单元格的文字内容的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。
(A22)从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置和最后一次出现的单元格位置(即找到相同上边沿坐标第一次出现的单元格位置和最后一次出现的单元格位置),将第一次出现的单元格位置到最后一次出现的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
优选地,在其它实施例中,所述表格信息换行识别方法还包括步骤:(A3)根据当前行文字的位置信息从当前行文字中识别出行尾换行的单元格。
具体而言,所述根据当前行文字的位置信息从当前行文字中识别出行尾换行的单元格包括如下步骤A31-A33。
(A31)若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息。其中,所述剩余单元格的文字内容位置信息包括,但不限于,所述剩余单元格的文字内容的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。
(A32)计算所述剩余单元格的文字内容上边沿坐标与当前行(如第一行)及下一行(如第二行)所有单元格的文字内容上边沿坐标的距离。
(A33)若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
进一步地,若距离最小值出现在下一行,则将所述剩余单元格的文字内容并入下一行,并判定所述剩余单元格为下一行的行尾换行单元格。
需要说明的是,在其它实施例中,所述根据当前行文字的位置信息从当前行文字中识别出行尾换行的单元格还可以包括如下步骤A34-A36。
(A34)若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息。其中,所述剩余单元格的文字内容位置信息包括,但不限于,所述剩余单元格的文字内容的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。
(A35)计算所述剩余单元格的文字内容上边沿坐标与当前行(如第二行)及上一行(如第一行)所有单元格的文字内容上边沿坐标的距离。
(A36)若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
进一步地,若距离最小值出现在上一行,则将所述剩余单元格的文字内容并入上一行,并判定所述剩余单元格为上一行的行尾换行单元格。
需要说明的是,上述步骤A1-A2、A21-A22、A31-A36是以在PDF文件的特定表格(如客户供应商表格)中识别出表格信息换行情形为例进行说明,本领域技术人员可以理解,在其它实施例中,上述表格信息换行识别方法也可以针对PDF文件的所有表格进行换行情形识别,在此不再赘述。
进一步地,所述从该指定文档的表格中识别出跨页情形包括如下步骤B1-B3(方法一)。
(B1)针对该指定文档中相邻的前一表格和下一表格,获取前一表格文字内容的位置信息、标签信息和下一表格文字内容的位置信息、标签信息。
优选地,在本实施例中,所述前一表格文字内容的位置信息包括,但不限于,前一表格每行文字的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息,及前一表格每列文字的左边沿坐标等。所述前一表格文字内容的标签信息包括,但不限于,前一表格每行文字在所述指定文档(如PDF文档)的页码(即每行文字所在页面的序号)、页面长度、页面宽度等。
进一步地,所述下一表格文字内容的位置信息包括,但不限于,下一表格每行文字的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息,及下一表格每列文字的左边沿坐标等。所述下一表格文字内容的标签信息包括,但不限于,下一表格每行文字在所述指定文档(如PDF文档)的页码(即每行文字所在页面的序号)、页面长度、页面宽度等。
(B2)比对下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标。举例而言,比对下一表格第1列文字的左边沿坐标与前一表格第1列文字的左边沿坐标,比对下一表格第2列文字的左边沿坐标与前一表格第2列文字的左边沿坐标,依此类推。
(B3)当下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标都相同时(代表下一表格与前一表格为同一表格),则比对下一表格每行文字的页码与前一表格每行文字的页码。举例而言,第一页的页尾包括前一表格,第二页的页首包括下一表格,其中,下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标都相同,则判定下一表格与前一表格为同一表格。
若下一表格每行文字的页码与前一表格每行文字的页码存在不同,则判定下一表格与前一表格为存在跨页情形的同一表格。若下一表格每行文字的页码与前一表格每行文字的页码都相同,则判定下一表格与前一表格为不存在跨页情形的同一表格,即下一表格与前一表格为位于同一页面的同一表格。
优选地,在本实施例中,若下一表格每列文字的左边沿坐标与前一表格 对应每列文字的左边沿坐标之间的差值都小于预设阈值(如2个像素单位值),则判定下一表格每列文字的左边沿坐标与前一表格对应每列文字的左边沿坐标都相同。
需要说明的是,上述步骤B1-B3(方法一)是以在PDF文件的相邻两个表格(前一表格和下一表格)中识别出表格信息跨页情形为例进行说明,本领域技术人员可以理解,在其它实施例中,上述表格信息跨页识别方法也可以针对PDF文件的特定表格(如财务表格)进行跨页情形识别(方法二),方法二包括如下步骤B4-B5。
(B4)定位该指定文档中的特定表格,获取该特定表格文字内容的位置信息和标签信息。其中,该特定表格文字内容的位置信息包括,但不限于,该特定表格每行文字的左边沿坐标、上边沿坐标、文本宽度、文本长度等坐标信息。该特定表格文字内容的标签信息包括,但不限于,该特定表格每行文字在所述指定文档(如PDF文档)的页码(即每行文字所在页面的序号)、页面长度、页面宽度等。
具体而言,可以通过该指定文档的特定规则,对该指定文档中的特定表格进行定位。例如,若该指定文档为PDF年报,则年报发布有明确的格式要求,可以根据类似下述的年报规则对特定表格进行判断。
如介绍主要客户和供应商时,表格标题会设为“主要销售客户和主要供应商情况”,因此这一标题后面就是客户供应商的特定表格。根据特定表格的标题关键词,则可以对介绍特定内容的表格进行定位,方便后续的解析。同理,PDF年报中的其它特定表格都有类似的格式。
(B5)根据该特定表格文字内容的位置信息(如上边沿坐标)依次读取该特定表格的每行文字(如上边沿坐标相同的文字为同一行),并根据该特定表格文字内容的标签信息获取每行文字的页码。
若该特定表格每行文字的页码存在不同,则判定该特定表格存在跨页情形(即识别出该特定表格位于不同页面的前一表格和下一表格)。若该特定表格每行文字的页码都相同,则判定该特定表格不存在跨页情形。
步骤S33,当从该指定文档的表格中识别出换行情形时,则根据第一重塑规则将表格信息进行分行存储(分行提取表格数据并存储)和分列存储(分列提取表格数据并存储),形成结构化的表格数据。
优选地,在本实施例中,所述第一重塑规则包括:将上边沿坐标相同的文字存储为同一行(分行存储),将左边沿坐标相同的文字存储为同一列(分列存储)。
步骤S34,当从该指定文档的表格中识别出跨页情形时,则根据第二重塑规则将表格信息进行分行存储和分列存储,形成结构化的表格数据。
优选地,在本实施例中,所述第二重塑规则包括:
删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉;
将删除页脚后的前一表格文字内容与删除页眉后的下一表格文字内容进行拼接形成拼接表格(即形成同一页的表格);及
将所述拼接表格中上边沿坐标相同的文字存储为同一行(分行存储),并将所述拼接表格中左边沿坐标相同的文字存储为同一列(分列存储)。
具体而言,所述删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉包括:根据前一页面和下一页面的标签信息、及该指定文档的特定规则,对该指定文档中前一页面的页脚范围和下一页面的页眉范围进行定位,并根据定位确定的页脚范围和页眉范围删除前一页面的页脚和下一页面的页眉。
其中,所述前一页面的标签信息包括,但不限于,前一页面的页码、页面长度、页面宽度等;所述下一页面的标签信息包括,但不限于,下一页面的页码、页面长度、页面宽度等。该指定文档的特定规则包括,但不限于,前一页面的页脚所占页面长度的第一比例(如8%)、下一页面的页眉所占页面长度的第二比例(如9%)。可以理解,所述第一比例和第二比例也可以相同。
进一步地,所述前一页面的页脚范围的确定规则为:依据从下至上的顺序,选取所述前一页面的页面长度的第一比例内容,将选取的第一比例内容作为所述前一页面的页脚范围。所述下一页面的页眉范围的确定规则为:依据从上至下的顺序,选取所述下一页面的页面长度的第二比例内容,将选取的第二比例内容作为所述下一页面的页眉范围。
优选地,在其它实施例中,所述表格信息结构化提取方法还包括步骤:针对存储的结构化表格数据进行横向比对分析和纵向比对分析。
其中,所述横向比对分析包括:比对同一时间范围内(如同一年)同一行业不同公司的结构化表格数据(如应收账款数据),以便分析不同公司的债务情况、资金状况等经营信息。所述纵向比对分析包括:比对同一公司在不同时间范围内(如近三年)的结构化表格数据(如应收账款数据),以便分析该公司的债务情况、资金状况等经营信息(如应收账款变化)。
通过上述步骤S31-S34及其它相关步骤,本申请所提出的表格信息结构化提取方法,通过分析指定文档(如PDF文档)中表格文字内容的位置信息和标签信息,可以识别出表格(如PDF年报表格)中的换行情形和跨页情形,并对出现换行情形和跨页情形的表格进行结构化数据提取并存储。该方法无需将PDF文件转化为word、excel等结构化文档,数据提取效率高,大规模数据集下召回率和准确率较高,且利于后续横向比对分析、纵向比对分析及数据建模。
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质(如ROM/RAM、磁碟、光盘),所述计算机可读存储介质存储有表格信息结构化 提取系统20,所述表格信息结构化提取系统20可被至少一个处理器22执行,以使所述至少一个处理器22执行如上所述的表格信息结构化提取方法的步骤。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件来实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上参照附图说明了本申请的优选实施例,并非因此局限本申请的权利范围。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
本领域技术人员不脱离本申请的范围和实质,可以有多种变型方案实现本申请,比如作为一个实施例的特征可用于另一实施例而得到又一实施例。凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种电子设备,其特征在于,所述电子设备包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的表格信息结构化提取系统,所述表格信息结构化提取系统被所述处理器执行时实现如下步骤:
    获取指定文档中每行文字的位置信息和标签信息;
    根据每行文字的位置信息和标签信息,从该指定文档的表格中识别出换行情形和跨页情形;
    当从该指定文档的表格中识别出换行情形时,则根据第一重塑规则将表格信息进行分行存储和分列存储;及
    当从该指定文档的表格中识别出跨页情形时,则根据第二重塑规则将表格信息进行分行存储和分列存储。
  2. 如权利要求1所述的电子设备,其特征在于,所述第一重塑规则包括:将上边沿坐标相同的文字存储为同一行,将左边沿坐标相同的文字存储为同一列;
    所述第二重塑规则包括:
    删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉;
    将删除页脚后的前一表格文字内容与删除页眉后的下一表格文字内容进行拼接形成拼接表格;及
    将所述拼接表格中上边沿坐标相同的文字存储为同一行,并将所述拼接表格中左边沿坐标相同的文字存储为同一列。
  3. 如权利要求2所述的电子设备,其特征在于,所述删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉包括:
    根据前一页面和下一页面的标签信息、及该指定文档的特定规则,对该指定文档中前一页面的页脚范围和下一页面的页眉范围进行定位,并根据定位确定的页脚范围和页眉范围删除前一页面的页脚和下一页面的页眉;
    其中,前一页面的页脚范围的确定规则为:依据从下至上的顺序,选取所述前一页面的页面长度的第一比例内容,将选取的第一比例内容作为所述前一页面的页脚范围;及
    下一页面的页眉范围的确定规则为:依据从上至下的顺序,选取所述下一页面的页面长度的第二比例内容,将选取的第二比例内容作为所述下一页面的页眉范围。
  4. 如权利要求2所述的电子设备,其特征在于,所述换行情形包括行内换行和行尾换行;
    其中,所述行内换行的识别包括:
    获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的 文字内容位置信息包括每个单元格的文字内容的上边沿坐标;及
    从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置和最后一次出现的单元格位置,将第一次出现的单元格位置到最后一次出现的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
  5. 如权利要求3所述的电子设备,其特征在于,所述换行情形包括行内换行和行尾换行;
    其中,所述行内换行的识别包括:
    获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的文字内容位置信息包括每个单元格的文字内容的上边沿坐标;及
    从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置和最后一次出现的单元格位置,将第一次出现的单元格位置到最后一次出现的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
  6. 如权利要求4所述的电子设备,其特征在于,所述行尾换行的识别包括:
    若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息,其中,所述剩余单元格的文字内容位置信息包括所述剩余单元格的文字内容的上边沿坐标;
    计算所述剩余单元格的文字内容上边沿坐标与当前行及下一行所有单元格的文字内容上边沿坐标的距离,或计算所述剩余单元格的文字内容上边沿坐标与当前行及上一行所有单元格的文字内容上边沿坐标的距离;及
    若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
  7. 如权利要求5所述的电子设备,其特征在于,所述行尾换行的识别包括:
    若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息,其中,所述剩余单元格的文字内容位置信息包括所述剩余单元格的文字内容的上边沿坐标;
    计算所述剩余单元格的文字内容上边沿坐标与当前行及下一行所有单元格的文字内容上边沿坐标的距离,或计算所述剩余单元格的文字内容上边沿坐标与当前行及上一行所有单元格的文字内容上边沿坐标的距离;及
    若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
  8. 一种表格信息结构化提取方法,应用于电子设备,其特征在于,所述方法包括:
    获取指定文档中每行文字的位置信息和标签信息;
    根据每行文字的位置信息和标签信息,从该指定文档的表格中识别出换行情形和跨页情形;
    当从该指定文档的表格中识别出换行情形时,则根据第一重塑规则将表格信息进行分行存储和分列存储;及
    当从该指定文档的表格中识别出跨页情形时,则根据第二重塑规则将表格信息进行分行存储和分列存储。
  9. 如权利要求8所述的表格信息结构化提取方法,其特征在于,所述第一重塑规则包括:将上边沿坐标相同的文字存储为同一行,将左边沿坐标相同的文字存储为同一列;
    所述第二重塑规则包括:
    删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉;
    将删除页脚后的前一表格文字内容与删除页眉后的下一表格文字内容进行拼接形成拼接表格;及
    将所述拼接表格中上边沿坐标相同的文字存储为同一行,并将所述拼接表格中左边沿坐标相同的文字存储为同一列。
  10. 如权利要求9所述的表格信息结构化提取方法,其特征在于,所述删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉包括:
    根据前一页面和下一页面的标签信息、及该指定文档的特定规则,对该指定文档中前一页面的页脚范围和下一页面的页眉范围进行定位,并根据定位确定的页脚范围和页眉范围删除前一页面的页脚和下一页面的页眉;
    其中,前一页面的页脚范围的确定规则为:依据从下至上的顺序,选取所述前一页面的页面长度的第一比例内容,将选取的第一比例内容作为所述前一页面的页脚范围;及
    下一页面的页眉范围的确定规则为:依据从上至下的顺序,选取所述下一页面的页面长度的第二比例内容,将选取的第二比例内容作为所述下一页面的页眉范围。
  11. 如权利要求9所述的表格信息结构化提取方法,其特征在于,所述换行情形包括行内换行和行尾换行;
    其中,所述行内换行的识别包括:
    获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的文字内容位置信息包括每个单元格的文字内容的上边沿坐标;及
    从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置 和最后一次出现的单元格位置,将第一次出现的单元格位置到最后一次出现的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
  12. 如权利要求10所述的表格信息结构化提取方法,其特征在于,所述换行情形包括行内换行和行尾换行;
    其中,所述行内换行的识别包括:
    获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的文字内容位置信息包括每个单元格的文字内容的上边沿坐标;及
    从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置和最后一次出现的单元格位置,将第一次出现的单元格位置到最后一次出现的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
  13. 如权利要求11所述的表格信息结构化提取方法,其特征在于,所述行尾换行的识别包括:
    若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息,其中,所述剩余单元格的文字内容位置信息包括所述剩余单元格的文字内容的上边沿坐标;
    计算所述剩余单元格的文字内容上边沿坐标与当前行及下一行所有单元格的文字内容上边沿坐标的距离,或计算所述剩余单元格的文字内容上边沿坐标与当前行及上一行所有单元格的文字内容上边沿坐标的距离;及
    若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
  14. 如权利要求12所述的表格信息结构化提取方法,其特征在于,所述行尾换行的识别包括:
    若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息,其中,所述剩余单元格的文字内容位置信息包括所述剩余单元格的文字内容的上边沿坐标;
    计算所述剩余单元格的文字内容上边沿坐标与当前行及下一行所有单元格的文字内容上边沿坐标的距离,或计算所述剩余单元格的文字内容上边沿坐标与当前行及上一行所有单元格的文字内容上边沿坐标的距离;及
    若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
  15. 一种计算机可读存储介质,所述计算机可读存储介质存储有表格信息 结构化提取系统,所述表格信息结构化提取系统可被至少一个处理器执行,所述表格信息结构化提取系统被所述处理器执行时实现如下步骤:
    获取指定文档中每行文字的位置信息和标签信息;
    根据每行文字的位置信息和标签信息,从该指定文档的表格中识别出换行情形和跨页情形;
    当从该指定文档的表格中识别出换行情形时,则根据第一重塑规则将表格信息进行分行存储和分列存储;及
    当从该指定文档的表格中识别出跨页情形时,则根据第二重塑规则将表格信息进行分行存储和分列存储。
  16. 如权利要求15所述的计算机可读存储介质,其特征在于,所述第一重塑规则包括:将上边沿坐标相同的文字存储为同一行,将左边沿坐标相同的文字存储为同一列;
    所述第二重塑规则包括:
    删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉;
    将删除页脚后的前一表格文字内容与删除页眉后的下一表格文字内容进行拼接形成拼接表格;及
    将所述拼接表格中上边沿坐标相同的文字存储为同一行,并将所述拼接表格中左边沿坐标相同的文字存储为同一列。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述删除前一表格所在前一页面的页脚和下一表格所在下一页面的页眉包括:
    根据前一页面和下一页面的标签信息、及该指定文档的特定规则,对该指定文档中前一页面的页脚范围和下一页面的页眉范围进行定位,并根据定位确定的页脚范围和页眉范围删除前一页面的页脚和下一页面的页眉;
    其中,前一页面的页脚范围的确定规则为:依据从下至上的顺序,选取所述前一页面的页面长度的第一比例内容,将选取的第一比例内容作为所述前一页面的页脚范围;及
    下一页面的页眉范围的确定规则为:依据从上至下的顺序,选取所述下一页面的页面长度的第二比例内容,将选取的第二比例内容作为所述下一页面的页眉范围。
  18. 如权利要求16所述的计算机可读存储介质,其特征在于,所述换行情形包括行内换行和行尾换行;
    其中,所述行内换行的识别包括:
    获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的文字内容位置信息包括每个单元格的文字内容的上边沿坐标;及
    从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置和最后一次出现的单元格位置,将第一次出现的单元格位置到最后一次出现 的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
  19. 如权利要求17所述的计算机可读存储介质,其特征在于,所述换行情形包括行内换行和行尾换行;
    其中,所述行内换行的识别包括:
    获取该行文字中每个单元格的文字内容位置信息,其中,每个单元格的文字内容位置信息包括每个单元格的文字内容的上边沿坐标;及
    从文字内容上边沿坐标相同的单元格中,获取第一次出现的单元格位置和最后一次出现的单元格位置,将第一次出现的单元格位置到最后一次出现的单元格位置的所有单元格确定为同一行,并判定第一次出现的单元格位置与最后一次出现的单元格位置之间文字内容上边沿坐标不同的单元格为行内换行的单元格。
  20. 如权利要求18或19所述的计算机可读存储介质,其特征在于,所述行尾换行的识别包括:
    若行内换行识别后当前行文字中存在剩余单元格,则获取所述剩余单元格的文字内容位置信息,其中,所述剩余单元格的文字内容位置信息包括所述剩余单元格的文字内容的上边沿坐标;
    计算所述剩余单元格的文字内容上边沿坐标与当前行及下一行所有单元格的文字内容上边沿坐标的距离,或计算所述剩余单元格的文字内容上边沿坐标与当前行及上一行所有单元格的文字内容上边沿坐标的距离;及
    若距离最小值出现在当前行,则将所述剩余单元格的文字内容并入当前行,并判定所述剩余单元格为当前行的行尾换行单元格。
PCT/CN2018/076167 2017-10-16 2018-02-10 表格信息结构化提取方法、电子设备及计算机可读存储介质 Ceased WO2019075969A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710962303.5A CN107818075A (zh) 2017-10-16 2017-10-16 表格信息结构化提取方法、电子设备及计算机可读存储介质
CN201710962303.5 2017-10-16

Publications (1)

Publication Number Publication Date
WO2019075969A1 true WO2019075969A1 (zh) 2019-04-25

Family

ID=61608392

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/076167 Ceased WO2019075969A1 (zh) 2017-10-16 2018-02-10 表格信息结构化提取方法、电子设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN107818075A (zh)
WO (1) WO2019075969A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11436249B1 (en) 2021-03-26 2022-09-06 International Business Machines Corporation Transformation of composite tables into structured database content

Families Citing this family (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062874B (zh) * 2018-06-12 2022-03-04 平安科技(深圳)有限公司 财政数据的获取方法、终端设备及介质
CN109002425B (zh) * 2018-06-19 2022-03-22 平安科技(深圳)有限公司 企业上下游关系的获取方法、终端设备及介质
CN109542898A (zh) * 2018-10-30 2019-03-29 天津字节跳动科技有限公司 资料库表格的数据存储方法、装置、电子设备及存储介质
CN109522538B (zh) * 2018-11-28 2021-10-29 腾讯科技(深圳)有限公司 表格内容的自动分列方法、装置、设备及存储介质
CN109871524B (zh) * 2019-02-21 2023-06-09 腾讯科技(深圳)有限公司 一种图表生成方法及装置
CN110032718B (zh) * 2019-04-12 2023-04-18 广州广燃设计有限公司 一种表格转换方法、系统和存储介质
CN110489423B (zh) * 2019-08-26 2021-10-08 北京香侬慧语科技有限责任公司 一种信息抽取的方法、装置、存储介质及电子设备
CN110489424B (zh) * 2019-08-26 2021-10-12 北京香侬慧语科技有限责任公司 一种表格化信息提取的方法、装置、存储介质及电子设备
CN110569846B (zh) * 2019-09-16 2025-08-29 北京百度网讯科技有限公司 图像文字识别方法、装置、设备及存储介质
CN110909123B (zh) * 2019-10-23 2023-08-25 深圳价值在线信息科技股份有限公司 一种数据提取方法、装置、终端设备及存储介质
CN112287660B (zh) * 2019-12-04 2024-05-31 上海柯林布瑞信息技术有限公司 Pdf文件中的表格解析方法及装置、计算设备、存储介质
CN111626030A (zh) * 2020-07-28 2020-09-04 浙江明度智控科技有限公司 一种用于医药行业的表格差异化内容分析方法、系统和存储介质
CN112380825B (zh) * 2020-11-17 2022-07-15 平安科技(深圳)有限公司 Pdf文档跨页表格合并方法、装置、电子设备及存储介质
CN112464626B (zh) * 2020-12-09 2022-04-01 上海携宁计算机科技股份有限公司 Pdf文档的图表提取方法、电子设备和存储介质
CN113536874A (zh) * 2020-12-18 2021-10-22 腾讯科技(深圳)有限公司 表格识别方法、模型训练方法、装置及设备
CN112651331B (zh) * 2020-12-24 2024-04-16 万兴科技集团股份有限公司 文本表格提取方法、系统、计算机设备及存储介质
CN112632927A (zh) * 2020-12-30 2021-04-09 上海犀语科技有限公司 一种基于语义处理的表格片段链接复原方法及系统
CN113111864A (zh) * 2021-05-13 2021-07-13 上海巽联信息科技有限公司 基于多模态下的智能表格抽取算法
CN113361257B (zh) * 2021-06-29 2022-10-11 深圳壹账通智能科技有限公司 Pdf文档解析方法、系统、电子装置及存储介质
CN113869014A (zh) * 2021-08-25 2021-12-31 盐城金堤科技有限公司 表格数据的提取方法和装置、以及存储介质和电子设备
CN115270706B (zh) * 2022-07-20 2026-03-03 上海亘岩网络科技有限公司 Pdf关键字定位方法、装置及存储介质
CN115935928A (zh) * 2022-11-18 2023-04-07 华能招标有限公司 文档信息的提取方法和装置
CN116740744A (zh) * 2023-06-30 2023-09-12 中国工商银行股份有限公司 具有转折字段行表格图像的识别方法和装置
CN119418356A (zh) * 2024-09-10 2025-02-11 中国长江电力股份有限公司 一种pdf文档提取处理文本数据的方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090282009A1 (en) * 2008-05-09 2009-11-12 Tags Ltd System, method, and program product for automated grading
CN102722475A (zh) * 2012-05-09 2012-10-10 深圳市万兴软件有限公司 一种PDF文档中的表格转换成Excel表格的方法
US20120265759A1 (en) * 2011-04-15 2012-10-18 Xerox Corporation File processing of native file formats
CN102855232A (zh) * 2012-09-14 2013-01-02 同方光盘股份有限公司 一种表格分析编改加工方法
CN104268127A (zh) * 2014-09-22 2015-01-07 同方知网(北京)技术有限公司 一种电子档版式文件阅读顺序分析的方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508826B (zh) * 2011-11-03 2014-04-16 汉王科技股份有限公司 一种文档中的表格显示方法及装置
CN106951400B (zh) * 2017-02-06 2025-02-18 北京因果树网络科技有限公司 一种pdf文件的信息抽取方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090282009A1 (en) * 2008-05-09 2009-11-12 Tags Ltd System, method, and program product for automated grading
US20120265759A1 (en) * 2011-04-15 2012-10-18 Xerox Corporation File processing of native file formats
CN102722475A (zh) * 2012-05-09 2012-10-10 深圳市万兴软件有限公司 一种PDF文档中的表格转换成Excel表格的方法
CN102855232A (zh) * 2012-09-14 2013-01-02 同方光盘股份有限公司 一种表格分析编改加工方法
CN104268127A (zh) * 2014-09-22 2015-01-07 同方知网(北京)技术有限公司 一种电子档版式文件阅读顺序分析的方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11436249B1 (en) 2021-03-26 2022-09-06 International Business Machines Corporation Transformation of composite tables into structured database content

Also Published As

Publication number Publication date
CN107818075A (zh) 2018-03-20

Similar Documents

Publication Publication Date Title
WO2019075969A1 (zh) 表格信息结构化提取方法、电子设备及计算机可读存储介质
WO2019075968A1 (zh) 表格信息跨页识别方法、电子设备及计算机可读存储介质
CN107832676B (zh) 表格信息换行识别方法、电子设备及计算机可读存储介质
CN109062874B (zh) 财政数据的获取方法、终端设备及介质
CN110795919B (zh) 一种pdf文档中的表格抽取方法、装置、设备及介质
US9489385B1 (en) Exact look and feel for sharepoint archived content
CN102737012B (zh) 文本信息对比方法及系统
US8892579B2 (en) Method and system of data extraction from a portable document format file
CN107679084B (zh) 聚类标签生成方法、电子设备及计算机可读存储介质
CN113779218B (zh) 问答对构建方法、装置、计算机设备和存储介质
CN111061742B (zh) 用于标记数据的方法、装置及其服务系统
WO2019041442A1 (zh) 图表数据结构化提取方法、系统、电子设备及计算机可读存储介质
CN111177511A (zh) 利用爬虫获取并解析公告信息方法及装置
US11281901B2 (en) Document extraction system and method
CN114220113A (zh) 一种论文质量检测方法、装置和设备
WO2019075967A1 (zh) 企业名称识别方法、电子设备及计算机可读存储介质
CN112528832A (zh) 对pdf格式的继电保护定值单进行处理的方法和系统
CN114238575A (zh) 文档解析方法、系统、计算机设备及计算机可读存储介质
CN109670461A (zh) Pdf文字提取方法、装置、计算机设备和存储介质
WO2019024231A1 (zh) 数据自动匹配方法、电子设备及计算机可读存储介质
CN114528413A (zh) 众包标注支持的知识图谱更新方法、系统和可读存储介质
CN112818687B (zh) 一种用于构建标题识别模型的方法、装置、电子设备以及存储介质
CN110674250A (zh) 一种文本匹配方法、装置、计算机系统及可读存储介质
CN112651725A (zh) 电子发票解析方法和装置
CN120067190A (zh) 一种基于模板的数据处理方法、装置及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18869274

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13.10.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18869274

Country of ref document: EP

Kind code of ref document: A1