Method for calculating row and column numbers of cells from graph representation of table structure

By inserting boundary and placeholder vertices into the graph representation of the table structure and calculating the number of separators of the vertices, the problem of lack of unified representation and handling complex situations in table structure recognition is solved, and accurate calculation of cell row and column numbers and effective conversion of table digitization is realized.

CN119692319APending Publication Date: 2025-03-25杨帆 +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311237137.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-25
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The existing technology lacks a unified definition and reasonable representation in the process of table structure identification and digitization, resulting in a variety of understanding and modeling methods of table structure and lack of consistency, making it difficult to effectively deal with complex situations such as vacancy, crossover, merger and frame breakage of cells in tables.

Method used

A method of calculating cell row and column numbers from the graph representation of a table structure is proposed. By connecting the boundary vertex to the left and rightmost side of the graph, inserting the placeholder vertex to handle cell vacancies, and counting the number of column separators for each vertex to determine the starting and ending column numbers, and then exchanging the row and column labels of the edges to calculate the row numbers.

Benefits of technology

It realizes the rational representation and processing of complex situations in the table structure, and can accurately calculate the start and end row and column numbers of cells, thereby effectively converting back to the original digitized form of the table structure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119692319A_ABST
    Figure CN119692319A_ABST
Patent Text Reader

Abstract

The invention discloses a method for calculating row and column numbers of cells from graph representation of a table structure, which is characterized by comprising the following steps of: accessing two boundary vertexes at the left side and the right side of a graph, and connecting the two boundary vertexes by row edges; searching row adjacent point pairs corresponding to the cell vacancies in the graph, inserting placeholder vertexes, and connecting the placeholder vertexes by using column and row edges; calculating the number of column secant lines of the cells corresponding to each vertex; calculating a starting column number and an ending column number of a cell corresponding to each vertex; and carrying out label exchange on the row and the column of the edge to change the row into the column and change the column into the row, and then repeatedly executing the steps to obtain the starting row number and the ending row number of the cell corresponding to each vertex. According to the method for converting the table structure diagram representation into the row and column numbers of the table cells, provided by the invention, under the conditions that the table cells in the table are merged in the row or column direction, the table cells are missing (such as the periodic table of elements), the table cells are crossed and the table frame lines are fractured, the table structure diagram representation is converted into the row and column numbers of the table cells; and the starting row number, the starting column number, the ending row number and the ending column number of each table cell of the table can be correctly calculated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the fields of computer science, pattern recognition, table recognition and discrete mathematics, and in particular to a method for calculating cell row and column numbers from a graph representation of a table structure. Background Art

[0002] Tables are common information carriers in life and work, used to organize, record, display, and disseminate various types of data, such as text, symbols, formulas, and images. Tables are used by a wide range of audiences, from students taking exams to workers in finance, academia, medicine, education, and other industries. For example, students fill in their answers in the table on the test paper, and the teacher corrects them; accountants enter the table from paper materials into the computer, and summarize, organize, and count the table data; scholars read the tables in the literature and understand the experimental methods and conclusions of the literature. These processes involve a lot of manual operations, which are tedious and error-prone. Therefore, we urgently hope to use pattern recognition and artificial intelligence technology to realize intelligent table understanding, which can automatically mark the test paper to assist in correction, recognize the table in the image and automatically enter it into the computer, analyze the data association and automatically organize and statistical data, and generate summary text to assist understanding.

[0003] To realize intelligent table understanding, two types of problems must be solved. The first type is to use computer vision methods to extract the original digital form of the table from the image, with the goal of printing the extracted results consistent with the image. The second type is to use natural language processing and understanding methods to interpret digital tables to obtain information that is easy for people to understand or highly organized, such as natural language descriptions, entities and entity relationships. The key to both types of technologies is the digital form of the table, but there is currently no consensus in this field on what is the optimal digital form. The reason is that there is no unified definition of the table itself. This can be seen from the chaotic status of the table structure recognition task. The table structure recognition task belongs to the first type of problem, which aims to recognize the two-dimensional organizational form of the table. However, existing studies have very different understandings and modeling methods of table structures. Some works use graphs to represent table structures, with the edges of the graph representing row-column relationships, and use graph neural networks to predict the connection relationships of vertices; some works use one-dimensional symbol sequences, such as markup languages, to represent table structures, and use sequence decoding networks to predict structure sequences; some works use sets of cell row and column numbers to represent, and use regression models to predict the row and column numbers of elements; and some works use the positions of cells or rows and columns in documents to represent, and use detection or segmentation models to locate cells or rows and columns. However, these works hastily modeled the problem with representations, but did not analyze the rationality of the representations: 1) Do instances of the representation domain correspond one-to-one to table instances, that is, is there an ambiguous situation where one table corresponds to multiple representations, or one representation corresponds to multiple tables? 2) Is the information exactly complete, that is, is there no redundant information or missing information? We call these two types of rationality one-to-one correspondence and information completeness, respectively.

[0004] In summary, it is necessary to provide a reasonable representation method for the case where there are rows or cells missing in the table (such as the periodic table, Figure 1 ), the case where cells intersect ( Figure 2 ), merging across columns or rows ( Figure 3 ) and table borders are broken ( Figure 4 ), can all be reasonably represented; and a method is invented to convert the representation back to the original digital form of the table structure, such as the starting row number, ending row number, starting column number and ending column number of each cell in the table. Summary of the invention

[0005] In view of this, in order to solve the above technical problems, the present invention provides a method for calculating the starting row number, ending row number, starting column number and ending column number of a cell from an optimal graph representation of a table structure.

[0006] A method for calculating the row and column numbers of cells from a graph representation of a table structure comprises the following steps:

[0007] Step 1: Add two boundary vertices on the left and right sides of the graph and connect them with edges.

[0008] Step 2, find the row-adjacent point pairs corresponding to the cell vacancies in the graph, insert the placeholder vertices, and connect the placeholder vertices with column and row edges, where the row-adjacent point pairs are the vertex pairs whose maximum row-edge distance is 1;

[0009] Step 3, calculate the number of column cuts of the cell corresponding to each vertex;

[0010] Step 4, calculate the starting column number and the ending column number of the cell corresponding to each vertex;

[0011] Step 5: Exchange the row and column labels of the edges and repeat the above steps to obtain the starting and ending row numbers of the cells corresponding to each vertex.

[0012] Specifically, the step of accessing two boundary vertices at the leftmost and rightmost sides of the graph and connecting them with row edges includes the following steps:

[0013] All graph vertices with zero in-degree in the graph are inserted into the first boundary vertex and connected to the row edge, the direction is indicated by the boundary vertex, and for all graph vertices with zero out-degree, the second boundary vertex is inserted and connected to the row edge, the direction is pointing to the boundary vertex.

[0014] Specifically, the step of finding row adjacent point pairs corresponding to cell vacancies in the graph, inserting placeholder vertices, and connecting the placeholder vertices with column edges includes the following steps:

[0015] Sort the vertices of the graph according to the row and column priority relationship, from top to bottom and from left to right, to obtain the sorted vertex sequence;

[0016] Traverse the rows of adjacent vertex pairs, and for each vertex pair:

[0017] ① Find the column double track and determine whether the adjacent point pairs in the current row correspond to the cell vacancy based on the track method;

[0018] ② If there is a vacancy, add a placeholder vertex, and based on the placeholder vertex connection rule, connect the current placeholder vertex with other vertices by column edges and row edges, where the direction of the column edge is indicated by the placeholder vertex.

[0019] Specifically, the vertices of the graph are sorted according to the row and column priority relationship in the order from top to bottom and from left to right, including the following steps:

[0020] Each time, select a vertex with zero in-degree, remove it from the graph and put it at the end of the sequence;

[0021] If there are multiple vertices with zero in-degree, the first-order and second-order row and column priorities are considered to determine which vertices should be removed from the graph first and placed at the end of the sequence;

[0022] If there are still vertices whose order cannot be compared after considering the priority, randomly select a vertex and put it at the end of the sequence or store all possible sorting results;

[0023] The first-order row-column priority means that if two vertices have a common parent (child) vertex, the vertex priority of the column edge connecting the parent (child) vertex is higher (lower) than the vertex connected by the row edge;

[0024] The second-order row and column priority means that if two vertices are the two endpoints of an undirected ring without considering the direction of the edge, and the two branches between the two vertices on the ring have only two intermediate nodes, and one branch satisfies the edge label order of "row-column-row", and the other satisfies the label order of "column-row-column", and when considering the direction, the direction of the middle edge of one branch is opposite to the direction of the middle edge of the other branch, then the vertex pointed to by the middle edge labeled "column" has a higher priority than the other vertex.

[0025] Specifically, the step of obtaining the column double track and determining whether the adjacent point pairs in the current row correspond to a cell vacancy based on the track method includes the following steps:

[0026] Find the column right track of the starting vertex and the column left track of the ending vertex of the adjacent point pair in the current row, and obtain the column double track of the adjacent point pair in this row;

[0027] Mark the first (last) point on the left (right) track of the sorted vertex sequence as an external point;

[0028] Points marked on the left (right) side of the left (right) track point and connected by a row edge are external points;

[0029] The points between adjacent left (right) track points in the marked vertex sequence and connected to the adjacent vertices by edges and pointing away from (toward) the point are external points;

[0030] The points between the adjacent left (right) track points in the marked vertex sequence and connected to the adjacent track points by edges, and the direction is away from (pointing to) the point, are called external points;

[0031] Mark the points in the vertex sequence that are between adjacent left (right) track points and connected to the external points in the previous step by a column edge as external points;

[0032] Remove all external points from the original graph to obtain the orbital subgraph, and find all the paths in the orbital subgraph to obtain all the point groups between the orbits;

[0033] The following judgment is made for each point group:

[0034] ① The longest distance between the leftmost point and the rightmost point of the point group is less than or equal to 1,

[0035] ② The maximum value of the sum of the in-degree and out-degree contributed by the orbital subgraph to each vertex in the point group is λ = max[Σ i∈K <d (i) in >,Σ i∈K <d (i) out >]≤λ 0 , where K is the total number of vertices in the current point group, i is the summation traversal index, indicating the i vertices, d (i) in represents the in-degree contributed by the i-th vertex from the orbital subgraph, d (i) out represents the out-degree of the i-th vertex, λ 0 represents the λ of the neighboring points of the current row to this point group, <x>=max(x,1)

[0036] If there is a point group that does not satisfy one of the above two conditions, it can be determined that there is a gap between the cells corresponding to the adjacent point pairs in the current previous row.

[0037] Specifically, the step of obtaining the column right track of the starting vertex and the column left track of the ending vertex of the adjacent point pair in the current row specifically includes the following steps:

[0038] Find all vertices that are connected to the starting (ending) vertex by columns, and extract these vertices from the sorted vertex sequence to form a subsequence of the sorted vertex sequence;

[0039] On the subsequence, follow the connection of the column edges, jump from back (front) to front (back) in sequence, and record the vertex jumped to each time, extract all the recorded vertices, and get the right (left) track of the column.

[0040] Specifically, the method of connecting the current placeholder vertex with other vertices with edges based on the placeholder vertex connection rule specifically includes the following steps:

[0041] Mark the first (last) point on the left (right) track of the sorted vertex sequence as an external point;

[0042] Points marked on the left (right) side of the left (right) track point and connected by a row edge are external points;

[0043] The points between adjacent left (right) track points in the marked vertex sequence and connected to the adjacent vertices by edges and pointing away from (toward) the point are external points;

[0044] The points between the adjacent left (right) track points in the marked vertex sequence and connected to the adjacent track points by edges, and the direction is away from (pointing to) the point, are called external points;

[0045] Mark the points in the vertex sequence that are between adjacent left (right) track points and connected to the external points in the previous step by a column edge as external points;

[0046] Extract the vertices other than the exclusion point and the orbit point in the graph to obtain the orbit inner point;

[0047] Connect all vertices in the track;

[0048] For points on the track, the following judgment is made:

[0049] ① There is another track whose track point is in the same column as this track point,

[0050] ② There is a point in the orbit in the same column as this point,

[0051] If one of the above conditions is met, the track point is connected;

[0052] Connect the edges from the starting vertex to the placeholder vertex;

[0053] Connect the rows of edges from the placeholder vertex to the starting vertex.

[0054] Specifically, the step of calculating the number of column cut lines of the cell corresponding to each vertex includes the following steps:

[0055] Traverse each vertex and perform the following operations on each vertex:

[0056] ① Find all vertices connected to the current vertex by columns;

[0057] ② Find the row-adjacent vertex pairs among these vertices;

[0058] ③ Pair vertex pairs;

[0059] ④ Traverse each pair of vertices, determine whether the two vertex pairs contribute repeated tangents, and finally obtain the number of non-repeated tangents of the current vertex;

[0060] ⑤ Among them, the criterion for judging whether the secant contributed by a pair of vertices is repeated is to determine whether the subgraph formed by the pair of vertices is consistent with the following three topological types (such as Fig.11 One of them is a graph isomorphism relationship:

[0061] a) O-type: The edges of the four vertices are connected in a way that forms an "O" shape, with two row edges and two column edges in the same direction.

[0062] b) Triangle: The edges of the three vertices are connected in a way that they form a triangle, two of which are row edges and pointed by the same vertex, and the other is a column edge.

[0063] c) Inverted triangle: The edges of the three vertices are connected in a way that forms a triangle, two of the edges are row edges and both point to the same vertex, and the other edge is a column edge.

[0064] If the graphs are isomorphic, then the secants contributed by two pairs of vertices to the current vertex are repeated.

[0065] Specifically, the calculation of the starting column number and the ending column number of the cell corresponding to each vertex includes the following steps:

[0066] Only keep the edges with the maximum distance between each vertex in the original graph being 1;

[0067] For each vertex, recursively calculate the total number of tangent lines of all preceding vertices along the column edges of the vertex, and combine the number of tangent lines of the current vertex to obtain the starting column number and ending column number of the current vertex. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 This is an example diagram of a cell vacancy situation;

[0069] Figure 2 This is an example diagram of a cell intersection situation;

[0070] Figure 3 This is an example diagram of cell merging;

[0071] Figure 4 This is an example of a situation where the table frame line is broken;

[0072] Figure 5 It is a schematic diagram of the definition of edge relations represented by the graph;

[0073] Figure 6 is an instance graph of the graph representation;

[0074] Figure 7 is a schematic diagram of the table's underlying grid;

[0075] Figure 8 It is a schematic diagram of the secant line;

[0076] Fig. 9 It is a flowchart of a method for calculating the row and column numbers of cells by representing the table structure in the present invention;

[0077] Fig.10 It is a diagram of row and column priority;

[0078] Fig.11 It is a topological display diagram. DETAILED DESCRIPTION

[0079] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0080] In order to better understand the technical content of this embodiment, the explanation of terms involved in this embodiment is first introduced.

[0081] Graph: A mathematical object in discrete mathematics, graph theory, and computer data structures, defined as a 4-tuple consisting of a set of vertices, a set of edges, a set of edge labels, and a set of vertex labels.

[0082] Graph isomorphism: The intuition of graph isomorphism is that by relabeling the vertices of graph G to make it exactly the same as graph G', then G and G' are isomorphic.

[0083] The in-degree of a vertex: the number of edges pointing to that vertex.

[0084] The out-degree of a vertex: the number of edges pointed out by the vertex.

[0085] Table: Any type of information, such as symbols, text, and images, arranged in two dimensions on a page according to a certain pattern.

[0086] Table border: A collection of straight lines that humans must use to distinguish each information unit when conceiving and drawing a table.

[0087] Table layout style: A description of the "appearance" of a table that has nothing to do with the actual content of the table, such as omitting a line segment of the border, filling the background of the cell with a color, scaling the entire table on the page, etc.

[0088] Table cell: The cell of the table border. The cell must be a rectangle with four sides: top, bottom, left, and right.

[0089] Table structure: The relative two-dimensional topological relationship of each cell in the table frame. It is a two-dimensional positional relationship in the sense of topological geometry. For the same table, changing the layout style of the table will not cause the table structure to change, that is, the layout style remains unchanged.

[0090] Graph representation of table structure: The graph representation in the present invention, also called Table Structure Graph (TSG), is a directed acyclic graph. A vertex of the graph corresponds to a cell of the table frame. There are two types of labels for the edges of the graph, namely "row" labels and "column" labels. The edges with row labels are called row edges, and the edges with column labels are called column edges. Figure 5 It shows how the edges are connected. If the horizontal / vertical projection directions of two cells overlap, the corresponding vertices are connected by row / column edges, and the direction of the edge is from the vertex corresponding to the left / top cell to the vertex corresponding to the right / bottom cell. Figure 6 Several examples of actual tables are shown, along with corresponding graphical representation examples.

[0091] The basic grid of the table: The basic grid of the table is also called the table grid, or simply the grid. Figure 7 As shown, all line segments of the table frame are extended to obtain a two-dimensional grid, and each extended line is numbered to obtain the basic grid of the table. Each extended line is also called a grid line.

[0092] The starting row number, ending row number, starting column number, and ending column number of a cell are the numbers of the grid lines on the top, bottom, left, and right sides of the cell. Figure 7 As shown, the starting row number, ending row number, starting column number, and ending column number of cell 2 are 4, 5, 2, and 4 respectively.

[0093] Row / column secants of cells: Figure 8 The two column cut lines of the "2023" cell are shown. The column cut line of a cell is defined as the part where the vertical grid line overlaps the cell area, such as Figure 5 Similarly, the row secant is the line segment where the horizontal grid line overlaps the cell area.

[0094] Cell vacancy: Figure 1 As shown, the cell gap is an area on the page where the table is located. If the area is "filled" with cells of the same "shape", the border of the entire table will be a rectangle with no gaps.

[0095] Boundary vertex: It is a virtual graph vertex that is temporarily added and is used to be added on both sides of the vertices corresponding to the cells on the left and right sides of the entire table.

[0096] Placeholder vertices: virtual graph vertices added temporarily to correspond to the vacancies of cells. The purpose of adding placeholder vertices is to "fill" the table into a regular rectangular table, so as to facilitate the subsequent calculation of the algorithm.

[0097] Vertex pair: An ordered pair of two vertices.

[0098] Row / column adjacent vertex pairs: After removing all row / column edges in the graph, if the longest distance between two vertices in the graph is 1, then the two vertices are adjacent column / row vertex pairs.

[0099] Implementation 1:

[0100] Fig. 9 A flow chart of Embodiment 1 of the present invention is shown. A method for calculating the row and column numbers of cells from a graph representation of a table structure comprises the following steps:

[0101] Step 1: Add two boundary vertices on the left and right sides of the graph and connect them with edges.

[0102] Step 2, find the row-adjacent point pairs corresponding to the cell vacancies in the graph, insert the placeholder vertices, and connect the placeholder vertices with column and row edges, where the row-adjacent point pairs are the vertex pairs whose maximum row-edge distance is 1;

[0103] Step 3, calculate the number of column cuts of the cell corresponding to each vertex;

[0104] Step 4, calculate the starting column number and the ending column number of the cell corresponding to each vertex;

[0105] Step 5: Exchange the row and column labels of the edges and repeat the above steps to obtain the starting and ending row numbers of the cells corresponding to each vertex.

[0106] The following example specifically illustrates how to calculate the row and column numbers of cells from a graphical representation of a table structure.

[0107] Execute step 1, add two boundary vertices on the left and right sides of the graph, and connect them with edges.

[0108] The step of accessing two boundary vertices at the leftmost and rightmost sides of the graph and connecting them with row edges includes the following steps:

[0109] All graph vertices with zero in-degree in the graph are inserted into the first boundary vertex and connected to the row edge, the direction is indicated by the boundary vertex, and for all graph vertices with zero out-degree, the second boundary vertex is inserted and connected to the row edge, the direction is pointing to the boundary vertex.

[0110] Execute step 2 to find the row-adjacent point pairs corresponding to the cell vacancies in the graph, insert the placeholder vertices, and connect the placeholder vertices with column and row edges, where the row-adjacent point pairs are the vertex pairs with the maximum row-edge distance of 1.

[0111] The method of finding row adjacent point pairs corresponding to cell vacancies in the graph, inserting placeholder vertices, and connecting the placeholder vertices with column edges includes the following steps:

[0112] Sort the vertices of the graph according to the row and column priority relationship, from top to bottom and from left to right, to obtain the sorted vertex sequence;

[0113] Traverse the rows of adjacent vertex pairs, and for each vertex pair:

[0114] ① Find the column double track and determine whether the adjacent point pairs in the current row correspond to the cell vacancy based on the track method;

[0115] ② If there is a vacancy, add a placeholder vertex, and based on the placeholder vertex connection rule, connect the current placeholder vertex with other vertices by column edges and row edges, where the direction of the column edge is indicated by the placeholder vertex.

[0116] The vertices of the graph are sorted according to the row and column priority relationship from top to bottom and from left to right, including the following steps:

[0117] Each time, select a vertex with zero in-degree, remove it from the graph and put it at the end of the sequence;

[0118] If there are multiple vertices with zero in-degree, the first-order and second-order row and column priorities are considered to determine which vertices should be removed from the graph first and placed at the end of the sequence;

[0119] If there are still vertices whose order cannot be compared after considering the priority, randomly select a vertex and put it at the end of the sequence or store all possible sorting results;

[0120] The first-order row priority, such as Fig.10 As shown, if two vertices have a common parent (child) vertex, the vertex connected to the parent (child) vertex by the column edge has a higher (lower) priority than the vertex connected by the row edge;

[0121] The second-order row priority is Fig.10 As shown, it means that if two vertices are the two endpoints of an undirected ring without considering the direction of the edge, and the two branches between the two vertices on the ring have only two intermediate nodes, and one branch satisfies the edge label order of "row-column-row", and the other satisfies the label order of "column-row-column", and when considering the direction, the direction of the middle edge of one branch is opposite to that of the middle edge of the other branch, then the vertex pointed to by the middle edge labeled "column" has a higher priority than the other vertex.

[0122] The method of obtaining the column double track and judging whether the adjacent point pairs in the current row correspond to the cell vacancy based on the track method includes the following steps:

[0123] Find the column right track of the starting vertex and the column left track of the ending vertex of the adjacent point pair in the current row, and obtain the column double track of the adjacent point pair in this row;

[0124] Mark the first (last) point on the left (right) track of the sorted vertex sequence as an external point;

[0125] Points marked on the left (right) side of the left (right) track point and connected by a row edge are external points;

[0126] The points between adjacent left (right) track points in the marked vertex sequence and connected to the adjacent vertices by edges and pointing away from (toward) the point are external points;

[0127] The points between the adjacent left (right) track points in the marked vertex sequence and connected to the adjacent track points by edges, and the direction is away from (pointing to) the point, are called external points;

[0128] Mark the points in the vertex sequence that are between adjacent left (right) track points and connected to the external points in the previous step by a column edge as external points;

[0129] Remove all external points from the original graph to obtain the orbital subgraph, and find all the paths in the orbital subgraph to obtain all the point groups between the orbits;

[0130] The following judgment is made for each point group:

[0131] ① The longest distance between the leftmost point and the rightmost point of the point group is less than or equal to 1,

[0132] ② The maximum value of the sum of the in-degree and out-degree contributed by the orbital subgraph to each vertex in the point group is λ = max[Σ i∈K <d (i) in >,Σ i∈K <d (i) out >]≤λ 0 , where K is the total number of vertices in the current point group, i is the summation traversal index, indicating the i vertices, d (i) in represents the in-degree contributed by the i-th vertex from the orbital subgraph, d (i) out represents the out-degree of the i-th vertex, λ 0 represents the λ of the neighboring points of the current row to this point group, <x>=max(x,1)

[0133] If there is a point group that does not satisfy one of the above two conditions, it can be determined that there is a gap between the cells corresponding to the adjacent point pairs in the current previous row.

[0134] The step of obtaining the column right track of the starting vertex and the column left track of the ending vertex of the adjacent point pair in the current row specifically includes the following steps:

[0135] Find all vertices that are connected to the starting (ending) vertex by columns, and extract these vertices from the sorted vertex sequence to form a subsequence of the sorted vertex sequence;

[0136] On the subsequence, follow the connection of the column edges, jump from back (front) to front (back) in sequence, and record the vertex jumped to each time, extract all the recorded vertices, and get the right (left) track of the column.

[0137] The method of connecting the current placeholder vertex with other vertices based on the placeholder vertex connection rule specifically includes the following steps:

[0138] Mark the first (last) point on the left (right) track of the sorted vertex sequence as an external point;

[0139] Points marked on the left (right) side of the left (right) track point and connected by a row edge are external points;

[0140] The points between adjacent left (right) track points in the marked vertex sequence and connected to the adjacent vertices by edges and pointing away from (toward) the point are external points;

[0141] The points between the adjacent left (right) track points in the marked vertex sequence and connected to the adjacent track points by edges, and the direction is away from (pointing to) the point, are called external points;

[0142] Mark the points in the vertex sequence that are between adjacent left (right) track points and connected to the external points in the previous step by a column edge as external points;

[0143] Extract the vertices other than the exclusion point and the orbit point in the graph to obtain the orbit inner point;

[0144] Connect all vertices in the track;

[0145] For points on the track, the following judgment is made:

[0146] ① There is another track whose track point is in the same column as this track point,

[0147] ② There is a point in the orbit in the same column as this point,

[0148] If one of the above conditions is met, the track point is connected;

[0149] Connect the edges from the starting vertex to the placeholder vertex;

[0150] Connect the rows of edges from the placeholder vertex to the starting vertex.

[0151] Execute step 3 to calculate the number of column cuts of the cell corresponding to each vertex. The specific steps include:

[0152] Traverse each vertex and perform the following operations on each vertex:

[0153] ① Find all vertices connected to the current vertex by columns;

[0154] ② Find the row-adjacent vertex pairs among these vertices;

[0155] ③ Pair vertex pairs;

[0156] ④ Traverse each pair of vertices, determine whether the two vertex pairs contribute repeated tangents, and finally obtain the number of non-repeated tangents of the current vertex;

[0157] ⑤ Among them, the criterion for judging whether the secant contributed by a pair of vertices is repeated is to determine whether the subgraph formed by the pair of vertices is consistent with the following three topological types (such as Fig.11 One of them is a graph isomorphism relationship:

[0158] a) O-type: The edges of the four vertices are connected in a way that forms an "O" shape, with two row edges and two column edges in the same direction.

[0159] b) Triangle: The edges of the three vertices are connected in a way that they form a triangle, two of which are row edges and pointed by the same vertex, and the other is a column edge.

[0160] c) Inverted triangle: The edges of the three vertices are connected in a way that forms a triangle, two of the edges are row edges and both point to the same vertex, and the other edge is a column edge.

[0161] If the graphs are isomorphic, then the secants contributed by two pairs of vertices to the current vertex are repeated.

[0162] Execute step 4 to calculate the starting column number and the ending column number of the cell corresponding to each vertex, including the following steps:

[0163] Only keep the edges with the maximum distance between each vertex in the original graph being 1;

[0164] For each vertex, recursively calculate the total number of tangent lines of all preceding vertices along the column edges of the vertex, and combine the number of tangent lines of the current vertex to obtain the starting column number and ending column number of the current vertex.

[0165] Execute step 5, swap the row and column labels of the edge, and repeat the above steps to obtain the starting and ending row numbers of the cell corresponding to each vertex;

[0166] Combining the above results, we can get the starting row number, ending row number, starting column number, and ending column number of each cell.

[0167] Implementation Method 2

[0168] The difference between this embodiment and embodiment 1 is that: the number of row and column secants of the cell corresponding to each vertex in the graph is calculated, and then the starting row number, ending row number, starting column number and ending column number of the cell corresponding to each vertex in the graph are calculated. The other contents are the same as those in embodiment 1 and will not be described in detail here.

[0169] The technical features or steps of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features or steps in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0170] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.< / x> < / x>

Claims

1. A method for calculating the row and column numbers of cells from a graphical representation of a table structure, characterized in that: The method comprises: A connects two boundary vertices on the left and right sides of the graph and connects them with row edges; B. Find the row-adjacent point pairs corresponding to the cell vacancies in the graph, insert the placeholder vertices, and connect the placeholder vertices with column and row edges; C calculates the number of column secants of the cell corresponding to each vertex; D. Calculate the starting column number and ending column number of the cell corresponding to each vertex; E swaps the row and column labels of the edges so that rows become columns and columns become rows, and then repeats AD to obtain the starting and ending row numbers of the cells corresponding to each vertex.

2. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 1, characterized in that: The A includes: Insert the graph vertex with zero in-degree into the first boundary vertex and connect the row edges in the direction indicated by the boundary vertex; Insert the graph vertex with zero out-degree into the second boundary vertex and connect the row edges, with the direction pointing to the boundary vertex.

3. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 1, characterized in that: The B includes: B1 sorts the vertices of the graph from top to bottom and from left to right according to the row and column priority relationship to obtain a sorted vertex sequence; B2 traverses the adjacent vertex pairs in the row and determines whether the adjacent vertex pairs in the current row correspond to vacant cells.

4. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 3, characterized in that: The B2 includes: Get the column right track of the starting vertex and the column left track of the ending vertex of the adjacent point pair in the current row, and get the column double track of the adjacent point pair in this row; Based on the orbit method, determine whether the adjacent point pairs in the current row correspond to cell vacancies; If there is a vacancy, add a placeholder vertex and connect the current placeholder vertex with other vertices with column edges and row edges.

5. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 4, characterized in that: The acquisition of the column right track of the starting vertex and the column left track of the ending vertex of the adjacent point pair in the current row includes: Find all vertices connected to the start / end vertex by columns and extract them from the sorted vertex sequence to form a subsequence of the sorted vertex sequence; In the subsequence, jump from back / front to front / back along the connection of the column edges, and record the vertex jumped to each time, extract all the recorded vertices, and get the right / left track of the column.

6. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 4, characterized in that: The method of judging whether the adjacent point pairs in the current row correspond to a cell vacancy based on the track method includes: Mark the external points of the left and right track points in the vertex sequence, remove the external points in the original graph, get the track subgraph, and get all the point groups between the tracks through all the paths in the track subgraph; Determine whether the longest distance between the leftmost and rightmost points of the point group is less than or equal to 1, and the maximum value λ of the sum of the in-degree and the sum of the out-degree contributed by the orbit subgraph to each vertex in the point group: λ=max[Σ i∈K <d (i) in >,S i∈K <d (i) out >]≤λ0 Among them, K is the total number of vertices in the current point group, i is the summation traversal index, and represents the i vertices, d (i) in represents the in-degree contributed by the i-th vertex from the orbital subgraph, d (i) out represents the out-degree of the i-th vertex, λ0 represents the λ of the adjacent points in the current row to this point group, <x> =max(x,1);< / x> If the longest distance between the leftmost and rightmost points of the point group is greater than 1 or the maximum value of the sum of the in-degree and the sum of the out-degree contributed by the track subgraph to each vertex in the point group is λ≥λ0, then it is determined that there is a gap between the cells corresponding to the adjacent point pairs in the current previous row.

7. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 1, characterized in that: The C specifically includes: C1 finds all vertices connected to the current vertex by column edges, finds row-adjacent vertex pairs among the vertices connected by column edges, and pairs them up; C2 traverses each vertex pair, determines whether the two vertex pairs correspond to repeated cut lines, and finally obtains the number of non-repeated cut lines of the current vertex.

8. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 7, characterized in that: In C2, the judgment of whether two vertex pairs contribute repeated secants includes: Determine whether the subgraph formed by the pair of vertices is isomorphic to one of the three topological types: O-type, triangle type, and inverted triangle type; If the graphs are isomorphic, the secants contributed by the two vertex pairs to the current vertex are repeated.

9. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 8, characterized in that: The O-shape is formed by connecting the edges of the four vertices in a "mouth" shape, with two row edges and two column edges in the same direction; the triangle-shape is formed by connecting the edges of the three vertices in a triangle, two edges are row edges and are pointed to the same vertex, and the other edge is a column edge; the inverted triangle-shape: the edges of the three vertices are connected in a triangle, two edges are row edges and both point to the same vertex, and the other edge is a column edge.

10. The method for calculating the row and column numbers of cells from the graphical representation of a table structure as claimed in claim 1, characterized in that: The D includes: Only keep the edges with the maximum distance between each vertex in the original graph being 1; For each vertex, recursively calculate the total number of tangent lines of all preceding vertices along the column edges of the vertex, and combine the number of tangent lines of the current vertex to obtain the starting number and ending column number of the current vertex.