WO2019041442A1 - 图表数据结构化提取方法、系统、电子设备及计算机可读存储介质 - Google Patents

图表数据结构化提取方法、系统、电子设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2019041442A1
WO2019041442A1 PCT/CN2017/105033 CN2017105033W WO2019041442A1 WO 2019041442 A1 WO2019041442 A1 WO 2019041442A1 CN 2017105033 W CN2017105033 W CN 2017105033W WO 2019041442 A1 WO2019041442 A1 WO 2019041442A1
Authority
WO
WIPO (PCT)
Prior art keywords
chart
text
information
area
specified document
Prior art date
Application number
PCT/CN2017/105033
Other languages
English (en)
French (fr)
Inventor
王鸿滨
汪伟
王晓伟
王智
肖京
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019041442A1 publication Critical patent/WO2019041442A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting

Definitions

  • the present invention relates to the field of computer information technology, and in particular, to a chart data structured extraction method, system, electronic device, and computer readable storage medium.
  • the existing information extraction for PDF documents is mostly limited to text information, and for chart information, only a single chart is extracted, and the related information of the chart is not uniformly extracted.
  • a separate chart may give people an unintelligible feeling after being separated from their specific semantic environment, which is not conducive to the further analysis and utilization of the chart information. Therefore, the design of the chart data extraction method in the prior art is not reasonable enough and needs to be improved.
  • the present invention provides a chart data structured extraction method, an electronic device, and a computer readable storage medium, which form a chart information by structurally extracting chart data including a chart itself, a chart title, and context text information thereof.
  • the complete expression makes it easy for other application interfaces to further analyze and utilize the chart information.
  • a first aspect of the present invention provides an electronic device, where the electronic device includes a memory and a processor, where the memory stores a chart data structured extraction system, and the chart data structured extraction system is The processor implements the following steps when it executes:
  • the context text of each chart is spliced, and the spliced context text is associated with the title of each chart and the chart itself to form structured chart data.
  • a second aspect of the present invention provides a method for structured data extraction of a chart, the method being applied to an electronic device, the method comprising:
  • the context text of each chart is spliced, and the spliced context text is associated with the title of each chart and the chart itself to form structured chart data.
  • a third aspect of the present invention provides a chart data structured extraction system, the system comprising:
  • An acquisition module for obtaining a chart in a specified document and location information of each chart
  • An extraction module configured to extract a title and contextual text information of each chart according to position information of each chart;
  • the association module is configured to splicing the context text of each chart according to the position information of the context text, and associating the spliced context text with the title of each chart and the chart itself to form structured chart data.
  • a fourth aspect of the invention provides a computer readable storage medium having stored thereon at least one computer readable instruction executable by a processor to:
  • the context text of each chart is spliced, and the spliced context text is associated with the title of each chart and the chart itself to form structured chart data.
  • the electronic device, the chart data structured extraction method and the computer readable storage medium proposed by the present invention form a pair by structurally extracting chart data including a chart itself, a chart title and context text information thereof.
  • the complete expression of the chart information facilitates further analysis and utilization of the chart information by other application interfaces.
  • FIG. 1 is a schematic diagram of an optional hardware architecture of an electronic device of the present invention
  • FIG. 2 is a schematic diagram of a program module of an embodiment of a chart data structured extraction system in an electronic device of the present invention
  • FIG. 3 is a schematic diagram of an implementation flow of an embodiment of a method for extracting structured data of a chart according to the present invention.
  • first, second and the like in the present invention 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 indicated technical features. .
  • 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. It is also within the scope of protection required by the present invention.
  • the present invention proposes an electronic device 2.
  • FIG. 1 a schematic diagram of an optional hardware architecture of the electronic device 2 of the present invention is shown.
  • 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.
  • 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 chart data 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 chart data 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 network, Bluetooth, Wi-Fi, etc.
  • FIG. 2 it is a program block diagram of an embodiment of the chart data structured extraction system 20 of the electronic device 2 of the present invention.
  • the chart data 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 present invention.
  • the chart data structured extraction system 20 can be segmented into an acquisition module 201, an extraction module 202, and an association module 203.
  • the program module referred to in the present invention refers to a series of computer program instruction segments capable of performing a specific function, and is more suitable than the program to describe the execution process of the chart data structured extraction system 20 in the electronic device 2.
  • the functions of each of the program modules 201-203 are described in detail.
  • the obtaining module 201 is configured to acquire a chart in a specified document (such as a PDF document) and location information of each chart.
  • the position information of each chart includes, but is not limited to, the number of pages of each chart in the specified document, the coordinates of the upper left corner of each chart, and the coordinates of the lower right corner.
  • the chart and the position information of each chart may be extracted from the specified document by using a text density-based analysis manner, or the chart and each piece may be extracted from the specified document by means of page rendering.
  • the location information of the chart may be extracted from the specified document by using a text density-based analysis manner, or the chart and each piece may be extracted from the specified document by means of page rendering.
  • extracting the chart and the position information of each chart from the specified document by using the text density-based analysis method includes the following steps A1 to A3:
  • A1 Obtain location information of all the characters in the specified document, and obtain the text distribution information in the specified document according to the location information of all the characters.
  • the position information of the character includes, but is not limited to, a horizontal coordinate, a vertical coordinate, a longitudinal distance from the previous line of characters, and a longitudinal distance from the next line of characters.
  • the text distribution information includes, but is not limited to, coordinates of the upper left corner of each line of text, length and width of the line of characters, and the like.
  • A2 Analyze the text distribution information in the specified document, determine an area in the specified document with a low text distribution density, or/and a non-text distribution area, and select the area with a low text distribution density, and/or Areas without text distribution are marked as candidate chart areas.
  • the determining that the area of the specified document has a low density of characters includes: if the length of the line of characters is less than the first threshold (eg, 5 characters per unit length), determining the line The text is distributed at a lower density and cleans (deletes) the line of text. The line of text after cleaning becomes an area with no text distribution.
  • the first threshold eg, 5 characters per unit length
  • the determining that the area of the specified document has no text distribution comprises: scanning each page of the specified document from top to bottom, if the second threshold width is exceeded (eg, 2 If the area of the character unit width is not scanned, the area is judged to be an area where no text is distributed.
  • the second threshold width eg, 2 If the area of the character unit width is not scanned, the area is judged to be an area where no text is distributed.
  • the marked candidate chart area can be converted to a picture using a specific image processing tool such as the ImageMagick tool.
  • the filtering the picture including the chart information from the converted picture comprises: filtering the converted picture by using pixel distribution analysis (or content richness analysis), and selecting the included chart A picture of information (such as PDF chart information). Since there are two cases in the non-text area: one is a chart, and the other is a blank area of the page. By analyzing the pixel distribution of the picture, it can be determined which of the two cases.
  • pixel distribution analysis or content richness analysis
  • the image including the chart information is filtered from the converted image by pixel distribution analysis, including:
  • each pixel of the picture is represented as 0 or 255. Where 0 is black, which is a pixel with information content in the picture, and 255 is white, which is a blank pixel in the picture.
  • the number of rows containing specific content is counted to determine the richness of the content in the image. The more rows containing the specific content, the richer the content representing the image. If the number of lines containing the specific content is greater than or equal to the set threshold (such as 2 lines), it is determined that the converted picture is rich in content, and is a picture containing the chart information. On the other hand, if the number of rows containing the specific content is less than the set threshold (such as 2 rows), it is determined that the converted image content is not rich enough, and is a blank image that does not contain the chart information.
  • the set threshold such as 2 lines
  • extracting the chart and the position information of each chart from the specified document by means of page rendering includes the following steps B1 to B3:
  • a specific character recognition tool (such as a pdf2html tool) can be used to obtain location information of all the characters in the specified document.
  • the specific text recognition tool can parse the PDF document into a text file, and at the same time parse the specific position information of each line of text in the PDF document (such as the coordinates of the upper left corner, the length and width of the line of text, etc.).
  • each line of text occupies a specific position of the specified document page.
  • the rendering of the blank image includes: for all the pixel positions in the blank image, the pixel position occupied by the text is rendered as black, and the pixel position occupied by the text remains white.
  • the blank picture can be rendered as black and white, black is the text area, and white is the non-text area.
  • step B2 further includes the following steps: processing the rendered picture by an image morphology processing method (such as expansion processing, shrink processing, etc.), in the rendered picture
  • image morphology processing method such as expansion processing, shrink processing, etc.
  • the extracting the chart information from the candidate chart area comprises:
  • the image including the chart information is filtered from the converted image by pixel distribution analysis, including:
  • each pixel of the picture is represented as 0 or 255. Where 0 is black, which is a pixel with information content in the picture, and 255 is white, which is a blank pixel in the picture.
  • the number of rows containing specific content is counted to determine the richness of the content in the image. The more rows containing the specific content, the richer the content representing the image. If the number of lines containing the specific content is greater than or equal to the set threshold (such as 2 lines), it is determined that the converted picture is rich in content, and is a picture containing the chart information. On the other hand, if the number of rows containing the specific content is less than the set threshold (such as 2 rows), it is determined that the converted image content is not rich enough, and is a blank image that does not contain the chart information.
  • the set threshold such as 2 lines
  • the extraction module 202 is configured to extract a title and contextual text information of each chart according to location information of each chart.
  • the extracting the title and contextual text information of each chart includes:
  • the predetermined number of lines (such as one to two lines) is scanned upward from the position of each chart (for example, from the upper left coordinate), and the scanned text information is recorded as the title of each chart;
  • each chart the number of remaining lines in the adjacent area is scanned up and down from the position of each chart (for example, downward from the lower right coordinate), and the scanned text information is recorded as each chart.
  • Contextual text information (such as location information, etc.).
  • the association module 203 is configured to splicing (forming a complete sentence or a paragraph) of the context text of each chart according to the location information of the context text (eg, from the order of going to the post), and splicing the context text Associated with the title of each chart and the chart itself to form structured chart data.
  • the chart data structured extraction system 20 forms a complete expression of the chart information by structurally extracting chart data including the chart itself, the chart title and its contextual text information.
  • Other application interfaces follow the chart information Further analysis and utilization.
  • the present invention also proposes a structured data extraction method for chart data.
  • FIG. 3 it is a schematic flowchart of an implementation process of an embodiment of the chart data structure extraction method of the present invention.
  • 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 obtaining a chart in a specified document (such as a PDF document) and location information of each chart.
  • the position information of each chart includes, but is not limited to, the number of pages of each chart in the specified document, the coordinates of the upper left corner of each chart, and the coordinates of the lower right corner.
  • the chart and the position information of each chart may be extracted from the specified document by using a text density-based analysis manner, or the chart and each piece may be extracted from the specified document by means of page rendering.
  • the location information of the chart may be extracted from the specified document by using a text density-based analysis manner, or the chart and each piece may be extracted from the specified document by means of page rendering.
  • extracting the chart and the position information of each chart from the specified document by using the text density-based analysis method includes the following steps A1 to A3:
  • A1 Obtain location information of all the characters in the specified document, and obtain the text distribution information in the specified document according to the location information of all the characters.
  • the position information of the character includes, but is not limited to, a horizontal coordinate, a vertical coordinate, a longitudinal distance from the previous line of characters, and a longitudinal distance from the next line of characters.
  • the text distribution information includes, but is not limited to, coordinates of the upper left corner of each line of text, length and width of the line of characters, and the like.
  • A2 Analyze the text distribution information in the specified document, determine an area in the specified document with a low text distribution density, or/and a non-text distribution area, and select the area with a low text distribution density, and/or Areas without text distribution are marked as candidate chart areas.
  • the determining that the area of the specified document has a low density of characters includes: if the length of the line of characters is less than the first threshold (eg, 5 characters per unit length), determining the line The text is distributed at a lower density and cleans (deletes) the line of text. The line of text after cleaning becomes an area with no text distribution.
  • the first threshold eg, 5 characters per unit length
  • the determining that the area of the specified document has no text distribution comprises: scanning each page of the specified document from top to bottom, if the second threshold width is exceeded (eg, 2 If the area of the character unit width is not scanned, the area is judged to be an area where no text is distributed.
  • the second threshold width eg, 2 If the area of the character unit width is not scanned, the area is judged to be an area where no text is distributed.
  • the marked candidate chart area can be converted to a picture using a specific image processing tool such as the ImageMagick tool.
  • the filtering the image including the chart information from the converted image comprises: performing pixel distribution analysis (or content richness analysis) on the converted image Filter and select an image that contains chart information (such as PDF chart information). Since there are two cases in the non-text area: one is a chart, and the other is a blank area of the page. By analyzing the pixel distribution of the picture, it can be determined which of the two cases.
  • pixel distribution analysis or content richness analysis
  • the image including the chart information is filtered from the converted image by pixel distribution analysis, including:
  • each pixel of the picture is represented as 0 or 255. Where 0 is black, which is a pixel with information content in the picture, and 255 is white, which is a blank pixel in the picture.
  • the number of rows containing specific content is counted to determine the richness of the content in the image. The more rows containing the specific content, the richer the content representing the image. If the number of lines containing the specific content is greater than or equal to the set threshold (such as 2 lines), it is determined that the converted picture is rich in content, and is a picture containing the chart information. On the other hand, if the number of rows containing the specific content is less than the set threshold (such as 2 rows), it is determined that the converted image content is not rich enough, and is a blank image that does not contain the chart information.
  • the set threshold such as 2 lines
  • extracting the chart and the position information of each chart from the specified document by means of page rendering includes the following steps B1 to B3:
  • a specific character recognition tool (such as a pdf2html tool) can be used to obtain location information of all the characters in the specified document.
  • the specific text recognition tool can parse the PDF document into a text file, and at the same time parse the specific position information of each line of text in the PDF document (such as the coordinates of the upper left corner, the length and width of the line of text, etc.).
  • each line of text occupies a specific position of the specified document page.
  • the rendering of the blank image includes: for all the pixel positions in the blank image, the pixel position occupied by the text is rendered as black, and the pixel position occupied by the text remains white.
  • the blank picture can be rendered as black and white, black is the text area, and white is the non-text area.
  • step B2 further includes the following steps: processing the rendered picture by an image morphology processing method (such as expansion processing, shrink processing, etc.), in the rendered picture
  • image morphology processing method such as expansion processing, shrink processing, etc.
  • the extracting the chart information from the candidate chart area comprises:
  • the marked candidate chart area Converting the marked candidate chart area into a picture, and filtering the converted picture by pixel distribution analysis (or content richness analysis), and selecting a picture containing chart information (such as PDF chart information) as the designation The chart extracted from the document page.
  • the marked candidate chart area can be converted to a picture using a specific image processing tool such as the ImageMagick tool.
  • the image including the chart information is filtered from the converted image by pixel distribution analysis, including:
  • each pixel of the picture is represented as 0 or 255. Where 0 is black, which is a pixel with information content in the picture, and 255 is white, which is a blank pixel in the picture.
  • the number of rows containing specific content is counted to determine the richness of the content in the image. The more rows containing the specific content, the richer the content representing the image. If the number of lines containing the specific content is greater than or equal to the set threshold (such as 2 lines), it is determined that the converted picture is rich in content, and is a picture containing the chart information. On the other hand, if the number of rows containing the specific content is less than the set threshold (such as 2 rows), it is determined that the converted image content is not rich enough, and is a blank image that does not contain the chart information.
  • the set threshold such as 2 lines
  • Step S32 extracting the title and contextual text information of each chart according to the position information of each chart.
  • the extracting the title and contextual text information of each chart includes:
  • the predetermined number of lines (such as one to two lines) is scanned upward from the position of each chart (for example, from the upper left coordinate), and the scanned text information is recorded as the title of each chart;
  • each chart the number of remaining lines in the adjacent area is scanned up and down from the position of each chart (for example, downward from the lower right coordinate), and the scanned text information is recorded as each chart.
  • Contextual text information (such as location information, etc.).
  • Step S33 according to the position information of the context text (such as from the order of going to and after), splicing the context text of each chart (forming a complete sentence or a paragraph), and splicing the context text with each chart
  • the title and the chart itself are linked together to form structured chart data.
  • the chart data structured extraction method proposed by the present invention forms a complete expression of the chart information by structurally extracting chart data including the chart itself, the chart title and its contextual text information, and is convenient for other applications.
  • the interface further analyzes and utilizes the chart information.
  • the present invention further provides a computer readable storage medium (such as a ROM/RAM, a magnetic disk, an optical disk), the computer readable storage medium storing a chart data structured extraction system 20,
  • the chart data 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 chart data 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 invention 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 cell phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.

Landscapes

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

Abstract

一种图表数据结构化提取方法,该方法包括步骤:获取指定文档中的图表及每张图表的位置信息(S31);根据每张图表的位置信息,提取每张图表的标题和上下文文字信息(S32);根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据(S33)。该方法可以提高图表数据提取的完整度。

Description

图表数据结构化提取方法、系统、电子设备及计算机可读存储介质
本申请要求于2017年8月31日提交中国专利局、申请号为201710775380.X,发明名称为“图表数据结构化提取方法、电子装置及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机信息技术领域,尤其涉及一种图表数据结构化提取方法、系统、电子设备及计算机可读存储介质。
背景技术
现有针对PDF文档的信息提取大多仅限于文字信息,而对于图表信息,也仅是提取出单独的图表,没有对图表的相关信息也进行统一抽取。单独的图表在脱离了其特定语义环境后可能会给人一种不知所云的感觉,这一点非常不利于对图表信息的进一步分析与利用。故,现有技术中的图表数据提取方法设计不够合理,亟需改进。
发明内容
有鉴于此,本发明提出一种图表数据结构化提取方法、电子设备及计算机可读存储介质,通过结构化地提取包括图表本身、图表标题及其上下文文字信息的图表数据,形成对图表信息的完整表达,便于其它应用接口后续对图表信息进行进一步地分析与利用。
为实现上述目的,本发明第一方面提供一种电子设备,所述电子设备包括存储器、处理器,所述存储器上存储有图表数据结构化提取系统,所述图表数据结构化提取系统被所述处理器执行时实现如下步骤:
获取指定文档中的图表及每张图表的位置信息;
根据每张图表的位置信息,提取每张图表的标题和上下文文字信息;及
根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
此外,为实现上述目的,本发明第二方面提供一种图表数据结构化提取方法,该方法应用于电子设备,所述方法包括:
获取指定文档中的图表及每张图表的位置信息;
根据每张图表的位置信息,提取每张图表的标题和上下文文字信息;及
根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
此外,为实现上述目的,本发明第三方面提供一种图表数据结构化提取系统,所述系统包括:
获取模块,用于获取指定文档中的图表及每张图表的位置信息;
提取模块,用于根据每张图表的位置信息,提取每张图表的标题和上下文文字信息;及
关联模块,用于根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
进一步地,为实现上述目的,本发明第四方面提供一种计算机可读存储介质,所述计算机可读存储介质上存储有至少一个可被处理器执行以实现以下操作的计算机可读指令:
获取指定文档中的图表及每张图表的位置信息;
根据每张图表的位置信息,提取每张图表的标题和上下文文字信息;及
根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
相较于现有技术,本发明所提出的电子设备、图表数据结构化提取方法及计算机可读存储介质,通过结构化地提取包括图表本身、图表标题及其上下文文字信息的图表数据,形成对图表信息的完整表达,便于其它应用接口后续对图表信息进行进一步地分析与利用。
附图说明
图1是本发明电子设备一可选的硬件架构的示意图;
图2是本发明电子设备中图表数据结构化提取系统一实施例的程序模块示意图;
图3为本发明图表数据结构化提取方法一实施例的实施流程示意图。
附图标记:
电子设备 2
存储器 21
处理器 22
网络接口 23
图表数据结构化提取系统 20
获取模块 201
提取模块 202
关联模块 203
流程步骤 S31-S33
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
需要说明的是,在本发明中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。
进一步需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
首先,本发明提出一种电子设备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文档)中的图表及每张图表的位置信息。其中,每张图表的位置信息包括,但不限于,每张图表在该指定文档中的页数、每张图表的左上角坐标、及右下角坐标等。
优选地,在本实施例中,可以通过基于文本密度的分析方式从该指定文档中抽取图表及每张图表的位置信息,也可以通过基于页面渲染的方式从该指定文档中抽取图表及每张图表的位置信息。
其中,通过基于文本密度的分析方式从该指定文档中抽取图表及每张图表的位置信息包括如下步骤A1~A3:
A1、获取指定文档中所有文字的位置信息,并根据所有文字的位置信息获取该指定文档中的文字分布信息。
优选地,在本实施例中,所述文字的位置信息包括,但不限于,文字的横向坐标、纵向坐标、与上一行文字的纵向距离、及与下一行文字的纵向距离等。所述文字分布信息包括,但不限于,每一行文字的左上角坐标,该行文字的长度和宽度等。
A2、分析该指定文档中的文字分布信息,判断出该指定文档中文字分布密度较低的区域、或/及无文字分布的区域,并将所述文字分布密度较低的区域、或/及无文字分布的区域标记为候选图表区域。
优选地,在本实施例中,所述判断出该指定文档中文字分布密度较低的区域包括:若一行文字的长度小于第一阀值(如5个字符单位长度),则判断出该行文字分布密度较低,并清洗(删除)该行文字。清洗后的该行文字变成了一个无文字分布的区域。
优选地,在本实施例中,所述判断出该指定文档中无文字分布的区域包括:对该指定文档中每一页从上到下进行扫描,若超过第二阀值宽度(如2个字符单位宽度)的区域没有扫描到文字,则判断出该区域为无文字分布的区域。
A3、将所述标记的候选图表区域转换为图片,并从转换后的图片中筛选出包含图表信息的图片,作为该指定文档中抽取出的图表,并记录下每张图表的位置信息(如每张图表的左上角坐标等)。在本实施例中,可以使用特定的图片处理工具(如ImageMagick工具)将所述标记的候选图表区域转换为图片。
优选地,在本实施例中,所述从转换后的图片中筛选出包含图表信息的图片包括:通过像素分布分析(或内容丰富程度分析),对转换后的图片进行筛选,选择出包含图表信息(如PDF图表信息)的图片。由于无文字区域有两种情况:一种是图表,一种是页面的空白区域,通过对图片的像素分布分析,可以判断出是这两种情况中的哪一种。
具体而言,通过像素分布分析从转换后的图片中筛选出包含图表信息的图片包括:
(1)对该转换后的图片进行灰度处理(如通过应用程序Python中的Opencv模块进行灰度处理),将该转换后的图片转换为灰度图。在该灰度图中,图片的每个像素点都被表示为0或255。其中,0代表黑色,为图片中有信息内容的像素点,255代表白色,为图片中空白的像素点。
(2)按行统计该灰度图中黑色像素点的数量和比例,若一行中黑色像素点的数量和比例超过指定阈值(如数量超过5,比例超过50%),则判定该行包含有具体内容。
(3)统计包含有具体内容的行的数量,以此来判定图片中内容的丰富程度,包含有具体内容的行越多,则代表该图片的内容越丰富。若包含有具体内容的行数大于或等于设定阈值(如2行),则判定该转换后的图片内容丰富,是一张包含图表信息的图片。反之,若包含有具体内容的行数小于该设定阈值(如2行),则判定该转换后的图片内容不够丰富,是一张没有包含图表信息的空白图片。
进一步地,通过基于页面渲染的方式从该指定文档中抽取图表及每张图表的位置信息包括如下步骤B1~B3:
B1、获取指定文档中所有文字的位置信息。在本实施例中,可以使用特定的文字识别工具(如pdf2html工具)获取该指定文档中所有文字的位置信息。该特定的文字识别工具可以将PDF文档解析为文本文件,同时解析出每行文本在PDF文档中的具体位置信息(如左上角坐标,该行文字的长度和宽度等)。
B2、针对该指定文档中的每张页面,生成一张与该指定文档页面相同大小的空白图片,然后根据该页面中所有文字的位置信息,将该页面中所有文字转换为该空白图片中的像素点,并对该空白图片进行渲染。
在本实施例中,通过所有文字的位置信息,就可以判断出每行文字占据该指定文档页面的具体位置。其中,所述对该空白图片进行渲染包括:针对该空白图片中的所有像素点位置,将有文字占据的像素点位置渲染为黑色,没有文字占据的像素点位置保持白色。通过上述渲染,可以将该空白图片渲染为黑白二色,黑色为文字区域,白色为无文字区域。
进一步地,在其它实施例中,步骤B2还包括如下步骤:通过图像形态学处理方法(如膨胀处理、收缩处理等)对所述渲染后的图片进行处理,将所述渲染后的图片中的文字信息界限显著化。
B3、将所述渲染后的图片中的空白区域(即无文字区域)标记为候选图表区域,并从该候选图表区域中抽取图表信息,作为该指定文档页面抽取出的图表,并记录下每张图表的位置信息(如每张图表的左上角坐标等)。
优选地,在本实施例中,所述从该候选图表区域中抽取图表信息包括:
将所述标记的候选图表区域转换为图片,并通过像素分布分析(或内容丰富程度分析),对转换后的图片进行筛选,选择出包含图表信息(如PDF图表信息)的图片,作为该指定文档页面抽取出的图表。在本实施例中,可 以使用特定的图片处理工具(如ImageMagick工具)将所述标记的候选图表区域转换为图片。
具体而言,通过像素分布分析从转换后的图片中筛选出包含图表信息的图片包括:
(1)对该转换后的图片进行灰度处理(如通过应用程序Python中的Opencv模块进行灰度处理),将该转换后的图片转换为灰度图。在该灰度图中,图片的每个像素点都被表示为0或255。其中,0代表黑色,为图片中有信息内容的像素点,255代表白色,为图片中空白的像素点。
(2)按行统计该灰度图中黑色像素点的数量和比例,若一行中黑色像素点的数量和比例超过指定阈值(如数量超过5,比例超过50%),则判定该行包含有具体内容。
(3)统计包含有具体内容的行的数量,以此来判定图片中内容的丰富程度,包含有具体内容的行越多,则代表该图片的内容越丰富。若包含有具体内容的行数大于或等于设定阈值(如2行),则判定该转换后的图片内容丰富,是一张包含图表信息的图片。反之,若包含有具体内容的行数小于该设定阈值(如2行),则判定该转换后的图片内容不够丰富,是一张没有包含图表信息的空白图片。
所述提取模块202,用于根据每张图表的位置信息,提取每张图表的标题和上下文文字信息。
优选地,在本实施例中,所述提取每张图表的标题和上下文文字信息包括:
确定每张图表的一个相邻区域(如每张图表向上4行及向下2行的相邻区域);
于每张图表的相邻区域内,从每张图表的位置向上(如从左上角坐标向上)扫描预定数量行数(如一到两行),扫描获取的文字信息记录为每张图表的标题;
于每张图表的相邻区域内,从每张图表的位置向上、向下(如从右下角坐标向下)扫描该相邻区域内的剩余行数,扫描获取的文字信息记录为每张图表的上下文文字信息(如位置信息等)。
所述关联模块203,用于根据上下文文字的位置信息(如从前往后的顺序),对每张图表的上下文文字进行拼接(形成完整的一句话或一段话),并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
通过上述程序模块201-203,本发明所提出的图表数据结构化提取系统20,通过结构化地提取包括图表本身、图表标题及其上下文文字信息的图表数据,形成对图表信息的完整表达,便于其它应用接口后续对图表信息进行 进一步地分析与利用。
此外,本发明还提出一种图表数据结构化提取方法。
参阅图3所示,是本发明图表数据结构化提取方法一实施例的实施流程示意图。在本实施例中,根据不同的需求,图3所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。
步骤S31,获取指定文档(如PDF文档)中的图表及每张图表的位置信息。其中,每张图表的位置信息包括,但不限于,每张图表在该指定文档中的页数、每张图表的左上角坐标、及右下角坐标等。
优选地,在本实施例中,可以通过基于文本密度的分析方式从该指定文档中抽取图表及每张图表的位置信息,也可以通过基于页面渲染的方式从该指定文档中抽取图表及每张图表的位置信息。
其中,通过基于文本密度的分析方式从该指定文档中抽取图表及每张图表的位置信息包括如下步骤A1~A3:
A1、获取指定文档中所有文字的位置信息,并根据所有文字的位置信息获取该指定文档中的文字分布信息。
优选地,在本实施例中,所述文字的位置信息包括,但不限于,文字的横向坐标、纵向坐标、与上一行文字的纵向距离、及与下一行文字的纵向距离等。所述文字分布信息包括,但不限于,每一行文字的左上角坐标,该行文字的长度和宽度等。
A2、分析该指定文档中的文字分布信息,判断出该指定文档中文字分布密度较低的区域、或/及无文字分布的区域,并将所述文字分布密度较低的区域、或/及无文字分布的区域标记为候选图表区域。
优选地,在本实施例中,所述判断出该指定文档中文字分布密度较低的区域包括:若一行文字的长度小于第一阀值(如5个字符单位长度),则判断出该行文字分布密度较低,并清洗(删除)该行文字。清洗后的该行文字变成了一个无文字分布的区域。
优选地,在本实施例中,所述判断出该指定文档中无文字分布的区域包括:对该指定文档中每一页从上到下进行扫描,若超过第二阀值宽度(如2个字符单位宽度)的区域没有扫描到文字,则判断出该区域为无文字分布的区域。
A3、将所述标记的候选图表区域转换为图片,并从转换后的图片中筛选出包含图表信息的图片,作为该指定文档中抽取出的图表,并记录下每张图表的位置信息(如每张图表的左上角坐标等)。在本实施例中,可以使用特定的图片处理工具(如ImageMagick工具)将所述标记的候选图表区域转换为图片。
优选地,在本实施例中,所述从转换后的图片中筛选出包含图表信息的图片包括:通过像素分布分析(或内容丰富程度分析),对转换后的图片进行 筛选,选择出包含图表信息(如PDF图表信息)的图片。由于无文字区域有两种情况:一种是图表,一种是页面的空白区域,通过对图片的像素分布分析,可以判断出是这两种情况中的哪一种。
具体而言,通过像素分布分析从转换后的图片中筛选出包含图表信息的图片包括:
(1)对该转换后的图片进行灰度处理(如通过应用程序Python中的Opencv模块进行灰度处理),将该转换后的图片转换为灰度图。在该灰度图中,图片的每个像素点都被表示为0或255。其中,0代表黑色,为图片中有信息内容的像素点,255代表白色,为图片中空白的像素点。
(2)按行统计该灰度图中黑色像素点的数量和比例,若一行中黑色像素点的数量和比例超过指定阈值(如数量超过5,比例超过50%),则判定该行包含有具体内容。
(3)统计包含有具体内容的行的数量,以此来判定图片中内容的丰富程度,包含有具体内容的行越多,则代表该图片的内容越丰富。若包含有具体内容的行数大于或等于设定阈值(如2行),则判定该转换后的图片内容丰富,是一张包含图表信息的图片。反之,若包含有具体内容的行数小于该设定阈值(如2行),则判定该转换后的图片内容不够丰富,是一张没有包含图表信息的空白图片。
进一步地,通过基于页面渲染的方式从该指定文档中抽取图表及每张图表的位置信息包括如下步骤B1~B3:
B1、获取指定文档中所有文字的位置信息。在本实施例中,可以使用特定的文字识别工具(如pdf2html工具)获取该指定文档中所有文字的位置信息。该特定的文字识别工具可以将PDF文档解析为文本文件,同时解析出每行文本在PDF文档中的具体位置信息(如左上角坐标,该行文字的长度和宽度等)。
B2、针对该指定文档中的每张页面,生成一张与该指定文档页面相同大小的空白图片,然后根据该页面中所有文字的位置信息,将该页面中所有文字转换为该空白图片中的像素点,并对该空白图片进行渲染。
在本实施例中,通过所有文字的位置信息,就可以判断出每行文字占据该指定文档页面的具体位置。其中,所述对该空白图片进行渲染包括:针对该空白图片中的所有像素点位置,将有文字占据的像素点位置渲染为黑色,没有文字占据的像素点位置保持白色。通过上述渲染,可以将该空白图片渲染为黑白二色,黑色为文字区域,白色为无文字区域。
进一步地,在其它实施例中,步骤B2还包括如下步骤:通过图像形态学处理方法(如膨胀处理、收缩处理等)对所述渲染后的图片进行处理,将所述渲染后的图片中的文字信息界限显著化。
B3、将所述渲染后的图片中的空白区域(即无文字区域)标记为候选图表区域,并从该候选图表区域中抽取图表信息,作为该指定文档页面抽取出的图表,并记录下每张图表的位置信息(如每张图表的左上角坐标等)。
优选地,在本实施例中,所述从该候选图表区域中抽取图表信息包括:
将所述标记的候选图表区域转换为图片,并通过像素分布分析(或内容丰富程度分析),对转换后的图片进行筛选,选择出包含图表信息(如PDF图表信息)的图片,作为该指定文档页面抽取出的图表。在本实施例中,可以使用特定的图片处理工具(如ImageMagick工具)将所述标记的候选图表区域转换为图片。
具体而言,通过像素分布分析从转换后的图片中筛选出包含图表信息的图片包括:
(1)对该转换后的图片进行灰度处理(如通过应用程序Python中的Opencv模块进行灰度处理),将该转换后的图片转换为灰度图。在该灰度图中,图片的每个像素点都被表示为0或255。其中,0代表黑色,为图片中有信息内容的像素点,255代表白色,为图片中空白的像素点。
(2)按行统计该灰度图中黑色像素点的数量和比例,若一行中黑色像素点的数量和比例超过指定阈值(如数量超过5,比例超过50%),则判定该行包含有具体内容。
(3)统计包含有具体内容的行的数量,以此来判定图片中内容的丰富程度,包含有具体内容的行越多,则代表该图片的内容越丰富。若包含有具体内容的行数大于或等于设定阈值(如2行),则判定该转换后的图片内容丰富,是一张包含图表信息的图片。反之,若包含有具体内容的行数小于该设定阈值(如2行),则判定该转换后的图片内容不够丰富,是一张没有包含图表信息的空白图片。
步骤S32,根据每张图表的位置信息,提取每张图表的标题和上下文文字信息。
优选地,在本实施例中,所述提取每张图表的标题和上下文文字信息包括:
确定每张图表的一个相邻区域(如每张图表向上4行及向下2行的相邻区域);
于每张图表的相邻区域内,从每张图表的位置向上(如从左上角坐标向上)扫描预定数量行数(如一到两行),扫描获取的文字信息记录为每张图表的标题;
于每张图表的相邻区域内,从每张图表的位置向上、向下(如从右下角坐标向下)扫描该相邻区域内的剩余行数,扫描获取的文字信息记录为每张图表的上下文文字信息(如位置信息等)。
步骤S33,根据上下文文字的位置信息(如从前往后的顺序),对每张图表的上下文文字进行拼接(形成完整的一句话或一段话),并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
通过上述步骤S31-S33,本发明所提出的图表数据结构化提取方法,通过结构化地提取包括图表本身、图表标题及其上下文文字信息的图表数据,形成对图表信息的完整表达,便于其它应用接口后续对图表信息进行进一步地分析与利用。
进一步地,为实现上述目的,本发明还提供一种计算机可读存储介质(如ROM/RAM、磁碟、光盘),所述计算机可读存储介质存储有图表数据结构化提取系统20,所述图表数据结构化提取系统20可被至少一个处理器22执行,以使所述至少一个处理器22执行如上所述的图表数据结构化提取方法的步骤。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件来实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。
以上参照附图说明了本发明的优选实施例,并非因此局限本发明的权利范围。上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
本领域技术人员不脱离本发明的范围和实质,可以有多种变型方案实现本发明,比如作为一个实施例的特征可用于另一实施例而得到又一实施例。凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (20)

  1. 一种电子设备,其特征在于,所述电子设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的图表数据结构化提取系统,所述图表数据结构化提取系统被所述处理器执行时实现如下步骤:
    获取指定文档中的图表及每张图表的位置信息;
    根据每张图表的位置信息,提取每张图表的标题和上下文文字信息;及
    根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
  2. 如权利要求1所述的电子设备,其特征在于,所述提取每张图表的标题和上下文文字信息包括:
    确定每张图表的一个相邻区域;
    于每张图表的相邻区域内,从每张图表的位置向上扫描预定数量行数,扫描获取的文字信息记录为每张图表的标题;及
    于每张图表的相邻区域内,从每张图表的位置向上、向下扫描该相邻区域内的剩余行数,扫描获取的文字信息记录为每张图表的上下文文字信息。
  3. 如权利要求2所述的电子设备,其特征在于,所述获取指定文档中的图表及每张图表的位置信息包括:
    获取指定文档中所有文字的位置信息,并根据所有文字的位置信息获取该指定文档中的文字分布信息;
    分析该指定文档中的文字分布信息,判断出该指定文档中文字分布密度较低的区域、或/及无文字分布的区域,并将所述文字分布密度较低的区域、或/及无文字分布的区域标记为候选图表区域;及
    将所述标记的候选图表区域转换为图片,并从转换后的图片中筛选出包含图表信息的图片,作为该指定文档中抽取出的图表,并记录下每张图表的位置信息。
  4. 如权利要求3所述的电子设备,其特征在于,所述判断出该指定文档中文字分布密度较低的区域包括:若一行文字的长度小于第一阀值,则判断出该行文字分布密度较低,并清洗该行文字;及
    所述判断出该指定文档中无文字分布的区域包括:对该指定文档中每一页从上到下进行扫描,若超过第二阀值宽度的区域没有扫描到文字,则判断出该区域为无文字分布的区域。
  5. 如权利要求4所述的电子设备,其特征在于,所述从转换后的图片中筛选出包含图表信息的图片包括:
    对该转换后的图片进行灰度处理,将该转换后的图片转换为灰度图;
    按行统计该灰度图中黑色像素点的数量和比例,若一行中黑色像素点的数量和比例超过指定阈值,则判定该行包含有具体内容;及
    统计包含有具体内容的行的数量,若包含有具体内容的行数大于或等于设定阈值,则判定该转换后的图片为一张包含图表信息的图片。
  6. 一种图表数据结构化提取方法,应用于电子设备,其特征在于,所述方法包括:
    获取指定文档中的图表及每张图表的位置信息;
    根据每张图表的位置信息,提取每张图表的标题和上下文文字信息;及
    根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
  7. 如权利要求6所述的图表数据结构化提取方法,其特征在于,所述提取每张图表的标题和上下文文字信息包括:
    确定每张图表的一个相邻区域;
    于每张图表的相邻区域内,从每张图表的位置向上扫描预定数量行数,扫描获取的文字信息记录为每张图表的标题;及
    于每张图表的相邻区域内,从每张图表的位置向上、向下扫描该相邻区域内的剩余行数,扫描获取的文字信息记录为每张图表的上下文文字信息。
  8. 如权利要求7所述的图表数据结构化提取方法,其特征在于,所述获取指定文档中的图表及每张图表的位置信息包括:
    获取指定文档中所有文字的位置信息,并根据所有文字的位置信息获取该指定文档中的文字分布信息;
    分析该指定文档中的文字分布信息,判断出该指定文档中文字分布密度较低的区域、或/及无文字分布的区域,并将所述文字分布密度较低的区域、或/及无文字分布的区域标记为候选图表区域;及
    将所述标记的候选图表区域转换为图片,并从转换后的图片中筛选出包含图表信息的图片,作为该指定文档中抽取出的图表,并记录下每张图表的位置信息。
  9. 如权利要求8所述的图表数据结构化提取方法,其特征在于,所述判断出该指定文档中文字分布密度较低的区域包括:若一行文字的长度小于第一阀值,则判断出该行文字分布密度较低,并清洗该行文字;及
    所述判断出该指定文档中无文字分布的区域包括:对该指定文档中每一页从上到下进行扫描,若超过第二阀值宽度的区域没有扫描到文字,则判断出该区域为无文字分布的区域。
  10. 如权利要求9所述的图表数据结构化提取方法,其特征在于,所述从转换后的图片中筛选出包含图表信息的图片包括:
    对该转换后的图片进行灰度处理,将该转换后的图片转换为灰度图;
    按行统计该灰度图中黑色像素点的数量和比例,若一行中黑色像素点的数量和比例超过指定阈值,则判定该行包含有具体内容;及
    统计包含有具体内容的行的数量,若包含有具体内容的行数大于或等于设定阈值,则判定该转换后的图片为一张包含图表信息的图片。
  11. 一种图表数据结构化提取系统,其特征在于,所述系统包括:
    获取模块,用于获取指定文档中的图表及每张图表的位置信息;
    提取模块,用于根据每张图表的位置信息,提取每张图表的标题和上下文文字信息;及
    关联模块,用于根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
  12. 如权利要求11所述的图表数据结构化提取系统,其特征在于,所述提取模块包括:
    确定子模块,用于确定每张图表的一个相邻区域;
    第一扫描子模块,用于于每张图表的相邻区域内,从每张图表的位置向上扫描预定数量行数,扫描获取的文字信息记录为每张图表的标题;及
    第二扫描子模块,用于于每张图表的相邻区域内,从每张图表的位置向上、向下扫描该相邻区域内的剩余行数,扫描获取的文字信息记录为每张图表的上下文文字信息。
  13. 如权利要求12所述的图表数据结构化提取系统,其特征在于,所述获取模块包括:
    第一获取子模块,用于获取指定文档中所有文字的位置信息,并根据所有文字的位置信息获取该指定文档中的文字分布信息;
    分析子模块,用于分析该指定文档中的文字分布信息,判断出该指定文档中文字分布密度较低的区域、或/及无文字分布的区域,并将所述文字分布密度较低的区域、或/及无文字分布的区域标记为候选图表区域;及
    筛选子模块,用于将所述标记的候选图表区域转换为图片,并从转换后的图片中筛选出包含图表信息的图片,作为该指定文档中抽取出的图表,并记录下每张图表的位置信息。
  14. 如权利要求13所述的图表数据结构化提取系统,其特征在于,所述分析子模块包括:
    第一判断子模块,用于判断出该指定文档中文字分布密度较低的区域;
    第二判断子模块,用于判断出该指定文档中无文字分布的区域。
  15. 如权利要求14所述的图表数据结构化提取系统,其特征在于,所述筛选子模块还包括:
    处理子模块,用于对该转换后的图片进行灰度处理,将该转换后的图片转换为灰度图;
    第一统计子模块,用于按行统计该灰度图中黑色像素点的数量和比例,若一行中黑色像素点的数量和比例超过指定阈值,则判定该行包含有具体内容;及
    第二统计子模块,用于统计包含有具体内容的行的数量,若包含有具体内容的行数大于或等于设定阈值,则判定该转换后的图片为一张包含图表信息的图片。
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有图表数据结构化提取系统,所述图表数据结构化提取系统可被至少一个处理器执行,以使所述至少一个处理器执行如下步骤:
    获取指定文档中的图表及每张图表的位置信息;
    根据每张图表的位置信息,提取每张图表的标题和上下文文字信息;及
    根据上下文文字的位置信息,对每张图表的上下文文字进行拼接,并将拼接后的上下文文字与每张图表的标题及图表本身关联在一起,形成结构化的图表数据。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述提取每张图表的标题和上下文文字信息包括:
    确定每张图表的一个相邻区域;
    于每张图表的相邻区域内,从每张图表的位置向上扫描预定数量行数,扫描获取的文字信息记录为每张图表的标题;及
    于每张图表的相邻区域内,从每张图表的位置向上、向下扫描该相邻区域内的剩余行数,扫描获取的文字信息记录为每张图表的上下文文字信息。
  18. 如权利要求17所述的计算机可读存储介质,其特征在于,所述获取指定文档中的图表及每张图表的位置信息包括:
    获取指定文档中所有文字的位置信息,并根据所有文字的位置信息获取该指定文档中的文字分布信息;
    分析该指定文档中的文字分布信息,判断出该指定文档中文字分布密度较低的区域、或/及无文字分布的区域,并将所述文字分布密度较低的区域、或/及无文字分布的区域标记为候选图表区域;及
    将所述标记的候选图表区域转换为图片,并从转换后的图片中筛选出包 含图表信息的图片,作为该指定文档中抽取出的图表,并记录下每张图表的位置信息。
  19. 如权利要求18所述的计算机可读存储介质,其特征在于,所述判断出该指定文档中文字分布密度较低的区域包括:若一行文字的长度小于第一阀值,则判断出该行文字分布密度较低,并清洗该行文字;及
    所述判断出该指定文档中无文字分布的区域包括:对该指定文档中每一页从上到下进行扫描,若超过第二阀值宽度的区域没有扫描到文字,则判断出该区域为无文字分布的区域。
  20. 如权利要求19所述的计算机可读存储介质,其特征在于,所述从转换后的图片中筛选出包含图表信息的图片包括:
    对该转换后的图片进行灰度处理,将该转换后的图片转换为灰度图;
    按行统计该灰度图中黑色像素点的数量和比例,若一行中黑色像素点的数量和比例超过指定阈值,则判定该行包含有具体内容;及
    统计包含有具体内容的行的数量,若包含有具体内容的行数大于或等于设定阈值,则判定该转换后的图片为一张包含图表信息的图片。
PCT/CN2017/105033 2017-08-31 2017-09-30 图表数据结构化提取方法、系统、电子设备及计算机可读存储介质 WO2019041442A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710775380.X 2017-08-31
CN201710775380.XA CN107689070B (zh) 2017-08-31 2017-08-31 图表数据结构化提取方法、电子设备及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2019041442A1 true WO2019041442A1 (zh) 2019-03-07

Family

ID=61155956

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/105033 WO2019041442A1 (zh) 2017-08-31 2017-09-30 图表数据结构化提取方法、系统、电子设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN107689070B (zh)
WO (1) WO2019041442A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107871128B (zh) * 2017-12-11 2023-06-06 广州市标准化研究院(广州市组织机构代码管理中心) 一种基于svg动态图表的高鲁棒性图像识别方法
CN109062874B (zh) * 2018-06-12 2022-03-04 平安科技(深圳)有限公司 财政数据的获取方法、终端设备及介质
CN109656647B (zh) * 2018-09-27 2023-04-11 平安科技(深圳)有限公司 图表图片生成方法、装置、设备及计算机可读存储介质
CN109461195A (zh) * 2018-09-28 2019-03-12 武汉优品楚鼎科技有限公司 一种基于svg的图表提取方法、装置及设备
CN111753814B (zh) * 2019-03-26 2023-07-25 杭州海康威视数字技术股份有限公司 样本生成方法、装置及设备
CN113553883B (zh) * 2020-04-24 2023-04-07 上海高德威智能交通系统有限公司 一种票据图像识别方法、装置及电子设备
CN112464626B (zh) * 2020-12-09 2022-04-01 上海携宁计算机科技股份有限公司 Pdf文档的图表提取方法、电子设备和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6014458A (en) * 1994-11-10 2000-01-11 Canon Kabushiki Kaisha System for designating document direction
CN101008960A (zh) * 2006-01-26 2007-08-01 株式会社理光 信息处理设备,信息处理方法,以及计算机程序产品
CN101908136A (zh) * 2009-06-08 2010-12-08 比亚迪股份有限公司 一种表格识别处理方法及系统
CN104346615A (zh) * 2013-08-08 2015-02-11 北大方正集团有限公司 版式文档中复合图的提取装置和提取方法
CN106897690A (zh) * 2017-02-22 2017-06-27 南京述酷信息技术有限公司 Pdf表格提取方法
CN107103010A (zh) * 2016-02-23 2017-08-29 阿里巴巴集团控股有限公司 可视化数据的处理方法及装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101556606B (zh) * 2009-05-20 2010-12-01 同方知网(北京)技术有限公司 一种基于Web数值表格抽取的数据挖掘方法
JP2011039839A (ja) * 2009-08-12 2011-02-24 Konica Minolta Business Technologies Inc 文書処理装置、文書処理方法および文書処理プログラム
CN101853246B (zh) * 2010-06-14 2012-05-23 深圳市万兴软件有限公司 一种文档格式的转换方法及装置
CN102567300B (zh) * 2011-12-29 2013-11-27 方正国际软件有限公司 图片文档的处理方法及装置
CN106951400A (zh) * 2017-02-06 2017-07-14 北京因果树网络科技有限公司 一种pdf文件的信息抽取方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6014458A (en) * 1994-11-10 2000-01-11 Canon Kabushiki Kaisha System for designating document direction
CN101008960A (zh) * 2006-01-26 2007-08-01 株式会社理光 信息处理设备,信息处理方法,以及计算机程序产品
CN101908136A (zh) * 2009-06-08 2010-12-08 比亚迪股份有限公司 一种表格识别处理方法及系统
CN104346615A (zh) * 2013-08-08 2015-02-11 北大方正集团有限公司 版式文档中复合图的提取装置和提取方法
CN107103010A (zh) * 2016-02-23 2017-08-29 阿里巴巴集团控股有限公司 可视化数据的处理方法及装置
CN106897690A (zh) * 2017-02-22 2017-06-27 南京述酷信息技术有限公司 Pdf表格提取方法

Also Published As

Publication number Publication date
CN107689070B (zh) 2021-06-04
CN107689070A (zh) 2018-02-13

Similar Documents

Publication Publication Date Title
WO2019041442A1 (zh) 图表数据结构化提取方法、系统、电子设备及计算机可读存储介质
US20210256253A1 (en) Method and apparatus of image-to-document conversion based on ocr, device, and readable storage medium
WO2019041527A1 (zh) 文档图表抽取方法、电子设备及计算机可读存储介质
US9798925B2 (en) Method for identifying PDF document
KR20160132842A (ko) 플로우 문서를 생성하기 위한 이미지 문서 컴포넌트 검출 및 추출 기법
CN104298982A (zh) 一种文字识别方法及装置
US10679089B2 (en) Systems and methods for optical character recognition
CN110728687B (zh) 文件图像分割方法、装置、计算机设备和存储介质
US8538154B2 (en) Image processing method and image processing apparatus for extracting heading region from image of document
CN106599001A (zh) 网页内容获取方法和系统
CN113221632A (zh) 文档图片识别方法、装置以及计算机设备
CN110866457A (zh) 一种电子保单的获得方法、装置、计算机设备和存储介质
US20100238474A1 (en) Document image processing apparatus, document image processing method, and computer-readable recording medium having recorded document image processing program
WO2020186779A1 (zh) 图片信息识别方法、装置、计算机设备和存储介质
US9049400B2 (en) Image processing apparatus, and image processing method and program
CN114359533A (zh) 一种基于页面文本的页码识别方法和计算机设备
US10963690B2 (en) Method for identifying main picture in web page
WO2019041526A1 (zh) 文档图表抽取方法、电子设备及计算机可读存储介质
CN112528832A (zh) 对pdf格式的继电保护定值单进行处理的方法和系统
CN109145879B (zh) 一种打印字体识别的方法、设备及存储介质
CN115565193A (zh) 问卷信息录入方法、装置、电子设备及存储介质
CN115331247A (zh) 文档结构识别方法、装置、电子设备及可读存储介质
CN112560849B (zh) 基于神经网络算法的文理分割方法及系统
CN115205881A (zh) 一种表格识别方法、设备及介质
CN114417820A (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: 17923525

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 24.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17923525

Country of ref document: EP

Kind code of ref document: A1