A method for extracting and storing table content with merged cells

Through regular expressions and self-supervised learning models, merge cells, generate tree structures and build graphical tables, the problem of low efficiency of information extraction and storage of complex tables is solved, efficient and accurate information extraction and storage is achieved, and analysis is improved. Accuracy and query speed.

CN119067073BActive Publication Date: 2025-01-03ANHUI TRANSPORT CONSULTING & DESIGN INST
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411561936.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2025-01-03
Estimated Expiration
2044-11-05

AI Technical Summary

Technical Problem

The prior art is difficult to effectively extract and store information in tables with merged cells, especially when the standard specifications are not unified, traditional methods are difficult to accurately identify complex structures and process semantic ambiguity, resulting in low efficiency in information extraction and storage. Not very accurate.

Method used

Regular expression matching is used to extract table titles and contents, and use a self-supervised learning model to identify merged cell positions, generate tree structures of row titles and column titles, and build graph structures through multi-layer parent-child relationships and context consistency verification to store To graphical table structure, a weight-based edge connection mechanism is introduced.

Benefits of technology

It realizes accurate capture of merge relationships in complex tables, improves structure generation efficiency by more than 30%, and has a parsing accuracy of 99.8%, and optimizes data storage and query speed, solving the problems of misjudgment and omissions in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067073B_ABST
    Figure CN119067073B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for extracting and storing table contents with merged cells, S1, extracting table titles and table contents in a standard table by using a regular expression matching method; S2, defining cell attributes; S3, generating a tree structure of row titles and column titles according to the table title area; S4, marking the parent-child relationship between each node as a connection relationship between a parent node and a child node; marking the parent-child relationship between each node as a connection relationship between a parent node and a child node; S5, generating edge connections connecting row title nodes and column title nodes one by one according to row title nodes and column title nodes corresponding to their positions; S6, using a leaf node list of a row title tree structure and a leaf node list of a column title tree structure as row and column dimensions of a final graphic structure respectively; S7, storing the generated graphic structure in a data storage system. The present invention can make more valuable use of the data in the table by extracting the table in the standard specification.
Need to check novelty before this filing date? Find Prior Art

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 lot of useful information. If the information can be extracted, processed and used, 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 easier to handle ambiguity.

[0003] At present, similar technical solutions do not involve storage issues, but only describe the extraction of such tables. On the other hand, other similar technical solutions extract titles from merged cells in the following ways: extract from the title library; extract according to specific expression rules, etc. Since there are many titles in the standard specification, and they do not necessarily conform to a relatively unified expression rule, the above extraction methods do not meet the scenario of the standard specification. Summary of the invention

[0004] One purpose of the present invention is to provide a method for extracting and storing the contents 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] A method for extracting and storing content of a table with merged cells according to an embodiment of the present invention includes the following steps:

[0006] 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;

[0007] S2. Use the numerical content of each cell in the table content array as the cell value and define the cell attributes;

[0008] 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;

[0009] 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;

[0010] 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;

[0011] S5. Based on the multi-layer parent-child relationship of 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.

[0012] 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;

[0013] S7. Storing the generated graphic structure in a data storage system as a graphic table structure containing merged cell information.

[0014] Optionally, the S1 includes the following steps:

[0015] 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;

[0016] 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;

[0017] 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.

[0018] Optionally, S2 includes the following steps:

[0019] 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;

[0020] 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 ;

[0021] S23. Based on the attributes defined by the cell, merge the rows of each cell into a marker Set to logical value:

[0022] When the cell Same as the previous row of cells When the content is the same or in a merged state, ,otherwise, ;

[0023] S24. Merge the columns of each cell based on the attributes defined by the cell Set to logical value;

[0024] When the cell With the previous column of cells When the content is the same or in a merged state, ,otherwise, ;

[0025] 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.

[0026] Optionally, S3 includes the following steps:

[0027] 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 ;

[0028] 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 ;

[0029] 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:

[0030] ;

[0031] ;

[0032] 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

[0033] 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;

[0034] S35. Store the tree structure of step S34 as a node list of row headers and column headers.

[0035] Optionally, S4 includes the following steps:

[0036] 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;

[0037] For each cell in the row header area Build the corresponding node , merge identifiers according to the cell rows Define the parent node for:

[0038] ;

[0039] 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. ;

[0040] Build an ordered list of all nodes and their parent-child relationships:

[0041] ;

[0042] Each cell Indicates the parent-child connection relationship in the row header tree structure;

[0043] 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;

[0044] For each cell in the column header area Build the corresponding node , merge identifiers according to the cell columns , define the parent node for:

[0045] ;

[0046] 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. ;

[0047] Build an ordered list of all nodes and their parent-child relationships:

[0048] ;

[0049] Each cell Represents the parent-child connection relationship in the column header tree structure.

[0050] Optionally, S5 includes the following steps:

[0051] 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;

[0052] 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;

[0053] 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;

[0054] 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:

[0055] ;

[0056] Among them, when , the row header nodes and column header nodes share the same parent node, thus maintaining contextual consistency in edge connections;

[0057] 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.

[0058] Optionally, the S6 includes the following steps:

[0059] 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 :

[0060] ;

[0061] 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;

[0062] 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 ;

[0063] 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:

[0064] ;

[0065] 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.

[0066] The beneficial effects of the present invention are:

[0067] (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 the complex structure table is accurately captured. In the process of parsing multi-level merged cells, the traditional method is prone to misjudgment or omission, while the self-supervised model used in 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%.

[0068] (2) The present invention constructs the leaf nodes of the table title tree as row and column dimensions in a graph structure and combines it with a context consistency check function to ensure that the connection edges between row titles and column titles are semantically consistent. Traditional table parsing methods are difficult to handle semantic ambiguity between cross-level titles. 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.

[0069] (3) The present invention introduces a weighted edge connection storage mechanism into the graph structure, and 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 storage of the relationship between nodes, but also supports weight-based fast query and retrieval. 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

[0070] 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:

[0071] Figure 1 The present invention provides a flowchart of a method for extracting and storing the contents of a table with merged cells. DETAILED DESCRIPTION

[0072] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0073] refer to Figure 1 , a method for extracting and storing the contents of a table with merged cells, comprising the following steps:

[0074] 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;

[0075] S2. Use the numerical content of each cell in the table content array as the cell value and define the cell attributes;

[0076] 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;

[0077] 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;

[0078] 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;

[0079] S5. Based on the multi-layer parent-child relationship of 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.

[0080] 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;

[0081] S7. Storing the generated graphic structure in a data storage system as a graphic table structure containing merged cell information.

[0082] In this implementation, S1 includes the following steps:

[0083] 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;

[0084] 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;

[0085] 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.

[0086] In this implementation, S2 includes the following steps:

[0087] 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;

[0088] 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 ;

[0089] S23. Based on the attributes defined by the cell, merge the rows of each cell into a marker Set to logical value:

[0090] When the cell Same as the previous row of cells When the content is the same or in a merged state, ,otherwise, ;

[0091] S24. Merge the columns of each cell based on the attributes defined by the cell Set to logical value;

[0092] When the cell With the previous column of cells When the content is the same or in a merged state, ,otherwise, ;

[0093] 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.

[0094] In this implementation, S3 includes the following steps:

[0095] 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 ;

[0096] 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 ;

[0097] 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:

[0098] ;

[0099] ;

[0100] 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

[0101] 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;

[0102] S35. Store the tree structure of step S34 as a node list of row headers and column headers.

[0103] In this implementation, S4 includes the following steps:

[0104] 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;

[0105] For each cell in the row header area Build the corresponding node , merge identifiers according to the cell rows Define the parent node for:

[0106] ;

[0107] 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. ;

[0108] Build an ordered list of all nodes and their parent-child relationships:

[0109] ;

[0110] Each cell Indicates the parent-child connection relationship in the row header tree structure;

[0111] 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;

[0112] For each cell in the column header area Build the corresponding node , merge identifiers according to the cell columns , define the parent node for:

[0113] ;

[0114] 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. ;

[0115] Build an ordered list of all nodes and their parent-child relationships:

[0116] ;

[0117] Each cell Represents the parent-child connection relationship in the column header tree structure.

[0118] In this implementation, S5 includes the following steps:

[0119] 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;

[0120] 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;

[0121] 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;

[0122] 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:

[0123] ;

[0124] Among them, when , the row header nodes and column header nodes share the same parent node, thus maintaining contextual consistency in edge connections;

[0125] 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.

[0126] In this implementation, S6 includes the following steps:

[0127] 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 :

[0128] ;

[0129] 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;

[0130] 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 ;

[0131] 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:

[0132] ;

[0133] 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.

[0134] Embodiment 1:

[0135] In an infrastructure project, the construction unit needs to standardize the management of various construction processes and display these management specifications in the form of tables in the construction manual. The table contains a large amount of merged cell information, which is used to represent the quality standards under different construction conditions, such as the different construction requirements of "highways, first-class highways" and "second-class and below highways". The table data not only needs to be recorded in the project management system, but also needs to be extracted, parsed and stored as retrievable structured data. However, traditional table parsing methods cannot accurately identify these complex merged cell structures, resulting in difficulty in data extraction and information loss during storage.

[0136] In order 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 the integrity and availability of data.

[0137] The construction unit needs to parse a table titled "Panel prefabrication and installation construction quality standards", in which 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:

[0138] 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.

[0139] Each cell in the table content is extracted as a cell value. For example, the value of the cell in the 4th row and the 1st column is "Roadbed", and its attribute is "(Roadbed, true, false)", which means it is merged with the previous row but not with the previous column. Similarly, the value of the cell in the 2nd row and the 3rd column is "Expressway, First-class Highway", and its attribute is "(Expressway, First-class Highway, false, false)".

[0140] When generating the tree structure of row and column headers, the number of rows and columns occupied by the header area is counted based on the position of the merged cells. For the row headers of this table, the parsing result is "[Highway, First-class Highway, Second-class and below highways]"; the column headers are "[Light, Medium and Heavy Traffic, Extra Heavy, Extremely Heavy Traffic, Upper Embankment, Lower Embankment, Foundation Replacement]".

[0141] The parent-child relationship of each title node is marked by the upper and lower hierarchical relationship in the tree structure to ensure that the hierarchical information will not be lost in the subsequent storage process.

[0142] The traversal of the table body starts from the depth 1 of the row header tree and the depth 2 of the column header tree. The self-supervised model is used to verify the contextual consistency between the row header and column header nodes corresponding to each cell and generate edge connections between row and column nodes to ensure the accuracy of data relationships.

[0143] All generated edge connections are stored as part of the graph structure, and the connection relationship of all nodes is verified according to the weight and context consistency function. The leaf nodes of the final graph structure are "[highway, first-class highway, second-class and below highway]" and "[light, medium and heavy traffic, extra-heavy, extremely heavy traffic, upper embankment, lower embankment, foundation replacement]".

[0144] The present invention is superior to traditional methods in terms of parsing speed and accuracy. Through the application of self-supervision 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.

[0145] The present invention utilizes a self-supervised learning model to accurately identify the position and attributes of merged cells, and realizes efficient generation of row header trees and column header trees by automatically extracting hierarchical relationships in tables. Compared with traditional extraction methods that rely 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 relationships in complex structure tables are accurately captured. In the parsing process of multi-level merged cells, traditional methods are prone to misjudgment or omissions, while the self-supervised model adopted by the present invention can dynamically parse the multi-level parent-child relationships 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%.

[0146] The present invention ensures that the connection edges between row headers 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 them with a context consistency check function. Traditional table parsing methods find it difficult to handle 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.

[0147] The present invention introduces a weighted edge connection storage mechanism in the graph structure, and 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 weight-based fast query and retrieval. 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.

[0148] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope 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 content 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 With the previous column of cells 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

Cited By

  • Graph data extraction method based on language large model driving

    CN120046717A