An entity recognition method for Chinese electronic medical records based on Lattice LSTM model

By using the Lattice LSTM model and BERT pre-trained language model in Chinese electronic medical record naming entity recognition, combined with medical dictionary, the problem of word segmentation error and difficulty in recognizing unlogged words is solved, and the accuracy of naming entity recognition and the ability to handle polysynthetic ambiguity are improved. .

CN112151183BActive Publication Date: 2024-11-22SHANGHAI MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011011399.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-23
Publication Date
2024-11-22
Estimated Expiration
2040-09-23

AI Technical Summary

Technical Problem

There are problems of large participle errors in Chinese electronic medical records and difficulty in identifying unlogged words. Traditional methods cannot effectively solve the long dependency problem and polysyllabus ambiguity, resulting in poor recognition of named entities.

Method used

The Chinese electronic medical record entity recognition method based on the Lattice LSTM model is adopted, combined with the BERT pre-trained language model and external dictionary in the field of medicine, entity recognition is performed through bidirectional Lattice LSTM encoding and CRF model, and context-dependent representation and ambiguity of the word are fused.

Benefits of technology

It improves the accuracy of naming entity recognition, reduces word segmentation errors, enhances the ability to recognize unlogged words, alleviates the ambiguity of polysemes, and improves the entity recognition effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112151183B_ABST
    Figure CN112151183B_ABST
Patent Text Reader

Abstract

The present invention discloses an entity recognition method for Chinese electronic medical records based on a Lattice LSTM model, comprising the following steps: Step 1: training feature vectors of electronic medical record data to obtain feature vectors of electronic medical record data; Step 2: based on a bidirectional Lattice LSTM encoding model, bidirectional feature vector encoding is performed on the feature vector to obtain an output state sequence of the electronic medical record data; Step 3: based on the transfer characteristic of a CRF model, the output state sequence is labeled with probability sorting, the result of entity recognition is obtained, and entity recognition is completed. This invention solves the shortcomings of traditional Chinese electronic medical record named entity recognition, utilizes explicit word information through a Lattice LSTM model, uses a BERT pre-trained language model to fuse the context-related representation of a word, represents the polysemy of a word, and introduces external dictionary resources in the medical field, which not only improves the recognition effect of the model, but also has a certain ability to discover unregistered words.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of named entity recognition, and in particular to an entity recognition method for Chinese electronic medical records based on a Lattice LSTM model. Background Art

[0002] With the rapid development of medical information, electronic medical records have also shown explosive growth. Large-scale electronic medical records record the entire medical process of patients, contain a large amount of patient diagnosis and treatment information, and are an important data source for clinical medical research. Electronic medical record named entity recognition is the use of computers to automatically identify and extract medical-related named entity objects such as body parts, diseases, symptoms, etc. from unstructured clinical medical texts. These named entities provide a working basis for the subsequent construction of medical systems and related research identification.

[0003] However, for named entity recognition of Chinese electronic medical records, there are many unregistered words in clinical electronic medical records, which causes great errors in Chinese word segmentation, and word segmentation errors greatly affect the recognition effect of named entities. At the same time, due to the personal writing habits of doctors, electronic medical record texts do not have a unified and standardized writing format, and the abbreviations of various symptoms, drugs, etc. increase the difficulty of identifying named entities in electronic medical records.

[0004] At present, the popular methods for named entity recognition in Chinese electronic medical records are mainly divided into: machine learning-based methods and deep learning-based methods. Machine learning-based methods mainly include hidden Markov model (HMM), maximum entropy (ME), and conditional random field (CRF). This method regards the named entity recognition task as a sequence labeling task, labels each word in the input sentence with a corresponding label, and determines the boundary position and type of the entity based on the label. The disadvantage is that it has high requirements on the quality of feature selection, cannot solve the long dependency problem in the text, and cannot recognize unregistered words.

[0005] Therefore, researchers applied deep learning to named entity recognition tasks. The best named entity recognition (NER) in the English field is the BiLSTM-CRF model. Due to the differences in language features between Chinese and English, Chinese text does not have identifiers such as spaces in English text. Chinese entity recognition must first segment the text. There are many professional medical terms in Chinese electronic medical records, which will cause a large number of segmentation errors and lead to accumulated errors in NER. The simple BiLSTM-CRF model based on character vectors will result in the separation of many words that should not be separated, thereby losing the original intrinsic information of the words.

[0006] Based on the above problems, the present invention considers using the improved BiLSTM-CRF model, that is, the Lattice LSTM grid model based on word vectors as the neural network base model of the invention. At the same time, in different parts of the Chinese electronic medical record, the category attributes of medical entities are different. There is a fuzzy classification problem when labeling named entities, and it is impossible to judge the boundaries between certain named entities. Common entities that represent symptoms often appear in the names of disease entities. In the face of such problems, the present invention considers modeling the multiple meanings of polysemous words based on the base model and combining external dictionaries in the medical field to reduce the ambiguity of polysemous words, thereby improving the effect of entity recognition. Summary of the invention

[0007] The purpose of the present invention is to provide an entity recognition method for Chinese electronic medical records based on the Lattice LSTM model. This method aims to solve the deficiencies of traditional Chinese electronic medical record named entity recognition. The Lattice LSTM model uses explicit word information, uses the BERT pre-trained language model to integrate the context-related representation of words, represents the polysemy of words, and introduces external dictionary resources in the medical field, which not only improves the recognition effect of the model, but also has a certain ability to discover unregistered words.

[0008] To achieve the above object, the present invention provides an entity recognition method for Chinese electronic medical records based on the Lattice LSTM model, comprising the following steps:

[0009] Step 1: Perform feature vector training on the electronic medical record data to obtain the feature vector of the electronic medical record data;

[0010] Step 2: Based on the bidirectional Lattice LSTM encoding model, perform bidirectional feature vector encoding on the feature vector of the electronic medical record data to obtain the output state sequence of the electronic medical record data;

[0011] Step 3: Based on the transfer characteristics of the CRF model, the output state sequence is sorted by labeling probability to obtain the result of entity recognition and complete entity recognition.

[0012] Most preferably, feature vector training comprises the following steps:

[0013] Step 1.1: Construct a dictionary containing both general text and medical professional vocabulary;

[0014] Step 1.2: preprocessing the electronic medical record data to obtain preprocessed electronic medical record data;

[0015] Step 1.3: Based on the BERT pre-trained language model, perform word vector training on the pre-processed electronic medical record data to obtain a word feature vector of the electronic medical record data having a corresponding word vector after word vector training;

[0016] Step 1.4: Perform word vector training based on the dictionary combination and the word sequence in the preprocessed electronic medical record data to obtain a word feature vector for each word sequence in the electronic medical record data vector;

[0017] Step 1.5: Fusing the character feature vector with the word feature vector to obtain the feature vector of the electronic medical record data.

[0018] Most preferably, constructing the dictionary combination comprises the following steps:

[0019] Step 1.1.1: Obtain Chinese Wikipedia corpus and medical word segmentation dictionary respectively;

[0020] Step 1.1.2: Based on the Word2Vec pre-trained language model, perform Jieba word segmentation training on the Chinese Wikipedia corpus to obtain the Wikipedia word vector;

[0021] Step 1.1.3: Performing improved word segmentation training on the medical word segmentation dictionary to obtain a medical word segmentation word vector;

[0022] Step 1.1.4: Perform a dictionary combination on the Wikipedia word vector and the medical word segmentation word vector to obtain a dictionary combination containing ordinary text and medical professional vocabulary.

[0023] Most preferably, the pretreatment comprises the following steps:

[0024] Step 1.2.1: De-privacy processing is performed on the electronic medical record data to obtain de-privacy case data from which patient privacy information is removed;

[0025] Step 1.2.2: Perform sentence fragment processing on the deprived case data to obtain processed electronic case data;

[0026] Step 1.2.3: Based on the regular matching method, the processed electronic medical record data is filtered and cleaned to obtain filtered electronic medical record data;

[0027] Step 1.2.4: Annotate the filtered electronic medical record data to obtain pre-processed electronic medical record data.

[0028] Most preferably, the residual sentence processing includes completing the missing sentences in the private case data, deleting the erroneous sentences in the private case data, and segmenting the overly long sentences in the private case data.

[0029] Most preferably, word vector training includes the following steps:

[0030] Step 1.3.1: Read the character sequence in the preprocessed electronic medical record data;

[0031] Step 1.3.2: The BERT pre-trained language model performs character mapping on the word sequence one by one to obtain a word input vector of the BERT pre-trained language model;

[0032] Step 1.3.3: Perform feature training on the word input vector and output the character feature vector.

[0033] Most preferably, bidirectional feature vector encoding comprises the following steps:

[0034] Step 2.1: Based on the sigmoid activation function and the Lattice LSTM encoding model, the feature vector of the electronic medical record data is encoded into a word vector to obtain the word output vector of the electronic medical record data;

[0035] Step 2.2: Based on the Lattice LSTM encoding model, the feature vector of the electronic medical record data is encoded with a word vector to obtain the word output vector of the electronic medical record data;

[0036] Step 2.3: performing feature vector fusion according to the word output vector and the feature vector of the electronic medical record data to obtain an updated feature vector of the electronic medical record data;

[0037] Step 2.4: Based on the Lattice LSTM encoding model, the updated feature vector and the feature vector of the electronic medical record data are respectively unidirectionally encoded and reversely encoded at the hidden layer to obtain the unidirectional feature vector and reverse feature vector of the electronic medical record data respectively;

[0038] Step 2.5: perform vector concatenation of the unidirectional feature vector and the reverse feature vector to obtain the bidirectional feature vector of the electronic medical record data, thereby calculating the output state sequence H of the electronic medical record data.

[0039] Most preferably, word vector encoding comprises the following steps:

[0040] Step 2.1.1: Based on the sigmoid activation function and the Lattice LSTM encoding model, encode the word feature vector in the feature vector to obtain the input gate of each index position, the forget gate of each index position, the output gate of each index position, and the candidate value of each index position;

[0041] Step 2.1.2: Calculate the memory unit of each index position according to the input gate of each index position, the forget gate of each index position and the candidate value of each index position;

[0042] Step 2.1.3: Calculate the word output vector of each index position of the electronic medical record data according to the output gate of each index position and the memory unit of each index position.

[0043] Most preferably, feature vector fusion comprises the following steps:

[0044] Step 2.3.1: Perform vector fusion on the feature vector of the electronic medical record data and the word output vector to obtain a gating unit of the word output vector;

[0045] Step 2.3.2: According to the gating unit of the word output vector and the feature vector of the electronic medical record data, normalized weight calculations are performed on the character granularity information and the word granularity information, respectively, to obtain the character granularity weight of each index position and the word granularity weight of each index position;

[0046] Step 2.3.3: According to the character granularity weight of each index position and the word granularity weight of each index position, the word output vector of the electronic medical record data and the feature vector of the electronic medical record data are updated to calculate the updated feature vector of each index position.

[0047] Most preferably, the labeling probability ranking comprises the following steps:

[0048] Step 3.1: perform entity sequence labeling on the output state sequence to obtain the probability of word and sentence labels in the output state sequence;

[0049] Step 3.2: Based on the Viterbi algorithm, the labeling sequence with the maximum probability of each word in the output state sequence is calculated as the result of entity recognition, thereby completing entity recognition.

[0050] By using this invention, the shortcomings of traditional Chinese electronic medical record named entity recognition are solved. The explicit word information is utilized through the LatticeLSTM model, and the context-related representation of the characters is integrated using the BERT pre-trained language model to represent the polysemy of the characters. The external dictionary resources in the medical field are introduced, which not only improves the recognition effect of the model, but also has a certain ability to discover unregistered words.

[0051] Compared with the prior art, the present invention has the following beneficial effects:

[0052] 1. The entity recognition method provided by the present invention adopts the Lattice LSTM model and utilizes the potential semantic information of words in the context to effectively avoid the propagation error caused by word segmentation.

[0053] 2. The entity recognition method provided by the present invention is based on the pre-trained word vector of the BERT language model, which can fully learn the character-level, word-level, sentence-level and inter-sentence relationship features of the corpus, and generate a dynamic word embedding vector based on the current context for each word in the input text, which solves the problem that the traditional word embedding method maps the same word in different contexts to the same semantic space, and improves the semantic disambiguation capability.

[0054] 3. The entity recognition method provided by the present invention can enhance the recognition ability of the neural network for various named entities by using medical-related external dictionaries, thereby making up for the deficiency in the scale of experimental data and alleviating the problem of polysemy. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A flow chart of the entity recognition method provided by the present invention;

[0056] Figure 2 A schematic diagram of the structure of the BERT pre-trained language model provided by the present invention;

[0057] Figure 3 This is a schematic diagram of the structure of the Lattice LSTM model provided by the present invention. DETAILED DESCRIPTION

[0058] The present invention will be further described below through specific embodiments in conjunction with the accompanying drawings. These embodiments are only used to illustrate the present invention and are not intended to limit the protection scope of the present invention.

[0059] The present invention provides an entity recognition method for Chinese electronic medical records based on the Lattice LSTM model. Figure 1 As shown, the following steps are included:

[0060] Step 1: Acquire Chinese electronic medical record data, and perform feature vector training on the electronic medical record data to obtain feature vectors of the electronic medical record data.

[0061] The feature vector training includes the following steps:

[0062] Step 1.1: Construct a dictionary combination D containing common text and medical professional vocabulary; wherein constructing the dictionary combination includes the following steps:

[0063] Step 1.1.1: Obtain the Chinese Wikipedia corpus and the medical word segmentation dictionary from Peking University Open Data Platform respectively;

[0064] Step 1.1.2: Based on the Word2Vec pre-trained language model, perform Jieba word segmentation training on the Chinese Wikipedia corpus to obtain the Wikipedia word vector;

[0065] Step 1.1.3: Perform improved word segmentation training on the medical word segmentation dictionary to obtain medical word segmentation word vectors; in this embodiment, the improved word segmentation training includes the following steps:

[0066] Step 1.1.3.1. Since the medical word segmentation dictionary includes five categories: disease, symptom, examination, medicine, and surgical treatment, and since the entity categories of the medical dictionary and the present invention are not completely consistent, the medical word segmentation dictionary needs to be slightly modified.

[0067] Step 1.1.3.2: According to medical knowledge, drugs are also treatment methods for certain diseases. Therefore, drugs and surgical treatments in the medical dictionary can be classified into the entity category of treatment (TREATMENT) of the present invention.

[0068] Step 1.1.3.3: There is no body part category in the medical segmentation dictionary. The present invention combines the body part entity category marked in the corpus data into a partial dictionary of body parts, thereby completing the construction of the medical segmentation dictionary required by the present invention.

[0069] Step 1.1.3.4: Represent the features of the medical word segmentation dictionary constructed above with a binary vector, and set c i The mapping relationship between and w is: w=c1c2...c k , 1≤i≤k. dict is a predefined dictionary. When w∈dict, there are c i ∈dict. Define the following dictionary feature description function, where different values ​​represent different dictionary feature states of a word c:

[0070]

[0071] Then the dictionary vector representation of word c is expressed as [b1(c), b2(c), b3(c), b4(c), b5(c)].

[0072] Step 1.1.4: Perform a dictionary combination of the Wikipedia word vector and the medical word segmentation word vector to obtain a dictionary combination D containing ordinary text and medical professional vocabulary.

[0073] Step 1.2: Preprocess the electronic medical record data to obtain preprocessed electronic medical record data.

[0074] Wherein, the pre-processing comprises the following steps:

[0075] Step 1.2.1: De-privacy processing is performed on the electronic medical record data to obtain de-privacy case data from which the patient's privacy information is removed, so as to ensure that the patient's personal information is not disclosed.

[0076] Step 1.2.2: The deprived case data may have incoherent or overlong sentences, which may cause the sentences in the deprived case data to lose their original meanings; the deprived case data is processed for residual sentences to obtain processed electronic case data.

[0077] The residual sentence processing includes completing the missing sentences in the private case data, deleting the wrong sentences in the private case data, and segmenting the overly long sentences in the private case data.

[0078] Step 1.2.3: Based on the regular matching method, the processed electronic medical record data is filtered and cleaned, and non-text content in the processed electronic medical record data is filtered out to obtain filtered electronic medical record data.

[0079] Step 1.2.4: Annotate the filtered electronic medical record data to obtain pre-processed electronic medical record data.

[0080] In this embodiment, the processed original medical text data and the corresponding annotation data are converted into a format that can be recognized by the program using the BIO annotation system. The BIO annotation system includes 11 entity tags as follows: O, B-SIGNS, I-SIGNS, B-CHECK, I-CHECK, B-DISEASE, I-DISEASE, B-TREATMENT, I-TREATMENT, B-BODY, I-BODY (i.e., including non-entities, symptoms and signs, examinations and tests, diseases and diagnosis, treatments, and body parts), where O represents non-entities, B- represents the beginning of an entity, and I- represents the middle part of an entity.

[0081] For example, "Bilateral pupils are large and equal in size and are sensitive to light." The result after annotation is: "bilateral B-BODY, lateral I-BODY, pupil I-BODY, hole I-BODY, positive B-SIGNS, large I-SIGNS, equal I-SIGNS, round I-SIGNS, O, B-CHECK, light I-CHECK, reflection I-CHECK, reflection I-CHECK, sensitive O, sensitive O, O"

[0082] It is also necessary to convert the entity tags into digital form, that is, {"O":0,"B-SIGNS":1,"I-SIGNS":2,"B-CHECK":3,"I-CHECK":4,"B-DISEASE":5,"I-DISEASE":6,"B-TREATMENT":7,"I-TREATMENT":8,"B-BODY":9,"I-BODY":10}.

[0083] Step 1.3: The word vectors generated by training the traditional Word2Vec pre-trained language model are simple context-independent static vectors, which cannot well represent the polysemy of words according to the context, so the BERT pre-trained language model is selected; compared with the traditional Word2Vec pre-trained language model, the BERT pre-trained language model has stronger generalization ability; based on the BERT pre-trained language model, the pre-processed electronic medical record data is trained with word vectors to obtain the word feature vectors of the electronic medical record data with corresponding word vectors after word vector training

[0084] The word vector training includes the following steps:

[0085] Step 1.3.1: The BERT pre-trained language model reads the character sequence in the preprocessed electronic medical record data; the character sequence in the preprocessed electronic medical record data is s and satisfies:

[0086] s=[c1,c2,c3,…c n ]

[0087] Among them, c j Represents the jth character in a character sequence, where j = 1, 2, 3, ..., n;

[0088] Step 1.3.2: The BERT pre-trained language model uses three vectors: token embedding, segment embedding, and position embedding to embed each word c in the word sequence s. j Perform character mapping one by one to obtain the word input vector E1...E of the BERT pre-trained language model N , N is the length of the input word sequence s;

[0089] Step 1.3.3: If Figure 2 As shown, the BERT pre-trained language model uses a bidirectional feature extractor (Transformer) as an encoder to input the word vector E1...E N Perform feature training and output the word feature vector of the jth word that changes dynamically according to the context c is the character feature vector flag.

[0090] The model training is performed by masking about 15% of the tokens in the corpus and performing Transformer encoding operations at the same time, so that the word input vector E1...E NEach character in the code integrates the information on the left and right sides, rather than simply encoding from left to right or from right to left, so as to obtain the word feature vector of the electronic medical record data.

[0091] Step 1.4: Perform word vector training based on the dictionary combination D and the word sequence s in the preprocessed electronic medical record data to obtain each word sequence w in the electronic medical record data vector b,e The word feature vector of the wth word (index position) from the starting word index b to the ending word index e w is the word feature vector flag, b is the start word index of the word start matching position, and e is the end word index of the word end matching position.

[0092] Step 1.5: Substitute the word feature vectors in the electronic medical record data vector after the BERT pre-trained language model language training Each word sequence w in the electronic medical record data vector b,e The word feature vector Perform feature fusion to obtain a feature vector of the electronic medical record data.

[0093] Step 2: The Lattice LSTM encoding model is an optimized model based on the character-based LSTM-CRF model. New word sequence information and additional gates for controlling information flow are added to the LSTM-CRF model.

[0094] Based on the bidirectional Lattice LSTM encoding model, bidirectional feature vector encoding is performed on the feature vector of the electronic medical record data to obtain an output state sequence H of the electronic medical record data.

[0095] The bidirectional feature vector encoding comprises the following steps:

[0096] Step 2.1: When the character in the feature vector of the input electronic medical record data does not have any word ending with it in the dictionary, the transfer of the unit in the Lattice LSTM model will be the same as the normal long short-term memory model;

[0097] Based on the sigmoid activation function and Lattice LSTM encoding model, the word feature vector in the feature vector of the electronic medical record data is Perform word vector encoding to obtain the word output vector of the jth word (index position) of the electronic medical record data

[0098] The word vector encoding comprises the following steps:

[0099] Step 2.1.1: Based on the sigmoid activation function and the tanh layer in the Lattice LSTM encoding model, the word feature vector of the jth word is Encode and obtain the input gate of the jth index position The forget gate at the jth index position The output gate at the jth index position and the candidate value for the jth index position And satisfy:

[0100]

[0101] Among them, W cT and b c All are Lattice LSTM encoding model parameters, σ is the sigmoid activation function, and tanh is the hyperbolic tangent activation function; The word output vector for the j-1th word;

[0102] Step 2.1.2: According to the input gate of the j-th index position The current information controlled, the forget gate of the jth index position Controlled historical information and candidate values ​​for the jth index position calculate

[0103] The memory cell at the jth index position And satisfy:

[0104] in, is the memory unit at the j-1th index position;

[0105] Step 2.1.3: According to the output gate of the j-th index position and the memory cell at the jth index position Calculate the word output vector for the jth index position And satisfy:

[0106]

[0107] Step 2.2: Based on the Lattice LSTM encoding model, the word feature vector in the feature vector of the electronic medical record data is Perform word vector encoding to obtain the word output vector of the wth word (index position) in the electronic medical record data from the starting word index b to the ending word index e And satisfy:

[0108]

[0109]

[0110] in, Output vector for the word at the w-1th index position in a sequence of words s from the starting word index b to the ending word index e; and b w These are Lattice LSTM encoding model parameters; and are the hidden information and global information output by the starting word index b in the word sequence s in the character BiLSTM model; is the input gate of the wth index position in a sequence of words s from the starting word index b to the ending word index e; It is the forget gate of the wth index position in a series of word sequence s from the starting word index b to the ending word index e.

[0111] At the same time, the input gate of the wth index position in the series of word sequences s from the starting word index b to the ending word index e is and the forget gate at the w-th index position The input gate at the jth index position calculated based on the sigmoid activation function in step 2.1.1 above and the forget gate at the jth index position The calculation method is the same and will not be elaborated here.

[0112] Moreover, this model is actually a word vector-based model, and the entity label only exists at the word level, so there is no need to consider the output gate in the word unit structure. Step 2.3: Output the word vector according to the wth word (index position) from the starting word index b to the ending word index e and the word feature vector of the jth word Perform feature vector fusion to obtain the updated feature vector of the jth word (index position)

[0113] The feature vector fusion comprises the following steps:

[0114] Step 2.3.1: Take the word feature vector at the end word index e in the word sequence s in the electronic medical record data The word output vector of the wth index position from the starting word index b to the ending word index e in the electronic medical record data Perform vector fusion to obtain the word output vector for each index position in a series of word sequences s from the starting word index b to the ending word index e The contribution of the gating unit And satisfy:

[0115]

[0116] Among them, and b l are both parameters of the Lattice LSTM encoding model.

[0117] As Figure 3 shown, for each memory cell in the hidden layer the calculation is affected by multi-path information flow; in this embodiment, for the sentence "chronic obstructive pulmonary disease with cor pulmonale", the first "disease" (index position 8) in this sentence matches the corresponding words "pulmonary disease" and "disease", that is, the gating unit of the character "disease" is calculated under the influence of the character feature vector and the gating unit as well as the output of the previous hidden layer.

[0118] Step 2.3.2: According to the gating unit from the start word index b to the end word index e and the input gate at the j-th index position, calculate the normalized weights of the character-level information and the word-level information respectively, and obtain the character-level weight of the j-th character (index position) and the word-level weight from the start word index b to the end word index j, and respectively satisfy:

[0119]

[0120]

[0121] Among them, is the gating unit from the start word index b to the end word index j; is the gating unit from the start word index b' to the end word index j; is the set of words from the start word index b'' to the end word index j matched in the dictionary combination D.

[0122] Step 2.3.3: According to the character-level weight of the j-th character (index position) and the word-level weight from the start word index b to the end word index j, update the word output vector of the w-th word (index position) from the start word index b to the end word index j in the electronic medical record data and the candidate value at the j-th index position, calculate the updated feature vector of the j-th character (index position) and satisfy:

[0123]

[0124] where D is the dictionary combination.

[0125] Step 2.4: Based on the Lattice LSTM encoding model, update the feature vector of the j-th word (index position) And the word feature vector of the jth word calculated based on the sigmoid activation function The output gate of the j-th index position in Perform one-way encoding and reverse encoding of the hidden layer respectively to obtain the one-way feature vector of the tth sentence of the electronic medical record data and the reverse feature vector of the t-th sentence;

[0126] Among them, the one-way feature vector of the t-th sentence satisfy:

[0127]

[0128] Step 2.5: The one-way feature vector of the tth sentence in the electronic medical record data and the reverse feature vector of the tth sentence in the electronic medical record data Perform vector concatenation to obtain the bidirectional feature vector h of the tth sentence of the electronic medical record data t , thereby calculating the output state sequence H of the electronic medical record data;

[0129] The bidirectional feature vector h of the tth sentence of the electronic medical record data t satisfy:

[0130]

[0131] The output state sequence H of the electronic medical record data satisfies:

[0132] H={h1,h2,...,h n}.

[0133] Step 3: Based on the transfer characteristics of the CRF model, the output state sequence H is sorted by labeling probability to obtain the result of entity recognition and complete entity recognition.

[0134] The labeling probability sorting includes the following steps:

[0135] Step 3.1: Input the output state sequence H into the CRF model, perform entity sequence labeling on each character in the output state sequence H, and obtain the probability P(y|s) of the word label, which satisfies:

[0136]

[0137] Among them, y' represents any label sequence of the output, The model is for each l i The weight parameter, It is from l i-1 To i The bias term of i is the vector corresponding to the sentence to be labeled; y is the label sequence with the highest probability;

[0138] Step 3.2: Based on the Viterbi algorithm, the labeling sequence with the maximum probability of each word in the output state sequence H is calculated as the result of entity recognition, thereby completing entity recognition.

[0139] Working principle of the present invention:

[0140] Feature vector training is performed on the electronic medical record data to obtain the feature vector of the electronic medical record data; based on the bidirectional Lattice LSTM encoding model, the feature vector is bidirectionally encoded to obtain the output state sequence of the electronic medical record data; based on the transfer characteristics of the CRF model, the output state sequence is labeled and ranked by probability to obtain the result of entity recognition, thereby completing entity recognition.

[0141] In summary, the entity recognition method of Chinese electronic medical records based on the Lattice LSTM model of the present invention solves the shortcomings of traditional Chinese electronic medical record named entity recognition. The Lattice LSTM model utilizes explicit word information, uses the BERT pre-trained language model to integrate the context-related representation of characters, represents the polysemy of characters, and introduces external dictionary resources in the medical field, which not only improves the recognition effect of the model, but also has a certain ability to discover unregistered words.

[0142] Although the content of the present invention has been described in detail through the above preferred embodiments, it should be appreciated that the above description should not be considered as a limitation of the present invention. After reading the above content, it will be apparent to those skilled in the art that various modifications and substitutions of the present invention will occur. Therefore, the protection scope of the present invention should be limited by the appended claims.

Claims

1. An entity recognition method for Chinese electronic medical records based on the Lattice LSTM model, It is characterized in that The following steps are involved: Step 1: Perform feature vector training on the electronic medical record data to obtain the feature vector of the electronic medical record data; The feature vector training comprises the following steps: Step 1.1: Construct a dictionary containing both general text and medical professional vocabulary; Step 1.2: preprocessing the electronic medical record data to obtain preprocessed electronic medical record data; The pre-processing comprises the following steps: Step 1.2.1: De-privacy processing is performed on the electronic medical record data to obtain de-privacy case data from which patient privacy information is removed; Step 1.2.2: Perform sentence fragment processing on the deprived case data to obtain processed electronic case data; Step 1.2.3: Based on the regular matching method, the processed electronic medical record data is filtered and cleaned to obtain filtered electronic medical record data; Step 1.2.4: annotating the filtered electronic medical record data to obtain pre-processed electronic medical record data; Step 1.3: Based on the BERT pre-trained language model, perform word vector training on the pre-processed electronic medical record data to obtain word feature vectors of the electronic medical record data; Step 1.3.1: Read the character sequence in the preprocessed electronic medical record data; Step 1.3.2: The BERT pre-trained language model performs character mapping on the word sequence one by one to obtain a word input vector of the BERT pre-trained language model; Step 1.3.3: Perform feature training on the word input vector and output the word feature vector; Step 1.4: Perform word vector training based on the dictionary combination and the word sequence in the preprocessed electronic medical record data to obtain a word feature vector for each word sequence in the electronic medical record data vector; Step 1.5: performing feature fusion on the character feature vector and the word feature vector to obtain a feature vector of the electronic medical record data; Step 2: Based on the bidirectional Lattice LSTM encoding model, the feature vector is bidirectionally encoded to obtain an output state sequence of the electronic medical record data; The bidirectional feature vector encoding comprises the following steps: Step 2.1: Based on the sigmoid activation function and the Lattice LSTM encoding model, the feature vector is encoded as a word vector to obtain a word output vector of the electronic medical record data; Step 2.1.1: Based on the sigmoid activation function and the Lattice LSTM encoding model, the feature vector is encoded to obtain an input gate at each index position, a forget gate at each index position, an output gate at each index position, and a candidate value at each index position; Step 2.1.2: Calculate the memory unit of each index position according to the input gate of each index position, the forget gate of each index position and the candidate value of each index position; Step 2.1.3: Calculate the word output vector of each index position according to the output gate of each index position and the memory unit of each index position; Step 2.2: Based on the Lattice LSTM encoding model, the feature vector is encoded with a word vector to obtain a word output vector of the electronic medical record data; Step 2.3: performing feature vector fusion according to the word output vector and the feature vector to obtain an updated feature vector of the electronic medical record data; The feature vector fusion comprises the following steps: Step 2.3.1: performing vector fusion on the feature vector and the word output vector to obtain a gating unit of the word output vector; Step 2.3.2: According to the gating unit and the feature vector, normalized weight calculations are performed on the character granularity information and the word granularity information, respectively, to obtain the character granularity weight of each index position and the word granularity weight of each index position; Step 2.3.3: performing vector update on the word output vector and the feature vector according to the character granularity weight of each index position and the word granularity weight of each index position, and calculating the updated feature vector of each index position; Step 2.4: Based on the Lattice LSTM encoding model, the updated feature vector and the feature vector are respectively unidirectionally encoded and reversely encoded in the hidden layer to obtain a unidirectional feature vector and a reverse feature vector of the electronic medical record data; Step 2.5: Concatenate the unidirectional feature vector and the reverse feature vector to obtain the bidirectional feature vector of the electronic medical record data, thereby calculating the output state sequence of the electronic medical record data; Step 3: Based on the transfer characteristics of the CRF model, sort the output state sequence by labeling probability, obtain the result of entity recognition, and complete entity recognition.

2. The entity recognition method for Chinese electronic medical records based on the Lattice LSTM model as claimed in claim 1, It is characterized in that The dictionary construction comprises the following steps: Step 1.1.1: Obtain Chinese Wikipedia corpus and medical word segmentation dictionary respectively; Step 1.1.2: Based on the Word2Vec pre-trained language model, perform Jieba word segmentation training on the Chinese Wikipedia corpus to obtain the Wikipedia word vector; Step 1.1.3: Performing improved word segmentation training on the medical word segmentation dictionary to obtain a medical word segmentation word vector; Step 1.1.4: Perform a dictionary combination on the Wikipedia word vector and the medical word segmentation word vector to obtain the dictionary combination.

3. The entity recognition method for Chinese electronic medical records based on the Lattice LSTM model as claimed in claim 1, It is characterized in that The residual sentence processing includes completing missing sentences in the private case data, deleting erroneous sentences in the private case data, and segmenting overly long sentences in the private case data.

4. The entity recognition method for Chinese electronic medical records based on the Lattice LSTM model as claimed in claim 1, It is characterized in that The labeling probability sorting comprises the following steps: Step 3.1: perform entity sequence labeling on the output state sequence to obtain the probability of the sentence label in the output state sequence; Step 3.2: Based on the Viterbi algorithm, the labeling sequence with the highest probability for each sentence in the output state sequence is calculated as the result of entity recognition, thereby completing entity recognition.