A method for cross-fusion named entity recognition based on a traditional Chinese medicine dictionary
By constructing character-level and word-level models and combining them with a traditional Chinese medicine dictionary model, the problem of low accuracy in named entity recognition models was solved, thereby improving the accuracy and robustness of named entity recognition in the field of traditional Chinese medicine.
Patent Information
- Application Number
- CN202310641231.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-01
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-06-01
AI Technical Summary
Existing named entity recognition models suffer from low accuracy and insufficient robustness due to their simple network structure.
A cross-fusion named entity recognition method based on a traditional Chinese medicine dictionary is adopted. By constructing a character-level model, a word-level model, and a traditional Chinese medicine dictionary model, and combining them with dynamic sliding window matching technology, a fusion model is built. Finally, the predicted sequence is generated through multi-round training and annotation fusion strategy.
It improves the accuracy and robustness of named entity recognition, especially in named entity recognition tasks in the field of traditional Chinese medicine.
Smart Images

Figure CN116681072B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, specifically a cross-fusion named entity recognition method based on a traditional Chinese medicine dictionary. Background Technology
[0002] With the development and popularization of internet technology, available information resources such as electronic text have been greatly enriched. People urgently need to extract useful information from massive amounts of unstructured text. Named entities, as a clearly defined concept and research object, are basic information elements in target text and are fundamental to the correct understanding of target text. Chinese named entity recognition is an important foundational tool in text applications such as relation extraction, syntactic analysis, sentiment recognition, and intelligent question answering, and occupies a significant position in natural language processing technology.
[0003] Most current named entity recognition tasks rely on character-feature-based neural network models like BiLSTM-CRF. The principle is to break down sentences into characters, train vectors for each character using models like Word2vec on a corpus, obtain word embeddings as input to the BiLSTM model, extract latent features through a neural network, and finally use a CRF to label the sequence. Neural network models based on word features are similar to those based on character embeddings, both using the BiLSTM-CRF structure. The main difference is that the word embedding layer breaks down sentences into words, trains vectors for each word on a corpus, obtains word embeddings as input to the BiLSTM model, extracts latent features through a neural network, and finally uses a CRF to label the sequence. These models all use a single network structure. While they can accomplish named entity recognition tasks, the limited network structure results in low accuracy. Summary of the Invention
[0004] The purpose of this invention is to provide a cross-fusion named entity recognition method based on a traditional Chinese medicine dictionary, so as to improve the accuracy and robustness of named entity recognition.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] A cross-fusion named entity recognition method based on a traditional Chinese medicine dictionary includes the following steps:
[0007] Step 1: Take the given documents as the dataset and divide the dataset into data subsets. The data subsets are divided into an initial training set and a dataset to be identified. Each initial training set and dataset to be identified is split into n sentences, and each sentence is then split into a character sequence and a word sequence.
[0008] Step 2. Construct a character-level model, a word-level model, and a TCM dictionary model using the initial training set; the input of the character-level model is the character sequence in the initial training set, and the output is the prediction result of the temporary entity label corresponding to each character; the input of the word-level model is the word sequence, and the output is the prediction result of the temporary entity label corresponding to each word; the input of the TCM dictionary model is the sentence and the pre-set standardized specialized terminology dictionary in the field of TCM, and the output is the matching result between the two.
[0009] Step 3: Using the character-level model and word-level model as the basic models, construct a fusion model by combining them with a traditional Chinese medicine dictionary; the fusion model includes a first fusion model and a second fusion model, wherein the first fusion model is formed by fusing the word-level model with the traditional Chinese medicine dictionary, and the second fusion model is formed by fusing the character-level model with the traditional Chinese medicine dictionary;
[0010] Step 4: Use the data to be identified to train the character-level model, word-level model, TCM dictionary model, first fusion model, and second fusion model in multiple rounds to obtain the labeled dataset to be identified. In the multiple rounds of training, the character-level model and the first fusion model are regarded as one group, and the word-level model and the second fusion model are regarded as the second group. The two groups are alternately combined with the TCM dictionary model for training.
[0011] Step 5: Using the labeled data to be identified, a label fusion strategy is employed to generate the final predicted sequence.
[0012] Furthermore, the method for generating the final predicted sequence using the annotation fusion strategy is as follows:
[0013] If an entity is labeled by the basic model, the TCM dictionary model, and the fusion model simultaneously, then that entity will be retained in the final prediction sequence.
[0014] If two models label the same entity, and the other model predicts a different entity, and the two entities do not conflict, then both predicted entities are retained; if the two entities conflict, then the entity labeled by both models is retained.
[0015] If the three models label three different entities respectively: if there is no conflict between the three entities, then all three entities are retained; if two of the three entities conflict, the non-conflicting entity is retained, and one of the other two conflicting entities is retained according to the priority level from high to low; if the three entities conflict with each other, one entity is retained according to the priority level from high to low; the priority order of entity retention is the same as above; the priority from high to low is: fusion model, TCM dictionary model, basic model.
[0016] Furthermore, the TCM dictionary model employs a dynamic sliding window to match sentences with a pre-defined standardized dictionary of TCM terminology. The dynamic sliding window refers to a window whose length changes dynamically, starting with a length of 1 and increasing to the maximum word length in the external dictionary. During matching, the window head slides, starting from the first character of the sentence and moving one character at a time until the window reaches the end of the sentence. Each window movement matches words appearing in the dictionary within the current window. Finally, all words are collected into a set for the current sentence.
[0017] Furthermore, the preset standardized proprietary terminology dictionary in the field of traditional Chinese medicine includes "Classification and Code of Diseases and Syndromes in Traditional Chinese Medicine" and "Clinical Diagnosis and Treatment Terminology in Traditional Chinese Medicine," which can be selected according to needs.
[0018] This invention provides a cross-fusion named entity recognition method based on a Traditional Chinese Medicine (TCM) dictionary. It constructs a character-level model, a word-level model, a TCM dictionary model, and a fusion model, utilizing these models to complete the named entity recognition task. The fusion model, based on the original character-level and word-level models, introduces a standardized TCM terminology dictionary and two fusion models derived from this dictionary, incorporating external vocabulary. The introduction of the fusion model enriches the model diversity. The character-level model and the first fusion model are considered as one group, and the word-level model and its corresponding second fusion model are considered as a second group. During multiple rounds of training, the two groups of models are alternately combined with the TCM dictionary model to refine the annotation results. All annotation results are then fused to obtain the final predicted sequence, completing the named entity recognition.
[0019] Compared with existing technologies, this invention improves recognition accuracy and robustness through the synergy of fusing the model and fusing the annotation results of all models. Attached Figure Description
[0020] Figure 1 This is the overall training model for the example implementation;
[0021] Figure 2 A character-level model representation diagram;
[0022] Figure 3 A graph representing the word-level model;
[0023] Figure 4 This is the first fusion model;
[0024] Figure 5 This is the second fusion model. Detailed Implementation
[0025] like Figure 1 As shown in the figure, this embodiment provides a cross-fusion named entity recognition method based on a traditional Chinese medicine dictionary, which includes the following steps:
[0026] Step 1: Take the given documents as the dataset and divide the dataset into parts. The method for dividing the dataset is as follows:
[0027] First, the dataset is divided into subsets: an initial training set and a dataset to be identified. The initial training set is used to build the model, and the dataset to be identified is used to train the model. Each initial training set and dataset to be identified is further divided into n sentences, and then each sentence is further divided into character sequences and word sequences.
[0028] In this embodiment, the document set is represented as: D = {d1, d2, ... d n}, where d n Let d represent the subset of data corresponding to the nth document. n Breaking it down into sentences, it can be represented as: d={s1,s2,...s k}, where s k Let d represent the k-th sentence. Then, treat each sentence as a character sequence and a word sequence, respectively. Subset d of the data... n The dataset is randomly divided into two parts, one of which is used as the initial training set and the other as the dataset to be identified.
[0029] Step 2: Construct a character-level model based on character sequences, construct a word-level model based on vocabulary sequences, and construct a TCM dictionary model by combining sentences with a pre-set standardized specialized terminology dictionary in the field of TCM.
[0030] Building character-level models, such as Figure 2 As shown, the character-level model takes a sequence of characters from the initial training set as input and outputs a temporary entity label prediction for each character. The character-level model consists of a bidirectional LSTM network, an output layer, and hidden layers, and its prediction process is as follows:
[0031] a1. First, each word is mapped to a vector, resulting in a sequence of word embeddings. This sequence is then used as input to a bidirectional LSTM, connecting the forward and backward shifting output layers to create context-specific representations. The specific method is as follows:
[0032] Sentences k Breaking it down into characters, it is represented as: s k ={c1,c2,...c t ,....c m}, where c t This represents the t-th character.
[0033] Take each character c t The input is fed into the embedding layer of a bidirectional LSTM network to obtain a character embedding sequence.
[0034]
[0035] Where e c This indicates character embedding layer encoding.
[0036]
[0037]
[0038]
[0039] in This represents the forward implicit representation of the t-th character. This represents the forward implicit representation of the (t-1)th character. This represents the backward implicit representation of the t-th character. h represents the backward implicit representation of the (t-1)th character. c,t This represents the implicit representation after the concatenation of the t-th character.
[0040] a2. Using CRF (Conditional Random Field) as the output layer, the CRF is used to label context-specific representation information. In this embodiment, the previously predicted label is set as the prediction condition for the current label.
[0041] The hidden layer predicts the probability score of each character based on the annotation information output by the output layer, so as to obtain possible target labels and output temporary entity labels corresponding to each character.
[0042] a3. Optimize the model by minimizing the classification cross-entropy:
[0043]
[0044] Wherein, P(y t =l|h c,t ) is the probability that the label of the t-th character is l, and m represents the number of characters.
[0045] A word-level model is constructed. The input to the word-level model is the sequence of words obtained from word splitting, and the output is the predicted temporary entity label for each word. The word-level model has the same structure as the character-level model, but differs in its embedding layer. The specific implementation process is as follows: Figure 3 As shown:
[0046] b1. Words are first mapped to vectors, resulting in a sequence of word embeddings. This sequence of word embeddings is then used as input to a bidirectional LSTM, connecting the output layers of the forward and backward shifts to obtain context-specific representations. That is:
[0047] Put each word wt The word embedding sequence is obtained by inputting the bidirectional LSTM embedding layer.
[0048]
[0049]
[0050]
[0051]
[0052] Where e w Represents word embedding layer encoding, This represents the forward implicit representation of the t-th word. This represents the forward implicit representation of the (t-1)th word. This represents the backward implicit representation of the t-th word. h represents the backward implicit representation of the (t-1)th word. w,t This represents the implicit representation following the concatenation of the t-th word.
[0053] The hidden layer is placed on top of the bidirectional LSTM to detect deeper levels of feature information. t ;
[0054] d t =tanh(W d h w,t )
[0055]
[0056] Among them W d This represents the weights of the hidden layer.
[0057] A TCM dictionary model is constructed. The input of the TCM dictionary model is the sentence obtained in step 1 and the pre-set standardized specialized terminology dictionary in the field of TCM. The output is the matching result between the two.
[0058] Building a dictionary model requires an external dictionary for later matching. In this embodiment, a standardized dictionary of proprietary terminology in the field of Traditional Chinese Medicine (TCM) is used, capable of matching different external dictionaries based on the type of entity recognition. For example, for named entity recognition of TCM syndrome types, the "Classification and Codes of TCM Diseases and Syndromes" issued by the State Administration of Traditional Chinese Medicine is used as the external dictionary. For symptom recognition, the "Clinical Terminology of TCM" is used as the external dictionary.
[0059] Because each word in the dictionary has a different size, a fixed-size window cannot match all words. Therefore, a dynamic sliding window is used, with its length dynamically changing, starting from a size of 1 and increasing to the maximum word length in the dictionary. The sliding window head moves one character size at a time, starting from the first character of the sentence, until the window reaches the end of the sentence. Each time the window moves, it matches the words appearing in the dictionary within that window. Finally, all words are collected into a set for the current sentence.
[0060] max_len=max(|dicW1|,|dicW2|,....,|dicW m |)
[0061] Set len =match len (c i ,c i+1 ,....,c i+m )
[0062] K = Set1 ∪ Set2 ∪ ... Set max_len
[0063] Where `max_len` represents the maximum length of words in the dictionary, `match` represents character matching, and if a word enclosed in the sliding window appears in the dictionary, it is output. `len` represents the size of the sliding window. len The set of words matched by a sliding window of size len. K represents the set of all matched words.
[0064] Step 3: Using the character-level model and word-level model as the basic models, construct a fusion model by combining them with a traditional Chinese medicine dictionary. The fusion model includes a first fusion model and a second fusion model. For example... Figure 4 As shown, the first fusion model is formed by fusing a word-level model with a traditional Chinese medicine dictionary. Figure 5 As shown, the second fusion model is formed by fusing a character-level model with a traditional Chinese medicine dictionary.
[0065] Compared to character-level models, word-level models are affected by word segmentation effects. While they achieve higher accuracy in general domains, their accuracy still needs improvement in some proprietary domains. This embodiment constructs a first fusion model by introducing an external dictionary into the word-level model, and a second fusion model by introducing an external dictionary into the character-level model. This enables the model to recognize previously unseen representations of proprietary words and obtain contextual syntactic information, thereby improving accuracy in proprietary domains.
[0066] The output of the first fusion model is a joint representation constructed from individual words. For each word, its feature representation consists of two parts, where h w,tThe latent vectors learned at the lexical level in step 3 are K(w) t The vector is represented by the matching result of the t-th word in the dictionary model K of the input text. The two vectors are concatenated to form a new word-level representation for the sequence labeling model:
[0067]
[0068] The second fusion model is similar to the first fusion model, also having two optional feature representations, where h c,t The embeddings are learned at the character level, and K(c) t The vector is represented by the result of matching the t-th character of the input text in the external dictionary. The two vectors are concatenated and used as the new character-level representation for the sequence labeling model:
[0069]
[0070] Step 4: Use the data to be identified to train the character-level model, word-level model, TCM dictionary model, first fusion model, and second fusion model in multiple rounds to obtain the labeled dataset to be identified. In the multiple rounds of training, the character-level model and the first fusion model are regarded as one group, and the word-level model and the corresponding second fusion model are regarded as the second group. The two groups are alternately combined with the TCM dictionary model for training.
[0071] To maintain diversity in output results, this embodiment does not employ a fixed structure during training, but rather dynamically changes it as the model trains. Specifically, three models are used in each batch of data training: the first is a basic model, consisting of a character-level model and a word-level model; only one basic model can be selected at a time, and it is replaced by a different basic model in the next batch. The second is a Traditional Chinese Medicine (TCM) dictionary model, which matches sentences from the input data against a pre-defined standardized dictionary of TCM terminology and outputs all matched annotations. The third is a joint model, a fusion model obtained by combining another basic model not selected in this round of training with another TCM dictionary model. This ensures that each batch of data contains a basic native named entity recognition model, an improved dictionary model combined with another native model, and native dictionary matching results.
[0072] Specifically, the training process is divided into n steps, and the dataset to be identified is divided into n parts. In the first step, three models are used for training: a character-level model, a traditional Chinese medicine dictionary model, and a first fusion model. The first part of the dataset to be identified is input into each of these three models for training and annotation. In the second step, three models are used for training: a word-level model, a traditional Chinese medicine dictionary model, and a second fusion model. The second part of the dataset to be identified is input into each of these three models for training and annotation. This process is repeated until all n batches of datasets have been trained.
[0073] Step 5: Generate the final predicted sequence based on the labeled data to be identified.
[0074] In this embodiment, the basic model, the TCM dictionary model, and the fusion model in each batch of data training are represented as Ma, Mb, and Mc, respectively. The method for generating the final prediction sequence Y according to the annotation fusion strategy is as follows:
[0075] If an entity is labeled by Ma, Mb, and Mc simultaneously, then that entity is retained in the final prediction sequence.
[0076] If two models label the same entity, and the other model predicts a different entity, and the two entities do not conflict, then both predicted entities are retained; if the two entities conflict, then the entity labeled by both models is retained.
[0077] If the three models label three different entities respectively: if there is no conflict between the three entities, then all three entities are retained; if two of the three entities conflict, the non-conflicting entity is retained, and one of the other two conflicting entities is retained according to the priority level from high to low; if the three entities conflict with each other, one entity is retained according to the priority level from high to low; the priority order of entity retention is the same as above; the priority from high to low is: fusion model, TCM dictionary model, basic model.
[0078] The above description is merely a specific embodiment of the present invention. The character-level model described above, depending on its implementation, can also be called a character embedding recognition model, and the word-level model can also be called a word embedding recognition model. It should be noted that any feature disclosed in this specification, unless specifically stated otherwise, can be replaced by other equivalent or similarly purposed alternative features; all disclosed features, or steps in all methods or processes, except for mutually exclusive features and / or steps, can be combined in any way.
Claims
1. A cross-fusion named entity recognition method based on a traditional Chinese medicine dictionary, characterized in that, Includes the following steps: Step 1: Take the given documents as the dataset and divide the dataset into data subsets. The data subsets are divided into an initial training set and a dataset to be identified. Each initial training set and dataset to be identified is split into n sentences, and each sentence is then split into a character sequence and a word sequence. Step 2. Construct a character-level model, a word-level model, and a TCM dictionary model using the initial training set; the input of the character-level model is the character sequence in the initial training set, and the output is the prediction result of the temporary entity label corresponding to each character; the input of the word-level model is the word sequence, and the output is the prediction result of the temporary entity label corresponding to each word; the input of the TCM dictionary model is the sentence and the pre-set standardized specialized terminology dictionary in the field of TCM, and the output is the matching result between the two. Step 3: Using the character-level model and word-level model as the basic models, construct a fusion model by combining them with a traditional Chinese medicine dictionary; the fusion model includes a first fusion model and a second fusion model, wherein the first fusion model is formed by fusing the word-level model with the traditional Chinese medicine dictionary, and the second fusion model is formed by fusing the character-level model with the traditional Chinese medicine dictionary; Step 4: Use the data to be identified to train the character-level model, word-level model, TCM dictionary model, first fusion model, and second fusion model in multiple rounds to obtain the labeled dataset to be identified; in the multiple rounds of training, the character-level model and the first fusion model are regarded as one group, and the word-level model and the corresponding second fusion model are regarded as the second group. The two groups are alternately combined with the TCM dictionary model for training. Step 5: Using the labeled data to be identified, a label fusion strategy is employed to generate the final predicted sequence.
2. The method for cross-fusion named entity recognition based on a traditional Chinese medicine dictionary according to claim 1, characterized in that, The method for generating the final predicted sequence using the annotation fusion strategy is as follows: If an entity is labeled by the basic model, the TCM dictionary model, and the fusion model simultaneously, then that entity will be retained in the final prediction sequence. If two models label the same entity, and the other model predicts a different entity, and the two entities do not conflict, then both predicted entities are retained; if the two entities conflict, then the entity labeled by both models is retained. If the three models are labeled with three different entities: if there is no conflict between the three entities, then all three entities are retained; if two of the three entities conflict, the entity that does not conflict is retained, and for the other two conflicting entities, one of them is retained according to its priority level from high to low. If the three entities conflict with each other, one entity is retained in descending order of preference. The priority order for entity retention is the same as above. The priority order from high to low is: fusion model, TCM dictionary model, basic model.
3. The method for cross-fusion named entity recognition based on a traditional Chinese medicine dictionary according to claim 1, characterized in that, The TCM dictionary model employs a dynamic sliding window to match sentences with a pre-defined standardized terminology dictionary in the field of TCM. The dynamic sliding window refers to the window length changing dynamically. The initial window length is 1, and it increases from 1 to the maximum vocabulary length in the external dictionary. During matching, the sliding window head moves one character size at a time, starting from the first character of the sentence, until the window tail reaches the end of the sentence. Each time the window is moved, the words appearing in the dictionary within the current window are matched; finally, all the words are collected into a set for the current sentence.
4. A cross-fusion named entity recognition method based on a traditional Chinese medicine dictionary according to any one of claims 1 to 3, characterized in that, The pre-defined standardized terminology dictionary in the field of traditional Chinese medicine includes "Classification and Code of Diseases and Syndromes in Traditional Chinese Medicine" and "Clinical Diagnosis and Treatment Terminology in Traditional Chinese Medicine," which can be selected according to needs.
Citation Information
Patent Citations
Named entity recognition method for Chinese medical text
CN111079377A
Medical named entity identification method utilizing multi-model fusion strategy
CN111651991A
