Entity recognition method and apparatus, electronic device, and computer-readable storage medium
By acquiring entity boundary words and suggested regions, adjusting the boundaries using similarity calculation to generate entity candidate regions, and combining multi-head self-attention algorithm to optimize the entity recognition network, the problem of low efficiency in nested entity recognition in traditional methods is solved, achieving efficient nested entity coverage and reduced computational complexity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING SAMSUNG TELECOM R&D CENT
- Filing Date
- 2021-06-04
- Publication Date
- 2026-05-08
AI Technical Summary
Traditional entity recognition methods cannot effectively identify nested entities, have high computational complexity, and cannot efficiently cover nested entities in text sequences.
By acquiring entity boundary words and suggested regions from the text sequence to be identified, the boundaries are adjusted using background representation vectors and similarity calculations to generate entity candidate regions. The entity recognition network is then optimized by combining a multi-head self-attention algorithm, which reduces computational complexity and improves the coverage of nested entities.
Without increasing the number of candidate entity regions, the coverage of nested entities is improved, the computational complexity is reduced, and efficient nested entity recognition is achieved.
Smart Images

Figure CN113886571B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to an entity recognition method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] The main purpose of entity recognition is to extract all candidate entities that may be entities from a text sequence to be recognized and to determine the entity category.
[0003] Nested entity recognition refers to the possibility that entities in the text sequence to be recognized may be nested. Nested entity recognition requires the identification of all candidate entities in the input text sequence, not just the outermost candidate entities. Traditional sequence labeling-based methods can only assign a label to each word, so it is necessary to optimize traditional entity recognition methods. Summary of the Invention
[0004] The purpose of this application is to at least solve one of the aforementioned technical defects. The technical solution provided by the embodiments of this application is as follows:
[0005] In a first aspect, embodiments of this application provide an entity recognition method, including:
[0006] Obtain at least one entity boundary word corresponding to the text sequence to be identified;
[0007] Based on at least one entity boundary word, obtain at least one entity candidate region in the text sequence to be identified;
[0008] Based on entity candidate regions, obtain entity recognition results for the text sequence to be recognized.
[0009] In one optional embodiment of this application, obtaining at least one entity boundary word corresponding to the text sequence to be identified includes:
[0010] Treat all words in the text sequence to be identified as entity boundary words; or...
[0011] Based on the background representation vector of the words in the text sequence to be identified, the probability of the words in the text sequence to be identified as entity boundary words is obtained, and based on the probability, the entity boundary words of the text sequence to be identified are determined.
[0012] In one optional embodiment of this application, obtaining at least one entity candidate region in the text sequence to be identified based on at least one entity boundary word includes:
[0013] Based on entity boundary words, obtain the entity suggestion region corresponding to the text sequence to be identified;
[0014] Based on the entity suggestion region, obtain the corresponding entity candidate region.
[0015] In one optional embodiment of this application, obtaining entity suggestion regions corresponding to the text sequence to be identified based on entity boundary words includes:
[0016] Based on at least one preset width, entity suggestion regions of at least one preset width are obtained, with entity boundary words as anchor words respectively.
[0017] In one optional embodiment of this application, obtaining the corresponding entity candidate region based on the entity suggestion region includes:
[0018] Based on the background representation vectors of words covered by entity suggestion regions and the background representation vectors of corresponding anchor words, obtain the corresponding combined vector;
[0019] Obtain the similarity between the background representation vector and the combined vector of entity boundary words in the text sequence to be identified;
[0020] Based on similarity, obtain the corresponding entity candidate regions.
[0021] In one optional embodiment of this application, obtaining the similarity between the background representation vector and the combined vector of entity boundary words in the text sequence to be identified includes:
[0022] In Euclidean or hyperbolic space, obtain the similarity between the background representation vector and the combined vector of entity boundary words in the text sequence to be identified.
[0023] In one optional embodiment of this application, obtaining the corresponding entity candidate region based on similarity includes:
[0024] Based on similarity, the starting boundary words of the corresponding entity candidate regions are determined from the anchor words of the entity suggestion regions in the text sequence to be identified and the entity boundary words located to the left of the anchor words. The ending boundary words of the corresponding entity candidate regions are determined from the anchor words of the entity suggestion regions in the text sequence to be identified and the entity boundary words located to the right of the anchor words.
[0025] Based on the start boundary words and the end boundary words, the corresponding entity candidate regions are determined.
[0026] In one optional embodiment of this application, a corresponding combined vector is obtained based on the background representation vector of the word covered by the entity suggestion region and the background representation vector of the corresponding anchor word, including:
[0027] The width of the entity proposal region is used as the width of the convolution kernel. The background representation vector of the word covered by the entity proposal region is convolved to obtain the corresponding feature vector.
[0028] Based on the feature vectors corresponding to the words covered by the entity suggestion region and the background representation vectors of the corresponding anchor words, the corresponding combined vector is obtained.
[0029] In one optional embodiment of this application, obtaining the corresponding entity candidate region based on the entity suggestion region includes:
[0030] Determine the candidate start boundary words and candidate end boundary words for anchor words in the entity suggestion region;
[0031] The starting boundary word of the entity proposal region is determined from the starting boundary word candidate, and the ending boundary word of the entity proposal region is determined from the ending boundary word candidate;
[0032] Based on the obtained start and end boundary words, the corresponding entity candidate regions are determined.
[0033] In one optional embodiment of this application, the start boundary word candidates and end boundary word candidates of the anchor word of the entity suggestion region are determined, including
[0034] The anchor word in the entity suggestion area and the boundary word located to the left of the anchor word are identified as the starting boundary word candidates for the anchor word;
[0035] The anchor word in the entity suggestion area and the boundary word to the right of the anchor word are identified as candidates for the termination boundary word of the anchor word.
[0036] In one optional embodiment of this application, determining the starting boundary word of the entity proposal region from the starting boundary word candidates and determining the ending boundary word of the entity proposal region from the ending boundary word candidates includes:
[0037] Determine the first probability of each starting boundary word candidate as the starting boundary word of the entity proposal region, and the second probability of each ending boundary word candidate as the ending boundary word of the entity proposal region;
[0038] The starting boundary word of the entity proposal region is determined based on the first probability, and the ending boundary word of the entity proposal region is determined based on the second probability.
[0039] In one optional embodiment of this application, obtaining entity recognition results for the text sequence to be recognized based on entity candidate regions includes:
[0040] The entity candidate regions are filtered to obtain the filtered entity candidate regions;
[0041] The filtered candidate regions of entities are classified to obtain the entity recognition results of the text sequence to be recognized.
[0042] In one optional embodiment of this application, filtering the entity candidate regions to obtain filtered entity candidate regions includes:
[0043] Based on the background representation vector of the word covered by the entity candidate region, obtain the corresponding first classification feature vector;
[0044] Based on the first classification feature vector corresponding to the entity candidate region, the probability that the entity candidate region belongs to the entity is obtained;
[0045] Based on the probability that an entity candidate region belongs to an entity, the filtered entity candidate regions are obtained.
[0046] In one optional embodiment of this application, the filtered entity candidate regions are classified to obtain the entity recognition result of the text sequence to be recognized, including:
[0047] Based on the background representation vectors of the start and end boundary words corresponding to the filtered entity candidate regions, the corresponding second classification feature vectors are obtained.
[0048] The entity recognition result is obtained by classifying the entity based on the second classification feature vector corresponding to the selected entity candidate region.
[0049] In one optional embodiment of this application, obtaining entity recognition results for the text sequence to be recognized based on entity candidate regions includes:
[0050] Based on the background representation vectors of the starting and ending boundary words corresponding to the entity candidate regions, the corresponding third-class feature vectors are obtained.
[0051] The entity recognition result is obtained by classifying the entity based on the third classification feature vector corresponding to the entity candidate region.
[0052] In one optional embodiment of this application, obtaining at least one entity candidate region in the text sequence to be identified based on at least one entity boundary word includes:
[0053] From the text sequence to be identified, obtain a preset number of entity boundary words adjacent to the entity boundary words;
[0054] Obtain the background representation vector of entity boundary words and the similarity between it and the background representation vector of the corresponding preset number of adjacent entity boundary words;
[0055] Based on similarity, obtain the corresponding entity candidate regions.
[0056] In one optional embodiment of this application, obtaining the corresponding entity candidate region based on similarity includes:
[0057] Based on similarity, the starting and ending boundary words of the corresponding entity candidate regions are determined from the entity boundary words of the text sequence to be identified, as well as from a preset number of adjacent entity boundary words.
[0058] Based on the start boundary words and the end boundary words, the corresponding entity candidate regions are determined.
[0059] Secondly, embodiments of this application provide an entity recognition device, including:
[0060] The entity boundary word acquisition module is used to acquire at least one entity boundary word corresponding to the text sequence to be identified;
[0061] The entity candidate region acquisition module is used to acquire at least one entity candidate region in the text sequence to be identified based on at least one entity boundary word.
[0062] The entity recognition result acquisition module is used to obtain the entity recognition result of the text sequence to be recognized based on the entity candidate region.
[0063] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor;
[0064] The memory contains computer programs;
[0065] A processor for executing computer programs to implement the methods provided in the first aspect embodiment or any alternative embodiment of the first aspect.
[0066] Fourthly, embodiments of this application provide a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the method provided in the first aspect embodiment or any optional embodiment of the first aspect.
[0067] The beneficial effects of the technical solution provided in this application are:
[0068] By obtaining entity candidate regions corresponding to the text sequence to be identified, and then obtaining entity recognition results of the text sequence to be identified based on the entity candidate regions, this scheme can improve the coverage of entities in the text sequence to be identified by entity candidate regions without increasing the number of entity candidate regions, and reduce the computational complexity. Attached Figure Description
[0069] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.
[0070] Figure 1a This is a schematic diagram of nested entity recognition results in an example of an embodiment of this application;
[0071] Figure 1b This is a schematic diagram of nested entities in a text sequence, as shown in an example of an embodiment of this application.
[0072] Figure 2 This is a schematic diagram illustrating an example of obtaining entity candidate regions in the prior art;
[0073] Figure 3 This is a schematic diagram illustrating another example of obtaining entity candidate regions in the prior art;
[0074] Figure 4 A flowchart illustrating an entity recognition method provided in an embodiment of this application;
[0075] Figure 5 This is a schematic diagram illustrating the acquisition of an entity suggestion region in one example of an embodiment of this application;
[0076] Figure 6 This is a schematic diagram illustrating entity recognition via an entity recognition network, provided as an embodiment of this application.
[0077] Figure 7 This is a schematic diagram illustrating entity recognition of a text sequence to be recognized using an entity recognition network, as an example of an embodiment of this application.
[0078] Figure 8 This is a schematic diagram of the structure of an entity recognition network model provided in an embodiment of this application;
[0079] Figure 9a This is a schematic diagram illustrating entity recognition in one example of an embodiment of this application;
[0080] Figure 9b This is an example of an entity candidate obtained in an embodiment of this application;
[0081] Figure 9c Entity candidates obtained as an example of existing technology;
[0082] Figure 10 This is a schematic diagram of the entity boundary word detection layer network structure in an embodiment of this application;
[0083] Figure 11a This is a schematic diagram of entity boundary word detection in an example of an embodiment of this application;
[0084] Figure 11b This is a schematic diagram of entity boundary word detection in an example of an embodiment of this application;
[0085] Figure 12a This is a schematic diagram illustrating the acquisition of an entity suggestion region in one example of an embodiment of this application;
[0086] Figure 12b This is a schematic diagram of the network structure of the entity suggestion generation layer in the embodiments of this application;
[0087] Figure 13a This is a schematic diagram of the network structure of the entity candidate identification layer in an embodiment of this application;
[0088] Figure 13b This is a detailed network structure diagram of the entity candidate identification layer in the embodiments of this application;
[0089] Figure 13c A comparison diagram of boundary attention calculation based on boundary word mask and ordinary boundary attention calculation in this application embodiment;
[0090] Figure 14 This is a schematic diagram of the network structure of the entity candidate filtering layer in an embodiment of this application;
[0091] Figure 15 This is a schematic diagram of the network structure of the entity classifier module in an embodiment of this application;
[0092] Figure 16 This is a schematic diagram of an entity recognition scheme based on hyperbolic representation in an embodiment of this application;
[0093] Figure 17 This is a schematic diagram of the structure of an entity recognition network model provided in an embodiment of this application;
[0094] Figure 18a This application provides an example of the application of nested entity recognition in smart screen recognition.
[0095] Figure 18b This application provides an example of nested entity recognition being used in news reading enhancement.
[0096] Figure 18c A schematic diagram illustrating the application of nested entity recognition in menu reading enhancement, provided as an example of an embodiment of this application;
[0097] Figure 18d This application provides an example of the application of nested entity recognition in image editing.
[0098] Figure 18e This application provides an example of the application of nested entity recognition in knowledge graph construction.
[0099] Figure 19 A structural block diagram of an entity recognition device provided in an embodiment of this application;
[0100] Figure 20 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0101] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting the invention.
[0102] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0103] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0104] Named Entity Recognition (NER) is a subtask of information extraction. Its purpose is to locate entity names mentioned in unstructured text and determine their category based on a predefined set of categories, such as PERSON (person's name), ORGNIZATION (organization's name), LOCATION (location's name), and TIME (time). Named entities are typically proper nouns used to refer to people or things, and can be defined according to specific needs.
[0105] Nested NER tasks refer to the phenomenon of nested or overlapping entities mentioned in a text. For example... Figure 1a As shown, an ORGNIZATION "Edinburgh University" is nested within another ORGNIZATION "Edinburgh University Library". However, this nested structure makes the problem inefficient for conventional methods.
[0106] The difference between nested NER methods and non-nested NER methods: Traditional NER methods can only identify the outermost or innermost entity in a sentence, and there is no nesting / overlapping structure among all the identified entities. In contrast, nested entity recognition can identify multi-granularity, nested entities with overlapping structures, as shown in Table 1.
[0107] Table 1
[0108]
[0109] When performing entity recognition on text sequences, for text sequences without nested entities, it is necessary to identify the independent entities (i.e., entities without nesting). For example, in the sentence "Hi, Bixby, what's the weather like in Beijing today?", both 'Bixby' and 'Beijing' can be identified as entities; the former is "Product (PRO)" and the latter is "Location (LOC)". The specific type of entity to be identified in the text sequence depends on the entity category set defined by the recognition task. However, for text sequences containing nested entities, it is necessary to identify both the independent entities and the nested entities (which can be understood as entities containing two independent entities), such as... Figure 1b As shown, the text sequence "Thomas Jefferson, the third president of the United States, drafted the Declaration of Independence" contains "United States (LOC)" and "Thomas Jefferson (person, Person, PER)" as independent entities, while "Thomas Jefferson, the third president of the United States (PER)" is a nested entity. Entity recognition requires identifying all three: "United States (LOC)," "Thomas Jefferson (Person, PER)," and "Thomas Jefferson, the third president of the United States (PER)." Traditional sequence labeling methods, which can only assign one label to each word, cannot identify nested entities.
[0110] Existing technologies typically employ region-based nested entity recognition methods. These methods identify multiple candidate entity regions within a text sequence to determine if they are candidate entities. Nested entities can be identified because different nested entities correspond to different candidate entity regions. The key to nested entity recognition lies in generating the candidate entity regions corresponding to the nested entities. Several methods can be used to obtain these candidate regions: 1) using nodes from the parse tree as candidate entities; 2) generating N(N+1) / 2 candidate subsequences for a text sequence containing N words, and using these N(N+1) / 2 candidate subsequences as candidate entity regions; 3) using a transition-based method, constructing candidate subsequences through specially designed action sequences, and using these constructed candidate subsequences as candidate entity regions. However, these methods acquire almost all text subsequences corresponding to the text sequence, resulting in high computational costs for both the candidate region acquisition process and the subsequent candidate region recognition process.
[0111] In addition, existing technologies employ schema-based approaches for nested entity recognition. These approaches design better-expressing labeled patterns to handle nested entities, rather than modifying the labeling units. A representative direction is the hypergraph-based approach, where hypergraph labels are used to ensure that word-level labels can recover nested entity candidates. Some researchers have also proposed bipartite graph-based methods to handle nested entity labels. However, these patterns require meticulous design to prevent spurious structures and structural ambiguities. Furthermore, stronger, unambiguous patterns inevitably lead to higher training and decoding time complexity.
[0112] Building upon region-based nested entity recognition methods, existing technologies further propose a method based on Anchor-Region Networks (ANNs) to obtain entity candidate regions corresponding to nested entities. This method can be implemented in two ways: 1) Using each word in the text sequence as an anchor word, multiple entity candidate regions are obtained based on multiple preset widths. For example, a text sequence contains 6 words, t1, t2, t3, t4, t5, and t6, with 6 preset widths (1-6). These 6 preset widths correspond to 6 proposals (candidates), namely Proposal1-Proposal6. For anchor word t3, the entity candidate regions corresponding to Proposal1-Proposal6 are as follows: Figure 2As shown, the area within the rectangular box is the entity candidate region. For example, the entity candidate region corresponding to Proposal2 is [t3, t4]. 2) Using a specific head entity word in the text sequence as the anchor word, and using this head entity word as the reference, the boundary of the entity candidate region is predicted, thus obtaining the entity candidate region. For example, as shown... Figure 3 As shown, for the text sequence "The minister of the department", the anchor word prediction network obtains the head entity word "minister" (entity category "Person (PER)"). Based on the head entity word "minister", the corresponding candidate entity boundaries are obtained as "the" and "department", thus obtaining the corresponding entity candidate regions. In the first implementation, there are nested entities with large width variations in the text sequence. In order to make the obtained entity candidate regions cover all nested entities in the text sequence as much as possible, it is necessary to increase the preset width, that is, to obtain more entity candidate regions, which will increase the computational complexity of the model. In the second implementation, in many cases, the head entity word of the text sequence cannot be determined, and therefore the entity candidate regions of the text sequence cannot be obtained. To address the above problems, the embodiments of this application provide the following entity recognition method.
[0113] Figure 4 This is a flowchart illustrating an entity recognition method provided in an embodiment of this application, as shown below. Figure 4 As shown, the method may include: step S401, obtaining at least one entity boundary word corresponding to the text sequence to be identified; step S402, obtaining at least one entity candidate region in the text sequence to be identified based on at least one entity boundary word; step S403, obtaining the entity recognition result of the text sequence to be identified based on the entity candidate region.
[0114] The solution provided in this application, compared with the prior art, can improve the coverage of entities in the text sequence to be identified by entity candidate regions without increasing the number of entity candidate regions, and reduce the computational complexity.
[0115] Example 1
[0116] In one optional embodiment, obtaining entity candidate regions corresponding to the text sequence to be identified includes: obtaining entity suggestion regions corresponding to the text sequence to be identified; and obtaining corresponding entity candidate regions based on the entity suggestion regions. Specifically, obtaining entity suggestion regions corresponding to the text sequence to be identified includes: obtaining entity suggestion regions of at least one preset width, using words in the text sequence to be identified as anchor words, based on at least one preset width. In particular, in this embodiment, entity suggestion regions are determined for each word in the text to be identified, and then the start and end boundary words of the entity candidate regions are determined from each word in the text to be identified using the entity suggestion regions.
[0117] An entity recognition method provided in this application embodiment may include: obtaining at least one entity suggestion region corresponding to a text sequence to be recognized; obtaining entity candidate regions corresponding to the entity suggestion regions; and obtaining entity recognition results of the text sequence to be recognized based on the entity candidate regions.
[0118] In this context, the anchor word of the entity suggestion region can be any word in the text sequence to be recognized, and its width can be any width not exceeding the width of the text sequence to be recognized. For example, consider a text sequence to be recognized containing 5 words, t1, t2, t3, t4, and t5. First, three predefined widths for the entity suggestion regions are 1, 3, and 5 respectively. These three predefined widths correspond to three proposals (candidates), namely Proposal1-Proposal3. Then, when t3 is selected as the anchor word, the corresponding entity suggestion region can be as follows: Figure 5 As shown, the area within the rectangle is the entity candidate region. For example, the entity suggestion region corresponding to Proposal2 is [t2, t4]. It should be noted that the entity candidate region corresponding to Proposal2 can also be [t3, t5] or [t1, t3], as long as the anchor word of the corresponding entity suggestion region is t3 and the width is 3. For the text sequence to be recognized, if the anchor words of the corresponding entity suggestion regions and the anchor words of the entity candidate regions are the same, but the boundary words are different, then the corresponding entity candidate regions can be obtained by adjusting the boundaries of each entity suggestion region.
[0119] Specifically, in the process of adjusting the boundaries of each entity proposal region to obtain the corresponding entity candidate regions, the correlation between the entity proposal regions and the words in the text sequence to be identified is referenced, making the adjusted boundaries more accurate. That is, compared with multiple entity proposal regions, the corresponding multiple entity candidate regions have a higher coverage of entities in the text sequence to be identified. Since each entity candidate region can cover both independent entities and nested entities, when classifying each entity candidate region, both independent and nested entities in the text sequence to be identified can be identified, thus obtaining the corresponding entity recognition results.
[0120] The solution provided in this application adjusts the boundaries of each entity suggestion region in the text sequence to obtain the corresponding entity candidate region by referring to the association relationship between the entity suggestion region and each word in the text sequence to be identified. Then, the entity candidate region is identified to obtain the corresponding entity recognition result. Compared with the prior art, this solution can improve the coverage of entities in the text sequence to be identified by entity candidate regions without increasing the number of entity candidate regions, and reduce the computational complexity.
[0121] In this embodiment, the entity recognition process described above can be implemented using a preset entity recognition network, which can be, for example, such as... Figure 6 The structure shown may include a feature extraction module (also known as a semantic encoding module or sentence encoding module) 601, a candidate region determination module (also known as a candidate region generation module) 602, and an entity classification module (also known as an entity category classification module) 603 connected in sequence. Specifically, the feature extraction module 601 is used to extract features from the input text sequence to be recognized, obtaining the corresponding background semantic encoding matrix. The candidate region determination module 602 is used to receive the background semantic encoding matrix output by the feature extraction module 601 and output multiple entity candidate regions of the text to be processed. The entity classification module 603 is used to receive the multiple entity candidate regions output by the candidate region determination module 602 and output the corresponding entity recognition result. The following embodiments will further describe the processing procedures in each module during entity recognition in the text recognition network.
[0122] In one optional embodiment of this application, obtaining the entity candidate region corresponding to the entity suggestion region includes:
[0123] Based on the background semantic encoding matrix corresponding to the text sequence to be identified, entity candidate regions corresponding to the entity suggestion regions are obtained through an entity recognition network.
[0124] It should be noted that in this scheme, the background semantic encoding matrix is the same as the background representation matrix, and the background semantic encoding vector is the same as the background representation vector.
[0125] Specifically, the background semantic encoding matrix can be used to obtain the background semantic encoding vectors of each word in the text sequence to be identified, including the background semantic encoding vectors of each word covered by the baseline entity candidate region. The relationship between the background semantic encoding vectors of each word covered by the baseline entity candidate region and the background semantic encoding vectors of each word in the text sequence to be identified is used as the basis for adjusting the boundary to obtain the entity candidate region. This process can be performed in the candidate region determination module of the entity recognition network.
[0126] In one optional embodiment of this application, based on the background semantic coding matrix corresponding to the text sequence to be identified, an entity recognition network is used to obtain entity candidate regions corresponding to entity suggestion regions, including:
[0127] Based on the background semantic encoding matrix corresponding to the text sequence to be identified and the combined vector corresponding to the entity suggestion region, the similarity between the background semantic encoding vector of the word in the text sequence to be identified and the corresponding combined vector is obtained.
[0128] Based on similarity, the entity candidate regions corresponding to the entity suggestion regions are determined.
[0129] The relationship between the background semantic encoding vectors of each word covered by the benchmark entity candidate region and the background semantic encoding vectors of each word in the text sequence to be identified can be the similarity between the combined vector corresponding to the benchmark entity candidate region and the background semantic encoding vectors of each word in the text sequence to be identified.
[0130] Specifically, for each entity proposal region, the similarity between the background semantic encoding vector of each word in the text sequence to be recognized and the combined vector corresponding to that entity proposal region is obtained; that is, each word corresponds to a similarity score. Based on the magnitude of the similarity scores of each word, the boundary of the corresponding entity proposal region can be adjusted, that is, the boundary words of the entity proposal region are redefined, thereby obtaining the corresponding entity candidate region, and the entity candidate region is more likely to cover the entity than the corresponding entity proposal region. Next, the entity classification module classifies the entities in the entity candidate region to obtain the corresponding entity recognition result.
[0131] In one optional embodiment of this application, the similarity between the background semantic encoding vector of a word in the text sequence to be identified and the corresponding combined vector is obtained based on the background semantic encoding matrix corresponding to the text sequence to be identified and the combined vector corresponding to the entity proposal region, including:
[0132] Based on the background semantic encoding matrix corresponding to the text sequence to be identified, obtain the background semantic encoding vector of the words in the text sequence to be identified;
[0133] Based on the feature vectors corresponding to the words covered by the entity suggestion region and the background semantic encoding vectors of the corresponding anchor words, the corresponding combined vectors are obtained.
[0134] Multi-head self-attention computation is performed based on the combined vector corresponding to the entity proposal region and the background semantic encoding vector of the words in the text sequence to be identified, to obtain the similarity between the background semantic encoding vector of the words in the text sequence to be identified and the combined vector corresponding to the entity proposal region.
[0135] The combined vector corresponding to each entity suggestion region can be the sum of the feature vector corresponding to each entity suggestion region and the background semantic encoding vector of the corresponding anchor word. That is, the combined vector incorporates the relevant information of the corresponding entity suggestion region and anchor word.
[0136] Specifically, multi-head self-attention is used to calculate the similarity between the combined vector and each word. The combined vector corresponding to each reference matrix is used as the query matrix in the multi-head self-attention algorithm, and the background semantic encoding matrix of the text sequence to be recognized is used as the key matrix. The similarity between each reference matrix is obtained through the multi-head self-attention algorithm; this similarity can also be called the attention score. Specifically, for the text sequence to be recognized, where the background semantic encoding vector of each word is u... i (i = 1, 2, 3…L), and pre-set k (k can be a small integer such as 1, 2, 3, etc.) preset widths for obtaining entity suggestion regions. Taking the i-th word as the anchor word, an entity suggestion region (hereinafter referred to as the entity suggestion region corresponding to ki) is obtained for the text region to be recognized based on the k-th preset width. The similarity between the combined vector corresponding to the entity suggestion region and the background semantic encoding vector of each word in the text sequence to be recognized is obtained by the following formula:
[0137]
[0138] Where <·,·> represent inner product operations. Let h ∈ {lk, rk} be the query matrix and addressing matrix in self-attention computation, respectively, where h ∈ {lk, rk}. They are both background semantic encoding matrices U ∈ R that are used to recognize text sequences. L×D It is derived through a linear transformation (first, U is linearly transformed into Q = F(U) ∈ R). L×D Then, Q is divided into 2K heads according to the feature dimension, that is, 2K parts {Q1, Q2, ..., Q...} 2K},in Each head corresponds to a query matrix, K h (Similar operations are used to obtain the entity proposals). In order to regress the boundary of the entity candidate region based on the entity proposal region corresponding to the k-th preset width, the feature vector P corresponding to each entity proposal region can be... k Add it to the query matrix of self-attention computation, i.e., Q lk ←Q lk +P k Q rk ←Q rk +P k .
[0139] In one optional embodiment of this application, the feature vector corresponding to any entity suggestion region can be obtained by using the width of the entity suggestion region as the width of the convolution kernel, and performing convolution processing on the concatenated vector corresponding to the background semantic encoding vector of the word covered by the entity suggestion region to obtain the corresponding feature vector.
[0140] Specifically, for the entity proposal region corresponding to ki, its feature vector is obtained by the following formula:
[0141] p ki =Conv1D k (u i ) = ReLU(W k U i-k+1:i+k-1 )
[0142] Among them, ReLU has a preset activation function, u i-k+1:i+k-1 W is the concatenated vector corresponding to the background semantic encoding vector of the word covered by the entity suggestion region corresponding to ki. k The sizes of the convolution kernel and the convolution window are 2k-1, respectively. The word u at all positions. i This can be done simultaneously; the convolution operation can be denoted as P. k =Conv1D k (U).
[0143] In one optional embodiment of this application, a boundary determination submodule determines entity candidate regions corresponding to entity suggestion regions based on similarity, including:
[0144] The word with the highest similarity between the anchor word corresponding to the entity proposal region and the first endpoint word of the text sequence to be identified is determined as the starting boundary word of the corresponding entity candidate region, and the word with the highest similarity between the anchor word and the second endpoint word of the text sequence to be identified is determined as the ending boundary word of the corresponding entity candidate region.
[0145] Based on the first boundary word and the second boundary word, the corresponding entity candidate regions are determined.
[0146] If we consider the words in the text sequence to be recognized as a horizontally arranged sequence, then the first endpoint word can be considered the left endpoint word in the text sequence, located to the left of the anchor word, and the corresponding first boundary word is the starting boundary word. Similarly, the second endpoint word can be considered the right endpoint word in the text sequence, located to the right of the anchor word, and the corresponding second boundary word is the ending boundary word. For ease of understanding and description, the following text will explain the scheme using the first boundary word as the starting boundary word and the second boundary word as the ending boundary word.
[0147] Specifically, in the process of obtaining the corresponding entity candidate region by adjusting the boundary of the entity suggestion region, it is necessary to determine the adjusted left and right boundaries, that is, to determine the starting and ending boundary words of the entity candidate region. The higher the similarity between the background semantic encoding vector and the combined vector of each word in the text to be identified, the higher the matching degree between the word and the boundary of the target entity candidate region corresponding to the anchor word. Specifically, the word with the highest similarity to the combined vector is found among the anchor word and the words to its left as the starting boundary word of the entity candidate region, and the word with the highest similarity to the combined vector is found among the anchor word and the words to its right as the ending boundary word of the entity candidate region, thus obtaining the entity candidate region.
[0148] Specifically, based on the similarity scores of the words to the left of the anchor word and the similarity scores of the words to the right of the anchor word, the positions of the starting boundary word and the ending boundary word can be obtained using the following formula:
[0149]
[0150] Among them, A lk [i, j] represents the score matrix A lk The element at the position of the i-th row and j-th column, l ki r represents the left boundary of the entity candidate region corresponding to the entity suggestion region corresponding to ki. ki Let be the right boundary of the entity candidate region corresponding to the entity suggestion region corresponding to ki. It can be understood that the left boundary corresponds to the anchor word and a word to its left in the text sequence to be recognized, and the right boundary corresponds to the anchor word and a word to its left in the text sequence to be recognized. Therefore, the entity candidate region corresponding to the entity suggestion region corresponding to ki is:
[0151] In one optional embodiment of this application, obtaining at least one entity suggestion region corresponding to the text sequence to be identified includes:
[0152] Using an entity recognition network, based on at least one preset width, entity suggestion regions of at least one preset width are obtained by taking words in the text sequence to be recognized as anchor words.
[0153] Specifically, if the text sequence to be identified contains L (L≥1) words (including punctuation marks) and K (K≥1) preset widths, then the number of entity suggestion regions corresponding to each word in the text sequence to be identified is K, and the total number of entity suggestion regions corresponding to all words in the text to be identified is L*K. It can be seen that the entity suggestion regions in this embodiment are essentially the same as the entity candidate regions obtained in implementation method 1) of the prior art method for obtaining entity candidate regions based on anchor-region networks. As described above, the solution in this application also requires boundary adjustment of the entity suggestion regions to obtain entity candidate regions with higher coverage. The step of obtaining entity suggestion regions is also performed in the entity candidate region determination module.
[0154] In one optional embodiment of this application, obtaining entity recognition results for the text sequence to be recognized based on entity candidate regions includes:
[0155] Based on the background semantic encoding vectors corresponding to each word covered by each entity candidate region, the filtered entity candidate regions are obtained through an entity recognition network.
[0156] The entity recognition network is used to obtain the type and location of entities in the filtered entity candidate region.
[0157] Specifically, some of the entity candidate regions output by the entity candidate region determination module may not contain any entities. Therefore, before performing entity classification, the entity candidate region filtering module can be used to filter each entity candidate region, and the filtered entity candidate regions can be input into the entity classification module for entity recognition to obtain the corresponding entity type and location.
[0158] Clearly, the entity candidate region filtering module is located between the entity candidate region determination module and the entity classification module. It should be noted that this entity candidate region filtering module is not a necessary structure in the entity recognition network. When the entity recognition network does not have this module, the entity recognition module directly classifies the entity candidate regions output by the entity candidate region determination module.
[0159] In one optional embodiment of this application, based on the background semantic encoding vectors corresponding to each word covered by the entity candidate region, the filtered entity candidate regions are obtained through an entity recognition network, including:
[0160] Based on the background semantic encoding vector of each word covered by the entity candidate region, the corresponding first classification feature vector is obtained;
[0161] Based on the first classification feature vector corresponding to each entity candidate region, the probability that each entity candidate region contains an entity is obtained;
[0162] Based on the probability that each entity candidate region contains an entity, the filtered entity candidate regions are obtained.
[0163] The feature vector corresponding to each entity candidate region can be obtained by averaging the background semantic coding matrices of each word covered by the entity candidate region by row. For example, if an entity candidate region corresponds to 5 words, the background semantic coding matrix (D*5 matrix, D≥1 and is an integer) corresponding to these 5 words is obtained from the background semantic coding matrix of the text sequence to be identified. The first classification feature vector (D*1 column vector) of the entity candidate region is obtained by averaging the rows of this D*5 matrix.
[0164] Furthermore, the feature vector corresponding to each entity candidate region can also be a concatenated vector corresponding to the background semantic encoding vectors of its start boundary word, end boundary word, and anchor word, i.e.
[0165] Specifically, after obtaining the first classification feature vector of each entity candidate region, the following classifier is used to filter each entity candidate region:
[0166] p ki =Softmax(Wh ki )
[0167] Where, p ki Let W ∈ R be the probability that the entity candidate region corresponding to the entity suggestion region corresponding to ki contains the entity. 2×3D The linear transformation parameter matrix (whose dimension depends on the dimension of the hki eigenvectors), h ki Let ki be the first classification feature vector corresponding to the entity candidate region corresponding to the entity suggestion region.
[0168] After determining the probability that each entity candidate region contains an entity, entity candidate regions with a probability greater than or equal to a first preset value are selected as the filtered entity candidate regions.
[0169] In one optional embodiment of this application, obtaining the type and location of entities in the filtered entity candidate region through an entity recognition network includes:
[0170] Based on the background semantic encoding vector of the boundary words corresponding to the filtered entity candidate regions, the corresponding second classification feature vector is obtained;
[0171] Based on the second classification feature direction corresponding to the filtered entity candidate region, the type and location of the corresponding entity are obtained.
[0172] The second classification feature vector of each entity candidate region can be obtained by concatenating the background semantic encoding vectors corresponding to the start and end boundary words. For example, if the background semantic encoding vector of the start boundary word of a certain entity candidate region is... The background semantic encoding vector of the termination boundary word is Then the encoding vector corresponding to the candidate region of the entity is
[0173] In addition, the second classification feature vector of each entity candidate region can also be obtained by concatenating the background semantic encoding vectors corresponding to the start boundary word, end boundary word and anchor word.
[0174] Specifically, after obtaining the second classification feature vector of each entity candidate region, the following classifier is used to classify each entity candidate region:
[0175] o ki = softmax(W2·ReLU(W1·e ki ))
[0176] Among them, o ki Let W1 ∈ R be the predicted probability vector of the entity type of the entity candidate region corresponding to the entity suggestion region corresponding to ki. 2D×H and W2∈R C×H Both are linear transformation parameter matrices, e ki Let be the second classification feature vector corresponding to the entity candidate region corresponding to the entity suggestion region corresponding to ki, and C equals the number of entity categories. Here, C includes categories that do not belong to the entity and is used to further filter the entity candidate regions.
[0177] It should be noted that the method in this application embodiment can identify both nested entities and independent entities. When the text sequence to be identified does not contain nested entities, it is only necessary to perform conflict judgment on the identified entities after identification. Here, the Non-Maximum Suppression (NMS) algorithm can be used to process redundant and overlapping entity candidate regions and output the true entities. The idea of NMS is simple and effective: obtain the predicted probability of the entity corresponding to each entity candidate region when the entity classification module classifies the entity candidate regions, select the candidate entity with the highest probability, delete conflicting candidate entities, and repeat the previous process until all candidate entities have been processed. Finally, these non-conflicting candidate entities can be obtained as the final identification result.
[0178] In an optional embodiment of this application, before obtaining the entity candidate region corresponding to the entity suggestion region, the method may further include:
[0179] The background semantic encoding matrix corresponding to the text sequence to be recognized is obtained through an entity recognition network.
[0180] Specifically, the step of obtaining the background semantic encoding matrix of the text sequence to be identified is performed in the feature extraction network.
[0181] In one optional embodiment of this application, obtaining the background semantic encoding matrix corresponding to the text sequence to be recognized through an entity recognition network includes:
[0182] Obtain the initial background semantic encoding matrix corresponding to the text sequence to be recognized;
[0183] Based on the initial sentence background semantic encoding matrix and the part-of-speech embedding matrix corresponding to the text sequence to be identified, the corresponding background semantic encoding matrix is obtained.
[0184] The feature extraction module further includes an ELMo (Embeddings from Language Models) submodule and a Bi-directional Long Short-Term Memory (Bi-LSTM) submodule.
[0185] Specifically, for a text sequence x = (t1, t2, ..., t) containing L words to be identified... L The input text is encoded using ELMo to obtain the corresponding initial background semantic encoding matrix W. ELMo =ELMo(x)∈R L×E Where E is the dimension of the word vector. Considering that part-of-speech tags have a significant impact on entity boundary and entity category recognition, we assume that the part-of-speech tag sequence corresponding to the text sequence to be recognized is (p1, p2, ..., p...). L The corresponding part-of-speech embedding matrix is W. pos ∈R L×p , where p is the dimension of each part-of-speech embedding vector. Then W ELMo and W pos Word-by-word concatenation is input into the bidirectional long short-term memory submodule to obtain the background semantic encoding matrix of the text sequence to be recognized. in These are the forward and backward implicit vector representations of Bi-LSTM, respectively.
[0186] The sentence encoder can be defined in other ways. For example, the feature extraction module can include only the BERT (Bidirectional Encoder Representations from Transformers) module. The background semantic encoding matrix corresponding to the text sequence to be recognized can be obtained through the BERT module, U = BERT(x).
[0187] In one optional embodiment of this application, the entity recognition network is trained in the following manner:
[0188] Determine the training loss function, which includes the boundary loss function, the entity candidate region selection loss function, and the entity classification loss function;
[0189] Obtain the training sample set, in which text sequence samples are labeled with the location and type labels of real entities;
[0190] The entity recognition network is trained based on the training loss function and the training sample set until the value of the training loss function meets the preset conditions, thus obtaining the trained entity recognition network.
[0191] In the training phase of the entity recognition network, three loss functions were used for joint training: the boundary loss function, the entity candidate region selection loss function, and the entity classification loss function.
[0192] Specifically, the boundary loss function is mainly used to optimize the entity candidate region determination module. When similarity is used to optimize the left and right boundaries of the entity candidate region, the corresponding cross-entropy loss function is as follows:
[0193]
[0194]
[0195] Where CE(·,·) represents the standard cross-entropy loss function, l ki and r ki These represent the left and right boundaries of the target entity candidate region corresponding to the entity suggestion region corresponding to ki, respectively. lk [i,:] is the similarity vector representing the left boundary of each word in the entity suggestion region corresponding to ki, A rk The words in the entity suggestion region corresponding to [i,:]ki are used as the similarity vectors of the right boundary. The boundary loss function is L. b =L left +L right .
[0196] The entity candidate region filtering loss function is mainly used to optimize the entity candidate region filtering module. This module determines the probability that an entity candidate region belongs to an entity, which is a binary classification process. The corresponding binary cross-entropy loss function is as follows:
[0197]
[0198] Among them, yki p represents the result of determining whether the entity candidate region corresponding to the entity suggestion region corresponding to ki contains an entity. ki The probability that the entity candidate region corresponding to the entity suggestion region corresponding to ki contains the entity.
[0199] The entity classification loss function is mainly used to optimize the entity classification module. The corresponding cross-entropy loss function is as follows:
[0200]
[0201] Among them, y ki ∈{0, 1, ..., C} represents the entity candidate region m = [l] corresponding to the entity suggestion region of ki. ki ,r ki The corresponding entity type tag, o ki Let be the predicted probability vector of the entity type of the entity candidate region corresponding to the entity suggestion region corresponding to ki.
[0202] During the model training phase, this embodiment employs an end-to-end optimization method, simultaneously optimizing the boundary loss, entity candidate region selection loss, and entity classification loss. The objective loss function for the entire model is defined as follows:
[0203] L = L b +L r +L c
[0204] Furthermore, during the optimization of the entity candidate region selection module, it is considered that the entity candidate regions obtained by the entity candidate region determination module may contain errors and may lack diversity, making it difficult to quickly optimize the entity candidate region selection module. To avoid the accumulation of errors during training, in this embodiment of the application, when optimizing the entity candidate region selection module, the words in the input sample text sequence are combined pairwise to form entity candidate regions. If all combined entity candidate regions are input into the entity candidate region selection module, it will lead to high computational complexity. At the same time, the number of negative samples is much larger than the number of positive samples, which is not conducive to model optimization. To avoid this problem, negative sampling is performed on the negative samples.
[0205] In one optional embodiment of this application, the loss value of the boundary loss function corresponding to any entity candidate region is obtained in the following manner:
[0206] Based on the overlap between the words covered by the entity proposal region corresponding to the entity candidate region and the words covered by the real entity in the text sequence sample, the target entity candidate region is obtained.
[0207] Substitute the similarity vector of the boundary corresponding to the candidate region of the entity and the one-hot representation vector of the boundary of the target candidate entity into the boundary loss function to obtain the corresponding loss value.
[0208] During training, obtaining the value of the boundary loss function requires obtaining the target entity candidate region corresponding to each entity's proposed region. The target entity candidate region serves as the supervision label for the optimization module for determining the entity candidate region.
[0209] Specifically, for each entity proposal region, the corresponding target entity candidate region is determined based on the degree of overlap between the words covered by that entity proposal region and the word sets covered by each real entity in the text sequence sample, also known as the Intersection-over Union Ratio (IoU Ratio). The formulas for calculating each overlap degree are as follows:
[0210]
[0211] Among them, P ki E represents the set of words covered by the entity suggestion region corresponding to ki. m Let m be the set of words covered by the m-th (m = 1, 2, 3…) real entity in the text sample sequence. After determining the target entity candidate regions corresponding to the proposed regions of each entity based on the overlap, the similarity representation vector of the boundary of the entity candidate region and the one-hot representation vector of the boundary of the target candidate entity are substituted into the boundary loss function to obtain the left boundary loss and the right boundary loss, and then the corresponding loss values are obtained.
[0212] Furthermore, based on the overlap between the words covered by the entity proposal region corresponding to the entity candidate region and the words covered by the real entities in the text sequence sample, the target entity candidate region is obtained, including:
[0213] If the overlap of the candidate region of the entity is not less than the preset threshold, then the region corresponding to the real entity is taken as the corresponding candidate region of the target entity.
[0214] If the overlap of the candidate entity region is less than a preset threshold, then the region corresponding to the anchor word of the candidate entity region is taken as the corresponding target entity candidate region.
[0215] Specifically, for each entity suggestion region, if its overlap with the word set covered by a real entity is not less than a preset threshold (this preset threshold can be set to 0.1), then the region corresponding to the real entity is determined as the target entity candidate region corresponding to the entity suggestion region. If its overlap with the word set covered by a real entity is less than the preset threshold, then its corresponding anchor word is taken as the corresponding target entity candidate region.
[0216] In addition, during the training of the entity recognition network, multiple scales of basic entity regions can be obtained by pre-setting multiple widths (also known as scales). Setting multiple scales of basic regions helps to determine which real entity to regress during training, and also helps to regress all real entities in the text sample sequence based on the overlap score.
[0217] The following example further illustrates the solution of this application embodiment: a pre-trained entity recognition network is used to recognize a text sequence containing nested entities (The Minister of Foreign Affairs convened a meeting). Figure 7 As shown, the entity recognition network in this example includes a sentence encoding layer 701, an entity proposal generation layer 702, an entity candidate filtering layer 703, and an entity classifier module 704. The sentence encoding layer 701 further includes an ELMo submodule and a dual forward long short-term memory submodule connected in sequence. The entity recognition network inputs the text sequence to be recognized and outputs the final entity recognition result.
[0218] Specifically, in the entity suggestion generation layer 702, three preset widths are pre-set to obtain the corresponding entity suggestion regions. The three preset widths correspond to three different proposals: Proposal1 corresponds to a preset width of 1, Proposal2 corresponds to a preset width of 3, and Proposal3 corresponds to a preset width of 5. The entity suggestion generation layer 702 outputs 27 entity candidate regions corresponding to different proposals, as shown in the dashed box 705. The entity candidate filtering layer 703 filters the 27 entity candidate regions to obtain three filtered entity candidate regions, as shown in the dashed box 706. The entity classifier module 704 classifies the three filtered entity candidate regions to obtain the entity type corresponding to each filtered entity candidate region. Among them, the filtered entity candidate region [7,7] does not belong to any entity type, as shown in the dashed box 707. Finally, the entity recognition network outputs the nested entity "The Minister of Foreign Affairs" and its corresponding entity type PER contained in the text sequence to be recognized, and the independent entity "Foreign Affairs" and its corresponding type ORG, as shown in the dashed box 708.
[0219] Example 2
[0220] In one optional embodiment, obtaining at least one entity candidate region in the text sequence to be identified based on at least one entity boundary word includes: obtaining entity suggestion regions corresponding to the text sequence to be identified based on entity boundary words; and obtaining corresponding entity candidate regions based on entity suggestion regions. Specifically, in this embodiment, entity suggestion regions are determined by entity boundary words, and then the start and end boundary words of the entity candidate regions are determined from the entity boundary words using the entity suggestion regions.
[0221] like Figure 8 The diagram shown is an architecture diagram of a model for performing an entity recognition method according to an embodiment of this application. This model can be called a Temporal Region Proposal Network (TRPN) model. Figure 8 As shown, it consists of two modules: an entity candidate detector module and an entity classifier module. The structure and function of these two modules are described below.
[0222] 1. Entity Candidate Detector Network (ECDN) module: This module aims to detect all possible entity candidates (i.e., entity candidate regions) in the input text (i.e., the text sequence to be recognized). It takes a sentence as input and outputs all entity candidates. This module consists of two sub-modules: a sentence encoding layer and an entity candidate generation module.
[0223] The sentence encoding layer uses Bi-LSTM (Bidirectional Long Short-Term Memory) / CNN (Convolutional Neural Networks) / BERT (Bidirectional Encoder Representations from Transformers) to semantically encode the input sentence, obtaining a context representation vector for each word. The entity candidate generation module dynamically detects potential entity candidates with different granularities in the input text. This module consists of two parts: an entity proposal generation layer and an entity candidate filtering layer.
[0224] The Entity Proposal Generator layer dynamically predicts entity proposal regions of different granularities using the generated entity proposal windows (i.e., different region widths) as the entity region benchmark. Here, we design a fast and memory-efficient boundary attention mechanism to accelerate model inference. First, we identify possible entity boundary words in the sentence through an entity boundary word detection layer, and then calculate boundary attention scores only on the entity boundary words.
[0225] The Entity Candidate Filter uses a binary classification layer to determine the probability that a generated entity candidate belongs to a real entity, and then filters the generated entity candidates based on this probability.
[0226] 2. Entity Classifier Network (ECN) Module: This module aims to classify entity candidates obtained by the detector module according to a predefined set of entity categories. It takes each generated entity candidate and its representation as input and outputs its entity category. This module consists of two sub-modules: an entity candidate encoding layer and an entity category classification layer.
[0227] The entity candidate encoding layer transforms entity candidate representations into fixed-dimensional feature vectors. It takes each generated entity candidate and its background representation as input and outputs its corresponding entity category.
[0228] The entity category classification layer is a submodule that determines the entity category for each candidate entity. It takes the entity feature vector of the candidate entity as input, predicts the probability that the entity belongs to each entity category, and determines the entity category with the highest probability.
[0229] The following example illustrates the overall process of the entity recognition method implemented by the above model. Figure 9a As shown, enter the sentence "The director...Geographic" (see details). Figure 9a As shown, the entity recognition process can include the following steps:
[0230] Step 1: Input the sentence into the entity candidate detector module, which uses the entity boundary word detection layer to obtain possible entity boundary words in the sentence, such as “t1:The”, “t5:National”, “t11:Diseases”, “t13:National”, and “t14:Geographic”.
[0231] Step 2: Utilize the entity proposal window generation layer to generate entity proposal windows using each boundary term as an anchor term. When "t5:National" is used as the anchor term, the corresponding entity proposal windows are "[t5,t5]:National" and "[t4,t6]:theNational Institute". When "t14:Geographic" is used as the anchor term, the corresponding entity proposal windows are "[t14,t14]:National" and "[t13,t15]:National Geographic.", etc. Here, we take two predefined entity proposals with widths of 1 and 3 as an example.
[0232] Step 3: Then, the entity suggestion windows [t5,t5], [t4,t6], [t14,t14], and [t13,t15] are input into the entity candidate recognition layer, which are used as the baseline to adjust the prediction and obtain the corresponding entity candidate regions [t5,t11], [t1,t11], [t13,t14], and [t13,t14].
[0233] Step 4: Input the detected entity candidates into the entity candidate filtering layer to filter out erroneous and duplicate entities, obtaining [t5,t11], [t1,t11], and [t13,t14].
[0234] Step 5: Determine the entity category of the filtered entity candidates [t5,t11], [t1,t11], and [t13,t14] respectively, and input them into the entity classifier. Finally, obtain the entities and their categories: "[t5,t11]: PERSON", "[t1,t11]: ORGNIZATION", and "[t13,t14]: ORGNIZATION".
[0235] Compared with the prior art, the solution of the embodiments of this application ( Figure 9b ) and existing technology ( Figure 9c The biggest difference lies in the entity candidate generation module. As shown in the figure, there are two main differences:
[0236] First, the number of different predefined entity proposal windows. Our method only requires two different entity proposal windows (i.e., two entity proposal windows with R=1,3 and widths of 1 and 3). However, existing methods typically require defining multiple entity proposal windows (i.e., R=1,2,3,4,5,6) to generate entities of different granularities.
[0237] Second, the predefined entity suggestion window is used differently. Our method uses the generated entity suggestion window as a benchmark for entity candidates to dynamically predict multi-granularity entity candidates, while existing technologies directly use the entity suggestion window as entity candidates.
[0238] The following sections will provide a detailed description of each module of the model described in the embodiments of this application.
[0239] In one optional embodiment of this application, obtaining at least one entity boundary word corresponding to the text sequence to be identified includes:
[0240] Alternatively, based on the background representation vectors of the words in the text sequence to be identified, obtain the probability of each word in the text sequence to be identified as an entity boundary word, and determine the entity boundary words of the text sequence to be identified based on the probability.
[0241] In this embodiment, all words in the text sequence to be identified are treated as entity boundary words, corresponding to the scheme in Example 1, where each word in the text sequence to be identified is treated as an entity boundary word for subsequent processing to determine the entity candidate region of the text sequence to be identified. In this embodiment, however, a subset of words are selected from the text sequence to be identified as entity boundary words for subsequent processing to determine the entity candidate region of the text sequence to be identified.
[0242] Specifically, entity boundary words of the text sequence to be recognized can be obtained through the entity boundary word detection layer. That is, this module is used to detect the boundary words of all possible entities in the input text and generate a boundary word sequence. The design of this module is used to remove non-boundary word representations in the subsequent entity candidate recognition module, realize the compression of the Query (index) matrix and Key (key value) matrix in the boundary attention calculation, accelerate the speed of the entity candidate recognition module and reduce the computational cost.
[0243] like Figure 10 The diagram illustrates how the entity boundary word detection layer obtains entity boundary words. For the input sentence "The director of…National Geographic.", the entity boundary word detection layer outputs its entity boundary words as {"t2:director", "t5:National", "t11:Diseases", "t13:National", "t14:Geographic"}. For this module, given a sentence, this module detects each word t... i The output will be a probability score p. i ∈[0,1] represents the probability that the word belongs to the boundary word. The specific process may include:
[0244] Step 1, for each word ti Input its background representation vector u i ∈R d By connecting to a fully connected neural network (FNN), a numerical value v is obtained. i That is, v i =FNN(u i ), where the parameters of FNN() are shared across all words;
[0245] Step 2, apply the Sigmoid activation function to the value v i Convert to a probability value, i.e., p i =Sigmoid(v i );
[0246] Step 3, based on the probability value p i To determine the boundary words, given a boundary word threshold α∈(0,1) (e.g., it can be set to 0.5), then if p i >α, then the word belongs to the boundary word mask. i =1, otherwise the word is not a boundary word mask. i =0;
[0247] Step 4: Output all entity boundary words in the sentence, i.e., the entity boundary word mask sequence of the input sentence.
[0248] Specifically, entity boundary word detection aims to identify the set of all possible boundary words that could be used to define nested entities. An entity's boundary words include its start boundary word and its end boundary word. For example... Figure 11a As shown, the detected entity boundary words are: {“t2:director”,“t5:National”,“t11:Diseases”,“t13:National”,“t14:Geographic”}. Figure 11b As shown, the detected entity boundary words are: {"t1:Edinburgh","t2:University","t3:Library","t7:Adam","t8:Ferguson","t9:Building"}.
[0249] Furthermore, the reason why entity boundary words in a sentence can be identified can be attributed to two aspects:
[0250] On the one hand, entity boundary words in a sentence often exhibit certain patterns, which can be discovered through rule-based matching. The location of entity boundary words can be identified using rules based on dictionaries, parts of speech, prefixes, suffixes, etc. For example:
[0251] • “...went to UK…”, where “UK” is generally the starting boundary term for the entity “LOCATION”;
[0252] • “...party went to…”, where “party” is generally the terminator of the ORGNIZATION entity;
[0253] • “...director of the…”, where “director” is generally the opening boundary word for the PERSON entity;
[0254] • "#Noun Phrase tells" The word "tells" generally indicates that the preceding word is a PERSON terminator, where "#Noun Phrase" indicates a noun phrase in the sentence;
[0255] • If a word's prefix is a lowercase letter and the current word's prefix is an uppercase letter, then the current word is the starting boundary word of an entity. For example: "...the National Institute...", "...to Adam Ferguson Building...";
[0256] • If the prefix of the current word is an uppercase letter and the prefix of the next word is a lowercase letter, then the current word is usually the terminator of an entity, for example: "...Diseases tells...", "...UniversityLibrary is...";
[0257] For phrases that satisfy the syntactic structure #Definite Article (abbreviated as DT) + #Noun, the noun corresponding to #Noun (abbreviated as NN) is usually the starting word of an entity. Here, "#Definite Article" represents the definite article, and "#Noun" represents the noun. This syntactic structure means that the definite article is followed by a noun, and in this syntactic structure, the definite article noun is generally the starting word of an entity. For example, in "The / DT director / NN…", "The" is the definite article, and the noun "director" that follows it is the starting word of an entity.
[0258] On the other hand, entity boundary words in sentences exhibit certain statistical patterns. Table 2 shows the statistical results for two nested entity recognition datasets, ACE2004 and ACE2005, displaying the most frequent words appearing at different entity positions, as well as the most frequent part-of-speech rules for named entity recognition. From Table 2, we can see that:
[0259] • Some words frequently appear as the starting words for entities, such as "president", "North", "New", etc.
[0260] • Some words are frequently used as terminators for entities, such as “country”, “company”, “party”, etc.
[0261] Based on the part-of-speech information of the text, many entity boundaries can be discovered through part-of-speech rules. Among them, "Determiner + Noun" means a determiner plus a noun, "Preposition + Noun" means a preposition connecting a noun, "Preposition + Proper Noun" means a preposition connecting a proper noun, "Verb + Noun" means a verb connecting a noun, and "Noun + Verb" means a noun connecting a verb.
[0262] Table 2
[0263]
[0264] In one optional embodiment of this application, obtaining entity suggestion regions corresponding to the text sequence to be identified based on entity boundary words includes:
[0265] Based on at least one preset width, entity suggestion regions of at least one preset width are obtained, with entity boundary words as anchor words respectively.
[0266] Specifically, entity suggestion regions can be obtained through an entity suggestion generation layer. This module can generate corresponding entity suggestion regions for each entity boundary word in a sentence using two predefined entity suggestion windows of different lengths (i.e., preset widths). These generated entity suggestion regions will be used as entity region benchmarks to dynamically detect entity candidates at different granularities. It will also encode each entity suggestion region based on the background representation of the word sequence. It should be noted that the preset width selected by this module can be one, two, or more. Understandably, the smaller the selected preset width, the fewer entity suggestion regions are obtained, and the less computation is required subsequently. Figure 12a The diagram illustrates how this module obtains entity suggestion areas. For example, it may include the following steps:
[0267] Step 1: Generate all entity candidates for a given sentence using the entity suggestion window.
[0268] For each word in the sentence, two different entity suggestion regions of length 1 and 3 (i.e., entity suggestion windows of length 1 and 3) are generated, such as... Figure 12bAs shown in the figure, using the entity boundary term "t3:Library" as the anchor term, the resulting entity proposal regions are as follows: "[t3,t3]:Library" (corresponding to a preset width of 1, Proposal 1) and "[t2,t4]:University Library is" (corresponding to a preset width of 3, Proposal 3). Table 3 shows the entity proposal regions generated for all possible entity boundary terms.
[0269] Two symmetrical entity suggestion windows are generated around each anchor word. Other asymmetrical forms can also be used. For example, for the anchor word "t3:Library", the asymmetrical window can be [t3,t4], [t2,t5].
[0270] Generally, for a word ti in a sentence, R different lengths of entity suggestion regions can be generated, where R is the number of preset widths selected when generating the entity suggestion regions. In fact, two widths or even one width of suggestion window is sufficient for nested entity recognition.
[0271] Table 3
[0272] Anchor words Entity suggestion window (k=1) Entity suggestion window (k=3) "t1:Edinburgh" "[t1,t1]:Edinburgh" "[t0,t2]:Edinburgh University" "t2:University" "[t2,t2]:University" "[t1,t3]:Edinburgh University Library" "t3:Library" "[t3,t3]:Library" "[t2,t4]:University Library is" "t7:Adam" "[t7,t7]:Adam" "[t6,t8]:to Adam Ferguson" "t8:Ferguson" "[t7,t8]:Ferguson" "[t7,t9]:Adam Ferguson Building" "t9:Building" "[t9,t9]:Building" "[t8,t10]:Ferguson Building"
[0273] Step 2 involves obtaining entity proposal region representations for all entity boundary words through a sliding convolution operation on the sentence background representation matrix. To utilize the generated entity proposal region information in subsequent modules, it needs to be encoded to obtain the corresponding representation vectors.
[0274] Entity suggestion regions for anchor words are generated using Proposal 1 (preset width 1) and Proposal 3 (preset width 3). This embodiment introduces a local one-dimensional convolution Conv1D to perform a convolution operation on each generated entity suggestion region, and its output serves as its feature representation vector.
[0275] Regarding the entity suggestion region representation for Proposal 1: p i =Conv1D1(u i ),
[0276] Regarding the entity suggestion area representation in Proposal 3: p i =Conv1D3([u i-1 ,u i ,u i+1 ]),
[0277] Among them, Conv1D k This represents a 1D convolution operation with a kernel width of k, u i-1 ,ui ,u i+1 These represent the three words t that are covered by the entity suggestion region of Proposal 3 of the i-th word. i-1 ,t i ,t i+1 The background representation vector.
[0278] This scheme uses two convolution operations with different kernel widths to obtain the background representation vector of the entity proposal region for each entity boundary word in the sentence. The advantage of using convolution is that the background representation vector of the entity proposal region can be computed in parallel.
[0279] The solution provided in this application uses only two entity suggestion windows (i.e., preset widths) to generate entity suggestion areas, which is sufficient for subsequent nested entity recognition with multi-layered structures. This is mainly due to the following reasons:
[0280] The following is based on Figure 11b To illustrate, typically each entity has a unique boundary term. Using these boundary terms, all entity regions can be obtained in the two entity suggestion windows, as shown in Table 4 (the arrows in the table indicate the direction of region expansion predicted for entity candidate regions). Specifically:
[0281] 1. Since “t1:Edinburgh” is an entity boundary term, the entity suggestion region corresponding to this term is [t1,t1], [t0,t2]. Using these two entity suggestion regions as a benchmark, the entity candidates “Edinburgh” and “Edinburgh University” can be predicted.
[0282] 2. Since “t8:Ferguson” is an entity boundary term, the entity suggestion regions corresponding to this term as the anchor term are “[t8,t8]:Ferguson” and “[t7,t9]:Adam Ferguson Building”. Using the entity suggestion region “[t8,t8]” as the baseline, the entity candidate [t7,t8] (“Adam Ferguson”) can be obtained through prediction. Using the entity suggestion region [t7,t9] as the baseline, the entity candidate “[t7,t9]:Adam Ferguson Building” can be obtained through prediction.
[0283] 3. Through the above two boundary word operations, the entity candidate region “[t1,t3]:Edinburgh UniversityLibrary” has not yet been detected, but this entity region has a unique entity boundary word “t3:Library”, which can yield two entity suggestion regions [t3,t3] and [t2,t4]. The entity candidate [t1,t3] can be obtained by using one of these two suggestion windows as a benchmark.
[0284] Table 4
[0285]
[0286]
[0287] The solution provided in this application uses only one entity suggestion window (i.e., a preset width) to generate the entity suggestion area, which is sufficient for subsequent nested entity recognition with multi-layered structures. The main reasons for this are as follows:
[0288] Still with Figure 11b For example, it can be seen that almost every entity has a unique boundary word. Generating entity proposal regions using these boundary words as anchor words can expand to the corresponding entity candidate regions, as shown in Table 5. Using more entity proposal windows can help achieve more stable model performance. However, defining many entity proposal regions also incurs additional computational costs. Therefore, to balance model prediction performance and computational cost, only two entity proposal windows can be selected, such as Proposal 1 with a width of 1 and Proposal 3 with a width of 3.
[0289] Table 5
[0290]
[0291]
[0292] In one optional embodiment of this application, obtaining the corresponding entity candidate region based on the entity suggestion region includes:
[0293] Determine the candidate start boundary words and candidate end boundary words for anchor words in the entity suggestion region;
[0294] The starting boundary word of the entity proposal region is determined from the starting boundary word candidate, and the ending boundary word of the entity proposal region is determined from the ending boundary word candidate;
[0295] Based on the obtained start and end boundary words, the corresponding entity candidate regions are determined.
[0296] Among them, the candidate start boundary words and candidate end boundary words for anchor words in the entity suggestion region are determined, including
[0297] The anchor word in the entity suggestion area and the boundary word located to the left of the anchor word are identified as the starting boundary word candidates for the anchor word;
[0298] The anchor word in the entity suggestion area and the boundary word to the right of the anchor word are identified as candidates for the termination boundary word of the anchor word.
[0299] Specifically, the starting boundary word of the entity proposal region is determined from the starting boundary word candidates, and the ending boundary word of the entity proposal region is determined from the ending boundary word candidates, including:
[0300] Determine the first probability of each starting boundary word candidate as the starting boundary word of the entity proposal region, and the second probability of each ending boundary word candidate as the ending boundary word of the entity proposal region;
[0301] The starting boundary word of the entity proposal region is determined based on the first probability, and the ending boundary word of the entity proposal region is determined based on the second probability.
[0302] In other words, based on the entity suggestion region, the corresponding entity candidate region is obtained, including:
[0303] Based on the background representation vectors of words covered by entity suggestion regions and the background representation vectors of corresponding anchor words, obtain the corresponding combined vector;
[0304] Obtain the similarity between the background representation vector and the combined vector of entity boundary words in the text sequence to be identified;
[0305] Based on similarity, obtain the corresponding entity candidate regions.
[0306] The process of obtaining the similarity between the background representation vector and the combined vector of entity boundary words in the text sequence to be identified includes:
[0307] In Euclidean or hyperbolic space, obtain the similarity between the background representation vector and the combined vector of entity boundary words in the text sequence to be identified.
[0308] Among them, based on similarity, the corresponding entity candidate regions are obtained, including:
[0309] Based on similarity, the starting boundary words of the corresponding entity candidate regions are determined from the anchor words of the entity suggestion regions in the text sequence to be identified and the entity boundary words located to the left of the anchor words. The ending boundary words of the corresponding entity candidate regions are determined from the anchor words of the entity suggestion regions in the text sequence to be identified and the entity boundary words located to the right of the anchor words.
[0310] Based on the start boundary words and the end boundary words, the corresponding entity candidate regions are determined.
[0311] Specifically, the anchor words of the entity proposal regions in the text sequence to be identified, and the entity boundary words with the highest similarity among the entity boundary words located to the left of the anchor words, are determined as the starting boundary words of the corresponding entity candidate regions. The anchor words of the entity proposal regions in the text sequence to be identified, and the entity boundary words with the highest similarity among the entity boundary words located to the right of the anchor words, are determined as the ending boundary words of the corresponding entity candidate regions. Based on the starting and ending boundary words, the corresponding entity candidate regions are determined.
[0312] Specifically, entity candidate regions can be obtained based on entity suggestion regions through an entity candidate recognition layer. This module dynamically predicts the boundary word positions of entity candidate regions according to the entity suggestion window. It will generate all entity candidates and their background representations. Unlike existing methods, entity suggestion regions are used as a benchmark for obtaining entity candidate regions, rather than being used directly as entity candidate regions.
[0313] like Figure 13a As shown, this module uses a self-attention mechanism to predict the boundary word positions of all entity candidates. For example, it may include the following steps:
[0314] Step 1, Obtain Key Matrix Transformation and Query Matrix Transformation: Two different linear transformations are used to transform the background representation matrix of the text to be recognized, resulting in four new sentence representations (each sentence representation is a matrix containing the background representation feature vectors of all words): 1) Key Matrix Representation (start and end): Feature representations of words at the start and end boundaries; each key matrix contains the feature vector of each word with respect to the key value. 2) Query Matrix Representation (k = 1, 3): Feature representations of each word with respect to two different suggestion windows;
[0315] Step 2: Entity Proposal-aware Index Matrix (PQM) – The index matrix representation (k=1,3) is fused with different proposal window representations from the entity proposal window generation module.
[0316] Steps 3-4, Fast and Memory-efficient Boundary Attention (FMBA): Calculate the attention score (normalized inner product score) between each anchor word and all words in the sentence. To avoid the high computational cost and high memory consumption of standard self-attention, we filter out parts of the key-value matrix and the entity proposal-aware index representation (PQM) that cannot be considered as boundaries based on the boundary word mask obtained from the entity boundary detector.
[0317] Step 5: Determine the boundary word position of the entity candidate based on the boundary attention score.
[0318] This module uses entity proposal regions as a benchmark to dynamically predict entity candidate regions. A fast and memory-efficient boundary attention operation is designed for entity candidate boundary prediction, which only considers possible entity boundary words, rather than all words in the input sentence.
[0319] Figure 13b The detailed structure of the entity candidate recognition module is shown. This module mainly involves five parts of calculation, as indicated by the numbers in the figure. The calculation process for these five parts is given below:
[0320] 1. Calculate the key-value matrix representation and the index matrix representation:
[0321] Starting key value: K l =W l U;
[0322] Termination key value: K r =W r U;
[0323] Index (k=1): Q1=W1U;
[0324] Index (k=3): Q3=W2U.
[0325] Among them, W l W r W1 and W2 are weight parameter matrices, and U is the background representation from the sentence encoding layer.
[0326] 2. The Proposal-aware Query Matrix (PQM) predicts entity candidate boundaries using the entity proposal window as the entity region benchmark. The PQM is calculated for Proposal 1 and Proposal 3:
[0327] Q1←Q1+Conv1D1(U);
[0328] Q2←Q2+Conv1D3(U).
[0329] 3. Compressed key-value matrix and compressed PQM: Their calculation involves two steps:
[0330] 1) Combine the boundary mask M obtained from the entity boundary detector with the key value matrix representation K. l ,K r And the index matrix representations Q1 and Q2 for entity suggestion awareness.
[0331] 2) Represent the original key-value matrix K using the filtered-out vectors (non-boundary words). l ,K r The index matrix representation of entity suggestion perception is compressed into Q1 and Q2, and the compressed matrix is denoted as . and
[0332] 4. Start and End Boundary Attention Operations: For Compressed PQM For those from or The vector q in i As an anchor term index query, attention operations are used to calculate its relevance to the query. The initial boundary score and the final boundary score,
[0333]
[0334] Where <·,·> represents the similarity score calculation between two vectors. It can use a similarity measure in Euclidean space or a similarity measure based on a non-Euclidean space, such as the similarity induced by hyperbolic distance in hyperbolic space. In either Euclidean or hyperbolic space, the similarity between the background representation vector of the entity boundary word in the text sequence to be identified and the combined vector is obtained, and then the boundary score is obtained based on the similarity.
[0335] 5. Determine the position of entity boundary words for entity candidates: For those from or The eigenvector q in i The key word with the highest attention score is taken as the boundary word. The positions of the start and end boundary words are calculated as follows:
[0336]
[0337] The obtained candidate regions for predicted entities are [l i ,r i ], l i For the position of the boundary word, r i The position of the terminating boundary word.
[0338] Furthermore, the most direct boundary attention operation has a self-attention operation. Its time and memory complexity is O(N). 2d), where N is the length of the input sequence and d is the dimension of the feature vectors of K and Q. This operation has a quadratic relationship with the length of the input sequence, which leads to high computational and memory consumption costs, making it unable to scale well to long text sequences. To address these challenges, we propose a fast and memory-efficient boundary attention operation (FMBA) to compute the boundary scores of entity candidates.
[0339] FMBA design is based on sparse attention operations using detected boundary words. For example... Figure 13c As shown, it first considers boundary words to compress the index and key-value matrix, and then computes the boundary attention operation:
[0340] Compressed key-value matrix and entity proposal-aware index matrix: Since FMBA only needs to calculate the attention score between boundary words to find the positions of the two boundary words for each entity candidate, we can filter out the start and end key-value matrices Ks, Ke and the index matrix Q based on the boundary word mask. k The non-boundary word parts in (k=1,2) are used to obtain the corresponding compression matrix.
[0341] Attention scores are calculated using a compressed key-value matrix and index matrix: scores are calculated on boundary words. replace Suppose the number of possible boundary words in the input sentence is . The time and memory complexity of FMBA is... Because boundary words are usually much shorter than the sentence sequence length It can significantly reduce the computational and memory costs of boundary attention operations during inference.
[0342] This scheme designs a fast and memory-efficient boundary attention operation module to compute the boundary score matrix, reducing the computational complexity from O(N) to O(N). 2 d) Approaching here
[0343] In one optional embodiment of this application, the entity recognition result of the text sequence to be recognized is obtained based on the entity candidate region, including:
[0344] The entity candidate regions are filtered to obtain the filtered entity candidate regions;
[0345] The filtered candidate regions of entities are classified to obtain the entity recognition results of the text sequence to be recognized.
[0346] The process involves filtering the entity candidate regions to obtain the filtered entity candidate regions, including:
[0347] Based on the background representation vector of the word covered by the entity candidate region, obtain the corresponding first classification feature vector;
[0348] Based on the first classification feature vector corresponding to the entity candidate region, the probability that the entity candidate region belongs to the entity is obtained;
[0349] Based on the probability that an entity candidate region belongs to an entity, the filtered entity candidate regions are obtained.
[0350] Specifically, an entity candidate filtering layer can be used to filter the entity candidate regions obtained by the previous module, resulting in filtered entity candidate regions. This module simultaneously estimates the probability that each entity candidate belongs to an entity and filters the generated entity candidates based on the probability values. For example... Figure 14 As shown, this module filters out entity candidates that are unlikely to be the correct entities. The module first encodes each entity candidate into a fixed-dimensional feature vector, and then inputs it into a binary classifier to determine whether the entity candidate belongs to the true entity. This module consists of two sub-modules: an entity candidate encoding layer and an entity candidate classification layer.
[0351] The entity candidate encoding layer encodes all entity candidates of different lengths into fixed-dimensional feature vectors. For entity candidate [l] i ,r i ], plus its corresponding anchor word t i This module encodes the entity candidate using three components, including the start word feature vector. Termination word feature vector Anchor word feature vector u i Entity candidates [l] i ,r i The encoded features (i.e., the primary classification features) are represented as follows:
[0352]
[0353] That is, the concatenation of three feature vectors;
[0354] The entity candidate classification layer, a fully connected layer (FNN) with two-class softmax, is used to determine the quality of entity candidates and filter out erroneous ones. The probability of an entity candidate is defined as:
[0355] p i =Softmax(FNN(h) i ))
[0356] Unlike existing technologies that use CNN / LSTM to encode entity candidates, this scheme's entity candidate encoding layer only uses the concatenation of three components of the entity candidate: the feature vectors of the start boundary word, the end boundary word, and the anchor word (i.e., the background representation vector). This operation is very efficient and helps to accelerate model inference.
[0357] The process involves classifying the selected entity candidate regions to obtain the entity recognition results for the text sequence to be recognized, including:
[0358] Based on the background representation vectors of the start and end boundary words corresponding to the filtered entity candidate regions, the corresponding second classification feature vectors are obtained.
[0359] The entity recognition result is obtained by classifying the entity based on the second classification feature vector corresponding to the selected entity candidate region.
[0360] Specifically, the entity classifier module can be used to classify the filtered entity candidate regions. This module is as follows: Figure 15 As shown, each filtered entity candidate (i.e., the filtered entity candidate region) is first encoded and classified into different predefined entity categories, which will determine the final predicted entity.
[0361] This module encodes each filtered entity candidate to obtain a fixed-dimensional feature vector, and then inputs it into a fully connected network with a Softmax output layer for entity category determination. It consists of two sub-modules:
[0362] Entity candidate encoding layer: Encodes entity candidates of different lengths into feature vectors of fixed dimension. For each entity candidate interval m = [l, r], its feature vector is defined as the concatenation of two boundary word feature vectors:
[0363] m = Concat(u l ,u r ).
[0364] This coding layer has a simple and efficient structure, and other existing methods such as CNN / LSTM can also be used as coding layers for entity candidates.
[0365] Entity Classification Layer: This layer determines the entity candidate category based on the feature vector m obtained from the entity candidate encoding layer. The entity classifier is defined as follows:
[0366] p = Softmax(FNN(m))
[0367] The fully connected neural network (FNN) can be...
[0368] FNN(m) = W2ReLU(W1m),
[0369] Here W1∈R 2D×H ,W2∈R C×D Here are the network parameters to be learned, D is the predefined number of entity categories, including the non-entity category None, and ReLU() is the activation function of the network.
[0370] Unlike existing methods, this approach encodes each entity candidate based on its representation from the entity candidate encoding layer, rather than directly encoding entity candidates from the original word sequence and the input sentence. This end-to-end approach not only reduces error propagation but also accelerates online model inference. Furthermore, this module uses only the concatenation of the feature vectors of the two boundary words of the entity candidate as its entity feature vector; this operation is efficient and requires no additional computational cost, further speeding up model inference.
[0371] Furthermore, boundary attention operations, i.e., similarity calculations, can be performed in hyperbolic space during the entity candidate recognition layer, such as... Figure 16 As shown, entity boundary detection is based on similarity scores induced by hyperbolic distance.
[0372] Figure 16This paper presents a hyperbolic entity proposal network architecture for nested entity recognition, comprising two neural network modules: an entity candidate detector module and a hyperbolic entity classifier module. The entity candidate detector module aims to identify potential entity regions by computing multi-head attention scores in hyperbolic space. It then generates entity region candidates and can be further divided into three modules: a sentence encoding layer (i.e., the sentence encoder in the figure), a hyperbolic space-based candidate generation layer (i.e., the hyperbolic space-based candidate generator in the figure), and an entity candidate classification layer (i.e., the entity candidate classifier in the figure). More specifically, the sentence encoder obtains the background representation of each word through a bidirectional long short-term memory module (Bi-LSTM), a convolutional neural network (CNN), and a pre-trained language model (such as BERT). The candidate generator generates entity region candidates based on the attention scores (i.e., similarity) of different heads. Unlike computing multi-head attention scores in Euclidean space, here the similarity between anchor words and individual words is calculated in hyperbolic space. Hyperbolic proximity-induced similarity replaces Euclidean space similarity calculation, and this hyperbolic space-based calculation helps the model learn word alignments with hierarchical relationships. The entity candidate classification layer is a binary classification neural network layer that determines the probability of generated entity candidate regions belonging to an entity category and filters the candidate regions based on this probability. This layer can be computed in Euclidean space or hyperbolic space. The hyperbolic entity classification module aims to classify detected entity candidate regions according to predefined entity categories. This module consists of two parts: first, an entity candidate encoding layer that encodes the filtered entity candidates in hyperbolic space; and second, an entity candidate classification layer that classifies the filtered entity candidate regions obtained in the previous steps into the appropriate entity category.
[0373] It should be noted that during training, this network uses both positive entity candidates (m1, m3, m4, m8 in the figure) and negative entity candidates (m2, m5, m6, m7 in the figure) as training samples. Positive entity candidates can be understood as filtered entity candidates, meaning they belong to entities and their labels are specific entity types, while negative entity candidates do not belong to entities. Training with both positive and negative entity candidates separately results in shared network parameters for the entity candidate encoding layer. Including negative entity candidates during training helps improve the hyperbolic entity classifier's ability to distinguish entity categories.
[0374] A hyperbolic distance-induced similarity calculation function can be defined:
[0375] K(q h k h )=-α h d c (q h k h) 2 +β h
[0376] in Here, is the hyperbolic distance. The addition operation in hyperbolic space is calculated as follows:
[0377]
[0378] Accordingly, for entity category classifiers, since there is a significant conceptual hierarchy in nested entities, we can define a classifier in hyperbolic space. First, we map the predefined set of categories C = {c1, c2, ..., cT} + {None_Type} to a feature vector space, where the embedding vector corresponding to category c is defined as y. c ∈R D The classifier is defined as follows: Assume h m Given the feature representation of entity candidate m, its classifier is defined as
[0379]
[0380] Where e m ∈R D Let m be a D-dimensional feature representation vector obtained by a nonlinear transformation FNN(), i.e.
[0381] e m =FNN(h m )
[0382] Among them, y c p represents the embedding vector for category c∈C. m,c This represents the probability of entity candidate m with respect to category c. When making predictions, the model selects the category with the highest probability as the predicted entity category.
[0383] The hyperbolic space-based entity classification layer essentially replaces the parameters, operations, and similarity scores of the Euclidean space-based entity classification layer with those of hyperbolic space. Given an entity candidate *m*, its representation vector is:
[0384]
[0385] here These are the network full connectivity parameters, and b1 and b2 represent the bias parameters. Denotes the activation function in hyperbolic space. This is a Mobius addition operation. If C represents the set of categories containing None, the probability that entity candidate m belongs to category c is...
[0386]
[0387] where \(K(e m ,y c ) is the similarity induced by the hyperbolic distance. Note that this is different from the inner product operation in Euclidean space.
[0388] Example 3
[0389] In an alternative embodiment, based on at least one entity boundary word, at least one entity candidate region in the text sequence to be recognized is obtained, including: obtaining a preset number of entity boundary words adjacent to the entity boundary word from the text sequence to be recognized; obtaining the background representation vectors of the entity boundary words, and the similarities between the background representation vectors of the entity boundary words and the corresponding adjacent preset number of entity boundary words; obtaining the corresponding entity candidate regions based on the similarities. Among them, based on the similarities, the start boundary word and the end boundary word of the corresponding entity candidate region are respectively determined from the entity boundary words in the text sequence to be recognized and the adjacent preset number of entity boundary words of the entity boundary word; based on the start boundary word and the end boundary word, the corresponding entity candidate region is determined. Specifically, in this solution, after obtaining the entity boundary word, the start boundary word and the end boundary of the entity candidate region are directly determined based on the entity boundary word, and then the corresponding entity candidate region is obtained.
[0390] As Figure 17 shown, the difference between the model implementing this solution and the models in the previous two embodiments mainly lies in the entity candidate detector module. The entity candidate detector module in this solution consists of three modules: an entity boundary word detection layer, a nearest neighbor word discovery layer, and an entity candidate recognition layer, where:
[0391] 1. The entity boundary word detection layer, which detects possible entity boundary words in the input text sequence and is consistent with the entity boundary word detection layer in the previous two embodiments.
[0392] 2. The nearest neighbor word discovery layer, which uses the detected entity boundary word as an anchor word, and then uses the local sensitive hashing (Local Sensitive Hash) technology to find the first \(K\) nearest neighbor words of each entity boundary word, where \(K\ll L\), and \(L\) is the length of the text sequence to be recognized.
[0393] 3. The entity candidate recognition layer, which calculates the similarity scores between each anchor word and its first \(K\) nearest neighbor entity boundary words, and forms a boundary word pair of the entity candidate, that is, the start boundary word and the end boundary word, by combining the anchor word with the nearest neighbor entity boundary word with the maximum similarity score;
[0394] Repeat the execution process of the nearest neighbor word discovery layer and the entity candidate recognition layer \(H\) times (such as \(H = 2\)). Finally, all entity candidates are collected and output.
[0395] The main difference between this scheme and the scheme in Example 2 lies in the entity candidate detector module:
[0396] It does not require a predefined entity suggestion window, and replaces the entity candidate generator in the entity candidate detector with a nearest neighbor word discovery module;
[0397] With low computational complexity, this scheme only requires calculating the similarity scores between the anchor word and the first K boundary words selected by Locality Sensitive Hashing (LSH), resulting in a computational complexity of O(Nlog(K)). Typically, K < 0. <N。
[0398] It should be noted that the entity recognition scheme provided in this application is well-suited for recognizing nested entities, as well as traditional non-nested entities. This scheme is applicable to the following application scenarios requiring nested question recognition:
[0399] 1. Smart Screen Recognition
[0400] Smart Screen Recognition is an intelligent solution for mobile phones. When chatting, reading, or browsing pictures, users can trigger this function by long-pressing the text content area on the screen. It can automatically extract information such as entities and keywords in the text, such as names, place names, locations, and phone numbers, and then expand the information, link application services, or recommend interests to help users achieve the goal of "One Step". Figure 18a Examples of potential applications of nested entity recognition in smart screens are shown.
[0401] 2. Enhanced reading skills related to news reading
[0402] When users read news text, they may be unfamiliar with the background information of related entities mentioned in the news. In this case, the reading enhancement feature can automatically extract relevant entities from the text and link them to web pages describing those entities. This feature helps users quickly jump to the web pages of entities they are interested in, such as... Figure 18b As shown.
[0403] 3. Enhanced menu reading experience
[0404] When consumers read menus, they need to understand the dish names before ordering, such as understanding and imagining the ingredients and dishes corresponding to the names. However, when reading menus, we often encounter unfamiliar or uneaten ingredients. Reading enhancement tools can be used to identify ingredients in the dish names (i.e., nested entities) and link them to relevant physical items and ingredient descriptions to aid understanding. Figure 18c As shown.
[0405] 4. Image Tagging
[0406] Image tagging is a tool that helps users quickly edit image tags. Similar functionality is already available in many smartphones. When users want to add tags to images and screenshots, this tool can automatically extract key phrases from the text content of the image and provide them to the user as candidates for selection and editing. Figure 18d As shown, the nested entity recognition technology provided in this application can be used to automatically extract these key phrases with different granularities from its text content, requiring only the addition of an entity importance ranking.
[0407] 5. Knowledge Graph Construction
[0408] Knowledge graphs have been widely applied in question-answering systems, recommendation systems, search engines, and other fields. This is particularly important for the automatic construction of large-scale, complete knowledge graphs. Nested entity recognition can provide richer entity relationships for knowledge graph completion tasks. For example, in... Figure 18e First, based on the nested entity recognition results in the sentence, relation extraction is performed to obtain the relationships between the entities in the sentence. Then, based on the previous step, a knowledge graph (KG completion) is constructed, ultimately resulting in a knowledge graph (KG).
[0409] If nested entities are not discovered, the related entity relationships will be lost, such as:
[0410] hasLocation(Adam Ferguson Building,Edinburgh);
[0411] If all these nested entities are discovered, more additional entities can be obtained, such as:
[0412] partOf(Edinburgh University Library,Edinburgh University);
[0413] hasLocation(Edinburgh University,Edinburgh).
[0414] Figure 19 A structural block diagram of an entity recognition device provided in an embodiment of this application is shown below. Figure 19 As shown, the device 1800 may include: an entity boundary word acquisition module 1801, an entity candidate region acquisition module 1802, and an entity recognition result acquisition module 1803, wherein:
[0415] The entity boundary word acquisition module 1801 is used to acquire at least one entity boundary word corresponding to the text sequence to be identified;
[0416] The entity candidate region acquisition module 1802 is used to acquire at least one entity candidate region in the text sequence to be identified based on the at least one entity boundary word;
[0417] The entity recognition result acquisition module 1803 is used to acquire the entity recognition result of the text sequence to be recognized based on the entity candidate region.
[0418] The solution provided in this application, compared with the prior art, can improve the coverage of entities in the text sequence to be identified by entity candidate regions without increasing the number of entity candidate regions, and reduce the computational complexity.
[0419] In one optional embodiment of this application, the entity boundary term acquisition module is specifically used for:
[0420] Treat all words in the text sequence to be identified as entity boundary words; or...
[0421] Based on the background representation vector of the words in the text sequence to be identified, the probability of the words in the text sequence to be identified as entity boundary words is obtained, and based on the probability, the entity boundary words of the text sequence to be identified are determined.
[0422] In one optional embodiment of this application, the entity candidate region acquisition module is specifically used for:
[0423] Based on entity boundary words, obtain the entity suggestion region corresponding to the text sequence to be identified;
[0424] Based on the entity suggestion region, obtain the corresponding entity candidate region.
[0425] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0426] Based on at least one preset width, entity suggestion regions of at least one preset width are obtained, with entity boundary words as anchor words respectively.
[0427] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0428] Based on the background representation vectors of words covered by entity suggestion regions and the background representation vectors of corresponding anchor words, obtain the corresponding combined vector;
[0429] Obtain the similarity between the background representation vector and the combined vector of entity boundary words in the text sequence to be identified;
[0430] Based on similarity, obtain the corresponding entity candidate regions.
[0431] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0432] In Euclidean or hyperbolic space, obtain the similarity between the background representation vector and the combined vector of entity boundary words in the text sequence to be identified.
[0433] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0434] Based on similarity, the starting boundary words of the corresponding entity candidate regions are determined from the anchor words of the entity suggestion regions in the text sequence to be identified and the entity boundary words located to the left of the anchor words. The ending boundary words of the corresponding entity candidate regions are determined from the anchor words of the entity suggestion regions in the text sequence to be identified and the entity boundary words located to the right of the anchor words.
[0435] Based on the start boundary words and the end boundary words, the corresponding entity candidate regions are determined.
[0436] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0437] The width of the entity proposal region is used as the width of the convolution kernel. The background representation vector of the word covered by the entity proposal region is convolved to obtain the corresponding feature vector.
[0438] Based on the feature vectors corresponding to the words covered by the entity suggestion region and the background representation vectors of the corresponding anchor words, the corresponding combined vector is obtained.
[0439] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0440] Determine the candidate start boundary words and candidate end boundary words for anchor words in the entity suggestion region;
[0441] The starting boundary word of the entity proposal region is determined from the starting boundary word candidate, and the ending boundary word of the entity proposal region is determined from the ending boundary word candidate;
[0442] Based on the obtained start and end boundary words, the corresponding entity candidate regions are determined.
[0443] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0444] The anchor word in the entity suggestion area and the boundary word located to the left of the anchor word are identified as the starting boundary word candidates for the anchor word;
[0445] The anchor word in the entity suggestion area and the boundary word to the right of the anchor word are identified as candidates for the termination boundary word of the anchor word.
[0446] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0447] Determine the first probability of each starting boundary word candidate as the starting boundary word of the entity proposal region, and the second probability of each ending boundary word candidate as the ending boundary word of the entity proposal region;
[0448] The starting boundary word of the entity proposal region is determined based on the first probability, and the ending boundary word of the entity proposal region is determined based on the second probability.
[0449] In one optional embodiment of this application, the entity recognition result acquisition module is specifically used for:
[0450] The entity candidate regions are filtered to obtain the filtered entity candidate regions;
[0451] The filtered candidate regions of entities are classified to obtain the entity recognition results of the text sequence to be recognized.
[0452] In an optional embodiment of this application, the entity recognition result acquisition module is further used for:
[0453] Based on the background representation vector of the word covered by the entity candidate region, obtain the corresponding first classification feature vector;
[0454] Based on the first classification feature vector corresponding to the entity candidate region, the probability that the entity candidate region belongs to the entity is obtained;
[0455] Based on the probability that an entity candidate region belongs to an entity, the filtered entity candidate regions are obtained.
[0456] In an optional embodiment of this application, the entity recognition result acquisition module is further used for:
[0457] Based on the background representation vectors of the start and end boundary words corresponding to the filtered entity candidate regions, the corresponding second classification feature vectors are obtained.
[0458] The entity recognition result is obtained by classifying the entity based on the second classification feature vector corresponding to the selected entity candidate region.
[0459] In one optional embodiment of this application, the entity recognition result acquisition module is specifically used for:
[0460] Based on the background representation vectors of the starting and ending boundary words corresponding to the entity candidate regions, the corresponding third-class feature vectors are obtained.
[0461] The entity is identified by classifying the entity based on the third-class feature vector corresponding to the entity candidate region.
[0462] In one optional embodiment of this application, the entity candidate region acquisition module is specifically used for:
[0463] From the text sequence to be identified, obtain a preset number of entity boundary words adjacent to the entity boundary words;
[0464] Obtain the background representation vector of entity boundary words and the similarity between it and the background representation vector of the corresponding preset number of adjacent entity boundary words;
[0465] Based on similarity, obtain the corresponding entity candidate regions.
[0466] In an optional embodiment of this application, the entity candidate region acquisition module is further configured to:
[0467] Based on similarity, the starting and ending boundary words of the corresponding entity candidate regions are determined from the entity boundary words of the text sequence to be identified, as well as from a preset number of adjacent entity boundary words.
[0468] Based on the start boundary words and the end boundary words, the corresponding entity candidate regions are determined.
[0469] Based on the same principle, this application also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the method provided in any optional embodiment of this application, specifically implementing the following:
[0470] Obtain at least one entity boundary word corresponding to the text sequence to be identified; based on at least one entity boundary word, obtain at least one entity candidate region in the text sequence to be identified; based on the entity candidate region, obtain the entity recognition result of the text sequence to be identified.
[0471] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method shown in any embodiment of this application.
[0472] It is understandable that the medium may store the computer program corresponding to the verification method of the configuration management database.
[0473] Figure 20 The diagram shows a structural schematic of an electronic device to which an embodiment of this application applies, such as... Figure 20 As shown, Figure 20The illustrated electronic device 1900 includes a processor 1901 and a memory 1903. The processor 1901 and the memory 1903 are connected, for example, via a bus 1902. Further, the electronic device 1900 may also include a transceiver 1904, through which the electronic device 1900 can interact with other electronic devices. It should be noted that in practical applications, the transceiver 1904 is not limited to one type, and the structure of this electronic device 1900 does not constitute a limitation on the embodiments of this application.
[0474] In this embodiment, the processor 1901 is used to implement... Figure 19 The function of the entity recognition device shown.
[0475] Processor 1901 may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA, or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 1901 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0476] Bus 1902 may include a pathway for transmitting information between the aforementioned components. Bus 1902 may be a PCI bus or an EISA bus, etc. Bus 1902 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 20 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0477] The memory 1903 may be a ROM or other type of static storage device capable of storing static information and instructions, RAM or other type of dynamic storage device capable of storing information and instructions, or it may be an EEPROM, CD-ROM or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0478] The memory 1903 stores the application code that executes the scheme of this application, and its execution is controlled by the processor 1901. The processor 1901 executes the application code stored in the memory 1903 to implement... Figure 19 The operation of the entity recognition device provided in the illustrated embodiment.
[0479] The apparatus provided in this application embodiment can implement at least one of multiple modules through an AI model. AI-related functions can be executed through non-volatile memory, volatile memory, and a processor.
[0480] The processor may include one or more processors. In this case, the one or more processors may be general-purpose processors, such as central processing unit (CPU), application processor (AP), etc., or pure graphics processing unit, such as graphics processing unit (GPU), vision processing unit (VPU), and / or AI-specific processors, such as neural processing unit (NPU).
[0481] The one or more processors control the processing of input data based on predefined operating rules or artificial intelligence (AI) models stored in non-volatile and volatile memory. These predefined operating rules or AI models are provided through training or learning.
[0482] Here, "providing through learning" refers to obtaining predefined operating rules or an AI model with desired characteristics by applying a learning algorithm to multiple learning datasets. This learning can be performed within the device itself, in which the AI is executed according to the embodiment, and / or can be implemented via a separate server / system.
[0483] This AI model can contain multiple neural network layers. Each layer has multiple weight values, and the computation of a layer is performed using the results of the previous layer and the multiple weights of the current layer. Examples of neural networks include, but are not limited to, Convolutional Neural Networks (CNNs), Deep Neural Networks (DNNs), Recurrent Neural Networks (RNNs), Restricted Boltzmann Machines (RBMs), Deep Belief Networks (DBNs), Bidirectional Recurrent Deep Neural Networks (BRDNNs), Generative Adversarial Networks (GANs), and Deep Q-Networks.
[0484] A learning algorithm is a method of training a predetermined target device (e.g., a robot) using multiple learning data sets to enable, allow, or control the target device to make determinations or predictions. Examples of such learning algorithms include, but are not limited to, supervised learning, unsupervised learning, semi-supervised learning, or reinforcement learning.
[0485] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific methods implemented by the computer-readable medium described above when executed by an electronic device can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0486] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0487] The above are only some embodiments of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. An entity recognition method, characterized in that, include: Obtain at least one entity boundary word corresponding to the text sequence; Using the corresponding entity boundary word in the at least one entity boundary word as the anchor word, the entity suggestion region corresponding to the text sequence is determined based on the at least one entity boundary word; Based on the association between the entity suggestion region and each word in the text sequence, the boundary of the entity suggestion region is adjusted; Based on the adjusted boundaries of the entity suggestion regions, at least one entity candidate region in the text sequence is determined; Based on the at least one entity candidate region, entity recognition is performed on the text sequence to obtain at least one entity in the text sequence.
2. The method according to claim 1, characterized in that, The step of obtaining at least one entity boundary word corresponding to the text sequence includes: Use all words in the text sequence as entity boundary words; or... Based on the background representation vector of the words in the text sequence, the probability of the words in the text sequence being entity boundary words is obtained, and based on the probability, the entity boundary words of the text sequence are determined.
3. The method according to claim 1, characterized in that, Determining the entity suggestion region corresponding to the text sequence includes: The entity suggestion area is determined to include at least one preset width relative to the anchor word.
4. The method according to claim 1, characterized in that, Adjusting the boundary of the entity suggestion region includes: Based on the background representation vectors of words covered by entity suggestion regions and the background representation vectors of corresponding anchor words, obtain the corresponding combined vector; Obtain the similarity between the background representation vector of entity boundary words in the text sequence and the combined vector; The boundaries of the entity suggestion regions are adjusted based on similarity.
5. The method according to claim 4, characterized in that, The method also includes: Based on the adjusted boundary of the entity suggestion region, the corresponding entity candidate region is determined, and the starting boundary word and ending boundary word of the entity candidate region are determined based on the adjusted boundary of the entity suggestion region.
6. The method according to claim 4, characterized in that, The step of obtaining the similarity between the background representation vector of entity boundary words in the text sequence and the combined vector includes: In Euclidean space or hyperbolic space, obtain the similarity between the background representation vector of entity boundary words in the text sequence and the combined vector.
7. The method according to claim 5, characterized in that, The determination of the corresponding entity candidate region includes: Based on the similarity, the starting boundary word of the corresponding entity candidate region is determined from at least one anchor word of the entity suggestion region in the text sequence and the entity boundary word located to the left of the anchor word; the ending boundary word of the corresponding entity candidate region is determined from at least one anchor word of the entity suggestion region in the text sequence and the entity boundary word located to the right of the anchor word. Based on the starting boundary word and the ending boundary word, the corresponding entity candidate region is determined.
8. The method according to claim 4, characterized in that, The background representation vector of the word based on entity suggestion region coverage and the background representation vector of the corresponding anchor word are used to obtain the corresponding combined vector, including: The width of the entity proposal region is used as the width of the convolution kernel. The background representation vector of the word covered by the entity proposal region is convolved to obtain the corresponding feature vector. Based on the feature vectors corresponding to the words covered by the entity suggestion region and the background representation vectors of the corresponding anchor words, the corresponding combined vector is obtained.
9. The method as described in claim 5, characterized in that, The determination of the corresponding entity candidate region includes: Determine at least one start boundary word candidate and at least one end boundary word candidate for the anchor word of the entity proposal region; The starting boundary word of the entity proposal region is determined from at least one starting boundary word candidate, and the ending boundary word of the entity proposal region is determined from at least one ending boundary word candidate; Based on the obtained start and end boundary words, the corresponding entity candidate regions are determined.
10. The method as described in claim 9, characterized in that, Determine at least one start boundary word candidate and at least one end boundary word candidate for the anchor word of the entity proposal region, including: The anchor word of the entity suggestion region and the entity boundary word located to the left of the anchor word are determined as at least one candidate starting boundary word for the anchor word; The anchor word of the entity suggestion region and the entity boundary word located to the right of the anchor word are determined as at least one candidate termination boundary word for the anchor word.
11. The method as described in claim 9, characterized in that, Determining the starting boundary word of the entity proposal region from at least one starting boundary word candidate, and determining the ending boundary word of the entity proposal region from at least one ending boundary word candidate, including: Determine a first probability that each of the at least one starting boundary word candidates is the starting boundary word of the entity proposal region, and a second probability that each of the at least one ending boundary word candidates is the ending boundary word of the entity proposal region. The starting boundary word of the entity suggestion region is determined based on the first probability, and the ending boundary word of the entity suggestion region is determined based on the second probability.
12. The method according to any one of claims 1-11, characterized in that, The step of performing entity recognition on the text sequence based on the at least one entity candidate region to obtain at least one entity in the text sequence includes: Filter at least one entity candidate region to obtain at least one filtered entity candidate region; Each filtered entity candidate region is then categorized to obtain the entity recognition result of the text sequence.
13. The method according to claim 12, characterized in that, The step of filtering at least one entity candidate region to obtain at least one filtered entity candidate region includes: Based on the background representation vector of the word covered by at least one entity candidate region, obtain the corresponding first classification feature vector; Based on the corresponding first classification feature vector, the probability that the candidate region of an entity belongs to an entity is obtained; Based on the probability that an entity candidate region belongs to an entity, at least one filtered entity candidate region is obtained.
14. The method according to claim 12 or 13, characterized in that, The step of classifying each filtered entity candidate region to obtain the entity recognition result of the text sequence includes: Based on the background representation vectors of the start and end boundary words corresponding to each filtered entity candidate region, the corresponding second classification feature vector is obtained. Based on the second classification feature vector, the at least one filtered entity candidate region is classified to obtain the entity recognition result of the text sequence.
15. The method according to any one of claims 1-11, characterized in that, The step of performing entity recognition on the text sequence based on the at least one entity candidate region to obtain at least one entity in the text sequence includes: Based on the background representation vectors of the start and end boundary words corresponding to at least one entity candidate region, obtain the corresponding third classification feature vector; Based on the third classification feature vector, at least one entity candidate region is classified to obtain the entity recognition result of the text sequence.
16. The method according to claim 1 or 2, characterized in that, The step of obtaining at least one entity candidate region in the text sequence based on the at least one entity boundary word includes: From the text sequence, obtain a predetermined number of entity boundary words that are adjacent to at least one entity boundary word; Obtain the background representation vector of entity boundary words and the similarity between it and the background representation vector of the corresponding preset number of adjacent entity boundary words; Based on similarity, obtain the corresponding entity candidate regions.
17. The method according to claim 16, characterized in that, The step of obtaining the corresponding entity candidate region based on similarity includes: Based on the similarity, the starting and ending boundary words of the corresponding entity candidate regions are determined from the entity boundary words of the text sequence and from a preset number of adjacent entity boundary words. Based on the starting boundary word and the ending boundary word, the corresponding entity candidate region is determined.
18. An electronic device, characterized in that, Including memory and processor; The memory stores computer programs; The processor is configured to execute the computer program to implement the method of any one of claims 1 to 17.
19. 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 method of any one of claims 1 to 17.
Citation Information
Patent Citations
Neural network-based boundary combination named entity recognition method
CN110032737A
Named entity recognition method and device based on anchor point area network
CN110472237A