Table content extraction and storage mode with merged cells
Through self-supervised learning model and tree structure technology, merged cells are identified and parsed, row and column title trees are generated, and storage is connected by weighted edges, the problem of inefficient extraction and storage of complex table data is solved, and efficient and accurate data is achieved Process and quick query.
Patent Information
- Application Number
- CN202411561936.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-11-05
AI Technical Summary
The prior art is difficult to effectively process and store tabular data with merged cells, especially when the standard specifications are not unified, traditional methods are difficult to accurately identify and parse complex merged cell structures, resulting in low data extraction and storage efficiency. Slow parsing accuracy and query speed.
Using a self-supervised learning model combined with regular expressions and tree structure technology, the row title tree and column title tree are generated by identifying the positions and properties of merged cells, and the graphical structure is established through the context consistency verification function, and weighted edge connection is used. Storage mechanism to achieve efficient data extraction and storage.
The analytical efficiency and accuracy of complex structure tables have been improved, the structure generation efficiency of more than 30% and the analytical accuracy of more than 99.8%, the data storage and query speed have been optimized, and the problems of misjudgment and omission in traditional methods have been solved.
Smart Images

Figure CN119067073A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cell technology, and in particular to a method for extracting and storing content of a table with merged cells. Background Art
[0002] As a representation of structured text, tables contain a large amount of useful information. If the information can be extracted, processed, and utilized, it will be of great help to users who need this information. In particular, tables with merged cells contain tree-like information, which is equivalent to built-in branching. Compared with ordinary tables, they are more useful and more convenient to handle ambiguity.
[0003] Current similar technical solutions don't address storage issues, only the extraction of such tables. Other similar technical solutions for extracting titles from merged cells fall into the following categories: extracting from a title library; extracting based on specific expression rules; and so on. Because the standard contains numerous titles and they don't necessarily conform to a unified expression rule, the above extraction methods don't meet the standard's requirements. Summary of the Invention
[0004] One purpose of the present invention is to provide a method for extracting and storing the content of a table with merged cells. The present invention can make more valuable use of the data in the table by extracting the table in the standard specification.
[0005] According to an embodiment of the present invention, a method for extracting and storing the content of a table with merged cells includes the following steps: S1. extracting table titles and table contents from a standard table using a regular expression matching method, identifying the extracted table titles as title nodes and performing preliminary storage, and storing the table contents in a two-dimensional array format; S2. Use the numerical content of each cell in the table content array as the cell value and define the cell properties; S3. Using a self-supervised learning model to identify the locations of merged cells in a standard table, counting the row and column locations where the merged cells first appear, determining the number of rows and columns occupied by the table title area, and generating a tree structure of row and column titles based on the table title area; S4. In the generated row header tree structure, based on the multi-layer nodes identified in the row header area in step S3, the parent-child relationship in the row header area is stored as an ordered list of the row header tree structure, and the parent-child relationship between each node is marked as a connection relationship between the parent node and the child node; In the generated column title tree structure, based on the multi-layer nodes identified in the column title area in step S3, the parent-child relationship in the column title area is stored as an ordered list of the column title tree structure, and the parent-child relationship between each node is marked as a connection relationship between the parent node and the child node; S5. Based on the multi-layer parent-child relationship between the row and column header tree structures, the context consistency relationship is verified using a self-supervised model. By traversing the table body content, edge connections are generated one by one connecting the row and column header nodes according to the corresponding row and column header nodes. S6. Building a complete graph structure including a row header tree and a column header tree based on the edge connection structure generated in step S5, and using the leaf node list of the row header tree structure and the leaf node list of the column header tree structure as the row and column dimensions of the final graph structure, respectively; S7. Storing the generated graphic structure in a data storage system as a graphic table structure containing merged cell information.
[0006] Optionally, the S1 includes the following steps: S11. Based on the standard table content, use a regular expression to match the table title and table content. The regular expression includes two groups: the first group is used to extract the table title content and mark it as a title node; the second group is used to extract the specific data area of the table content; S12: Identify the table title extracted in step S11 as a title node , and write the title node into the storage area in the form of a preliminary storage structure, the title node Represents the top-level information of the table content and provides the initial node identifier for the hierarchical storage of table data; S13, the table content extracted in step S11 is passed through a two-dimensional array For storage, each cell of the two-dimensional array Represents a single cell in the table's contents.
[0007] Optionally, the S2 includes the following steps: S21. For two-dimensional arrays , each cell Extract the numeric content as cell value , cell value Indicates the specific data value at position i, j in the table content; S22. Define and assign cells Three attribute identifiers are used to determine the specific position relationship of the cell in the table structure, including the cell value , whether it is the same as the previous row of cells Merged logo And whether it is the same as the previous column cell Merged logo ; S23. Based on the attributes defined by the cell, merge the rows of each cell into a marker Set to logical value: When the cell With the previous row of cells When the content is the same or in a merged state, ,otherwise, ; S24. Merge the columns of each cell based on the attributes defined by the cell Set to a logical value; When the cell With the previous column of cells When the content is the same or in a merged state, ,otherwise, ; S25, according to the merge identification attribute of step S23 and step S24, the two-dimensional array Update and store the data, including the value of each cell and the row and column merge identifiers.
[0008] Optionally, S3 includes the following steps: S31. Using self-supervised learning model to learn two-dimensional arrays Each cell in Identify merged cells, determine if there are merged cells, and count the row positions where the merged cells first appear. and column position ; S32: Determine the boundary range of the table title area based on the merged cell position, and count the actual number of rows in the table title area based on the merged relationship between the row position and the column position as the starting point. and the actual number of columns ; S33, in the two-dimensional array according to the boundary range of the table title area Internally generated row header tree structure and column header tree structure and , and establish the parent-child relationship of multi-level nodes in the tree structure. The row header tree structure contains the hierarchical relationship of each row header node: ; ; in, Represents a tree structure of row headers generated from left to right, consisting of nodes To Node The order of nodes; Represents a tree structure of column headers generated from top to bottom, including nodes To Node The order of nodes; S34, hierarchical identification of multiple nodes in the row title tree structure and the column title tree structure, where each level of node represents different levels of information in the table title area, and the hierarchical relationship between the multiple row and column titles in the tree structure is stored; S35. Store the tree structure of step S34 as a node list of row headers and column headers.
[0009] Optionally, the S4 includes the following steps: S41. In the generated row header tree structure In the example, the parent-child relationship in the row header area is stored as an ordered list of the row header tree structure based on the multi-layer nodes identified in the row header area in S3. , and mark the parent-child relationship between each node as the connection relationship between the parent node and the child node; For each cell in the row header area Build the corresponding node , merge identifiers based on the cell rows Define the parent node for: ; in, Represents the node in the previous row of the same column. When the current node is not merged with the cell in the previous row, the parent node is the node in the same column in the previous row. ,when When the current node is merged with the cell in the previous row, the parent node inherits from the parent node of the node in the previous row. ; Build an ordered list of all nodes and their parent-child relationships: ; Each cell Indicates the parent-child connection relationship in the row header tree structure; S42. In the generated column header tree structure In step S3, the parent-child relationship in the column header area is stored as an ordered list of the column header tree structure according to the multi-layer node identified in the column header area. , and mark the parent-child relationship between each node as the connection relationship between the parent node and the child node; For each cell in the column header area Build the corresponding node , merge identifiers based on the cell columns , define the parent node for: ; in, Represents the node in the previous column of the same row. When the current node is not merged with the previous column of cells, the parent node is the node in the previous column of the same row. ,when When the current node is merged with the previous column cell, the parent node inherits the parent node of the previous column node. ; Build an ordered list of all nodes and their parent-child relationships: ; Each cell Indicates the parent-child connection relationship in the column header tree structure.
[0010] Optionally, the S5 includes the following steps: S51, based on the row header tree structure and column header tree structure The multi-layer parent-child relationship is verified by the self-supervisory model to ensure the semantic consistency of the connection relationship between each row header node and column header node; S52, traverse the table content, according to the table content cell The row and column labels of the corresponding row header nodes are found and column header nodes , and use it as a candidate node; S53. For each cell Generate row header nodes Node with column headers Edge connections between ,Edge connections represent the association relationship between row header nodes and column header nodes; S54. Define edge connections The context conditions include the hierarchical relationship between the row header node and the column header node, as well as the parent-child node relationship between the row and column nodes, which are recorded as: ; Among them, when When , the row header node and the column header node share the same parent node, thus maintaining context consistency in the edge connection; S55, connect all edges generated in step S54 Edge connection structure stored as a table ,Each edge connection represents a parent-child relationship between a row header node and a column header node.
[0011] Optionally, the S6 includes the following steps: S61, based on edge connection structure Structure the row headers into a tree and column header tree structure The leaf node list is used as the row and column dimensions of the final graph structure to build a complete graph structure including the row header tree and the column header tree : ; in, and Leaf nodes representing row and column headers respectively; is the weight between row nodes and column nodes, Represents the context consistency check function; S62. Extract row header tree structure All leaf nodes form a row leaf node list , extract the column header tree structure All leaf nodes form a list of leaf nodes ; S63. Construct a complete table graph structure based on the row leaf node list and column leaf node list , the tabular graph structure includes all edge connections , which represents the complete mapping relationship between row leaf nodes and column leaf nodes: ; in, Each element in Represents the connection edges between the leaf nodes of the row header tree and the column header tree. In the final graph structure, the parent-child relationship of the row and column dimensions is complete and semantically consistent.
[0012] The beneficial effects of the present invention are: (1) The present invention uses a self-supervised learning model to accurately identify the position and attributes of merged cells, and realizes the efficient generation of row header trees and column header trees by automatically extracting the hierarchical relationship in the table. Compared with the traditional extraction method that relies on fixed rules, the model of the present invention can adaptively adjust the recognition strategy according to the characteristics of different table data to ensure that the merge relationship in complex structure tables is accurately captured. In the process of parsing multi-level merged cells, traditional methods are prone to misjudgment or omission, while the self-supervised model adopted by the present invention can dynamically parse the multi-level parent-child relationship of row and column headers, thereby improving the structure generation efficiency by more than 30%. At the same time, the parsing accuracy in multidimensional data tables reaches more than 99.8%.
[0013] (2) The present invention ensures that the connection edges between row and column headers are semantically consistent by constructing the leaf nodes of the table title tree as row and column dimensions in a graph structure and combining it with a context consistency check function. Traditional table parsing methods have difficulty in handling semantic ambiguity between cross-level headers, while the present invention achieves significant improvement in semantic consistency in complex tables with multiple rows and columns by defining and optimizing the context and hierarchical relationships between nodes.
[0014] (3) The present invention introduces a weighted edge connection storage mechanism into the graph structure, which makes data storage more efficient by weighting the association relationship between row and column nodes. Compared with the traditional linear table storage method, the edge connection structure of the present invention not only optimizes the relationship storage between nodes but also supports fast query and retrieval based on weights. When processing complex tables containing a large amount of data, the query time complexity of the traditional method is relatively high, while the present invention achieves an improvement in data query speed through the weighted edge connection structure. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings: Figure 1 This is a flow chart of a method for extracting and storing the content of a table with merged cells proposed by the present invention. DETAILED DESCRIPTION
[0016] The present invention will now be described in further detail with reference to the accompanying drawings, which are simplified schematic diagrams that illustrate the basic structure of the present invention in a schematic manner.
[0017] refer to Figure 1 , a method for extracting and storing the content of a table with merged cells, comprising the following steps: S1. extracting table titles and table contents from a standard table using a regular expression matching method, identifying the extracted table titles as title nodes and performing preliminary storage, and storing the table contents in a two-dimensional array format; S2. Use the numerical content of each cell in the table content array as the cell value and define the cell properties; S3. Using a self-supervised learning model to identify the locations of merged cells in a standard table, counting the row and column locations where the merged cells first appear, determining the number of rows and columns occupied by the table title area, and generating a tree structure of row and column titles based on the table title area; S4. In the generated row header tree structure, based on the multi-layer nodes identified in the row header area in step S3, the parent-child relationship in the row header area is stored as an ordered list of the row header tree structure, and the parent-child relationship between each node is marked as a connection relationship between the parent node and the child node; In the generated column title tree structure, based on the multi-layer nodes identified in the column title area in step S3, the parent-child relationship in the column title area is stored as an ordered list of the column title tree structure, and the parent-child relationship between each node is marked as a connection relationship between the parent node and the child node; S5. Based on the multi-layer parent-child relationship between the row and column header tree structures, the context consistency relationship is verified using a self-supervised model. By traversing the table body content, edge connections are generated one by one connecting the row and column header nodes according to the corresponding row and column header nodes. S6. Building a complete graph structure including a row header tree and a column header tree based on the edge connection structure generated in step S5, and using the leaf node list of the row header tree structure and the leaf node list of the column header tree structure as the row and column dimensions of the final graph structure, respectively; S7. Storing the generated graphic structure in a data storage system as a graphic table structure containing merged cell information.
[0018] In this embodiment, S1 includes the following steps: S11. Based on the standard table content, use a regular expression to match the table title and table content. The regular expression includes two groups: the first group is used to extract the table title content and mark it as a title node; the second group is used to extract the specific data area of the table content; S12: Identify the table title extracted in step S11 as a title node , and write the title node into the storage area in the form of a preliminary storage structure, the title node Represents the top-level information of the table content and provides the initial node identifier for the hierarchical storage of table data; S13, the table content extracted in step S11 is passed through a two-dimensional array For storage, each cell of the two-dimensional array Represents a single cell in the table's contents.
[0019] In this embodiment, S2 includes the following steps: S21. For two-dimensional arrays , each cell Extract the numeric content as cell value , cell value Indicates the specific data value at position i, j in the table content; S22. Define and assign cells Three attribute identifiers are used to determine the specific position relationship of the cell in the table structure, including the cell value , whether it is the same as the previous row of cells Merged logo And whether it is the same as the previous column cell Merged logo ; S23. Based on the attributes defined by the cell, merge the rows of each cell into a marker Set to logical value: When the cell With the previous row of cells When the content is the same or in a merged state, ,otherwise, ; S24. Merge the columns of each cell based on the attributes defined by the cell Set to a logical value; When the cell With the previous column of cells When the content is the same or in a merged state, ,otherwise, ; S25, according to the merge identification attribute of step S23 and step S24, the two-dimensional array Update and store the data, including the value of each cell and the row and column merge identifiers.
[0020] In this embodiment, S3 includes the following steps: S31. Using self-supervised learning model to learn two-dimensional arrays Each cell in Identify merged cells, determine if there are merged cells, and count the row positions where the merged cells first appear. and column position ; S32: Determine the boundary range of the table title area based on the merged cell position, and count the actual number of rows in the table title area based on the merged relationship between the row position and the column position as the starting point. and the actual number of columns ; S33, in the two-dimensional array according to the boundary range of the table title area Internally generated row header tree structure and column header tree structure and , and establish the parent-child relationship of multi-level nodes in the tree structure. The row header tree structure contains the hierarchical relationship of each row header node: ; ; in, Represents a tree structure of row headers generated from left to right, consisting of nodes To Node The order of nodes; Represents a tree structure of column headers generated from top to bottom, including nodes To Node The order of nodes; S34, hierarchical identification of multiple nodes in the row title tree structure and the column title tree structure, where each level of node represents different levels of information in the table title area, and the hierarchical relationship between the multiple row and column titles in the tree structure is stored; S35. Store the tree structure of step S34 as a node list of row headers and column headers.
[0021] In this embodiment, S4 includes the following steps: S41. In the generated row header tree structure In the example, the parent-child relationship in the row header area is stored as an ordered list of the row header tree structure based on the multi-layer nodes identified in the row header area in S3. , and mark the parent-child relationship between each node as the connection relationship between the parent node and the child node; For each cell in the row header area Build the corresponding node , merge identifiers based on the cell rows Define the parent node for: ; in, Represents the node in the previous row of the same column. When the current node is not merged with the cell in the previous row, the parent node is the node in the same column in the previous row. ,when When the current node is merged with the cell in the previous row, the parent node inherits from the parent node of the node in the previous row. ; Build an ordered list of all nodes and their parent-child relationships: ; Each cell Indicates the parent-child connection relationship in the row header tree structure; S42. In the generated column header tree structure In step S3, the parent-child relationship in the column header area is stored as an ordered list of the column header tree structure according to the multi-layer node identified in the column header area. , and mark the parent-child relationship between each node as the connection relationship between the parent node and the child node; For each cell in the column header area Build the corresponding node , merge identifiers based on the cell columns , define the parent node for: ; in, Represents the node in the previous column of the same row. When the current node is not merged with the previous column of cells, the parent node is the node in the previous column of the same row. ,when When the current node is merged with the previous column cell, the parent node inherits the parent node of the previous column node. ; Build an ordered list of all nodes and their parent-child relationships: ; Each cell Indicates the parent-child connection relationship in the column header tree structure.
[0022] In this embodiment, S5 includes the following steps: S51, based on the row header tree structure and column header tree structure The multi-layer parent-child relationship is verified by the self-supervisory model to ensure the semantic consistency of the connection relationship between each row header node and column header node; S52, traverse the table content, according to the table content cell The row and column labels of the corresponding row header nodes are found and column header nodes , and use it as a candidate node; S53. For each cell Generate row header nodes Node with column headers Edge connections between ,Edge connections represent the association relationship between row header nodes and column header nodes; S54. Define edge connections The context conditions include the hierarchical relationship between the row header node and the column header node, as well as the parent-child node relationship between the row and column nodes, which are recorded as: ; Among them, when When , the row header node and the column header node share the same parent node, thus maintaining context consistency in the edge connection; S55, connect all edges generated in step S54 Edge connection structure stored as a table ,Each edge connection represents a parent-child relationship between a row header node and a column header node.
[0023] In this embodiment, S6 includes the following steps: S61, based on edge connection structure Structure the row headers into a tree and column header tree structure The leaf node list is used as the row and column dimensions of the final graph structure to build a complete graph structure including the row header tree and the column header tree : ; in, and Leaf nodes representing row and column headers respectively; is the weight between row nodes and column nodes, Represents the context consistency check function; S62. Extract row header tree structure All leaf nodes form a row leaf node list , extract the column header tree structure All leaf nodes form a list of leaf nodes ; S63. Construct a complete table graph structure based on the row leaf node list and column leaf node list , the tabular graph structure includes all edge connections , which represents the complete mapping relationship between row leaf nodes and column leaf nodes: ; in, Each element in Represents the connection edges between the leaf nodes of the row header tree and the column header tree. In the final graph structure, the parent-child relationship of the row and column dimensions is complete and semantically consistent.
[0024] Example 1: In an infrastructure project, construction companies need to standardize the management of various construction processes and present these management specifications in a table format in a construction manual. Tables contain a large amount of merged cell information, which is used to represent quality standards under different construction conditions, such as the different construction requirements for "expressways, first-class highways" and "second-class and lower-class highways." This table data not only needs to be recorded in the project management system but also needs to be extracted, parsed, and stored as searchable structured data. However, traditional table parsing methods cannot accurately identify these complex merged cell structures, resulting in difficult data extraction and information loss during storage.
[0025] To solve this problem, the present invention uses a self-supervisory model and tree structure parsing technology to efficiently extract and store complex tables in construction specifications to ensure data integrity and availability.
[0026] The construction company needs to parse a table titled "Panel prefabrication and installation construction quality standards," where the construction standards under different conditions are presented in the form of merged cells. The following is the application process of the present invention in this scenario: Use regular expressions to match the table title "Panel prefabrication, installation and construction quality standards" and the table content, identify the table title as a title node and store it, and store the table content as a two-dimensional array.
[0027] Each cell in the table's contents is extracted as a cell value. For example, the value of the cell in the 4th row, 1st column is "Roadbed," and its attribute is "(Roadbed, true, false)," indicating that it is merged with the previous row but not the previous column. Similarly, the value of the cell in the 2nd row, 3rd column is "Expressway, First-Class Highway," and its attribute is "(Expressway, First-Class Highway, false, false)."
[0028] When generating the tree structure for row and column headings, the number of rows and columns occupied by the heading area is calculated based on the position of merged cells. For this table, the row headings are parsed as "[Expressway, First-Class Highway, Second-Class and Below Highways]"; the column headings are "[Light, Medium, and Heavy Traffic, Extra Heavy, Extremely Heavy Traffic, Upper Embankment, Lower Embankment, Ground Replacement]."
[0029] The parent-child relationship of each title node is marked by the upper and lower hierarchical relationships in the tree structure to ensure that the hierarchical information will not be lost during subsequent storage.
[0030] The traversal of the table body starts from depth 1 of the row header tree and depth 2 of the column header tree. The self-supervised model verifies the contextual consistency between the row header and column header nodes corresponding to each cell and generates edge connections between row and column nodes to ensure the accuracy of data relationships.
[0031] All generated edge connections are stored as part of the graph structure, and the connection relationship of all nodes is verified based on the weight and context consistency function. The leaf nodes of the final graph structure are "[Expressway, Class I Highway, Class II and below Highway]" and "[Light, Medium and Heavy Traffic, Extra Heavy, Extreme Heavy Traffic, Upper Embankment, Lower Embankment, Foundation Replacement]".
[0032] The present invention outperforms traditional methods in both parsing speed and accuracy. Through the application of self-supervisory models, it reduces errors in table parsing and achieves significant advantages in cross-level title parsing. In terms of query response time for large-scale data, the weighted edge connection structure of the present invention also shows obvious superiority.
[0033] The present invention uses a self-supervised learning model to accurately identify the position and attributes of merged cells, and realizes the efficient generation of row header trees and column header trees by automatically extracting the hierarchical relationship in the table. Compared with the traditional extraction method that relies on fixed rules, the model of the present invention can adaptively adjust the recognition strategy according to the characteristics of different table data to ensure that the merge relationship in complex structure tables is accurately captured. In the process of parsing multi-level merged cells, traditional methods are prone to misjudgment or omission. The self-supervised model adopted by the present invention can dynamically parse the multi-level parent-child relationship of row and column headers, thereby improving the structure generation efficiency by more than 30%. At the same time, the parsing accuracy in multidimensional data tables reaches more than 99.8%.
[0034] The present invention ensures that the connecting edges between row and column headers are semantically consistent by constructing the leaf nodes of the table title tree as row and column dimensions in a graph structure and combining it with a context consistency verification function. Traditional table parsing methods have difficulty handling semantic ambiguity between cross-level headers, while the present invention achieves significant improvement in semantic consistency in complex tables with multiple rows and columns by defining and optimizing the context and hierarchical relationships between nodes.
[0035] The present invention introduces a weighted edge connection storage mechanism into the graph structure, making data storage more efficient by weighting the association relationship between row and column nodes. Compared with the traditional linear table storage method, the edge connection structure of the present invention not only optimizes the relationship storage between nodes but also supports fast query and retrieval based on weights. When processing complex tables containing large amounts of data, the query time complexity of traditional methods is relatively high, while the present invention achieves an improvement in data query speed through the weighted edge connection structure.
[0036] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A method for extracting and storing the contents of a table with merged cells, characterized in that: The steps include: S1. Using a regular expression matching method to extract table titles and table contents in a standard table, identifying the extracted table titles as title nodes and performing preliminary storage, and storing the table contents in a two-dimensional array form; S2. Use the numerical content of each cell in the table content array as the cell value and define the cell attributes; S3. Use a self-supervised learning model to identify the position of merged cells in the standard table, count the row and column positions where the merged cells appear for the first time, determine the number of rows and columns occupied by the table title area, and generate a tree structure of row and column titles based on the table title area; S4, in the generated row title tree structure, according to the multi-layer nodes identified in the row title area in step S3, the parent-child relationship in the row title area is stored as an ordered list of the row title tree structure, and the parent-child relationship between each node is marked as a connection relationship between the parent node and the child node; In the generated column title tree structure, according to the multi-layer nodes identified in the column title area in step S3, the parent-child relationship in the column title area is stored as an ordered list of the column title tree structure, and the parent-child relationship between each node is marked as a connection relationship between the parent node and the child node; S5. Based on the multi-layer parent-child relationship between the row header tree structure and the column header tree structure, the context consistency relationship is verified by a self-supervisory model. By traversing the table text content, edge connections connecting the row header nodes and the column header nodes are generated one by one according to the row header nodes and the column header nodes corresponding to their positions. S6, building a complete graph structure including a row header tree and a column header tree based on the edge connection structure generated in step S5, and using the leaf node list of the row header tree structure and the leaf node list of the column header tree structure as the row and column dimensions of the final graph structure respectively; S7. Storing the generated graphic structure in a data storage system as a graphic table structure containing merged cell information.
2. A method for extracting and storing the contents of a table with merged cells according to claim 1, characterized in that: The S1 comprises the following steps: S11. Based on the standard table content, a regular expression is used to match the table title and the table content. The regular expression includes two groups: the first group is used to extract the table title content and mark it as a title node; the second group is used to extract the specific data area of the table content; S12: Identify the table title extracted in step S11 as a title node , and write the title node into the storage area in the form of a preliminary storage structure, the title node Represents the top-level information of the table content and provides the initial node identifier for the hierarchical storage of the table data; S13, the table content extracted in step S11 is transmitted through a two-dimensional array For storage, each cell of the two-dimensional array Represents a single cell in the table content.
3. A method for extracting and storing the contents of a table with merged cells according to claim 1, characterized in that: The S2 comprises the following steps: S21. For two-dimensional arrays , each cell Extract the numeric content of the cell as the value , cell value Indicates the specific data value of the table content at position i, j; S22. Define and assign cells Three attribute identifiers are used to determine the specific position relationship of the cell in the table structure, including the cell value , whether it is the same as the previous row of cells Merged Logo And whether it is the same as the previous column cell Merged Logo ; S23. Based on the attributes defined by the cell, merge the rows of each cell into a marker Set to logical value: When the cell Same as the previous row of cells When the content is the same or in a merged state, ,otherwise, ; S24. Merge the columns of each cell based on the attributes defined by the cell Set to logical value; When the cell Same as the previous column cell When the content is the same or in a merged state, ,otherwise, ; S25, according to the merged identification attribute of step S23 and step S24, the two-dimensional array Update and store the data, including the value of each cell and the row and column merge identifiers.
4. A method for extracting and storing the contents of a table with merged cells according to claim 1, characterized in that: The S3 comprises the following steps: S31. Using self-supervised learning model to learn two-dimensional arrays Each cell in Identify merged positions, determine whether there are merged cells, and count the row positions where the merged cells first appear and column position ; S32: Determine the boundary range of the table title area based on the merged cell position, and count the actual number of rows in the table title area based on the merged relationship between the row position and the column position as the starting point. and the actual number of columns ; S33, in the two-dimensional array according to the boundary range of the table title area Internally generated row header tree structure and column header tree structure and , and establish the parent-child relationship of multi-level nodes in the tree structure. The row header tree structure contains the hierarchical relationship of each row header node: ; ; in, Represents a tree structure of row headers generated from left to right, consisting of nodes To Node The node order of Represents a tree structure of column headers generated from top to bottom, consisting of nodes To Node The node order of S34, performing hierarchical identification of multi-level nodes on the row title tree structure and the column title tree structure, wherein each level of nodes represents different levels of information in the table title area, and storing the hierarchical relationship between the multi-row and multi-column titles in the tree structure; S35. Store the tree structure of step S34 as a node list of row headers and column headers.
5. A method for extracting and storing the contents of a table with merged cells according to claim 1, characterized in that: The S4 comprises the following steps: S41. In the generated row header tree structure In the example, the parent-child relationship in the row header area is stored as an ordered list of the row header tree structure according to the multi-layer nodes identified in the row header area in S3. , and mark the parent-child relationship between each node as the connection relationship between the parent node and the child node; For each cell in the row header area Build the corresponding node , merge identifiers according to the cell rows Define the parent node for: ; in, Represents the node in the same column and the previous row. When the current node is not merged with the cell in the previous row, the parent node is the node in the same column in the previous row. ,when When the current node is merged with the cell in the previous row, the parent node inherits from the parent node of the node in the previous row. ; Build an ordered list of all nodes and their parent-child relationships: ; Each cell Indicates the parent-child connection relationship in the row header tree structure. is the actual number of rows, is the actual number of columns; S42. In the generated column header tree structure In step S3, the parent-child relationship in the column header area is stored as an ordered list of the column header tree structure according to the multi-layer node identified in the column header area in step S3. , and mark the parent-child relationship between each node as the connection relationship between the parent node and the child node; For each cell in the column header area Build the corresponding node , merge identifiers according to the cell columns , define the parent node for: ; in, Represents the node in the previous column of the same row. When the current node is not merged with the previous column of cells, the parent node is the node in the previous column of the same row. ,when When the current node is merged with the cell in the previous column, the parent node inherits the parent node of the node in the previous column. ; Build an ordered list of all nodes and their parent-child relationships: ; Each cell Represents the parent-child connection relationship in the column header tree structure.
6. A method for extracting and storing content of a table with merged cells according to claim 1, characterized in that: The S5 comprises the following steps: S51, based on the row header tree structure and column header tree structure The multi-layer parent-child relationship is verified by using a self-supervisory model to verify the context consistency relationship, so that the semantic consistency between each row header node and column header node in the connection relationship is achieved; S52, traverse the table content, according to the table content cell The row and column labels of the and column header nodes , and use it as a candidate node; S53. For each cell Generate row header nodes Node with column headers The edge connection between ,The edge connection represents the association relationship between the row header node and the column header node; S54. Define edge connections The context conditions include the hierarchical relationship between the row header node and the column header node and the parent-child node relationship between the row and column nodes, which are recorded as: ; Among them, when , the row header nodes and column header nodes share the same parent node, thus maintaining contextual consistency in edge connections; S55, connect all the edges generated in step S54 Edge connection structure stored as a table , each edge connection represents a parent-child relationship between a row header node and a column header node.
7. A method for extracting and storing the contents of a table with merged cells according to claim 6, characterized in that: The S6 comprises the following steps: S61, based on edge connection structure The row header tree structure and column header tree structure The leaf node list is used as the row and column dimensions of the final graph structure to build a complete graph structure including the row header tree and the column header tree : ; in, and Leaf nodes representing row and column headers respectively; is the weight between row nodes and column nodes, Represents the context consistency check function; S62. Extract row header tree structure All leaf nodes form a row leaf node list , extract the column header tree structure All leaf nodes of the column form a list of leaf nodes ; S63. Construct a complete table graph structure based on the row leaf node list and column leaf node list , the tabular graph structure includes all edge connections , which represents the complete mapping relationship between row leaf nodes and column leaf nodes: ; in, Each element in Represents the connection edges between the leaf nodes of the row header tree and the column header tree. In the final graph structure, the parent-child relationship of the row and column dimensions is complete and semantically consistent.
Citation Information
Patent Citations
Method and system for outputting table document in paging mode through tree data
CN115438638A
Document tree automatic generation method and device for large model knowledge questions and answers
CN118551734A
Spreadsheet table transformation
EP4010813A1
Answering natural language table queries through semantic table representation
US20160267117A1
