Information extraction method and apparatus
By using the attention layer in the information extraction method to process the layout information of the document text and obtain the text structural features, the problem of inaccurate information extraction in structured data by traditional methods is solved, and the accuracy and applicability of information extraction are improved.
Patent Information
- Application Number
- PCT/SG2024/050242
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-28
- Filing Date
- 2024-04-09
- Publication Date
- 2024-10-31
Smart Images

Figure SG2024050242_31102024_PF_FP_ABST
Abstract
Description
[0001] Information Extraction Method and Apparatus Cross-Reference This disclosure claims priority to a Chinese patent application filed with the Patent Office of China on April 28, 2023, with priority number 202310487569.4 and title “Information Extraction Method and Apparatus,” the entire contents of which are incorporated herein by reference. Technical Field: Embodiments of the present disclosure relate to the field of information processing technology, and more particularly, to an information extraction method. Background: Information extraction involves extracting specific event or factual information from massive natural language corpora, automatically classifying the content in massive documents, extracting important information, generating summary information, and reconstructing text structures. With the continuous development of natural language processing (NLP), the application scenarios of information extraction technology are also expanding. Massive amounts of data stored in structured digital formats such as images and portable document formats (PDFs) also need to be analyzed through information extraction. However, when extracting information from data stored in structured digital formats such as images, portable document formats, and documents, the traditional plain text information extraction method extracts inaccurate information. In other words, the traditional plain text information extraction method is gradually unable to meet the usage requirements in actual scenarios. Therefore, an accurate information extraction method is urgently needed. In view of this, the embodiments of the present disclosure provide an information extraction method. One or more embodiments of the present disclosure also relate to an information extraction device, a computing device, a computer-readable storage medium, and a computer program to address the technical defects existing in the prior art. According to a first aspect of the embodiments of the present disclosure, an information extraction method is provided, comprising: obtaining document text; inputting the document text into an information extraction model to obtain an information extraction result, wherein, The information extraction model includes an attention layer, which obtains text structure features corresponding to each text node in the layout information based on the layout information corresponding to the document text. The text structure features are obtained by text features corresponding to the current text node and the ancestor text node. The ancestor text node corresponding to the current text node is determined by the layout information.According to a second aspect of an embodiment of the present disclosure, an information extraction apparatus is provided, comprising: an acquisition module configured to acquire document text; and an acquisition module configured to input the document text into an information extraction model to obtain an information extraction result. The information extraction model includes an attention layer, wherein the attention layer obtains text structural features corresponding to each text node in the layout information based on layout information corresponding to the document text. The text structural features are obtained by combining text features corresponding to a current text node and an ancestor text node, wherein the ancestor text node corresponding to the current text node is determined by the layout information. According to a third aspect of an embodiment of the present disclosure, a computing device is provided, comprising: a memory and a processor; the memory is configured to store computer-executable instructions; the processor is configured to execute the computer-executable instructions, wherein the computer-executable instructions, when executed by the processor, implement the steps of the above-mentioned information extraction method. According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-executable instructions are stored; wherein the instructions, when executed by the processor, implement the steps of the above-mentioned information extraction method. According to a fifth aspect of an embodiment of the present disclosure, a computer program is provided, wherein, when executed in a computer, the computer program causes the computer to perform the steps of the above-mentioned information extraction method. One embodiment of the present disclosure obtains document text and inputs the document text into an information extraction model to obtain an information extraction result. The information extraction model includes an attention layer, which obtains text structural features corresponding to each text node in the layout information based on layout information corresponding to the document text. The text structural features are obtained by combining text features corresponding to a current text node and an ancestor text node, where the ancestor text node corresponding to the current text node is determined by the layout information. The text structural features corresponding to the current text node are obtained by combining text features between the current text node and the ancestor text node in the layout information. This ensures that the information extraction result obtained by the information extraction model is based on the text structural features corresponding to each text node in the layout information corresponding to the document text, thereby improving the accuracy of the information extraction result. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 is a schematic diagram of an interaction flow within an information extraction system architecture provided by an embodiment of the present disclosure; Figure 2 is a framework diagram of an information extraction system provided by an embodiment of the present disclosure; Figure 3 is a flow chart of an information extraction method provided by an embodiment of the present disclosure; Figure 4a is a flow chart of the processing process of an information extraction method provided by an embodiment of the present disclosure; Figure 4b is a schematic diagram of layout information in an information extraction method provided by an embodiment of the present disclosure; Figure 5 is a schematic diagram of the structure of an information extraction apparatus provided by an embodiment of the present disclosure; Figure 6 is a block diagram of the structure of a computing device provided by an embodiment of the present disclosure. Figure 7 is a schematic diagram of the structure of a processor provided by an embodiment of the present disclosure.DETAILED DESCRIPTION The following description sets forth numerous specific details to facilitate a thorough understanding of the present disclosure. However, the present disclosure can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without departing from the scope of the present disclosure. Therefore, the present disclosure is not limited to the specific implementations disclosed below. The terminology used in one or more embodiments of the present disclosure is for the purpose of describing specific embodiments only and is not intended to limit the present disclosure. As used in one or more embodiments of the present disclosure and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present disclosure refers to and encompasses any and all possible combinations of one or more of the associated listed items. It should be understood that while the terms "first," "second," and so on may be used to describe various information in one or more embodiments of the present disclosure, such information should not be limited to these terms. These terms are used solely to distinguish information of the same type from one another. For example, "first" could be referred to as "second," and similarly, "second" could be referred to as "first," without departing from the scope of one or more embodiments of the present disclosure. Depending on the context, the term "if" as used herein can be interpreted as meaning "when," "when," or "in response to determining." Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data configured for analysis, stored data, and displayed data, etc.) involved in one or more embodiments of this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or deny. First, the terminology used in one or more embodiments of this disclosure is explained. Information extraction: Information extraction is an important branch of the field of natural language processing and a subtask of sequence labeling. Information extraction specifically includes three downstream tasks: named entity recognition, relationship extraction, and event extraction. Document-level information extraction: Different from pure text information extraction, document-level information extraction is an information extraction task for multimodal representations stored in document structures. Documents contain images, text, structure, and modal information, making them a naturally multimodal scenario. Document structure information: Information specific to document data. Since documents are generally long, a clear organizational structure can better present the content of the document, which is specifically reflected in the hierarchical relationship of the title organization.Attention mechanism (Attention Mechanism): It is an effective means of feature screening and enhancement, and has been widely used in fields such as natural language processing (NLP) and computer vision (CV).
[0002] 3. Correction Page (Article 91 of the Detailed Rules) Automatically classify the content of massive documents, extract important information, generate summary information, and reconstruct text structure. With the continuous development of natural language processing, the application scenarios of information extraction technology are also expanding. Massive amounts of data stored in structured digital formats such as images, portable document formats, and documents also require information extraction for content analysis. Currently, there are three commonly used information extraction methods. The first is pure text information extraction: Traditional pure text information extraction methods often extract inaccurate information from data stored in structured digital formats such as images, portable document formats, and documents. This means that traditional pure text information extraction methods are gradually failing to meet the needs of practical scenarios. The second is information extraction methods that consider both image and text modalities: Information extraction methods that only consider image and text modalities ignore the document's unique structural information, resulting in poor performance in long document data and cross-section extraction. The third is to introduce structural information through graphs, but this method uses node granularity to divide the data, losing the document structure information and only retaining the connections between entities. This method performs poorly in long document data and cross-section extraction. Node granularity uses nodes for granularity division, such as using fine-grained nodes such as names, times, and locations. An accurate information extraction method is urgently needed. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data configured for analysis, stored data, and displayed data, etc.) involved in the embodiments of this disclosure are all authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or deny. This disclosure provides an information extraction method, an information extraction device, a computing device, and a computer-readable storage medium, each of which is described in detail in the following embodiments.Refer to Figure 1, which shows a schematic diagram of an interaction process under an information extraction system architecture provided by an embodiment of the present disclosure. As shown in Figure 1, the system includes a server 0101 and a client 0102. Server 0101: configured to obtain document text; input the document text into an information extraction model to obtain information extraction results, wherein the information extraction model includes an attention layer, and the attention layer obtains text structure features corresponding to each text node in the layout information based on the layout information corresponding to the document text. The text structure features are obtained by text features corresponding to the current text node and the ancestor text node, and the ancestor text node corresponding to the current text node is determined by the layout information; Client 0102: configured to receive information extraction results. The solution in the embodiments of the present disclosure is applied to obtain document text; the document text is input into an information extraction model to obtain information extraction results. The information extraction model includes an attention layer, which obtains text structural features corresponding to each text node in the layout information based on the layout information corresponding to the document text. The text structural features are obtained by comparing the text features corresponding to the current text node and its ancestor text nodes, where the ancestor text node corresponding to the current text node is determined by the layout information. The text structural features corresponding to the current text node are obtained by comparing the text features between the current text node and its ancestor text nodes in the layout information. This ensures that the information extraction results obtained by the information extraction model are based on the text structural features corresponding to each text node in the layout information corresponding to the document text, thereby improving the accuracy of the information extraction results. Referring to FIG. 2 , FIG. 2 shows a framework diagram of an information extraction system provided by an embodiment of the present disclosure. The system may include a server 100 and multiple clients 200. Multiple clients 200 can establish communication connections through the server 100. In an information extraction scenario, the server 100 is used to provide information extraction services between multiple clients 200. Multiple clients 200 can act as senders or receivers, communicating through the server 100. Users can interact with the server 100 through the client 200 to receive data from other clients 200 or send data to other clients 200. In an information extraction scenario, a user can issue an information extraction request to the server 100 through the client 200. The server 100 generates information extraction results based on the information extraction request and pushes the results to other clients 200 with which communication has been established. The connection between the client 200 and the server 100 is established through a network. The network provides the medium for the communication link between the client 200 and the server 100. The network can include various connection types, such as wired or wireless communication links or fiber optic cables.The data transmitted by the client 200 may need to undergo encoding, transcoding, compression, and other processing before being published to the server 100. The client 200 may be a browser, an application (APP), a web application such as a Hypertext Markup Language 5 (H5) application, a light application (also known as a mini-program, a lightweight application), or a cloud application. The client 200 may be developed based on a software development kit (SDK) for a corresponding service provided by the server, such as a real-time communication (RTC) SDK. The client 200 may be deployed in an electronic device and may rely on the device or certain apps in the device to operate. For example, the electronic device may have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, or a personal computer. Electronic devices can also typically be configured with various other applications, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, and the like. The server 100 may include servers that provide various services, such as servers that provide communication services to multiple clients, servers configured to provide background training to support models used on clients, and servers that process data sent by clients. It should be noted that the server 100 can be implemented as a distributed server cluster consisting of multiple servers or as a single server. The server can also be a server in a distributed system or a server integrated with blockchain. The server can also be a cloud server providing basic cloud computing services such as cloud services, cloud data sources, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. It is worth noting that the information extraction method provided in the embodiments of the present disclosure is generally executed by the server 100. However, in other embodiments of the present disclosure, the client 200 may also have similar functions to the server, thereby executing the information extraction method provided in the embodiments of the present disclosure. In other embodiments, the information extraction method provided in the embodiments of the present disclosure may also be jointly executed by the client 200 and the server 100.Referring to Figure 3, a flowchart of an information extraction method provided by an embodiment of the present disclosure is shown, specifically including the following steps. Step 302: Obtain document text. This embodiment of the present disclosure is configured as a client or server of an application capable of information extraction. The following description uses the server as an example. When there is a need to extract information from document text, the server obtains the document text. The document text can be input by the user on the front end or obtained by the server from a data source storing the document text. Specifically, document text refers to text consisting of multiple characters. The document text can be a long document that may include multiple chapters, such as a document with multiple chapters. In one possible implementation of the present disclosure, the server can initiate a channel for uploading the document text (e.g., via Bluetooth, network upload, etc.) upon a user click. The user then uploads the document text, and the server performs information extraction based on the uploaded document text. In another possible implementation of the present disclosure, a server may have multiple document texts. A user clicks on the document text to be uploaded. The selected target document text is used as the document text, and the server performs information extraction based on the document text. Since information extraction is performed on the document text in this embodiment of the present disclosure, the document text is obtained and used as the basis for subsequent information extraction based on the document text. Step 304: Input the document text into an information extraction model to obtain an information extraction result. The information extraction model includes an attention layer. The attention layer obtains text structural features corresponding to each text node in the layout information based on the layout information corresponding to the document text. The text structural features are obtained from the text features corresponding to the current text node and its ancestor text nodes. The ancestor text node corresponding to the current text node is determined by the layout information. Specifically, the information extraction model refers to a model that extracts information from text. The information extraction model can be obtained by fine-tuning a pre-trained model. Fine-tuning can be achieved by adding an attention layer to the pre-trained model to perform attention processing to obtain the information extraction result. An attention layer is a network layer that includes an attention mechanism. The attention mechanism is configured to learn features according to the attention mechanism's attention method, resulting in the output of the attention layer. Layout information is generated by constructing the layout of the document text. Layout information includes the text within the document and can be in the form of a tree or hierarchical graph structure. Layout information represents graph structural information.Text structural features refer to the structural features of the current node in the document text, characterizing the structural features of the current text node within the document text. Text structural features are derived from the text features corresponding to the current text node and the text features corresponding to ancestor text nodes. The current text node refers to the text node currently being processed in the layout information. The current text node can be any text node in the layout information at different processing moments. Ancestor text nodes refer to text nodes between the current text node and the root text node, including the root text node. Text features are derived by extracting features from the text content within a text node. For example, document A has a main title, two section titles (Section Title 1 and Section Title 2), and the corresponding paragraphs (Paragraph Text 1 and Paragraph Text 2). The constructed layout information is as follows: the main title is connected to Section Title 1 and Section Title 2 via edges, Section Title 1 is connected to Paragraph Text 1 via edges, and Section Title 2 is also connected to Paragraph Text 2 via edges, forming a graph structure consisting of five text nodes and four edges. There are many structures of the information extraction model, which may include or not include a layout construction layer for constructing layout information. The specific selection depends on the actual situation and this disclosure does not impose any limitation here. In a possible implementation of the present disclosure, the information extraction model does not include a layout construction layer for constructing layout information. Specifically, the information extraction model includes a feature extraction layer, an attention layer, and an information extraction layer. The information extraction model is used to process document text as follows: the document text is input into the feature extraction layer to obtain text character features corresponding to each text character in the document text; in addition to the information extraction model, a layout information construction model is also included, the document text is input into the layout information construction model to obtain layout information; the layout information and the text character features corresponding to each text character are input into the attention layer, the attention layer matches the text character features with the text nodes in the layout information to obtain layout feature information containing text features, and performs attention processing based on the layout feature information to obtain text structure features corresponding to each text node; the text structure features are input into the information extraction layer to obtain information extraction results.In another possible implementation of the present disclosure, the information extraction model includes a layout construction layer. Specifically, the information extraction model includes a layout construction layer, a feature extraction layer, an attention layer, and an information extraction layer. Inputting the document text into the information extraction model to obtain information extraction results in step 304 includes the following steps: inputting the document text into the layout construction layer to obtain layout information, where the layout information includes at least two text nodes and text relationship information between each text node; inputting the layout information into the feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node; inputting the text features corresponding to each text node and text relationship features between each text node into the attention layer to obtain text structural features corresponding to each text node; and inputting the text structural features corresponding to each text node into the information extraction layer to obtain information extraction results. Specifically, the layout construction layer refers to the network layer that constructs layout information based on the document text. The feature extraction layer refers to the network layer that extracts features from the text information. The attention layer is the network layer that defines how the attention of text features is learned within the attention layer. The information extraction layer extracts information from the document text, specifically by extracting information based on features corresponding to the text within the document text. Text relationship information refers to the edge information between text nodes in the layout information. For example, text relationship information could indicate that a headline and section title 1 are connected by an edge, and a headline and section title 2 are connected by an edge. These edges can be directed edges. Text relationship features are features extracted from text relationship information. Text relationship features can also represent relationships between text nodes. Text relationship information is contained in the layout information. When the layout information represents graph structure information, text relationship information only indicates that nodes are connected by edges. Therefore, this text relationship information needs to be input into the feature extraction layer for feature extraction to obtain feature vectors between text nodes, namely, text relationship features.Inputting document text into a layout construction layer to obtain layout information can be achieved by inputting document text into the layout construction layer, wherein the layout construction layer includes a semantic recognition or keyword recognition function, determines texts belonging to different levels, labels the texts according to different levels, and constructs layout information based on the labeling results. For example, the document text includes a main title, chapter title 1, chapter title 2, paragraph text 1, and paragraph text 2. Through semantic recognition, it is determined that the main title is the text of the highest level, chapter title 1 and chapter title 2 are parallel levels and are both lower-level texts of the main title, paragraph text 1 and paragraph text 2 are parallel levels, paragraph text 1 is the lower-level text of chapter title 1, and paragraph text 2 is the lower-level text of chapter title 2. Each text is labeled based on the recognition result, and then the layout information is constructed based on the labeling results. Optionally, when constructing layout information, the layout construction layer can identify the length of text within a text node. If the length exceeds a preset text length, the text within the text node is split to obtain multiple node texts, with the split node texts having the same text relationship information as the node texts before the split. The splitting can be performed by evenly dividing the text content within the text node; alternatively, the splitting can be performed once each time the preset text length is reached, until the last character is reached, at which point recognition and splitting cease. Inputting the layout information into the feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node can be implemented by identifying the text within each document text node in the layout information and the text relationship information between each text node, performing feature mapping on the text and text relationship information, and mapping the mapping to a vector space to obtain text features corresponding to each text node and text relationship features corresponding to the text relationship information. Inputting the text features corresponding to each text node and the text relationship features between the text nodes into the attention layer to obtain the text structural features corresponding to each text node can be achieved by determining the ancestor text node corresponding to each text node and obtaining the text structural features corresponding to each text node based on the text features of the text node and the text features of the ancestor text node. Attention processing is performed based on the text features of the text node and the text features of the ancestor text node to obtain an attention processing result; and based on the attention processing result, the text structural features corresponding to each text node are obtained. The method for obtaining the text structural features corresponding to each text node based on the attention processing result can be to perform a weighted summation of the attention processing results based on the attention processing results to obtain the text structural features corresponding to each text node.The information extraction results can be obtained by inputting the text structural features corresponding to each text node into the information extraction layer, using the information extraction layer to extract key features from the text structural features, and obtaining information extraction results based on the extracted key features. Applying the solution in the disclosed embodiments, the information extraction model includes a layout construction layer, a feature extraction layer, an attention layer, and an information extraction layer. The network layers in the information extraction model process the document text to construct layout information, obtain the text structural features corresponding to each text node in the layout information, and then obtain the information extraction results. This ensures that the information extraction results are obtained based on the text structural features of each text node in the layout information, ensuring the accuracy of the information extraction results. Optionally, inputting the text features and text relationship features of each text node into the attention layer can involve determining the ancestor text node of the current text node and processing the determined ancestor text node and the current text node to obtain the text structural features corresponding to each text node. Specifically, the above step of inputting the text features corresponding to each text node and the text relationship features between each text node into the attention layer to obtain the text structural features corresponding to each text node includes the following steps: determining whether the current text node has a corresponding ancestor text node based on the text relationship features between each text node; if the current text node has a corresponding ancestor text node, obtaining the text structural features corresponding to the current text node based on the text features corresponding to the current text node and the text features corresponding to the ancestor text node; if the current text node does not have a corresponding ancestor text node, obtaining the text structural features corresponding to the current text node based on the text features corresponding to the current text node. When the attention layer processes the text features corresponding to each text node and the text relationship features between each text node, it is necessary to first determine whether the current text node has a corresponding ancestor text node and select different processing methods based on the determination result to ensure processing efficiency. The implementation method for determining whether a current text node has a corresponding ancestor text node based on text relationship features between text nodes specifically involves determining the current text node and searching the text relationship features between text nodes for the ancestor text node corresponding to the current text node. Optionally, if it is determined that the current text node has a corresponding ancestor text node, text features corresponding to the ancestor text node and text features corresponding to the current text node are obtained. The text features corresponding to the current text node and the ancestor text node may be obtained from a cache database.When a current text node has a corresponding ancestor text node, a method for obtaining text structural features corresponding to the current text node based on text features corresponding to the current text node and text features corresponding to the ancestor text node is implemented. Specifically, when it is determined that a corresponding ancestor text node exists for the current text, attention processing is performed on the text features of the current text node and the text features of the ancestor text node according to an attention learning method preset in the attention layer, and the text structural features corresponding to the current text node are obtained based on the attention processing results. The attention learning method preset in the attention layer is an attention learning method obtained by training a pre-trained model based on a sample dataset and fine-tuning the pre-trained model. The method for obtaining text structural features corresponding to the current text node based on the attention processing results can be implemented by performing a weighted summation of the attention processing results to obtain the text structural features corresponding to the current text node. When the current text node does not have a corresponding ancestor text node, the text structural features corresponding to the current text node are obtained based on the text features corresponding to the current text node. Specifically, if it is determined that the current text node does not have a corresponding ancestor text node, attention processing is performed on the text features of the current text node according to the attention learning method preset in the attention layer, and the text structural features corresponding to the current text node are obtained based on the attention processing results. If the current text node has a corresponding ancestor text node, the current text node is determined to be a text node other than the root text node in the layout information; if the current text node does not have a corresponding ancestor text node, the current text node is determined to be the root text node in the layout information. By applying the solution of the embodiment of the present disclosure, the text features corresponding to each text node and the text relationship features between each text node are input into the attention layer in the information extraction model, and it is determined whether the current text node has a corresponding ancestor text node. Different attention processing methods are selected according to the determination result, and attention processing is performed. When the current text node has a corresponding ancestor text node, attention processing is performed using the text features corresponding to the current text node and the ancestor text node respectively, and the text structure features corresponding to the current text node are obtained, so that the text structure features corresponding to each text node can be used when obtaining the information extraction results subsequently, thereby ensuring the accuracy of the information extraction results.Optionally, processing based on the text features corresponding to the current text node and the ancestor text node can be performed by performing an attention calculation, and obtaining the text structural features corresponding to the current text node based on the attention calculation results. Specifically, the above steps of obtaining the text structural features corresponding to the current text node based on the text features corresponding to the current text node and the text features corresponding to the ancestor text node include the following steps: performing an attention calculation on the text features corresponding to the current text node and the text features corresponding to the ancestor text node to obtain a reference text feature generated for the current text node based on the ancestor text node; and obtaining the text structural features corresponding to the current text node based on the reference text feature. When the attention layer in the information extraction model performs processing, attention calculation is performed on the input features, and the output of the attention layer is obtained based on the attention calculation results. Therefore, attention calculation is required to be performed on the text features corresponding to the current text node and the text features corresponding to the ancestor text node to obtain the attention calculation results. Specifically, the reference text feature refers to the text feature calculated for the current text node based on the ancestor text node. An implementation method for performing attention calculation on the text features corresponding to the current text node and the text features corresponding to the ancestor text node to obtain the reference text features generated by the current text node based on the ancestor text node may be to perform attention calculation on the text features corresponding to the current text node and the text features corresponding to the ancestor text node according to a preset attention calculation rule, and obtain the reference text features generated by the current text node based on the ancestor text node based on the attention calculation result. The preset attention calculation rule may be an attention calculation formula, as specifically described in the following formula (1):
[0003] Attentioaf Formula (1) Where Attention is the reference text feature, K (Key) is the key, V (Va I ue) is the value, Q (Query) is the query, Softmax is used to normalize the vector, L is the dimension size of K, / T is the transpose of K, where Q, K and V are obtained by the following formulas (2), (3) and (4) respectively:
[0004] Q = Wq XX 1 Formula (2)
[0005] K = Roar XX Formula (3)
[0006] V ^ W v x X Formula (4) Where, W qΩ and % are both trainable parameter matrices in the attention layer of the information extraction model. X] represents the text features corresponding to the current text node; X represents the text features of the ancestor text node. Based on the attention calculation results, reference text features generated for the current text node based on the ancestor text nodes are obtained. This can be achieved by using the attention calculation results as the reference text features generated for the current text node based on the ancestor text nodes. Based on the reference text features, the text structural features corresponding to the current text node can be obtained by fusion of the reference text features and using the fused features as the text structural features. The feature fusion method varies depending on the number of ancestor text nodes corresponding to the current text node. By applying the solution of the embodiment of the present disclosure, attention calculation is performed on the text features corresponding to the current text node and the text features corresponding to the ancestor text node, and a reference text feature of the current text node generated based on the ancestor text node is obtained; based on the reference text feature, the text structure feature corresponding to the current text node is obtained, so that the text structure feature of the current text node is obtained based on the attention calculation of the text features of the current text node and the text features of the ancestor text node, that is, the generated text structure feature contains the structural information between the current text node and the ancestor text node and the information corresponding to the text features, so that the subsequent information extraction result based on the text structure feature of the current text node can take into account the structural information in the document text, thereby improving the accuracy of the information extraction result. Optionally, after obtaining the reference text features, it is necessary to obtain the text weight between the current text node and the ancestor text node, and process the reference text features based on the text weights to obtain the text structural features corresponding to the current text node. That is, the above steps of obtaining the text structural features corresponding to the current text node based on the reference text features include the following steps: obtaining the text weight between the current text node and the ancestor text node; and obtaining the text structural features corresponding to the current text node based on the text weight between the current text node and the ancestor text node and the reference text features generated by the current text node based on the ancestor text nodes. The number of ancestor text nodes corresponding to the current text node can be one or more, and the corresponding reference text features can be one or more. To obtain the text structural features corresponding to the current text node based on the reference text features, one or more reference text features need to be processed to obtain the text structural features corresponding to the current text node. Since the text relationship information between text nodes in the layout information is different, with different distances along the path, it is necessary to obtain the text weight between the current text node and the ancestor text node, and process the reference text features based on the text weights to obtain the text structural features corresponding to the current text node.Specifically, text weight refers to the weight between two text nodes. A text node to a root text node forms a path, and the sum of the text weights between the text node and all text nodes along the path is 1. The text weight between the current text node and its ancestor text node can be obtained from a text weight setting rule, which is specifically set based on actual circumstances and is not limited in this disclosure. In one possible implementation of this disclosure, the text weight setting rule can be pre-set based on the distance between text nodes along the path. For example, the text weight of two directly connected text nodes is 0.6, the text weight of two indirectly connected text nodes is 0.3, and the text weight of two text nodes separated by two text nodes is 0.1, etc. In another possible implementation of the present disclosure, the text weight setting rule may also be to set the text weight according to the text distance between the text node and the text node farthest away on the path. For example, if there is one text node between the current text node and the root text node, that is, there are three nodes on the path, then the text weight between the current text node and the middle text node is set to 0.6, and the text weight between the current node and the root text node is set to 0.4. OOptionally, after setting the text weight between the current text node and the ancestor text node according to the text weight setting rule, the text weight can be modified again. The implementation method of obtaining the text structure feature corresponding to the current text node based on the text weight between the current text node and the ancestor text node and the reference text feature generated by the current text node based on the ancestor text node can be to perform feature fusion based on the text weight between the current text node and the ancestor text node and the reference text feature generated by the current text node based on the ancestor text node to obtain the text structure feature corresponding to the current text node, wherein the feature fusion method can be weighted summation or weighted splicing, which is specifically selected according to actual conditions, and the present disclosure does not make any restrictions here. Applying the solution of the embodiment of the present disclosure, the text weight between the current text node and the ancestor text node is obtained; based on the text weight between the current text node and the ancestor text node and the reference text feature generated by the current text node based on the ancestor text node, the text structure feature corresponding to the current text node is obtained. Based on the obtained text weight and reference text features, the text structure features corresponding to the current text node are obtained, so that the obtained text structure features are obtained by processing the reference text features according to the corresponding text weights, ensuring that different reference text features have different proportions in my structural features, making full use of the distance between each text node, and improving the accuracy of the information extraction results obtained based on text structure feature extraction. Optionally, when there are two ancestor text nodes corresponding to the current text node, two reference text features are fused using different text weights to obtain the text structure feature corresponding to the current text node. That is, the current text node includes at least two ancestor text nodes. The above steps of obtaining the text structure feature corresponding to the current text node based on the text weights between the current text node and the ancestor text nodes and the reference text features generated by the current text node based on the ancestor text nodes include the following steps: determining a first weighted text feature corresponding to the current text node based on the text weight between the current text node and the first ancestor text node and the reference text feature generated by the current text node based on the first ancestor text node; determining a second weighted text feature corresponding to the current text node based on the text weight between the current text node and the second ancestor text node and the reference text feature generated by the current text node based on the second ancestor text node; and performing feature fusion based on the first weighted text feature and the second weighted text feature to obtain the text structure feature corresponding to the current text node. Specifically, the first weighted text feature refers to the text feature corresponding to the first ancestor text node in the structure corresponding to the current text node. The second weighted text feature refers to the text feature corresponding to the second ancestor text node in the structure corresponding to the current text node.If the current text node corresponds to at least two ancestor text nodes, then the current text node is determined to have at least two reference text features, with the number of ancestor text nodes corresponding to the number of reference text features. The first ancestor text node and the second ancestor text node are any two ancestor text nodes from the at least two ancestor text nodes, wherein the first ancestor text node and the second ancestor text node are different. Determining the first weighted text feature corresponding to the current text node based on the text weight between the current text node and the first ancestor text node and the reference text feature generated for the current text node based on the first ancestor text node may be accomplished by multiplying the text weight between the current text node and the first ancestor text node by the reference text feature generated for the current text node based on the first ancestor text node to obtain the first weighted text feature corresponding to the current text node. Determining the second weighted text feature corresponding to the current text node based on the text weight between the current text node and the second ancestor text node and the reference text feature generated for the current text node based on the second ancestor text node may be accomplished by multiplying the text weight between the current text node and the second ancestor text node by the reference text feature generated for the current text node based on the second ancestor text node to obtain the second weighted text feature corresponding to the current text node. The method for implementing feature fusion based on the first weighted text feature and the second weighted text feature to obtain the text structure feature corresponding to the current text node can be to add the first weighted text feature and the second weighted text feature to obtain the text structure feature corresponding to the current text node; or to concatenate the first weighted text feature and the second weighted text feature to obtain the text structure feature corresponding to the current text node. Applying the solution of the embodiment of the present disclosure, when there are at least two ancestor text nodes corresponding to the current text node, the weighted text feature generated by the current text node based on the ancestor text node is obtained by utilizing the text weights between the ancestor text node and the current text node and the reference text feature generated by the current text node based on the ancestor text node. Processing is then performed based on each weighted text feature to obtain the text structure feature corresponding to the current text node, so that subsequent processing based on the text structure feature corresponding to the current text node is performed to obtain an information extraction result, thereby ensuring the accuracy of the information extraction result.Optionally, the layout information includes text relationship information between at least two text nodes and each of the text nodes. After the layout information is input into the feature extraction layer, the feature extraction layer performs feature extraction on the text relationship information between the at least two text nodes and each of the text nodes to obtain corresponding text features and text relationship features. That is, the above steps of inputting the layout information into the feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node include the following steps: obtaining text information corresponding to each text node in the layout information and text relationship information between each text node; performing feature extraction on the text information corresponding to each text node to obtain text features corresponding to each text node; and performing feature extraction on the text relationship information between each text node to obtain text relationship features between each text node. The layout information includes text relationship information between at least two text nodes, and when feature extraction is performed on the layout information, feature extraction is performed on each piece of information in the layout information. The method for obtaining the text information corresponding to each text node in the layout information and the text relationship information between each text node can be to identify the information in the layout information and obtain the text information corresponding to each text node and the text relationship information between each text node. The obtained information can be divided according to text node or according to text information and text relationship information. The specific method is selected based on actual circumstances and is not limited in this disclosure. The method for extracting features from the text information corresponding to each text node and obtaining the text features corresponding to each text node can be specifically performed by mapping the text information corresponding to each text node into a vector space to obtain the text features corresponding to each text node. The method for extracting features from the text relationship information between each text node and obtaining the text relationship features between each text node can be specifically performed by mapping the text relationship information between each text node into a vector space to obtain the text relationship features between each text node. By applying the solution of the embodiment of the present disclosure, feature extraction is performed on the text information corresponding to each text node contained in the layout information and the text relationship information between each text node, so as to obtain the text features corresponding to each text node and the text relationship features between each text node, so that subsequent corresponding processing can be performed based on the obtained text features and text relationship features to obtain information extraction results, thereby ensuring the accuracy of the information extraction results.Optionally, after obtaining text features through the feature extraction layer, the text features can be stored in a cache database. This allows subsequent determination of the ancestor text node corresponding to the current text node to obtain the text features corresponding to the ancestor text node and perform corresponding processing. Specifically, after inputting the layout information into the feature extraction layer in the aforementioned steps to obtain the text features corresponding to each text node and the text relationship features between each text node, the following step is further included: storing the text features corresponding to each node in the layout information in a cache database, wherein the cache database is configured to store the text features corresponding to each text node in the layout information. The attention layer obtains the text structural features corresponding to each text node by processing each text node separately. Therefore, after the feature extraction layer obtains the text features corresponding to each text node, the text features can be stored in a storage database. When processing each text node, the text features corresponding to the corresponding text node are obtained, attention processing is performed, and the text structural features corresponding to each text node are obtained. Specifically, the cache database refers to a data source that stores the text features corresponding to each text node in the layout information. Storing the text features corresponding to each node in the layout information in the cache database can be implemented by categorizing the text features stored in the cache database according to the layout information and storing them according to the categories. Optionally, after the information extraction model completes processing the layout information, the text features corresponding to each text node in the corresponding layout information can be deleted from the cache database. Optionally, in addition to storing the text features corresponding to each text node in the cache database, the text relationship features between the text nodes can also be stored in the cache database, so that the relationship text features corresponding to the current text node and other text nodes can be subsequently obtained from the cache database. Using the solution of the embodiment of the present disclosure, after the feature extraction layer outputs the text features corresponding to each text node, the text features corresponding to each text node are stored in the cache database. When each text node is subsequently processed, the corresponding text features can be obtained from the cache database to obtain the text structural features corresponding to each text node. Information extraction results are then obtained based on the text structural features corresponding to each text node, thereby improving the accuracy of the information extraction results while ensuring the efficiency of information extraction. In one or more embodiments of the present disclosure, document structure information at the document layout level is introduced to extract information from document text using a document-level information extraction approach. This helps the information extraction model optimize extraction results by focusing on structural information, thereby improving cross-section extraction and long document extraction. The following, with reference to FIG4a, further illustrates the information extraction method provided by the present disclosure using the application of the method to document extraction as an example.Figure 4a shows a flowchart of the processing process of an information extraction method provided by one embodiment of the present disclosure, which specifically includes the following steps. Step 402: Obtain document text. Obtain document text, where the document text includes a document title, paragraph content 1, first-level heading 1, and first-level heading 2, first-level heading 1 includes second-level heading 1 and second-level heading 2, first-level heading 2 includes paragraph content 2, second-level heading 1 includes paragraph content 3, and second-level heading 2 includes paragraph content 4. Step 404: Input the document text into the layout construction layer to obtain layout information, where the layout information includes at least two text nodes and text relationship information between each text node. Document text is input into the layout construction layer to obtain layout information. See Figure 4b, which shows a schematic diagram of layout information in an information extraction method provided by one embodiment of the present disclosure: the document title is connected to paragraph content 1, first-level heading 1, and first-level heading 2, respectively. First-level heading 1 is connected to second-level heading 1 and second-level heading 2, respectively. First-level heading 2 is connected to paragraph content 2, second-level heading 1 is connected to paragraph content 3, and second-level heading 2 is connected to paragraph content 4. The document title is the root text node, and directions are assigned to the corresponding edges starting from the root text node and proceeding to any other text node in sequence. Each text node in the layout information includes the text information corresponding to the text node. Step 406: Obtain the text information corresponding to each text node in the layout information and the text relationship information between the text nodes. Step 408: Perform feature extraction on the text information corresponding to each text node to obtain the text features corresponding to each text node; and perform feature extraction on the text relationship information between the text nodes to obtain the text relationship features between the text nodes. Step 410: Determine whether the current text node has a corresponding ancestor text node based on the text relationship features between the text nodes. Step 412: If the current text node has a corresponding ancestor text node, perform an attention calculation on the text features corresponding to the current text node and the text features corresponding to the ancestor text node to obtain a reference text feature generated for the current text node based on the ancestor text node.For the current text node being Level 2 Title 1, Level 1 Title 1 and the document title being the ancestor text node corresponding to Level 2 Title 1, according to the above formulas (1) to (4), calculate the reference text feature 1 generated by Level 2 Title 1 based on Level 1 Title 1, and calculate the reference text feature 2 generated by Level 2 Title 1 based on the document title. Similarly, in the same manner, calculate the corresponding ancestor text nodes for Paragraph Content 1, Level 1 Title 1, Level 1 Title 2, Level 2 Title 1, Paragraph Content 2, Paragraph Content 3, and Paragraph Content 4. If there is no corresponding ancestor text node for the current text node, obtain the text structure feature corresponding to the current text node based on the text feature corresponding to the current text node. For the current text node being the document title, determine that the reference text feature corresponding to the document title is the text feature corresponding to the document title. Step 414: Obtain the text weight between the current text node and the ancestor text node. For the current text node being Level 2 Title 1, determine that the text weight between Level 2 Title 1 and Level 1 Title 1 is 0.7; and the text weight between Level 2 Title 1 and the document title is 0.3. Similarly, the text weights between other text nodes and their corresponding ancestor text nodes are obtained. Steps 416 to 420 below are described specifically for the current text node being Level 2 Heading 1. Step 416: Based on the text weight between the current text node and the first ancestor text node and the reference text feature generated for the current text node based on the first ancestor text node, a first weighted text feature corresponding to the current text node is determined. The text weight between Level 2 Heading 1 and Level 1 Heading 1 (0.7) is multiplied by Reference Text Feature 1 generated for Level 2 Heading 1 based on Level 1 Heading 1 to obtain the first weighted text feature. Step 418: Based on the text weight between the current text node and the second ancestor text node and the reference text feature generated for the current text node based on the second ancestor text node, a second weighted text feature is determined for the current text node. The text weight between Level 2 Heading 1 and the document title (0.3) is multiplied by Reference Text Feature 2 generated for Level 2 Heading 1 based on the document title to obtain the second weighted text feature. Step 420: Feature fusion is performed based on the first and second weighted text features to obtain the text structure feature corresponding to the current text node. The first weighted text feature and the second weighted text feature are added together to obtain the text structure feature corresponding to the secondary title 1. Step 422: The text structure feature corresponding to each text node is input into the information extraction layer to obtain the information extraction result.The solution in the embodiment of the present disclosure is applied to obtain document text; the document text is input into an information extraction model to obtain an information extraction result. The information extraction model includes an attention layer, which obtains text structural features corresponding to each text node in the layout information based on the layout information corresponding to the document text. The text structural features are obtained by combining the text features corresponding to the current text node and the ancestor text node, where the ancestor text node corresponding to the current text node is determined by the layout information. The text structural features corresponding to the current text node are obtained by combining the text features between the current text node and the ancestor text node in the layout information. This ensures that the information extraction result obtained by the information extraction model is based on the text structural features corresponding to each text node in the layout information corresponding to the document text, thereby improving the accuracy of the information extraction result. Corresponding to the above-mentioned method embodiment, the present disclosure also provides an information extraction device embodiment. FIG5 shows a schematic structural diagram of an information extraction device provided by an embodiment of the present disclosure. As shown in Figure 5, the device includes: an acquisition module 502, configured to acquire document text; an acquisition module 504, configured to input the document text into an information extraction model to obtain information extraction results, wherein the information extraction model includes an attention layer, and the attention layer obtains text structure features corresponding to each text node in the layout information based on the layout information corresponding to the document text. The text structure features are obtained by text features corresponding to the current text node and the ancestor text node, and the ancestor text node corresponding to the current text node is determined by the layout information. Optionally, the information extraction model includes a layout construction layer, a feature extraction layer, an attention layer, and an information extraction layer; the acquisition module 504 is further configured to input the document text into the layout construction layer to obtain layout information, wherein the layout information includes at least two text nodes and text relationship information between each text node; input the layout information into the feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node; input the text features corresponding to each text node and the text relationship features between each text node into the attention layer to obtain text structural features corresponding to each text node; and input the text structural features corresponding to each text node into the information extraction layer to obtain information extraction results. Optionally, the acquisition module 504 is further configured to determine whether a corresponding ancestor text node exists for the current text node based on the text relationship features between each text node; if the current text node exists for the corresponding ancestor text node, obtain the text structural features corresponding to the current text node based on the text features corresponding to the current text node and the text features corresponding to the ancestor text node; if the current text node does not exist for the corresponding ancestor text node, obtain the text structural features corresponding to the current text node based on the text features corresponding to the current text node.Optionally, obtaining module 504 is further configured to perform attention calculation on the text features corresponding to the current text node and the text features corresponding to the ancestor text nodes to obtain a reference text feature of the current text node generated based on the ancestor text node; and obtain the text structural feature corresponding to the current text node based on the reference text feature. Optionally, obtaining module 504 is further configured to obtain the text weight between the current text node and the ancestor text node; and obtain the text structural feature corresponding to the current text node based on the text weight between the current text node and the ancestor text node and the reference text feature generated by the current text node based on the ancestor text node. Optionally, the current text node includes at least two ancestor text nodes; obtaining module 504 is further configured to determine a first weighted text feature corresponding to the current text node based on the text weight between the current text node and the first ancestor text node and the reference text feature generated by the current text node based on the first ancestor text node; and determine a second weighted text feature corresponding to the current text node based on the text weight between the current text node and the second ancestor text node and the reference text feature generated by the current text node based on the second ancestor text node; and perform feature indigo on the first weighted text feature and the second weighted text feature to obtain the text structural feature corresponding to the current text node. Optionally, the acquisition module 504 is further configured to acquire text information corresponding to each text node in the layout information and text relationship information between each text node; perform feature extraction on the text information corresponding to each text node to acquire text features corresponding to each text node; and perform feature extraction on the text relationship information between each text node to acquire text relationship features between each text node. Optionally, the acquisition module 504 is further configured to store the text features corresponding to each node in the layout information in a cache data source, wherein the cache data source is configured to store the text features corresponding to each text node in the layout information. The solution in the disclosed embodiment is applied to acquire document text; the document text is input into an information extraction model to acquire information extraction results. The information extraction model includes an attention layer, which acquires text structural features corresponding to each text node in the layout information based on the layout information corresponding to the document text. The text structural features are acquired from text features corresponding to the current text node and an ancestor text node, wherein the ancestor text node corresponding to the current text node is determined by the layout information. By using the text features between the current text node and its ancestor text nodes in the layout information, the text structural features corresponding to the current text node are obtained. This ensures that the information extraction model extracts information based on the text structural features corresponding to each text node in the layout information corresponding to the document text, thereby improving the accuracy of the information extraction results. The above is an exemplary embodiment of an information extraction device according to this embodiment.It should be noted that the technical solution of the information extraction device and the technical solution of the above-mentioned information extraction method are based on the same concept. For details not described in detail in the technical solution of the information extraction device, please refer to the description of the technical solution of the above-mentioned information extraction method. Figure 6 shows a block diagram of the structure of a computing device provided by one embodiment of the present disclosure. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is configured to store data. The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface. In one embodiment of the present disclosure, the aforementioned components of the computing device 600 and other components not shown in FIG. 6 may also be connected to each other, for example, via a bus. It should be understood that the computing device structure block diagram shown in FIG. 6 is for illustrative purposes only and does not limit the scope of the present disclosure. Those skilled in the art may add or replace other components as needed.The computing device 600 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, personal digital assistant, laptop computer, notebook computer, netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or personal computer (PC). The computing device 600 can also be a mobile or stationary server. The processor 620 is configured to execute the following computer-executable instructions: obtaining document text; inputting the document text into an information extraction model to obtain information extraction results. The information extraction model includes an attention layer, which obtains text structural features corresponding to each text node in the layout information based on the layout information corresponding to the document text. The text structural features are obtained from text features corresponding to the current text node and an ancestor text node. The ancestor text node corresponding to the current text node is determined by the layout information. The processor 620 is further configured to execute the following computer-executable instructions: input document text into a layout construction layer to obtain layout information, wherein the layout information includes text relationship information between at least two text nodes and each text node; input the layout information into a feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node; input the text features corresponding to each text node and the text relationship features between each text node into an attention layer to obtain text structural features corresponding to each text node; and input the text structural features corresponding to each text node into an information extraction layer to obtain information extraction results. The processor 620 is further configured to execute the following computer-executable instructions: determine whether a current text node has a corresponding ancestor text node based on the text relationship features between each text node; if the current text node has a corresponding ancestor text node, obtain a text structural feature corresponding to the current text node based on the text features corresponding to the current text node and the text features corresponding to the ancestor text node; if the current text node does not have a corresponding ancestor text node, obtain a text structural feature corresponding to the current text node based on the text features corresponding to the current text node. In which, the processor 620 is further configured to execute the following computer-executable instructions: perform attention calculation on the text features corresponding to the current text node and the text features corresponding to the ancestor text node to obtain a reference text feature of the current text node generated based on the ancestor text node; and obtain a text structure feature corresponding to the current text node based on the reference text feature.The processor 620 is further configured to execute the following computer-executable instructions: obtaining a text weight between a current text node and an ancestor text node; obtaining a text structural feature corresponding to the current text node based on the text weight between the current text node and the ancestor text node and a reference text feature generated by the current text node based on the ancestor text node. The processor 620 is further configured to execute the following computer-executable instructions: obtaining a text structural feature corresponding to the current text node based on the text weight between the current text node and the ancestor text node and a reference text feature generated by the current text node based on the ancestor text node, including: determining a first weighted text feature corresponding to the current text node based on the text weight between the current text node and a first ancestor text node and a reference text feature generated by the current text node based on the first ancestor text node; determining a second weighted text feature corresponding to the current text node based on the text weight between the current text node and a second ancestor text node and a reference text feature generated by the current text node based on the second ancestor text node; and performing feature fusion based on the first weighted text feature and the second weighted text feature to obtain a text structural feature corresponding to the current text node. The processor 620 is further configured to execute the following computer-executable instructions: obtain text information corresponding to each text node in the layout information and text relationship information between each text node; perform feature extraction on the text information corresponding to each text node to obtain text features corresponding to each text node; perform feature extraction on the text relationship information between each text node to obtain text relationship features between each text node. The processor 620 is further configured to execute the following computer-executable instructions: store the text features corresponding to each node in the layout information in a cache database, wherein the cache database may be configured to store the text features corresponding to each text node in the layout information. When executed by the processor, these computer-executable instructions implement the steps of the aforementioned information extraction method. The above is a schematic diagram of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the aforementioned information extraction method are based on the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the aforementioned information extraction method. An embodiment of the present disclosure also provides a computer-readable storage medium storing computer-executable instructions. When executed by the processor, these computer-executable instructions implement the steps of the aforementioned information extraction method.Optionally, the computer-executable instructions, when executed by a processor, implement program code that: obtains document text; inputs the document text into an information extraction model to obtain an information extraction result, wherein the information extraction model includes an attention layer, and the attention layer obtains text structural features corresponding to each text node in the layout information based on layout information corresponding to the document text, wherein the text structural features are obtained from text features corresponding to the current text node and an ancestor text node, wherein the ancestor text node corresponding to the current text node is determined by the layout information. Optionally, the computer-executable instructions, when further executed by a processor, implement program code that: inputs the document text into a layout construction layer to obtain layout information, wherein the layout information includes text relationship information between at least two text nodes and each text node; inputs the layout information into a feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node; inputs the text features corresponding to each text node and text relationship features between each text node into the attention layer to obtain text structural features corresponding to each text node; and inputs the text structural features corresponding to each text node into the information extraction layer to obtain an information extraction result. Optionally, the computer-executable instructions further implement program code that, when executed by a processor, implements the following steps: determining whether a current text node has a corresponding ancestor text node based on text relationship features between text nodes; if the current text node has a corresponding ancestor text node, obtaining text structural features corresponding to the current text node based on the text features corresponding to the current text node and the text features corresponding to the ancestor text node; if the current text node does not have a corresponding ancestor text node, obtaining text structural features corresponding to the current text node based on the text features corresponding to the current text node. Optionally, the computer-executable instructions further implement program code that, when executed by a processor, implements the following steps: performing attention calculation on text features corresponding to the current text node and text features corresponding to the ancestor text node to obtain reference text features of the current text node generated based on the ancestor text node; obtaining text structural features corresponding to the current text node based on the reference text features. Optionally, the computer-executable instructions further implement program code that, when executed by a processor, implements the following steps: obtaining a text weight between the current text node and the ancestor text node; obtaining text structural features corresponding to the current text node based on the text weight between the current text node and the ancestor text node and the reference text features of the current text node generated based on the ancestor text node.Optionally, the computer-executable instructions further implement program code that, when executed by a processor, implements the following steps: obtaining a text structural feature corresponding to the current text node based on the text weights between the current text node and an ancestor text node and reference text features generated by the current text node based on the ancestor text node, including: determining a first weighted text feature corresponding to the current text node based on the text weights between the current text node and a first ancestor text node and the reference text features generated by the current text node based on the first ancestor text node; determining a second weighted text feature corresponding to the current text node based on the text weights between the current text node and a second ancestor text node and the reference text features generated by the current text node based on the second ancestor text node; and performing feature fusion based on the first weighted text feature and the second weighted text feature to obtain a text structural feature corresponding to the current text node. Optionally, the computer-executable instructions further implement program code that, when executed by a processor, implements the following steps: obtaining text information corresponding to each text node in layout information and text relationship information between each text node; performing feature extraction on the text information corresponding to each text node to obtain a text feature corresponding to each text node; and performing feature extraction on the text relationship information between each text node to obtain a text relationship feature between each text node. Optionally, the computer-executable instructions are also program codes that implement the following steps when executed by the processor: storing the text features corresponding to each node in the layout information in a cache database, wherein the cache database can be configured to store the text features corresponding to each text node in the layout information. The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the above-mentioned information extraction method belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the above-mentioned information extraction method. One embodiment of the present disclosure also provides a computer program, wherein, when the computer program is executed in a computer, the computer is instructed to execute the steps of the above-mentioned information extraction method. Optionally, when the above-mentioned computer program is executed by a processor, program code for implementing the following steps: obtaining document text; inputting the document text into an information extraction model to obtain information extraction results, wherein the information extraction model includes an attention layer, and the attention layer obtains text structure features corresponding to each text node in the layout information based on the layout information corresponding to the document text, and the text structure features are obtained by text features corresponding to the current text node and the ancestor text node, and the ancestor text node corresponding to the current text node is determined by the layout information.Optionally, the computer program further includes program code that, when executed by a processor, implements the following steps: inputting document text into a layout construction layer to obtain layout information, wherein the layout information includes text relationship information between at least two text nodes and each text node; inputting the layout information into a feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node; inputting the text features corresponding to each text node and the text relationship features between each text node into an attention layer to obtain text structural features corresponding to each text node; and inputting the text structural features corresponding to each text node into an information extraction layer to obtain information extraction results. Optionally, the computer program further includes program code that, when executed by a processor, implements the following steps: determining whether a current text node has a corresponding ancestor text node based on the text relationship features between each text node; if the current text node has a corresponding ancestor text node, obtaining a text structural feature corresponding to the current text node based on the text features corresponding to the current text node and the text features corresponding to the ancestor text node; if the current text node does not have a corresponding ancestor text node, obtaining a text structural feature corresponding to the current text node based on the text features corresponding to the current text node. Optionally, when executed by a processor, the computer program further implements program code that: performs attention calculation on text features corresponding to the current text node and text features corresponding to ancestor text nodes to obtain reference text features of the current text node generated based on the ancestor text nodes; and obtains text structural features corresponding to the current text node based on the reference text features. Optionally, when executed by a processor, the computer program further implements program code that: obtains text weights between the current text node and the ancestor text node; and obtains text structural features corresponding to the current text node based on the text weights between the current text node and the ancestor text node and the reference text features of the current text node generated based on the ancestor text nodes.Optionally, the computer program further includes program code that, when executed by a processor, implements the following steps: obtaining a text structural feature corresponding to the current text node based on the text weights between the current text node and an ancestor text node and reference text features generated by the current text node based on the ancestor text node, including: determining a first weighted text feature corresponding to the current text node based on the text weights between the current text node and a first ancestor text node and reference text features generated by the current text node based on the first ancestor text node; determining a second weighted text feature corresponding to the current text node based on the text weights between the current text node and a second ancestor text node and reference text features generated by the current text node based on the second ancestor text node; and performing feature fusion based on the first weighted text feature and the second weighted text feature to obtain a text structural feature corresponding to the current text node. Optionally, the computer program further includes program code that, when executed by a processor, implements the following steps: obtaining text information corresponding to each text node in layout information and text relationship information between each text node; performing feature extraction on the text information corresponding to each text node to obtain a text feature corresponding to each text node; and performing feature extraction on the text relationship information between each text node to obtain a text relationship feature between each text node. Optionally, the computer program described above further comprises program code that, when executed by a processor, implements the following steps: storing text features corresponding to each node in the layout information in a cache database, wherein the cache database may be configured to store text features corresponding to each text node in the layout information. The above is an illustrative embodiment of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the information extraction method described above are based on the same concept. For details not described in detail in the technical solution of the computer program, please refer to the description of the technical solution of the information extraction method described above. The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous. The computer instructions comprise computer program code, which may be in source code form, object code form, executable file, or some intermediate form.The computer-readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunications signal, and software distribution media. It should be noted that the content of the computer-readable medium may be appropriately increased or decreased based on the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media does not include electric carrier signals and telecommunications signals. The present disclosure also provides a processor. Figure 7 shows a schematic diagram of the structure of a processor used to implement the present disclosure. As shown in Figure 7, the processor 700 is configured to run a program, wherein the program, when executed by the processor, executes the method in the above-described embodiment. In the present disclosure, the processor 700 can execute the program for executing the information extraction method. Optionally, in this embodiment, process B 700 may be configured to perform the following steps: obtaining document text; inputting the document text into an information extraction model to obtain information extraction results, wherein the information extraction model includes an attention layer, and the attention layer obtains text structural features corresponding to each text node in the layout information based on layout information corresponding to the document text. The text structural features are obtained from text features corresponding to the current text node and an ancestor text node, and the ancestor text node corresponding to the current text node is determined by the layout information. Optionally, in this embodiment, process B 700 may also be configured to perform the following steps: inputting the document text into a layout construction layer to obtain layout information, wherein the layout information includes text relationship information between at least two text nodes and each text node; inputting the layout information into a feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node; inputting the text features corresponding to each text node and text relationship features between each text node into the attention layer to obtain text structural features corresponding to each text node; and inputting the text structural features corresponding to each text node into the information extraction layer to obtain information extraction results.Optionally, in this embodiment, processor 700 is further configured to perform the following steps: determining whether a current text node has a corresponding ancestor text node based on text relationship features between text nodes; if the current text node has a corresponding ancestor text node, obtaining text structural features corresponding to the current text node based on the text features corresponding to the current text node and the text features corresponding to the ancestor text node; if the current text node does not have a corresponding ancestor text node, obtaining text structural features corresponding to the current text node based on the text features corresponding to the current text node. Optionally, in this embodiment, process B 700 is further configured to perform the following steps: performing attention calculation on the text features corresponding to the current text node and the text features corresponding to the ancestor text node to obtain reference text features generated for the current text node based on the ancestor text node; and obtaining text structural features corresponding to the current text node based on the reference text features. Optionally, in this embodiment, processor 700 is further configured to perform the following steps: obtaining a text weight between the current text node and the ancestor text node; and obtaining text structural features corresponding to the current text node based on the text weight between the current text node and the ancestor text node and the reference text features generated for the current text node based on the ancestor text node. Optionally, in this embodiment, process S700 is further configured to execute the following steps: obtaining a text structural feature corresponding to the current text node based on the text weight between the current text node and an ancestor text node and a reference text feature generated by the current text node based on the ancestor text node, including: determining a first weighted text feature corresponding to the current text node based on the text weight between the current text node and a first ancestor text node and a reference text feature generated by the current text node based on the first ancestor text node; determining a second weighted text feature corresponding to the current text node based on the text weight between the current text node and a second ancestor text node and a reference text feature generated by the current text node based on the second ancestor text node; and performing feature fusion based on the first weighted text feature and the second weighted text feature to obtain a text structural feature corresponding to the current text node. Optionally, in this embodiment, processor 700 is further configured to execute the following steps: obtaining text information corresponding to each text node in the layout information and text relationship information between each text node; performing feature extraction on the text information corresponding to each text node to obtain a text feature corresponding to each text node; and performing feature extraction on the text relationship information between each text node to obtain a text relationship feature between each text node. Optionally, in this embodiment, the processor 700 is further configured to perform the following steps: storing text features corresponding to each node in the layout information into a cache data source, wherein the cache data source may be configured to store text features corresponding to each text node in the layout information.It should be noted that, for ease of description, the aforementioned method embodiments are described as a series of actions. However, those skilled in the art should understand that the embodiments of the present disclosure are not limited by the order of the actions described, as certain steps may be performed in a different order or simultaneously, depending on the embodiments of the present disclosure. Furthermore, those skilled in the art should also understand that the embodiments described in this disclosure are preferred embodiments, and the actions and modules described are not necessarily required for the embodiments of the present disclosure. In the above embodiments, the description of each embodiment has its own emphasis. For portions not described in detail in a particular embodiment, reference should be made to the relevant descriptions of other embodiments. The preferred embodiments of the present disclosure disclosed above are merely provided to illustrate the present disclosure. The optional embodiments do not describe all details in detail, nor do they limit the present disclosure to the specific implementation methods described. Obviously, many modifications and variations are possible based on the content of the embodiments of the present disclosure. The present disclosure selects and describes these embodiments in detail to better explain the principles and practical applications of the embodiments of the present disclosure, thereby enabling those skilled in the art to better understand and utilize the present disclosure. The present disclosure is limited only by the claims and their full scope and equivalents. Industrial Applicability The solution provided by the embodiment of the present disclosure can be applied to the process of extracting information through an information extraction model to obtain document text; the document text is input into the information extraction model to obtain information extraction results, wherein the information extraction model includes an attention layer, and the attention layer obtains text structure features corresponding to each text node in the layout information based on the layout information corresponding to the document text, and the text structure features are obtained by text features corresponding to the current text node and the ancestor text node, and the ancestor text node corresponding to the current text node is determined by the layout information, thereby solving the technical problem of low accuracy of information extraction results.
Claims
Claims 1. An information extraction method, comprising: Get the document text; The document text is input into an information extraction model to obtain an information extraction result, wherein the information extraction model includes an attention layer, and the attention layer obtains text structure features corresponding to each text node in the layout information based on the layout information corresponding to the document text, and the text structure features are obtained by text features corresponding to the current text node and the ancestor text node, and the ancestor text node corresponding to the current text node is determined by the layout information.
2. The method according to claim 1, wherein the information extraction model comprises a layout construction layer, a feature extraction layer, an attention layer and an information extraction layer; inputting the document text into the information extraction model to obtain an information extraction result, comprising: The document text is input into the layout construction layer to obtain layout information, wherein the layout information includes at least two text nodes and text relationship information between each text node; the layout information is input into the feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node; the text features corresponding to each text node and text relationship features between each text node are input into the attention layer to obtain text structure features corresponding to each text node; the text structure features corresponding to each text node are input into the information extraction layer to obtain information extraction results.
3. The method according to claim 2, inputting the text features corresponding to each text node and the text relationship features between each text node into the attention layer to obtain the text structure features corresponding to each text node, comprising: Determine whether the current text node has a corresponding ancestor text node based on the text relationship features between the text nodes; if the current text node has a corresponding ancestor text node, obtain the text structure features corresponding to the current text node based on the text features corresponding to the current text node and the text features corresponding to the ancestor text node; In the case that the current text node does not have a corresponding ancestor text node, the text structure feature corresponding to the current text node is obtained based on the text feature corresponding to the current text node.
4. The method according to claim 3, obtaining the text structure feature corresponding to the current text node based on the text feature corresponding to the current text node and the text feature corresponding to the ancestor text node, comprises: 29 Perform attention calculation on the text features corresponding to the current text node and the text features corresponding to the ancestor text node to obtain the reference text features of the current text node generated based on the ancestor text node; based on the reference text features, obtain the text structure features corresponding to the current text node.
5. The method according to claim 4, obtaining the text structure feature corresponding to the current text node based on the reference text feature, comprises: Obtaining the text weight between the current text node and the ancestor text node; Based on the text weight between the current text node and the ancestor text node and the reference text feature generated by the current text node based on the ancestor text node, the text structure feature corresponding to the current text node is obtained.
6. The method according to claim 5, wherein the ancestor text nodes corresponding to the current text node include at least two; obtaining the text structure feature corresponding to the current text node based on the text weight between the current text node and the ancestor text node and the reference text feature generated by the current text node based on the ancestor text node, comprising: Determine a first weighted text feature corresponding to the current text node based on a text weight between the current text node and a first ancestor text node and a reference text feature generated by the current text node based on the first ancestor text node; Based on the text weight between the current text node and the second ancestor text node and the reference text feature generated by the current text node based on the second ancestor text node, determine the second weighted text feature corresponding to the current text node; based on the first weighted text feature and the second weighted text feature, perform feature fusion to obtain the text structure feature corresponding to the current text node.
7. The method according to claim 2, wherein the layout information is input into the feature extraction layer to obtain text features corresponding to each text node and text relationship features between each text node, comprising: Acquire text information corresponding to each text node in the layout information and text relationship information between each text node; perform feature extraction on the text information corresponding to each text node to obtain text features corresponding to each text node; perform feature extraction on the text relationship information between each text node to obtain text relationship features between each text node.
8. The method according to claim 2, after inputting the layout information into the feature extraction layer to obtain the text features corresponding to each text node and the text relationship features between each text node, further comprises: 30 The text features corresponding to each node in the layout information are stored in a cache data source, wherein the cache data source is configured to store the text features corresponding to each text node in the layout information.
9. An information extraction device, comprising: Get module, set to get document text; An acquisition module is configured to input the document text into an information extraction model to obtain an information extraction result, wherein the information extraction model includes an attention layer, and the attention layer obtains text structure features corresponding to each text node in the layout information based on the layout information corresponding to the document text, and the text structure features are obtained by text features corresponding to a current text node and an ancestor text node, and the ancestor text node corresponding to the current text node is determined by the layout information.
10. A computing device comprising: Memory and processor; The memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the steps of the method described in any one of claims 1 to 8.
Citation Information
Patent Citations
Text relation extraction method based on graph network
CN114491074A
Business document information extraction method based on variant attention and hierarchical structure
CN115098673A
Resume information extraction method and device, electronic equipment and storage medium
CN115690795A
Document Information Extraction Without Additional Annotations
US20220129671A1
Cited By
Nuclear power safety report data extraction method and system based on multi-modal feature fusion
CN121074928A
