A medical named entity recognition method and device based on context-aware spectrum unit and multi-scale network
By using a method based on context-aware spectral units and multi-scale networks, the problems of insufficient capture of contextual semantics and inadequate utilization of multi-scale information in medical named entity recognition are solved. This method achieves high accuracy and robustness in medical named entity recognition, adapts to the complex semantics and multi-scale characteristics of medical texts, and improves the model's adaptability and interpretability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU INFORMATION INVESTMENT CO LTD
- Filing Date
- 2026-03-26
- Publication Date
- 2026-07-03
Smart Images

Figure CN122334255A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of healthcare informatics and natural language processing, specifically involving deep learning-based named entity recognition technology for medical texts, and falls under the technical category of extracting and classifying entity information from medical texts using neural network models. Background Technology
[0002] Medical named entity recognition (NENT) is a key technology for automatically identifying and classifying medical-related entities such as disease symptoms, examinations, medications, and surgeries from medical texts such as electronic medical records, medical literature, and clinical reports. In the development of smart healthcare, this technology provides crucial technical support for applications such as structured clinical decision support for electronic medical records and the construction of medical knowledge graphs. Medical texts are inherently highly specialized, structurally complex, and context-dependent, making NENT recognition a challenging task. The sheer volume of medical terminology, including numerous abbreviations, synonyms, and variant forms, often results in ambiguous entity boundaries and frequent nested entity instances. Furthermore, the same term may represent different entity types in different contexts. Acquiring high-quality medical annotation data is both difficult and costly, further increasing the complexity of the task.
[0003] For the task of medical named entity recognition, various methods have been developed in the existing technology, each with its own shortcomings. Rule-based methods can achieve high recognition accuracy, but their generalization ability is poor, making it difficult to adapt to the medical text recognition needs of different scenarios. Traditional machine learning-based methods require complex feature engineering during implementation, resulting in high human and time costs. Deep learning-based methods have become the mainstream research direction, but these methods still lack in context modeling capabilities and adaptability to the medical field in terms of multi-scale information utilization. They fail to fully mine the contextual information in medical texts and cannot achieve adaptive recognition of medical entities of different lengths.
[0004] Existing deep learning methods for processing medical texts suffer from insufficient capture of contextual semantics, inadequate fusion and utilization of multi-scale entity information, and insufficient understanding of complex semantics such as negation and adversative semantics in medical texts. This makes it difficult to adapt to the specialized expressions characteristic of medical texts, resulting in the accuracy and robustness of medical named entity recognition failing to meet the demands of practical medical applications. Therefore, a medical named entity recognition method is needed that can fully exploit the contextual information of medical texts, adaptively process medical entities at different scales, and accurately understand the complex semantics of medical texts. This would improve the overall performance of medical named entity recognition and better meet the practical application needs of the medical field. Summary of the Invention
[0005] The purpose of this invention is to provide a medical named entity recognition method and apparatus based on context-aware spectral units and multi-scale networks, which solves the problems of insufficient modeling of medical text context and inadequate utilization of multi-scale information in existing medical named entity recognition technologies, thereby improving the accuracy and robustness of medical named entity recognition.
[0006] To achieve the above objectives, the present invention provides the following technical solution:
[0007] In a first aspect, the present invention provides a medical named entity recognition method based on context-aware spectral units and multi-scale networks, comprising the following steps:
[0008] The original medical text is obtained and preprocessed to obtain a standardized sequence of terms;
[0009] The standardized word sequence is encoded using a pre-trained semantic model to obtain a context semantic vector sequence;
[0010] The context semantic vector sequence is processed using a sequence feature extraction model to obtain enhanced sequence features;
[0011] The enhanced sequence features are input into a multi-scale context feature extraction network to obtain multi-scale fused features. The multi-scale context feature extraction network includes multiple parallel feature extraction units. Each feature extraction unit performs the following operations based on a preset context window size: projecting the window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projection features; calculating the correlation metric between the window features and the central word feature; performing weighted fusion processing on the multi-directional projection features based on the correlation metric to obtain fused features; performing bipolar rectification processing on the fused features to separate positive and negative feature components; and fusing the positive and negative feature components output by each feature extraction unit to obtain the multi-scale fused features.
[0012] Based on the multi-scale fusion features, predict the named entity tag sequence of the original medical text.
[0013] In one possible implementation, the step of performing bipolar rectification on the fused features to separate the positive and negative feature components includes:
[0014] The fused features are used as input feature vectors, and the input feature vectors are processed by a first function to extract the positive feature components. The first function is to take the maximum value between the input feature vector and 0.
[0015] The input feature vector is processed by a second function to extract the negative feature component. The second function is to take the maximum value between the negative value and 0 of the input feature vector.
[0016] The positive feature component and the negative feature component are concatenated to obtain a bipolar feature representation.
[0017] In one possible implementation, the step of calculating the correlation measure between the window feature and the center word feature is to obtain the correlation measure by calculating the cosine similarity between the window feature and the center word feature.
[0018] In one possible implementation, the context window sizes corresponding to the plurality of feature extraction units are 1, 3, and 5, respectively; the feature extraction unit with a context window size of 1 has 2 projection directions, the feature extraction unit with a context window size of 3 has 4 projection directions, and the feature extraction unit with a context window size of 5 has 6 projection directions.
[0019] In one possible implementation, the step of predicting the named entity tag sequence of the original medical text based on the multi-scale fusion features includes:
[0020] The multi-scale fused features are input into a fully connected classification layer for feature mapping to obtain the label emission score of each word.
[0021] The tag emission scores are input into the conditional random field decoding layer, and the legality of the tag sequence is constrained by a preset transition probability matrix.
[0022] Based on the tag emission score and the transition score corresponding to the transition probability matrix, the Viterbi algorithm is used for decoding to obtain the globally optimal named entity tag sequence.
[0023] In one possible implementation, the step of acquiring the original medical text and preprocessing it to obtain a standardized lexical sequence includes:
[0024] The original medical text is cleaned to remove irrelevant characters, special symbols, garbled text, and web page tags, while retaining the core medical text content.
[0025] The cleaned medical text is segmented into Chinese words, and medical terms, compound words and professional abbreviations are processed in combination with a medical dictionary to obtain a word segmentation sequence;
[0026] The word segmentation sequence is standardized by controlling the length of the word segmentation sequence through a preset maximum sequence length to obtain a standardized sequence.
[0027] The standardized sequence is encoded and converted to generate a corresponding lexical identifier sequence, attention mask, and segmentation identifier, thus obtaining the standardized lexical sequence.
[0028] In one possible implementation, the pre-trained semantic model is a BERT pre-trained language model. The step of encoding the standardized word sequence using the pre-trained semantic model to obtain the context semantic vector sequence includes:
[0029] The standardized word sequence is input into the BERT pre-trained language model, and features are extracted through the multi-layer Transformer encoder in the model to obtain the initial semantic vector sequence.
[0030] The initial semantic vector sequence is subjected to dimensionality reduction and normalization adaptation processing to obtain the context semantic vector sequence.
[0031] In one possible implementation, the sequence feature extraction model is a bidirectional gated recurrent unit network (BRNN). The steps of using the BRNN to extract features from the context semantic vector sequence to obtain enhanced sequence features include:
[0032] The forward GRU network and backward GRU network of the bidirectional gated recurrent unit network are used to extract temporal features from the left and right directions respectively to obtain the forward hidden state and the backward hidden state.
[0033] The forward hidden state and the backward hidden state are concatenated along the feature dimension to obtain a single-layer concatenated feature.
[0034] The bidirectional gated recurrent unit network is stacked in multiple layers. The single-layer spliced features of the previous layer are input into the next layer for feature extraction. Dropout processing is used between layers to prevent overfitting.
[0035] The enhanced sequence features are obtained by integrating the single-layer splicing features of the last layer.
[0036] In one possible implementation, before the step of projecting the window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projected features, the method further includes:
[0037] For each central word in the enhanced sequence features, features within the context window corresponding to the central word are extracted according to the context window size of the feature extraction unit, and used as the window features.
[0038] Extract the features corresponding to the central word from the enhanced sequence features, and use them as the central word features.
[0039] In one possible implementation, after performing bipolar rectification on the fused features to separate the positive and negative feature components, the method further includes:
[0040] Local convolution processing is performed on the positive feature components and the negative feature components respectively to extract local pattern features;
[0041] The positive and negative feature components after convolution are used as the positive and negative feature components output by the feature extraction unit to participate in the generation of multi-scale fusion features.
[0042] Secondly, the present invention provides a medical named entity recognition device based on context-aware spectral units and multi-scale networks, comprising:
[0043] The preprocessing module is used to acquire the original medical text and preprocess it to obtain a standardized word sequence;
[0044] The sequence feature extraction module is used to encode the standardized word sequence using a pre-trained semantic model to obtain a context semantic vector sequence.
[0045] The context semantic vector sequence is processed using a sequence feature extraction model to obtain enhanced sequence features;
[0046] A multi-scale feature extraction and fusion module is used to input the enhanced sequence features into a multi-scale context feature extraction network to obtain multi-scale fused features. The multi-scale context feature extraction network includes multiple parallel feature extraction units. Each feature extraction unit performs the following operations based on a preset context window size: projecting window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projection features; calculating the correlation metric between the window features and the central word feature; performing weighted fusion processing on the multi-directional projection features based on the correlation metric to obtain fused features; performing bipolar rectification processing on the fused features to separate positive and negative feature components; and fusing the positive and negative feature components output by each feature extraction unit to obtain the multi-scale fused features.
[0047] The label prediction module is used to predict the named entity label sequence of the original medical text based on the multi-scale fusion features.
[0048] Compared with the prior art, the advantages of this invention are as follows:
[0049] This invention significantly enhances contextual modeling capabilities, effectively addressing the problem of insufficient capture of contextual semantics in medical texts by existing deep learning methods. Existing technologies, when processing medical texts, either fail to explicitly quantify the semantic relationship between context and central lexical units, or uniformly process feature polarity using traditional activation functions, either directly discarding negative signals resulting in information loss, or treating positive and negative signals indiscriminately, failing to accurately identify complex expressions such as negation in medical texts. This invention, through the relevance calculation stage in a multi-scale contextual feature extraction network, explicitly calculates the cosine similarity between window features and central lexical features, quantifying their semantic consistency, enabling the model to accurately capture the contextual dependencies of medical texts. Simultaneously, it constructs a bipolar rectification processing mechanism, separating the fused features into positive and negative feature components, respectively representing positive semantics such as the presence of positive increases and negative semantics such as the absence of negative normalities. These two components are then concatenated to form a bipolar feature representation, fully preserving the positive and negative semantic information in medical texts. This allows the model to accurately understand the modifying effect of negation words on subsequent entities, avoiding the misidentification of negated symptoms as entities. Existing baseline models often suffer from recognition bias because they cannot capture such complex semantics. This feature of the present invention makes it perform better in medical text processing such as electronic medical records rich in negation expressions.
[0050] This invention achieves full fusion of multi-scale information, effectively solving the problems of poor adaptability to medical entities of different scales and low accuracy in recognizing nested and discontinuous entities in existing technologies. Existing simplified methods mostly focus on local feature extraction, making it difficult to cover multi-scale information from local details to global semantics, and thus unable to adapt to the recognition needs of medical entities of different lengths. The multi-scale context feature extraction network of this invention sets up three parallel feature extraction units, corresponding to different context window sizes and projection directions. From a local context containing only the central word, to a medium-sized window context with one word on each side, and then to a global semantic context with two words on each side, it achieves comprehensive coverage of semantic information at different scales and can adapt to medical entities of different lengths. Simultaneously, the model adaptively weights and fuses multi-directional projected features based on relevance metrics, automatically learning the optimal fusion strategy, allowing features of different scales to participate in the final feature construction according to their semantic relevance, significantly improving the recognition accuracy of nested and discontinuous entities. Ablation experiments show that the F1 score of the model drops significantly after removing the multi-scale network, with an even greater drop when only a single scale is used. This fully demonstrates the key role of multi-scale information fusion design in improving recognition performance. In tests on standard datasets, the recognition performance of this invention is significantly better than that of traditional models that do not employ multi-scale fusion.
[0051] This invention offers enhanced adaptability to the medical field, significantly improving overall recognition accuracy and robustness. Compared to existing technologies, it eliminates the need for extensive domain-adaptive pre-training, effectively addressing the highly specialized and structurally complex nature of medical texts. Existing rule-based methods suffer from poor generalization, traditional machine learning methods require complex feature engineering, and some deep learning methods necessitate extensive pre-training in the medical field to adapt to specialized texts. This invention combines a pre-trained semantic model with a bidirectional gated recurrent unit network for feature extraction. First, the pre-trained semantic model converts standardized word sequences into vector sequences containing basic contextual semantics. Then, the bidirectional gated recurrent unit network processes the sequence from both left and right directions, capturing long-distance temporal dependencies. Enhanced sequence features are formed through layer-by-layer feature abstraction. This feature extraction process allows the model to effectively handle medical texts with numerous medical terms, abbreviations, synonyms, and variant forms, adapting to the specialized characteristics of medical texts without requiring extensive additional domain-adaptive pre-training. Simultaneously, the model inputs multi-scale fused features into the fully connected classification layer, and then processes them through the conditional random field decoding layer. It uses the transition probability matrix to constrain the legality of the label sequence, and combines this with the Viterbi algorithm to decode and obtain the globally optimal named entity label sequence, avoiding the problem of unreasonable label sequences caused by independent classification. In tests on the CCKS2019 Chinese Electronic Medical Record NER dataset, the precision of this invention reached 92.7%, the recall reached 90.8%, and the F1 score reached 91.7%, far exceeding the BiLSTM-CRF and BERT-CRF models, and also outperforming the BERT-BiGRU-CRF model. Ablation experiments of each core component also demonstrated that removing the context relevance calculation or the bipolar rectification mechanism resulted in varying degrees of decrease in the model's F1 score.
[0052] This invention also enhances the model's generalization ability and interpretability, overcoming many shortcomings of existing medical named entity recognition models. Existing rule-based methods are only applicable to medical texts in specific scenarios, exhibiting poor generalization ability. Traditional deep learning models are often black-box models, making it difficult to quantify and analyze the recognition decision-making process. This invention employs an end-to-end training approach, automatically learning the feature patterns of medical texts through data-driven learning. It eliminates the need for manually constructing complex feature engineering. Combined with data augmentation techniques such as dynamic batch entity replacement and optimization methods such as L2 regularization gradient pruning, it effectively prevents overfitting, allowing the model to perform stably across different types of medical texts, including electronic medical records, medical literature, and clinical reports, significantly improving generalization ability. Simultaneously, the context relevance score calculated by the model can directly quantify the impact of contextual information on entity recognition. The multi-scale feature extraction process can also be presented visually, assisting technicians in understanding the model's decision-making process. This transforms the model from a simple black-box model, significantly improving interpretability and making it easier to understand and accept in practical applications in the medical field. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a schematic diagram of the overall architecture of the medical named entity recognition system according to an embodiment of the present invention;
[0055] Figure 2 This is a schematic diagram of the multi-scale context feature extraction process according to an embodiment of the present invention;
[0056] Figure 3 This is a schematic diagram of the ON / OFF bipolar rectification mechanism in an embodiment of the present invention.
[0057] Figure 4 This is a flowchart illustrating the medical named entity recognition method according to an embodiment of the present invention. Detailed Implementation
[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0059] Example:
[0060] It should be noted that the terms "comprising" and "having" and any variations thereof in the embodiments of the present invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
[0061] This embodiment of a medical named entity recognition method based on context-aware spectral units and multi-scale networks may include the following steps:
[0062] Step 101: Obtain the original medical text and preprocess it to obtain a standardized lexical sequence.
[0063] Specifically, the original medical text can be a diagnosis and treatment description in an electronic medical record, a symptom analysis in medical literature, or a result record in a clinical examination report; the standardized lexical sequence can be an ordered set of text lexical units and their corresponding identifiers after word segmentation and length normalization.
[0064] The step of acquiring the original medical text and preprocessing it to obtain a standardized lexical sequence includes: cleaning the original medical text to remove irrelevant characters, special symbols, garbled text, and web page tags, while retaining the core medical text content; performing Chinese word segmentation on the cleaned medical text, and processing medical terms, compound words, and professional abbreviations using a medical dictionary to obtain a word segmentation sequence; standardizing the word segmentation sequence by controlling its length through a preset maximum sequence length to obtain a standardized sequence; and encoding the standardized sequence to generate corresponding lexical identifier sequences, attention masks, and segmentation identifiers to obtain the standardized lexical sequence.
[0065] Specifically, text cleaning can be the removal of noisy characters from the original medical text; irrelevant characters can be redundant spaces and line breaks in the text, special symbols can be special symbols without actual medical semantics, and web page tags can be HTML tags; Chinese word segmentation can be the operation of dividing continuous Chinese text into independent word units; a medical dictionary can be a dictionary database containing medical terms, compound words, and professional abbreviations, such as containing terms like "community-acquired pneumonia" and "WBC"; a word segmentation sequence can be a set of word units arranged in text order after word segmentation; the maximum sequence length can be a preset maximum length of the word unit sequence; sequence standardization can be the operation of truncating or padding the word segmentation sequence, where excessively long sequences can be truncated to the maximum sequence length, and excessively short sequences can be padded with placeholders to the maximum sequence length; encoding conversion can be the operation of converting word units in the standardized sequence into numerical identifiers; a word unit identifier sequence can be a sequence of numerical identifiers corresponding to word units arranged in text order; an attention mask can be an identifier sequence that distinguishes between valid word units and padded word units, with valid positions set to 1 and padded positions set to 0; and segmentation identifiers can be identifier sequences that distinguish between different text segments.
[0066] Step 102: Encode the standardized word sequence using a pre-trained semantic model to obtain a context semantic vector sequence.
[0067] Specifically, the pre-trained semantic model can be the BERT pre-trained language model; the context semantic vector sequence can be a sequence of low-dimensional dense vectors corresponding to each word in text order.
[0068] The pre-trained semantic model is a BERT pre-trained language model. The steps of encoding the standardized word sequence using the pre-trained semantic model to obtain the context semantic vector sequence include:
[0069] The standardized word sequence is input into the BERT pre-trained language model, and features are extracted through the multi-layer Transformer encoder in the model to obtain the initial semantic vector sequence.
[0070] The initial semantic vector sequence is subjected to dimensionality reduction and normalization adaptation processing to obtain the context semantic vector sequence.
[0071] Specifically, the BERT pre-trained language model can be the bert-base-chinese Chinese pre-trained model; the multi-layer Transformer encoder can be a feature extraction module composed of 12 Transformer encoder layers; the initial semantic vector sequence can be the feature sequence output by the hidden state of the last layer of the BERT model; dimensionality reduction can be the operation of mapping high-dimensional features to low-dimensional features through fully connected layers; normalization can be the operation of standardizing the feature vectors so that the feature mean is 0 and the variance is 1; the context semantic vector sequence can be the feature sequence that meets the input requirements of the sequence feature extraction model.
[0072] Step 103: Use a sequence feature extraction model to perform feature extraction processing on the context semantic vector sequence to obtain enhanced sequence features.
[0073] Specifically, the sequence feature extraction model can be a bidirectional gated recurrent unit network; the enhanced sequence features can be lexical feature sequences that capture long-distance temporal dependencies in the text.
[0074] The sequence feature extraction model is a bidirectional gated recurrent unit network (BRNN). The steps of using the BRNN to extract features from the context semantic vector sequence to obtain enhanced sequence features include:
[0075] The forward and backward GRU networks of the bidirectional gated recurrent unit network are used to extract temporal features from the context semantic vector sequence from both left and right directions, respectively, to obtain the forward hidden state and the backward hidden state. The forward hidden state and the backward hidden state are concatenated along the feature dimension to obtain a single-layer concatenated feature. Multiple layers of the bidirectional gated recurrent unit network are stacked, and the single-layer concatenated feature from the previous layer is input into the next layer for feature extraction. Dropout processing is used between layers to prevent overfitting. The single-layer concatenated feature of the last layer is integrated to obtain the enhanced sequence feature.
[0076] Specifically, the bidirectional gated recurrent unit network can be a recurrent neural network composed of a forward GRU network and a backward GRU network; the forward GRU network can be a gated recurrent unit network that processes text sequences from left to right; the backward GRU network can be a gated recurrent unit network that processes text sequences from right to left; temporal feature extraction can be a feature extraction operation that captures the temporal dependencies between words in a text sequence; the forward hidden state can be a feature sequence output by the forward GRU network; the backward hidden state can be a feature sequence output by the backward GRU network; single-layer concatenated features can be a feature sequence concatenated from the forward and backward hidden states in the feature dimension; Dropout processing can be an operation that randomly discards some neuron outputs to prevent model overfitting, and the dropout rate can be 0.1; the enhanced sequence features can be feature sequences extracted by multi-layer bidirectional GRU networks, preserving the long-distance temporal dependency information of the text.
[0077] Step 104: Input the enhanced sequence features into a multi-scale context feature extraction network to obtain multi-scale fused features. The multi-scale context feature extraction network includes multiple parallel feature extraction units. Each feature extraction unit performs the following operations based on a preset context window size: project the window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projection features; calculate the correlation metric between the window features and the central word feature; perform weighted fusion processing on the multi-directional projection features based on the correlation metric to obtain fused features; perform bipolar rectification processing on the fused features to separate positive and negative feature components; fuse the positive and negative feature components output by each feature extraction unit to obtain the multi-scale fused features.
[0078] Specifically, the multi-scale context feature extraction network can be a parallel network structure containing multiple feature extraction units at different context window scales; the feature extraction unit can be a network module that implements single-scale context feature extraction; the context window size can be the number of context words surrounding the central word, such as 1, 3, or 5; the window feature can be a set of enhanced sequence features of all words within the context window; the multi-directional projection feature can be a feature vector after the window feature is mapped to different semantic dimensions, and the number of projection directions can be 2, 4, or 6; the relevance measure can be a numerical value that quantifies the semantic similarity between the window feature and the central word feature; the fusion feature can be a multi-directional projection feature after weighted fusion; the positive feature component can be a feature vector representing the positive semantics of the text, such as the presence of symptoms or elevated indicators; the negative feature component can be a feature vector representing the negative semantics of the text, such as the absence of symptoms or normal indicators; and the multi-scale fusion feature can be a word feature vector after fusing context features at different scales.
[0079] The step of performing bipolar rectification processing on the fused features to separate positive and negative feature components includes: using the fused features as an input feature vector; processing the input feature vector using a first function to extract the positive feature component, wherein the first function is the maximum value of the input feature vector plus 0; processing the input feature vector using a second function to extract the negative feature component, wherein the second function is the maximum value of the negative value of the input feature vector plus 0; and concatenating the positive and negative feature components to obtain a bipolar feature representation.
[0080] Specifically, the input feature vector can be a weighted fused feature; the first function can be... , The input feature vector; the positive feature components can be the non-negative feature vectors retained after processing by the first function; the second function can be... , The input feature vector is the negative feature component, which can be the non-negative feature vector retained after processing by the second function; the bipolar feature representation can be the feature vector obtained by concatenating the positive and negative feature components along the feature dimension.
[0081] In the step of calculating the correlation measure between the window feature and the central word feature, the correlation measure is obtained by calculating the cosine similarity between the window feature and the central word feature.
[0082] Specifically, cosine similarity can be an index that quantifies the similarity of vectors by calculating the cosine value of the angle between two vectors, with a value range of [-1,1]; window features can be a set of left window features, center word features, and right window features within the context window; center word features can be the feature vector of the corresponding text center word in the enhanced sequence features.
[0083] The context window sizes corresponding to the multiple feature extraction units are 1, 3, and 5, respectively; the feature extraction unit with a context window size of 1 has 2 projection directions, the feature extraction unit with a context window size of 3 has 4 projection directions, and the feature extraction unit with a context window size of 5 has 6 projection directions.
[0084] Specifically, the context window size 1 can be a window scale that only contains the central word and has no additional context words; the context window size 3 can be a window scale that contains the central word and one context word on each side; the context window size 5 can be a window scale that contains the central word and two context words on each side; the number of projection directions 2 can be mapping features to two semantic directions: attribute and classification; the number of projection directions 4 can be mapping features to four semantic directions: symptom-attribute, symptom-relationship, symptom-diagnosis and treatment, and symptom-classification; the number of projection directions 6 can be mapping features to six semantic directions: disease-attribute, disease-relationship, disease-diagnosis and treatment, disease-classification, disease-cause, and disease-prognosis.
[0085] Before the step of projecting the window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projection features, the method further includes:
[0086] For each central word in the enhanced sequence features, features within the context window corresponding to the central word are extracted according to the context window size of the feature extraction unit, and used as the window features.
[0087] Extract the features corresponding to the central word from the enhanced sequence features, and use them as the central word features.
[0088] Specifically, the central word can be a word in the medical text currently being processed, such as cough or pneumonia; the context window range can be a word interval surrounding the central word, determined by the size of the context window; the window features can be a feature set composed of the enhanced sequence features of all words within the context window range in sequence; and the central word feature can be the feature vector corresponding to the central word in the enhanced sequence features.
[0089] The step of performing bipolar rectification on the fused features to separate the positive and negative feature components further includes:
[0090] The positive and negative feature components are subjected to local convolution processing to extract local pattern features. The positive and negative feature components after convolution processing are used as the positive and negative feature components output by the feature extraction unit to participate in the generation of multi-scale fusion features.
[0091] Specifically, local convolution processing can be an operation that extracts local feature patterns through a one-dimensional convolutional layer; local feature patterns can be feature vectors that capture local semantic associations of features; and a one-dimensional convolutional layer can be a convolutional operation layer containing multiple convolutional kernels.
[0092] Step 105: Based on the multi-scale fusion features, predict the named entity tag sequence of the original medical text.
[0093] Specifically, the named entity tag sequence can be a set of entity type tags that correspond one-to-one with the lexical sequence. The tags can be B-SYM, I-DIS, O, etc.
[0094] The step of predicting the named entity tag sequence of the original medical text based on the multi-scale fusion features includes: inputting the multi-scale fusion features into a fully connected classification layer for feature mapping to obtain the tag emission score of each lexical unit; inputting the tag emission score into a conditional random field decoding layer to constrain the legality of the tag sequence using a preset transition probability matrix; and using the Viterbi algorithm for decoding based on the tag emission score and the transition score corresponding to the transition probability matrix to obtain the globally optimal named entity tag sequence.
[0095] Specifically, the fully connected classification layer can be a network layer that maps multi-scale fused features to the entity label space; the label emission score can be the predicted probability value of each entity label corresponding to each word; the conditional random field decoding layer can be a sequence decoding network layer that models the transition relationship between labels; the transition probability matrix can be a matrix that represents the transition probability between different entity labels, and the dimension can be the number of labels × the number of labels; the transition score can be the transition probability value between labels in the transition probability matrix; the Viterbi algorithm can be a dynamic programming algorithm for solving the optimal sequence labeling; the globally optimal named entity label sequence can be a label sequence that takes into account both the predicted probability of word labels and the legality of transitions between labels.
[0096] Based on the same inventive concept, embodiments of the present invention also provide a medical named entity recognition device based on context-aware spectral units and multi-scale networks, comprising:
[0097] The preprocessing module is used to acquire the original medical text and preprocess it to obtain a standardized word sequence;
[0098] The sequence feature extraction module is used to encode the standardized word sequence using a pre-trained semantic model to obtain a context semantic vector sequence.
[0099] The context semantic vector sequence is processed using a sequence feature extraction model to obtain enhanced sequence features;
[0100] A multi-scale feature extraction and fusion module is used to input the enhanced sequence features into a multi-scale context feature extraction network to obtain multi-scale fused features. The multi-scale context feature extraction network includes multiple parallel feature extraction units. Each feature extraction unit performs the following operations based on a preset context window size: projecting window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projection features; calculating the correlation metric between the window features and the central word feature; performing weighted fusion processing on the multi-directional projection features based on the correlation metric to obtain fused features; performing bipolar rectification processing on the fused features to separate positive and negative feature components; and fusing the positive and negative feature components output by each feature extraction unit to obtain the multi-scale fused features.
[0101] The label prediction module is used to predict the named entity label sequence of the original medical text based on the multi-scale fusion features.
[0102] Since this device corresponds to the medical named entity recognition method based on context-aware spectral units and multi-scale networks in this embodiment of the invention, and the principle of this system in solving the problem is similar to that of this method, the implementation of this device can refer to the implementation process of the above method embodiment, and repeated parts will not be described again.
[0103] The following is in conjunction with the appendix Figure 1 To be continued Figure 3 The preferred embodiments of the medical named entity recognition method based on context-aware spectral units and multi-scale networks of the present invention are described in detail below.
[0104] Example 1:
[0105] See Figure 1 This embodiment takes the complete data stream calculation and processing based on a single sentence of medical text as an example to fully present the entire process from medical text input to structured entity tag output.
[0106] For ease of understanding, the key variable symbols used in this specification and their meanings are listed below:
[0107] Inputting raw medical text, such as "A 65-year-old male patient was admitted to the hospital due to cough and fever for 3 days and was diagnosed with pneumonia.", enters the text preprocessing module. After text cleaning—removing irrelevant HTML tags and garbled characters while keeping the text unchanged—Jieba is used for Chinese word segmentation, and a medical dictionary is loaded. The segmentation result is a list: ["patient", "male", "", "65", "years old", ""due to", "cough", "", "fever", "3", "days", "admission", "" diagnosis", "as", "pneumonia", "."]
[0108] Sequence Normalization and Encoding: According to BERT requirements, the maximum sequence length `max_seq_length` is preset to 512. In this example, the sequence length is 18, so no truncation is needed; it is then padded with [PAD] tokens to reach a length of 512. Subsequently, each lexical unit is converted into a corresponding Token ID using the BERT vocabulary, generating `token_ids` (in shape...). At the same time, the corresponding attention_mask and token_type_ids are generated.
[0109] Pre-trained semantic encoding: Load the BERT-base-chinese (Chinese) pre-trained model with a hidden layer dimension d_model=768. Input token_ids, attention_mask, and token_type_ids into the BERT model. The BERT model contains a 12-layer Transformer encoder, which calculates the contextual representation of each token based on the whole sentence through a self-attention mechanism. Take the last hidden state as the encoding result, resulting in a shape of... The three-dimensional tensor. Since the effective sequence length is 18, we take the vectors from the first 18 positions to obtain the effective feature matrix. .
[0110] Sequence feature extraction (BiGRU processing): A two-layer bidirectional GRU (BiGRU) is used, with 128 hidden units per layer (gru_hidden_size) and a dropout rate of 0.1 between layers. Input BiGRU: 1) First-layer BiGRU processing: The forward GRU processes the sequence from left to right, and the backward GRU processes the sequence from right to left. Each direction outputs a 128-dimensional hidden state. 2) The forward and backward hidden states are concatenated at each time step to obtain a 256-dimensional vector. 3) After Dropout, this vector is input into the second layer. The second-layer BiGRU performs the same operation and concatenates the vector again. 4) The output is the enhanced sequence feature matrix. .
[0111] Context window extraction: for each position in the sequence Extract its left, middle, and right context windows: ; ; . This refers to the window size. This represents the floor function.
[0112] Taking "cough" (position 7) as an example, its corresponding feature vector It integrates bidirectional temporal dependency information from the preceding text ("The patient is a 65-year-old male who was admitted to the hospital after 3 days of fever and was diagnosed with pneumonia.") and the following text ("The patient was admitted to the hospital after 3 days of fever and was diagnosed with pneumonia.").
[0113] Multi-scale contextual feature extraction: as shown in the appendix Figure 2 As shown, the network contains three context-aware spectral units (ReSU) at different scales (window sizes of 1, 3, and 5 windows respectively), used to extract and fuse contextual features at the three scales (the window size is limited by this design in this patent). The functions of each unit are as follows:
[0114] Scale 1: Local Context (Window Size) )
[0115] It only contains central word features and has no context window.
[0116] For position 7 (“cough”): Enter: Number of projection directions: 2 (attributes, categories); Projection calculation: ,in ON / OFF rectification: ON characteristic = OFF feature = Bipolarity Output 4-dimensional features. After local convolution: Output 150-dimensional local features . This represents a one-dimensional convolutional layer containing 150 kernels of size 3.
[0117] Scale 2: Medium window context (window size) , There is one word element on each side.
[0118] For position 7 (“Cough”):
[0119] Input window: Number of projection directions: 4 (symptom-attribute, symptom-relationship, symptom-diagnosis, symptom-classification); Projection calculation: , , ,in , .
[0120] The cosine similarity calculation is defined as follows: ,in Represents the L2 norm of a vector. Contextual relevance calculation. , (Relevance of the central word element to itself) .
[0121] Weighting coefficients: , , , in This is a temperature adjustment parameter used to control the sharpness of the weight distribution.
[0122] Weighted feature fusion: The projected features are weighted and summed using the adaptive weights described above.
[0123] ON / OFF rectification: ON characteristic = OFF feature = Bipolarity Output 8-dimensional features. After local convolution: Output 200-dimensional local features . This represents a one-dimensional convolutional layer containing 200 kernels of size 3.
[0124] Scale 3: Global semantics of large windows (window size = 5) There are two word elements on each side.
[0125] For position 7 (“Cough”):
[0126] Input window: ;
[0127] Central features: ;
[0128] Flatten the feature vectors of the left and right windows:
[0129] Left window features = ;
[0130] Right feature flattening = ;
[0131] The central features remain unchanged: ;
[0132] Projection calculation: , , ,in , , Interactivity computation and weighted fusion (similar to scale 2), computation , , This is then converted into weights, weighted fusion is performed, and local convolution is used. Output 250-dimensional global features . This represents a one-dimensional convolutional layer containing 250 kernels of size 3.
[0133] Multi-scale feature fusion: concatenating the output features from three scales along the feature dimension.
[0134] Through fully connected dimensionality reduction and fusion, a 512-dimensional multi-scale fusion feature matrix is obtained, and its operational representation is...
[0135]
[0136] The weight matrix , .
[0137] Tag prediction and decoding:
[0138] 1) Map the 512-dimensional features of each word element to 15 entity labels through a fully connected layer;
[0139] 2) Label Geometry: The emission scores of {Diseases: B-DIS (Disease Start), I-DIS (Disease Inside), E-DIS (Disease End), S-DIS (Single-word Disease); Symptoms: B-SYM, I-SYM, E-SYM, S-SYM; Examinations: B-EXM, I-EXM, E-EXM, S-EXM; Drugs: B-DRG, I-DRG, E-DRG, O} are calculated, and then decoded through a Conditional Random Field layer. The decoding process involves establishing constraints between labels using a learnable label transition matrix, combining the classification score of each word with the transition scores between labels, and calculating the globally optimal label sequence using the Viterbi algorithm.
[0140] For the input text above, the model system outputs the following label sequence:
[0141] ["Patient (O),"Male (O),","(O),"65 (O),"Age (O),","(O),"Due to (O),"Cough (B-SYM),","、"(O),"Fever (B-SYM),"3 (O),"Days (O),"Hospitalized (O),","(O),"Diagnosis (O),"For (O),"Pneumonia (B-DIS),."(O)]
[0142] The window size and projection direction are not limited by the above settings. The detailed steps for ON / OFF bipolar rectification calculation are as follows:
[0143] In traditional neural networks, activation functions (such as ReLU and Sigmoid) typically treat the polarity of input features uniformly. The ReLU function directly discards negative signals, leading to information loss; while the Sigmoid function, although retaining negative signals, lacks explicit separation and differentiated processing of positive and negative signals. In medical text analysis, positive features (such as symptom presence or elevated indicators) and negative features (such as symptom absence or normal indicators) have equally important semantic value and need to be extracted and utilized.
[0144] Figure 3 This method employs a bipolar feature separation and recombination mechanism. The input feature vector is separated into a positive signal (ON channel) and a negative signal (OFF channel). These are then processed through two independent paths for differentiated rectification and feature transformation, and finally reassembled to form an enhanced bipolar feature representation. This approach allows for finer control over information retention and suppression in the feature stream, improving the model's sensitivity to signal polarity and ease of recognition.
[0145] Taking position 7 ("cough") at scale 2 (window size 3) as an example, after multi-directional projection, correlation calculation and weighted fusion, the fused feature vector is obtained. The vector is then input into the ON / OFF rectifier subunit for processing. To illustrate the rectification process, the input feature vector from the previous layer is received. This vector represents the activation state of the current position in four semantic dimensions (symptom-attribute, symptom-relationship, symptom-diagnosis, symptom-classification), where positive values indicate positive semantic activation and negative values indicate negative semantic activation. A weakly correlated signal indicating "cough" symptoms. Negative evidence indicating "no difficulty breathing" A strong correlation signal indicating the symptom of "fever" Stronger negative evidence indicating "no chest pain".
[0146] Bipolar Separation and Rectification: Separates the input feature vector into two independent channels. ON channel (positive signal channel) separation function. , Only positive or zero activation is retained, representing positive semantics such as "presence," "positive," and "elevation." The OFF channel (negative signal channel) is separated by a function. , Inverting the vector retains the positive value, converting the negative value of the original vector to a positive value. This represents negative semantics such as "missing", "negative", and "normal". Independent channel processing: 1) ON channel path, ensuring positive signal. Proceed directly to the next step; the input is no longer negative. Output: positive activation features on_features 2) OFF channel path: Passing through the separation step To achieve signal inversion, since the input is non-negative, ReLU is an constant mapping. Output negative activation features: off_features=[0, 0.5, 0,0.8].
[0147] The feature concatenation layer concatenates the feature vectors from the two channels along their feature dimensions. The feature space is expanded, and positive and negative information are displayed on different dimensions.
[0148] The output is a bipolar feature vector. The first four dimensions (ON part) encode the intensity of symptom presence or abnormal indicators, and the last four dimensions (OFF part) encode the confidence level of symptom absence or normal indicators.
[0149] Example 2:
[0150] This embodiment evaluates the effectiveness of the invention through comparative and ablation experiments on a standard dataset.
[0151] Experimental setup and environment configuration:
[0152] Hardware environment: NVIDIA RTX 3090 GPU, 32GB VRAM, 64GB RAM;
[0153] Software environment: Python 3.8, PyTorch 1.12, Transformer 4.25;
[0154] Dataset: CCKS2019 Chinese Electronic Medical Record NER dataset, including training set: 735 labeled samples; validation set: 157 labeled samples; test set: 158 labeled samples.
[0155] Model configuration and parameter settings:
[0156] Basic configuration: bert_model:bert-base-chinese, max_seq_length=512, batch_size=16;
[0157] BiGRU configuration: gru_hidden_size:128, gru_num_layer:2, gru_dropout:0.1;
[0158] Multi-scale context network configuration:
[0159] context_window_sizes=[1,3,5];
[0160] projection_counts=[2,4,6].
[0161] Training configuration
[0162] AdamW optimizer parameters
[0163] Learning rate Weight decay rate ;
[0164] First-order moment estimation of exponential decay rate:
[0165] Second-order moment estimation of exponential decay rate:
[0166] Numerical stability term
[0167] During the model training warm-up phase, warmup_ratio=0.1
[0168] Epochs=20, patience=3;
[0169] Regularization settings: dropout_rate=0.1, gradient clipping: grad_clip=1.0.
[0170] Training process and optimization
[0171] Loss function: CRF negative log-likelihood loss ,here .
[0172] Experimental Results and Analysis
[0173] The evaluation results on the test set are shown in the table below:
[0174] Case Analysis
[0175] Input text: "The patient is a 65-year-old male, admitted to the hospital due to 'cough, sputum production, and fever for 3 days. Physical examination: T 38.5°C, audible rales in both lungs. Chest X-ray shows patchy opacities in the right lower lung field. Blood routine: WBC 15.6." / L, N85%. Preliminary diagnosis: Community-acquired pneumonia. Treated with levofloxacin for infection.
[0176] Recognition results:
[0177] "Cough": Symptom (B-Sym), "Sputum": Symptom (B-Sym), "Fever": Symptom (B-Sym), "T 38.5°C": Examination Result (B-Exam), "Moist rales audible in both lungs": Examination Finding (I-Exam), "Chest X-ray": Examination (B-Exam), "Patterned shadows in the right lower lung": Examination Finding (I-Exam), "Complete Blood Count": Examination (B-Exam), "WBC 15.6" " / L": Test result (I-Exam), "N85%": Test result (I-Exam). "Community-acquired pneumonia": Disease (B-Dis). "Levofloxacin": Drug (B-Drug).
[0178] Ablation experiment:
[0179] To verify the contribution of each component, an ablation experiment was conducted:
[0180] Example 3: Case Analysis of Negation Semantic Understanding and Demonstration of Model Advantages
[0181] To verify the ability of the model of this invention to understand complex negation semantics in medical texts, a typical negation case in the test set was selected for analysis and compared with the baseline model to highlight the technical advantages of this invention.
[0182] Enter the text: "The patient has no cough or sputum, but complains of chest tightness and shortness of breath."
[0183] Textual Challenges: 1) Negation Semantic Coverage: The semantic scope of the negation word "none" covers the following parallel phrases "cough" and "sputum," indicating that these two symptoms do not exist. 2) Semantic Contrast: The phrase "but," which introduces "chest tightness" and "shortness of breath," are actual symptoms experienced by the patient. 3) Entity Confusion Risk: Traditional models tend to overlook the impact of negation words on subsequent entities, mistakenly identifying negated symptoms as entities.
[0184] Baseline model (BERT-CRF) identification results and analysis:
[0185] Output label sequence: "Patient" (O), "None" (O), "Cough" (B-SYM), "、" (O), "Sputum" (B-SYM), "," (O), "But" (O), "Complaint" (O), "Chest tightness" (B-SYM), "、" (O), "Shortness of breath" (B-SYM), "." (O)
[0186] Error Analysis: The baseline model failed to fully understand the semantic negation effect of the negation word "none" on the parallel symptoms "cough" and "phlegm," incorrectly identifying these two lexical units that should have been negated as symptom entities (B-SYM). This indicates that the baseline model primarily relies on the co-occurrence of suggestive words for identification and is insensitive to deep negation logic.
[0187] The model recognition results of this invention are as follows:
[0188] Output label sequence:
[0189] "Patient" (O), "None" (O), "Cough" (O), "、" (O), "Sputum" (O), "," (O), "But" (O), "Complaint" (O), "Chest tightness" (B-SYM), "、" (O), "Shortness of breath" (B-SYM), "." (O).
[0190] Results show that the model of this invention correctly identifies "cough" and "sputum" modified by the negative word "no" as non-entities (O), while accurately identifying the actual symptoms "chest tightness" and "shortness of breath" after the transition as symptom entities (B-SYM).
[0191] In the description of this specification, the 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 present 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. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0192] The above embodiments are merely illustrative of the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent changes or modifications made based on the essence of the content of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A medical named entity recognition method based on context-aware spectrum unit and multi-scale network, characterized in that, Includes the following steps: The original medical text is obtained and preprocessed to obtain a standardized sequence of terms; The standardized word sequence is encoded using a pre-trained semantic model to obtain a context semantic vector sequence; The context semantic vector sequence is processed using a sequence feature extraction model to obtain enhanced sequence features; The enhanced sequence features are input into a multi-scale context feature extraction network to obtain multi-scale fused features. The multi-scale context feature extraction network includes multiple parallel feature extraction units. Each feature extraction unit performs the following operations based on a preset different context window size: projecting the window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projection features. Calculate the correlation metric between the window features and the center word features; based on the correlation metric, perform weighted fusion processing on the multi-directional projection features to obtain fused features; perform bipolar rectification processing on the fused features to separate positive feature components and negative feature components; fuse the positive feature components and negative feature components output by each feature extraction unit to obtain the multi-scale fused features; Based on the multi-scale fusion features, predict the named entity tag sequence of the original medical text.
2. The method of claim 1, wherein the context-aware spectrum unit and multi-scale network-based medical named entity recognition method is characterized by, The step of performing bipolar rectification on the fused features to separate the positive and negative feature components includes: The fused features are used as input feature vectors, and the input feature vectors are processed by a first function to extract the positive feature components. The first function is to take the maximum value between the input feature vector and 0. The input feature vector is processed by a second function to extract the negative feature component. The second function is to take the maximum value between the negative value and 0 of the input feature vector. The positive feature component and the negative feature component are concatenated to obtain a bipolar feature representation.
3. The method of claim 1, wherein the context-aware spectrum unit and multi-scale network-based medical named entity recognition method is characterized by, In the step of calculating the correlation measure between the window feature and the center word feature, the correlation measure is obtained by calculating the cosine similarity between the window feature and the center word feature.
4. The method of claim 1, wherein the context-aware spectrum unit and multi-scale network-based medical named entity recognition method is characterized by, The context window sizes corresponding to the multiple feature extraction units are 1, 3, and 5, respectively; the feature extraction unit with a context window size of 1 has 2 projection directions, the feature extraction unit with a context window size of 3 has 4 projection directions, and the feature extraction unit with a context window size of 5 has 6 projection directions.
5. The method of claim 1, wherein the context-aware spectrum unit and multi-scale network-based medical named entity recognition method is characterized by, The step of predicting the named entity tag sequence of the original medical text based on the multi-scale fusion features includes: The multi-scale fused features are input into a fully connected classification layer for feature mapping to obtain the label emission score of each word. The tag emission scores are input into the conditional random field decoding layer, and the legality of the tag sequence is constrained by a preset transition probability matrix. Based on the tag emission score and the transition score corresponding to the transition probability matrix, the Viterbi algorithm is used for decoding to obtain the globally optimal named entity tag sequence.
6. The method of claim 1, wherein the context-aware spectrum unit and multi-scale network-based medical named entity recognition method is characterized by, The steps of obtaining the original medical text and preprocessing it to obtain a standardized lexical sequence include: The original medical text is cleaned to remove irrelevant characters, special symbols, garbled text, and web page tags, while retaining the core medical text content. The cleaned medical text is segmented into Chinese words, and medical terms, compound words and professional abbreviations are processed in combination with a medical dictionary to obtain a word segmentation sequence; The word segmentation sequence is standardized by controlling the length of the word segmentation sequence through a preset maximum sequence length to obtain a standardized sequence. The standardized sequence is encoded and converted to generate a corresponding lexical identifier sequence, attention mask, and segmentation identifier, thus obtaining the standardized lexical sequence.
7. The method of claim 1, wherein the context-aware spectrum unit and multi-scale network-based medical named entity recognition method is characterized by, The pre-trained semantic model is a BERT pre-trained language model. The steps of encoding the standardized word sequence using the pre-trained semantic model to obtain the context semantic vector sequence include: The standardized word sequence is input into the BERT pre-trained language model, and features are extracted through the multi-layer Transformer encoder in the model to obtain the initial semantic vector sequence. The initial semantic vector sequence is subjected to dimensionality reduction and normalization adaptation processing to obtain the context semantic vector sequence.
8. The method of claim 1, wherein the context-aware spectrum unit and multi-scale network-based medical named entity recognition method is characterized by, The sequence feature extraction model is a bidirectional gated recurrent unit network. The steps of using the bidirectional gated recurrent unit network to extract features from the context semantic vector sequence to obtain enhanced sequence features include: The forward GRU network and backward GRU network of the bidirectional gated recurrent unit network are used to extract temporal features from the left and right directions respectively to obtain the forward hidden state and the backward hidden state. The forward hidden state and the backward hidden state are concatenated along the feature dimension to obtain a single-layer concatenated feature. The bidirectional gated recurrent unit network is stacked in multiple layers. The single-layer spliced features of the previous layer are input into the next layer for feature extraction. Dropout processing is used between layers to prevent overfitting. The enhanced sequence features are obtained by integrating the single-layer splicing features of the last layer.
9. The method of claim 1, wherein the context-aware spectrum unit and multi-scale network-based medical named entity recognition method is characterized by, Before the step of projecting the window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projection features, the method further includes: For each central word in the enhanced sequence features, features within the context window corresponding to the central word are extracted according to the context window size of the feature extraction unit, and used as the window features. The features corresponding to the central word in the enhanced sequence features are extracted and used as the central word features.
10. A medical named entity recognition device based on context-aware spectral units and multi-scale networks, characterized in that, include: The preprocessing module is used to acquire the original medical text and preprocess it to obtain a standardized word sequence; The sequence feature extraction module is used to encode the standardized word sequence using a pre-trained semantic model to obtain a context semantic vector sequence. The context semantic vector sequence is processed using a sequence feature extraction model to obtain enhanced sequence features; A multi-scale feature extraction and fusion module is used to input the enhanced sequence features into a multi-scale context feature extraction network to obtain multi-scale fused features. The multi-scale context feature extraction network includes multiple parallel feature extraction units. Each feature extraction unit performs the following operations based on a preset different context window size: projecting the window features in the enhanced sequence features into multiple semantic directions to obtain multi-directional projection features. Calculate the correlation metric between the window features and the center word features; based on the correlation metric, perform weighted fusion processing on the multi-directional projection features to obtain fused features; perform bipolar rectification processing on the fused features to separate positive feature components and negative feature components; fuse the positive feature components and negative feature components output by each feature extraction unit to obtain the multi-scale fused features; The label prediction module is used to predict the named entity label sequence of the original medical text based on the multi-scale fusion features.