Method for extracting numerical knowledge elements from XML-formatted academic literature tables

By utilizing preset tags and cross-multiplication extraction methods in XML format academic literature, the problem of low efficiency in extracting numerical indicators from complex tables was solved, achieving automated and accurate acquisition of numerical indicators.

CN117520574BActive Publication Date: 2026-11-24SHANXI TONGFANG KNOWLEDGE NETWORK DIGITAL PUBLISHING TECH CO +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311639578.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-01
Publication Date
2026-11-24
Estimated Expiration
2043-12-01

AI Technical Summary

Technical Problem

Existing technologies struggle to quickly and accurately extract numerical indicator knowledge elements with a uniform structure from complex academic literature tables, resulting in high manual processing costs and low efficiency.

Method used

By acquiring academic literature data in XML format, using preset tags to determine the table position, expanding and merging cells, obtaining table attribute content, and using the cross-extraction method to extract numerical indicator knowledge elements.

Benefits of technology

It enables automatic identification and extraction of numerical indicators from academic literature tables, improving the efficiency and accuracy of numerical indicator acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117520574B_ABST
    Figure CN117520574B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, electronic device, and storage medium for extracting numerical indicator knowledge elements from XML-formatted academic literature tables, relating to the field of XML format data extraction technology. The method acquires academic literature data in XML format, determines the position of tables within the academic literature data using a first preset tag, obtaining an initial table from the academic literature data; expands merged cells of the initial table to obtain an expanded table; acquires the attribute content of the expanded table; and extracts numerical indicator knowledge elements from the expanded table based on the attribute content of the expanded table. As can be seen, the embodiments of this application can automatically identify tables related to numerical values, recognize relevant information from the tables, and finally output numerical indicator knowledge elements in a prescribed format based on the relevant information from the tables, improving the efficiency of acquiring specific numerical indicators.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of XML format data extraction technology, and in particular to a method, apparatus, electronic device and storage medium for extracting numerical index knowledge elements from XML format academic literature tables. Background Technology

[0002] With the continuous development of science and technology in recent years, all sectors have shown a great demand for academic literature resources. CNKI processes a large number of academic papers into XML (Extensible Markup Language) format every year to facilitate subsequent storage and use. The vast abundance of literature and the effective use of these resources inevitably create a certain contradiction. The concept of knowledge elements provides a new approach to the granular use of literature resources.

[0003] Currently, most knowledge element extraction methods use text as the basic unit, outputting the required text sentences or paragraphs of knowledge element information through certain rules or models. However, tables, as an important form of knowledge content expression in academic literature, present certain difficulties in accurately extracting the content information corresponding to the table based on its complex and diverse structure. While manual processing can guarantee accuracy, it will increase the time cost significantly. Therefore, quickly and accurately extracting knowledge elements with a unified structure from various complex tables containing rich statistical experimental data has become an important issue in knowledge element extraction. Summary of the Invention

[0004] In view of the above problems, this application is proposed to provide a method, apparatus, electronic device, and storage medium for extracting numerical index knowledge elements from XML format academic literature tables to overcome or at least partially solve the above problems. The technical solution is as follows:

[0005] Firstly, a method for extracting numerical indicator knowledge elements from XML-formatted academic literature tables is provided, including:

[0006] Obtain academic literature data in XML format, and determine the position of tables in the academic literature data through the first preset tag to obtain the initial tables in the academic literature data;

[0007] The merged cells in the initial table are expanded to obtain the expanded table.

[0008] Obtain the attribute content of the expanded table;

[0009] Based on the attribute content of the expanded table, numerical indicator knowledge elements are extracted from the expanded table.

[0010] In one possible implementation, the merged cells of the initial table are expanded to obtain an expanded table, including:

[0011] Copy the contents of the merged row or column cells in the initial table back to the original non-merged unique cells to obtain the expanded table.

[0012] In one possible implementation, the contents of the merged row or column cells in the initial table are copied and restored to the original non-merged unique cells, including:

[0013] Iterate through the second preset label within the first preset label of the initial table;

[0014] Each second preset label is output as a list, where each element is the cell content corresponding to the third preset label within the second preset label. If the third preset label has a preset column attribute, the content of the corresponding cell in the current list is copied according to the number corresponding to the preset column attribute. The output format is [x1, x2, ... x...]. n ], where n is the number of columns in the cells, x1, x2, ... x n All values ​​represent the content of individual cells. If the third preset label has a preset row attribute, then while writing the content of the corresponding cell in the current list, the content of the cell in the newly created list is also written according to the number corresponding to the preset row attribute. Other positions in the newly created list are temporarily left empty. The output format is [[x1,x2,…x...]. n [,x2,…],,[,x2,…],…], where n is the number of columns in the cell. When the corresponding second preset label is encountered during subsequent traversal, the data of the third preset label corresponding to the second preset label is written to fill the empty list positions.

[0015] The final output format is [[x 11 ,x 12 ,…x 1n ],[x 21 ,x 22 ,…x 2n ],…[x m1 ,x m2 ,…x mn ]], where n is the number of columns in the table, m is the number of rows in the table, and x 11 ,x 12 ,…x 1n All of these are contents of a table, x 21 ,x 22 ,…x 2n All of these are contents of a table, x m1 ,x m2 ,…x mn All of these are table contents.

[0016] In one possible implementation, the extended table's attribute content includes one or more of the following: the number of table rows, the number of table columns, the number of table header rows, the number of table header columns, the content of the table header rows, and the content of the table header columns.

[0017] In one possible implementation, obtaining the attribute content of the expanded table includes:

[0018] The last list of the results of the expanded table output [x m1 ,x m2 ,…x mn The text type in the list is determined from left to right according to a preset regular expression. If the regular expression matches the content, the corresponding cell content is determined to be a number; otherwise, it is a non-number. If all the content in the final list is determined to be a number, the expanded table is considered to be a vertical table with only row headers.

[0019] Take the last item from each sublist of the expanded table output to form a new list [x 1n ,x 2n ,…x mn The text type in the list is determined from left to right according to a preset regular expression. If the regular expression matches the content, the corresponding cell content is determined to be a number; otherwise, it is a non-number. If all the content in the final list is determined to be a number, the expanded table is considered to be a horizontal table with only column headers.

[0020] If [x] m1 ,x m2 ,…x mn ] and [x 1n ,x 2n ,…x mn If none of the contents of either final list are determined to be numerical, then the expanded table is determined to lack numerical indicators and the required numerical indicator knowledge elements. If both final lists contain numerical indicators, then the expanded table can be determined to be a numerical table. For numerical tables that only have row headers, the list is analyzed from left to right [x]. 1n ,x 2n ,…x mn Non-numeric elements can be used to obtain the number and content of row headings. If only column headings are available, the list is analyzed from left to right. m1 ,x m2 ,…x mnNon-numeric elements can be used to obtain the number and content of column headers. If both row and column headers exist, the number and content of header rows, as well as the number and content of header columns, can be determined by analyzing whether the first and third preset tags within the first and second preset tags of the XML file contain preset column attributes and preset row attributes, which are the corresponding first table in the upper left corner of the table.

[0021] In one possible implementation, based on the attribute content of the expanded table, numerical indicator knowledge elements are extracted from the expanded table, including:

[0022] Numerical index knowledge elements are extracted from the expanded table using the cross-multiplication extraction method, and the rows and columns of the expanded table are numbered starting from 1.

[0023] Based on the number and content of the header rows and the number and content of the header columns, save the serial number and the content corresponding to the header row and the content corresponding to the header column. If the number of header rows or the number of header columns is greater than 1 and the content in the header row cells or the content in the header column cells is unique, then store the unique content of multiple cells under the current serial number by connecting them with "&&&". If there are only header rows or only header columns, empty content is allowed.

[0024] Iterate through all cells except the header row and header column. If the current cell content is determined to be a number by a preset regular expression, obtain the row and column number of the current cell, and then obtain the corresponding header row and header column content through the row and column number, forming a 5-tuple knowledge element. The 5-tuple list includes the cell's numerical content, the corresponding header row content, the corresponding header row number, the corresponding header column content, and the corresponding header column number. If there is no cell row or column, the corresponding header row or header column content and the corresponding header row or header column number can be empty.

[0025] In one possible implementation, the cross-cutting extraction method involves determining that a cell is a numerical cell, and then obtaining the title content of the row and column where the cell is located through the row and column information, thereby knowing the specific content information expressed by the numerical value.

[0026] Secondly, a device for extracting numerical index knowledge elements from XML-formatted academic literature tables is provided, including:

[0027] The first acquisition unit is used to acquire academic literature data in XML format, and determine the position of the table in the academic literature data through the first preset tag to obtain the initial table in the academic literature data.

[0028] The expanded cell is used to expand the merged cells of the initial table to obtain an expanded table.

[0029] The second acquisition unit is used to acquire the attribute content of the expanded table;

[0030] The extraction unit is used to extract numerical indicator knowledge elements from the expanded table based on the attribute content of the expanded table.

[0031] Thirdly, an electronic device is provided, comprising a processor and a memory, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the numerical index knowledge element extraction method for XML format academic literature tables as described in any of the preceding claims.

[0032] Fourthly, a storage medium is provided that stores a computer program, wherein the computer program is configured to execute the numerical index knowledge element extraction method for XML format academic literature tables described above at runtime.

[0033] By employing the above technical solutions, the present application provides a method, apparatus, electronic device, and storage medium for extracting numerical indicator knowledge elements from XML-formatted academic literature tables. This method can acquire XML-formatted academic literature data, determine the position of tables within the academic literature data using a first preset tag, and obtain an initial table from the academic literature data; expand the merged cells of the initial table to obtain an expanded table; acquire the attribute content of the expanded table; and extract numerical indicator knowledge elements from the expanded table based on the attribute content. As can be seen, the present application can automatically identify tables related to numerical values, recognize relevant information from the tables, and finally output numerical indicator knowledge elements in a prescribed format based on the relevant information from the tables, thereby improving the efficiency of acquiring specific numerical indicators. Attached Figure Description

[0034] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0035] Figure 1a This document illustrates a flowchart of a method for extracting numerical index knowledge elements from XML-formatted academic literature tables, as provided in an embodiment of this application.

[0036] Figure 1b A flowchart is shown below illustrating a method for extracting numerical index knowledge elements from an XML-formatted academic literature table according to another embodiment of this application.

[0037] Figure 2A flowchart of an algorithm for expanding merged cells in an initial table, provided in an embodiment of this application, is shown.

[0038] Figure 3 This illustration shows the table header row content, header column content, number of header rows, and number of header columns provided in an embodiment of this application.

[0039] Figure 4 This document illustrates a flowchart of the algorithm for obtaining the content of the table header row, the content of the header columns, the number of header rows, and the number of header columns provided in an embodiment of this application.

[0040] Figure 5 The schematic diagram of the cross-multiplication extraction method provided in the embodiment of this application is shown;

[0041] Figure 6 This paper shows a structural diagram of the numerical index knowledge element extraction device for XML format academic literature tables provided in an embodiment of this application;

[0042] Figure 7 A structural diagram of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0043] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.

[0044] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such use can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the term "comprising" and its variations should be interpreted as open-ended terms meaning "including but not limited to."

[0045] To address the aforementioned technical problems, embodiments of this application provide a method for extracting numerical indicator knowledge elements from XML-formatted academic literature tables, such as... Figure 1a As shown, the method for extracting numerical indicator knowledge elements from the XML format academic literature table may include the following steps S101 to S104:

[0046] Step S101: Obtain academic literature data in XML format, and determine the position of the table in the academic literature data through the first preset tag to obtain the initial table in the academic literature data.

[0047] In this step, the first preset label can be

[0048]

[0049]

[0050]

[0051]

[0052]

[0053]

[0054]

[0055]

[0056]

[0057] Tags, etc., are not limited in this embodiment. Step S102: Expand the merged cells of the initial table to obtain an expanded table. Step S103: Obtain the attribute content of the expanded table. Step S104: Extract numerical indicator knowledge elements from the expanded table based on the attribute content of the expanded table. This application embodiment can automatically identify tables related to numerical values, identify the relevant information of the table, and finally output numerical indicator knowledge elements in a specified format based on the relevant information of the table, thereby improving the efficiency of obtaining specific numerical indicators. This application embodiment provides a possible implementation method. Step S102 above expands the merged cells of the initial table to obtain an expanded table, which may specifically include the following step A1: Step A1: Copy and restore the content of the merged row cells or column cells of the initial table to the original non-merged unique cells to obtain the expanded table. This embodiment copies and restores the content of the merged row cells or column cells of the initial table to the original non-merged unique cells, thereby facilitating the subsequent acquisition of table attributes and the output of knowledge elements. This application embodiment provides a possible implementation method. Step A1 above copies and restores the content of the merged row or column cells of the initial table to the original non-merged unique cells. Specifically, it may include the following steps A11 to A13: Step A11, traversing the second preset label within the first preset label of the initial table. In this step, the first preset label can be...

[0058] n n n

[0059] The second preset tag can be a tag. Tags, etc., are not limited in this embodiment. Step A12: Each second preset tag is output as a list, where the elements are the cell contents corresponding to the third preset tag within the second preset tag. If the third preset tag has a preset column attribute, the content of the corresponding cell is copied in the current list according to the number corresponding to the preset column attribute, with the output format being [x1,x2,…x], where n is the number of columns in the cell, and x1,x2,…x are the contents of the cell. If the third preset tag has a preset row attribute, while writing the content of the corresponding cell in the current list, the content of the cell is also written in the corresponding position in the newly created list according to the number corresponding to the preset row attribute. Other positions in the newly created list are temporarily left empty, with the output format being [[x1,x2,…x],[,x2,…],,[,x2,…],…], where n is the number of columns in the cell. When the corresponding second preset tag is encountered again, the data of the third preset tag corresponding to the second preset tag is written to fill the empty list positions. In this step, the third preset tag can be... Tags, etc., are not limited in this embodiment. The preset column attribute can be the COLSPAN attribute, which can be used to specify the number of columns a table cell spans. In other words, it can make a cell span multiple columns horizontally.

[0060] The default row property can be the ROWSPAN property, which can be used to specify the number of rows a table cell spans, allowing a cell to span multiple rows vertically.

[0061] Step A13, the final output format is [[x 11 ,x 12 ,…x 1n ],[x 21 ,x 22 ,…x 2n ],…[x m1 ,x m2 ,…x mn ]], where n is the number of columns in the table, m is the number of rows in the table, and x 11 ,x 12 ,…x 1n All of these are contents of a table, x 21 ,x 22 ,…x 2n All of these are contents of a table, x m1 ,x m2 ,…x mn All of these are table contents.

[0062] This embodiment can accurately and efficiently copy and restore the contents of the merged row or column cells of the initial table to the original non-merged unique cells, thereby facilitating the subsequent acquisition of table attributes and the output of knowledge elements.

[0063] This application provides a possible implementation method. The attribute content of the extended table mentioned in step S103 above may include one or more of the following: the number of table rows, the number of table columns, the number of table header rows, the number of table header columns, the content of the table header rows, and the content of the table header columns.

[0064] This application provides a possible implementation method. Step S103 above, which obtains the attribute content of the expanded table, may specifically include the following steps B1 to B3:

[0065] Step B1, output the last list of the results of the expanded table [x m1 ,x m2 ,…x mn The algorithm determines the text type in the list from left to right based on a preset regular expression. If the regular expression matches the content, the corresponding cell content is determined to be a number; otherwise, it is a non-number. If all the content in the final list is determined to be a number, the expanded table is considered to be a vertical table with only row headers.

[0066] In this step, the preset regular expression can be "^\d+\.?\d*[~~]?\d*.?\d*$", etc., and this embodiment does not limit it.

[0067] Step B2: Take the last item from each sublist of the expanded table output result to form a new list [x 1n ,x 2n ,…x mn The algorithm determines the text type in the list from left to right based on a preset regular expression. If the regular expression matches the content, the corresponding cell content is determined to be a number; otherwise, it is a non-number. If all the content in the final list is determined to be a number, the expanded table is considered to be a horizontal table with only column headers.

[0068] Step B3, if [x m1 ,x m2 ,…x mn ] and [x 1n ,x 2n ,…x mn If none of the contents of either final list are determined to be numerical, then the expanded table is determined to lack numerical indicators and the required numerical indicator knowledge elements. If both final lists contain numerical indicators, then the expanded table can be determined to be a numerical table. For numerical tables that only have row headers, the list is analyzed from left to right [x]. 1n ,x 2n ,…x mn Non-numeric elements can be used to obtain the number and content of row headings. If only column headings are available, the list is analyzed from left to right. m1 ,x m2 ,…x mn Non-numeric elements can be used to obtain the number and content of column headers. If both row and column headers exist, the number and content of header rows, as well as the number and content of header columns, can be determined by analyzing whether the first and third preset tags within the first and second preset tags of the XML file contain preset column attributes and preset row attributes, which are the corresponding first table in the upper left corner of the table.

[0069] If there are no row or column headers in this step, no further processing will be performed.

[0070] This embodiment can distinguish between title cells and numerical cells by the text type within the cells, which facilitates the subsequent acquisition of numerical indicator knowledge elements.

[0071] This application embodiment provides a possible implementation method. The above step S104 extracts numerical indicator knowledge elements from the expanded table based on the attribute content of the expanded table, which may specifically include the following steps C1 to C3:

[0072] Step C1: Extract numerical index knowledge elements from the expanded table using the cross-multiplication extraction method, and number the rows and columns of the expanded table starting from 1.

[0073] Step C2: Based on the number and content of the header rows and the number and content of the header columns, save the serial number and the content corresponding to the header row and the content corresponding to the header column. If the number of header rows or header columns is greater than 1 and the content in the header row cells or the content in the header column cells are unique, then connect and store the unique content of multiple cells under the current serial number using "&&&". If there are only header rows or only header columns, empty content is allowed.

[0074] Step C3: Iterate through all cells except the header row and header column. If the current cell content is determined to be a number by a preset regular expression, obtain the row and column number of the current cell, and then obtain the corresponding header row content and header column content through the row and column number to form a quintuple knowledge element. The quintuple list includes the cell's numerical content, the corresponding header row content, the corresponding header row number, the corresponding header column content, and the corresponding header column number. If there is no cell row or column, the corresponding header row or header column content and the corresponding header row or header column number can be empty.

[0075] This embodiment uses a cross-multiplication extraction method to extract numerical indicator knowledge elements from the expanded table. Ultimately, each numerical cell outputs a corresponding list of five tuples: [cell numerical content, corresponding header row content, corresponding header row number, corresponding header column content, corresponding header column number]. Here, if there are multiple unique row or column headers for a cell, they are connected using "&&&". One of the row or column header values ​​can be empty, as can the row or column number values.

[0076] This application provides a possible implementation method. The cross-cutting extraction method mentioned in step C1 above, after determining that the cell is a numerical cell, can obtain the title content of the row and column where the cell is located by using the row and column information, thereby knowing the specific content information expressed by the numerical value. Because the acquisition method is similar to drawing a cross in the cell, it is called the cross-cutting extraction method.

[0077] The above introduces Figure 1a The embodiments shown have various implementation methods for each step. The following will further explain the method for extracting numerical index knowledge elements from XML format academic literature tables in this application through specific embodiments.

[0078] like Figure 1b The diagram shows a flowchart of a method for extracting numerical indicator knowledge elements from XML format academic literature tables, including the following steps:

[0079] (1) Acquisition of XML academic literature data;

[0080] (2) Determine the position of the table using labels;

[0081] (3) Expand the merged cells in the table;

[0082] (4) Obtaining table-related attributes;

[0083] (5) Determine if the current table contains numerical indicators; if yes (i.e., ... Figure 1b If Y is true, then execute (6) and (7); otherwise (i.e. Figure 1b If N is specified in the original text, then no extraction will be performed.

[0084] (6) Extract the numerical indicators from the tables that are determined to contain numerical indicators;

[0085] (7) The extracted numerical indicators and the corresponding information in the table are combined to form a quintuple knowledge element output.

[0086] XML academic literature can be sourced from the academic journal data processing department of CNKI (China National Knowledge Infrastructure).

[0087] XML, as a data storage language, contains various types of tags, each with its specific meaning and function. In this example, table positioning is achieved through XML academic literature. This is achieved using tags; in general XML documents, table content is typically implemented using tags. The tags are used for description.

[0088] For tables with merged cells, it is necessary to expand these merged cells. For example, in an m*n table (m rows and n columns), the expanded table will have n cells in each row and m cells in each column. Figure 2 The flowchart for the table expansion algorithm is shown below. The specific implementation algorithm is as follows:

[0089] (2.1) Reading 11 12 1n 21 22 2n m1 m2 mn

[0094] Figure 3 Figure 4

[0095] 11 12 1n 21 22 2n m1 m2 mn m1 m2 mn 1n 2n mn

[0096] m1 m2 mn

[0097] 1n 2n mn

[0098]

[0099]

[0100]

[0101]

[0102]

[0103]

[0104]

[0105]

[0106] Under the tag Read the content within the tag. The content of the tag, if If the tag does not contain the ROWSPAN or COLSPAN attribute, the content is written to the list sequentially, resulting in a 1*n list, [x1, x2, ... xn]. n ];

[0090] (2.2) If If a tag has the ROWSPAN attribute and its value is i, then the values ​​from the current position in the list to the next i-1 positions will all be written to the current position. The content within the tag;

[0091] (2.3) If If a tag has a COLSPAN attribute, assuming its value is j, then the current position in the list will be written to the positions corresponding to the next j-1 lists. The content within the tag;

[0092] (2.4) If a position in the current list already contains content, skip that position and move the current position to the next position. The content within the tag is written to the list;

[0093] (2.5) If a new one is read For the tags, repeat steps (2.1) to (2.4), writing each item from the list generated in step (2.1) into a new list for saving, ultimately obtaining a list in the form [[x,x,…x],[x,x,…x],…[x,x,…x]], where n is the number of columns in the table and m is the number of rows in the table. Table-related attributes can include the number of rows and columns, the number of header rows, the number of header columns, the content of the header rows, and the content of the header columns. The number of rows and columns can be obtained by directly analyzing the list format output by the extended table. The number of header rows, the number of header columns, the content of the header rows, and the content of the header columns are mainly determined by the first table in the upper left corner of the cell and the text type. The diagram shows the contents of the table header row, header column, number of header rows, and number of header columns. The flowchart shows the algorithm for obtaining the contents of the table header row, header column, number of header rows, and number of header columns. The specific implementation algorithm is as follows: (4.1) Divide the extracted list [[x,x,…x],[x,x,…x],…[x,x,…x]] into two smaller lists and process them separately. One is to take the last sublist [x,x,…x], which corresponds to the last row of the table. The other is to take the last content of each sublist in the list to form a new smaller list [x,x,…x], which corresponds to the last column of the table. These two smaller lists are taken because the header row and header column are generally located at the top and leftmost edges of the table. By comparing the data types of the last row and the last column, the specific positions of the header row and header column can be better determined. (4.2) The smaller list [x,x,…x] is denoted as list1. From left to right, according to the regular expression "^\d+\ The regular expression "^\d+\.? \d*[~~]? \d*.? \d*$" is used to determine the text type (or element type) in the list. If the regular expression matches the content, the corresponding cell content is determined to be a number; otherwise, it is a non-number. If all the content in the final list is determined to be a number, the table is considered to be a vertical table with only row headers (or header rows). (4.3) For the small list [x,x,…x], denoted as list2, the regular expression "^\d+\.? \d*[~~]? \d*.? \d*$" is used to determine the text type (or element type) in the list from left to right. If the regular expression matches the content, the corresponding cell content is determined to be a number; otherwise, it is a non-number. If all the content in the final list is determined to be a number, the table is considered to be a horizontal table with only column headers (or header columns). (4.4) If none of the content in the two final lists in steps (4.2) and (4.3) is determined to be a number, the current table is determined to not contain numerical indicators and does not have the required numerical indicator knowledge elements.If both final lists contain numerical content, then the current table can be determined to contain numerical indicators. The specific algorithm framework for obtaining the number of header rows and header columns for a numerical indicator table is as follows: Input: Table object xmlTable, list1, list2 Output: Number of header rows xmlTable.tRowCount, Number of header columns xmlTable.tColCount The above code is used to process an XML table (xmlTable) containing table headers and content, and to count the number of rows (tRowCount) and columns (tColCount). The number of rows and columns here may include the table header rows and columns. The main steps of the code are as follows: Determine if row headers and column headers exist; depending on the existence of row headers and column headers, increment the number of rows or columns respectively; if both row headers and column headers exist, increment the number of columns based on the first one. In the tag determine the number of rows and columns according to the ROWSPAN and COLSPAN attribute values of the label;

[0107] If there is neither a row header nor a column header, the table is considered problematic and will not be processed.

[0108] (4.5) According to the values of xmlTable.tColCount and xmlTable.tRowCount obtained in step (4.4), the specific content of the header row and header column can be obtained.

[0109] When the content of a certain cell is determined to be a numerical value, the information expressed by the cell value can be interpreted through the corresponding header row content and corresponding header column content. This extraction method is similar to the "cross" in form and logic, and is referred to as the cross extraction method in this embodiment. Figure 5 shows the schematic diagram of this method, and the specific implementation algorithm is as follows:

[0110] (5.1) Number the rows and columns of the table starting from 1;

[0111] (5.2) According to the number and content of header rows, save the serial number and the corresponding content of the header row. If the number of header rows is greater than 1 and the content in the header row cells is not repeated, connect and store the non-repeated content of multiple cells under the current serial number with "&&&". If there is only a header row or only a header column, the missing content is allowed to be empty;

[0112] According to the number and content of header columns, save the serial number and the corresponding content of the header column. If the number of header columns is greater than 1 and the content in the header column cells is not repeated, connect and store the non-repeated content of multiple cells under the current serial number with "&&&". If there is only a header row or only a header column, the missing content is allowed to be empty.

[0113] (5.3) Traverse other cells except the header row and header column. If the content of the current cell is determined to be a numerical value through the regular expression "^\d+\.?\d*[~~]?\d*.?\d*$", obtain the row and column serial numbers of the current cell, and obtain the corresponding header row content and header column content through the row and column serial numbers to form a five-tuple knowledge element. The content of the five-tuple list is [cell numerical content, cell corresponding header row content, cell corresponding header row serial number, cell corresponding header column content, cell corresponding header column serial number]. If there is no header row, the cell corresponding header row content and cell corresponding header row serial number are allowed to be empty; if there is no header column, the cell corresponding header column content and cell corresponding header column serial number are allowed to be empty.

[0114] It should be noted that the sequence numbers of the steps in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. In practical applications, all the above possible implementation methods can be arbitrarily combined in a combined manner to form possible embodiments of this application, which will not be described in detail here.

[0115] Based on the methods for extracting numerical index knowledge elements from XML-formatted academic literature tables provided in the above embodiments, and based on the same inventive concept, this application also provides a device for extracting numerical index knowledge elements from XML-formatted academic literature tables.

[0116] Figure 6 This is a structural diagram of the numerical index knowledge element extraction device for XML format academic literature tables provided in this application embodiment. For example... Figure 6 As shown, the numerical index knowledge element extraction device for the XML format academic literature table may specifically include a first acquisition unit 610, an extension unit 620, a second acquisition unit 630, and an extraction unit 640.

[0117] The first acquisition unit 610 is used to acquire academic literature data in XML format, and determine the position of the table in the academic literature data through the first preset tag to obtain the initial table in the academic literature data.

[0118] The expansion unit 620 is used to expand the merged cells of the initial table to obtain the expanded table;

[0119] The second acquisition unit 630 is used to acquire the attribute content of the expanded table;

[0120] Extraction unit 640 is used to extract numerical indicator knowledge elements from the expanded table based on the attribute content of the expanded table.

[0121] This application embodiment provides a possible implementation, wherein the expansion unit 620 is further configured to:

[0122] Copy the contents of the merged row or column cells in the initial table back to the original non-merged unique cells to obtain the expanded table.

[0123] This application embodiment provides a possible implementation, wherein the expansion unit 620 is further configured to:

[0124] Iterate through the second preset label within the first preset label of the initial table;

[0125] Each second preset label is output as a list, where each element is the cell content corresponding to the third preset label within the second preset label. If the third preset label has a preset column attribute, the content of the corresponding cell in the current list is copied according to the number corresponding to the preset column attribute. The output format is [x1, x2, ... x...]. n ], where n is the number of columns in the cells, x1, x2, ... x n All values ​​represent the content of individual cells. If the third preset label has a preset row attribute, then while writing the content of the corresponding cell in the current list, the content of the cell in the newly created list is also written according to the number corresponding to the preset row attribute. Other positions in the newly created list are temporarily left empty. The output format is [[x1,x2,…x...]. n [,x2,…],,[,x2,…],…], where n is the number of columns in the cell. When the corresponding second preset label is encountered during subsequent traversal, the data of the third preset label corresponding to the second preset label is written to fill the empty list positions.

[0126] The final output format is [[x 11 ,x 12 ,…x 1n ],[x 21 ,x 22 ,…x 2n ],…[x m1 ,x m2 ,…x mn ]], where n is the number of columns in the table, m is the number of rows in the table, and x 11 ,x 12 ,…x 1n All of these are contents of a table, x 21 ,x 22 ,…x 2n All of these are contents of a table, x m1 ,x m2 ,…x mn All of these are table contents.

[0127] This application provides a possible implementation method in which the attribute content of the extended table includes one or more of the following: the number of table rows, the number of table columns, the number of table header rows, the number of table header columns, the content of the table header rows, and the content of the table header columns.

[0128] This application embodiment provides a possible implementation, wherein the second acquisition unit 630 is further configured to:

[0129] The last list of the results of the expanded table output [x m1 ,x m2 ,…x mn The text type in the list is determined from left to right according to a preset regular expression. If the regular expression matches the content, the corresponding cell content is determined to be a number; otherwise, it is a non-number. If all the content in the final list is determined to be a number, the expanded table is considered to be a vertical table with only row headers.

[0130] Take the last item from each sublist of the expanded table output to form a new list [x 1n ,x 2n ,…x mn The text type in the list is determined from left to right according to a preset regular expression. If the regular expression matches the content, the corresponding cell content is determined to be a number; otherwise, it is a non-number. If all the content in the final list is determined to be a number, the expanded table is considered to be a horizontal table with only column headers.

[0131] If [x] m1 ,x m2 ,…x mn ] and [x 1n ,x 2n ,…x mn If none of the contents of either final list are determined to be numerical, then the expanded table is determined to lack numerical indicators and the required numerical indicator knowledge elements. If both final lists contain numerical indicators, then the expanded table can be determined to be a numerical table. For numerical tables that only have row headers, the list is analyzed from left to right [x]. 1n ,x 2n ,…x mn Non-numeric elements can be used to obtain the number and content of row headings. If only column headings are available, the list is analyzed from left to right. m1 ,x m2 ,…x mn Non-numeric elements can be used to obtain the number and content of column headers. If both row and column headers exist, the number and content of header rows, as well as the number and content of header columns, can be determined by analyzing whether the first and third preset tags within the first and second preset tags of the XML file contain preset column attributes and preset row attributes, which are the corresponding first table in the upper left corner of the table.

[0132] This application embodiment provides a possible implementation, wherein the extraction unit 640 is further configured to:

[0133] Numerical index knowledge elements are extracted from the expanded table using the cross-multiplication extraction method, and the rows and columns of the expanded table are numbered starting from 1.

[0134] Based on the number and content of the header rows and the number and content of the header columns, save the serial number and the content corresponding to the header row and the content corresponding to the header column. If the number of header rows or the number of header columns is greater than 1 and the content in the header row cells or the content in the header column cells are unique, then store the unique content of multiple cells under the current serial number by connecting them with "&&&". If there are only header rows or only header columns, empty content is allowed.

[0135] Iterate through all cells except the header row and header column. If the current cell content is determined to be a number by a preset regular expression, obtain the row and column number of the current cell, and then obtain the corresponding header row and header column content through the row and column number, forming a 5-tuple knowledge element. The 5-tuple list includes the cell's numerical content, the corresponding header row content, the corresponding header row number, the corresponding header column content, and the corresponding header column number. If there is no cell row or column, the corresponding header row or header column content and the corresponding header row or header column number can be empty.

[0136] This application provides a possible implementation method. The cross-extraction method is that after determining that the cell is a numerical cell, the title content of the row and column where the cell is located can be obtained through the row and column, so as to know the specific content information expressed by the numerical value.

[0137] Compared with existing technical methods, the implementation of this invention achieves the extraction of numerical indicator knowledge elements from academic literature tables, effectively improving the efficiency of table numerical knowledge element extraction, and has the following advantages:

[0138] Expanding merged cells in a table facilitates the subsequent retrieval of table attributes, including the number of table rows, columns, header rows, header columns, content of header rows, and content of header columns. Expanding into a single table also greatly aids in the precise extraction of knowledge elements. A "cross-cutting extraction method" is proposed, which allows for simple and clear location of the cell containing the numerical value and precise determination of the information expressed by the value. This results in a unified output format, facilitating data storage and resolving the problem of unclear meaning and difficulty in utilizing subsequent numerical indicators.

[0139] Based on the same inventive concept, this application also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the numerical index knowledge element extraction method for XML format academic literature tables of any of the above embodiments.

[0140] In an exemplary embodiment, an electronic device is provided, such as Figure 7 As shown, Figure 7 The illustrated electronic device 700 includes a processor 701 and a memory 703. The processor 701 and the memory 703 are connected, for example, via a bus 702. Optionally, the electronic device 700 may also include a transceiver 704. It should be noted that in practical applications, the transceiver 704 is not limited to one type, and the structure of this electronic device 700 does not constitute a limitation on the embodiments of this application.

[0141] Processor 701 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 701 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0142] Bus 702 may include a pathway for transmitting information between the aforementioned components. Bus 702 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 702 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 7 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0143] The memory 703 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.

[0144] The memory 703 stores computer program code that executes the scheme of this application, and its execution is controlled by the processor 701. The processor 701 executes the computer program code stored in the memory 703 to implement the content shown in the foregoing method embodiments.

[0145] Among them, electronic devices include, but are not limited to: mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 7 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0146] Based on the same inventive concept, this application also provides a storage medium storing a computer program, wherein the computer program is configured to execute the method for extracting numerical index knowledge elements from XML format academic literature tables of any of the above embodiments at runtime.

[0147] Those skilled in the art will clearly understand that the specific working process of the systems, devices, and modules described above can be referred to the corresponding process in the foregoing method embodiments. For the sake of brevity, it will not be repeated here.

[0148] Those skilled in the art will understand that the technical solution of this application, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several program instructions to cause an electronic device (e.g., a personal computer, server, or network device) to execute all or part of the steps of the methods described in the embodiments of this application when running the program instructions. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0149] Alternatively, all or part of the steps of the foregoing method embodiments can be implemented by hardware (such as electronic devices like personal computers, servers, or network devices) associated with program instructions. The program instructions can be stored in a computer-readable storage medium. When the program instructions are executed by the processor of the electronic device, the electronic device executes all or part of the steps of the methods described in the embodiments of this application.

[0150] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that within the spirit and principles of this application, modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein; and these modifications or substitutions do not cause the corresponding technical solutions to leave the protection scope of this application.

Claims

1. A method for extracting numerical index knowledge elements from XML format academic literature tables, characterized in that, include: Acquire academic literature data in XML format, and determine the position of tables in the academic literature data using the first preset tag to obtain the initial tables in the academic literature data; The merged cells in the initial table are expanded to obtain the expanded table. Obtain the attribute content of the expanded table; Based on the attribute content of the expanded table, numerical indicator knowledge elements are extracted from the expanded table. The process involves expanding the merged cells of the initial table to obtain an expanded table, which includes: Copy the contents of the merged row or column cells in the initial table back to the original non-merged unique cells to obtain the expanded table; This includes copying and restoring the contents of merged row or column cells in the initial table to the original non-merged unique cells, including: Iterate through the second preset label within the first preset label of the initial table; Each second preset label is output as a list, and the elements in the list are the contents of the cells corresponding to the third preset label in the second preset label. If the third preset label has a preset column attribute, the contents of the corresponding cells are copied in the current list according to the number corresponding to the preset column attribute, and the output format is [x1, x2, … x n ], n is the number of columns of the cell, x1, x2, … x n are the contents of the cell; if the third preset label has a preset row attribute, the contents of the corresponding cells are written in the current list at the same time, and the contents of the cells are written in the newly created list at the corresponding position according to the number corresponding to the preset row attribute, and the other positions of the newly created list are temporarily left blank, and the output format is [[x1, x2, … x n ], [, x2, … ],, [, x2, … ], …], n is the number of columns of the cell, and when the corresponding second preset label is traversed subsequently, the data of the third preset label corresponding to the second preset label is written to fill the blank list position. The final output format is [[x 11 ,x 12 ,…x 1n ],[x 21 ,x 22 ,…x 2n ],…[x m1 ,x m2 ,…x mn ]]. n is the column number of the table, m is the row number of the table, x 11 ,x 12 ,…x 1n are the contents of the table, x 21 ,x 22 ,…x 2n are the contents of the table, x m1 ,x m2 ,…x mn are the contents of the table.

2. The method according to claim 1, characterized in that, The extended table's attributes include one or more of the following: the number of table rows, the number of table columns, the number of table header rows, the number of table header columns, the content of the table header rows, and the content of the table header columns.

3. The method according to claim 2, characterized in that, Obtain the attribute content of the expanded table, including: The last list [x m1 ,x m2 ,…x mn ] of the extended table output result is determined from left to right according to a preset regular expression to determine the text type in the list. If the content is matched by the regular expression, the corresponding cell content is determined as a numerical value, otherwise, it is determined as a non-numerical value. If all the contents in the final list are determined as numerical values, the extended table is considered as a vertical table with only row titles. Take the last content of each sub-list of the extended table output result to form a new list [x 1n ,x 2n ,…x mn ], and judge the text type in the list from left to right according to the preset regular expression. If the content is matched by the regular expression, the corresponding cell content is determined as a numerical value, otherwise as a non-numerical value. If all the contents in the final list are determined as numerical values, the extended table is considered as a horizontal table with only column titles. if [x m1 ,x m2 ,…x mn ] and [x 1n ,x 2n ,…x mn ] two final list all content is not determined as a numerical value, then determine that the extended table does not contain numerical indicators, no required numerical indicators knowledge element; if the two final list contains numerical indicators, it can be determined that the extended table is a numerical table, for numerical table if only row title, through the analysis of list [x 1n ,x 2n ,…x mn ] from left to right non numerical elements can get the number and content of row title, if only column title, through the analysis of list [x m1 ,x m2 ,…x mn ] from left to right non numerical elements can get the number and content of column title, if row and column title, by getting the first third preset label in the first second preset label of XML file, analysis whether contains the preset column attribute and the preset row attribute, that is, the first table in the upper left corner of the table in the table to determine the number and content of the title row, and the number and content of the title column.

4. The method according to claim 3, characterized in that, Based on the attribute content of the expanded table, numerical indicator knowledge elements are extracted from the expanded table, including: Numerical index knowledge elements are extracted from the expanded table using the cross-multiplication extraction method, and the rows and columns of the expanded table are numbered starting from 1. Based on the number and content of the header rows and the number and content of the header columns, save the serial number and the content corresponding to the header row and the content corresponding to the header column. If the number of header rows or the number of header columns is greater than 1 and the content in the header row cells or the content in the header column cells are unique, then store the unique content of multiple cells under the current serial number by connecting them with "&&&". If there are only header rows or only header columns, empty content is allowed. Iterate through all cells except the header row and header column. If the current cell content is determined to be a number by a preset regular expression, obtain the row and column number of the current cell, and then obtain the corresponding header row and header column content through the row and column number, forming a 5-tuple knowledge element. The 5-tuple list includes the cell's numerical content, the corresponding header row content, the corresponding header row number, the corresponding header column content, and the corresponding header column number. If there is no cell row or column, the corresponding header row or header column content and the corresponding header row or header column number can be empty.

5. The method according to claim 4, characterized in that, The cross-cutting extraction method involves determining that a cell is a numerical cell, and then using the row and column of the cell, obtaining the title content of the row and column, thus understanding the specific information represented by the numerical value.

6. A device for extracting numerical index knowledge elements from XML format academic literature tables, characterized in that, include: The first acquisition unit is used to acquire academic literature data in XML format, and determine the position of the table in the academic literature data through the first preset tag to obtain the initial table in the academic literature data. The expanded cell is used to expand the merged cells of the initial table to obtain an expanded table. The second acquisition unit is used to acquire the attribute content of the expanded table; The extraction unit is used to extract numerical indicator knowledge elements from the expanded table based on the attribute content of the expanded table. The extended cell is also used to: copy and restore the contents of the merged row or column cells of the initial table to the original non-merged unique cells to obtain the extended table; The extended unit is also used to: traverse the second preset label within the first preset label of the initial table; Each second preset label is output as a list, where each element is the cell content corresponding to the third preset label within the second preset label. If the third preset label has a preset column attribute, the content of the corresponding cell in the current list is copied according to the number corresponding to the preset column attribute. The output format is [x1, x2, ... x...]. n ], where n is the number of columns in the cells, x1, x2, ... x n All values ​​represent the content of individual cells. If the third preset label has a preset row attribute, then while writing the content of the corresponding cell in the current list, the content of the cell in the newly created list is also written according to the number corresponding to the preset row attribute. Other positions in the newly created list are temporarily left empty. The output format is [[x1,x2,…x...]. n [,x2,…], ,[,x2,…],…], where n is the number of columns in the cell. When the corresponding second preset label is encountered during subsequent traversal, the data of the third preset label corresponding to the second preset label is written to fill the empty list positions. The final output format is [[x 11 ,x 12 ,…x 1n ],[x 21 ,x 22 ,…x 2n ],…[x m1 ,x m2 ,…x mn ]], where n is the number of columns in the table, m is the number of rows in the table, and x 11 ,x 12 ,…x 1n All of these are contents of a table, x 21 ,x 22 ,…x 2n All of these are contents of a table, x m1 ,x m2 ,…x mn All of these are table contents.

7. An electronic device, characterized in that, The method includes a processor and a memory, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the numerical index knowledge element extraction method for XML format academic literature tables according to any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute, at runtime, the method for extracting numerical index knowledge elements from XML format academic literature tables according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Periodical literature table extraction method based on text state characteristics

    CN110968667A