Medical text recognition method and device, electronic equipment and storage medium

By using a BiLSTM network model for medical text recognition, the problem of complex and inefficient entity and relationship recognition in existing technologies is solved, and efficient and accurate entity and relationship recognition is achieved in the same model.

CN115600133BActive Publication Date: 2026-04-14WEST CHINA HOSPITAL SICHUAN UNIV +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-09
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing medical text recognition models suffer from problems such as complex structure, low efficiency, and low accuracy in entity and relation recognition, especially due to high model sensitivity caused by human annotation errors.

Method used

A BiLSTM network model is used for medical text recognition. By preprocessing text vectors and simultaneously recognizing entities and relationships in the same model, the pre-trained BiLSTM network model is used for entity and relationship recognition, combined with multiplicative attention mechanism and linear projection technique.

Benefits of technology

It reduces model complexity, improves recognition efficiency and accuracy, reduces errors caused by text defects, and achieves simultaneous recognition of entities and relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115600133B_ABST
    Figure CN115600133B_ABST
Patent Text Reader

Abstract

The application provides a medical text recognition method and device, electronic equipment and a computer readable storage medium, and relates to the field of neural networks. The medical text recognition method comprises: obtaining a text vector, the text vector being obtained based on to-be-recognized medical text; determining, by using a pre-trained BiLSTM network model, an entity included in the to-be-recognized medical text or a relationship between the entities based on the text vector. Therefore, entity recognition and relationship recognition in medical text can be performed in the same model framework, and end-to-end output can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of neural networks, and more particularly to a medical text recognition method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] In today's society, although people's living standards have greatly improved, some diseases that were not common in the past are now gradually increasing. The causes of these diseases are complex and the symptoms are diverse. Therefore, it is becoming increasingly important to extract effective information from medical texts such as medical history and discharge summaries to analyze the causes of these diseases.

[0003] In the process of recognizing medical text, a common approach is to encode words or single characters and then use neural networks to identify them to obtain entity or relationship recognition results. However, due to the existence of relationships between entities, overlap between entities, and overlap between relationships, existing recognition models sometimes fail to identify certain cases. Furthermore, manual annotation often results in omissions or errors, leading to inherent textual problems. Models trained on text with these omissions and errors are highly sensitive to them, resulting in low accuracy.

[0004] Existing methods for text recognition require entity recognition and relation recognition to be performed separately, using different models for each. This results in complex model structures for simultaneously recognizing entities and relations. Furthermore, the need to perform entity recognition before relation recognition leads to low recognition efficiency. Summary of the Invention

[0005] The purpose of this invention is to provide a medical text recognition method, device, electronic device, and computer-readable storage medium to improve the problem of complex model structures in the prior art that simultaneously recognize entities and relationships.

[0006] The embodiments of the present invention are implemented as follows:

[0007] In a first aspect, embodiments of this application provide a medical text recognition method, comprising: obtaining a text vector, wherein the text vector is obtained based on the medical text to be recognized;

[0008] The pre-trained BiLSTM network model determines the entities or relationships between the entities included in the medical text to be identified based on the text vectors.

[0009] In this embodiment of the application, by inputting the text vector of the medical text to be identified into a pre-trained BiLSTM network model, entity recognition and relationship recognition can be performed in the same model. Compared with the prior art, there is no need to model entity recognition and relationship recognition separately, which can reduce the complexity of the model to a certain extent.

[0010] In one embodiment, obtaining the text vector includes: obtaining the medical text to be identified; preprocessing the medical text to be identified to obtain preprocessed text; and encoding the preprocessed text to obtain the text vector.

[0011] In this embodiment of the application, by preprocessing the medical text to be recognized, obtaining the preprocessed text, and encoding the preprocessed text, it is helpful to make the input text conform to the requirements of the BiLSTM network model and be recognized by the BiLSTM network model. This reduces recognition errors caused by text defects in the recognition process and improves recognition accuracy.

[0012] In one embodiment, the preprocessing of the medical text to be identified includes: truncating the medical text to be identified according to a preset length to obtain the preprocessed text.

[0013] In this embodiment of the application, by truncating the medical text to be recognized according to a preset length, the efficiency of text encoding can be improved; at the same time, the problem of reduced recognition efficiency due to excessively long text can be avoided during recognition.

[0014] In one embodiment, encoding the preprocessed text to obtain the text vector includes: encoding the preprocessed text to obtain an initial text vector; and projecting the initial text vector into a low-dimensional space to obtain the text vector.

[0015] In this embodiment, the preprocessed text is encoded to obtain an initial text vector; and the initial text vector is projected into a low-dimensional space to obtain a text vector for inputting into the BiLSTM network model. This reduces the complexity requirements of the BiLSTM network model and decreases the difficulty of building the model.

[0016] In one embodiment, the step of obtaining the pre-trained BiLSTM network model includes: constructing an initial BiLSTM neural network; training the initial BiLSTM neural network using pre-obtained training samples to obtain the pre-trained BiLSTM network model, wherein the training samples are medical records pre-labeled with entities and entity relationships; and determining the trained BiLSTM network model as the pre-trained BiLSTM network model when the f1 value for entity recognition using the trained BiLSTM network model is greater than a first threshold and the f1 value for relationship recognition using the trained BiLSTM network model is greater than a second threshold.

[0017] In one embodiment, determining the entities or relationships between entities in the medical text to be identified based on the text vector using a pre-trained BiLSTM network model includes: obtaining a first text state by using a multiplicative attention mechanism with the initial hidden state of the pre-trained BiLSTM network model and the text vector; concatenating the first text state with a pre-determined initial semantic state to obtain a first semantic state; inputting the first semantic state, the initial hidden state, and the initial cell state of the pre-trained BiLSTM network model into the pre-trained BiLSTM network model to obtain a first hidden state; injecting the first hidden state into the text vector to obtain a first identification vector, wherein the first identification vector is the vector obtained by injecting the hidden state into the text vector; performing a linear projection on the first identification vector to obtain a first entity start position vector and a first entity end position vector; and inputting the first entity start position vector and the first entity end position vector into the text vector. The first hidden state is concatenated with the first hidden state to obtain a first concatenated vector; the first concatenated vector is linearly projected to obtain a first entity category; a second text state is obtained based on the first hidden vector and the text vector through a multiplicative attention mechanism; the second text state is concatenated with the first semantic state to obtain a second semantic state; the second semantic state and the first hidden state are input into the pre-trained BiLSTM network model to obtain a second hidden state; the second hidden state is injected into the text vector to obtain a second vector to be identified; the second vector to be identified is linearly projected to obtain a second entity start position vector and a second entity end position vector; the second entity start position vector and the second entity end position vector are concatenated with the second hidden state to obtain a second concatenated vector; the second concatenated vector is linearly projected to obtain a second entity category; this process is repeated until the currently obtained entity category is determined to be a preset entity category, where the preset entity category is the end marker.

[0018] In one embodiment, determining the entities or relationships between the entities included in the medical text to be identified based on the text vector using the pre-trained BiLSTM network model includes: obtaining the first text state based on the initial hidden state of the pre-trained BiLSTM network model and the text vector through a multiplicative attention mechanism;

[0019] The first text state is concatenated with a predetermined initial semantic state to obtain the first semantic state;

[0020] The first semantic state, the initial hidden state, and the initial cell state of the pre-trained BiLSTM network model are input into the pre-trained BiLSTM network model to obtain the first hidden state;

[0021] The first hidden state is injected into the text vector to obtain the first vector to be identified;

[0022] Linear projection is performed on the first vector to be identified to obtain the first entity start position vector and the first entity end position vector;

[0023] The first concatenated vector is obtained by concatenating the start position vector of the first entity and the end position vector of the first entity.

[0024] The first spliced ​​vector is used to obtain the second entity start position vector and the second entity end position vector through the pre-trained BiLSTM network model;

[0025] The first entity start position vector, the first entity end position vector, the second entity start position vector, and the second entity end position vector are concatenated to obtain the first relationship concatenation vector.

[0026] Perform a linear projection on the first relation concatenation vector to obtain the first relation category;

[0027] This process continues until the obtained relationship category is determined to be a preset relationship category, which serves as the terminator.

[0028] A second aspect provides a medical text recognition device, comprising: an acquisition module for acquiring text vectors, the text vectors being obtained based on medical text to be recognized; and a determination module for determining, based on the text vectors, the entities included in the medical text to be recognized and the relationships between the entities, using a pre-trained BiLSTM network model.

[0029] In one embodiment, the acquisition module is specifically used to: acquire the medical text to be identified; preprocess the medical text to be identified to obtain preprocessed text; and encode the preprocessed text to obtain the text vector.

[0030] In one embodiment, the acquisition module is further configured to truncate the medical text to be identified according to a preset length to obtain the preprocessed text.

[0031] In one embodiment, the acquisition module is further configured to encode the preprocessed text to obtain an initial text vector; and project the initial text vector into a low-dimensional space to obtain the text vector.

[0032] In one embodiment, the medical text recognition device further includes a construction module for constructing an initial BiLSTM neural network; training the initial BiLSTM neural network using pre-obtained training samples, wherein the training samples are medical records pre-labeled with entities and entity relationships; and determining the trained BiLSTM network model as the pre-trained BiLSTM network model when the f1 value for entity recognition using the trained BiLSTM network model is greater than a first threshold and the f1 value for relationship recognition using the trained BiLSTM network model is greater than a second threshold.

[0033] In one embodiment, the determining module is specifically configured to: obtain a first text state based on the initial hidden state of the pre-trained BiLSTM network model and the text vector through a multiplicative attention mechanism; concatenate the first text state with a pre-determined initial semantic state to obtain a first semantic state; input the first semantic state, the initial hidden state, and the initial cell state of the pre-trained BiLSTM network model into the pre-trained BiLSTM network model to obtain a first hidden state; inject the first hidden state into the text vector to obtain a first vector to be identified; perform linear projection on the first vector to be identified to obtain a first entity start position vector and a first entity end position vector; concatenate the first entity start position vector and the first entity end position vector with the first hidden state to obtain a first concatenated vector; and perform linear projection on the first concatenated vector. The process involves: obtaining a first entity category; obtaining a second text state based on the first hidden vector and the text vector using a multiplicative attention mechanism; concatenating the second text state with the first semantic state to obtain a second semantic state; inputting the second semantic state and the first hidden state into the pre-trained BiLSTM network model to obtain a second hidden state; injecting the second hidden state into the text vector to obtain a second entity vector to be identified; performing a linear projection on the second entity vector to obtain a second entity start position vector and a second entity end position vector; concatenating the second entity start position vector and the second entity end position vector with the second hidden state to obtain a second concatenated vector; performing a linear projection on the second concatenated vector to obtain a second entity category; and so on, until the obtained entity category is determined to be a preset entity category, where the preset entity category is the end marker.

[0034] In one embodiment, the determining module is further configured to: obtain a first text state based on the initial hidden state of the pre-trained BiLSTM network model and the text vector through a multiplicative attention mechanism; concatenate the first text state with a pre-determined initial semantic state to obtain a first semantic state; input the first semantic state, the initial hidden state of the pre-trained BiLSTM network model, and the initial cell state into the pre-trained BiLSTM network model to obtain a first hidden state; inject the first hidden state into the text vector to obtain a first vector to be identified; and perform linear projection on the first vector to be identified to obtain a first entity open... The process begins by generating a start position vector and a first entity end position vector. These start and end vectors are then concatenated to obtain a first concatenated vector. This first concatenated vector is then processed through a BiLSTM network model to obtain a second entity start position vector and a second entity end position vector. The first entity start position vector, the first entity end position vector, the second entity start position vector, the second entity end position vector, and the first hidden vector are then concatenated to obtain a first relation concatenated vector. A linear projection is then performed on this first relation concatenated vector to obtain a first relation category. This process is repeated until a predetermined relation category is determined to be the end-of-relationship category.

[0035] Thirdly, this application also provides an electronic device, including a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor performs the aforementioned medical text recognition method.

[0036] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed on a computer, causes the computer to perform a medical text recognition method.

[0037] Other features and advantages of this disclosure will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.

[0038] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments of the present invention are described in detail below with reference to the accompanying drawings. Attached Figure Description

[0039] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 A flowchart illustrating a medical text recognition method provided in one embodiment of this application;

[0041] Figure 2 A schematic diagram of the structure of a medical text recognition device provided in an embodiment of this application;

[0042] Figure 3 This is a structural block diagram of an electronic device provided in an embodiment of this application.

[0043] The reference numerals are as follows: Medical Text Recognition Device - 200; Acquisition Module - 210; Determination Module - 220. Detailed Implementation

[0044] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0045] Please see Figure 1 The present application provides a flowchart of a medical text recognition method according to an embodiment. This medical text recognition method may include the following steps.

[0046] Step S110: Obtain the text vector, which is based on the medical text to be identified.

[0047] In this embodiment, the medical text to be identified can be texts such as the patient's discharge summary and medical records, which can provide information about the patient's treatment.

[0048] In one embodiment, the text vector can be obtained in the following manner.

[0049] First, the medical text to be identified is obtained. It should be noted that the medical text to be identified can be obtained through image recognition based on patient medical records, discharge summaries, and other image data. This medical text can be pre-stored locally or in the cloud; therefore, it can be retrieved directly from either location.

[0050] Then, preprocess the medical text to be recognized to obtain a preprocessed text. In one embodiment, preprocessing the medical text to be recognized may be truncating the preprocessed text according to a preset length. By truncating the medical text to be recognized according to the preset length, the efficiency of text encoding in subsequent processes can be relatively high; at the same time, during subsequent recognition, the problem of reduced recognition efficiency caused by too long text can be avoided. Specifically, for a text with a length greater than the preset length, it is truncated according to the preset length using a specific symbol (e.g., a full stop or a semicolon, etc.). The preset length is less than or equal to 500 character lengths. For example, the preset length can be 100 character lengths, 200 character lengths, 300 character lengths, 400 character lengths, 500 character lengths, or any character length between any two of them. In this embodiment, the length of the preprocessed text can be represented by L. In one embodiment, the tokenizer of the BERT model can be used to truncate the preprocessed text according to the preset length. In addition, preprocessing the medical text to be recognized may also include using the tokenizer of the BERT model to perform lowercase conversion and word segmentation on the preprocessed text, etc.

[0051] Next, encode the preprocessed text to obtain a text vector. In one embodiment, the BERT model can be used to encode the preprocessed text to obtain a text vector. The parameters of the BERT model can be initialized using bert-wwm-ext open-sourced by Harbin Institute of Technology. In another embodiment, encoding the preprocessed text to obtain a text vector may include encoding the preprocessed text to obtain an initial text vector (e.g., which can be represented as enc_hs_1, with a dimension of (L, D), where D is the dimension of the embedding space); and projecting the initial text vector into a low-dimensional space to obtain the text vector (e.g., which can be represented as enc_hs, with a dimension of (L, d), where d < D). Thereby, the requirement for the complexity of the network model for recognition can be reduced, and the difficulty of building the model can be decreased.

[0052] It can be understood that in other embodiments, the text vector can also be pre-stored locally or in the cloud. At this time, it can be directly obtained from the local or the cloud.

[0053] Step S120, determine the entities included in the medical text to be recognized or the relationships between the entities based on the text vector through a pre-trained BiLSTM network model.

[0054] In this embodiment, the entities included in the medical text to be recognized may be examinations, dates, medications, surgical names, etc.; correspondingly, the relationships between the entities included in the medical text to be recognized may be the relationship between an examination item and an examination result, the relationship between an examination item and an examination date, the relationship between a prescribed medication and a dosage, the relationship between surgical treatment and treatment effect, etc.

[0055] In this embodiment, the pre-trained BiLSTM network model can be obtained in the following way:

[0056] First, we construct the initial BiLSTM neural network. It should be noted that the BiLSTM model is a recurrent neural network model. Because recurrent neural network models have the characteristic of persistently retaining information, they can pass information from the current step to the next step. Therefore, the positional and semantic information generated during the recognition process can be passed on.

[0057] Then, the initial BiLSTM neural network is trained using pre-obtained training samples, which are medical records pre-annotated with entities and entity relationships. The training samples include samples for training and samples for validation. The initial BiLSTM network model, built upon the BiLSTM neural network, can, after training, identify entities or relationships between entities contained in text vectors. Using a sufficient amount of medical text for training allows the trained BiLSTM network model to encompass the ability to recognize as many different texts as possible, thereby achieving high accuracy and reliability in the recognition results. In this embodiment, 800 of the 1000 pre-annotated medical records with entities and entity relationships (e.g., discharge summaries, medical history records, etc.) are used for training, and the remaining 200 are used for validation training of the BiLSTM neural network. Before training the initial BiLSTM neural network using the training samples, the training samples can be truncated to a preset length, thereby reducing the problem of model non-convergence caused by excessively long texts during training and improving training efficiency. The specific steps for truncating the training samples to a preset length are similar to those for preprocessing the medical text to be recognized, and will not be repeated here for the sake of brevity.

[0058] Next, when the f1 value of entity recognition using the trained BiLSTM network model is greater than the first threshold, and the f1 value of relation recognition using the trained BiLSTM network model is greater than the second threshold, the trained BiLSTM network model is determined to be a pre-trained BiLSTM network model.

[0059] Specifically, during the training of the BiLSTM network model using training samples, the number of correctly identified entities, the number of false negatives, the number of false positives, and the number of correctly rejected non-matching pairs in each output of the model can be statistically analyzed. Based on the statistical data, precision and recall are calculated. Then, the F1 scores of the entity recognition model and the relationship recognition model are calculated using the precision and recall scores respectively. When the F1 score for entity recognition reaches a first threshold and the F1 score for relationship recognition reaches a second threshold, training is considered complete. In other words, when the F1 score for entity recognition using the trained BiLSTM network model is greater than the first threshold, and the F1 score for relationship recognition using the same trained BiLSTM network model is greater than the second threshold, it indicates that the model has been trained to convergence. The model that has converged is the well-trained BiLSTM network model.

[0060] It should be noted that the first threshold and the second threshold can be set according to the user's different requirements for model accuracy. In this embodiment, the first threshold can be 0.86 and the second threshold can be 0.83.

[0061] The initial state (H, C) of a trained BiLSTM network model can be represented by a zero vector, where H is the initial hidden state and C is the initial cell state, and both H and C have a dimension of d.

[0062] When using a trained BiLSTM network model to recognize text vectors, for entity recognition, the initial position state of an entity can be represented by a 0 vector with a dimension of 4*d, the initial category state of an entity can be represented by a 0 vector with a dimension of d, and the initial semantic state is the concatenation of the initial position state and the initial category state with a dimension of 5*d. For relation recognition, the initial position state of entity 1 and entity 2 can be represented by a 0 vector with a dimension of 4*d, the initial relation category state can be represented by a 0 vector with a dimension of d, and the initial semantic state is the concatenation of the above three with a dimension of 9*d. For both entity and relation recognition, the initial semantic state can be denoted as seg_tuples.

[0063] When using a pre-trained BiLSTM network model to identify entities in text vectors, the process includes obtaining the current hidden state and determining the entity category.

[0064] Specifically, obtaining the current hidden state includes: obtaining the current text state based on the previous hidden state and the text vector through a multiplicative attention mechanism; concatenating the previous semantic state with the current text state to obtain the current semantic state; and inputting the current semantic state and the previous hidden state into a pre-trained BiLSTM network model to obtain the current hidden state and the current cell state. The semantic state records the start and end positions of entities. By recording the semantic state through the hidden state, the current position of the text vector during recognition can be recorded. The recorded information is passed down through the hidden state, enabling the trained BiLSTM network model to progressively recognize entities in the text vector.

[0065] Determining the entity category involves: using the current hidden state as a parameter and injecting it into the text vector through a Layer Normalization layer to obtain the vector to be identified; linearly projecting the trained BiLSTM network model onto the vector to be identified to obtain the start and end position vectors of the entity; concatenating the two position vectors with the current hidden state to obtain the concatenated vector; linearly projecting the concatenated vector to obtain the dimension of the concatenated vector in the current dimension; and outputting the dimension as the preset entity category through softmax.

[0066] The two linear projections here are different. When performing entity category recognition, the model projects the vector to be recognized to (L,1) dimension, where L is the text length, and predicts the start and end position vectors of the entity. The concatenated vector is linearly projected to (N+1,1) dimension, where N is the number of predefined entity categories, and the entity categories are predicted. Entity recognition is performed N+1 times. When the end symbol is recognized, the prediction of the current text ends, and when the end symbol is recognized, there is no need to identify the start and end positions of the end symbol.

[0067] The following section details the process of determining the entities included in the medical text to be identified based on text vectors using a pre-trained BiLSTM network model.

[0068] First, the initial hidden state of the pre-trained BiLSTM network model and the text vector are used to obtain the first text state through a multiplicative attention mechanism.

[0069] Next, the first text state is concatenated with the predetermined initial semantic state to obtain the first semantic state.

[0070] Next, the first semantic state, along with the initial hidden state and initial cell state of the pre-trained BiLSTM network model, are input into the pre-trained BiLSTM network model to obtain the first hidden state.

[0071] Next, the first hidden state is injected into the text vector to obtain the first vector to be recognized. The first recognition vector is the vector obtained by injecting the text vector into the hidden state.

[0072] Next, a linear projection is performed on the first vector to be identified to obtain the first entity start position vector and the first entity end position vector.

[0073] Next, the start position vector and end position vector of the first entity are concatenated with the first hidden state to obtain the first concatenated vector.

[0074] Next, a linear projection is performed on the first concatenated vector to obtain the first entity category.

[0075] Next, the second text state is obtained by using a multiplicative attention mechanism based on the first hidden vector and the text vector.

[0076] Next, the second text state is concatenated with the first semantic state to obtain the second semantic state; the second semantic state and the first hidden state are then input into a pre-trained BiLSTM network model to obtain the second hidden state.

[0077] Next, the second hidden state is injected into the text vector to obtain the second vector to be recognized.

[0078] Next, a linear projection is performed on the second vector to be identified to obtain the start position vector and the end position vector of the second entity.

[0079] Next, the start position vector and end position vector of the second entity are concatenated with the second hidden state to obtain the second concatenated vector.

[0080] Next, a linear projection is performed on the second concatenated vector to obtain the second entity category.

[0081] This process continues until the currently obtained entity category is determined to be the preset entity category, which serves as the end marker.

[0082] When using a pre-trained BiLSTM network model to determine the relationships between entities in a medical text to be identified based on text vectors, the process includes steps such as obtaining the current hidden state and determining the categories of relationships between entities.

[0083] The process of obtaining the current hidden state is the same as that used for entity recognition, so it will not be repeated here.

[0084] Determining the relationship category between entities includes: using the current hidden state as a parameter and injecting it into the text vector through a LayerNormalization layer to obtain the vector to be identified; using a pre-trained BiLSTM network model to linearly project the vector to be identified to obtain the start and end position vectors of entity 1; concatenating the start and end position vectors of entity 1 to obtain the first concatenated vector; using the pre-trained BiLSTM network model based on the first concatenated vector to obtain the start and end position vectors of entity 2; concatenating the start and end position vectors of entity 1 and entity 2 with the current hidden state to obtain the first relationship concatenated vector; linearly projecting the concatenated vector to obtain the dimension of the concatenated vector in the current dimension; and outputting the dimension as the preset relationship category through softmax.

[0085] When using a pre-trained BiLSTM network model to linearly project the vector to be identified to obtain the start and end position vectors of entity 1, the vector to be identified can be linearly projected to (L,1) dimensions to predict the start and end position vectors of entity 1, denoted as start1 and end1 respectively. start1 and end1 are concatenated to obtain the first concatenated vector. Based on the first concatenated vector, the pre-trained BiLSTM network model is used to obtain the start and end position vectors of entity 2, denoted as start2 and end2 respectively. The two entity start and end position vectors are then concatenated with the hidden state of the current step to obtain the first relation concatenated vector. This first relation concatenated vector is then linearly projected to (M+1,1) dimensions, where M is the predefined number of relation categories, to predict the relation categories between the entities.

[0086] The two linear projections here are different. When performing relation category recognition, the model projects the vector to be recognized onto the (L,1) dimension, where L is the text length, and predicts the start and end position vectors of entity 1. The first concatenated vector is linearly projected onto the (M+1,1) dimension, where M is the number of predefined relation categories, and the relation categories are predicted. Relation recognition is performed M+1 times until the end character is identified, at which point the prediction of the current text ends. When identifying the end character, it is not necessary to identify the start and end positions of the end character.

[0087] The following section details the process of using a pre-trained BiLSTM network model to identify text vectors and determine the entities and relationships between them in the medical text to be identified.

[0088] First, the initial hidden state of the pre-trained BiLSTM network model and the text vector are used to obtain the first text state through a multiplicative attention mechanism.

[0089] Next, the first text state is concatenated with the predetermined initial semantic state to obtain the first semantic state.

[0090] Next, the first semantic state, along with the initial hidden state and initial cell state of the pre-trained BiLSTM network model, are input into the pre-trained BiLSTM network model to obtain the first hidden state.

[0091] Next, the first hidden state is injected into the text vector to obtain the first vector to be recognized.

[0092] Next, a linear projection is performed on the first vector to be identified to obtain the first entity start position vector and the first entity end position vector.

[0093] Next, the start position vector and the end position vector of the first entity are concatenated to obtain the start position vector and the end position vector of the second entity.

[0094] Next, the start position vector of the first entity, the end position vector of the first entity, the start position vector of the second entity, the end position vector of the second entity, and the hidden vector are concatenated to obtain the first relation concatenation vector.

[0095] Next, a linear projection is performed on the concatenated vector of the first relation to obtain the first relation category.

[0096] This process continues until the obtained relationship category is determined to be the preset relationship category, which is the terminator.

[0097] The medical text recognition method provided in this application can perform entity recognition and relationship recognition in the same model by inputting the text vector of the medical text to be recognized into a pre-trained BiLSTM network model. Compared with the prior art, it does not require separate modeling for entity recognition and relationship recognition, which can reduce the complexity of the model to a certain extent. In addition, relationship recognition and entity recognition can be performed simultaneously, which can improve recognition efficiency to a certain extent.

[0098] Please see Figure 2 Based on the same inventive concept, one embodiment of this application provides a medical text recognition device 200. The medical text recognition device 200 includes an acquisition module 210 and a determination module 220.

[0099] The acquisition module 210 is used to acquire text vectors, which are obtained based on the medical text to be identified. In this embodiment, the acquisition module S210 is constructed using a BERT model. Text preprocessing is performed using the BERT model's tokenizer to convert the text to lowercase, truncate the text, and segment it into words. Text encoding is also constructed using a BERT model, with BERT parameters initialized using bert-wwm-ext, thus building a model capable of encoding the medical text to be identified.

[0100] The determination module 220 is used to determine the entities included in the medical text to be identified and the relationships between entities based on the text vectors using a pre-trained BiLSTM network model.

[0101] In this embodiment, the determination module S220 is constructed using a BiLSTM neural network. Under the same neural network model framework, a model with both entity recognition and relationship recognition functions is constructed, so that both relationship recognition and entity recognition can be completed in the determination module, and entity recognition does not need to be performed separately before performing relationship recognition.

[0102] In one embodiment, the acquisition module 210 is specifically used for: acquiring the medical text to be identified; preprocessing the medical text to be identified to obtain preprocessed text; and encoding the preprocessed text to obtain a text vector.

[0103] In one embodiment, the acquisition module 210 is further configured to truncate the medical text to be identified according to a preset length to obtain preprocessed text.

[0104] In one embodiment, the acquisition module 210 is further configured to encode the preprocessed text to obtain an initial text vector; and project the initial text vector into a low-dimensional space to obtain a text vector.

[0105] In one embodiment, the medical text recognition device further includes a construction module for constructing an initial BiLSTM neural network; training the initial BiLSTM neural network using pre-obtained training samples, wherein the training samples are medical records pre-labeled with entities and entity relationships; and determining that the trained BiLSTM network model is a pre-trained BiLSTM network model when the f1 value for entity recognition using the trained BiLSTM network model is greater than a first threshold and the f1 value for relationship recognition using the trained BiLSTM network model is greater than a second threshold.

[0106] In one embodiment, the determining module 220 is specifically used to obtain a first text state based on the initial hidden state of a pre-trained BiLSTM network model and the text vector through a multiplicative attention mechanism; concatenate the first text state with a pre-determined initial semantic state to obtain a first semantic state; input the first semantic state, the initial hidden state of the pre-trained BiLSTM network model, and the initial cell state into the pre-trained BiLSTM network model to obtain a first hidden state; inject the first hidden state into the text vector to obtain a first vector to be identified; perform linear projection on the first vector to be identified to obtain a first entity start position vector and a first entity end position vector; concatenate the first entity start position vector and the first entity end position vector with the first hidden state to obtain a first concatenated vector; and perform... Linear projection yields the first entity category; based on the first hidden vector and the text vector, a second text state is obtained through a multiplicative attention mechanism; the second text state is concatenated with the first semantic state to obtain the second semantic state; the second semantic state and the first hidden state are input into a pre-trained BiLSTM network model to obtain the second hidden state; the second hidden state is injected into the text vector to obtain the second vector to be identified; linear projection is performed on the second vector to be identified to obtain the second entity start position vector and the second entity end position vector; the second entity start position vector and the second entity end position vector are concatenated with the second hidden state to obtain the second concatenated vector; linear projection is performed on the second concatenated vector to obtain the second entity category; this process is repeated until the obtained entity category is determined to be a preset entity category, and the preset entity category is the end marker.

[0107] In one embodiment, the determining module 220 is further configured to: obtain a first text state based on the initial hidden state of the pre-trained BiLSTM network model and the text vector through a multiplicative attention mechanism; concatenate the first text state with a pre-determined initial semantic state to obtain a first semantic state; input the first semantic state, the initial hidden state of the pre-trained BiLSTM network model, and the initial cell state into the pre-trained BiLSTM network model to obtain a first hidden state; inject the first hidden state into the text vector to obtain a first vector to be identified; and perform linear projection on the first vector to be identified to obtain the starting position of the first entity. The process begins by concatenating the start and end position vectors of the first entity to obtain a first concatenated vector. This first concatenated vector is then passed through a BiLSTM network model to obtain the start and end position vectors of the second entity. These vectors are then concatenated to obtain a first relation concatenated vector. A linear projection is then performed on this first relation concatenated vector to obtain a first relation category. This process is repeated until a predetermined relation category is identified as the end-of-relationship category.

[0108] It is understood that the medical text recognition device 200 provided in this application corresponds to the medical text recognition method provided in this application. In order to keep the specification concise, the same or similar parts can be referred to the content of the medical text recognition method section, and will not be repeated here.

[0109] The modules in the aforementioned medical text recognition device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the server's processor in hardware form or independent of it, or stored in the server's memory in software form, so that the processor can call and execute the operations corresponding to each module. The processor can be a central processing unit (CPU), a microprocessor, a microcontroller, etc.

[0110] The aforementioned medical text recognition method and / or medical text recognition device can be implemented in the form of a computer-readable instruction, which can be implemented in, for example... Figure 3 It runs on the electronic device shown.

[0111] This application also provides an electronic device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the program, it implements the above-described medical text recognition method.

[0112] Figure 3This is a schematic diagram of the internal structure of an electronic device according to an embodiment of this application. The electronic device may be a server. Please refer to... Figure 3 The electronic device includes a processor, a non-volatile storage medium, internal memory, an input device, a display screen, and a network interface connected via a system bus. The non-volatile storage medium can store an operating system and computer-readable instructions. When executed, these computer-readable instructions cause the processor to perform a medical text recognition method according to various embodiments of this application. The specific implementation process of this method can be found in [reference needed]. Figure 1 The specific details will not be elaborated here. The processor of this electronic device provides computing and control capabilities, supporting the operation of the entire electronic device. The internal memory can store computer-readable instructions, which, when executed by the processor, cause the processor to perform a medical text recognition method. The input device of the electronic device is used for inputting various parameters, the display screen of the electronic device is used for display, and the network interface of the electronic device is used for network communication. Those skilled in the art will understand that... Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0113] Based on the same inventive concept, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when run on a computer, causes the computer to perform a medical text recognition method.

[0114] In the embodiments provided in this application, it should be understood that the disclosed methods and apparatus can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. The functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0115] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0116] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0117] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A medical text recognition method, characterized in that, include: Obtain the text vector, which is based on the text vector of the medical text to be identified; The entities included in the medical text to be identified or the relationships between the entities are determined based on the text vectors using a pre-trained BiLSTM network model. The method of determining the entities or relationships between entities in the medical text to be identified based on the text vector using a pre-trained BiLSTM network model includes: obtaining a first text state by using a multiplicative attention mechanism with the initial hidden state of the pre-trained BiLSTM network model and the text vector; concatenating the first text state with a pre-determined initial semantic state to obtain a first semantic state; inputting the first semantic state, the initial hidden state, and the initial cell state of the pre-trained BiLSTM network model into the pre-trained BiLSTM network model to obtain a first hidden state; injecting the first hidden state into the text vector to obtain a first vector to be identified; performing a linear projection on the first vector to be identified to obtain a first entity start position vector and a first entity end position vector; and concatenating the first entity start position vector and the first entity end position vector with the first hidden state to obtain... The process involves: obtaining a first concatenated vector; performing a linear projection on the first concatenated vector to obtain a first entity category; obtaining a second text state based on the first hidden state and the text vector using a multiplicative attention mechanism; concatenating the second text state with the first semantic state to obtain a second semantic state; inputting the second semantic state and the first hidden state into the pre-trained BiLSTM network model to obtain a second hidden state; injecting the second hidden state into the text vector to obtain a second vector to be identified; performing a linear projection on the second vector to be identified to obtain a second entity start position vector and a second entity end position vector; concatenating the second entity start position vector and the second entity end position vector with the second hidden state to obtain a second concatenated vector; performing a linear projection on the second concatenated vector to obtain a second entity category; and so on, until the obtained entity category is determined to be a preset entity category, where the preset entity category is the end marker. Alternatively, determining the entities or relationships between the entities in the medical text to be identified based on the text vector using a pre-trained BiLSTM network model includes: obtaining a first text state by using a multiplicative attention mechanism based on the initial hidden state of the pre-trained BiLSTM network model and the text vector; concatenating the first text state with a pre-determined initial semantic state to obtain a first semantic state; inputting the first semantic state, the initial hidden state of the pre-trained BiLSTM network model, and the initial cell state into the pre-trained BiLSTM network model to obtain a first hidden state; and injecting the first hidden state into the text vector to obtain the first vector to be identified. Linear projection is performed on the first vector to be identified to obtain a first entity start position vector and a first entity end position vector; the first entity start position vector and the first entity end position vector are concatenated to obtain a first concatenated vector; the first concatenated vector is passed through the pre-trained BiLSTM network model to obtain a second entity start position vector and a second entity end position vector; the first entity start position vector, the first entity end position vector, the second entity start position vector, the second entity end position vector, and the first hidden state are concatenated to obtain a first relation concatenated vector; linear projection is performed on the first relation concatenated vector to obtain a first relation category; this process is repeated until the obtained relation category is determined to be a preset relation category, and the preset relation category is the end symbol.

2. The method according to claim 1, characterized in that, The process of obtaining the text vector includes: obtaining the medical text to be identified; The medical text to be identified is preprocessed to obtain preprocessed text; The preprocessed text is encoded to obtain the text vector.

3. The method according to claim 2, characterized in that, The preprocessing of the medical text to be identified includes: truncating the medical text to be identified according to a preset length to obtain the preprocessed text.

4. The method according to claim 2, characterized in that, Encoding the preprocessed text to obtain the text vector includes: The preprocessed text is encoded to obtain an initial text vector; The initial text vector is projected onto a low-dimensional space to obtain the text vector.

5. The method according to claim 1, characterized in that, The steps to obtain the pre-trained BiLSTM network model include: Construct the initial BiLSTM neural network; The initial BiLSTM neural network is trained using pre-obtained training samples, wherein the training samples are medical records pre-labeled with entities and entity relationships; When the f1 score of entity recognition using the trained BiLSTM network model is greater than a first threshold, and the f1 score of relation recognition using the trained BiLSTM network model is greater than a second threshold, the trained BiLSTM network model is determined to be the pre-trained BiLSTM network model.

6. A medical text recognition device, characterized in that, The medical text recognition device includes: an acquisition module, used to acquire a text vector, the text vector being obtained based on the medical text to be recognized; The determination module is used to determine the entities included in the medical text to be identified and the relationships between the entities based on the text vector using a pre-trained BiLSTM network model. The determining module is configured to: obtain a first text state based on the initial hidden state of the pre-trained BiLSTM network model and the text vector through a multiplicative attention mechanism; concatenate the first text state with a pre-determined initial semantic state to obtain a first semantic state; input the first semantic state, along with the initial hidden state and initial cell state of the pre-trained BiLSTM network model, into the pre-trained BiLSTM network model to obtain a first hidden state; inject the first hidden state into the text vector to obtain a first vector to be identified; perform linear projection on the first vector to be identified to obtain a first entity start position vector and a first entity end position vector; concatenate the first entity start position vector and the first entity end position vector with the first hidden state to obtain a first concatenated vector; and perform linear projection on the first concatenated vector to obtain... The process involves: identifying a first entity category; obtaining a second text state based on the first hidden state and the text vector using a multiplicative attention mechanism; concatenating the second text state with the first semantic state to obtain a second semantic state; inputting the second semantic state and the first hidden state into the pre-trained BiLSTM network model to obtain a second hidden state; injecting the second hidden state into the text vector to obtain a second vector to be identified; performing a linear projection on the second vector to be identified to obtain a second entity start position vector and a second entity end position vector; concatenating the second entity start position vector and the second entity end position vector with the second hidden state to obtain a second concatenated vector; performing a linear projection on the second concatenated vector to obtain a second entity category; and so on, until the obtained entity category is determined to be a preset entity category, where the preset entity category is the end marker. Alternatively, the determining module is configured to: obtain the first text state based on the initial hidden state of the pre-trained BiLSTM network model and the text vector through a multiplicative attention mechanism; concatenate the first text state with a pre-determined initial semantic state to obtain the first semantic state; input the first semantic state, the initial hidden state of the pre-trained BiLSTM network model, and the initial cell state into the pre-trained BiLSTM network model to obtain the first hidden state; and inject the first hidden state into the text vector to obtain the first vector to be identified. Linear projection is performed on the first vector to be identified to obtain a first entity start position vector and a first entity end position vector; the first entity start position vector and the first entity end position vector are concatenated to obtain a first concatenated vector; the first concatenated vector is passed through the pre-trained BiLSTM network model to obtain a second entity start position vector and a second entity end position vector; the first entity start position vector, the first entity end position vector, the second entity start position vector, the second entity end position vector, and the first hidden state are concatenated to obtain a first relation concatenated vector; linear projection is performed on the first relation concatenated vector to obtain a first relation category; this process is repeated until the obtained relation category is determined to be a preset relation category, and the preset relation category is the end symbol.

7. An electronic device comprising a memory and a processor, characterized in that, The memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the medical text recognition method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The readable storage medium stores a computer program that, when run on a computer, causes the computer to perform a medical text recognition method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Joint entity relationship extraction method and device and storage medium

    CN110598001A