CN112668289A - Extraction method and device of nested table and storage medium - Google Patents

Extraction method and device of nested table and storage medium Download PDF

Info

Publication number
CN112668289A
CN112668289A CN202011564518.XA CN202011564518A CN112668289A CN 112668289 A CN112668289 A CN 112668289A CN 202011564518 A CN202011564518 A CN 202011564518A CN 112668289 A CN112668289 A CN 112668289A
Authority
CN
China
Prior art keywords
line segments
text
unit
tables
intersection points
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.)
Pending
Application number
CN202011564518.XA
Other languages
Chinese (zh)
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.)
Auntec Co ltd
Original Assignee
Auntec 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 Auntec Co ltd filed Critical Auntec Co ltd
Priority to CN202011564518.XA priority Critical patent/CN112668289A/en
Publication of CN112668289A publication Critical patent/CN112668289A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

本申请公开了一种嵌套表格的提取方法及装置、存储介质,所述方法包括:读取第一类型文件中的数据内容并进行解析,确定解析后的所述数据内容中包含的线段坐标信息;以展示单元为基准,对线段进行分组;基于线段的坐标将相邻或相接线段横向或纵向距离小于相应阈值、相邻线段相邻端点间隔小于对应定阈值的线段进行合并;遍历合并后的所有线段,确定线段是否相交,生成集合;遍历集合内线段,确定合并后的相交线段之间的交点,遍历所有交点,确定构成矩形框的交点;以构成的矩形框面积大于设定阈值的交点为基准,生成表格;基于生成的表格,计算表格的包含关系,基于包含关系形成嵌套表格。本申请提升了表格提取准确率,减轻了编辑工作。

Figure 202011564518

The present application discloses a method, device, and storage medium for extracting a nested table. The method includes: reading and parsing data content in a first-type file, and determining line segment coordinates included in the parsed data content. information; group the line segments based on the display unit; merge the line segments whose horizontal or vertical distance between adjacent or adjacent line segments is less than the corresponding threshold and the interval between the adjacent endpoints of the adjacent line segments is less than the corresponding predetermined threshold based on the coordinates of the line segments; traverse and merge After all the line segments, determine whether the line segments intersect, and generate a set; traverse the line segments in the set, determine the intersection points between the merged intersecting line segments, traverse all the intersection points, and determine the intersection points that form a rectangular frame; The area of the formed rectangular frame is greater than the set threshold Based on the intersection of , a table is generated; based on the generated table, the inclusion relationship of the table is calculated, and a nested table is formed based on the inclusion relationship. This application improves the accuracy of table extraction and reduces editing work.

Figure 202011564518

Description

Extraction method and device of nested table and storage medium
Technical Field
The embodiment of the application relates to office and network data acquisition technologies, in particular to a method and a device for extracting nested tables and a storage medium.
Background
At present, when text recognition is performed on a non-editable text, such as a PDF text, the recognition and extraction manner of the text portion therein is relatively mature, and the recognition and extraction accuracy is relatively high, but when the non-editable text includes table contents, such as a table, the recognition of the table structure itself is relatively poor, such as the lines in the recognized table are discontinuous and uneven, which seriously affects the recognition experience of the non-editable text, and causes a user to need to waste a large amount of time to repair the recognized table structure, which results in relatively low processing efficiency and poor use experience.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for extracting a nested table, and a storage medium.
According to a first aspect of the present application, there is provided a method for extracting a nested table, including:
reading and analyzing data content in a first type file, and determining line segment coordinate information contained in the analyzed data content;
grouping the line segments by taking the display unit of the first type file as a reference;
for the line segments in each group, merging the line segments of which the transverse or longitudinal distance of the adjacent or phase connection line segments is less than a first set threshold value and the interval between the adjacent end points of the adjacent line segments is less than a second set threshold value based on the coordinates of the line segments;
traversing all the combined line segments, classifying according to whether the line segments are intersected or not, generating N sets, wherein the line segments in the sets are intersected, and the line segments between the sets are not intersected; n is an integer greater than or equal to 1;
traversing the line segments in the set, determining the intersection points between the combined intersected line segments, traversing all the intersection points, and determining the intersection points forming the rectangular frame;
generating a table by taking the intersection point of which the area of the formed rectangular frame is larger than the third threshold value as a reference;
based on the generated tables, inclusion relationships between the tables are calculated, and nested tables are formed based on the inclusion relationships of the tables.
As an implementation, the method further comprises:
acquiring text information and coordinate information of the text contained in the analyzed data content, merging the text according to the coordinate information of the text, and calculating a character outline;
determining text and/or picture information located in the table area according to coordinate information of the outline of the text and/or picture coordinate information contained in the analyzed data content;
and filling the determined text and/or picture in a corresponding area of the table.
As one implementation, the table-based containment relationship forms a nested table, including:
according to the coordinate information of the rectangular frame, integrating the data outside the table for analysis, and calculating a basic cell width and height list;
based on the basic cell width and height list, calculating the nesting relation between the tables, and setting rectangular area borders and merging cells according to the sequence of the rectangular area from small to large to generate a nested table format.
As an implementation, the method further comprises:
and storing the text information outside the table in the first type file, and storing the table and the text and/or the picture in the table as table data.
As one implementation, the determining an intersection point between the merged line segments includes:
dividing transverse line segments contained in the analyzed data content into a first set, dividing longitudinal line segments into a second set, and sequencing the line segments in the first set and the second set according to line segment coordinates;
and determining all line segments with intersection points for any line segment in the first set or the second set, and forming an intersection point set by intersection points formed among the line segments with the intersection points.
According to a second aspect of the present application, there is provided an extraction apparatus of a nested table, comprising:
the reading and analyzing unit is used for reading and analyzing the data content in the first type file;
a first determining unit, configured to determine line segment coordinate information included in the analyzed data content;
the grouping unit is used for grouping the line segments by taking the display unit of the first type file as a reference;
the first merging unit is used for merging the line segments with the transverse or longitudinal distance of the adjacent or connected line segments smaller than a first set threshold value and the adjacent endpoint interval of the adjacent line segments smaller than a second set threshold value based on the coordinates of the line segments in each group;
the set generation unit is used for traversing all the combined line segments, classifying according to whether the line segments are intersected or not, and generating N sets, wherein the line segments in the sets are intersected, and the line segments between the sets are not intersected; n is an integer greater than or equal to 1;
the second determining unit is used for traversing the line segments in the set, determining the intersection points between the combined intersected line segments, traversing all the intersection points and determining the intersection points forming the rectangular frame;
a generating unit, configured to generate a table based on an intersection point where the area of the rectangular frame is larger than a third threshold;
and the forming unit is used for calculating the inclusion relation between the tables based on the generated tables and forming the nested tables based on the inclusion relation of the tables.
As an implementation, the apparatus further comprises:
the acquisition unit is used for acquiring the text information contained in the analyzed data content and the coordinate information of the text;
the second merging unit is used for merging the texts according to the coordinate information of the texts and calculating character outlines;
a third determining unit, configured to determine text and/or picture information located in the table area according to coordinate information of an outline of a text and/or picture coordinate information included in the parsed data content;
and the filling unit is used for filling the determined text and/or picture in the corresponding area of the table.
As an implementation, the forming unit is further configured to:
according to the coordinate information of the rectangular frame, integrating the data outside the table for analysis, and calculating a basic cell width and height list;
based on the basic cell width and height list, calculating the nesting relation between the tables, and setting rectangular area borders and merging cells according to the sequence of the rectangular area from small to large to generate a nested table format.
As an implementation, the apparatus further comprises:
and the storage unit is used for storing the text information outside the table in the first type file, and the table and the text and/or picture in the table are stored as table data.
As an implementation manner, the second determining unit is further configured to:
dividing transverse line segments contained in the analyzed data content into a first set, dividing longitudinal line segments into a second set, and sequencing the line segments in the first set and the second set according to line segment coordinates;
and determining all line segments with intersection points for any line segment in the first set or the second set, and forming an intersection point set by intersection points formed among the line segments with the intersection points.
According to a third aspect of the present application, there is provided a storage medium having stored thereon an executable program which, when executed by a processor, implements the steps of the method of extracting nested tables.
According to the method and the device for extracting the nested table and the storage medium, the line segment information is extracted from the data content in the analyzed non-editable text, the line segments are merged based on the coordinate positions of the line segments, the intersection points between the merged line segments are determined, the corresponding table structure is determined and generated based on the intersection point information, and the corresponding characters or pictures and the like are filled in the regenerated table structure according to the coordinate information of the analyzed text, so that the non-editable character text and the table content can be extracted, for example, the structure of the extracted table can be directly imported into an Excel file, and the like. The embodiment of the application improves the accurate identification of the table in the non-editable text, can be directly used without redrawing, greatly facilitates the use of a user, improves the identification accuracy of the non-editable text, and lightens the editing work of the user.
Drawings
Fig. 1 is a schematic flowchart of an extraction method of a nested table according to an embodiment of the present application;
fig. 2 is a flowchart illustrating a specific example of an extracting method of a nested table according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a set of horizontal line segments of a table provided in an embodiment of the present application;
FIG. 4 is a schematic diagram of a set of vertical line segments of a table provided in an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a line crossing situation provided in an embodiment of the present application;
FIG. 6 is a schematic diagram of a text box provided in an embodiment of the present application;
fig. 7 is a schematic diagram of a table extraction and reduction effect in PDF according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a composition of an extracting apparatus for nested tables according to an embodiment of the present application.
Detailed Description
The following explains the essence of the technical solution of the embodiments of the present application in detail with reference to examples.
Fig. 1 is a schematic flowchart of an extraction method of a nested table provided in an embodiment of the present application, and as shown in fig. 1, the extraction method of the nested table in the embodiment of the present application includes the following processing steps:
step 101, reading and analyzing data content in a first type file, and determining line segment coordinate information contained in the analyzed data content.
In the embodiment of the present application, the first type file includes non-editable text such as PDF text, screen capture text, pictures, and other text.
The first type file can contain text, tables, particularly nested tables, pictures and the like. In the embodiment of the present application, the table includes not only a general table but also a frame containing characters.
And 102, grouping the line segments by taking the display unit of the first type file as a reference.
In this embodiment of the application, the display unit may be a page of the first type file, that is, each page constitutes one display unit, and the display unit may also be a portion of the first type file displayed in the current display interface of the electronic device. In the embodiment of the application, after the first type file is analyzed, the line segments in the first type file are grouped according to the display unit, so that the tables and the like in the first type file are processed according to the groups.
When the display unit is the current display interface, the user can display the table in the first type file to be analyzed in the current display interface, and perform text analysis by using the current display interface as a unit so as to analyze the table displayed by the current display interface.
And 103, merging the line segments in each group, wherein the transverse or longitudinal distance of the adjacent or connected line segments is less than a first set threshold value, and the interval between the adjacent end points of the adjacent line segments is less than a second set threshold value, based on the coordinates of the line segments.
In the embodiment of the present application, the line segments in the table should be, in theory, either parallel or perpendicular to each other. For line segments in which there is no continuity but the spacing is particularly close, the parallel distances are also particularly close, merged into one line segment.
And 104, traversing all the combined line segments, classifying according to whether the line segments are intersected or not, generating N sets, wherein the line segments in the sets are intersected, and the line segments between the sets are not intersected.
Wherein N is an integer of 1 or more.
In the embodiment of the application, all line segments in one display unit needing to be traversed and analyzed are classified according to whether the line segments are intersected or not after all transverse lines and vertical lines are traversed, and N sets are generated, wherein the line segments in the sets are intersected, and the line segments between the sets are not intersected. The set without intersection among the line segments is the precursor of a plurality of mutually nested tables to be extracted.
And 105, traversing the line segments in the set, determining intersection points among the combined intersected line segments, traversing all the intersection points, and determining the intersection points forming the rectangular frame.
In the embodiment of the application, the transverse line segments contained in the analyzed data content are divided into a first set, the longitudinal line segments are divided into a second set, and the line segments in the first set and the line segments in the second set are sequenced according to line segment coordinates; and determining all line segments with intersection points for any line segment in the first set or the second set, and forming an intersection point set by intersection points formed among the line segments with the intersection points.
And 106, generating a table by taking the intersection point of which the area of the formed rectangular frame is larger than the third threshold value as a reference.
In the embodiment of the present application, for the intersection point capable of forming the rectangular frame, the size of the rectangular frame needs to be determined, and for the rectangular frame smaller than the minimum text outline, an analysis error obviously occurs, and a non-table line segment part may be added to the line segment set, so that the rectangular frame with the area smaller than the third threshold value should be removed. In the embodiment of the present application, because the table structure included in the first type file is mainly configured as a rectangular frame, the table structure can be regenerated by determining the corresponding rectangular frame through the intersection point set.
And step 107, calculating the inclusion relationship between the tables based on the generated tables, and forming a nested table based on the inclusion relationship of the tables.
In the embodiment of the application, according to the coordinate information of the rectangular frame, integrating the data outside the table for analysis, and calculating a basic cell width and height list; based on the basic cell width and height list, calculating the nesting relation between the tables, and setting the rectangular area border and the merging cells according to the sequence of the rectangular area from small to large, thereby generating the nested table format.
In the embodiment of the present application, on the basis of the foregoing steps, the method further includes: acquiring text information and coordinate information of the text contained in the analyzed data content, merging the text according to the coordinate information of the text, and calculating a character outline;
determining text and/or picture information located in the table area according to coordinate information of the outline of the text and/or picture coordinate information contained in the analyzed data content;
and filling the determined text and/or picture in a corresponding area of the table.
And after the table structure is determined, acquiring the text content in the table area, filling the text and/or picture information in the table area into the table according to the corresponding coordinate information of the text and/or picture.
In this embodiment of the application, after the text and table analysis processing is completed on the first type file, the text information outside the table in the first type file may be separately stored, and the table and the text and/or the picture in the table are stored as table data.
The embodiments of the present application will be described in further detail below with reference to specific examples.
The embodiment of the present application takes a PDF document as an example for description, and it should be noted that other non-editable texts, such as a screenshot, a picture and other texts, may use the technical means of the embodiment of the present application.
Fig. 2 is a flowchart of a specific example of an extraction method of a nested table according to an embodiment of the present application, and as shown in fig. 2, the extraction method of table data and a nested table in a PDF document according to the embodiment of the present application includes the following specific steps:
reading a PDF file to a memory of the electronic equipment, reading each page of the PDF, and analyzing data of each page one by one.
Analyzing all data information in the PDF page, wherein the data information comprises but is not limited to attribute information of characters, line segments and pictures and coordinate information of the characters, the line segments and the pictures.
Analyzing and acquiring coordinate information of all line segments in the PDF page, and sorting out a set of all horizontal lines (horizontal lines) and vertical lines or vertical lines (vertical lines). The line segments acquired here may be discontinuous data information. Such as: [ (X1, Y1), (X2, Y1) ], [ (X2, Y1), (X3, Y1) ], where X represents an X-axis coordinate value of an end point of the segment, Y represents a Y-axis coordinate value of an end point of the segment, e.g., (X1, Y1) represents a coordinate of a first end point of the segment, and (X2, Y1) represents a coordinate of a second end point of the segment. The coordinate system here may be a coordinate system of a display screen in the electronic device, such as a coordinate system in units of pixels, or may be a coordinate system specifically provided in the electronic device.
And for the condition that the horizontal lines and the vertical lines in the page cannot be aligned, judging the set coordinate points of the horizontal lines or the vertical lines, and combining the parallel line segments of which the horizontal and vertical distances are less than a certain set threshold value. As in the above coordinate case, the horizontal line segments are overlapped, and if X3> X2> X1, the data can be directly recorded as [ (X1, Y1), (X3, Y1) ], and recorded as a line segment; if a segment [ (X1, Y1), (X2, Y1) ], [ (X2, Y2), (X3, Y2) ],. Y1 and Y2 are present in the set, the difference between these segments can also be recorded as [ (X1, Y1), (X3, Y1) ]. The second set threshold here may be set according to a specific resolution precision, such as several pixel units, such as 100 pixel units, etc. And extending and connecting the line segments of which the distance between the end points is less than a first set threshold value in the two parallel line segments, so that the parallel line segments are fused into one line segment.
The line segments of the horizontal and vertical sets are sorted according to the coordinates to obtain two ordered sets of line segments, as shown in fig. 3 and 4, examples of the horizontal line set and the vertical line set are respectively shown.
Whether the horizontal lines and the vertical lines on the current page have intersection points is judged, and five conditions are adopted. Fig. 5 is a schematic diagram of a line segment intersection situation provided in the embodiment of the present application, and as shown in fig. 5, five cases where there are intersections between two line segments include:
case 1 is a case where the horizontal line segment and the vertical line segment do not intersect or where one line segment has been determined to intersect with other line segments and is set in the set of intersecting line segments, and the determination of the intersection point of the subsequent horizontal and vertical lines continues to be circulated regardless of the resetting of the two line segments to the set of intersecting line segments, and still remains in the original set of line segments.
Case 2 is that the horizontal line segment and the vertical line segment intersect, and are not included in other intersecting line segment sets, so that two line segments that intersect in case 2 need to be arranged in the intersecting line segment set, and the set is guaranteed to be formed by the intersecting line segments.
Case 3 is where the vertical line segment does not belong to any set of line segments and the horizontal line segment belongs to a set of line segments, then the vertical line segment is placed in the set of horizontal line segments.
Case 4 is where the vertical line segment belongs to a set of line segments and the horizontal line segment does not belong to any set of line segments, then the horizontal line segment is set to the set of vertical line segments.
Case 5 is where the vertical and horizontal line segments intersect and are in different sets of line segments, then the two sets of line segments where the vertical and horizontal line segments are located are merged.
The line segment set shown in fig. 5 may be considered that a plurality of line segments located under the same X-axis coordinate form a vertical line segment set, a plurality of line segments located under the same Y-axis coordinate form a horizontal line segment set, and the coordinates of the line segments in each set are used to determine whether to intersect, and the intersecting line segments are set in the intersecting line segment set.
After the intersection point judgment processing, one or more sets of the intersected line segments can be obtained, and the sets are independent line segment sets without intersection points. After traversing all the horizontal lines and the vertical lines, classifying according to whether the line segments are intersected or not and according to whether the line segments are intersected or not, generating N sets, wherein the line segments in the sets are intersected, and the line segments between the sets are not intersected. The disjoint set of these segments is the predecessor of the nested tables to be extracted.
And (5) extracting a set of crossed line segment intersections.
Traversing the set of all the intersections forms a rectangular table. The composition of the rectangle (upper left coordinates [ x1, y1], lower right coordinates [ x2, y2]) are four separate line segments: ([ x1, y1], [ x2, y1]), ([ x1, y2], [ x2, y2]), ([ x1, y1], [ x1, y2]), ([ x2, y1], [ x2, y2]), and whether or not these line segments exist is determined, and if they exist, it is determined that a rectangle is formed.
And screening out all intersection point sets with the rectangular areas larger than a third set threshold. The third threshold may be set according to the outline size of the text, that is, each table unit in the table can at least put the next smallest text, or at least put the next normal text, so that the rectangular frame with an excessively small area will be an error table due to a line segment analysis error.
The method comprises the steps of utilizing a set of rectangles to calculate form information, synthesizing extra-form data for analysis according to obtained coordinate information of the rectangles, calculating a cell width and height list, calculating nesting relations among the forms, determining whether nested forms exist in the forms or not based on the nesting relations, setting rectangular region borders and merging cells for the form units with nested structures based on a mode that the areas are from small to large, and generating nested form format information.
According to the coordinate information of the text, merging of the text and calculation of the outline of the text are performed, where the coordinate of the text is the coordinate value of the upper left of the character, and after processing, the position information of the character text box is obtained, as shown in fig. 6, and the square part in the figure represents the character text box.
And calculating the relationship of the nested tables, and performing sorting processing according to the relationship of the small area of the tables to the large area of the tables, wherein the sorting of the areas of the tables is used for conveniently recording the text information and the picture information.
Text and picture information within the table region is calculated. And recording the information of the characters and the pictures from the smallest area in the nested table. The matching of the text content of the nested child tables in the table structure to the parent table is avoided.
And calculating the structure information of the nested table and storing the structure information into the page table information structure.
And circulating the processes to analyze the data information of all the pages of the whole PDF file.
And writing the information according to all the analyzed information of the PDF file. The text pictures outside the table are data of one type, the data can be stored in a related text file or can be copied into other electronic equipment, and the data interface in the table is data of another type, and can be written into an Excel file step by step.
In the embodiment of the application, the analysis of attribute information such as the size of characters, whether colors are thickened and the like in the analysis table of character attributes can be conveniently written into corresponding rows and columns and text attribute values can be set.
The method and the device for extracting the nested table data can accurately restore the table effect in the file, and the nested table data can be effectively extracted and restored. Fig. 7 is a schematic diagram of a table extraction and reduction effect in a PDF according to an embodiment of the present application, and as shown in fig. 7, a schematic diagram of a display effect of extracting and reducing a table in a PDF into an Excel is shown.
According to the method and the device, the line segment information is extracted from the data content in the analyzed non-editable text, the line segments are merged based on the coordinate positions of the line segments, the intersection points between the merged line segments are determined, the corresponding table structure is determined and generated based on the intersection point information, and the corresponding characters or pictures are filled in the regenerated table structure according to the coordinate information of the analyzed text, so that the non-editable character text and the table content can be extracted, for example, the extracted table content can be imported into an Excel file according to the table structure, and the like. The embodiment of the application improves the accurate identification of the table in the non-editable text, can be directly used without redrawing, greatly facilitates the use of a user, improves the identification accuracy of the non-editable text, and greatly lightens the editing work of the user.
Fig. 8 is a schematic structural diagram of a composition of an extracting apparatus of a nested table provided in an embodiment of the present application, and as shown in fig. 8, the extracting apparatus of the nested table of the embodiment of the present application includes:
a reading and analyzing unit 80, configured to read and analyze data content in the first type file;
a first determining unit 81, configured to determine line segment coordinate information included in the analyzed data content;
a grouping unit 82, configured to group the line segments with reference to the presentation unit of the first type file;
the first merging unit 83 is configured to merge, for line segments in each group, line segments whose lateral or longitudinal distance between adjacent or adjacent line segments is smaller than a first set threshold and whose adjacent endpoint interval is smaller than a second set threshold based on coordinates of the line segments;
a set generating unit 84, configured to traverse all the merged segments, classify according to whether the segments intersect, and generate N sets, where the segments in the sets intersect, and the segments between the sets do not intersect; n is an integer greater than or equal to 1;
a second determining unit 85, configured to traverse line segments in the set, determine intersections between the merged intersecting line segments, traverse all the intersections, and determine intersections that form the rectangular frame;
a generating unit 86 configured to generate a table based on an intersection point at which the area of the rectangular frame is larger than a third threshold;
a forming unit 87, configured to calculate an inclusion relationship between the tables based on the generated tables, and form a nested table based on the inclusion relationship of the tables. .
As an implementation manner, on the basis of the extraction apparatus of the nested table shown in fig. 8, the extraction apparatus of the nested table according to the embodiment of the present application further includes:
an acquiring unit (not shown in fig. 8) configured to acquire text information included in the parsed data content and coordinate information of the text;
a second merging unit (not shown in fig. 8) configured to merge texts according to coordinate information of the texts and calculate text outlines;
a third determining unit (not shown in fig. 8) configured to determine text and/or picture information located in the table area according to coordinate information of an outline of a text and/or picture coordinate information included in the parsed data content;
a filling unit (not shown in fig. 8) for filling the determined text and/or picture in the corresponding area of the table.
As an implementation manner, the forming unit 87 is further configured to:
according to the coordinate information of the rectangular frame, integrating the data outside the table for analysis, and calculating a basic cell width and height list;
based on the basic cell width and height list, calculating the nesting relation between the tables, and setting rectangular area borders and merging cells according to the sequence of the rectangular area from small to large to generate a nested table format.
As an implementation manner, on the basis of the extraction apparatus of the nested table shown in fig. 8, the extraction apparatus of the nested table according to the embodiment of the present application further includes:
and a storage unit (not shown in fig. 8) configured to store text information outside the table in the first type file, and store the table and text and/or pictures in the table as table data.
As an implementation manner, the second determining unit 84 is further configured to:
dividing transverse line segments contained in the analyzed data content into a first set, dividing longitudinal line segments into a second set, and sequencing the line segments in the first set and the second set according to line segment coordinates;
and determining all line segments with intersection points for any line segment in the first set or the second set, and forming an intersection point set by intersection points formed among the line segments with the intersection points.
In an exemplary embodiment, each of the Processing units of the extraction apparatus of the nested table of the embodiment of the present Application may be implemented by one or more Central Processing Units (CPUs), Graphics Processing Units (GPUs), Baseband Processors (BPs), Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors (GPUs), controllers, Micro Controllers (MCUs), microprocessors (microprocessors), or other electronic elements.
In the embodiment of the present disclosure, the specific manner in which each processing unit in the extraction apparatus of the nested table shown in fig. 8 performs operations has been described in detail in the embodiment related to the method, and will not be elaborated here.
The embodiment of the application also describes a storage medium, on which an executable program is stored, and the executable program realizes the steps of the extraction method of the nested table of the embodiment when being executed by a processor.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present invention, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention. The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are only illustrative, for example, the division of the unit is only one logical function division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units; can be located in one place or distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The above description is only an embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the present invention, and all such changes or substitutions are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (11)

1. A method of extracting nested tables, the method comprising:
reading and analyzing data content in a first type file, and determining line segment coordinate information contained in the analyzed data content;
grouping the line segments by taking the display unit of the first type file as a reference;
for the line segments in each group, merging the line segments of which the transverse or longitudinal distance of the adjacent or phase connection line segments is less than a first set threshold value and the interval between the adjacent end points of the adjacent line segments is less than a second set threshold value based on the coordinates of the line segments;
traversing all the combined line segments, classifying according to whether the line segments are intersected or not, generating N sets, wherein the line segments in the sets are intersected, and the line segments between the sets are not intersected; n is an integer greater than or equal to 1;
traversing the line segments in the set, determining the intersection points between the combined intersected line segments, traversing all the intersection points, and determining the intersection points forming the rectangular frame;
generating a table by taking the intersection point of which the area of the formed rectangular frame is larger than the third threshold value as a reference;
based on the generated tables, inclusion relationships between the tables are calculated, and nested tables are formed based on the inclusion relationships of the tables.
2. The method of claim 1, further comprising:
acquiring text information and coordinate information of the text contained in the analyzed data content, merging the text according to the coordinate information of the text, and calculating a character outline;
determining text and/or picture information located in the table area according to coordinate information of the outline of the text and/or picture coordinate information contained in the analyzed data content;
and filling the determined text and/or picture in a corresponding area of the table.
3. The method of claim 2, wherein forming nested tables based on table-based containment relationships comprises:
according to the coordinate information of the rectangular frame, integrating the data outside the table for analysis, and calculating a basic cell width and height list;
based on the basic cell width and height list, calculating the nesting relation between the tables, and setting rectangular area borders and merging cells according to the sequence of the rectangular area from small to large to generate a nested table format.
4. A method according to claim 2 or 3, characterized in that the method further comprises:
and storing the text information outside the table in the first type file, and storing the table and the text and/or the picture in the table as table data.
5. The method of claim 1, wherein determining intersections between merged segments comprises:
dividing transverse line segments contained in the analyzed data content into a first set, dividing longitudinal line segments into a second set, and sequencing the line segments in the first set and the second set according to line segment coordinates;
and determining all line segments with intersection points for any line segment in the first set or the second set, and forming an intersection point set by intersection points formed among the line segments with the intersection points.
6. An apparatus for extracting nested tables, the apparatus comprising:
the reading and analyzing unit is used for reading and analyzing the data content in the first type file;
a first determining unit, configured to determine line segment coordinate information included in the analyzed data content;
the grouping unit is used for grouping the line segments by taking the display unit of the first type file as a reference;
the first merging unit is used for merging the line segments with the transverse or longitudinal distance of the adjacent or connected line segments smaller than a first set threshold value and the adjacent endpoint interval of the adjacent line segments smaller than a second set threshold value based on the coordinates of the line segments in each group;
the set generation unit is used for traversing all the combined line segments, classifying according to whether the line segments are intersected or not, and generating N sets, wherein the line segments in the sets are intersected, and the line segments between the sets are not intersected; n is an integer greater than or equal to 1;
the second determining unit is used for traversing the line segments in the set, determining the intersection points between the combined intersected line segments, traversing all the intersection points and determining the intersection points forming the rectangular frame;
a generating unit, configured to generate a table based on an intersection point where the area of the rectangular frame is larger than a third threshold;
and the forming unit is used for calculating the inclusion relation between the tables based on the generated tables and forming the nested tables based on the inclusion relation of the tables.
7. The apparatus of claim 6, further comprising:
the acquisition unit is used for acquiring the text information contained in the analyzed data content and the coordinate information of the text;
the second merging unit is used for merging the texts according to the coordinate information of the texts and calculating character outlines;
a third determining unit, configured to determine text and/or picture information located in the table area according to coordinate information of an outline of a text and/or picture coordinate information included in the parsed data content;
and the filling unit is used for filling the determined text and/or picture in the corresponding area of the table.
8. The apparatus of claim 7, wherein the forming unit is further configured to:
according to the coordinate information of the rectangular frame, integrating the data outside the table for analysis, and calculating a basic cell width and height list;
based on the basic cell width and height list, calculating the nesting relation between the tables, and setting rectangular area borders and merging cells according to the sequence of the rectangular area from small to large to generate a nested table format.
9. The apparatus of claim 7 or 8, further comprising:
and the storage unit is used for storing the text information outside the table in the first type file, and the table and the text and/or picture in the table are stored as table data.
10. The apparatus of claim 6, wherein the second determining unit is further configured to:
dividing transverse line segments contained in the analyzed data content into a first set, dividing longitudinal line segments into a second set, and sequencing the line segments in the first set and the second set according to line segment coordinates;
and determining all line segments with intersection points for any line segment in the first set or the second set, and forming an intersection point set by intersection points formed among the line segments with the intersection points.
11. A storage medium having stored thereon an executable program which, when executed by a processor, carries out the steps of the method of extracting nested tables according to any one of claims 1 to 5.
CN202011564518.XA 2020-12-25 2020-12-25 Extraction method and device of nested table and storage medium Pending CN112668289A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011564518.XA CN112668289A (en) 2020-12-25 2020-12-25 Extraction method and device of nested table and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011564518.XA CN112668289A (en) 2020-12-25 2020-12-25 Extraction method and device of nested table and storage medium

Publications (1)

Publication Number Publication Date
CN112668289A true CN112668289A (en) 2021-04-16

Family

ID=75409342

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011564518.XA Pending CN112668289A (en) 2020-12-25 2020-12-25 Extraction method and device of nested table and storage medium

Country Status (1)

Country Link
CN (1) CN112668289A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113158987A (en) * 2021-05-19 2021-07-23 中国科学技术信息研究所 Table processing method, device, equipment and computer readable storage medium
CN113343815A (en) * 2021-05-31 2021-09-03 北森云计算有限公司 Method for identifying form in PDF (Portable document Format) and other format documents
CN113343658A (en) * 2021-07-01 2021-09-03 湖南四方天箭信息科技有限公司 PDF file information extraction method and device and computer equipment
CN115390853A (en) * 2022-09-14 2022-11-25 北京虎蜥信息技术有限公司 Structured analysis method, system, terminal and storage medium for multi-source process file
CN115471854A (en) * 2022-09-15 2022-12-13 云南电网有限责任公司信息中心 A form image defect correction and extraction method based on machine vision technology
CN115512385A (en) * 2022-09-30 2022-12-23 中交第二航务工程局有限公司 Bitmap-format reinforcing steel drawing data extraction method and system
CN115631503A (en) * 2022-09-08 2023-01-20 杭州新迪数字工程系统有限公司 A method and system for automatically extracting tabular data in two-dimensional drawings
CN115759259A (en) * 2022-11-10 2023-03-07 电子科技大学中山学院 Form recognition method, device, electronic equipment and storage medium
CN116086437A (en) * 2023-01-17 2023-05-09 智道网联科技(北京)有限公司 Method, device, electronic device and storage medium for generating lane line collection task frame
CN116682130A (en) * 2022-02-22 2023-09-01 广联达科技股份有限公司 Method, device and equipment for extracting icon information and readable storage medium
CN116719459A (en) * 2022-09-26 2023-09-08 荣耀终端有限公司 Display method of comment box, electronic device and readable storage medium
CN119759355A (en) * 2024-11-22 2025-04-04 杭州信公小安信息科技有限公司 A method for extracting and parsing tables in PDF
CN115759259B (en) * 2022-11-10 2026-05-01 电子科技大学中山学院 A table recognition method, apparatus, electronic device, and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446264A (en) * 2018-03-26 2018-08-24 阿博茨德(北京)科技有限公司 Table vector analysis method and device in PDF document
CN110399878A (en) * 2019-06-14 2019-11-01 南京火眼锐视信息科技有限公司 Table format restoration methods, computer-readable medium and computer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446264A (en) * 2018-03-26 2018-08-24 阿博茨德(北京)科技有限公司 Table vector analysis method and device in PDF document
US20190294399A1 (en) * 2018-03-26 2019-09-26 Abc Fintech Co., Ltd. Method and device for parsing tables in pdf document
CN110399878A (en) * 2019-06-14 2019-11-01 南京火眼锐视信息科技有限公司 Table format restoration methods, computer-readable medium and computer

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
张远: "印刷体文档表格识别技术研究", 中国优秀硕士学位论文全文数据库 信息科技辑, no. 1, 15 January 2019 (2019-01-15) *
机器之心: "三篇论文,纵观深度学习在表格识别中的最新应用", Retrieved from the Internet <URL:www.bing.com> *

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113158987A (en) * 2021-05-19 2021-07-23 中国科学技术信息研究所 Table processing method, device, equipment and computer readable storage medium
CN113343815A (en) * 2021-05-31 2021-09-03 北森云计算有限公司 Method for identifying form in PDF (Portable document Format) and other format documents
CN113343815B (en) * 2021-05-31 2022-06-07 北森云计算有限公司 Method for identifying form in PDF (Portable document Format) and other format documents
CN113343658A (en) * 2021-07-01 2021-09-03 湖南四方天箭信息科技有限公司 PDF file information extraction method and device and computer equipment
CN113343658B (en) * 2021-07-01 2024-04-09 湖南四方天箭信息科技有限公司 PDF file information extraction method and device and computer equipment
CN116682130A (en) * 2022-02-22 2023-09-01 广联达科技股份有限公司 Method, device and equipment for extracting icon information and readable storage medium
CN116682130B (en) * 2022-02-22 2025-09-23 广联达科技股份有限公司 Method, device, equipment and readable storage medium for extracting image label information
CN115631503A (en) * 2022-09-08 2023-01-20 杭州新迪数字工程系统有限公司 A method and system for automatically extracting tabular data in two-dimensional drawings
CN115390853A (en) * 2022-09-14 2022-11-25 北京虎蜥信息技术有限公司 Structured analysis method, system, terminal and storage medium for multi-source process file
CN115471854A (en) * 2022-09-15 2022-12-13 云南电网有限责任公司信息中心 A form image defect correction and extraction method based on machine vision technology
CN116719459A (en) * 2022-09-26 2023-09-08 荣耀终端有限公司 Display method of comment box, electronic device and readable storage medium
CN115512385A (en) * 2022-09-30 2022-12-23 中交第二航务工程局有限公司 Bitmap-format reinforcing steel drawing data extraction method and system
CN115512385B (en) * 2022-09-30 2024-09-27 中交第二航务工程局有限公司 Bitmap format steel bar drawing data extraction method and system
CN115759259A (en) * 2022-11-10 2023-03-07 电子科技大学中山学院 Form recognition method, device, electronic equipment and storage medium
CN115759259B (en) * 2022-11-10 2026-05-01 电子科技大学中山学院 A table recognition method, apparatus, electronic device, and storage medium
CN116086437A (en) * 2023-01-17 2023-05-09 智道网联科技(北京)有限公司 Method, device, electronic device and storage medium for generating lane line collection task frame
CN119759355A (en) * 2024-11-22 2025-04-04 杭州信公小安信息科技有限公司 A method for extracting and parsing tables in PDF
CN119759355B (en) * 2024-11-22 2025-09-02 杭州信公小安信息科技有限公司 A method for extracting and parsing tables in PDF

Similar Documents

Publication Publication Date Title
CN112668289A (en) Extraction method and device of nested table and storage medium
CN114004204B (en) Table structure reconstruction and text extraction method and system based on computer vision
US10691936B2 (en) Column inferencer based on generated border pieces and column borders
CN110516221B (en) Method, equipment and storage medium for extracting chart data in PDF document
CN113239818B (en) Table cross-modal information extraction method based on segmentation and graph convolution neural network
CN113051885B (en) AutoCAD-based design drawing rapid typesetting method
CN109697414B (en) Text positioning method and device
CN101876967A (en) Method for generating PDF text paragraphs
CN107943956A (en) Conversion of page method, apparatus and conversion of page equipment
CN111626145A (en) A simple and effective method for identifying incomplete forms and splicing across pages
US20250029367A1 (en) Component identification method and apparatus, electronic device, and storage medium
RU2430421C2 (en) Applying effects to merged text path
CN114863408A (en) Document content classification method, system, device, and computer-readable storage medium
CN112818655B (en) Excel data processing method and tool based on template and file additional writing
CN115588211A (en) Text image generation method and device, electronic equipment and storage medium
CN112084103B (en) Interface test method, device, equipment and medium
CN104992176B (en) A kind of Chinese character extracting method towards an inscription on a tablet
CN109426458A (en) A kind of Method of printing and device of relational graph
JP6377743B2 (en) Method and apparatus for building an intermediate character library
CN103839060B (en) Method and device for merging single character areas
CN112818894A (en) Method and device for identifying text box in PDF file, computer equipment and storage medium
CN112084364A (en) Object analysis method, local image search method, device, and storage medium
CN112767419A (en) Method and system for cutting nine-grid of atlas
CN118918262A (en) Point cloud data screening method, equipment and storage medium
CN118114636A (en) Drawing-based form data processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210416