A named entity recognition method, device and medium based on label hints

CN116595979BActive Publication Date: 2026-09-18SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310374346.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-07
Publication Date
2026-09-18
Estimated Expiration
2043-04-07

AI Technical Summary

Technical Problem

但是MRC方法也存在几点不足

Benefits of technology

[0050] The beneficial effects of this invention are: this invention encodes the label hints and the source text separately, and then integrates the label hint information into the candidate text span to be classified through cross-attention, which alleviates the problem that the attention to label knowledge is scattered by the original text caused by the fusion of label knowledge and the whole text, and also reduces the training and inference time of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116595979B_ABST
    Figure CN116595979B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, and medium for named entity recognition based on tag prompts. The method includes: generating tag prompts for each type of entity using a tag prompt generator; obtaining a word segmentation sequence and its corresponding hidden layer representation based on the input text; filtering spans that may constitute entities and obtaining a representation for each span; fusing the span representation with all tag prompts to obtain an encoded representation; concatenating the encoded representation with the original span encoded representation to obtain the final representation of the span relative to all tags; classifying the span representation relative to each tag and obtaining a probability score for the span relative to each type of tag; for spans with probability scores greater than a classification threshold, converting all word segments within that span to obtain the final target entity. This invention avoids the time and effort consumed by manually designing tag knowledge by generating tag prompt information and can be applied to the fields of neural networks and natural language processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of neural networks and natural language processing, and in particular to a method, apparatus and medium for named entity recognition based on label prompts. Background Technology

[0002] Named Entity Recognition (NER) aims to locate specific words or phrases in unstructured text and classify them into predefined semantic categories, such as names, locations, and organizations. NER is a fundamental task in Natural Language Processing (NLP). It is widely applied in various downstream tasks, such as relation extraction, reading comprehension, and multi-turn dialogue. To date, many researchers have focused on span-based entity recognition, as the inherent characteristics of span allow it to be naturally applied to both planar and nested entities (where the spans are independent). However, most methods for span recognition treat labels as independent, meaningless vectors, ignoring the prior knowledge contained within them. To alleviate this problem, researchers have begun to focus on integrating label knowledge into the span. Machine Reading Comprehension (MRC) is a particularly prominent approach. MRC formally treats NER as a question-answering task, designing questions related to label knowledge based on given text, and then concatenating the questions with the text as input, allowing span recognition to benefit from this pre-prepared label knowledge. In low-resource scenarios, the MRC formalization achieves state-of-the-art performance in span recognition. However, the MRC method also has several shortcomings. First, the problems in the MRC method are artificially created, resulting in significant subjective variability. Second, concatenating the problem with the text in the MRC method causes the computational cost of the model to increase exponentially with the number of entity categories, leading to a significant decrease in efficiency. Third, concatenating the problem with the text causes attention to be diverted to the original text, thus failing to fully utilize label knowledge to enhance the text representation. Therefore, how to solve these problems while utilizing label knowledge remains a significant challenge. Summary of the Invention

[0003] In order to at least partially solve one of the technical problems existing in the prior art, the present invention aims to provide a named entity recognition method, device and medium based on tag prompts.

[0004] The technical solution adopted in this invention is:

[0005] A named entity recognition method based on tag suggestions includes the following steps:

[0006] S1. Generate label hints for each type of entity using a label hint generator. Each label hint is a set of multiple codes.

[0007] S2. Segment the words in the input text X to obtain the segmentation sequence T corresponding to the input text X. Input the segmentation sequence T into the pre-trained model BERT to obtain the hidden layer representation H corresponding to the segmentation sequence T.

[0008] S3. Filter the spans that may make up the entity based on the hidden layer representation, and obtain the representation of each span through conditional layer normalization (CLN).

[0009] S4. By using cross-attention, the representation of span (i,j) is s ij This is combined with all tag hints to obtain the encoded representation of each span relative to each tag. Encoding representation Compared to the original span encoding representation s ij By concatenating the data, we obtain the final representation of the span (i,j) relative to all labels.

[0010] S5. The representation of span (i,j) relative to each label is passed through a self-attention module that learns multi-entity label relationships, and then classified to obtain the probability score of span (i,j) relative to each type of label.

[0011] S6, Probability Score Greater than the classification threshold t c The word segmentation table is used to convert all words within the specified span to obtain the final target entity.

[0012] Further, step S1 specifically includes:

[0013] The tag hint generator generates tag hints using entity category names and the entity center instances of the cluster; the format of the tag hint is [entity name: instance 1... instance c].

[0014] Further, step S2 specifically includes:

[0015] Segment the words in the input text X to obtain the segmentation sequence T corresponding to the input text X;

[0016] Based on the input text X, obtain the position sequence and segment sequence corresponding to the word segmentation sequence T;

[0017] The word segmentation sequence T, the position sequence, and the segmentation sequence are input into the pre-trained model BERT to obtain the hidden layer representation H = {h1, h2, ..., h} corresponding to the word segmentation sequence T. n}

[0018] Furthermore, the calculation formula for step S3 is as follows:

[0019]

[0020]

[0021]

[0022] γ ij =W α h i +b α

[0023] λ ij =Wβ β h i +b β

[0024] Among them, h i h represents the starting vector of the span. j The endpoint vector represents the span, d represents the dimension of each word segmentation vector, and h represents the length of the segmentation vector. jk Represents the endpoint vector h j The k-th element, μ and σ are the endpoint vector h. j The mean and standard deviation of W; α W β b α and b β All of these are trainable parameters;

[0025] Starting vector h j Normalization is performed by fixing the mean and variance, and then the parameters γ are used respectively. ij and λ ij Scaling and shifting are performed; the representation s corresponding to the span (i,j) is obtained through a conditional layer normalization mechanism. ij .

[0026] Furthermore, in step S4, the expression for fusing label cue information and text span information through cross-attention is as follows:

[0027] Q = G k W q

[0028] [K,V]=s ij [W k W v ]

[0029]

[0030] in, This indicates that the span (i,j) is within the label hint G. k Conditional encoding representation under conditions, W q W k W v U and Q are trainable parameters, Q is the query vector for calculating attention, K is the key vector for calculating attention, V is the value vector for calculating attention, and d is the dimension of vector K.

[0031] Furthermore, the calculation formula for step S5 is as follows:

[0032]

[0033]

[0034] MLA is a multi-label attention module. Let (i,j) represent the probability that the span (i,j) belongs to entity class k. MLP is a three-layer feedforward neural network with the GELU activation function.

[0035] Furthermore, the calculation formula for the multi-label attention module is as follows:

[0036]

[0037]

[0038] MLP is used to calculate the attention score between Q′ and K′, W′ q ,W′ k ,W′ v There are three trainable parameters, where Norm represents layer normalization.

[0039] Furthermore, during the training phase, based on the obtained probability scores... Calculate the loss and perform gradient backpropagation.

[0040] Furthermore, in step S5, regarding span classification, to alleviate the class imbalance problem, CircleLoss is used as the final loss function. The formula for CircleLoss is:

[0041]

[0042] P a Q is the span set of all entities of type α in this sample. a It is the span set of all non-entity or type non-α entities in the sample; γ and m are usually hyperparameters that need to be considered in metric learning.

[0043] Another technical solution adopted in this invention is:

[0044] A named entity recognition device based on tag prompts, comprising:

[0045] At least one processor;

[0046] At least one memory for storing at least one program;

[0047] When the at least one program is executed by the at least one processor, the at least one processor implements the method described above.

[0048] Another technical solution adopted in this invention is:

[0049] A computer-readable storage medium storing a processor-executable program, which, when executed by a processor, performs the method described above.

[0050] The beneficial effects of this invention are: this invention encodes the label hints and the source text separately, and then integrates the label hint information into the candidate text span to be classified through cross-attention, which alleviates the problem that the attention to label knowledge is scattered by the original text caused by the fusion of label knowledge and the whole text, and also reduces the training and inference time of the model. Attached Figure Description

[0051] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following description is provided with accompanying drawings of the relevant technical solutions in the embodiments of the present invention or the prior art. It should be understood that the accompanying drawings described below are only for the purpose of clearly illustrating some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0052] Figure 1 This is a structural diagram of a named entity recognition method based on tag prompts in an embodiment of the present invention;

[0053] Figure 2 These are example images of two different types of entities in embodiments of the present invention;

[0054] Figure 3 This is a schematic diagram illustrating the specific execution process of the tag suggestion generator in an embodiment of the present invention;

[0055] Figure 4 This is a flowchart illustrating the steps of a named entity recognition method based on tag prompts in an embodiment of the present invention. Detailed Implementation

[0056] The embodiments of the present invention 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 the present invention, and should not be construed as limiting the present invention. The step numbers in the following embodiments are set only for ease of explanation, and there is no limitation on the order between the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

[0057] In the description of this invention, it should be understood that the orientation descriptions, such as up, down, front, back, left, right, etc., are based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.

[0058] In the description of this invention, "several" means one or more, "more than" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.

[0059] In the description of this invention, unless otherwise explicitly defined, terms such as "set up," "install," and "connect" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this invention in conjunction with the specific content of the technical solution.

[0060] To address the problems of existing technologies, this invention provides a label-based named entity recognition method. This method uses a fixed prompt template and clustered entity instances to generate label prompt information, avoiding subjective differences caused by manual design. Furthermore, the prompt information can continuously evolve during training, searching for prompts that better fit the model. Moreover, this invention encodes the label prompts separately from the source text, and then integrates the label information into the text span to be classified through cross-attention, significantly reducing the model's training and inference time compared to previous MRC methods. When classifying spans, this invention also considers the correlation between different labels for the same span, using a multi-label attention module to learn this information, thereby further improving the model's classification ability.

[0061] like Figure 1 and Figure 4As shown in the figure, the named entity recognition method based on tag hints provided in this embodiment specifically includes the following steps:

[0062] S1. Generate label hints for each type of entity using a label hint generator. Each label hint is a set of multiple codes.

[0063] Generate label hints {G1, G2, ..., G} for m entities using a label hint generator. m Each label suggestion is a collection of multiple encodings. The label suggestion generator generates suggestions using entity category names and the entity center instances of the cluster, with a fixed format of [entity name: instance 1... instance c]. These encoded representations generated by clustering are added as new words to the BERT dictionary, allowing them to fine-tune these examples during training and search for expressions that better fit the model.

[0064] S2. Segment the words in the input text X to obtain the segmented sequence T corresponding to the input text X. Input the segmented sequence T into the pre-trained model BERT to obtain the hidden layer representation H corresponding to the segmented sequence T.

[0065] The words in the input text X are segmented to obtain the corresponding word segmentation sequence T. Before being fed into the encoder, the word segmentation sequence T is first obtained from the original text to obtain the position sequence and segmentation sequence corresponding to T. Then, all three are fed into the pre-trained model BERT to obtain the hidden layer representation H = {h1, h2, ..., h...} corresponding to the word segmentation sequence T. n}

[0066] S3. Filter the spans that may make up the entity based on the hidden layer representation, and obtain the representation of each span through conditional layer normalization.

[0067] The calculation formula for step S3 is as follows:

[0068]

[0069]

[0070]

[0071] γ ij =W α h i +b α (4)

[0072] λ ij =W β h i +b β (5)

[0073] In the formula, hi h represents the starting vector of the span. j The endpoint vector represents the span, d represents the dimension of each word segmentation vector, and h represents the length of the segmentation vector. jk h j The k-th element, μ and σ are respectively h j The mean and standard deviation of W α W β b α and b β All are trainable parameters; h j First, normalization is performed by fixing the mean and variance, and then γ is used respectively. ij and λ ij Scaling and shifting are performed. Using the CLN mechanism, the joint representation s corresponding to the span (i,j) can be obtained. ij .

[0074] S4. By using cross-attention, the representation of span (i,j) is s ij This is combined with all tag hints to obtain the encoded representation of each span relative to each tag. Encoding representation Compared to the original span encoding representation s ij By concatenating the data, we obtain the final representation of the span (i,j) relative to all labels.

[0075] By using cross-attention, the representation s of span (i,j) is... ij The merging process is performed separately from all tag prompts, and the merging formula is as follows:

[0076] Q = G k W q (6)

[0077] [K,V]=s ij [W k W v (7)

[0078]

[0079] in, This indicates that the span (i,j) is within the label hint G. k Conditional encoding representation under conditions, There are three trainable parameters. These are also trainable parameters.

[0080] In obtaining the encoded representation of each span relative to each tag Then it is combined with the original span encoding representation s ij splicing Obtain the final representation of the span (i,j) relative to all labels.

[0081] S5. The representation of span (i,j) relative to each label is passed through a self-attention module that learns multi-entity label relationships, and then classified to obtain the probability score of span (i,j) relative to each type of label.

[0082] The span (i,j) is represented relative to each label through a self-attention module that learns multi-entity label relationships, and then they are classified separately:

[0083]

[0084]

[0085]

[0086] MLP was used to calculate the attention score between Q′ and K′. There are three trainable parameters, where Norm represents layer normalization. This represents the probability that the span (i,j) belongs to entity class k. During the training phase, based on the obtained... Calculate the loss, perform gradient backpropagation, and train the model. During the inference phase, step S6 is executed directly.

[0087] Regarding span classification, to alleviate the class imbalance problem, Circle loss is used for calculation. The formula for Circle loss is:

[0088]

[0089] Among them, P a Q is the span set of all entities of type α in this sample. a It is the span set of all non-entity or type non-α entities in the sample. γ and m are usually hyperparameters that need to be considered in metric learning, so they can be ignored here. Since our classification task is a multi-label classification task with m selecting k, and the number of k is not fixed, we need a threshold s0 to distinguish between the target class and the non-target class. Equation (12) can be simplified to:

[0090]

[0091] S6, Probability Score Greater than the classification threshold t c The word segmentation table is used to convert all words within the specified span to obtain the final target entity.

[0092] For all probability fractions Greater than the classification threshold t c The span is the predicted span of the k-th class entity. Finally, the word segmentation sequence corresponding to the span is transformed according to the word segmentation transformation table to obtain the final target entity.

[0093] To verify that the label-based named entity recognition method proposed in this application can more effectively utilize label knowledge in span recognition and improve the performance of entity span recognition, a verification experiment is conducted below:

[0094] In the verification experiment, the label-based named entity recognition method proposed in this embodiment of the invention was applied to common planar and nested entities. Example images are shown below. Figure 2 As shown.

[0095] The validated NER datasets include two planar NER datasets (containing only planar entities) and two nested NER datasets (containing both nested and planar entities). Table 1 shows the details for each dataset:

[0096] Table 1. Statistical information of the dataset used in the experiment

[0097]

[0098] To illustrate the advantages of the method in this application compared to existing technologies, this experiment compares the span recognition method based on Biaffine with the span recognition method based on MRC. The final experimental results are shown in Table 2:

[0099] Table 2. Experimental results on the NER dataset

[0100]

[0101] In Table 2, P, R, and F1 represent precision, recall, and F1 score, respectively, and Label Prompt represents the label-based named entity recognition proposed in this invention.

[0102] As shown in Table 2, the MRC method, which incorporates label knowledge, outperforms the Biaffine method across all four datasets. Our label-based span recognition method achieves better results than the MRC method on OntoNotes 5.0, CoNLL2003, and ACE2004, and achieves very similar results to the MRC method on ACE2005. In addition to comparing the recognition performance of different methods, this experiment also compared the training and inference speeds of the MRC method and the Label Prompt method. The results are as follows: Figure 3 As shown.

[0103] Table 3. Efficiency Comparison of MRC Method and Label Prompt Method

[0104]

[0105] Table 3 shows that the batch size for training MRC and Label Prompt is 16, and the batch size for inference is 32. The results in Table 3 show that the Label Prompt method proposed in this invention has lower training and inference time costs than the MRC method, saving an average of 79% of training time and 82% of inference time.

[0106] Experimental results show that the label-based named entity recognition proposed in this invention is not only comparable to or even better than the other two commonly used methods in terms of entity recognition, but also requires much less training and inference time than the previous MRC method that incorporates label knowledge, thus exhibiting better overall performance.

[0107] In summary, compared with the prior art, the present invention has at least the following advantages and beneficial effects:

[0108] (1) The present invention designs a method for generating label prompt information using a fixed prompt template and clustered entity instances, which avoids the time and effort consumed by manually designing label knowledge, eliminates the subjective uncertainty of label knowledge, and allows the prompt information to change continuously with training, and search for prompt expressions that are more suitable for the model.

[0109] (2) This invention encodes the label hints separately from the source text, and then integrates the label hint information into the candidate text span to be classified through cross-attention. On the one hand, it alleviates the problem that the attention to the label knowledge is scattered by the original text caused by the fusion of label knowledge and the whole text. On the other hand, it significantly reduces the training and inference time of the model compared with the previous MRC method that integrates label knowledge.

[0110] (3) The present invention also takes into account the association between the same span and different labels, and uses a multi-label attention module to learn the competitive and promotional relationship between the same span and different labels, thereby further improving the classification ability of the model.

[0111] (4) This invention takes into account the imbalance between positive and negative samples in the span classification process, applies Circle loss, and integrates the task characteristics in this invention to make adaptive simplifications.

[0112] This embodiment also provides a named entity recognition device based on tag prompts, including:

[0113] At least one processor;

[0114] At least one memory for storing at least one program;

[0115] When the at least one program is executed by the at least one processor, the at least one processor implements Figure 4 The method shown.

[0116] This embodiment of the named entity recognition device based on tag prompts can execute a named entity recognition method based on tag prompts provided in the method embodiment of the present invention. It can execute any combination of implementation steps of the method embodiment and has the corresponding functions and beneficial effects of the method.

[0117] This application also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform... Figure 4 The method shown.

[0118] This embodiment also provides a storage medium storing instructions or programs that can execute the tag-based named entity recognition method provided in the method embodiment of the present invention. When the instructions or programs are run, any combination of implementation steps of the method embodiment can be executed, and the method has the corresponding functions and beneficial effects.

[0119] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is altered and sub-operations described as part of a larger operation are executed independently.

[0120] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the described functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.

[0121] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0122] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0123] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0124] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0125] In the foregoing description of this specification, references to terms such as "one embodiment," "another embodiment," or "some embodiments" indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of the present invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0126] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

[0127] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.

Claims

1. A named entity recognition method based on tag hints, characterized in that, Includes the following steps: S1. Generate label hints for each type of entity using a label hint generator. Each label hint is a set of multiple codes. S2, Input text The words in the input text are segmented to obtain the input text. Corresponding word segmentation sequence , segment the sequence Input into the pre-trained BERT model to obtain the word segmentation sequence The corresponding hidden layer representation ; S3. Filter the spans that may constitute entities, and obtain the representation of each span through conditional layer normalization; S4. By using cross-attention, the representation of span (i,j) is... This is combined with all tag hints to obtain the encoded representation of each span relative to each tag. , to encode Compared to the original span encoding representation By concatenating the data, we obtain the final representation of the span (i,j) relative to all labels. ; S5. Represent the span (i,j) relative to the label. By using a self-attention module to learn multi-entity label relationships, and then performing classification, the probability score of span (i,j) relative to each type of label is obtained. ; S6, Probability Score Greater than the classification threshold The word segmentation table is used to convert all words within the specified span to obtain the final target entity.

2. The named entity recognition method based on tag hints according to claim 1, characterized in that, Step S1 specifically includes: The tag hint generator generates tag hints using entity category names and the entity center instances of the clusters; the format of the tag hints is [Entity Name: Instance 1...Instance 2]. ].

3. The named entity recognition method based on tag hints according to claim 1, characterized in that, Step S2 specifically includes: Enter text The words in the input text are segmented to obtain the input text. Corresponding word segmentation sequence ; Based on the input text Get word segmentation sequence The corresponding position sequence and segment sequence; Word segmentation sequence The position sequence and segmented sequence are input together into the pre-trained model BERT to obtain the word segmentation sequence. The corresponding hidden layer representation .

4. The named entity recognition method based on tag hints according to claim 1, characterized in that, The calculation formula for step S3 is as follows: in, The starting vector representing the span. The endpoint vector representing the span. This represents the dimension corresponding to each word segmentation vector. Represents the endpoint vector The One element, and These are the endpoint vectors. The mean and standard deviation; , and All of these are trainable parameters; Endpoint vector Normalization is performed by fixing the mean and variance, and then parameters are used respectively. and Scaling and shifting are performed; the representation corresponding to the span (i,j) is obtained through a conditional layer normalization mechanism. .

5. The named entity recognition method based on tag hints according to claim 4, characterized in that, In step S4, the expression for fusing label cue information and text span information through cross-attention is as follows: in, Indicates the span (i,j) in the label hint Conditional encoding representation under conditions, and These are all trainable parameters. It is the key vector for calculating attention. It is the value vector used to calculate attention. It is a vector The corresponding dimension.

6. The named entity recognition method based on tag hints according to claim 1, characterized in that, The calculation formula for step S5 is as follows: in, It is a multi-label attention module. , Indicates that span (i,j) belongs to The probability of a class entity. It is a three-layer feedforward neural network with the activation function GELU.

7. The named entity recognition method based on tag hints according to claim 6, characterized in that, The calculation formula for the multi-label attention module is as follows: in, Used for calculation Attention scores between There are three trainable parameters. Representation layer normalization.

8. The named entity recognition method based on tag hints according to claim 6, characterized in that, During the training phase, based on the obtained probability scores Calculate the loss and perform gradient backpropagation; For span classification, in order to alleviate the problem of class imbalance, Circle Loss is used as the final loss function.

9. A named entity recognition device based on tag prompts, characterized in that, include: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method of any one of claims 1-8.

10. A computer-readable storage medium storing a processor-executable program, characterized in that, The processor-executable program, when executed by the processor, is used to perform the method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Chinese medical text entity relationship joint extraction method based on conversation attention mechanism

    CN114756679A

  • Joint extraction method for label fusion

    CN115114934A