Nested medical named entity identification method and system

By using a nested medical named entity recognition model, utilizing a bidirectional long short-term memory network and a multi-head self-attention mechanism, combined with imbalanced adaptive span decoding and asymmetric loss functions, the accuracy problem of nested entity recognition is solved, and efficient nested entity recognition is achieved.

CN121859904APending Publication Date: 2026-04-14ANHUI MEDICAL UNIV
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing medical named entity recognition methods have limitations when dealing with nested entities, making it difficult to accurately identify nested entities in medical texts. Furthermore, traditional models fail to effectively handle the imbalance between entity span and non-entity span during training, leading to a decline in recognition performance.

Method used

A pre-built nested medical named entity recognition model is adopted, which utilizes a bidirectional long short-term memory network and a multi-head self-attention mechanism to extract contextual dependency information of word embedding sequences. The model parameters are optimized by imbalanced adaptive span decoding and imbalanced perception asymmetric loss function to improve the accuracy of nested entity recognition.

Benefits of technology

It improves the accuracy and interpretability of medical named entity recognition, can better identify the boundaries of nested entities, overcomes the limitations of traditional methods in handling nested entities, and enhances the model's recognition ability in complex medical texts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121859904A_ABST
    Figure CN121859904A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of medical named entity recognition, and discloses a nested medical named entity recognition method and system, and the method comprises the steps: carrying out the word embedding coding of each word in a to-be-processed medical text, and obtaining a word embedding sequence; extracting final feature representation of the word embedding sequence; performing unbalanced adaptive span decoding on the final feature representation to obtain starting and ending position representations of a candidate entity span; performing entity classification on the candidate entity spans according to the starting and ending position representations to obtain entity types, and constructing an asymmetric loss function according to the entity types; performing model parameter optimization on the nested medical named entity recognition model according to the loss function to obtain a target entity recognition model; and recognizing the medical named entity in the medical text according to a target entity recognition model. The method can ensure that the model can accurately classify each entity and recognize the boundary of the entity, and effectively improves the recognition precision of the medical nested entity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical named entity recognition technology, specifically a nested medical named entity recognition method and system. Background Technology

[0002] With the widespread adoption of electronic medical records and unstructured clinical literature, Medical Named Entity Recognition (MNER) has been widely applied in the field of medical information processing. MNER's task is to extract and classify medical entities, such as diseases, symptoms, and drugs, from medical text. This task is crucial for building medical knowledge graphs, question-answering systems, and automated analysis of clinical records. However, compared to general domain Named Entity Recognition (NER) tasks, Medical Named Entity Recognition faces more challenges, especially when dealing with nested entities. Nested entities refer to situations where one entity is nested within another, a structure frequently found in medical text. For example, the disease entity "chronic kidney disease" contains entities related to the "kidney" part. Such nested structures increase the difficulty of entity boundary detection; therefore, effectively identifying nested entities is key to improving MNER performance.

[0003] Traditional MNER methods are mainly based on sequence labeling or statistical models, such as Conditional Random Fields (CRFs) and Hidden Markov Models (HMMs). These methods rely on manually designed features and, although they can handle some simple named entities, they often struggle to handle long-range dependencies and domain-specific syntax in medical texts, especially the recognition of nested entities, due to the complexity and specialization of medical language.

[0004] In recent years, deep learning-based models have gradually become the mainstream for medical named entity recognition. Deep learning models can effectively improve semantic understanding capabilities by automatically learning features, especially through large-scale pre-trained models (such as BERT and RoBERTa). However, existing span-based models still face significant challenges when processing medical text. These models typically perform entity recognition by enumerating all possible spans in the text and assigning a category label to each span. While this method performs well when handling non-nested entities, it has significant limitations when dealing with nested entities.

[0005] Existing span-based models typically rely on pre-trained language models from general domains. This makes them lack sufficient domain knowledge when processing medical texts, making it difficult to capture complex semantic dependencies, especially when dealing with nested entities. Furthermore, these models fail to effectively handle the imbalance between entity spans and non-entity spans during training, resulting in excessive optimization of non-entity spans during model training, thus degrading entity recognition performance.

[0006] To address these issues, existing research CN117669574A discloses an entity recognition method and system in the field of artificial intelligence based on multi-semantic feature fusion. This method forms an entity recognition model by cascading an encoder, a bidirectional long short-term memory network layer, an attention fusion layer, and a conditional random field layer. However, the hierarchical structure leads to high computational complexity, making it difficult to scale to large-scale medical datasets. CN113033207A provides a biomedical nested type entity recognition method based on a layer-by-layer perception mechanism. This method uses hidden feature encoding and decoding in recurrent neural networks and nested type entity recognition based on a multi-task layer-by-layer perception mechanism. Although it introduces position encoding to improve entity boundary detection capabilities, it still has shortcomings in handling the semantic complexity and span imbalance problems in medical texts.

[0007] In summary, how to accurately and efficiently perform medical named entity recognition, improve the performance when recognizing nested entities, and overcome the limitations of traditional methods when dealing with medical texts has become an urgent problem to be solved. Summary of the Invention

[0008] The technical problem to be solved by this invention is how to improve the performance of nested entity recognition, overcome the limitations of traditional methods when dealing with medical text, and thus perform medical named entity recognition accurately and efficiently.

[0009] The present invention solves the above-mentioned technical problems through the following technical means: The medical text to be processed is obtained, and each word in the medical text is embedded and encoded using a pre-built nested medical named entity recognition model to obtain a word embedding sequence. By utilizing the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model, short-range and long-range contextual dependency information of the word embedding sequence is extracted to obtain the final feature representation of each word; The final feature representation is subjected to unbalanced adaptive span decoding to obtain the start and end position representations of the candidate entity span corresponding to each word; Based on the start and end positions, the candidate entity span is classified to obtain the entity type, and an imbalance-aware asymmetric loss function is constructed based on the entity type. The nested medical named entity recognition model is optimized by performing model parameter optimization based on the imbalance perception asymmetric loss function to obtain the target entity recognition model. The medical named entities in the medical text are identified based on the target entity recognition model.

[0010] Optionally, the step of using a pre-built nested medical named entity recognition model to perform word embedding encoding on each word in the medical text to obtain a word embedding sequence includes: The medical text is segmented into words to obtain a segmented word sequence; The text segmentation sequence is embedded and encoded to obtain a word embedding sequence.

[0011] Optionally, the step of utilizing the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model to extract short-range and long-range contextual dependency information of the word embedding sequence to obtain the final feature representation of each word includes: The forward and backward hidden states of each word embedding in the word embedding sequence are calculated using a bidirectional long short-term memory network; The multi-head self-attention features corresponding to the forward and backward hidden states are calculated using a multi-head self-attention mechanism; The forward and backward hidden states are residually connected with the multi-head self-attention features to obtain the final feature representation of each word.

[0012] Optionally, the step of performing unbalanced adaptive span decoding on the final feature representation to obtain the start and end position representations of the candidate entity span corresponding to each word includes: The unbalanced adaptive span decoding of the final feature representation is performed using the following formula to obtain the start and end positions of the candidate entity span corresponding to each word:

[0013] in, and They represent the first Candidate entity span corresponding to each word The start and end positions indicate, Indicates entity type, and These are feedforward networks used to calculate the start and end positions, respectively. Indicates the first The final feature representation of each word.

[0014] Optionally, the step of classifying the candidate entity span based on the start and end positions to obtain the entity type includes: The start and end position representations are embedded using a preset rotation matrix; Calculate the entity candidate scores represented by the start and end positions after rotational position embedding; The entity type is determined based on the entity candidate score.

[0015] Optionally, the rotation matrix is ​​represented as:

[0016]

[0017] in, Represents the rotation matrix. Indicates the start or end position. The final feature representation of a word corresponds to its vector dimension.

[0018] Optionally, constructing an imbalance-aware asymmetric loss function based on the entity type includes: The imbalance-sensing asymmetric loss function is expressed as follows:

[0019]

[0020]

[0021] in, The asymmetric loss function representing imbalance perception. Indicates entity type, Indicates the total number of entity types. Indicates entity type is The span of candidate entities, Indicates entity type is The number of candidate entity spans, Candidate entity spans are represented as non-entity spans. This indicates the number of candidate entity spans that are not entity spans. , These represent activation functions, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the span of candidate entities The corresponding entity candidate score.

[0022] Optionally, optimizing the model parameters of the nested medical named entity recognition model based on the imbalance-perception asymmetric loss function to obtain the target entity recognition model includes: The imbalance-asymmetric loss function is optimized based on the entity type to obtain an optimized loss function; The nested medical named entity recognition model is updated using the optimized loss function to obtain an updated parameter model; The loss value of the optimized loss function corresponding to the medical text is calculated based on the updated parameter model. The updated parameter model is iteratively updated based on the loss value until the loss value is less than a preset loss threshold, thereby obtaining the target entity recognition model.

[0023] Optionally, the optimization loss function is expressed as:

[0024]

[0025]

[0026]

[0027] in, This represents the optimization loss function. Indicates entity type, Indicates the total number of entity types. Indicates entity type is The span of candidate entities, Indicates entity type is The number of candidate entity spans, Candidate entity spans are represented as non-entity spans. This indicates the number of candidate entity spans that are not entity spans. , These represent activation functions, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the total number of words. This represents the preset entity scaling factor. This represents the preset non-physical scaling factor.

[0028] To address the aforementioned problems, this invention also proposes a nested medical named entity recognition system, the system comprising: The word embedding encoding module is used to acquire the medical text to be processed, and to perform word embedding encoding on each word in the medical text using a pre-built nested medical named entity recognition model to obtain a word embedding sequence; The final feature representation module is used to extract short-range and long-range contextual dependency information of the word embedding sequence by utilizing the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model, so as to obtain the final feature representation of each word. The position representation calculation module is used to perform unbalanced adaptive span decoding on the final feature representation to obtain the start and end position representations of the candidate entity span corresponding to each word; The loss function construction module is used to classify the candidate entity span according to the start and end positions to obtain the entity type, and construct an imbalance-aware asymmetric loss function according to the entity type. The model parameter optimization module is used to optimize the model parameters of the nested medical named entity recognition model according to the imbalance perception asymmetric loss function to obtain the target entity recognition model. The medical named entity recognition module is used to identify medical named entities in the medical text based on the target entity recognition model.

[0029] The advantages of this invention are: This invention encodes each word in a medical text using word embeddings to obtain a word embedding sequence. It then extracts short-range and long-range contextual dependency information from the word embedding sequence to obtain the final feature representation of each word, providing rich semantic information for subsequent span recognition and classification. Imbalanced adaptive span decoding is applied to the final feature representation to obtain the start and end position representations of candidate entity spans, improving the accuracy and interpretability of nested medical named entity recognition in medical texts. Based on the start and end position representations, candidate entity spans are classified to obtain entity types. An imbalance-aware asymmetric loss function is constructed based on the entity types. This imbalance-aware asymmetric loss function allows for dynamic adjustment of positive and negative sample contributions during the optimization process, resulting in an optimized loss function. This optimized loss function ensures that the model can better balance the influence of entity spans and non-entity spans during the learning process, ensuring that the model can accurately classify each entity and identify its boundaries, thus precisely recognizing medical named entities in medical texts. Attached Figure Description

[0030] Figure 1 This is a flowchart illustrating a nested medical named entity recognition method according to an embodiment of the present invention; Figure 2 This is a model architecture diagram of nested medical named entity recognition in one embodiment of the present invention. Figure 3 This is a functional module diagram of a nested medical named entity recognition system provided in one embodiment of the present invention. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0032] Reference Figure 1 The diagram shown is a flowchart illustrating a nested medical named entity recognition method according to an embodiment of the present invention. In this embodiment, the nested medical named entity recognition method includes: S1. Obtain the medical text to be processed, and use a pre-built nested medical named entity recognition model to perform word embedding encoding on each word in the medical text to obtain a word embedding sequence.

[0033] In this embodiment of the invention, the medical text to be processed is a professional text containing multiple levels of nested medical entities, and there is a "containment and being contained" relationship between these entities (such as "XX part of XX disease" or "XX dosage form of XX drug").

[0034] In detail, the nested medical named entity recognition model includes a heterogeneous dependency fusion encoder for extracting the final feature representation of each word and an imbalanced adaptive span decoder for optimizing the model training process. The heterogeneous dependency fusion encoder can effectively capture long-range semantic dependencies in medical texts, enhancing the ability to recognize nested entities in complex medical texts. The imbalanced adaptive span decoder optimizes the contribution of entity and non-entity spans in the training process by introducing an imbalance-aware adaptive loss function, thereby overcoming the problem of scarce entity spans in traditional methods when processing medical texts.

[0035] Specifically, the step of using a pre-built nested medical named entity recognition model to perform word embedding encoding on each word in the medical text to obtain a word embedding sequence includes: The medical text is segmented into words to obtain a segmented word sequence; The text segmentation sequence is embedded and encoded to obtain a word embedding sequence.

[0036] In this embodiment of the invention, for medical text, a medical dictionary can be used for text segmentation. This does not force word segmentation, but allows for word-level prior knowledge using the dictionary, thus avoiding omissions of medical entities due to word segmentation.

[0037] Specifically, the heterogeneous dependency fusion encoder includes a pre-trained BERT model, which serves as the foundation for the embedding layer. This BERT model generates word vector representations for each word, which are then used as input for subsequent processing. This process assigns preliminary semantic information to each word.

[0038] Specifically, each word in the medical text is encoded using the following formula to obtain a word embedding sequence:

[0039] in, Represents word embedding sequences, This indicates the first in the medical text. words The corresponding word embedding representation, Indicates the total number of words. This indicates the embedding layer.

[0040] S2. Using the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model, extract the short-range and long-range contextual dependency information of the word embedding sequence to obtain the final feature representation of each word.

[0041] In this embodiment of the invention, the heterogeneous dependency fusion encoder in the nested medical named entity recognition model extracts short-range and long-range contextual dependency information through a bidirectional long short-term memory network and a multi-head self-attention mechanism to obtain the final representation of each word, i.e., the final feature representation.

[0042] Specifically, the step of utilizing the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model to extract short-range and long-range contextual dependency information of the word embedding sequence to obtain the final feature representation of each word includes: The forward and backward hidden states of each word embedding in the word embedding sequence are calculated using a bidirectional long short-term memory network; The multi-head self-attention features corresponding to the forward and backward hidden states are calculated using a multi-head self-attention mechanism; The forward and backward hidden states are residually connected with the multi-head self-attention features to obtain the final feature representation of each word.

[0043] In this embodiment of the invention, the word embedding sequence is input into a bidirectional long short-term memory network (BiLSTM), and its forward and backward hidden states are calculated, as expressed by the formula:

[0044] in, Indicates the first The word embeddings of each word represent the corresponding forward hidden states. This represents the forward long short-term memory network in a bidirectional long short-term memory network. No. The word embeddings of each word represent the corresponding forward hidden states. Indicates the first The word embeddings of each word represent the corresponding backward hidden states. This represents the inverse long short-term memory network in a bidirectional long short-term memory network. No. The word embeddings of each word represent the corresponding backward hidden state.

[0045] Furthermore, the output of the BiLSTM is processed using a multi-head self-attention mechanism. This is achieved by calculating a linear transformation of the query, key, and value matrices, expressed as follows:

[0046] in, , , These represent the query, key, and value matrices, respectively. This represents the forward and backward hidden states of the output of a bidirectional long short-term memory network. , , These represent the preset query, key, and value transformation matrices, respectively.

[0047] Then, by calculating the scaled dot product attention, the output of each attention head is obtained:

[0048] in, express Dimensions.

[0049] The multi-head attention mechanism is extended by concatenating and linearly transforming the outputs of all attention heads, as expressed by the formula:

[0050] in, This indicates the characteristics of multi-head self-attention. This indicates a splicing operation. This represents the output of each attention head in a multi-head self-attention mechanism. This indicates the total number of heads receiving attention. This represents the preset weight matrix.

[0051] The BiLSTM output is then combined with the multi-head self-attention output using a residual connection mechanism, as expressed in the formula:

[0052] in, Indicates the first The final feature representation of each word, This indicates a residual join operation. Indicates the forward and backward hidden states. This indicates the multi-head self-attention feature.

[0053] In this embodiment of the invention, the nested medical named entity recognition model can simultaneously capture short-range dependencies and long-range semantic information to generate the final representation of each word. This provides rich semantic information for subsequent span recognition and classification.

[0054] S3. Perform unbalanced adaptive span decoding on the final feature representation to obtain the start and end position representations of the candidate entity span corresponding to each word.

[0055] In this embodiment of the invention, the unbalanced adaptive span decoding involves feeding the final feature representation of each word into two independent feedforward networks. These two networks respectively calculate the start and end positions of the candidate entity. The candidate entity span refers to the range of positions in the text that each word might refer to for a particular entity.

[0056] Specifically, the unbalanced adaptive span decoding of the final feature representation to obtain the start and end position representations of the candidate entity span corresponding to each word includes: The unbalanced adaptive span decoding of the final feature representation is performed using the following formula to obtain the start and end positions of the candidate entity span corresponding to each word:

[0057] in, and They represent the first Candidate entity span corresponding to each word The start and end positions indicate, Indicates entity type, and These are feedforward networks used to calculate the start and end positions, respectively. Indicates the first The final feature representation of each word.

[0058] In this embodiment of the invention, by calculating the start and end positions of the candidate entity span corresponding to each word, a clear modeling target is provided for subsequent entities, which improves the accuracy and interpretability of medical named entity recognition nested in medical text.

[0059] S4. Classify the candidate entity span according to the start and end positions to obtain the entity type, and construct an imbalance-aware asymmetric loss function based on the entity type.

[0060] In this embodiment of the invention, entity classification uses a global pointer network combined with Rotated Position Embedding (RoPE) to classify the span of candidate entities and calculate the probability that they belong to each entity type, thereby determining the entity type.

[0061] Specifically, the step of classifying the candidate entity span based on the start and end positions to obtain the entity type includes: The start and end position representations are embedded using a preset rotation matrix; Calculate the entity candidate scores represented by the start and end positions after rotational position embedding; The entity type is determined based on the entity candidate score.

[0062] In this embodiment of the invention, the rotation matrix is ​​represented as:

[0063]

[0064] in, Represents the rotation matrix. Indicates the start or end position. The final feature representation of a word corresponds to its vector dimension.

[0065] Furthermore, the start and end position representations are rotated and embedded using the following formula:

[0066] in, The start and end positions are indicated after the rotation position is embedded. This indicates transpose.

[0067] In this embodiment of the invention, the start pointer vector and end pointer vector in the pre-constructed global pointer network are multiplied by the start and end position representations after rotation position embedding to obtain the score of the span start position and the score of the span end position. The scores of the span start position, the score of the span end position, and the mutual attention scores (dot product) of the start and end position representations after rotation position embedding are added to obtain the entity candidate score for each candidate entity span.

[0068] Furthermore, the entity candidate score is converted into a probability value between 0 and 1 using an activation function, representing that the candidate entity span is an "effective target span," i.e., the entity candidate probability of the entity span. When the entity candidate probability is less than a preset threshold, it indicates that the entity type of the candidate entity span is a non-entity span; when the entity candidate probability is greater than or equal to the preset threshold, it indicates that the candidate entity span is an entity span. Specifically, for each entity span, when calculating the entity candidate score, a dedicated start pointer vector and end pointer vector can be set for each entity category, thereby obtaining the category probability belonging to each entity category. The entity category corresponding to the maximum category probability is selected as the corresponding entity type.

[0069] In this embodiment of the invention, in order to solve the imbalance problem between entity span and non-entity span in candidate entity span, an imbalance-aware asymmetric loss function (A2SL) is adopted to dynamically adjust the contributions of entity span and non-entity span through the imbalance-aware asymmetric loss function.

[0070] In this study, candidate entity spans that belong to entity spans in the entity type are used as positive samples, while the remaining non-entity spans are used as negative samples.

[0071] Specifically, the asymmetric loss function for imbalance sensing is expressed as:

[0072]

[0073]

[0074] in, The asymmetric loss function representing imbalance perception. Indicates entity type, Indicates the total number of entity types. Indicates entity type is The span of candidate entities, Indicates entity type is The number of candidate entity spans, Candidate entity spans are represented as non-entity spans. This indicates the number of candidate entity spans that are not entity spans. , These represent activation functions, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the span of candidate entities The corresponding entity candidate score.

[0075] In this embodiment of the invention, the imbalance between entity span and non-entity span can be addressed by using an imbalance-aware asymmetric loss function during the training of a nested medical named entity recognition model, thereby improving the model's ability to recognize entity span. S5. The model parameters of the nested medical named entity recognition model are optimized according to the imbalance-aware asymmetric loss function to obtain the target entity recognition model.

[0076] In this embodiment of the invention, model parameter optimization is achieved by dynamically adjusting the contributions of positive and negative samples during the optimization process using an imbalance-aware asymmetric loss function, resulting in an optimized loss function. This optimized loss function then ensures that the model can better balance the influence of entity span and non-entity span during the learning process, thereby avoiding excessive influence of non-entity span on the model. Through this process, the model parameters are gradually optimized, resulting in the final target entity model.

[0077] Specifically, the step of optimizing the model parameters of the nested medical named entity recognition model based on the asymmetric loss function of the imbalance perception to obtain the target entity recognition model includes: The imbalance-asymmetric loss function is optimized based on the entity type to obtain an optimized loss function; The nested medical named entity recognition model is updated using the optimized loss function to obtain an updated parameter model; The loss value of the optimized loss function corresponding to the medical text is calculated based on the updated parameter model. The updated parameter model is iteratively updated based on the loss value until the loss value is less than a preset loss threshold, thereby obtaining the target entity recognition model.

[0078] Specifically, optimizing the imbalance-asymmetric loss function involves adjusting the weights of entity spans and non-entity spans based on the proportion of entity spans and non-entity spans in the entity type, so that the model can better balance the influence of entity spans and non-entity spans during the learning process.

[0079] Specifically, the optimization loss function is expressed as:

[0080]

[0081]

[0082]

[0083] in, This represents the optimization loss function. Indicates entity type, Indicates the total number of entity types. Indicates entity type is The span of candidate entities, Indicates entity type is The number of candidate entity spans, Candidate entity spans are represented as non-entity spans. This indicates the number of candidate entity spans that are not entity spans. , These represent activation functions, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the total number of words. This represents the preset entity scaling factor. This represents the preset non-physical scaling factor.

[0084] In this embodiment of the invention, the learnable parameters in the nested medical named entity recognition model are updated based on the function value of the optimized loss function to obtain an updated parameter model. The updated parameter model is then used to return to steps S1-S4 above to obtain the updated entity classification of the medical text. Furthermore, the updated entity classification is adjusted according to the ratio of entity spans to non-entity spans in the updated entity classification. as well as Next, the loss value of the updated parameter model is calculated to update the parameters. This process is repeated to iterate and update the learnable parameters in the updated parameter model until the loss value of the loss function is less than the preset loss threshold or the iteration meets the preset number of times, thus obtaining the target entity recognition model.

[0085] In detail, by adjusting the proportion of entity spans and non-entity spans in the entity type, the weights in the imbalance-aware asymmetric loss function can be adaptively adjusted to avoid focusing too much on non-entity spans during the optimization process, thereby improving the model's ability to identify entity spans.

[0086] S6. Identify medical named entities in the medical text based on the target entity recognition model.

[0087] In this embodiment of the invention, after adjusting the weights of entity span and non-entity span as described above, the model updates its parameters by optimizing the loss function. The optimization process, using an adaptively adjusted loss function, ensures that the model can better balance the influence of entity span and non-entity span during the learning process, thereby avoiding excessive influence of non-entity span on the model. Through this process, the model's parameters are gradually optimized, ultimately achieving efficient recognition and classification of nested medical named entities. For example, the entity type obtained from the entity classification during the last parameter optimization can be used as the recognition result of nested medical named entities in medical text; alternatively, the trained target entity recognition model can be used to recognize medical named entities in medical text.

[0088] In this embodiment of the invention, the process of optimizing model parameters can enhance the model's performance in medical texts, especially in complex semantic relationships and nested entity structures, ensuring that the model can accurately classify each entity and identify its boundaries, thus completing the task of medical named entity recognition.

[0089] Specifically, the specific steps of this invention can be found in [reference needed]. Figure 2 As shown, where, Figure 2 It includes a model structure that nests medical named entity recognition models and an asymmetric loss function for imbalance perception.

[0090] like Figure 3 The diagram shown is a functional block diagram of a nested medical named entity recognition system provided in an embodiment of the present invention.

[0091] The nested medical named entity recognition system 100 of this invention can be installed in a processing device. Depending on the functions implemented, the nested medical named entity recognition system 100 may include a word embedding encoding module 101, a final feature representation module 102, a position representation calculation module 103, a loss function construction module 104, a model parameter optimization module 105, and a medical named entity recognition module 106. The module described in this invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, stored in the memory of the electronic device.

[0092] In this embodiment, the functions of each module / unit are as follows: The word embedding encoding module 101 is used to acquire the medical text to be processed, and to perform word embedding encoding on each word in the medical text using a pre-built nested medical named entity recognition model to obtain a word embedding sequence. The final feature representation module 102 is used to extract short-range and long-range contextual dependency information of the word embedding sequence by utilizing the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model, so as to obtain the final feature representation of each word. The position representation calculation module 103 is used to perform unbalanced adaptive span decoding on the final feature representation to obtain the start and end position representations of the candidate entity span corresponding to each word; The loss function construction module 104 is used to classify the candidate entity span according to the start and end positions to obtain the entity type, and construct an imbalance-aware asymmetric loss function according to the entity type. The model parameter optimization module 105 is used to optimize the model parameters of the nested medical named entity recognition model according to the imbalance perception asymmetric loss function to obtain the target entity recognition model. The medical named entity recognition module 106 is used to recognize medical named entities in the medical text according to the target entity recognition model.

[0093] As a further preferred technical solution, the word embedding encoding module 101 is specifically used for: The medical text is segmented into words to obtain a segmented word sequence; The text segmentation sequence is embedded and encoded to obtain a word embedding sequence.

[0094] As a further preferred technical solution, the final feature representation module 102 is specifically used for: The forward and backward hidden states of each word embedding in the word embedding sequence are calculated using a bidirectional long short-term memory network; The multi-head self-attention features corresponding to the forward and backward hidden states are calculated using a multi-head self-attention mechanism; The forward and backward hidden states are residually connected with the multi-head self-attention features to obtain the final feature representation of each word.

[0095] As a further preferred technical solution, the position representation calculation module 103 is specifically used for: The unbalanced adaptive span decoding of the final feature representation is performed using the following formula to obtain the start and end positions of the candidate entity span corresponding to each word:

[0096] in, and They represent the first Candidate entity span corresponding to each word The start and end positions indicate, Indicates entity type, and These are feedforward networks used to calculate the start and end positions, respectively. Indicates the first The final feature representation of each word.

[0097] As a further preferred technical solution, the loss function construction module 104 is specifically used for: The start and end position representations are embedded using a preset rotation matrix; Calculate the entity candidate scores represented by the start and end positions after rotational position embedding; The entity type is determined based on the entity candidate score.

[0098] As a further preferred technical solution, the loss function construction module 104 is specifically used for:

[0099]

[0100] in, Represents the rotation matrix. Indicates the start or end position. The final feature representation of a word corresponds to its vector dimension.

[0101] As a further preferred technical solution, the loss function construction module 104 is specifically used for: The imbalance-sensing asymmetric loss function is expressed as follows:

[0102]

[0103]

[0104] in, The asymmetric loss function representing imbalance perception. Indicates entity type, Indicates the total number of entity types. Indicates entity type is The span of candidate entities, Indicates entity type is The number of candidate entity spans, Candidate entity spans are represented as non-entity spans. This indicates the number of candidate entity spans that are not entity spans. , These represent activation functions, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the span of candidate entities The corresponding entity candidate score.

[0105] As a further preferred technical solution, the model parameter optimization module 105 is specifically used for: The imbalance-asymmetric loss function is optimized based on the entity type to obtain an optimized loss function; The nested medical named entity recognition model is updated using the optimized loss function to obtain an updated parameter model; The loss value of the optimized loss function corresponding to the medical text is calculated based on the updated parameter model. The updated parameter model is iteratively updated based on the loss value until the loss value is less than a preset loss threshold, thereby obtaining the target entity recognition model.

[0106] As a further preferred technical solution, the model parameter optimization module 105 is specifically used for:

[0107]

[0108]

[0109]

[0110] in, This represents the optimization loss function. Indicates entity type, Indicates the total number of entity types. Indicates entity type is The span of candidate entities, Indicates entity type is The number of candidate entity spans, Candidate entity spans are represented as non-entity spans. This indicates the number of candidate entity spans that are not entity spans. , These represent activation functions, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the total number of words. This represents the preset entity scaling factor. This represents the preset non-physical scaling factor.

[0111] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the 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.

[0112] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0113] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for nested medical named entity recognition, characterized in that, include: The medical text to be processed is obtained, and each word in the medical text is embedded and encoded using a pre-built nested medical named entity recognition model to obtain a word embedding sequence. By utilizing the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model, short-range and long-range contextual dependency information of the word embedding sequence is extracted to obtain the final feature representation of each word; The final feature representation is subjected to unbalanced adaptive span decoding to obtain the start and end position representations of the candidate entity span corresponding to each word; Based on the start and end positions, the candidate entity span is classified to obtain the entity type, and an imbalance-aware asymmetric loss function is constructed based on the entity type. The nested medical named entity recognition model is optimized by performing model parameter optimization based on the imbalance perception asymmetric loss function to obtain the target entity recognition model. The medical named entities in the medical text are identified based on the target entity recognition model.

2. The nested medical named entity recognition method as described in claim 1, characterized in that, The step involves using a pre-built nested medical named entity recognition model to perform word embedding encoding on each word in the medical text, resulting in a word embedding sequence, including: The medical text is segmented into words to obtain a segmented word sequence; The text segmentation sequence is embedded and encoded to obtain a word embedding sequence.

3. The nested medical named entity recognition method as described in claim 1, characterized in that, The method utilizes the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model to extract short-range and long-range contextual dependency information of the word embedding sequence, obtaining the final feature representation of each word, including: The forward and backward hidden states of each word embedding in the word embedding sequence are calculated using a bidirectional long short-term memory network; The multi-head self-attention features corresponding to the forward and backward hidden states are calculated using a multi-head self-attention mechanism; The forward and backward hidden states are residually connected with the multi-head self-attention features to obtain the final feature representation of each word.

4. The nested medical named entity recognition method as described in claim 1, characterized in that, The method describes performing unbalanced adaptive span decoding on the final feature representation to obtain the start and end position representations of the candidate entity span for each word, including: The unbalanced adaptive span decoding of the final feature representation is performed using the following formula to obtain the start and end positions of the candidate entity span corresponding to each word: in, and They represent the first Candidate entity span corresponding to each word The start and end positions indicate, Indicates entity type, and These are feedforward networks used to calculate the start and end positions, respectively. Indicates the first The final feature representation of each word.

5. The nested medical named entity recognition method as described in claim 1, characterized in that, The step of classifying the candidate entity span based on the start and end positions to obtain the entity type includes: The start and end position representations are embedded using a preset rotation matrix; Calculate the entity candidate scores represented by the start and end positions after rotational position embedding; The entity type is determined based on the entity candidate score.

6. The nested medical named entity recognition method as described in claim 5, characterized in that, The rotation matrix is ​​represented as: in, Represents the rotation matrix. Indicates the start or end position. The final feature representation of a word corresponds to its vector dimension.

7. The nested medical named entity recognition method as described in claim 1, characterized in that, The construction of the imbalance-aware asymmetric loss function based on the entity type includes: The imbalance-sensing asymmetric loss function is expressed as follows: in, The asymmetric loss function representing imbalance perception. Indicates entity type, Indicates the total number of entity types. Indicates entity type is The span of candidate entities, Indicates entity type is The number of candidate entity spans, Candidate entity spans are represented as non-entity spans. This indicates the number of candidate entity spans that are not entity spans. , These represent activation functions, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the span of candidate entities The corresponding entity candidate score.

8. The nested medical named entity recognition method as described in claim 1, characterized in that, The step of optimizing the model parameters of the nested medical named entity recognition model based on the imbalance-perception asymmetric loss function to obtain the target entity recognition model includes: The imbalance-asymmetric loss function is optimized based on the entity type to obtain an optimized loss function; The nested medical named entity recognition model is updated using the optimized loss function to obtain an updated parameter model; The loss value of the optimized loss function corresponding to the medical text is calculated based on the updated parameter model. The updated parameter model is iteratively updated based on the loss value until the loss value is less than a preset loss threshold, thereby obtaining the target entity recognition model.

9. The nested medical named entity recognition method as described in claim 8, characterized in that, The optimization loss function is expressed as: in, This represents the optimization loss function. Indicates entity type, Indicates the total number of entity types. Indicates entity type is The span of candidate entities, Indicates entity type is The number of candidate entity spans, Candidate entity spans are represented as non-entity spans. This indicates the number of candidate entity spans that are not entity spans. , These represent activation functions, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the span of candidate entities The corresponding entity candidate score, Indicates the total number of words. This represents the preset entity scaling factor. This represents the preset non-physical scaling factor.

10. A nested medical named entity recognition system, characterized in that, include: The word embedding encoding module is used to acquire the medical text to be processed, and to perform word embedding encoding on each word in the medical text using a pre-built nested medical named entity recognition model to obtain a word embedding sequence; The final feature representation module is used to extract short-range and long-range contextual dependency information of the word embedding sequence by utilizing the bidirectional long short-term memory network and multi-head self-attention mechanism in the nested medical named entity recognition model, so as to obtain the final feature representation of each word. The position representation calculation module is used to perform unbalanced adaptive span decoding on the final feature representation to obtain the start and end position representations of the candidate entity span corresponding to each word; The loss function construction module is used to classify the candidate entity span according to the start and end positions to obtain the entity type, and construct an imbalance-aware asymmetric loss function according to the entity type. The model parameter optimization module is used to optimize the model parameters of the nested medical named entity recognition model according to the imbalance perception asymmetric loss function to obtain the target entity recognition model. The medical named entity recognition module is used to identify medical named entities in the medical text based on the target entity recognition model.

Citation Information

Patent Citations

  • Biomedicine nested type entity recognition method based on layer-by-layer sensing mechanism

    CN113033207A