A semantic segmentation method for Chinese electronic medical record text based on deep learning
Through a deep learning-based method, combining semantic dictionary and pre-trained language model, the semantic features of text and characters are obtained and fused, the problem of semantic segmentation of Chinese electronic medical records is solved, and the high-accurate text segmentation and medical data structure is achieved. change.
Patent Information
- Application Number
- CN202210052863.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-18
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-01-18
AI Technical Summary
The prior art is difficult to effectively segment text semantics of Chinese electronic medical records, resulting in the inability to accurately structure medical data, affecting medical data analysis and clinical decision-making.
Using a deep learning-based method, the text semantic feature vector is obtained by building a semantic dictionary and pre-trained language model, and combined with the character semantic position characteristics, it is input into a deep neural network for training to realize text semantic segmentation.
It improves the accuracy and efficiency of semantic segmentation of Chinese electronic medical records, can achieve higher segmentation accuracy when the data set is small, and supports structured and intelligent analysis of medical data.
Smart Images

Figure CN114417836B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a text semantic segmentation method based on deep learning in the field of natural language processing, belonging to the technical field of medical text data mining, and in particular to a Chinese electronic medical record text semantic segmentation method. Background Art
[0002] At present, deep learning-based methods have promoted the continuous development of natural language processing technology, and have been successfully applied to typical scenarios including text classification, human-computer dialogue, intelligent services, text translation, and natural language reasoning, helping us understand and process natural language and text and obtain a large amount of valuable information.
[0003] With the deep integration of natural language processing technology and medicine, smart medical care has achieved a series of new results in clinical auxiliary diagnosis and treatment, medical data mining, and disease risk assessment. The new methods used in these results are highly dependent on massive amounts of real, accurate, and reliable structured diagnosis and treatment data. Medical records contain a lot of professional medical knowledge. However, clinical electronic medical records are usually designed to be mainly for recording rather than for scientific research. Clinical data are recorded in their original form, but there is no processing of the information for research and application. Hospitals cannot directly use the information in electronic medical records, let alone use it to serve clinical diagnosis and treatment. Therefore, structuring unstructured medical data becomes a necessary and critical step. Considering the huge amount of data, if it is structured manually, the economic cost will undoubtedly be very high. Therefore, using natural language processing technology to automatically extract structured clinical information from electronic medical records is an ideal choice.
[0004] The medical text semantic segmentation method and system is a system that can automatically segment and extract sentence segments describing symptoms, examinations, patient status, and treatment diagnoses, which has a significant impact on the performance of the electronic medical record structuring system. The accuracy of information segmentation has a fundamental impact on the subsequent medical data analysis process. Therefore, a good semantic segmentation system can help improve the accuracy of medical record structuring, and can also serve medical data mining, clinical decision support, clinical risk assessment, etc. more efficiently and accurately. At present, there is no semantic segmentation method and system specifically optimized for electronic medical records.
[0005] On the other hand, in the field of semantic segmentation, image semantic segmentation is an important part of image processing and machine vision technology in image understanding, and is also an important branch in the field of AI. Semantic segmentation is to classify each pixel in the image, determine the category of each point (such as background, person or car, etc.), and then divide the area. At present, semantic segmentation has been widely used in scenes such as autonomous driving and drone landing point determination.
[0006] The Fully Convolutional Networks (FCN) is one of the outstanding models in the field of image semantic segmentation. This model replaces the several fully connected layers behind CNN with convolutions, so that a 2D feature map can be obtained, followed by softmax to obtain the classification information of each pixel, thus solving the segmentation problem. FCN has become the basic framework of semantic segmentation. These related studies provide a good reference and inspiration for using FCN for text semantic segmentation.
[0007] Semantic segmentation based on the FCN architecture cannot get rid of the encoder's need to downsample the input feature map, and one of the characteristics of the Transformer is that it can maintain the spatial resolution of the input and output unchanged, while also effectively capturing global contextual information. Therefore, the use of similar structures for feature extraction and semantic segmentation has gradually surfaced. In order to solve the problem of text semantic segmentation, this paper designs an algorithm and model suitable for text semantic segmentation to address the problems of local receptive field and inaccurate contextual semantic expression in current research, which is of great significance to the study of medical record text. Summary of the invention
[0008] The purpose of this patent is to perform semantic segmentation on text and propose a text semantic segmentation model and text semantic segmentation system. This patent combines the idea of image semantic segmentation to construct character context semantic information, thereby realizing refined text semantic segmentation of different semantic information in large texts to facilitate natural language understanding and structuring of natural text.
[0009] To achieve the above object, the present invention adopts the following technical solution:
[0010] A Chinese electronic medical record text semantic segmentation method based on deep learning includes the following steps:
[0011] Step 1: Build medical dataset and semantic dictionary
[0012] Select an original data set; use an extractor to preprocess the original data set to obtain a number of training data samples, use the aforementioned several training data samples as training data sets, and perform semantic category labeling on the training data samples according to rules; count the statistical data character set, input the characters into the semantic dictionary constructed by the pre-training model, and represent each character as a vector of fixed dimension;
[0013] Step 2: Obtain text semantic feature vector
[0014] Based on the semantic dictionary obtained in step 1, generate text feature vectors in the order of text sequence;
[0015] Step 3: Fusion of semantic position features
[0016] Combine the text position feature of the character with the text semantic feature vector obtained in step 2 into an overall feature;
[0017] Step 4: Input the overall features into the deep neural network for parameter training;
[0018] Step 5: Use the trained deep neural network model to perform semantic segmentation on the test samples.
[0019] As a preferred method, in step 2, text vector representation is first performed to vectorize the text, that is, given a text sequence S = (c1, c2, ..., c n ), n is the total number of characters in the text, c i is the i-th character in text S, then the text vector is represented by T(S)=A. Where A=(a 1 ,a 2 ,…,a n ), a i c i The m-dimensional character vector is obtained through the SEG semantic dictionary constructed by the BERT_wwm pre-training model. The maximum input sequence Max_length is set considering the laboratory equipment configuration. According to the variable-length text, the text features beyond the maximum sequence are integrated, and multi-segment segmentation data enhancement is performed to obtain the feature vector representation of the text.
[0020] As a preferred method, in step 3, in order to solve the problem that position information is not considered in self-attention and to more accurately distinguish the semantic features of characters, we add a unique semantic position vector e to each position in the text. i , by the transfer matrix and p i Multiply them together to get, where p i For each c of the text i The corresponding one-hot encoding vector. Then the semantic position vector e i With text vector a i The sum is then input into the self-attention layer for feature learning.
[0021] Preferably, the deep neural network in step 4 is composed of the following parts: the embedding layer uses BERT_wwm to map the text into a vector form for input into the model; the Transformer Encoder layer first fuses the input vector with the learnable semantic position vector feature, learns the features between characters through the multi-head self-attention layer, no longer appends CLS, and regards each text word vector as valid information for classification prediction, which is then normalized through the feedforward neural network layer, and the semantic information of each character is obtained through LinearScore to capture the category characteristics of each character in the sequence; the Prediction layer is used for decoding to find the best semantic category label for each character.
[0022] Preferably, step 5 performs semantic segmentation of the Chinese electronic medical record by using the semantic category of each character, wherein characters belonging to the same category are classified into the same semantic segment; in addition, by analyzing the medical record, short sentences separated by commas or periods usually represent a partially complete semantic part, so when the character is a comma or a period, the semantic category follows the previous character; when several adjacent characters c in a short sentence are i ,c i+1 ,…,c i+j When there are different semantic categories, the sentence category with the largest number of characters is used as the short sentence category.
[0023] The present invention represents the semantic features of the text context through a pre-trained language model, and adds the semantic position features of the characters, and inputs the combined overall features into a deep neural network for model training. The marker features of the comparison samples are used for residual calculation, and the performance of the entire deep architecture is optimized and adjusted through supervised fine-tuning. In the testing phase, the test samples are input into the deep neural network, and the idea of layer-by-layer training in deep learning is used. After the input features are linearly changed, they are input into the top-level classifier, the classification probability is calculated, and the final classification result is obtained. The method of the present invention makes full use of the characteristics of deep learning for deep optimization of features, and at the same time adds semantic position features, so as to achieve a higher accuracy of text semantic segmentation when the data set is small. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a schematic diagram of the overall structure of a Chinese electronic medical record semantic segmentation method based on deep learning in the present invention;
[0025] Figure 2 A schematic diagram of the structure of the semantic dictionary of the present invention;
[0026] Figure 3 It is a schematic diagram of the text semantic feature representation process of the present invention;
[0027] Figure 4Schematic diagram of the model structure of the deep neural network of the present invention;
[0028] Figure 5 This is a schematic diagram of the training process of the Chinese electronic medical record semantic segmentation method based on deep learning in the present invention. DETAILED DESCRIPTION
[0029] The features and implementation processes of various aspects of the present invention will be described in detail below. The following description covers many specific details in order to provide a comprehensive understanding of the present invention. However, it will be apparent to those skilled in the art that the present invention can be implemented without the need for some of these specific details. The following process description is only intended to provide a clearer understanding of the present invention by illustrating examples of the present invention. The present invention is by no means limited to any specific configuration and algorithm proposed below, but covers any modification, replacement and improvement of related elements, parts and algorithms without departing from the spirit of the present invention.
[0030] In order to solve the problem of text semantic segmentation, the present invention designs a method suitable for Chinese electronic medical record text semantic segmentation in view of the problems of local receptive field, context information and context semantics in current research. The present invention will be described in detail below in conjunction with the specific implementation methods shown in the accompanying drawings.
[0031] The overall structure diagram of the present invention is as follows Figure 1 As shown in Figure 1, the Chinese electronic medical record semantic segmentation method based on deep learning includes semantic dictionary construction and text semantic feature vector representation, overall feature fusion and deep neural network training. Their functions are as follows: semantic dictionary construction and text semantic feature vector representation of part of the statistical data character set, input the characters into the pre-trained model to build a semantic dictionary, represent each character as a vector of fixed dimension, generate text feature vectors according to the semantic dictionary in the order of text sequence, and the semantic dictionary construction structure diagram is shown in Figure 1. Figure 2 As shown in the figure, the overall feature fusion part combines the character semantic position feature with the context text semantic feature obtained in the previous step into the overall feature. The text semantic feature representation flow chart is shown in Figure 3 As shown in the figure, the deep neural network training part inputs the overall features into the deep neural network for parameter training, and finally uses the trained deep neural network model to perform semantic segmentation of Chinese electronic medical records. The model structure diagram of the deep neural network is shown in the figure. Figure 4 shown.
[0032] A Chinese electronic medical record semantic segmentation method based on deep learning of the present invention comprises the following steps:
[0033] Step 1: Build medical dataset and semantic dictionary
[0034] Count the statistical character set, input the characters into the semantic dictionary constructed by the pre-trained model, and represent each character as a vector of fixed dimension;
[0035] Step 2: Obtain text semantic feature vector
[0036] Based on the semantic dictionary obtained in step 1, generate text feature vectors in the order of text sequence;
[0037] Step 3: Fusion of semantic position features
[0038] Combine the text position feature of the character with the text semantic feature vector obtained in step 2 into an overall feature;
[0039] Step 4: Input the overall features into the deep neural network for parameter training;
[0040] Step 5: Use the trained deep neural network model to perform semantic segmentation on the test samples.
[0041] In step 2, the text is first represented by a vector and the text is vectorized. That is, given a text sequence S = (c1, c2, ..., c n ), n is the total number of characters in the text, c i is the i-th character in text S, then the text vector is represented by T(S)=A. Where A=(a 1 ,a 2 ,…,a n ), a i c i The m-dimensional character vector is obtained through the SEG semantic dictionary constructed by the BERT_wwm pre-training model. The maximum input sequence Max_length is set considering the laboratory equipment configuration. According to the variable-length text, the text features beyond the maximum sequence are integrated, and multi-segment segmentation data enhancement is performed to obtain the feature vector representation of the text.
[0042] In step 3, in order to solve the problem that position information is not considered in self-attention and to more accurately distinguish the semantic features of characters, we add a unique semantic position vector e to each position in the text. i , by the transfer matrix and p i Multiply them together to get, where p i For each c of the text i The corresponding one-hot encoding vector. Then the semantic position vector e i With text vector a i The sum is then input into the self-attention layer for feature learning.
[0043] The deep neural network in step 4 consists of the following parts: the embedding layer uses BERT_wwm to map the text into a vector form for input into the model; the Transformer Encoder layer first fuses the input vector with the learnable semantic position vector features, and learns the features between characters through the multi-head self-attention layer. Instead of appending CLS, each text word vector is regarded as valid information for classification prediction, which is then normalized through the feedforward neural network layer, and the semantic information of each character is obtained through LinearScore to capture the category characteristics of each character in the sequence; the Prediction layer is used for decoding to find the best semantic category label for each character.
[0044] Step 5: Semantic segmentation of Chinese electronic medical records is performed by using the semantic category of each character, where characters belonging to the same category are classified into the same semantic segment. In addition, by analyzing the medical records, short sentences separated by commas or periods usually represent a partially complete semantic part, so when a character is a comma or a period, the semantic category follows the previous character. When several adjacent characters c in a short sentence are i ,c i+1 ,…,c i+j When there are different semantic categories, the sentence category with the largest number of characters is used as the short sentence category.
[0045] The present invention represents the semantic features of the text context through a pre-trained language model, and adds the semantic position features of the characters, and inputs the combined overall features into a deep neural network for model training. The marker features of the comparison samples are used for residual calculation, and the performance of the entire deep architecture is optimized and adjusted through supervised fine-tuning. In the testing phase, the test samples are input into the deep neural network, and the idea of layer-by-layer training in deep learning is used. After the input features are linearly changed, they are input into the top-level classifier, the classification probability is calculated, and the final classification result is obtained. The method of the present invention makes full use of the characteristics of deep learning for deep optimization of features, and at the same time adds semantic position features, so as to achieve a higher accuracy of text semantic segmentation when the data set is small.
[0046] The present invention is based on the deep learning Chinese electronic medical record semantic segmentation training process as follows Figure 5As shown. Assuming that the purpose of training is to describe the current medical history in a Chinese electronic medical record, such as "the patient has certain symptoms at a certain time, and after certain examinations and corresponding treatments, what is his current mental state", etc., the entire sentence to be trained is segmented with characters as the basic unit. The vector representation of each character is found in the semantic dictionary, which is an m-dimensional vector. They are connected in the order of the text sequence to form a context n*m feature matrix. The acquired context features are fused with the character semantic position vector as the overall feature to form an n*m overall feature matrix. The overall feature is input into the deep neural network for parameter training, the residual calculation is performed by comparing the label features of the sample, and then supervised fine-tuning is performed to optimize the performance of the entire deep architecture. After the model is trained, the context features corresponding to the test sample are input into the model to obtain the output result. The semantic segmentation method of the present invention has been described in detail with reference to the accompanying drawings above. As mentioned above, the present invention applies deep learning technology to text semantic segmentation, and at the same time, the character semantic position features are added to the text semantic features, and the overall features are used to train the model of the deep neural network. Compared with the existing semantic segmentation technology, the present invention constructs global contextual semantic information between characters, captures the category characteristics of each character in the sequence, and finally finds the best semantic category label for each character, thereby realizing refined text semantic segmentation and developing a new method for EMR text semantic segmentation.
[0047] It should be understood that the present invention is not limited to the specific configurations and processing methods described above and shown in the figures. Moreover, for the sake of simplicity, a detailed description of known methods and techniques is omitted here. In the above method, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order of the steps to combine them after understanding the spirit of the present invention.
[0048] The present invention may be implemented in other specific forms without departing from its spirit and essential features. For example, the algorithm described in the present invention may be modified, and the system architecture does not depart from the basic spirit of the present invention. Therefore, the present methods are regarded as exemplary and non-restrictive in all aspects, and they are not used to limit the scope of protection of the present invention. All equivalent implementations or changes made without departing from the spirit of the present invention should be included in the scope of protection of the present invention.
Claims
1. A Chinese electronic medical record semantic segmentation method based on deep learning, characterized by: The method comprises the following steps: Step 1: Build medical dataset and semantic dictionary; Select an original data set; use an extractor to preprocess the original data set to obtain a number of training data samples, use the aforementioned several training data samples as training data sets, and perform semantic category labeling on the training data samples according to rules; count the statistical data character set, input the characters into the semantic dictionary constructed by the pre-training model, and represent each character as a vector of fixed dimension; Step 2: Obtain text semantic feature vector; Based on the semantic dictionary obtained in step 1, generate text feature vectors in the order of text sequence; Step 3: Fusion of semantic position features; Combine the text position feature of the character with the text semantic feature vector obtained in step 2 into an overall feature; Step 4: Input the overall features into the deep neural network for parameter training; Step 5: Use the trained deep neural network model to perform semantic segmentation on the test sample; The pre-trained language model is used to represent the semantic features of the text, and the character semantic position features are added to construct the global contextual semantic features between characters. The semantic category characteristics of each character in the sequence are captured and learned, and finally the best semantic category label for each character is found, thereby achieving refined text semantic segmentation. A Chinese electronic medical record semantic segmentation method based on deep learning, including semantic dictionary construction and text semantic feature vector representation, overall feature fusion, deep neural network training and prediction optimization. The pre-trained language model is used to represent the text context semantic features, and the character semantic position features are added. The fused overall features are input into the deep neural network for model training. Considering the problem of character semantic position information, in order to more accurately distinguish the semantic features of characters, a unique semantic position vector e is added to each position in the text i , by the transfer matrix and p i Multiply them together to get, where p i For each c of the text i The corresponding one-hot encoding vector; then the semantic position vector e i With text vector a i The sum is then input into the self-attention layer for feature learning; c i is the i-th character of the text; The deep neural network consists of the following parts: The embedding layer uses BERT_wwm to map the text into vector form for input into the model; The Transformer Encoder layer first fuses the input vector with the learnable semantic position vector features, and learns the features between characters through the multi-head self-attention layer. Instead of appending CLS, each text word vector is regarded as valid information for classification prediction. It is then normalized through the feedforward neural network layer, and the semantic information of each character is obtained through LinearScore to capture the category characteristics of each character in the sequence; the Prediction layer is used for decoding to find the best semantic category label for each character.
Citation Information
Patent Citations
A hierarchical BiLSTM Chinese electronic medical record disease code labeling method capable of enhancing semantic representation
CN109697285A
N-gram-based BERT model and semantic segmentation method
CN111553147A