Entity extraction method and device, equipment and storage medium

By establishing hierarchical relationships and entity feature matrices in invoice documents, and combining the Transformer feature extractor and cross-attention mechanism, the problem of confusing relationships between entities in complex invoice documents is solved, achieving efficient information structuring processing and automated data entry.

CN121859905APending Publication Date: 2026-04-14太保科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-04
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing technologies, when processing complex invoice documents consisting of multiple pages and modules, ignore the natural hierarchical semantic relationships of the documents. This leads to insufficient modeling of long-distance dependencies between entities, relationship confusion, high false alarm rates, difficulty in effectively connecting cross-page information, and impact on entity consistency identification and association judgment. Furthermore, the logical consistency and accuracy of relationship extraction are insufficient, making it difficult to meet the accuracy requirements of enterprise information processing.

Method used

By acquiring the text content, relative position, and row and column information of the target document, a hierarchical relationship is established based on the layout information. Entity features are extracted and an entity hierarchical feature and relationship matrix is ​​established. Entity classification and relationship extraction are performed. A Transformer feature extractor and a cross-attention mechanism are introduced to associate the position information of entities in the hierarchical structure and hierarchical association data, so as to achieve accurate matching and classification between entities.

Benefits of technology

It clarifies the scope of ownership and association of entities, reduces entity confusion and relationship mismatch, improves the efficiency of structured processing of document information, meets enterprises' needs for automated processing of complex invoice documents, reduces the workload of manual verification and correction, and promotes the standardization and efficiency of information entry in business systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121859905A_ABST
    Figure CN121859905A_ABST
Patent Text Reader

Abstract

The invention discloses an entity extraction method and device, equipment and a storage medium, and relates to the technical field of artificial intelligence natural language processing and document intelligent analysis. The method comprises the following steps: acquiring text content, relative position and row and column information corresponding to a target document, and establishing a hierarchical relationship based on format information of the target document; the text content, the relative position and the row and column information are coded, and entity features are extracted; establishing entity level features and an entity level feature relation matrix; performing entity classification based on the entity features and the entity level features; and encoding the classified entities, fusing the encoded entities with the entity level characteristic relation matrix, performing relation extraction, and outputting a relation extraction result. According to the method, the semantic association of the document is described through the hierarchical relationship, the format and semantic segmentation defect is made up, entity misinformation and relationship confusion are reduced, and the accuracy of complex document information extraction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence natural language processing and document intelligent analysis technology, and in particular to an entity extraction method, apparatus, device and storage medium. Background Technology

[0002] In fields such as commercial transactions, financial settlements, and corporate financial management, the need for structured processing of multi-page invoice documents (such as commercial drafts, settlement vouchers, and transaction documents) is becoming increasingly urgent. This relies heavily on entity extraction and relation extraction technologies to automate information entry. Currently, mainstream solutions typically first use OCR technology to convert invoice images or PDF files into text content and location information, and then utilize pre-trained models for feature extraction and relation inference. However, many technical bottlenecks still exist in practical applications.

[0003] Existing technologies generally ignore the inherent hierarchical semantic relationships of documents, flattening all textual information. This leads to insufficient modeling of long-distance dependencies between entities, resulting in relationship confusion and high false positive rates. Furthermore, for complex documents consisting of multiple pages and modules, existing methods struggle to effectively connect cross-page information, creating information silos and affecting entity consistency identification and association judgment. In addition, while some solutions introduce feature fusion mechanisms, they fail to fully integrate layout hierarchy information with entity semantic features, resulting in insufficient logical consistency and accuracy in relationship extraction. This makes it difficult to meet enterprises' requirements for information processing precision, still requiring extensive manual verification and correction, thus hindering improvements in processing efficiency and automation. Summary of the Invention

[0004] To address the aforementioned problems, this application provides an entity extraction method, apparatus, device, and storage medium, including the following:

[0005] Firstly, this application provides an entity extraction method, which includes:

[0006] Obtain the text content, relative position, and row and column information corresponding to the target document, and establish a hierarchical relationship based on the layout information of the target document;

[0007] The text content, relative position, and row and column information are encoded to extract entity features;

[0008] Establish entity hierarchical features and entity hierarchical feature relationship matrix;

[0009] Entity classification is performed based on the entity features and the entity hierarchy features.

[0010] The classified entities are encoded and then fused with the entity hierarchical feature relationship matrix to extract relationships, and the relationship extraction results are output.

[0011] Optionally, establishing a hierarchical relationship based on the layout information of the target document includes:

[0012] Set the content within the same punctuation mark as a first-level hierarchy, the content within the same sentence as a second-level hierarchy, and the content within the same paragraph as a third-level hierarchy.

[0013] Optionally, obtaining the text content, relative position, and row and column information corresponding to the target document includes:

[0014] The OCR model takes an image or PDF file of a target document with multiple pages of content and outputs the text content, relative position, and row and column information.

[0015] Optionally, the output relation extraction result includes:

[0016] The relationship extraction results are output in a preset format, and the output results are connected to the business system to complete the automated information entry.

[0017] Optionally, the step of encoding the classified entities and fusing them with the entity hierarchical feature relation matrix to extract relations includes:

[0018] Entity-level semantic encoding is performed on the classified entities to generate entity semantic vectors; the entity semantic vectors are fused with the entity hierarchical feature relationship matrix to obtain initial fused features; the initial fused features are further processed by the Transformer feature extractor; a position-based cross-attention mechanism is introduced to associate the position information of entities in the hierarchical structure and the hierarchical relationship data between entities; based on the above-processed feature data, entity pair relationship matching and classification operations are performed to complete relationship extraction.

[0019] Secondly, this application provides an entity extraction device, the device comprising:

[0020] The acquisition unit is used to acquire the text content, relative position, and row and column information corresponding to the target document, and to establish a hierarchical relationship based on the layout information of the target document;

[0021] The first processing unit is used to encode the text content, relative position, and row and column information, and extract entity features;

[0022] The second processing unit is used to establish entity-level features and entity-level feature relationship matrix;

[0023] The third processing unit is used to perform entity classification based on the entity features and the entity hierarchy features;

[0024] The fourth processing unit is used to encode the classified entities, fuse them with the entity hierarchical feature relationship matrix, extract the relationships, and output the relationship extraction results.

[0025] Optionally, the acquisition unit establishes a hierarchical relationship based on the layout information of the target document, including:

[0026] Set the content within the same punctuation mark as a first-level hierarchy, the content within the same sentence as a second-level hierarchy, and the content within the same paragraph as a third-level hierarchy.

[0027] Optionally, the acquisition unit acquires the text content, relative position, and row and column information corresponding to the target document, including:

[0028] The OCR model takes an image or PDF file of a target document with multiple pages of content and outputs the text content, relative position, and row and column information.

[0029] Optionally, the fourth processing unit outputs the following relationship extraction results:

[0030] The relationship extraction results are output in a preset format, and the output results are connected to the business system to complete the automated information entry.

[0031] Optionally, the fourth processing unit encodes the classified entities and performs relation extraction after fusing them with the entity hierarchical feature relation matrix, including:

[0032] Entity-level semantic encoding is performed on the classified entities to generate entity semantic vectors; the entity semantic vectors are fused with the entity hierarchical feature relationship matrix to obtain initial fused features; the initial fused features are further processed by the Transformer feature extractor; a position-based cross-attention mechanism is introduced to associate the position information of entities in the hierarchical structure and the hierarchical relationship data between entities; based on the above-processed feature data, entity pair relationship matching and classification operations are performed to complete relationship extraction.

[0033] Thirdly, this application provides an apparatus comprising a memory and a processor, the memory for storing instructions or code, and the processor for executing the instructions or code to cause the apparatus to perform the entity extraction method described in any of the implementations of the first aspect.

[0034] Fourthly, this application provides a computer-readable storage medium storing code, wherein when the code is executed, a device running the code implements the entity extraction method described in any of the implementations of the first aspect.

[0035] This application provides an entity extraction method. When executing the method, firstly, the text content, relative position, and row / column information corresponding to the target document are obtained, and a hierarchical relationship is established based on the layout information of the target document. Then, the text content, relative position, and row / column information are encoded to extract entity features. Next, entity hierarchical features and an entity hierarchical feature relationship matrix are established. Finally, based on the entity features and the entity hierarchical features, entity classification is performed. The classified entities are encoded, and after being fused with the entity hierarchical feature relationship matrix, relationship extraction is performed, and the relationship extraction result is output. This approach establishes hierarchical relationships based on the layout information of the target document, clearly defining the scope and association of entities within the document and preventing indiscriminate treatment of entities from different scopes. By extracting entity features and establishing entity hierarchical features and entity hierarchical feature relationship matrices, the semantic and hierarchical attributes of entities are comprehensively captured, providing multi-dimensional data support for subsequent processing. Entity classification is performed by fusing entity features and entity hierarchical features, reducing the inclusion of non-target entities. Relationship extraction is performed by encoding the classified entities and fusing the entity hierarchical feature relationship matrix, providing hierarchical basis for determining the associations between entities. This ensures that both entity classification and relationship extraction processes are supported at the document structure level, reducing the possibility of entity confusion and relationship mismatch. The extracted entity and relationship results are more aligned with the semantic logic of the document itself. This reduces the workload of manual verification and correction, improves the efficiency of structured document information processing, meets the enterprise's need for automated processing of complex invoice documents consisting of multiple pages and modules, and promotes the standardization and efficiency of information entry in business systems. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings used in the description of the embodiment or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0037] Figure 1 A flowchart of an entity extraction method provided in an embodiment of this application;

[0038] Figure 2 This is a schematic diagram of the structure of an entity extraction device provided in an embodiment of this application. Detailed Implementation

[0039] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part rather than all of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of this application without creative efforts shall fall within the scope of protection of this application.

[0040] 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 for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.

[0041] Figure 1 This is a flowchart of an entity extraction method provided by an embodiment of this application. Combining Figure 1 As shown, the entity extraction method provided by an embodiment of this application may include:

[0042] S101. Obtain the text content, relative position, and row-column information corresponding to the target document, and establish a hierarchical relationship based on the layout information of the target document.

[0043] The target document refers to a complex document composed of multiple pages and multiple modules, such as a business document containing different content modules such as parties, vehicles, roads, and traffic environments. Such documents are usually stored in the form of pictures or PDFs and contain multi-page continuous text information.

[0044] The specific implementation method is as follows: Input the picture or PDF file of the above target document with multiple pages of content into an OCR (Optical Character Recognition) model. The OCR model can recognize the text in the document, not only output the specific content of each text (i.e., the text content), but also obtain the coordinate information of each text in the document page (i.e., the relative position), as well as the row number and column number where the text is located (i.e., the row-column information). For example, if the target document is a multi-page accident identification form, after inputting its PDF file into the OCR model, the text content "Moumoujia" can be obtained, and at the same time, information such as its coordinates relative to the upper left corner of the page at the 2nd column of the 3rd row on the 1st page, which is (150, 200), can be obtained. Through this method, the conversion of unstructured documents into structured text-related information is achieved, and at the same time, the context of multi-page documents is connected, avoiding entity consistency problems caused by cross-page information breaks, and providing a basic input for subsequent coding operations.

[0045] The layout information refers to the typesetting and layout features of the text in the target document, including the distribution of punctuation marks, the division of sentences, the separation of paragraphs, and other layout information that combines vision and semantics. Based on these layout information, this step establishes a three-level hierarchical relationship of "within punctuation - within sentence - within paragraph", and the specific settings are as follows:

[0046] First-level hierarchical relationship: The content within the same punctuation mark is set as the first-level hierarchical relationship. The punctuation marks here include symbols indicating short pauses such as commas, semicolons, etc. The content within the same punctuation mark refers to the combination of consecutive words that are not separated by the above-mentioned punctuation marks. For example, in "Moumoujia, 35 years old", "Moumoujia" and "35 years old" respectively belong to two first-level hierarchical relationships;

[0047] Second-level hierarchical relationship: The content within the same sentence is set as the second-level hierarchical relationship. Sentences are separated by symbols indicating the end of a complete semantic meaning such as full stops, question marks, exclamation marks, etc. The content within the same sentence includes all the words at the first level in that sentence. For example, in the sentence "The party Moumoujia is mainly responsible.", the two first-level contents of "The party Moumoujia" and "is mainly responsible" together form a second-level hierarchical relationship;

[0048] Third-level hierarchical relationship: The content within the same paragraph is set as the third-level hierarchical relationship. Paragraphs are separated by layout features such as line breaks and indents. The content within the same paragraph includes all the sentences at the second level in that paragraph. For example, a paragraph in a business document contains two sentences: "The party Moumoujia is mainly responsible. The party Moumouyi has no responsibility.", and these two second-level hierarchical relationships together form a third-level hierarchical relationship.

[0049] By establishing the above three-level hierarchical relationship, it is possible to explicitly depict the scope of semantic associations within the document, clarify the attribution boundaries of different text contents, avoid treating content with different association strengths equally in subsequent processing, and solve the defect of the existing technology that flattens the document and cannot distinguish the strength of entity associations.

[0050] S102. Encode the text content, relative positions, and row and column information, and extract entity features.

[0051] This step is to perform in-depth processing of features based on the structured basic data obtained in S101, provide feature data that can be calculated by the model for entity recognition, and break through the limitation of the traditional model that separates layout and semantics.

[0052] The specific implementation method is as follows: Use a pre-trained model to encode the text content, relative positions, and row-column information obtained in S101. The pre-trained model can be the LayoutLM model. The LayoutLM model has the ability to fuse text semantics and layout position information. Its encoding process does not process single-type information in isolation, but jointly encodes the semantic features of the text content and the layout features reflected by the relative positions and row-column information. For example, for the text content of "Moumou Bing", in combination with its position and row-column information in the vehicle information module on page 2, row 5, column 3, the LayoutLM model will convert this information into feature data in the form of high-dimensional vectors. This feature data contains both the semantic attributes of "Moumou Bing" and its layout attributes in the document. These fused features are entity features. Through this encoding extraction process, the scattered basic data is converted into high-quality features that the model can recognize and process, making full use of the semantic hierarchical signals in the layout, providing a core basis for subsequent entity classification, and improving the adaptability of complex document features.

[0053] S103. Establish an entity-level feature and an entity-level feature relationship matrix.

[0054] In this step, through a dedicated hierarchical feature extraction module, the associated attributes of entities in the three-level hierarchical relationship are mined, and the hierarchical associations between entities are quantified into matrix form, providing a hierarchical basis for the fusion and relationship extraction of entity features, and making up for the problems of weak entity-relationship joint modeling and insufficient hierarchical semantic characterization in the existing technology.

[0055] Entity-level features refer to feature data that describe the position, hierarchical belonging, and hierarchical association attributes of entities in the three-level hierarchical relationship. The establishment process is as follows: The hierarchical feature extraction module reads the three-level hierarchical relationship established in S101, locates the hierarchical position corresponding to each entity. For example, the entity "Moumou Jia" is located in the 2nd sentence of the 3rd paragraph on page 1, that is, it belongs to the three-level hierarchy (the 3rd paragraph) and the second-level hierarchy (the 2nd sentence); at the same time, identify the hierarchical association situation between the entity and other entities. For example, the entity "Moumou Jia" and the entity "main responsibility" belong to the same second-level hierarchy (the same sentence), and belong to the same three-level hierarchy (the same paragraph) with the entity "Moumou Yi". Based on these hierarchical positions and association situations, generate the hierarchical features of the entity, such as feature data like "associated in the same sentence" and "paragraph belonging to the 3rd paragraph".

[0056] The entity-level feature relationship matrix is a structured matrix data formed by quantifying the hierarchical association strengths between all entities. The process of establishing it is as follows: The hierarchical feature extraction module defines the hierarchical association strengths between entities. For example, it sets the association weight of entities belonging to the same first-level hierarchical relationship to 0.9, the association weight of entities belonging to the same second-level hierarchical relationship but different first-level hierarchies to 0.7, the association weight of entities belonging to the same third-level hierarchical relationship but different second-level hierarchies to 0.5, and the association weight of entities across the third-level hierarchical relationship to 0.1. Subsequently, taking entities as rows and columns, the above association weights are filled into the corresponding positions in the matrix to form the entity-level feature relationship matrix. For example, if there are entity A (co-sentence associated entity B), entity B, and entity C (cross-paragraph entity), then the association weight between A and B in the matrix is 0.7, the association weight between A and C is 0.1, the association weight between B and C is 0.1, and the self-association weight of the entity is 1. This matrix clearly quantifies the hierarchical association degree between entities, provides an intuitive calculation basis for subsequent fusion operations, and avoids the confusion of entity relationships caused by the lack of hierarchical constraints.

[0057] [[ID=H3]]S104. Classify entities based on the entity features and the entity-level features.

[0058] The core logic of entity classification is to combine the semantic and layout basic features (entity features) and hierarchical association features (entity-level features) of entities to determine the category attributes of entities. For example, it determines that an entity is a "party", "vehicle information", "liability type", or "interference item", etc. The specific implementation method is as follows: The entity features extracted in S102 and the entity-level features established in S103 are fused. The fusion method can adopt the form of feature vector splicing, that is, the entity feature vector and the entity-level feature vector are connected end to end to form a fusion feature vector containing triple information of semantics, layout, and hierarchy. For example, the entity feature vector of the entity "Mou Mou Bing" includes its semantic attribute (person's name) and layout attribute (located in the vehicle module), and its hierarchical feature vector includes its hierarchical belonging (vehicle module paragraph). After splicing the two, a fusion feature vector is formed.

[0059] The fusion feature vector is input into an entity classification model (such as a NER classifier). The model classifies the entity based on the feature-category correspondence relationship learned from the training data. For example, in the fusion feature vector of "Mou Mou Bing" recognized by the model, the layout attribute is the vehicle module and the hierarchical belonging is the vehicle module paragraph. Therefore, it is determined that it is an "entity related to vehicle information" rather than a "party entity"; while in the fusion feature vector of "Mou Mou Jia", the semantic attribute is a person's name and the hierarchical belonging is the party paragraph. Therefore, it is determined that it is a "party entity". Through this fusion classification method, it can effectively distinguish target entities from interference items, reduce misjudgments caused by relying only on single features, and eliminate the need for a large amount of manual annotation and template maintenance, thereby reducing the business implementation threshold.

[0060] S105. Encode the classified entities, fuse them with the entity hierarchical feature relationship matrix, extract the relationships, and output the relationship extraction results.

[0061] Encoding the categorized entities and then fusing them with the entity-level feature relationship matrix for relationship extraction includes first performing entity-level semantic encoding on the categorized entities. This encoding differs from the encoding in S102, which encodes text-level information to extract basic textual features. The entity-level semantic encoding in this step processes the complete entities categorized in S104 (such as "XXX A," "Main Responsibility," "XXX B," and "No Responsibility"), aiming to strengthen the semantic representation of the entities themselves, making them more suitable for matching relationships between entities. Specifically, a pre-trained language model is used to encode the categorized entity text, generating entity semantic vectors. For example, "XXX A" is encoded as a high-dimensional vector containing its core semantics, and "Main Responsibility" is encoded as a high-dimensional vector corresponding to the responsibility type semantics.

[0062] Next, the entity semantic vector is fused with the entity hierarchical feature relation matrix to obtain the initial fused feature. The fusion method is to concatenate the semantic vector of each entity with the row vector corresponding to that entity in the entity hierarchical feature relation matrix. For example, the semantic vector of entity "XXXA" is concatenated with the row vector corresponding to "XXXA" in the matrix (which includes its hierarchical association weights with all other entities) to form the initial fused feature, so that the feature contains both the semantics of the entity itself and its hierarchical association information with other entities.

[0063] Then, the initial fused features are further processed using the Transformer feature extractor. The Transformer feature extractor has the ability to capture long-distance dependencies, and can further integrate and strengthen the semantic and hierarchical association information in the initial fused features, uncover potential association patterns in the features, and improve the expressive power of the features.

[0064] Subsequently, a location-based cross-attention mechanism is introduced to associate the positional information of entities in the hierarchical structure and the hierarchical association data between entities. This mechanism strengthens the feature interaction between related entities and weakens the interference of irrelevant entities by associating the specific position of entities in the hierarchical structure (such as the paragraph or sentence to which they belong) and the hierarchical association weights between entities (derived from the entity hierarchical feature relationship matrix). For example, it makes the feature interaction between "XXXA" and "main responsibility" at the same sentence level closer, while the feature interaction with cross-segment entities is relatively weaker.

[0065] Finally, based on the processed feature data, entity pair relationship matching and classification operations are performed to complete relationship extraction. Specifically, the model analyzes the processed features of all entity pairs to determine whether a preset relationship type (such as "responsibility attribution") exists between entities, and combines successfully matched entity pairs with corresponding relationships. For example, if "A" and "primary responsibility" have a "responsibility attribution" relationship, the correct relationship group {A, primary responsibility} is formed, avoiding incorrect combinations such as {A, primary responsibility, no responsibility}, thus ensuring the accuracy and logic of relationship extraction.

[0066] When outputting the relationship extraction results, the output is performed according to a preset format. This preset format is a standardized format adapted to the data entry requirements of the business system, such as a table or JSON format, ensuring that the output results can be directly read by the business system. Subsequently, the output results are integrated into the business system, which automatically completes the information entry operation based on the standardized relationship extraction results, eliminating the need for manual entry. For example, after outputting relationship results such as {A, primary responsibility} and {B, no responsibility} in JSON format and integrating them into the business management system, the system automatically enters this information into the corresponding database fields, achieving automated information entry, replacing traditional manual entry methods, and improving business processing efficiency.

[0067] The above are some specific implementations of an entity extraction method provided in the embodiments of this application. Based on this, this application also provides a corresponding apparatus. The apparatus provided in the embodiments of this application will be described below from the perspective of functional modularity.

[0068] Figure 2 This is a schematic diagram of a physical extraction device provided in an embodiment of this application. (In conjunction with...) Figure 2 As shown, the entity extraction device 200 provided in this application embodiment includes:

[0069] The acquisition unit 210 is used to acquire the text content, relative position and row and column information corresponding to the target document, and to establish a hierarchical relationship based on the layout information of the target document;

[0070] The first processing unit 220 is used to encode the text content, relative position and row and column information, and extract entity features;

[0071] The second processing unit 230 is used to establish entity-level features and entity-level feature relationship matrix;

[0072] The third processing unit 240 is used to perform entity classification based on the entity features and the entity hierarchy features;

[0073] The fourth processing unit 250 is used to encode the classified entities, fuse them with the entity hierarchical feature relationship matrix, extract the relationship, and output the relationship extraction result.

[0074] In one implementation of this application, the acquisition unit establishes a hierarchical relationship based on the layout information of the target document, including:

[0075] Set the content within the same punctuation mark as a first-level hierarchy, the content within the same sentence as a second-level hierarchy, and the content within the same paragraph as a third-level hierarchy.

[0076] In one implementation of this application, the acquisition unit acquires the text content, relative position, and row and column information corresponding to the target document, including:

[0077] The OCR model takes an image or PDF file of a target document with multiple pages of content and outputs the text content, relative position, and row and column information.

[0078] In one implementation of this application, the fourth processing unit outputs the relationship extraction result, including:

[0079] The relationship extraction results are output in a preset format, and the output results are connected to the business system to complete the automated information entry.

[0080] In one implementation of this application, the fourth processing unit encodes the classified entities and extracts relationships after fusing them with the entity hierarchical feature relationship matrix, including:

[0081] Entity-level semantic encoding is performed on the classified entities to generate entity semantic vectors; the entity semantic vectors are fused with the entity hierarchical feature relationship matrix to obtain initial fused features; the initial fused features are further processed by the Transformer feature extractor; a position-based cross-attention mechanism is introduced to associate the position information of entities in the hierarchical structure and the hierarchical relationship data between entities; based on the above-processed feature data, entity pair relationship matching and classification operations are performed to complete relationship extraction.

[0082] This application also provides corresponding devices and computer storage media for implementing the solutions provided in this application.

[0083] The device includes a memory and a processor. The memory stores instructions or code, and the processor executes the instructions or code to cause the device to perform the method described in any embodiment of this application.

[0084] The computer storage medium stores code, and when the code is run, the device running the code implements the method described in any embodiment of this application.

[0085] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus a general-purpose hardware platform. Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as a read-only memory (ROM) / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a router) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0086] It is understood that in the specific embodiments of this application, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved need to obtain user permission or consent when the above embodiments of this application are applied to specific products or technologies, and the collection, use and processing of related data need to comply with the relevant laws, regulations and standards of relevant countries and regions.

[0087] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0088] It should also be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and apparatus embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and apparatus embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components indicated as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0089] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. An entity extraction method, characterized in that, The method includes: Obtain the text content, relative position, and row and column information corresponding to the target document, and establish a hierarchical relationship based on the layout information of the target document; The text content, relative position, and row and column information are encoded to extract entity features; Establish entity hierarchical features and entity hierarchical feature relationship matrix; Entity classification is performed based on the entity features and the entity hierarchy features. The classified entities are encoded and then fused with the entity hierarchical feature relationship matrix to extract relationships, and the relationship extraction results are output.

2. The method according to claim 1, characterized in that, The establishment of hierarchical relationships based on the layout information of the target document includes: Set the content within the same punctuation mark as a first-level hierarchy, the content within the same sentence as a second-level hierarchy, and the content within the same paragraph as a third-level hierarchy.

3. The method according to claim 1, characterized in that, The process of obtaining the text content, relative position, and row and column information corresponding to the target document includes: The OCR model takes an image or PDF file of a target document with multiple pages of content and outputs the text content, relative position, and row and column information.

4. The method according to claim 1, characterized in that, The output relation extraction results include: The relationship extraction results are output in a preset format, and the output results are connected to the business system to complete the automated information entry.

5. The method according to claim 1, characterized in that, The step of encoding the classified entities and then extracting relationships after fusing them with the entity hierarchical feature relationship matrix includes: Entity-level semantic encoding is performed on the classified entities to generate entity semantic vectors; the entity semantic vectors are fused with the entity hierarchical feature relationship matrix to obtain initial fused features; the initial fused features are further processed by the Transformer feature extractor; a position-based cross-attention mechanism is introduced to associate the position information of entities in the hierarchical structure and the hierarchical relationship data between entities; based on the above-processed feature data, entity pair relationship matching and classification operations are performed to complete relationship extraction.

6. A physical extraction device, characterized in that, The device includes: The acquisition unit is used to acquire the text content, relative position, and row and column information corresponding to the target document, and to establish a hierarchical relationship based on the layout information of the target document; The first processing unit is used to encode the text content, relative position, and row and column information, and extract entity features; The second processing unit is used to establish entity-level features and entity-level feature relationship matrix; The third processing unit is used to perform entity classification based on the entity features and the entity hierarchy features; The fourth processing unit is used to encode the classified entities, fuse them with the entity hierarchical feature relationship matrix, extract the relationships, and output the relationship extraction results.

7. The apparatus according to claim 6, characterized in that, The acquisition unit establishes a hierarchical relationship based on the layout information of the target document, including: Set the content within the same punctuation mark as a first-level hierarchy, the content within the same sentence as a second-level hierarchy, and the content within the same paragraph as a third-level hierarchy.

8. The apparatus according to claim 6, characterized in that, The acquisition unit acquires the text content, relative position, and row and column information corresponding to the target document, including: The OCR model takes an image or PDF file of a target document with multiple pages of content and outputs the text content, relative position, and row and column information.

9. A computing device, characterized in that, The computing device includes: a memory and a processor; The memory is used to store computer programs; The processor is configured to implement the steps of the method as described in any one of claims 1 to 5 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 5.