Table content analysis method and device, electronic equipment and storage medium
By identifying and segmenting the table layout and generating sub-table description information, the problem of RAG system's difficulty in parsing complex structure tables is solved, and the accuracy and recall rate of the question-answering system are improved.
Patent Information
- Application Number
- CN202510880995.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-17
AI Technical Summary
Existing RAG systems have difficulty parsing and low recall rates when processing tables with complex structures, resulting in poor question-answering results.
By identifying the layout of the parsed table, determining the main body type, and dividing the table into a set of sub-tables according to the preset segmentation method, the natural language model is used to convert the sub-table content into description information, and finally generating table description information.
It improves the accuracy of table parsing and the accuracy and recall rate of the question-answering system, especially the parsing effect on complex structure tables.
Smart Images

Figure CN120804156A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of human-computer interaction, and in particular to a table content analysis method and device, an electronic device, and a storage medium. BACKGROUND
[0002] In today's digital age, question and answer systems have become an important bridge for enterprises to communicate with users. With the advancement of natural language processing technology, Retrieval-Augmented Generation (RAG) based systems, referred to as RAG systems, have become a new research hotspot due to their combination of large language model language understanding, generation, and large-scale document knowledge base advantages. Customer service question and answer systems using RAG can generate more natural, accurate, and fluent answers, thereby providing better customer service.
[0003] However, due to the diversity of document knowledge bases, existing RAG systems have difficulty parsing and low recall rate when processing table data, especially when processing complex structured tables, resulting in poor question and answer results. SUMMARY
[0004] In view of this, to solve some or all of the above technical problems, the present application provides a table content analysis method and device, an electronic device, and a storage medium.
[0005] In a first aspect, the present application provides a table content analysis method, which includes: performing layout identification on a table to be analyzed to obtain row and column content information of the table to be analyzed; determining a main body type of the table to be analyzed based on the row and column content information, wherein the main body type includes at least one of the following: a row main body type, a column main body type, and an independent main body type; splitting the table to be analyzed according to a preset splitting mode corresponding to the main body type to obtain a sub-table set; converting content contained in each sub-table in the sub-table set into sub-table description information; and generating table description information of the table to be analyzed based on the obtained sub-table description information.
[0006] In one possible implementation, splitting the table to be analyzed according to a preset splitting mode corresponding to the main body type to obtain a sub-table set includes: if the main body type is a row main body type or a column main body type, determining a merged cell from the table to be analyzed according to the row and column content information; splitting content corresponding to the merged cell to obtain a split table composed of independent cells; determining at least one group of cells from the table to be analyzed based on a content extraction direction corresponding to the main body type; combining a table header of the table to be analyzed and each group of cells in the at least one group of cells, respectively, and determining a simple sub-table obtained after the combination as a simple sub-table; and generating the sub-table set based on the simple sub-table.
[0007] In a possible implementation, the sub-table set is generated based on the simple sub-tables, including: combining the table header corresponding to the position of the merged cell in the parsed table and the content of the merged cell, and determining the combined sub-table as a complex sub-table; and determining the simple sub-tables and the complex sub-tables as the sub-table set.
[0008] In a possible implementation, the content included in each sub-table in the sub-table set is converted into sub-table description information, including: converting the content in the simple sub-table into natural language to obtain simple sub-table description information; converting the content in the complex sub-table into natural language to obtain complex sub-table description information; and determining the simple sub-table description information and the complex sub-table description information as the sub-table description information.
[0009] In a possible implementation, the parsed table is split according to a preset splitting manner corresponding to the subject type to obtain the sub-table set, including: if the subject type is an independent subject type, determining the arrangement order of each group of cells included in the parsed table according to a preset cell combination direction; for each group of cells in the parsed table except the first group of cells, determining whether the cells in the group of cells have a key-value relationship with the corresponding cells in the previous group of cells; if the key-value relationship exists, determining that the group of cells has a successor relationship with the previous group of cells; and splitting the parsed table into sub-tables by taking the groups of cells having the successor relationship as a whole and taking the groups of cells not having the successor relationship as a whole to obtain the sub-table set.
[0010] In a possible implementation, after the table description information of the parsed table is generated based on the obtained sub-table description information, the method further includes: performing content division on the table description information to obtain a content block set; performing vectorization conversion on each content block in the content block set to obtain a content vector corresponding to each content block; and storing the vectorization data and the content block set in the preset knowledge base correspondingly.
[0011] In a possible implementation, after the vectorization data and the content block set are stored in the preset knowledge base correspondingly, the method further includes: in response to receiving an input question sentence, performing vectorization processing on the question sentence to obtain a to-be-matched vector; matching the to-be-matched vector with the content vectors in the knowledge base; and if the to-be-matched vector matches a target content vector successfully, generating an answer sentence of the question sentence based on the content block corresponding to the target content vector.
[0012] In a second aspect, an embodiment of the present application provides a table content analysis apparatus, which comprises: an identification module configured to perform layout identification on a table to be analyzed to obtain row and column content information of the table to be analyzed; a determination module configured to determine a main body type of the table to be analyzed based on the row and column content information, wherein the main body type comprises at least one of a row main body type, a column main body type and an independent main body type; a segmentation module configured to segment the table to be analyzed according to a preset segmentation mode corresponding to the main body type to obtain a sub-table set; a first conversion module configured to convert content contained in each sub-table in the sub-table set into sub-table description information; and a first generation module configured to generate table description information of the table to be analyzed based on the obtained sub-table description information.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, which comprises: a memory configured to store a computer program; and a processor configured to execute the computer program stored in the memory, and the computer program, when executed, implements the method of any one of the embodiments of the table content analysis method of the first aspect of the present application.
[0014] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having a computer program stored thereon, and the computer program, when executed by a processor, implements the method of any one of the embodiments of the table content analysis method of the first aspect of the present application.
[0015] In a fifth aspect, an embodiment of the present application provides a computer program, which comprises computer readable code, and when the computer readable code is run on a device, the processor in the device implements the method of any one of the embodiments of the table content analysis method of the first aspect of the present application.
[0016] The table content analysis method, apparatus, electronic device and storage medium provided in the embodiments of the present application perform layout identification on a table to be analyzed to obtain column content information, determine a main body type of the table to be analyzed based on the row and column content information, segment the table to be analyzed according to a preset segmentation mode corresponding to the main body type to obtain a sub-table set, convert content contained in each sub-table in the sub-table set into sub-table description information, and generate table description information of the table to be analyzed based on the obtained sub-table description information. The embodiments of the present application implement segmentation into sub-tables according to the characteristics of tables with different layouts when analyzing the content of a table, thereby extracting sub-table description information from the sub-tables. In particular, for a table with a complex structure, the table description information of the entire table can be obtained efficiently and accurately, which helps to improve the accuracy of answers and recall rate of a question and answer system by using the table description information. BRIEF DESCRIPTION OF DRAWINGS
[0017] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the application and, together with the description, further serve to explain the principles of the application.
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the accompanying drawings required by the embodiments or the prior art description will be briefly introduced as follows. Obviously, those skilled in the art can obtain other drawings from these drawings without any creative effort.
[0019] One or more embodiments are illustrated by the drawings in the accompanying drawings, which do not constitute a limitation on the embodiments, and elements with the same reference numerals in the drawings represent similar elements, unless otherwise specified. The drawings in the drawings do not constitute a proportional limit.
[0020] Figure 1 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0021] Figure 2 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0022] Figure 3 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0023] Figure 4 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0024] Figure 5 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0025] Figure 6 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0026] Figure 7 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0027] Figure 8 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0028] Figure 9 A flowchart of a table content analysis method provided for the embodiments of the present application is shown in the figure;
[0029] Figure 10 A structure diagram of a table content analysis device provided for the embodiments of the present application is shown in the figure;
[0030] Figure 11 A structural schematic diagram of an electronic device is provided in the embodiments of the present application. DETAILED DESCRIPTION
[0031] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be apparent that the described embodiments are only part of the embodiments of the present application and are not intended to limit the scope of the present application. It should be noted that the relative arrangement of the components and steps, numerical expressions, and numerical values set forth in these embodiments are not intended to limit the scope of the present application unless otherwise specifically stated.
[0032] Those skilled in the art can understand that the terms "first", "second", etc. in the embodiments of the present application are only used to distinguish different steps, devices or modules, and do not represent any specific technical meaning, nor represent the logical order between them.
[0033] It should also be understood that in the embodiments, "a plurality of" can mean two or more, and "at least one" can mean one, two or more.
[0034] It should also be understood that for any component, data or structure mentioned in the embodiments of the present application, unless specifically limited or the context gives a contrary indication, it can be understood as one or more in general.
[0035] In addition, the term "and / or" in the present application is only a description of the association relationship between the associated objects, which means that there can be three relationships, for example, A and / or B can represent the existence of A alone, the existence of A and B together, and the existence of B alone. In addition, the character " / " in the present application generally represents an "or" relationship between the front and rear associated objects.
[0036] It should also be understood that the description of various embodiments of the present application focuses on the differences between the various embodiments, and the same or similar parts can be referred to each other, and for the sake of brevity, will not be repeated.
[0037] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the application or its application or uses.
[0038] Techniques, methods, and devices known to those of ordinary skill in the relevant art can not be discussed in detail, but should be considered part of the specification where appropriate.
[0039] It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0040] It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of this application can be combined with each other. To facilitate understanding of the embodiments of this application, the application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0041] In order to solve the technical problem of low accuracy in table content parsing in the prior art, the present application provides a table content parsing method, which can specifically extract table content from tables with different layout structures, thereby improving the accuracy of table parsing.
[0042] Figure 1 A flow chart of a table content parsing method provided in an embodiment of the present application. This method can be applied to one or more electronic devices such as vehicles (for example, smart driving vehicles), smart phones, laptops, desktop computers, portable computers, servers, etc. In addition, the execution subject of this method can be hardware or software. When the above-mentioned execution subject is hardware, the execution subject can be one or more of the above-mentioned electronic devices. For example, a single electronic device can execute this method, or a plurality of electronic devices can cooperate with each other to execute this method. When the above-mentioned execution subject is software, this method can be implemented as multiple software or software modules, or as a single software or software module. It is not specifically limited here.
[0043] like Figure 1 As shown, the method specifically includes:
[0044] Step 101: perform layout recognition on the parsed table to obtain row and column content information of the parsed table.
[0045] In some embodiments, the parsed table can be a table obtained from various scenarios. For example, when this embodiment is applied to a question-answering system, the parsed table can be a knowledge base table in a RAG system. The electronic device can use a table layout recognition model (such as PP-Table Magic) to perform layout recognition on the parsed table and obtain row and column content information. The row and column content information can include the position and content of each independent cell and merged cell. Figure 2 The row and column content information in the table 201 shown includes:
[0046] {[c1,c2],[r1],'Engineer'}; {[c2,c3],[r2],'L9'}; {[c1],[r3,r4],'Strong'}; {[c3],[r3,r4],'Medium'}, etc. Where c and r represent row and column positions.
[0047] At step 102, a subject type of the parsed table is determined based on the row and column content information.
[0048] In some embodiments, the subject type includes at least one of a row subject type, a column subject type, and an independent subject type. The row subject type is that each row is an independent complete information content except that the first row is a table header. Figure 2 The table shown in FIG. 2 is of the row subject type.
[0049] The column subject type is that each column is an independent complete information content except that the first column is a table header.
[0050] The independent subject type is that the table cannot be divided into rows and columns, i.e., does not belong to the row subject or the column subject, such as an application form (e.g., the table shown in FIG. 3) and the like, which belongs to a complete independent table template. Figure 7
[0051] The electronic device can recognize the table subject by using a pre-trained table subject recognition model (e.g., the PP-Table Magic model described above).
[0052] At step 103, the parsed table is divided according to a preset division mode corresponding to the subject type, to obtain a set of sub-tables.
[0053] In some embodiments, different subject types of the table correspond to different division modes. For example, for the row subject type, each row and the corresponding table header can be extracted as a sub-table. For the column subject type, each column and the corresponding table header can be extracted as a sub-table. For the independent subject type, the correlation between the cell contents in the table can be recognized, and the cells with the correlation can be grouped into a sub-table.
[0054] At step 104, the content included in each sub-table in the set of sub-tables is converted into sub-table description information.
[0055] In some embodiments, the electronic device can extract the content in each sub-table, and convert the extracted content into sub-table description information in natural language form by using a natural language model. For example, as shown in FIG. 4, for the sub-table with the name “Zhang San”, the table content conversion is performed on the sub-table, to obtain a piece of sub-table description information in natural language form “Zhang San, occupation is engineer, job level L8, strong reporting ability, strong engineering ability”. Figure 2
[0056] At step 105, table description information of the parsed table is generated based on the obtained sub-table description information.
[0057] In some embodiments, the sub-table description information may be combined into the table description information of the entire table, or the sub-table description information may be integrated using a natural speech model to obtain the table description information.
[0058] The table content parsing method provided in the embodiment of the present application obtains column content information by performing layout recognition on the table being parsed, determines the main body type of the table being parsed based on the row and column content information, and divides the table being parsed according to a preset segmentation method corresponding to the main body type to obtain a sub-table set. The content contained in each sub-table in the sub-table set is converted into sub-table description information, and table description information of the parsed table is generated based on the obtained description information of each sub-table. The embodiment of the present application realizes that when parsing the content of a table, it can be targeted and divided into sub-tables according to the characteristics of tables with different layouts, thereby extracting sub-table description information from the sub-tables. In particular, for tables with complex structures, the table description information of the entire table can be obtained efficiently and accurately, which helps to improve the answer accuracy and recall rate of the question-answering system by using the table description information.
[0059] In some optional implementations of this embodiment, such as Figure 3 As shown, step 103 includes:
[0060] Step 1031: If the body type is a row body type or a column body type, the merged cells are determined from the parsed table according to the row and column content information.
[0061] For example, Figure 2 In the table shown, based on the table content {[c1,c2],[r1],'engineer'}, the position of the merged cell formed by merging two independent cells can be determined.
[0062] Step 1032: Split the contents corresponding to the merged cells to obtain a split table consisting of independent cells.
[0063] like Figure 2 As shown, after splitting each merged cell, a split table 202 consisting of multiple independent cells is obtained.
[0064] Step 1033 : Determine at least one group of cells from the parsed table based on the content extraction direction corresponding to the subject type.
[0065] Among them, the content extraction direction corresponding to the row body type is row direction, that is, the content of each row is extracted as a group of cells; the content extraction direction corresponding to the column body type is column direction, that is, the content of each column is extracted as a group of cells.
[0066] Step 1034, combine the table header and each of the at least one group of cells of the parsed table respectively to obtain a sub-table, and determine the obtained sub-table as a simple sub-table.
[0067] That is, for a row subject type table, each row and the first row as the table header are combined into a simple sub-table. As shown in Figure 2 203 in FIG. 2B.
[0068] Step 1035, generate a sub-table set based on the simple sub-tables.
[0069] Specifically, the set of simple sub-tables can be taken as the sub-table set. Alternatively, the simple sub-tables and the complex sub-tables can be combined into the sub-table set according to the following embodiments.
[0070] The embodiment can parse the meaning of the merged cells by splitting the merged cells in the row subject type table and the column subject type table, and extract simple sub-tables from the split table, so that the meaning of the entire table can be fully expressed, and the accuracy of the table parsing is improved.
[0071] In some optional implementations of the embodiment, as shown in Figure 4 Step 1035 includes:
[0072] Step 10351, combine the table header corresponding to the position of the merged cell in the parsed table and the content of the merged cell to obtain a sub-table, and determine the obtained sub-table as a complex sub-table.
[0073] As shown in Figure 2 For the merged cell with the content of “engineer”, the corresponding row header and column header are combined to obtain the complex sub-table shown as 204 in Figure 2 to perform complex relationship language representation.
[0074] Step 10352, determine the set of the simple sub-tables and the complex sub-tables as a sub-table set.
[0075] The embodiment can generate complex sub-tables by extracting the merged cells, so as to help extract the content expressing complex semantics from the complex sub-tables, and further improve the accuracy of content parsing of the table with complex structure.
[0076] In some optional implementations of the embodiment, as shown in Figure 5 Step 104 includes:
[0077] Step 1041, perform natural language conversion on the content in the simple sub-table to obtain simple sub-table description information.
[0078] Specifically, the natural language model can be used to convert the content in a simple subtable into natural language. Figure 2 As shown, 205 is simple subtable description information.
[0079] Step 1042 : Perform natural language conversion on the content of the complex subtable to obtain complex subtable description information.
[0080] Specifically, the natural language model can be used to convert the content in the complex subtable into natural language. Figure 2 As shown, 206 is the complex subtable description information. Figure 2 The steps shown are the same and will not be repeated here.
[0081] Step 1043 : Determine the simple subtable description information and the complex subtable description information as subtable description information.
[0082] This embodiment performs natural language conversion on simple sub-tables and complex sub-tables to obtain language representations of simple tables and language representations of complex relationship tables. The parsed table description information can more comprehensively reflect the content of complex structure tables, thereby improving the accuracy of table content parsing.
[0083] In some optional implementations of this embodiment, such as Figure 6 As shown, step 103 includes:
[0084] Step 1036: If the subject type is an independent subject type, determine the arrangement order of each group of cells included in the parsed table according to the preset cell combination direction.
[0085] The cell combination direction can be horizontal or vertical. Figure 7 As shown, the cell combination direction corresponding to the table 701 is horizontal, that is, each row of cells is combined into a group of cells, and the arrangement order of each group of cells is from top to bottom.
[0086] Step 1037 : For each group of cells in the parsed table except the first group of cells, determine whether the cells in the group of cells have a key-value relationship with the corresponding cells in the previous group.
[0087] like Figure 7 In the table 701 shown, the first group of cells is the first row of cells. For each row except the first row, it is determined whether there is a key-value relationship between the cells in the current row and the cells in the previous row. Figure 7There is a key-value relationship between the second row and the third row in the table, and the "painting", "basketball", and "running" in the second row are keys, and the "yes", "yes", and "no" in the third row are values. Generally, whether there is a key-value relationship between cells can be determined by a pre-trained table recognition model.
[0088] In step 1038, if there is a key-value relationship, it is determined that the group of cells has a successor relationship with the previous group of cells.
[0089] As shown in Figure 7 , the second row and the third row have a successor relationship.
[0090] In step 1039, the cells with a successor relationship are grouped as a whole, and the cells without a successor relationship are grouped as a whole, and the parsed table is sub-table divided to obtain a set of sub-tables.
[0091] As shown in Figure 7 , after performing successor relationship recognition, the table is divided in a minimum row manner, and the second row and the third row are grouped as a whole to form a sub-table. The other rows do not have a successor relationship and form different sub-tables.
[0092] After obtaining the set of sub-tables, in step 104, natural language conversion is performed on each sub-table to obtain sub-table description information corresponding to each sub-table as shown in Figure 7 . Then in step 105, the sub-table description information is merged into table description information.
[0093] In this embodiment, by performing successor relationship recognition on a table of an independent subject type, the table with a more complex structure can be divided according to the semantic relationship between cells, thereby helping to extract complete table content from the divided sub-tables, and further improving the accuracy of content analysis of a complex structure table.
[0094] In some optional implementations of this embodiment, as shown in Figure 8 , after step 105, the method further includes:
[0095] In step 106, content division is performed on the table description information to obtain a set of content blocks.
[0096] Specifically, the language model can be used to divide the content of the table description information, and the division rule can be that the content of each block is minimized while maintaining the semantic integrity of a single content block.
[0097] In step 107, each content block in the set of content blocks is vectorized to obtain a content vector corresponding to each content block.
[0098] Specifically, a pre-trained word embedding model can be used to vectorize each content block, and each content vector has the same dimension.
[0099] At step 108, the vectorized data and the content block set are stored in a preset knowledge base.
[0100] The embodiment can use the parsed content of the table as the basis of the question and answer system, provide knowledge reserves for subsequent question retrieval, and improve the accuracy of question and answer operations.
[0101] In some optional implementations of the embodiment, as shown in Figure 9 After step 108, the method further includes:
[0102] At step 109, in response to receiving the input question sentence, the question sentence is vectorized to obtain a to-be-matched vector.
[0103] The method of vectorizing the question sentence can be implemented by using the embedding model described above.
[0104] At step 110, the to-be-matched vector is matched with the content vectors in the knowledge base.
[0105] Specifically, the to-be-matched vector can be used for similarity calculation with each content vector in the knowledge base to obtain one or more content vectors with the highest similarity.
[0106] At step 111, if the to-be-matched vector is successfully matched with a target content vector, an answer sentence for the question sentence is generated based on the content block corresponding to the target content vector.
[0107] Specifically, a generative large model can be used to generate an answer sentence corresponding to the question sentence based on the retrieved content block, and the answer sentence is output.
[0108] The embodiment helps to improve the accuracy of question retrieval by using the knowledge base to retrieve answers, which helps to utilize the characteristics of the accuracy of the statement in the knowledge base.
[0109] Figure 10 A structural schematic diagram of a table content parsing device provided by the embodiment of the present application is shown. Specifically, the device includes:
[0110] The recognition module 1001 is configured to perform layout recognition on the parsed table to obtain row and column content information of the parsed table.
[0111] The determination module 1002 is configured to determine a main body type of the parsed table based on the row and column content information, where the main body type includes at least one of the following: a row main body type, a column main body type, and an independent main body type.
[0112] The splitting module 1003 is configured to split the parsed table according to a preset splitting mode corresponding to the subject type, to obtain a set of sub-tables.
[0113] The first conversion module 1004 is configured to convert content contained in each sub-table in the set of sub-tables into sub-table description information.
[0114] The first generation module 1005 is configured to generate table description information of the parsed table based on the obtained sub-table description information.
[0115] In one possible implementation, the splitting module includes: a first determination unit configured to determine a merged cell from the parsed table according to row and column content information if the subject type is a row subject type or a column subject type; a splitting unit configured to split content corresponding to the merged cell to obtain a split table composed of independent cells; a second determination unit configured to determine at least one group of cells from the parsed table based on a content extraction direction corresponding to the subject type; a combination unit configured to combine a table header of the parsed table and each group of cells in the at least one group of cells respectively, and determine a sub-table obtained after the combination as a simple sub-table; and a generation unit configured to generate the set of sub-tables based on the simple sub-table.
[0116] In one possible implementation, the generation unit includes: a combination sub-unit configured to combine a table header corresponding to a position of the merged cell in the parsed table and content of the merged cell, and determine a sub-table obtained after the combination as a complex sub-table; and a determination sub-unit configured to determine a set of the simple sub-table and the complex sub-table as the set of sub-tables.
[0117] In one possible implementation, the first conversion module includes: a first conversion unit configured to perform natural language conversion on content in the simple sub-table to obtain simple sub-table description information; a second conversion unit configured to perform natural language conversion on content in the complex sub-table to obtain complex sub-table description information; and a third determination unit configured to determine the simple sub-table description information and the complex sub-table description information as the sub-table description information.
[0118] In a possible implementation, the splitting module comprises: a fourth determination unit, configured to determine, if the subject type is an independent subject type, an arrangement order of each group of cells included in the parsed table according to a preset cell group combination direction; a fifth determination unit, configured to determine, for each group of cells other than the first group of cells in the parsed table, whether a cell in the group of cells has a key-value relationship with a corresponding cell in a previous group of cells; a sixth determination unit, configured to determine that the group of cells has a successor relationship with the previous group of cells, if the key-value relationship exists; and a splitting unit, configured to split the parsed table into a set of sub-tables by taking the groups of cells having the successor relationship as a whole and taking the groups of cells not having the successor relationship as a whole.
[0119] In a possible implementation, the apparatus further comprises: a division module, configured to divide the table description information in content to obtain a set of content blocks; a second conversion module, configured to convert each content block in the set of content blocks into a content vector corresponding to the content block; and a storage module, configured to store the vectorized data and the set of content blocks in a preset knowledge base.
[0120] In a possible implementation, the apparatus further comprises: a vectorization module, configured to perform vectorization processing on an input question sentence to obtain a to-be-matched vector in response to receiving the input question sentence; a matching module, configured to match the to-be-matched vector with a content vector in the knowledge base; and a second generation module, configured to generate an answer sentence of the question sentence based on a content block corresponding to the target content vector, if the to-be-matched vector matches the target content vector successfully.
[0121] The table content analysis apparatus provided in this embodiment can be a table content analysis apparatus as shown in Figure 10 , which can perform all steps of the above table content analysis methods, and further achieve the technical effects of the above table content analysis methods. For brevity, details are not described herein.
[0122] Figure 11 A structural schematic diagram of an electronic device provided in this embodiment is shown in Figure 11 The electronic device 1100 shown in the figure comprises at least one processor 1101, a memory 1102, at least one network interface 1104, and other user interfaces 1103. The various components in the electronic device 1100 are coupled together through a bus system 1105. It can be understood that the bus system 1105 is used to realize the connection and communication between the components. The bus system 1105 includes not only a data bus, but also a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all kinds of buses are marked as the bus system 1105 in the figure. Figure 11
[0123] The user interface 1103 can include a display, a keyboard, or a pointing device (e.g., a mouse, a trackball, a touchpad, or a touchscreen).
[0124] It can be understood that the memory 1102 in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. The non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM) used as an external cache. By way of example, and not limitation, many forms of RAM can be used, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1102 described herein is intended to include, without being limited to, these and any other suitable types of memory.
[0125] In some embodiments, the memory 1102 stores the following elements, executable units or data structures, or a subset of them, or an extended set of them: an operating system 11021 and an application program 11022.
[0126] The operating system 11021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application program 11022 includes various application programs, such as a Media Player, a Browser, etc., for implementing various application services. The program for implementing the method of the embodiments of the present application can be included in the application program 11022.
[0127] In this embodiment, by calling the program or instructions stored in the memory 1102, specifically, the program or instructions stored in the application 11022, the processor 1101 is configured to execute the method steps provided by each method embodiment, for example, including:
[0128] Perform layout recognition on the parsed table to obtain row and column content information of the parsed table; determine the body type of the parsed table based on the row and column content information, wherein the body type includes at least one of the following: row body type, column body type, and independent body type; segment the parsed table according to a preset segmentation method corresponding to the body type to obtain a sub-table set; convert the content contained in each sub-table in the sub-table set into sub-table description information; and generate table description information of the parsed table based on the obtained description information of each sub-table.
[0129] The methods disclosed in the above embodiments of the present application can be applied to or implemented by processor 1101. Processor 1101 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in processor 1101 or by software instructions. The above processor 1101 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The methods, steps, and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software units in the decoding processor. The software units can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory 1102 , and the processor 1101 reads the information in the memory 1102 and completes the steps of the above method in combination with its hardware.
[0130] It can be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing units can be implemented within one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSP Devices, DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units designed to perform the functions described above, or a combination thereof.
[0131] For software implementation, the techniques described herein can be implemented with a processing unit that executes program components or modules. The software code can be stored in memory and executed by a processor. Memory can be implemented within the processor or external to the processor.
[0132] The electronic device provided by the embodiments can be an electronic device as shown in Figure 11 The electronic device provided by the embodiments can be an electronic device as shown in
[0133] The embodiments of the present disclosure further provide a storage medium (computer readable storage medium). The storage medium stores one or more programs. The storage medium can include a volatile memory, such as a random access memory, and / or can include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive, or a solid-state drive. The storage medium can also include a combination of the above-mentioned types of memories.
[0134] The one or more programs stored in the storage medium can be executed by the one or more processors to implement the table content analysis method described above.
[0135] The processor is configured to execute the program stored in the memory to implement the steps of the table content analysis method described above.
[0136] Layout recognition is performed on the parsed table to obtain row and column content information of the parsed table; based on the row and column content information, a main body type of the parsed table is determined, wherein the main body type comprises at least one of a row main body type, a column main body type, and an independent main body type; the parsed table is split according to a preset splitting mode corresponding to the main body type to obtain a sub-table set; content contained in each sub-table in the sub-table set is converted into sub-table description information; and based on the obtained sub-table description information, table description information of the parsed table is generated.
[0137] Those skilled in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be realized in electronic hardware, computer software, or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, each example has been described in general terms in the above description. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0138] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, software executed by a processor, or a combination of both. The software modules can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0139] It should be understood that the terms used herein are for the purpose of describing specific example implementations only and are not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises", "comprising", "includes", "including" and "has" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or groups thereof. The method steps, processes, and operations described herein are not to be interpreted as necessarily requiring their performance in the specific order indicated, unless explicitly stated otherwise. It is also to be understood that additional or alternative steps can be employed.
[0140] The foregoing detailed description of the application has been presented for purposes of illustration and description. Various modifications and changes can be made to these embodiments without departing from the spirit and scope of the application. It is intended that the scope of the application should not be limited by the particular representative embodiments described above.
Claims
1. A table content parsing method, characterized in that: The method comprises: Performing layout recognition on the parsed table to obtain row and column content information of the parsed table; Determining a body type of the parsed table based on the row and column content information, wherein the body type includes at least one of the following: a row body type, a column body type, and an independent body type; Splitting the parsed table according to a preset splitting method corresponding to the subject type to obtain a set of sub-tables; Converting the content of each subtable in the subtable set into subtable description information; Based on the obtained description information of each sub-table, table description information of the parsed table is generated.
2. The method according to claim 1, characterized in that The parsed table is segmented according to a preset segmentation method corresponding to the subject type to obtain a sub-table set, including: If the body type is a row body type or a column body type, determining merged cells from the parsed table according to the row and column content information; Splitting the contents corresponding to the merged cells to obtain a split table consisting of independent cells; determining at least one group of cells from the parsed table based on a content extraction direction corresponding to the subject type; Combining the header of the parsed table and each group of cells in the at least one group of cells, and determining a subtable obtained by the combination as a simple subtable; The sub-table set is generated based on the simple sub-table.
3. The method according to claim 2, characterized in that Generating the subtable set based on the simple subtable includes: Combining the header corresponding to the position of the merged cell in the parsed table with the content of the merged cell, and determining the subtable obtained by the combination as a complex subtable; A set of the simple subtable and the complex subtable is determined as the subtable set.
4. The method according to claim 3, characterized in that The converting the content of each subtable in the subtable set into subtable description information includes: Performing natural language conversion on the content of the simple subtable to obtain simple subtable description information; Performing natural language conversion on the content of the complex subtable to obtain complex subtable description information; The simple sub-table description information and the complex sub-table description information are determined as the sub-table description information.
5. The method according to claim 1, wherein The parsed table is segmented according to a preset segmentation method corresponding to the subject type to obtain a sub-table set, including: If the subject type is an independent subject type, determining the arrangement order of each group of cells included in the parsed table according to a preset cell combination direction; For each group of cells other than the first group of cells in the parsed table, determining whether cells in the group of cells have a key-value relationship with corresponding cells in the previous group; If there is a key-value relationship, determine whether this group of cells has a successor relationship with the previous group of cells; The cell group with the successor relationship is taken as a whole, and the cell group without the successor relationship is taken as a whole, and the parsed table is divided into sub-tables to obtain the sub-table set.
6. The method according to claim 1, characterized in that After generating the table description information of the parsed table based on the obtained description information of each sub-table, the method further includes: Dividing the table description information into content to obtain a content block set; Performing vectorization conversion on each content block in the content block set to obtain a content vector corresponding to each content block; The vectorized data and the content block set are stored correspondingly in a preset knowledge base.
7. The method according to claim 6, characterized in that After storing the vectorized data and the content block set in a preset knowledge base in correspondence, the method further includes: In response to receiving an input question statement, vectorizing the question statement to obtain a vector to be matched; Matching the vector to be matched with the content vector in the knowledge base; If the to-be-matched vector successfully matches the target content vector, an answer statement to the question statement is generated based on the content block corresponding to the target content vector.
8. A table content parsing device, characterized in that: The device comprises: an identification module, configured to perform layout identification on the parsed table and obtain row and column content information of the parsed table; a determination module, configured to determine a body type of the parsed table based on the row and column content information, wherein the body type includes at least one of the following: a row body type, a column body type, and an independent body type; A segmentation module, configured to segment the parsed table according to a preset segmentation method corresponding to the subject type to obtain a set of sub-tables; A first conversion module, configured to convert the content of each subtable in the subtable set into subtable description information; The first generating module is configured to generate table description information of the parsed table based on the obtained description information of each sub-table.
9. An electronic device, characterized in that: include: Memory for storing computer programs; The processor is configured to execute the computer program stored in the memory, and when the computer program is executed, the table content parsing method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the table content parsing method described in any one of claims 1 to 7 is implemented.