Model training and table information extraction method and electronic device

By constructing an information extraction model based on neural networks and attention mechanisms, the problem of low efficiency and accuracy in table information extraction in existing technologies is solved, and efficient and accurate information extraction is achieved in tables with non-fixed formats.

CN115661844BActive Publication Date: 2026-07-24SHANGHAI HONGJI INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI HONGJI INFORMATION TECH CO LTD
Filing Date
2022-11-07
Publication Date
2026-07-24

Smart Images

  • Figure CN115661844B_ABST
    Figure CN115661844B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of information processing, and discloses a model training and table information extraction method and an electronic device. The method comprises the following steps: screening a to-be-extracted cell and an associated cell of the to-be-extracted cell from a table according to a preset screening rule; acquiring position information and text information corresponding to the to-be-extracted cell and the associated cell, respectively; and performing table information extraction based on the position information and the text information by using a pre-trained information extraction model to obtain table extraction information. In this way, the information extraction model is used to perform table information extraction based on the screened to-be-extracted cell and the associated cell, thereby improving the efficiency and accuracy of table information extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information processing technology, and more specifically, to methods and electronic devices for model training and table information extraction. Background Technology

[0002] In some scenarios, it is often necessary to extract all or part of the information from certain cells in a table. Current technology typically employs neural network models to process data from all cells in the entire table to extract the target content from a subset of cells.

[0003] However, this method requires processing all cells in the entire table, resulting in low efficiency and accuracy in extracting table information. Summary of the Invention

[0004] The purpose of this application is to provide a method and electronic device for model training and table information extraction, so as to improve the accuracy and efficiency of table information extraction.

[0005] On the one hand, a method for model training is provided, including:

[0006] Obtain sample cell data and extract sample information data from each table sample;

[0007] An initial information extraction model is adopted, which obtains table extraction information for each table based on cell sample data of each table sample; the initial information extraction model is built based on neural networks and attention mechanisms.

[0008] Based on the extracted information from each table sample, the sample data, and the extracted information from the tables, the model loss is determined.

[0009] Based on the model loss, the parameters of the initial information extraction model are adjusted to obtain a well-trained information extraction model.

[0010] In the above implementation process, an information extraction model can be obtained by training the model based on the training data.

[0011] In one implementation, the cell sample data includes: the cell sample's location information and text information, as well as the location information and text information of the cell sample's associated cells;

[0012] The extracted information sample data includes: extracting text samples, or extracting text samples and at least one of the following: extracting text location and text category.

[0013] In the above implementation process, data extraction is performed to obtain training data.

[0014] In one implementation, the model loss is determined based on the extracted information sample data and table extraction information of each table sample, including:

[0015] Based on the extracted text location, extracted text and text category in the table extracted information, and extracted text location, extracted text sample, and text category in the extracted information sample data, the model loss is determined.

[0016] In the above implementation process, the model loss can be determined based on the extracted text location, extracted text, and text category.

[0017] On the one hand, a method for extracting information from a table is provided, including:

[0018] According to the preset filtering rules, the cells to be extracted and their associated cells are filtered from the table.

[0019] Obtain the location information and text information corresponding to the cell to be extracted and the associated cells, respectively;

[0020] A pre-trained information extraction model is used to extract table information based on location and text information. The information extraction model is trained using the methods provided in various optional implementations of any of the above-mentioned model training methods.

[0021] In the above implementation process, cells are filtered, and an information extraction model based on neural networks and attention mechanisms is used to extract table information based on the filtered cells to be extracted and related cells, which improves the efficiency and accuracy of table information extraction.

[0022] In one implementation, a pre-trained information extraction model is used to extract table information based on location information and text information, obtaining table extraction information, including:

[0023] Based on the location information corresponding to the cell to be extracted and the associated cells, a cell position vector for each cell is generated. Then, an attention mechanism is used to obtain table extraction information based on the cell position vector and text information of each cell.

[0024] Alternatively, based on the location information corresponding to the cell to be extracted and the associated cells, cell location markers are generated for each cell, and the text information corresponding to each cell is updated based on the cell location markers. An attention mechanism is then used to obtain the table extraction information based on the updated text information.

[0025] In the above implementation process, different methods can be used to extract table information based on cell position and the position of each character corresponding to the cell text, thereby improving the efficiency and accuracy of information extraction.

[0026] In one implementation, the location information includes the cell's start row, end row, start column, and end column; based on the location information corresponding to the cell to be extracted and the associated cells, a cell position vector for each cell is generated, including:

[0027] For each target cell, based on the target cell's start row, end row, start column, and end column, generate the start row vector, end row vector, start column vector, and end column vector, respectively; the target cell is any cell among the cells to be extracted and related cells; the cell position vector includes the start row vector, end row vector, start column vector, and end column vector;

[0028] Alternatively, for the target cell in each cell, generate an average row vector based on the start and end rows of the target cell, and generate an average column vector based on the start and end columns of the target cell; the target cell is any cell in the cell to be extracted and the associated cells; the cell position vector includes the average row vector and the average column vector.

[0029] In the above implementation process, different methods can be used to indicate the cell position.

[0030] In one implementation, the text information includes cell text and the character sequence number of each character in the cell text; an attention mechanism is used to obtain table extraction information based on the cell position vector and text information of each cell, including:

[0031] For the target text in the text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character numbers. The target text is any cell text in each cell of the text information.

[0032] An attention mechanism is used to obtain table extraction information based on the cell position vector of each cell and the character position vector of the text in each cell.

[0033] In the above implementation process, table information is extracted based on the position vectors of cells and characters.

[0034] In one implementation, the text information includes cell text and the character sequence number of each character in the cell text; an attention mechanism is used to obtain table extraction information based on the updated text information, including:

[0035] For the target text in the updated text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character indices. The target text is any cell text in the cell text of the updated text information.

[0036] An attention mechanism is used to obtain table information based on the character position vectors of the text in each cell.

[0037] In the above implementation process, a combination of cell text and cell tags is used to extract table information.

[0038] In one implementation, the information extracted from the table includes extracted text, or extracted text and its corresponding text category.

[0039] In one implementation, according to preset filtering rules, the cells to be extracted and their associated cells are filtered from the table, including:

[0040] From the table, filter the cells to be extracted using at least one of the following methods: filter the cells to be extracted at a specified location; filter the cells to be extracted that match a set keyword; and filter the cells to be extracted that conform to a regular expression.

[0041] Cells in the same row and column as the cell to be extracted are identified as associated cells.

[0042] In the above implementation process, cells can be filtered according to preset filtering rules.

[0043] On the one hand, a device for model training is provided, comprising:

[0044] The acquisition unit is used to acquire cell sample data and extract information sample data from each table sample.

[0045] The acquisition unit is used to obtain table extraction information for each table based on the cell sample data of each table sample using the initial information extraction model; the initial information extraction model is built based on neural networks and attention mechanisms.

[0046] The determination unit is used to determine the model loss based on the extracted information sample data and table extracted information of each table sample;

[0047] The adjustment unit is used to adjust the parameters of the initial information extraction model based on the model loss, so as to obtain a trained information extraction model.

[0048] In one implementation, the cell sample data includes: the cell sample's location information and text information, as well as the location information and text information of the cell sample's associated cells;

[0049] The extracted information sample data includes: extracting text samples, or extracting text samples and at least one of the following: extracting text location and text category.

[0050] In one implementation, the determining unit is used to:

[0051] Based on the extracted text location, extracted text and text category in the table extracted information, and extracted text location, extracted text sample, and text category in the extracted information sample data, the model loss is determined.

[0052] On the one hand, an apparatus for extracting table information is provided, comprising:

[0053] The filter unit is used to filter out the cells to be extracted from the table, as well as the associated cells of the cells to be extracted, according to preset filtering rules.

[0054] The acquisition unit is used to acquire the location information and text information corresponding to the cell to be extracted and the associated cells, respectively.

[0055] The extraction unit is used to extract table information based on location information and text information using a pre-trained information extraction model to obtain table extracted information. The information extraction model is trained using the methods provided in various optional implementations of any of the above-mentioned model training methods.

[0056] In one embodiment, the extraction unit is used for:

[0057] Based on the location information corresponding to the cell to be extracted and the associated cells, a cell position vector for each cell is generated. Then, an attention mechanism is used to obtain table extraction information based on the cell position vector and text information of each cell.

[0058] Alternatively, based on the location information corresponding to the cell to be extracted and the associated cells, cell location markers are generated for each cell, and the text information corresponding to each cell is updated based on the cell location markers. An attention mechanism is then used to obtain the table extraction information based on the updated text information.

[0059] In one embodiment, the location information includes the cell's start row, end row, start column, and end column; the extraction unit is used for:

[0060] For each target cell, based on the target cell's start row, end row, start column, and end column, generate the start row vector, end row vector, start column vector, and end column vector, respectively; the target cell is any cell among the cells to be extracted and related cells; the cell position vector includes the start row vector, end row vector, start column vector, and end column vector;

[0061] Alternatively, for the target cell in each cell, generate an average row vector based on the start and end rows of the target cell, and generate an average column vector based on the start and end columns of the target cell; the target cell is any cell in the cell to be extracted and the associated cells; the cell position vector includes the average row vector and the average column vector.

[0062] In one embodiment, the text information includes cell text and the character sequence number of each character in the cell text; the extraction unit is used for:

[0063] For the target text in the text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character numbers. The target text is any cell text in each cell of the text information.

[0064] An attention mechanism is used to obtain table extraction information based on the cell position vector of each cell and the character position vector of the text in each cell.

[0065] In one embodiment, the text information includes cell text and the character sequence number of each character in the cell text; the extraction unit is used for:

[0066] For the target text in the updated text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character indices. The target text is any cell text in the cell text of the updated text information.

[0067] An attention mechanism is used to obtain table information based on the character position vectors of the text in each cell.

[0068] In one implementation, the information extracted from the table includes extracted text, or extracted text and its corresponding text category.

[0069] In one implementation, the filtering unit is used for:

[0070] From the table, filter the cells to be extracted using at least one of the following methods: filter the cells to be extracted at a specified location; filter the cells to be extracted that match a set keyword; and filter the cells to be extracted that conform to a regular expression.

[0071] Cells in the same row and column as the cell to be extracted are identified as associated cells.

[0072] On the one hand, an electronic device is provided, including a processor and a memory, the memory storing computer-readable instructions, which, when executed by the processor, perform the steps of the methods provided in various optional implementations of any of the above-described model training or tabular information extraction methods.

[0073] On the one hand, a computer-readable storage medium is provided on which a computer program is stored, which, when executed by a processor, performs the steps of the methods provided in various optional implementations of any of the above-described model training or tabular information extraction methods.

[0074] On the one hand, a computer program product is provided, which, when run on a computer, causes the computer to perform the steps of the methods provided in various optional implementations of any of the above-mentioned table information extraction methods.

[0075] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0076] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0077] Figure 1 A flowchart illustrating a model training method provided in this application embodiment;

[0078] Figure 2 A flowchart illustrating a method for extracting table information provided in this application embodiment;

[0079] Figure 3 An example diagram of a cell provided in an embodiment of this application;

[0080] Figure 4 A detailed flowchart illustrating a method for extracting table information provided in this application embodiment;

[0081] Figure 5 Example diagram of a method for extracting contract information provided in an embodiment of this application;

[0082] Figure 6 A structural block diagram of a model training apparatus provided in an embodiment of this application;

[0083] Figure 7 A structural block diagram of a device for extracting table information provided in an embodiment of this application;

[0084] Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0085] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0086] First, some of the terms used in the embodiments of this application will be explained to facilitate understanding by those skilled in the art.

[0087] Terminal devices can be mobile terminals, fixed terminals, or portable terminals, such as mobile phones, sites, units, devices, multimedia computers, multimedia tablets, internet nodes, communicators, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, personal communication system devices, personal navigation devices, personal digital assistants, audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio broadcast receivers, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices, or any combination thereof. It is also foreseeable that terminal devices can support any type of user-facing interface (e.g., wearable devices).

[0088] Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms.

[0089] In some application scenarios, it is often necessary to extract partial information from tables. Traditionally, the following methods are commonly used for table information extraction:

[0090] Method 1: Use Optical Character Recognition (OCR) technology to extract information from the table.

[0091] However, this method can only extract information from tables with fixed formats, and its applicability is limited.

[0092] Method 2: Extract table information using key-value pairs.

[0093] However, this method can only extract data from tables that contain fixed keys and have fixed value orientations. It is not suitable for scenarios where the table style is flexible, the keys are not fixed, the value orientations are not fixed, or the value is part of the content in a merged cell.

[0094] Method 3: Extract table information using a model.

[0095] However, this method requires the entire table information as model input, resulting in a large amount of data processing and low efficiency and accuracy in information extraction.

[0096] Therefore, a technical solution for extracting table information is needed that can be applied to various scenarios when extracting partial information from a table, such as scenarios with variable table styles, large table content, large table size, and large amounts of information to be extracted, and can improve the accuracy and efficiency of table information extraction. To address the above problems, embodiments of this application provide a method and electronic device for model training and table information extraction.

[0097] The embodiments of this application are applied to electronic devices, which can be servers or terminal devices.

[0098] In this embodiment of the application, before extracting table information, model training is performed to obtain an information extraction model for table information extraction. See also... Figure 1 The diagram shown is a flowchart of a model training method provided in an embodiment of this application. The specific implementation process of this method is as follows:

[0099] Step 100: Obtain cell sample data and extract information sample data for each table sample.

[0100] In one implementation, the cell sample data includes: the cell sample's location information and text information, as well as the location information and text information of the cell sample's associated cells.

[0101] Location information includes the cell's starting row, ending row, starting column, and ending column. Text information includes the cell text and the character number of each character within the cell text.

[0102] The extracted information sample data includes: extracting text samples, or extracting text samples and at least one of the following: extracting text location and text category.

[0103] The Extract Text Location is used to indicate the location of the extracted text or extracted text sample within the cell text.

[0104] As an example, the extracted text position is (start character number, end character number). The start character number is the character number of the first character in the extracted text or extracted text sample within the cell text, and the end character number is the character number of the last character in the extracted text or extracted text sample within the cell text.

[0105] In practical applications, the text category can be set according to the actual application scenario, and there are no restrictions here.

[0106] In one implementation, the following steps can be used to annotate cell samples in a table:

[0107] S1001: Based on business requirements, find the target content needed by the business from the table and use it as a text sample for extraction.

[0108] Optionally, the target content can be a single text or multiple texts, and can be located in one or more cells. A single cell can contain one or more texts from the target content.

[0109] S1002: Filter out the cells containing the extracted text samples from the table, use them as cell samples, and label the location information of the cell samples.

[0110] S1003: Mark the location of the extracted text sample in the cell text.

[0111] S1004: Label the text category of the extracted text sample.

[0112] In this way, we can obtain sample data containing cell sample location information, extracted text location, and text category.

[0113] As an example, in a shipping order, the target content to be extracted is: "Shipper", "Consignee", "English Name of Goods", and "Net Weight". Therefore, "Shipper", "Consignee", "English Name of Goods", and "Net Weight" are used as text samples for extraction. The cells containing "Shipper", "Consignee", "English Name of Goods", and "Net Weight" are then selected as cell samples. The starting row, ending row, starting column, and ending column of each cell sample are also marked. The starting and ending character numbers for "Shipper", "Consignee", "English Name of Goods", and "Net Weight" are also marked (i.e., the text extraction positions). Finally, the text categories for "Shipper", "Consignee", "English Name of Goods", and "Net Weight" are also identified.

[0114] This allows for the labeling of portions of the table according to business needs, rather than labeling the entire cell, reducing the manpower and time costs associated with model training.

[0115] In one implementation, based on the location information of the cell sample, cells in the same row or column as the cell sample are selected from the table and used as associated cells of the cell sample.

[0116] It should be noted that if the cell sample is a non-merged cell, then the starting and ending rows of the cell sample are the same row, and the starting and ending columns are the same column. If the cell sample is a merged cell, then the cell sample corresponds to multiple rows and / or multiple columns.

[0117] In this context, all cells that are crossed by the same row in the table are considered to be cells in the same row, and all cells that are crossed by the same column in the table are considered to be cells in the same column.

[0118] In this way, we can construct cross-shaped training samples according to the row and column structure of the table, that is, use the text information of related cells in the same row or column as the text information of the cell sample as the context of the text information of the cell sample.

[0119] Step 101: Using the initial information extraction model, based on the cell sample data of each table sample, obtain the table extraction information of each table.

[0120] Specifically, the cell sample data of each table sample is input into the initial information extraction model to obtain the table extraction information corresponding to each table.

[0121] The initial model for information extraction is based on neural networks and attention mechanisms.

[0122] As an example, an initial model for information extraction is built based on the Transformer model and the sequence labeling module. The sequence labeling module is used to construct the position vectors of text or cells. Information extraction from tables includes extracting text and text categories.

[0123] In this way, by using cells in the same row and column, the contextual information of the cell samples is constructed, and based on the Transformer, a cross-shaped attention mechanism is formed, taking the cell text and cell position as the model input, thereby transforming the Transformer network originally used for natural text into a Transformer network for tables.

[0124] Furthermore, the initial information extraction model can also output the location of the extracted text.

[0125] In one implementation, step 101 can be performed in any of the following ways:

[0126] Method 1: Based on the position information corresponding to the cell samples and related cells, generate cell position vectors for each cell, and use an attention mechanism to obtain table extraction information based on the cell position vectors and text information of each cell.

[0127] Method 2: Based on the location information corresponding to the cell samples and related cells, generate cell location markers for each cell, update the text information corresponding to each cell based on the cell location markers, and use an attention mechanism to obtain table extraction information based on the updated text information.

[0128] The text information includes cell text and the character number of each character in the cell text; the updated text information contains cell position markers.

[0129] In one implementation, the cell position vector can be generated in any of the following ways:

[0130] Method 1: For each target cell, generate a starting row vector, an ending row vector, a starting column vector, and an ending column vector based on the starting row, ending row, starting column, and ending column of the target cell.

[0131] The target cell is any cell in the cell sample and associated cells; the cell position vector includes the starting row vector, the ending row vector, the starting column vector, and the ending column vector.

[0132] Method 2: For the target cell in each cell, generate an average row vector based on the start and end rows of the target cell, and generate an average column vector based on the start and end columns of the target cell.

[0133] The target cell is any cell in the cell sample and the associated cells; the cell position vector includes the average row vector and the average column vector.

[0134] In one implementation, average pooling is used to calculate the average of all row vectors from the starting row vector to the ending row vector, thus obtaining the average row vector. Similarly, average pooling is used to calculate the average of all column vectors from the starting column vector to the ending column vector, thus obtaining the average column vector.

[0135] In one implementation, when using an attention mechanism to obtain table extraction information based on the cell position vector and text information of each cell, the following steps can be taken:

[0136] For the target text in the text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character indices. The target text is any cell text in each cell of the text information. An attention mechanism is used to obtain table extraction information based on the cell position vector of each cell and the character position vector of each cell text.

[0137] In this embodiment, the character position relationship of the target text is represented by position embedding. Position embedding is an object represented by a numerical vector. Since the text in each cell does not have a linear order like natural language, the character position vector (position embedding) of each cell text is calculated starting from 0, that is, the character sequence number in each cell text is calculated independently.

[0138] In one implementation, when updating the text information corresponding to each cell based on the cell position markers, the following steps can be used:

[0139] For the target cell, the starting row, ending row, starting column, and ending column of the target cell are determined as the four cell position tokens of the target cell. Each cell position token is then inserted into the cell text of the target cell (e.g., inserted at the beginning of the cell text) to obtain the updated cell text, that is, the updated text information.

[0140] In one implementation, an attention mechanism is used to obtain table extraction information based on updated text information, including:

[0141] For the target text in the updated text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character indices. The target text is any cell text in the cell text of the updated text information.

[0142] An attention mechanism is used to obtain table information based on the character position vectors of the text in each cell.

[0143] Step 102: Determine the model loss based on the extracted sample data and table information of each table sample.

[0144] In one implementation, step 102 can be performed in any of the following ways:

[0145] Method 1: If the information extracted from the table includes extracted text, and the sample data of the extracted information includes extracted text samples, then the model loss is determined based on the extracted text from the table samples and the extracted text samples.

[0146] Method 2: If the information extracted from the table includes extracted text and text categories, and the information sample data includes extracted text samples and text categories, then the model loss is determined based on the extracted text and text categories of the table samples, as well as the extracted text samples and text categories.

[0147] Method 3: If the table extraction information includes extracted text and extracted text location, and the extracted information sample data includes extracted text sample and extracted text location, then the model loss is determined based on the extracted text and extracted text location of the table sample, as well as the extracted text sample and extracted text location.

[0148] Method 4: The table extraction information includes extracted text, extracted text location, and text category. The extracted information sample data includes extracted text sample, extracted text location, and text category. Then, the model loss is determined based on the extracted text, extracted text location, and text category of the table sample, as well as the extracted text sample, extracted text location, and text category.

[0149] Step 103: Adjust the parameters of the initial information extraction model based on the model loss to obtain a trained information extraction model.

[0150] In one implementation, if it is determined that the model loss is higher than the set loss, steps 101-103 are executed repeatedly until it is determined that the model loss is lower than the set loss, and a trained information extraction model is obtained.

[0151] In practical applications, the loss setting can be adjusted according to the actual application scenario, and there are no restrictions here.

[0152] See Figure 2 The diagram shown is a flowchart of a method for extracting table information according to an embodiment of this application. Figure 2 Combination Figure 1 The obtained information extraction model is used to extract tabular information. The specific implementation process of this method is as follows:

[0153] Step 200: According to the preset filtering rules, filter out the cells to be extracted and their associated cells from the table.

[0154] In one implementation, when performing step 200, the following steps may be used:

[0155] S2001: From the table, filter out the cells to be extracted using at least one of the following methods:

[0156] Method 1: Filter out the cells to be extracted from the specified locations.

[0157] As an example, the last row of the table is used as the cell to be extracted.

[0158] Method 2: Filter out the cells to be extracted that match the set keywords.

[0159] As an example, the keywords will be matched against the text in each cell of the table, and the cells corresponding to the matched text will be used as the cells to be extracted.

[0160] As another example, for cells containing key-value pairs, filter out the cells whose text matches the set key (e.g., name) and use them as the cells to be extracted.

[0161] It should be noted that the match can be exactly the same, or it can be a match with semantic or textual similarity higher than the set similarity (e.g., 0.8), and there are no restrictions here.

[0162] For example, in a shipping order, we need to extract information such as "Shipper" and "English name of goods". Common names include "Shipper", "SHIPPER", "Description of Goods", "GOOD DESC", and "DESC". Although the names are not fixed, after collecting these names, we can use them as keywords and use a similarity matching algorithm to find the cells containing the matching text in the table. Then, we can use the selected cells (i.e., the cells to be extracted) as anchor points.

[0163] In this way, we can use similarity matching to filter out cells from the table that contain text that matches the key or characteristic valve in the key-value pair.

[0164] Method 3: Filter out cells that match the regular expression to be extracted.

[0165] In practical applications, preset filtering rules, specified locations, keywords, similarity settings, and regular expressions can all be set according to the actual application scenario, and there are no restrictions here.

[0166] It should be noted that filtering (i.e., cell recall) of the cells in the table is necessary to extract the required content. This aims to reduce unnecessary reasoning and improve the efficiency of information extraction. Without recall, each cell needs to be used as an anchor point for cross-referencing to obtain the context of each cell (i.e., the text information of related cells).

[0167] S2002: Identify cells in the same row and column as the cell to be extracted as associated cells.

[0168] Step 201: Obtain the location information and text information corresponding to the cell to be extracted and the associated cells, respectively.

[0169] In this way, based on the row and column information of the table, the context cell data of the cell in the same row and column to be extracted can be obtained by using a cross-cutting method.

[0170] Step 202: Using a pre-trained information extraction model, based on location information and text information, extract table information to obtain table extracted information.

[0171] The information extraction model is built on neural networks and attention mechanisms.

[0172] In one implementation, the location information and text information corresponding to the cell to be extracted and the associated cells are input into the information extraction model to obtain the extracted text of each cell to be extracted, or the extracted text and text category. If there are multiple extracted texts, the extracted texts are merged.

[0173] Furthermore, if the recognition results (i.e., different extracted texts) for a certain business information (e.g., the age of a student) are different, text filtering can be performed according to the set business filtering rules (e.g., retaining the extracted texts contained in the set of business information) or text confidence probability (retaining the extracted texts with text confidence probability).

[0174] In practical applications, the text confidence probability can be output by the information extraction model, and the business filtering rules can be set according to the actual application scenario, without any restrictions here.

[0175] In one implementation, step 202 can be performed in any of the following ways:

[0176] Method 1: Based on the location information of the cell to be extracted and the associated cells, generate the cell position vector of each cell, and use an attention mechanism to obtain the table extraction information based on the cell position vector and text information of each cell.

[0177] Method 2: Based on the location information of the cell to be extracted and the associated cells, generate cell location markers for each cell, update the text information corresponding to each cell based on the cell location markers, and use an attention mechanism to obtain table extraction information based on the updated text information.

[0178] For the specific steps of Method 1 and Method 2 mentioned above, please refer to step 101 above, which will not be repeated here.

[0179] The following example uses a specific application scenario to illustrate the table from which information needs to be extracted. In the shipping industry, it is necessary to extract various information from the shipping documents submitted by customers, such as the English name of the goods, container type and quantity, number of pieces, net weight, gross weight, volume, hazard class, and UN number, etc. The extracted information will then be entered into a system, such as the System Applications and Products (SAP) system.

[0180] These requests have the following characteristics: The requests are primarily in document format (Word) and spreadsheet format (Excel); the information to be extracted is mainly stored in the spreadsheet; the spreadsheet format is completely variable, with almost every client having their own style, and cross-row / column layouts are common; it's frequent for a single cell to contain multiple pieces of information that need to be extracted separately (it's not possible to extract just the entire cell; different information must be extracted from the contents of a single cell). Some of the information to be extracted lacks a corresponding key, making key-value pairs unusable.

[0181] See Figure 3 The image shown is an example of a cell. A single cell needs to extract multiple pieces of information: the English name of the goods, the quantity, the hazard class, and the UN number. However, the quantity, hazard class, and UN number do not have corresponding keys.

[0182] See Figure 4 The diagram shown is a detailed implementation flowchart of a method for extracting information from a table. Figure 4 The method for extracting information from tables Figure 3 Extract information from the cells shown to perform the following steps: Figure 2 The method for extracting information from tables is illustrated with an example. The specific process of this method is as follows:

[0183] Step 400: Parse the target file to obtain the table from which the information to be extracted.

[0184] Optionally, the target file can be a Word or Excel file. As an example, the target file is parsed to obtain tabular data in JavaScript Object Notation (JSON) format, which is convenient for subsequent data processing.

[0185] Step 401: Filter the cells to be extracted from the table according to the preset filtering rules.

[0186] Specifically, different methods can be used to filter the cells to be extracted depending on the situation.

[0187] Scenario 1: For the English name of the goods, there is usually a corresponding key, such as "Description of Good" and "DESC". You can then perform similarity matching based on the key to obtain the cell to be extracted.

[0188] For example: For the English names of goods, common names collected ["Description of Good", "DESC"] are used as keywords, and the text in each cell of the table is matched against ["Description of Good", "DESC"]. Because... Figure 3 The cell shown contains "Packages / Description of Goods", therefore, confirm. Figure 3 The cell shown is the cell to be extracted that matches ["Description of Good", "DESC"].

[0189] Scenario 2: For hazard class and UN number, there is usually no key, but the values ​​are numbers such as X[.Y] and XXXX. Therefore, the cells to be extracted can be filtered by rule matching (i.e. regular expressions).

[0190] For example, set a regular expression to find cells whose text contains 4 digits, 1 digit, or 2 digits with a period in the middle, and use these as the cells to be extracted.

[0191] In this way, the actual hazard class and UN number of the material can be extracted from the table using the cell to be extracted.

[0192] Scenario 3: Regarding the number of items, since there may or may not be a key, we can first use the key to search for the cell to be extracted. If it is not found, considering that its value often contains units such as drum / carton / CTN, we can construct a regular expression based on drum / carton / CTN and use the regular expression to search for the cell to be extracted.

[0193] For example, common names for quantity of items are ["Quantity of Items", "Quantity or Size", "No. of Containers or Package", "P'KGS"]. Therefore, we use these common names as keywords and employ keyword matching to find the cells to be extracted. If no match is found, we can use regular expressions to search for cells in the table containing ["DRUM", "CARTON", "CTN"].

[0194] Step 402: Obtain the location and text information of the cell to be extracted and its corresponding associated cells.

[0195] Step 403: Using a pre-trained information extraction model, based on location information and text information, extract table information to obtain each extracted text and its corresponding text category.

[0196] Step 404: Merge each extracted text and its corresponding text category to obtain the table extraction information.

[0197] Specifically, the steps 400-404 can be found in steps 200-202 above, and will not be repeated here.

[0198] The above embodiments will be illustrated using another application scenario.

[0199] In corporate lending, banks sometimes grant credit and loans based on the business contracts (sales contracts) of loan applicants. Therefore, banks need to extract necessary information from these contracts and input it into their systems. This typically includes the names of the buyer and seller, the name of the goods, the quantity, and the amount. This information may be present in the contract's plain text or in tables (e.g., name of goods, quantity, and amount). Since these are contracts between the buyer and seller, banks have no binding force on their format; therefore, contract styles and table styles vary widely, often containing cells that span multiple rows and columns. Therefore, it is possible to extract the target content from the plain text of the contract and use... Figure 2 The method for extracting table information is used to extract target content from tables within a contract.

[0200] See Figure 5 The diagram shown is an example of a method for extracting contract information.

[0201] Step 500: Parse the target file to obtain the text content and tables in the target file, and then execute steps 501 and 503 respectively.

[0202] Step 501: Segment the text content to obtain multiple text information.

[0203] Step 502: Use keyword matching to extract each piece of text information to obtain the extracted text information, and then proceed to step 506.

[0204] Step 503: According to the preset filtering rules, filter out the cells to be extracted and the related cells of the cells to be extracted from the table.

[0205] Step 504: Obtain the location information and text information corresponding to the cell to be extracted and the associated cells, respectively.

[0206] Step 505: Using a pre-trained information extraction model, based on location information and text information, extract table information to obtain table extracted information.

[0207] Step 506: Merge the extracted text information and the extracted table information to obtain the contract extraction result.

[0208] In this embodiment, cells to be extracted are selected from the table, and an information extraction model is used to extract table information based on the position and text information of the cells to be extracted and their corresponding related cells. The information extraction model does not need to process the entire table. In this way, even for a large table (e.g., filling an entire A4 sheet of paper), the size of the model input data (e.g., the size of the cells to be extracted and their corresponding related cells) usually does not exceed the maximum input of the information extraction model (e.g., maximum input size = 512), thus enabling large tables to obtain better information extraction and improving the applicability of table information extraction.

[0209] Furthermore, by utilizing the contextual approach of constructing anchor points within the same row and column, a cross-junction attention mechanism is implemented in the information extraction model. This reduces the input of irrelevant cells, improves the efficiency of the attention mechanism, lowers the difficulty of model training, and enhances the accuracy of table information extraction. Additionally, sequence labeling is employed to locate the individual character positions within cells, allowing for the extraction of only a portion of the cell's content rather than the entire text, further improving the efficiency and accuracy of table information extraction. Moreover, this approach is applicable to tables containing merged cells spanning multiple rows and columns, and is suitable for various table styles, demonstrating broad applicability.

[0210] Based on the same inventive concept, this application also provides a model training apparatus. Since the principle of the above apparatus and device in solving the problem is similar to that of a model training method, the implementation of the above apparatus can refer to the implementation of the method, and the repeated parts will not be described again.

[0211] like Figure 6 As shown, it is a schematic diagram of the structure of a model training device provided in an embodiment of this application, including:

[0212] The acquisition unit 601 is used to acquire cell sample data and extract information sample data from each table sample.

[0213] Unit 602 is used to obtain table extraction information for each table based on cell sample data of each table sample using the initial information extraction model; the initial information extraction model is built based on neural networks and attention mechanisms.

[0214] The determination unit 603 is used to determine the model loss based on the extracted information sample data and table extracted information of each table sample;

[0215] The adjustment unit 604 is used to adjust the parameters of the initial information extraction model according to the model loss, so as to obtain a trained information extraction model.

[0216] In one implementation, the cell sample data includes: the cell sample's location information and text information, as well as the location information and text information of the cell sample's associated cells;

[0217] The extracted information sample data includes: extracting text samples, or extracting text samples and at least one of the following: extracting text location and text category.

[0218] In one implementation, the determining unit is used for 603:

[0219] Based on the extracted text location, extracted text and text category in the table extracted information, and extracted text location, extracted text sample, and text category in the extracted information sample data, the model loss is determined.

[0220] Based on the same inventive concept, this application also provides a device for extracting table information. Since the principle of the above-mentioned device and equipment in solving the problem is similar to that of a method for extracting table information, the implementation of the above-mentioned device can refer to the implementation of the method, and the repeated parts will not be described again.

[0221] like Figure 7 The diagram shown is a structural schematic of a device for extracting table information according to an embodiment of this application, comprising:

[0222] The filtering unit 701 is used to filter out the cells to be extracted and the associated cells of the cells to be extracted from the table according to the preset filtering rules.

[0223] The acquisition unit 702 is used to acquire the location information and text information corresponding to the cell to be extracted and the associated cell, respectively.

[0224] The extraction unit 703 is used to extract table information based on location information and text information using a pre-trained information extraction model to obtain table extraction information. The information extraction model is trained using the method provided in the above embodiments.

[0225] In one embodiment, the extraction unit 703 is used for:

[0226] Based on the location information corresponding to the cell to be extracted and the associated cells, a cell position vector for each cell is generated. Then, an attention mechanism is used to obtain table extraction information based on the cell position vector and text information of each cell.

[0227] Alternatively, based on the location information corresponding to the cell to be extracted and the associated cells, cell location markers are generated for each cell, and the text information corresponding to each cell is updated based on the cell location markers. An attention mechanism is then used to obtain the table extraction information based on the updated text information.

[0228] In one embodiment, the location information includes the cell's start row, end row, start column, and end column; the extraction unit 703 is used for:

[0229] For each target cell, based on the target cell's start row, end row, start column, and end column, generate the start row vector, end row vector, start column vector, and end column vector, respectively; the target cell is any cell among the cells to be extracted and related cells; the cell position vector includes the start row vector, end row vector, start column vector, and end column vector;

[0230] Alternatively, for the target cell in each cell, generate an average row vector based on the start and end rows of the target cell, and generate an average column vector based on the start and end columns of the target cell; the target cell is any cell in the cell to be extracted and the associated cells; the cell position vector includes the average row vector and the average column vector.

[0231] In one embodiment, the text information includes cell text and the character sequence number of each character in the cell text; the extraction unit 703 is used for:

[0232] For the target text in the text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character numbers. The target text is any cell text in each cell of the text information.

[0233] An attention mechanism is used to obtain table extraction information based on the cell position vector of each cell and the character position vector of the text in each cell.

[0234] In one embodiment, the text information includes cell text and the character sequence number of each character in the cell text; the extraction unit 703 is used for:

[0235] For the target text in the updated text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character indices. The target text is any cell text in the cell text of the updated text information.

[0236] An attention mechanism is used to obtain table information based on the character position vectors of the text in each cell.

[0237] In one implementation, the information extracted from the table includes extracted text, or extracted text and its corresponding text category.

[0238] In one embodiment, the screening unit 701 is used for:

[0239] From the table, filter the cells to be extracted using at least one of the following methods: filter the cells to be extracted at a specified location; filter the cells to be extracted that match a set keyword; and filter the cells to be extracted that conform to a regular expression.

[0240] Cells in the same row and column as the cell to be extracted are identified as associated cells.

[0241] The model training and table information extraction method and electronic device provided in this application embodiment, according to preset filtering rules, selects cells to be extracted and their associated cells from the table; obtains the position information and text information corresponding to the cells to be extracted and their associated cells, respectively; and uses a pre-trained information extraction model to extract table information based on the position information and text information to obtain the extracted table information. The information extraction model is built based on neural networks and attention mechanisms. Thus, by using an information extraction model built based on neural networks and attention mechanisms to extract table information based on the selected cells to be extracted and their associated cells, the efficiency and accuracy of table information extraction are improved.

[0242] Figure 8 A schematic diagram of the structure of an electronic device 8000 is shown. (See attached diagram.) Figure 8 As shown, the electronic device 8000 includes a processor 8010 and a memory 8020, and optionally may also include a power supply 8030, a display unit 8040, and an input unit 8050.

[0243] The processor 8010 is the control center of the electronic device 8000. It connects various components through various interfaces and lines, and performs various functions of the electronic device 8000 by running or executing software programs and / or data stored in the memory 8020, thereby performing overall monitoring of the electronic device 8000.

[0244] In this embodiment, when the processor 8010 calls the computer program stored in the memory 8020, it executes the steps in the above embodiments.

[0245] Optionally, the processor 8010 may include one or more processing units; preferably, the processor 8010 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 8010. In some embodiments, the processor and memory may be implemented on a single chip; in some embodiments, they may also be implemented separately on independent chips.

[0246] The memory 8020 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, various applications, etc.; the data storage area may store data created based on the use of the electronic device 8000, etc. In addition, the memory 8020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0247] The electronic device 8000 also includes a power supply 8030 (such as a battery) that supplies power to various components. The power supply can be logically connected to the processor 8010 through a power management system, thereby enabling the management of charging, discharging, and power consumption.

[0248] The display unit 8040 can be used to display information input by the user or information provided to the user, as well as various menus of the electronic device 8000. In this embodiment of the invention, it is mainly used to display the display interfaces of various applications in the electronic device 8000, as well as text, images, and other objects displayed on the display interfaces. The display unit 8040 may include a display panel 8041. The display panel 8041 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0249] The input unit 8050 can be used to receive information such as numbers or characters input by the user. The input unit 8050 may include a touch panel 8051 and other input devices 8052. The touch panel 8051, also known as a touch screen, can collect touch operations on or near the user (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 8051).

[0250] Specifically, the touch panel 8051 can detect user touch operations and the signals generated by these operations, convert them into touch point coordinates, send them to the processor 8010, and receive and execute commands from the processor 8010. Furthermore, the touch panel 8051 can be implemented using various types of sensors, including resistive, capacitive, infrared, and surface acoustic wave sensors. Other input devices 8052 can include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0251] Of course, the touch panel 8051 can cover the display panel 8041. When the touch panel 8051 detects a touch operation on or near it, it transmits the information to the processor 8010 to determine the type of touch event. Subsequently, the processor 8010 provides corresponding visual output on the display panel 8041 based on the type of touch event. Although in Figure 8 In this embodiment, the touch panel 8051 and the display panel 8041 are two separate components to realize the input and output functions of the electronic device 8000. However, in some embodiments, the touch panel 8051 and the display panel 8041 can be integrated to realize the input and output functions of the electronic device 8000.

[0252] The electronic device 8000 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity sensor, etc. Of course, depending on the specific application, the electronic device 8000 may also include other components such as a camera. Since these components are not the focus of this application's embodiments, therefore... Figure 8 It is not shown in the text and will not be described in detail here.

[0253] Those skilled in the art will understand that Figure 8 This is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than shown, or a combination of certain components, or different components.

[0254] In this embodiment of the application, a computer-readable storage medium stores a computer program thereon. When the computer program is executed by a processor, it enables a communication device to perform the various steps in the above embodiments.

[0255] For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this application, the functions of each module (or unit) can be implemented in one or more software or hardware components.

[0256] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0257] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0258] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0259] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0260] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0261] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for training a model, characterized in that, include: Obtain cell sample data and extracted information sample data for each table sample. The cell sample data includes: cell sample location information and text information, as well as the location information and text information of the associated cells of the cell sample. The extracted information sample data includes: extracted text samples, or extracted text samples and at least one of the following: extracted text location and text category. An initial information extraction model is adopted, which obtains table extraction information for each table based on cell sample data of each table sample; the initial information extraction model is built based on neural networks and attention mechanisms. Based on the extracted information from each table sample, the sample data, and the extracted information from the tables, the model loss is determined. Based on the model loss, the parameters of the initial information extraction model are adjusted to obtain a trained information extraction model; The method of adopting an initial information extraction model, based on cell sample data of each table sample, to obtain table extraction information for each table, includes: Based on the position information corresponding to the cell samples and the associated cells, a cell position vector for each cell is generated. Then, an attention mechanism is used to obtain table extraction information based on the cell position vectors and text information of each cell. Alternatively, based on the location information corresponding to the cell sample and the associated cell, a cell location marker is generated for each cell, and the text information corresponding to each cell is updated based on the cell location marker. An attention mechanism is then used to obtain table extraction information based on the updated text information. The location information includes the cell's start row, end row, start column, and end column; the generation of the cell position vector for each cell based on the cell sample and the location information corresponding to the associated cells includes: For each target cell in the cell set, a starting row vector, an ending row vector, a starting column vector, and an ending column vector are generated based on the starting row, ending row, starting column, and ending column of the target cell. The target cell is any cell in the cell sample and the associated cells. The cell position vector includes the starting row vector, the ending row vector, the starting column vector, and the ending column vector. Alternatively, for the target cell in each cell, an average row vector is generated based on the starting and ending rows of the target cell, and an average column vector is generated based on the starting and ending columns of the target cell, wherein the target cell is any cell in the cell sample and the associated cells; the cell position vector includes the average row vector and the average column vector.

2. The method as described in claim 1, characterized in that, The step of determining the model loss based on the extracted sample data and table information from each table sample includes: Based on the extracted text location output by the initial model for information extraction, the extracted text and text category in the table extracted information, and the extracted text location, extracted text sample, and text category in the extracted information sample data, the model loss is determined.

3. A method for extracting information from a table, characterized in that, include: According to the preset filtering rules, the cells to be extracted and their associated cells are filtered from the table; Obtain the location information and text information corresponding to the cell to be extracted and the associated cell, respectively; A pre-trained information extraction model is used to extract table information based on the location information and the text information to obtain table extraction information. The information extraction model is trained using the model training method described in any one of claims 1-2. The step of using a pre-trained information extraction model to extract table information based on the location information and the text information, and obtaining table extraction information, includes: Based on the location information corresponding to the cell to be extracted and the associated cell, a cell position vector for each cell is generated. Then, using an attention mechanism, the table extraction information is obtained based on the cell position vector and text information of each cell. Alternatively, based on the location information corresponding to the cell to be extracted and the associated cell, a cell location marker is generated for each cell, and the text information corresponding to each cell is updated based on the cell location marker. An attention mechanism is then used to obtain the table extraction information based on the updated text information. The location information includes the cell's start row, end row, start column, and end column; the step of generating a cell position vector for each cell based on the location information corresponding to the cell to be extracted and the associated cells includes: For each target cell, a starting row vector, an ending row vector, a starting column vector, and an ending column vector are generated based on the starting row, ending row, starting column, and ending column of the target cell, respectively; the target cell is any cell among the cell to be extracted and the associated cells; the cell position vector includes the starting row vector, the ending row vector, the starting column vector, and the ending column vector; Alternatively, for the target cell in each cell, an average row vector is generated based on the starting and ending rows of the target cell, and an average column vector is generated based on the starting and ending columns of the target cell; the target cell is any cell among the cell to be extracted and the associated cells; the cell position vector includes the average row vector and the average column vector.

4. The method as described in claim 3, characterized in that, The text information includes cell text and the character sequence number of each character in the cell text; the attention mechanism is used to obtain the table extraction information based on the cell position vector and text information of each cell, including: For the target text in the text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character numbers. The target text is any cell text in each cell text in the text information. An attention mechanism is used to obtain the table extraction information based on the cell position vector of each cell and the character position vector of the text in each cell.

5. The method as described in claim 3, characterized in that, The text information includes cell text and the character number of each character in the cell text; the attention mechanism is used to obtain the table extraction information based on the updated text information, including: For the target text in the updated text information, a character position vector of the target text is generated based on the characters in the target text and their corresponding character numbers, wherein the target text is any cell text in the cell text of the updated text information; An attention mechanism is used to obtain the table extraction information based on the character position vectors of the text in each cell.

6. The method according to any one of claims 3-5, characterized in that, The information extracted from the table includes extracted text, or extracted text and its corresponding text category.

7. The method according to any one of claims 3-5, characterized in that, The step of filtering the cells to be extracted from the table according to preset filtering rules, and the associated cells of the cells to be extracted, includes: From the table, the cells to be extracted are filtered out according to at least one of the following methods: filtering cells to be extracted at a specified position; filtering cells to be extracted that match a set keyword; and filtering cells to be extracted that conform to a regular expression. Cells in the same row and column as the cell to be extracted are identified as the associated cells.

8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing computer-readable instructions, which, when executed by the processor, perform the method as described in any one of claims 1-2 or 3-7.