Table relationship analysis method and device, computer device, and storage medium
By using a table relationship analysis model, feature encoders and decoders are used to identify word and cell relationships in tables, solving the problem of low analysis efficiency in existing technologies and achieving efficient end-to-end table relationship analysis.
Patent Information
- Application Number
- CN202410038192.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-09
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2044-01-09
AI Technical Summary
Existing tabular relationship analysis techniques lack versatility, require multi-stage processing and multiple independent components, resulting in high information transmission complexity and computational overhead, thus reducing analysis efficiency.
A table relationship analysis model, including a feature encoder, a feature decoder, and a relationship analysis network, is used to identify words in the table in an end-to-end manner, generate cell-encoded features, and identify the pairing relationships between cells.
It enables end-to-end table relationship analysis, improves analysis efficiency, reduces dependence on multiple independent components, and enhances the versatility and accuracy of modeling.
Smart Images

Figure CN118015639B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence and financial technology, and in particular to a method, apparatus, computer device and storage medium for tabular relational analysis. Background Technology
[0002] Tables are an important means of organizing and structuring data. In many scenarios, to prevent tampering and ensure the accuracy of table content, tables are often presented as images after creation. When automatically extracting and analyzing information, it is frequently necessary to use computers to obtain the text within the table image and the relationships between those texts. For example, in the financial and accounting fields, it is necessary to automatically extract information from table cells and analyze the relationships between them.
[0003] Current table relationship analysis techniques employ multi-stage systems, first extracting textual representations and then constructing relationships between texts. This requires designing different feature engineering and processing flows based on different table types and tasks, lacking universality. Furthermore, relying on multiple independent components necessitates transmitting information to multiple components, increasing the complexity of information transmission and computational overhead, thus reducing the efficiency of table relationship analysis. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, computer device, and storage medium for table relationship analysis, so as to improve the efficiency of table relationship analysis.
[0005] To address the aforementioned technical problems, this application provides a table relationship analysis method, employing the following technical solution:
[0006] Obtain the target table and identify each word element in the target table;
[0007] Discrete features of each word are obtained through a feature encoder in a table relation analysis model, which includes the feature encoder, feature decoder, and relation analysis network.
[0008] The discrete features of each word are input into the feature decoder, so that the feature decoder determines the cell instance to which each word belongs based on the feature sequence of each cell instance, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs. The feature sequence of each cell instance is obtained in advance through model training, and the cell instance is the instance within the cell of the table.
[0009] The at least one cell encoding feature is input into the relationship analysis network to obtain the pairing relationship between cells in the target table, and the cell relationship analysis result of the target table is generated based on the obtained pairing relationship.
[0010] To address the aforementioned technical problems, this application also provides a table relationship analysis device, which employs the following technical solution:
[0011] The acquisition and recognition module is used to acquire the target table and identify each word element in the target table;
[0012] The discrete acquisition module is used to acquire the discrete features of each word element through the feature encoder in the table relation analysis model, wherein the table relation analysis model includes the feature encoder, the feature decoder and the relation analysis network;
[0013] The instance determination module is used to input the discrete features of each word into the feature decoder, so that the feature decoder can determine the cell instance to which each word belongs based on the feature sequence of each cell instance, and generate at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs. The feature sequence of each cell instance is obtained in advance through model training, and the cell instance is the instance within the cell of the table.
[0014] The relationship analysis module is used to input the at least one cell encoding feature into the relationship analysis network to obtain the pairing relationship between cells in the target table, and generate the cell relationship analysis result of the target table based on the obtained pairing relationship.
[0015] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0016] Obtain the target table and identify each word element in the target table;
[0017] Discrete features of each word are obtained through a feature encoder in a table relation analysis model, which includes the feature encoder, feature decoder, and relation analysis network.
[0018] The discrete features of each word are input into the feature decoder, so that the feature decoder determines the cell instance to which each word belongs based on the feature sequence of each cell instance, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs. The feature sequence of each cell instance is obtained in advance through model training, and the cell instance is the instance within the cell of the table.
[0019] The at least one cell encoding feature is input into the relationship analysis network to obtain the pairing relationship between cells in the target table, and the cell relationship analysis result of the target table is generated based on the obtained pairing relationship.
[0020] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0021] Obtain the target table and identify each word element in the target table;
[0022] Discrete features of each word are obtained through a feature encoder in a table relation analysis model, which includes the feature encoder, feature decoder, and relation analysis network.
[0023] The discrete features of each word are input into the feature decoder, so that the feature decoder determines the cell instance to which each word belongs based on the feature sequence of each cell instance, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs. The feature sequence of each cell instance is obtained in advance through model training, and the cell instance is the instance within the cell of the table.
[0024] The at least one cell encoding feature is input into the relationship analysis network to obtain the pairing relationship between cells in the target table, and the cell relationship analysis result of the target table is generated based on the obtained pairing relationship.
[0025] Compared with the prior art, the embodiments of this application have the following advantages: After obtaining the target table, each word in the target table is identified; this application uses a table relationship analysis model to achieve end-to-end table relationship analysis, which includes a feature encoder, a feature decoder, and a relationship analysis network; the feature encoder can obtain the discrete features of each word; the feature decoder has feature sequences of each possible cell instance, and the feature decoder decodes the discrete features of each word according to each feature sequence to determine the cell instance to which each word belongs, and generates at least one cell encoding feature according to the feature sequence of the cell instance to which each word belongs, thus realizing feature representation of the involved cells; at least one cell encoding feature is input into the relationship analysis network to identify the pairing relationship between each cell in the target table, and generates the cell relationship analysis result of the target table according to the obtained pairing relationship, thus realizing end-to-end table relationship analysis, and the representation modeling method is more universal, without the need to set up multiple independent components, thereby improving the efficiency of table relationship analysis. Attached Figure Description
[0026] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0028] Figure 2 This is a flowchart of an embodiment of the tabular relationship analysis method according to this application;
[0029] Figure 3 This is a schematic diagram of the structure of an embodiment of the tabular relationship analysis apparatus according to this application;
[0030] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0032] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0033] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0034] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0035] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0036] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0037] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0038] It should be noted that the table relationship analysis method provided in this application embodiment is generally executed by the server, and correspondingly, the table relationship analysis device is generally set in the server.
[0039] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0040] Continue to refer to Figure 2 A flowchart illustrating an embodiment of the table relationship analysis method according to this application is shown. The table relationship analysis method includes the following steps:
[0041] Step S201: Obtain the target table and identify each word element in the target table.
[0042] In this embodiment, the tabular relational analysis method runs on an electronic device (e.g., Figure 1 The server shown can communicate with the terminal device via wired or wireless connection. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra wideband) connections, and other currently known or future known wireless connection methods.
[0043] Specifically, the process involves acquiring the target table to be processed and identifying the tokens within it. In natural language processing, a token is the basic unit of language processing; it can represent a single character, a word consisting of two characters, or a text unit consisting of three or more characters. A token can represent any continuous sequence of characters in text, including single letters, numbers, punctuation marks, words, etc. For example, in the financial and accounting field, a table containing the text "income declaration form agency" can have "income," "declaration," "form," and "agency" as tokens.
[0044] Furthermore, the steps for identifying each word in the target table may include: performing optical character recognition on the target table in image form to obtain each word in the target table and the spatial coordinates of each word.
[0045] Specifically, to prevent the content of tables from being tampered with, tables are usually presented as images after they are created. For this purpose, optical character recognition (OCR) is required to convert the image-based target table into machine-readable text, that is, to obtain the word units in the target table, and to obtain the spatial coordinates of each word unit in the target table during the OCR recognition process.
[0046] In this embodiment, optical character recognition is performed on the target table in image form to obtain each word and its spatial coordinates, resulting in machine-readable text, which lays the foundation for subsequent table analysis.
[0047] Furthermore, after the steps of identifying each word element in the target table mentioned above, the method may further include: encoding each word element separately to obtain the word element code; and encoding the spatial coordinates of each word element separately to obtain the coordinate code of each word element.
[0048] Specifically, each word can be encoded separately to obtain the word code of each word; and the spatial coordinates of each word can be encoded separately to obtain the coordinate code of each word, thus realizing the digital processing of word elements.
[0049] In this embodiment, each word is encoded separately to obtain the word code of each word; the spatial coordinates of each word are encoded separately to obtain the coordinate code of each word, thus realizing the digital processing of words so that they can be used for subsequent tabular relationship analysis through the model.
[0050] Step S202: Obtain the discrete features of each word through the feature encoder in the table relation analysis model. The table relation analysis model includes a feature encoder, a feature decoder, and a relation analysis network.
[0051] Specifically, this application establishes a table relation analysis model, which includes a feature encoder, a feature decoder, and a relation analysis network, forming an end-to-end table relation analysis system; the roles of each will be explained in the following discussion.
[0052] First, discrete features of each word are obtained by using a feature encoder to encode the discrete features of each word.
[0053] Furthermore, step S202 may include: fusing the word code and coordinate code of each word to obtain the initial discrete features of each word; inputting the initial discrete features of each word into the feature encoder in the table relation analysis model, so as to fuse the context information of the initial discrete features of each word through the feature encoder to obtain the high-dimensional discrete features of each word.
[0054] Specifically, for each word, there is a word code and a coordinate code. By fusing the word code and the coordinate code of the word (e.g., by directly adding them), the initial discrete features of the word can be obtained.
[0055] Then, the initial discrete features of each word are input into the feature encoder. The feature encoder encodes the initial discrete features of each word, and through encoding, it achieves the fusion of contextual information of the word to obtain the discrete features of each word. Here, the discrete features obtained are in high-dimensional form. The feature encoder here can be a transformer encoder based on an attention mechanism; the transformer encoder itself has the ability to associate context.
[0056] In one embodiment, each word and its spatial coordinates can be input into the feature encoder in the tabular relationship analysis model. The feature encoder encodes each word separately to obtain the word code and encodes the spatial coordinates of each word separately to obtain the coordinate code of each word. Then, the word code and coordinate code of each word are fused to obtain the initial discrete features of each word. Finally, the initial discrete features of each word are fused with context information to obtain the discrete features of each word.
[0057] In this embodiment, the word code and coordinate code of each word are fused to obtain the initial discrete features of each word. The initial discrete features of each word are then input into the feature encoder in the table relationship analysis model. The feature encoder performs contextual information fusion on the initial discrete features of each word to obtain the discrete features of each word. This makes the discrete features contain rich information and improves the accuracy of table relationship analysis.
[0058] Furthermore, the steps described above for fusing the word code and coordinate code of each word to obtain the initial discrete features of each word may include: obtaining a preset encoding fusion method, which may include additive fusion, weighted fusion, and concatenation fusion; and fusing the word code and coordinate code of each word according to the determined encoding fusion method to obtain the initial discrete features of each word.
[0059] Specifically, this application sets up multiple encoding fusion methods, and only one of them needs to be selected. The encoding fusion methods include additive fusion, weighted fusion, and concatenation fusion. Additive fusion is the simplest method, directly adding the word encoding and coordinate encoding of each word. Weighted fusion adds weights to the word encoding and coordinate encoding, and then performs a weighted sum. Concatenation fusion involves concatenating the word encoding and coordinate encoding (i.e., concatenate, abbreviated as concat), which refers to connecting (or concatenating) two or more tensors along a certain dimension. This operation stacks two or more tensors together along the specified dimension to form a larger tensor, typically used to combine information from different sources while preserving the original feature information. After concatenation, a linear transformation can be performed to obtain the initial discrete features of each word.
[0060] Based on the determined encoding fusion method, the word encoding and coordinate encoding of each word are fused to obtain the initial discrete features of each word.
[0061] In this embodiment, the encoding fusion methods include additive fusion, weighted fusion, and concatenation fusion. According to any encoding fusion method, the word code and coordinate code of each word can be fused to obtain the initial discrete features of each word, thereby improving the diversity of encoding fusion and the diversity of the obtained initial discrete features.
[0062] Step S203: Input the discrete features of each word into the feature decoder so that the feature decoder can determine the cell instance to which each word belongs based on the feature sequence of each cell instance, and generate at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs. The feature sequence of each cell instance is obtained in advance through model training, and the cell instance is the instance within the cell in the table.
[0063] Specifically, the table contains cells, and each cell contains an instance. For example, in a table in the financial and accounting field, cell 1 contains the cell instance "Income Declaration Form Authority", and cell 2 contains the cell instance "State Administration of Foreign Exchange". This application predefines the possible cell instances and, through training a table relationship analysis model, obtains the feature sequence of each cell instance, which can accurately vectorize the cell instances.
[0064] The discrete features of each word are input into the feature decoder. The feature sequence of each cell instance is equivalent to a dictionary. The feature decoder "looks up the dictionary" based on the discrete features of each word to determine which cell instance each word belongs to, and generates at least one cell encoding feature based on the feature sequences of the cell instances involved in each word. In other words, this step determines the cell instances involved in each word based on its discrete features. Next, it is necessary to identify the relationships between these cell instances to obtain the relationships between different cells in the target table.
[0065] Furthermore, the steps described above, in which the feature decoder determines the cell instance to which each word belongs based on the feature sequence of each cell instance, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs, may include: decoding the discrete features of each word through the feature decoder, and determining the cell instance to which each word belongs based on the feature sequence of each cell instance; and generating at least one cell encoding feature based on the feature sequence and instance number of the cell instance to which each word belongs.
[0066] Specifically, the feature decoder can be a transformer decoder, which needs to decode the sequence during operation and then associate it with the features through attention. In this application, the feature sequence of each cell instance will be used as the decoding sequence, and the discrete features of each word will be used as the features to be decoded.
[0067] The feature decoder decodes the discrete features of each word and determines the cell instance to which each word belongs based on the feature sequence of each cell instance.
[0068] This application assigns an instance number to each cell instance to uniquely identify each cell instance. The feature sequence and instance number of the cell instance to which each word belongs are obtained, and the feature sequence and instance number of each cell instance are fused to obtain the cell encoding feature of the cell instance.
[0069] In one embodiment, cell encoding features for each cell instance can be pre-generated. After obtaining the relevant cell instances through the feature decoder, the cell encoding features of these cell instances can be directly obtained, thereby improving the model processing speed.
[0070] This embodiment associates words with cell instances and generates cell encoding features. The number of cells is greatly reduced compared to the number of words, resulting in higher efficiency in subsequent calculations and richer features, which can improve the accuracy of table relationship recognition.
[0071] In this embodiment, the discrete features of each word are decoded by a feature decoder, and the cell instance to which each word belongs is determined based on the feature sequence of each cell instance. The feature sequence and instance number of the involved cell instances are fused to generate cell encoding features, and feature representation is implemented for the involved cells so as to identify cell pairing relationships in the future.
[0072] Step S204: Input at least one cell encoding feature into the relationship analysis network to obtain the pairing relationship between cells in the target table, and generate the cell relationship analysis result of the target table based on the obtained pairing relationship.
[0073] Specifically, at least one cell encoding feature is input into the relational analysis network. The cell encoding feature corresponds to a cell instance, and the cell instance corresponds to a cell in the target table. Based on the cell encoding features, the relational analysis network can identify the pairing relationships between different cells (which need to be relevant cells) in the target table. In one embodiment, the relational analysis network can also be a transformer encoder.
[0074] Based on the obtained pairing relationships, cell relationship analysis results for the target table can be generated. In one embodiment, the cell relationship analysis results may also include information such as cell instances and spatial coordinates of the cells (generated based on the spatial coordinates of each word). For example, the cell relationship analysis results may show that cell 1 (with cell instance "Income Declaration Form Authority") and cell 2 (with cell instance "State Administration of Foreign Exchange") are paired, indicating that "Income Declaration Form Authority" and "State Administration of Foreign Exchange" in the cells have achieved attribute pairing; or, the cell relationship analysis results may show that cell 3 (with cell instance "Name") and cell 2 (with cell instance "Zhang San") are paired, indicating that "Name" and "Zhang San" in the cells belong to a set of keyword attribute pairings.
[0075] In this embodiment, after obtaining the target table, each word element in the target table is identified. This application utilizes a table relationship analysis model to achieve end-to-end table relationship analysis. The table relationship analysis model includes a feature encoder, a feature decoder, and a relationship analysis network. The feature encoder can obtain the discrete features of each word element. The feature decoder has feature sequences of possible cell instances. The feature decoder decodes the discrete features of each word element according to the feature sequences, determines the cell instance to which each word element belongs, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word element belongs, thus realizing feature representation for the involved cells. The at least one cell encoding feature is input into the relationship analysis network to identify the pairing relationships between cells in the target table, and generates the cell relationship analysis result of the target table based on the obtained pairing relationships. This achieves end-to-end table relationship analysis, and the representation modeling method is more universal, eliminating the need to set up multiple independent components and improving the efficiency of table relationship analysis.
[0076] Furthermore, prior to the step of obtaining the target table, the method may further include: obtaining each training word in the training table; obtaining the training discrete features of each training word through the feature encoder in the initial table relationship analysis model, the initial table relationship analysis model including a feature encoder, a feature decoder, and a relationship analysis network; obtaining preset cell instances and randomly generating initial feature sequences for each cell instance through the feature decoder; inputting the training discrete features of each training word into the feature decoder, so that the feature decoder determines the cell instance to which each training word belongs based on the initial feature sequence of each cell instance, and generates at least one initial cell encoding feature based on the initial feature sequence of the cell instance to which each training word belongs, wherein the cell instance is an instance within a cell in the table; inputting at least one initial cell encoding feature into the relationship analysis network to obtain the predicted pairing relationship between each training cell in the training table; obtaining the pairing labels between each training cell, and calculating the model loss based on the obtained pairing labels and the predicted pairing relationship; adjusting the initial table relationship analysis model based on the model loss until the model loss meets the training stopping condition, thereby obtaining the table relationship analysis model and the feature sequence of each cell instance.
[0077] Specifically, this application requires pre-training an initial table relation analysis model to obtain the table relation analysis model. The initial table relation analysis model includes a feature encoder, a feature decoder, and a relation analysis network.
[0078] During training, each training word in the training table is first acquired. The discrete training features of each training word are then obtained through the feature encoder in the initial table relationship analysis model. Preset cell instances are acquired, and the initial feature sequence of each cell instance is randomly generated through the feature decoder that has not yet completed training. The discrete training features of each training word are input into the feature decoder, which decodes the initial feature sequence of each cell instance to determine the cell instance to which each training word belongs. Based on the initial feature sequence of the cell instance to which each training word belongs, at least one initial cell encoding feature is generated.
[0079] Input at least one initial cell encoding feature into the relation analysis network to obtain the predicted pairing relationships between training cells in the training table. Obtain the pairing labels between each training cell; the pairing labels represent the actual pairing relationships between training cells related to each training word.
[0080] The model loss can be calculated based on the obtained paired labels and predicted paired relationships. The model parameters of the initial table relationship analysis model are adjusted to reduce the model loss until the model loss meets the training stopping condition, thus obtaining the table relationship analysis model. The training stopping condition can be that the model loss is less than a preset loss threshold. It can be understood that the initial feature sequence of each cell instance will converge to a fixed value during training. At this point, the fixed initial feature sequence can be considered to accurately represent the cell instance and can be used as the feature sequence of the cell instance.
[0081] In this embodiment, during the training of the initial table relationship analysis model, the feature decoder randomly generates the initial feature sequence of each cell instance; after the training is completed, the initial feature sequence of each cell instance converges to a fixed value to obtain the feature sequence, thus preparing for table relationship analysis.
[0082] It should be emphasized that, in order to further ensure the privacy and security of the feature sequences of the above-mentioned cell instances, the feature sequences of the above-mentioned cell instances can also be stored in a node of a blockchain.
[0083] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0084] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0085] Foundational technologies in artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0086] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0087] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0088] Further reference Figure 3 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a table relationship analysis device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0089] like Figure 3As shown, the table relationship analysis device 300 described in this embodiment includes: an acquisition and identification module 301, a discrete acquisition module 302, an instance determination module 303, and a relationship analysis module 304, wherein:
[0090] The recognition module 301 is used to acquire the target table and recognize each word element in the target table.
[0091] The discrete acquisition module 302 is used to acquire the discrete features of each word through the feature encoder in the table relation analysis model. The table relation analysis model includes a feature encoder, a feature decoder and a relation analysis network.
[0092] The instance determination module 303 is used to input the discrete features of each word into the feature decoder, so that the feature decoder can determine the cell instance to which each word belongs based on the feature sequence of each cell instance, and generate at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs. The feature sequence of each cell instance is obtained in advance through model training, and the cell instance is the instance within the cell in the table.
[0093] The relationship analysis module 304 is used to input at least one cell encoding feature into the relationship analysis network to obtain the pairing relationship between cells in the target table, and generate the cell relationship analysis result of the target table based on the obtained pairing relationship.
[0094] In this embodiment, after obtaining the target table, each word element in the target table is identified. This application utilizes a table relationship analysis model to achieve end-to-end table relationship analysis. The table relationship analysis model includes a feature encoder, a feature decoder, and a relationship analysis network. The feature encoder can obtain the discrete features of each word element. The feature decoder has feature sequences of possible cell instances. The feature decoder decodes the discrete features of each word element according to the feature sequences, determines the cell instance to which each word element belongs, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word element belongs, thus realizing feature representation for the involved cells. The at least one cell encoding feature is input into the relationship analysis network to identify the pairing relationships between cells in the target table, and generates the cell relationship analysis result of the target table based on the obtained pairing relationships. This achieves end-to-end table relationship analysis, and the representation modeling method is more universal, eliminating the need to set up multiple independent components and improving the efficiency of table relationship analysis.
[0095] In some optional implementations of this embodiment, the acquisition and recognition module 301 can also be used to perform optical character recognition on the target table in image form to obtain each word in the target table and the spatial coordinates of each word.
[0096] In this embodiment, optical character recognition is performed on the target table in image form to obtain each word and its spatial coordinates, resulting in machine-readable text, which lays the foundation for subsequent table analysis.
[0097] In some optional implementations of this embodiment, the identification module 301 may further include: a word encoding submodule and a coordinate encoding submodule, wherein:
[0098] The lexical encoding submodule is used to encode each lexical separately to obtain the lexical code for each lexical.
[0099] The coordinate encoding submodule is used to encode the spatial coordinates of each word to obtain the coordinate code of each word.
[0100] In this embodiment, each word is encoded separately to obtain the word code of each word; the spatial coordinates of each word are encoded separately to obtain the coordinate code of each word, thus realizing the digital processing of words so that they can be used for subsequent tabular relationship analysis through the model.
[0101] In some optional implementations of this embodiment, the discrete acquisition module 302 may include: an encoding fusion submodule and a discrete generation submodule, wherein:
[0102] The encoding fusion submodule is used to fuse the word encoding and coordinate encoding of each word to obtain the initial discrete features of each word.
[0103] The discrete generation submodule is used to input the initial discrete features of each word into the feature encoder in the tabular relational analysis model, so that the feature encoder can perform contextual information fusion on the initial discrete features of each word to obtain the high-dimensional discrete features of each word.
[0104] In this embodiment, the word code and coordinate code of each word are fused to obtain the initial discrete features of each word. The initial discrete features of each word are then input into the feature encoder in the table relationship analysis model. The feature encoder performs contextual information fusion on the initial discrete features of each word to obtain the discrete features of each word. This makes the discrete features contain rich information and improves the accuracy of table relationship analysis.
[0105] In some optional implementations of this embodiment, the encoding fusion submodule may include: a mode acquisition unit and an encoding fusion unit, wherein:
[0106] The method acquisition unit is used to acquire a preset encoding fusion method, which includes additive fusion, weighted fusion, and splicing fusion.
[0107] The encoding fusion unit is used to fuse the word code and coordinate code of each word according to the determined encoding fusion method to obtain the initial discrete features of each word.
[0108] In this embodiment, the encoding fusion methods include additive fusion, weighted fusion, and concatenation fusion. According to any encoding fusion method, the word code and coordinate code of each word can be fused to obtain the initial discrete features of each word, thereby improving the diversity of encoding fusion and the diversity of the obtained initial discrete features.
[0109] In some optional implementations of this embodiment, the instance determination module 303 may include: an instance determination submodule and a feature generation submodule, wherein:
[0110] The instance determination submodule is used to decode the discrete features of each word through the feature decoder, and determine the cell instance to which each word belongs based on the feature sequence of each cell instance.
[0111] The feature generation submodule is used to generate at least one cell encoding feature based on the feature sequence and instance number of the cell instance to which each word belongs.
[0112] In this embodiment, the discrete features of each word are decoded by a feature decoder, and the cell instance to which each word belongs is determined based on the feature sequence of each cell instance. The feature sequence and instance number of the involved cell instances are fused to generate cell encoding features, and feature representation is implemented for the involved cells so as to identify cell pairing relationships in the future.
[0113] In some optional implementations of this embodiment, the table relationship analysis device 300 may include: a training lexical acquisition module, a training discrete acquisition module, an initial generation module, a training decoding module, a pairing prediction module, a loss calculation module, and a model adjustment module, wherein:
[0114] The training lexicon acquisition module is used to acquire each training lexicon in the training table.
[0115] The training discrete acquisition module is used to acquire the training discrete features of each training word through the feature encoder in the initial table relation analysis model. The initial table relation analysis model includes a feature encoder, a feature decoder, and a relation analysis network.
[0116] The initial generation module is used to obtain preset cell instances and randomly generate initial feature sequences for each cell instance through a feature decoder.
[0117] The training decoding module is used to input the training discrete features of each training word into the feature decoder, so that the feature decoder can determine the cell instance to which each training word belongs based on the initial feature sequence of each cell instance, and generate at least one initial cell encoding feature based on the initial feature sequence of the cell instance to which each training word belongs. The cell instance is the instance within the cell of the table.
[0118] The pairing prediction module is used to input at least one initial cell encoding feature into the relationship analysis network to obtain the predicted pairing relationship between each training cell in the training table.
[0119] The loss calculation module is used to obtain the paired labels between each training cell and calculate the model loss based on the obtained paired labels and the predicted paired relationship.
[0120] The model adjustment module is used to adjust the initial table relationship analysis model based on the model loss until the model loss meets the training stopping condition, thereby obtaining the table relationship analysis model and the feature sequence of each cell instance.
[0121] In this embodiment, during the training of the initial table relationship analysis model, the feature decoder randomly generates the initial feature sequence of each cell instance; after the training is completed, the initial feature sequence of each cell instance converges to a fixed value to obtain the feature sequence, thus preparing for table relationship analysis.
[0122] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0123] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0124] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0125] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for table relational analysis methods. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.
[0126] In some embodiments, the processor 42 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute computer-readable instructions for the table relational analysis method.
[0127] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.
[0128] The computer device provided in this embodiment can execute the above-described table relationship analysis method. The table relationship analysis method here can be any of the table relationship analysis methods described in the various embodiments above.
[0129] In this embodiment, after obtaining the target table, each word element in the target table is identified. This application utilizes a table relationship analysis model to achieve end-to-end table relationship analysis. The table relationship analysis model includes a feature encoder, a feature decoder, and a relationship analysis network. The feature encoder can obtain the discrete features of each word element. The feature decoder has feature sequences of possible cell instances. The feature decoder decodes the discrete features of each word element according to the feature sequences, determines the cell instance to which each word element belongs, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word element belongs, thus realizing feature representation for the involved cells. The at least one cell encoding feature is input into the relationship analysis network to identify the pairing relationships between cells in the target table, and generates the cell relationship analysis result of the target table based on the obtained pairing relationships. This achieves end-to-end table relationship analysis, and the representation modeling method is more universal, eliminating the need to set up multiple independent components and improving the efficiency of table relationship analysis.
[0130] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the tabular relational analysis method described above.
[0131] In this embodiment, after obtaining the target table, each word element in the target table is identified. This application utilizes a table relationship analysis model to achieve end-to-end table relationship analysis. The table relationship analysis model includes a feature encoder, a feature decoder, and a relationship analysis network. The feature encoder can obtain the discrete features of each word element. The feature decoder has feature sequences of possible cell instances. The feature decoder decodes the discrete features of each word element according to the feature sequences, determines the cell instance to which each word element belongs, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word element belongs, thus realizing feature representation for the involved cells. The at least one cell encoding feature is input into the relationship analysis network to identify the pairing relationships between cells in the target table, and generates the cell relationship analysis result of the target table based on the obtained pairing relationships. This achieves end-to-end table relationship analysis, and the representation modeling method is more universal, eliminating the need to set up multiple independent components and improving the efficiency of table relationship analysis.
[0132] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0133] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A method for analyzing tabular relationships, characterized in that, Includes the following steps: Obtain the target table and identify each word element in the target table; Discrete features of each word are obtained through a feature encoder in a table relation analysis model, which includes the feature encoder, feature decoder, and relation analysis network. The discrete features of each word are input into the feature decoder, so that the feature decoder determines the cell instance to which each word belongs based on the feature sequence of each cell instance, and generates at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs. The feature sequence of each cell instance is obtained in advance through model training, and the cell instance is the instance within the cell of the table. The at least one cell encoding feature is input into the relationship analysis network to obtain the pairing relationship between cells in the target table, and the cell relationship analysis result of the target table is generated based on the obtained pairing relationship.
2. The table relationship analysis method according to claim 1, characterized in that, The step of identifying each word element in the target table includes: Optical character recognition is performed on the target table in image form to obtain each word in the target table and the spatial coordinates of each word.
3. The table relationship analysis method according to claim 2, characterized in that, Following the step of identifying each word element in the target table, the method further includes: Each word element is encoded separately to obtain the word element encoding of each word element; The spatial coordinates of each word are encoded to obtain the coordinate code of each word.
4. The tabular relationship analysis method according to claim 3, characterized in that, The step of obtaining the discrete features of each word through the feature encoder in the tabular relationship analysis model includes: The word encoding and coordinate encoding of each word are fused to obtain the initial discrete features of each word. The initial discrete features of each word are input into the feature encoder in the table relation analysis model, so that the initial discrete features of each word are fused with contextual information through the feature encoder to obtain the high-dimensional discrete features of each word.
5. The table relationship analysis method according to claim 4, characterized in that, The step of fusing the word code and coordinate code of each word to obtain the initial discrete features of each word includes: Obtain a preset encoding fusion method, which includes additive fusion, weighted fusion, and splicing fusion; According to the determined encoding fusion method, the word encoding and coordinate encoding of each word are fused to obtain the initial discrete features of each word.
6. The table relationship analysis method according to claim 1, characterized in that, The step of determining the cell instance to which each word belongs based on the feature sequence of each cell instance by the feature decoder, and generating at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs, includes: The discrete features of each word are decoded by the feature decoder, and the cell instance to which each word belongs is determined based on the feature sequence of each cell instance. At least one cell encoding feature is generated based on the feature sequence and instance number of the cell instance to which each word belongs.
7. The tabular relationship analysis method according to claim 1, characterized in that, Before the step of obtaining the target table, the following is also included: Retrieve each training word element from the training table; The training discrete features of each training word are obtained through the feature encoder in the initial table relation analysis model, which includes the feature encoder, feature decoder and relation analysis network. Obtain preset cell instances, and randomly generate an initial feature sequence for each cell instance using the feature decoder; The training discrete features of each training word are input into the feature decoder, so that the feature decoder determines the cell instance to which each training word belongs based on the initial feature sequence of each cell instance, and generates at least one initial cell encoding feature based on the initial feature sequence of the cell instance to which each training word belongs. The cell instance is an instance within a cell in the table. The at least one initial cell encoding feature is input into the relationship analysis network to obtain the predicted pairing relationship between each training cell in the training table; Obtain the paired labels between each training cell, and calculate the model loss based on the obtained paired labels and the predicted paired relationships; The initial table relationship analysis model is adjusted based on the model loss until the model loss meets the training stopping condition, thereby obtaining the table relationship analysis model and the feature sequence of each cell instance.
8. A tabular relationship analysis device, characterized in that, include: The acquisition and recognition module is used to acquire the target table and identify each word element in the target table; The discrete acquisition module is used to acquire the discrete features of each word element through the feature encoder in the table relation analysis model, wherein the table relation analysis model includes the feature encoder, the feature decoder and the relation analysis network; The instance determination module is used to input the discrete features of each word into the feature decoder, so that the feature decoder can determine the cell instance to which each word belongs based on the feature sequence of each cell instance, and generate at least one cell encoding feature based on the feature sequence of the cell instance to which each word belongs. The feature sequence of each cell instance is obtained in advance through model training, and the cell instance is the instance within the cell of the table. The relationship analysis module is used to input the at least one cell encoding feature into the relationship analysis network to obtain the pairing relationship between cells in the target table, and generate the cell relationship analysis result of the target table based on the obtained pairing relationship.
9. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the tabular relation analysis method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the tabular relation analysis method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-entity relationship joint extraction method and device based on text generation
CN110196913A
Table information extraction method and device, electronic equipment and readable storage medium
CN116343248A
