A Medical Named Entity Recognition Method that Fudes Pre-trained Models and Large Language Models
By combining a pre-trained model with a large language model, and utilizing the ordered occurrence state and boundary evolution trajectory of candidate entities, the problems of entity boundary drift and structural inconsistency in medical named entity recognition are solved, thereby improving the accuracy and stability of medical named entity recognition.
Patent Information
- Application Number
- CN202611579470.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-13
- Publication Date
- 2026-11-10
AI Technical Summary
Existing technologies, when integrating pre-trained models and large language models for medical named entity recognition, struggle to distinguish the persistent support differences of the same candidate medical entity in high- and low-ranked candidate entity sequences, leading to boundary drift and structural inconsistencies. This results in insufficient accuracy, especially with long medical terms, nested entities, or entities with similar boundaries.
By identifying candidate medical entities through a pre-trained model, and combining the bundle search and candidate sequence probability of a large language model, the ordered occurrence state and boundary evolution trajectory of candidate entities are established. The degree of sustained support and structural reliability of entities are determined, the target boundary is identified, and candidate entities are fused to solve the problem of difficulty in determining the reliability of entity boundaries in multiple candidate sequences.
It improves the accuracy of boundary determination for long medical terms, nested entities, and entities with similar boundaries, provides clear criteria for candidate medical entity fusion and boundary conflict rejection, and enhances the stability and consistency of medical named entity recognition.
Smart Images

Figure CN123070107A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language technology, and in particular to a medical named entity recognition method that integrates pre-trained models and large language models. Background Technology
[0002] With the continuous application of natural language processing technology in electronic medical records, medical literature, clinical research data, and medical knowledge graphs, medical named entity recognition has gradually become an important foundation for the structuring of medical text. Current technologies typically employ pre-trained language models to extract candidate medical entities with clear contextual boundaries, and also use generative large language models combined with prompts to complete entity recognition for diseases, symptoms, drugs, examination items, and anatomical structures. Furthermore, multiple candidate sequences are obtained through beam search to express the semantics and boundary information of entities in medical text using different generation paths.
[0003] Existing natural language processing methods, when fusing pre-trained models with large language models for medical named entity recognition, typically focus on whether candidate entities appear, model confidence, or simple voting among multiple candidate sequences. These methods struggle to distinguish the sustained support differences of the same candidate medical entity across high- and low-ranked candidate entity sequences, and also fail to characterize the boundary evolution features resulting from changes in the entity's start and end positions as the candidate sequence changes. When medical texts contain long medical terms, nested entities, or entities with similar boundaries, even if candidate entities receive multiple supports, boundary drift and structural inconsistencies may still occur, thus affecting the accuracy of the final entity fusion and boundary determination. Summary of the Invention
[0004] In view of the problems existing in the prior art, the present invention is proposed.
[0005] Therefore, this invention provides a medical named entity recognition method that integrates a pre-trained model and a large language model, solving the problem of difficulty in jointly determining the continuous support of candidate medical entities and the reliability of entity boundaries in multiple candidate sequences.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] This invention provides a medical named entity recognition method that integrates a pre-trained model and a large language model. The method includes: identifying candidate medical entities in the medical text to be recognized using a pre-trained model; determining the number of candidate entity sequences in the large language model based on the text length and the number of candidate medical entities in the pre-trained model; inputting the medical text to be recognized into the large language model; performing a beam search according to the number of candidate entity sequences in the large language model to obtain the candidate sequences output by the large language model and the probabilities of the corresponding whole sentence sequences; arranging the candidate sequences according to the whole sentence sequence probabilities to form a candidate entity sequence; performing text position correction on the candidate medical entities in the candidate entity sequence; and establishing an ordered appearance status of candidate entities based on the order of appearance and entity boundary changes of the same candidate medical entity in different candidate entity sequences. The process involves analyzing the state and evolution trajectory of candidate entity boundaries; determining the degree of sustained support for the same candidate medical entity by different ordered candidate entity sequences using the ordered appearance state of candidate entities; determining the structural reliability of candidate entities based on the degree of sustained support and the relationship between the candidate entity boundary evolution trajectory and the position of candidate medical entities in the pre-trained model; identifying the target boundary of candidate entities from the boundary evolution trajectory; fusing candidate medical entities based on the cross-model candidate entity correspondence between candidate medical entities in the pre-trained model and candidate medical entities in the large language model; and selecting candidate medical entities with conflicting entity boundaries based on the structural reliability and target boundary of candidate entities to generate medical named entity recognition information.
[0008] As a preferred embodiment of the medical named entity recognition method that integrates the pre-trained model and the large language model described in this invention, the steps for identifying candidate medical entities in the medical text to be identified are as follows:
[0009] Obtain the medical text to be recognized, determine the text length according to the number of characters in the medical text to be recognized, input the medical text to be recognized into the pre-trained model for medical named entity recognition, and obtain the candidate medical entities and the number of candidate medical entities in the pre-trained model.
[0010] For different text lengths of labeled medical texts and the number of candidate medical entities in the pre-trained model, medical named entity recognition of the large language model is performed with different numbers of candidate entity sequences. The number of target candidate entity sequences is determined based on the consistency between the medical named entities corresponding to different numbers of candidate entity sequences and the labeled medical entities, and a correspondence is established. The number of candidate entity sequences of the large language model is determined based on the text length of the medical text to be identified and the number of candidate medical entities in the pre-trained model.
[0011] As a preferred embodiment of the medical named entity recognition method that integrates the pre-trained model and the large language model described in this invention, the step of performing beam search according to the number of candidate entity sequences in the large language model is as follows:
[0012] The medical text to be recognized is input into the large language model. When the recognition content is generated step by step, the probability of the candidate sequence is updated according to the probability of the word corresponding to each generation position. The candidate sequence with the highest probability is retained according to the number of candidate entity sequences in the large language model until the candidate sequence generation is completed, and the candidate sequence and the probability of the corresponding whole sentence sequence are obtained.
[0013] Candidate sequences are arranged from high to low probability of whole sentence sequence. The entity text, entity type and entity location corresponding to the candidate medical entity are obtained from each candidate sequence, and a candidate entity sequence is established according to the order of the candidate sequence.
[0014] As a preferred embodiment of the medical named entity recognition method that integrates the pre-trained model and the large language model described in this invention, the step of correcting the text position of candidate medical entities in the candidate entity sequence is as follows:
[0015] For each candidate medical entity in the candidate entity sequence, check the entity text against the medical text to be identified. If the entity text does not exist in the medical text to be identified, exclude the corresponding candidate medical entity. If the entity text exists but the entity position does not correspond, update the entity start position and entity end position according to the actual occurrence position of the entity text in the medical text to be identified.
[0016] For candidate medical entities of the same type in different candidate entity sequences, candidate medical entities corresponding to the same medical entity are determined based on entity text and entity location, and cross-sequence correspondence between the same candidate medical entity and different candidate entity sequences is established.
[0017] As a preferred embodiment of the medical named entity recognition method that integrates the pre-trained model and the large language model described in this invention, the steps for establishing the ordered occurrence state of candidate entities and the evolution trajectory of candidate entity boundaries are as follows:
[0018] The correspondence between candidate medical entities across sequences is checked sequentially according to the order of the candidate entity sequence. The occurrence and absence status of the same candidate medical entity in each candidate entity sequence are recorded. The occurrence and absence statuses are then associated according to the order of the corresponding candidate entity sequences to establish an ordered occurrence status of candidate entities.
[0019] Read the start and end positions of the candidate medical entities in the appearing state according to the order of the candidate entity sequence, compare the start and end positions of adjacent candidate medical entities in turn, and record the change relationship between the start and end positions of the entities according to the order of the candidate entity sequence to establish the boundary evolution trajectory of the candidate entities.
[0020] As a preferred embodiment of the medical named entity recognition method that integrates the pre-trained model and the large language model described in this invention, the step of determining the degree of sustained support of different ranked candidate entity sequences for the same candidate medical entity is as follows:
[0021] Verify the candidate medical entities in the pre-trained model and the candidate medical entities in the large language model according to entity type, entity text, and entity location. Establish cross-model candidate entity correspondence for candidate medical entities with the same entity type, corresponding entity text, and overlapping entity location ranges.
[0022] For the same candidate medical entity in the cross-model candidate entity correspondence, the candidate entity is read in the order of its sequence arrangement to determine the first occurrence position of the candidate entity sequence, the range of consecutive occurrences, and the missing positions between the ranges of consecutive occurrences.
[0023] The probability support ratio is determined by the proportion of the sum of probabilities of the entire sentence sequence corresponding to the candidate entity sequence in the occurrence state to the sum of probabilities of the entire sentence sequence of all candidate entity sequences. The continuous support ratio is determined by the proportion of the number of candidate entity sequences contained in the continuous occurrence range with the largest number of candidate entity sequences to the number of candidate entity sequences between the first and last occurrence positions. The degree of continuous support for candidate entities is calculated based on the probability support ratio and the continuous support ratio.
[0024] As a preferred embodiment of the medical named entity recognition method that integrates the pre-trained model and the large language model described in this invention, the steps for determining the reliability of the candidate entity structure are as follows:
[0025] Read the start and end positions of entities in the boundary evolution trajectory of candidate entities according to the order of the candidate entity sequence, obtain the deviation of each entity's start and end positions relative to the start and end positions of the candidate medical entities in the pre-trained model in the cross-model candidate entity correspondence, and obtain the change in entity boundary between adjacent candidate medical entities.
[0026] The degree of deviation of the candidate entity boundary structure is determined by the boundary deviation of the entity's starting and ending positions relative to the candidate medical entity positions in the pre-trained model in the candidate entity boundary evolution trajectory, as well as the change in entity boundary between adjacent candidate medical entities. The reliability of the candidate entity structure is determined by the inverse relationship between the degree of continuous support of the candidate entity and the degree of deviation of the candidate entity boundary structure.
[0027] As a preferred embodiment of the medical named entity recognition method that integrates the pre-trained model and the large language model described in this invention, the step of determining the candidate entity target boundary from the candidate entity boundary evolution trajectory is as follows:
[0028] For each entity boundary recorded in the candidate entity boundary evolution trajectory, the degree of continuous support of the corresponding entity boundary is determined based on the range of continuous occurrence of the candidate entity sequence where the corresponding entity boundary is located in the ordered occurrence state of the candidate entities.
[0029] Compare the boundary deviations between each entity boundary and the candidate medical entity positions in the pre-trained model, and select the entity boundary with the highest degree of sustained support from the entity boundaries with the smallest boundary deviation as the candidate entity target boundary.
[0030] As a preferred embodiment of the medical named entity recognition method that fuses the pre-trained model with a large language model according to the present invention, the steps for fusing candidate medical entities are as follows:
[0031] Pre-trained model candidate medical entities that correspond to the same medical entity and have the same entity type are grouped into the same candidate entity fusion group with large language model candidate medical entities.
[0032] The entity type corresponding to the candidate entity fusion group is determined as the entity type of the fusion candidate medical entity. The starting position and ending position of the entity are unified according to the target boundary of the candidate entity to obtain the fusion candidate medical entity.
[0033] As a preferred embodiment of the medical named entity recognition method that integrates the pre-trained model and the large language model described in this invention, the step of selecting candidate medical entities with conflicting entity boundaries is as follows:
[0034] By checking the starting and ending positions of entities according to the target boundaries of the fused candidate medical entities, entity boundary conflicts that have partial overlap and no inclusion relationship are identified.
[0035] For fusion candidate medical entities with entity boundary conflicts, the reliability of the candidate entity structure is compared. The fusion candidate medical entity with the highest reliability of the candidate entity structure is retained, and the other fusion candidate medical entities with entity boundary conflicts are excluded. The entity text, entity type, entity start position and entity end position corresponding to the retained fusion candidate medical entities are summarized to generate medical named entity recognition information.
[0036] The beneficial effects of this invention are as follows: By establishing the ordered occurrence state of candidate entities and the evolution trajectory of candidate entity boundaries, the continuity of the occurrence, missing positions, and boundary change information of the same candidate medical entity in different ordered candidate entity sequences can be preserved during natural language processing. In addition, the reliability of the candidate entity structure and the target boundary of the candidate entity are determined by combining the continuous support of the candidate entity with the position of the candidate medical entity in the pre-trained model. This makes the basis for retaining candidate medical entities reflect the stability of multi-sequence support and the consistency of boundary structure, which is conducive to improving the accuracy of boundary determination of long medical terms, nested entities, and entities with similar boundaries, and provides a clear basis for subsequent candidate medical entity fusion and entity boundary conflict selection. Attached Figure Description
[0037] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1 The flowchart shows a medical named entity recognition method that integrates a pre-trained model with a large language model.
[0039] Figure 2 A flowchart for establishing the boundary evolution trajectory of candidate entities.
[0040] Figure 3 A flowchart for determining the reliability of candidate entity structures.
[0041] Figure 4 A flowchart for generating medical named entity recognition information. Detailed Implementation
[0042] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0043] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0044] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0045] Reference Figures 1-4 This is one embodiment of the present invention, which provides a medical named entity recognition method that fuses a pre-trained model with a large language model, including the following steps:
[0046] S1. Identify candidate medical entities in the medical text to be identified through a pre-trained model, and determine the number of candidate entity sequences in the large language model based on the text length and the number of candidate medical entities in the pre-trained model.
[0047] S1.1: Obtain the medical text to be recognized, determine the text length according to the number of characters in the medical text to be recognized, input the medical text to be recognized into the pre-trained model for medical named entity recognition, and obtain the candidate medical entities and the number of candidate medical entities in the pre-trained model.
[0048] Specifically, after obtaining the medical text to be recognized, the number of characters is counted one by one according to the character arrangement order in the medical text, and the total number of characters counted is determined as the text length. The medical text to be recognized is input into the pre-trained model according to the complete text content. The pre-trained model reads the text content according to the character arrangement order in the medical text to be recognized and identifies the medical entities in the medical text to be recognized. For each identified medical entity, the corresponding entity text, entity type, entity start position, and entity end position are read. The entity text, entity type, entity start position, and entity end position are combined to form the candidate medical entities of the pre-trained model. All the candidate medical entities output by the pre-trained model are traversed, and each candidate medical entity of the pre-trained model is counted to obtain the number of candidate medical entities of the pre-trained model.
[0049] It should be noted that the pre-trained model adopts a BERT-base structure, which divides the medical text to be recognized into tokens and converts them into corresponding token representations. The tokens are then input into a 12-layer Transformer encoder to obtain the contextual feature representations corresponding to each token. The contextual feature representations are then input into a fully connected classification layer to obtain the medical entity label probability corresponding to each token. The medical entity label is determined according to the medical entity label probability. The medical entity label includes the starting label, internal label and non-entity label corresponding to the entity type. The token corresponding to the starting label is used as the starting token of the medical entity. The internal label corresponding to the same entity type as the starting label is read and merged. When a new starting label, a label of a different entity type or a non-entity label is encountered, the merging of the current medical entity ends. The entity text, entity type, entity start position and entity end position are determined according to the position of the corresponding token in the medical text to be recognized. The entity type includes disease, symptom, drug, examination item and anatomical structure, forming candidate medical entities in the pre-trained model.
[0050] During training, labeled medical text is used as training samples. The start position, end position, and type of labeled medical entities are converted into medical entity labels for corresponding words. The training samples are input into the pre-trained model to obtain the probability of medical entity labels for each word. Cross-entropy loss is used to measure the difference between the probability of medical entity labels and the labeled medical entity labels. The parameters of the Transformer encoder and the fully connected classification layer are updated through backpropagation. After each training round, the validation set is input into the pre-trained model and the cross-entropy loss corresponding to the validation set is obtained. When the cross-entropy loss of the current round is lower than the previous lowest cross-entropy loss, the lowest cross-entropy loss is updated. Training stops when the cross-entropy loss of three consecutive training rounds is not lower than the previous lowest cross-entropy loss, and the pre-trained model parameters corresponding to the lowest cross-entropy loss are retained to obtain a pre-trained model for medical named entity recognition.
[0051] S1.2: For different text lengths of labeled medical texts and the number of candidate medical entities in the pre-trained model, large language model medical named entity recognition is performed with different numbers of candidate entity sequences. The number of target candidate entity sequences is determined based on the consistency between the medical named entities corresponding to different numbers of candidate entity sequences and the labeled medical entities, and a correspondence is established. The number of candidate entity sequences in the large language model is determined based on the text length of the medical text to be recognized and the number of candidate medical entities in the pre-trained model.
[0052] Specifically, for each labeled medical text, the labeled medical text is input into the pre-trained model for medical named entity recognition, and the candidate medical entities output by the pre-trained model are counted one by one to obtain the number of candidate medical entities in the pre-trained model for the corresponding labeled medical text. The division range is determined according to the maximum and minimum values of text length and number of candidate medical entities in the training samples, and the text is divided into equal-width intervals according to the preset interval division number. Labeled medical texts that fall into the same text length interval and the same pre-trained model candidate medical entity number interval are grouped into the same group.
[0053] For each group, a different number of candidate entity sequences are set sequentially. Each labeled medical text within the group is input into the large language model, and the number of candidate entity sequences is used as the number of candidate sequences retained during the bundle search process to perform medical named entity recognition using the large language model. For each number of candidate entity sequences, the identified medical named entities are checked against the labeled medical text item by item in terms of entity text, entity type, entity start position, and entity end position. When all four pieces of information of the identified medical named entity and the labeled medical entity are consistent, the corresponding medical named entity is determined as a consistent medical named entity. If the same labeled medical entity appears repeatedly in more than one candidate entity sequence, it is counted only once according to the corresponding labeled medical entity to avoid the increase in the number of consistent medical named entities due to the repeated generation of candidate sequences for the same labeled medical entity. The number of consistent medical named entities corresponding to the number of candidate entity sequences with the most consistent medical named entities is determined as the target number of candidate entity sequences for the corresponding group. When the number of consistent medical named entities is the same, the number of candidate entity sequences with the smaller number of candidate entity sequences is selected as the target number of candidate entity sequences.
[0054] A correspondence is established based on the text length range, the range of candidate medical entities in the pre-trained model, and the number of target candidate entity sequences. The text length range to which the text length of the medical text to be identified belongs and the range of candidate medical entities in the pre-trained model belong are determined. When the text length of the medical text to be identified or the number of candidate medical entities in the pre-trained model exceeds the range covered by the correspondence, the corresponding value that exceeds the range is assigned to the boundary range closest to that value, and the number of target candidate entity sequences is read as the number of candidate entity sequences of the large language model based on the corresponding boundary range.
[0055] It should be noted that the number of interval divisions is determined based on the changes in the number of target candidate entity sequences corresponding to the text length and the number of candidate medical entities in the pre-trained model in the labeled medical text training samples. The text length, the number of candidate medical entities in the pre-trained model, and the number of target candidate entity sequences corresponding to all labeled medical texts are obtained. Intervals are divided according to the range of values for text length and the number of candidate medical entities, and the number of target candidate entity sequences corresponding to each interval combination is counted. When the number of target candidate entity sequences corresponding to the same interval combination is consistent, the current interval division result is retained. When the number of target candidate entity sequences corresponding to the same interval combination is inconsistent, the range of text length and the range of candidate medical entity sequences corresponding to the interval combination are further divided until each interval combination can correspond to a unique number of target candidate entity sequences, thus obtaining the final number of interval divisions.
[0056] The large language model adopts a generative structure based on a Transformer decoder, including a lexical embedding layer, a positional encoding layer, a multi-layer Transformer decoder, and an output layer. Each Transformer decoder layer includes a masked multi-head self-attention layer, a feedforward fully connected layer, residual connections, and a layer normalization layer. The output layer maps the hidden states output by the Transformer decoder to lexical probability distributions. In the pre-training stage, a large-scale text corpus is acquired and converted into lexical sequences. The training task is to predict subsequent lexical units from preceding lexical units in the sequence. Causal masks restrict each generation position to be associated only with the preceding lexical unit. The training is based on the predicted lexical unit probability and the actual subsequent lexical unit probability. The cross-entropy loss is determined, and the parameters of the large language model are iteratively updated through backpropagation to obtain the pre-trained large language model. In the training stage of medical named entity recognition, the labeled medical text is used as the training input. The entity text, entity type, entity start position, and entity end position of the labeled medical entities are arranged in the order of entity text, entity type, entity start position, and entity end position to form a structured target sequence. The target word at each position of the structured target sequence is used to supervise the output of the word probability. The low-rank adaptive parameters are updated in reverse according to the cross-entropy loss. After multiple rounds of iteration, the training of the large language model ends when the cross-entropy loss of the validation set in at least 3 adjacent training rounds no longer decreases.
[0057] S2. Input the medical text to be identified into the large language model, perform a beam search according to the number of candidate entity sequences in the large language model, obtain the candidate sequences and corresponding whole sentence sequence probabilities output by the large language model, and arrange them according to the whole sentence sequence probabilities to form candidate entity sequences. Perform text position correction on the candidate medical entities in the candidate entity sequences, and establish the orderly appearance state of candidate entities and the evolution trajectory of candidate entity boundaries based on the appearance order and entity boundary changes of the same candidate medical entity in different candidate entity sequences.
[0058] S2.1: Input the medical text to be recognized into the large language model. When the recognition content is generated step by step, update the candidate sequence probability according to the word probability corresponding to each generation position. And retain the candidate sequence with the highest candidate sequence probability according to the number of candidate entity sequences in the large language model until the candidate sequence generation is completed, and obtain the candidate sequence and the probability of the corresponding whole sentence sequence.
[0059] Specifically, the medical text to be recognized is input into the large language model. At the first generation position, the hidden state of the first generation position is obtained through a multi-layer Transformer decoder based on the medical text to be recognized. At subsequent generation positions, the hidden state of the corresponding generation position is obtained through a multi-layer Transformer decoder based on the medical text to be recognized and the generated words in the currently retained candidate sequences. The output layer maps the hidden state to the word probability of each candidate word at the corresponding generation position. At the first generation position, the candidate words are arranged in descending order of word probability value. Starting from the first position, the number of candidate words is the same as the number of candidate entity sequences in the large language model to establish candidate sequences, and the corresponding word probability is used as the candidate sequence probability.
[0060] In subsequent generation positions, candidate lexical units output by the large language model are concatenated to the currently retained candidate sequences. The product of the probability of the candidate sequence before expansion and the probability of the corresponding lexical unit of the newly added candidate lexical unit is used as the probability of the candidate sequence after expansion. After the candidate sequence expansion is completed at each generation position, all expanded candidate sequences are arranged in descending order of candidate sequence probability values. Starting from the first position, candidate sequences with the same number as the number of candidate entity sequences in the large language model are retained in sequence, and the remaining candidate sequences are excluded. The retained candidate sequences are then used to enter the next generation position to continue expanding and updating the candidate sequence probability until the candidate sequence generation reaches the end mark. The candidate sequence probability corresponding to each candidate sequence at the end of generation is determined as the probability of the entire sentence sequence.
[0061] S2.2: Arrange the candidate sequences from high to low probability according to the whole sentence sequence, obtain the entity text, entity type and entity position corresponding to the candidate medical entity from each candidate sequence, and establish the candidate entity sequence according to the order of the candidate sequence.
[0062] Specifically, candidate sequences are arranged in descending order of their overall probability values, with the candidate sequence having the highest probability value placed first, and the remaining candidate sequences arranged in order. For each candidate sequence, the candidate sequence is parsed according to the field order and field identifiers corresponding to the structured target sequence, and the entity text, entity type, entity start position, and entity end position corresponding to the candidate medical entity are read. The entity start position and entity end position are then determined as the entity position. The corresponding candidate medical entities are arranged according to the order of the candidate sequences, and the candidate medical entities in the same candidate sequence are arranged from front to back according to their entity start positions, thus establishing a candidate entity sequence.
[0063] S2.3: Check the candidate medical entities in the candidate entity sequence one by one against the entity text and the medical text to be identified. If the entity text does not exist in the medical text to be identified, exclude the corresponding candidate medical entity. If the entity text exists but the entity position does not correspond, update the entity start position and entity end position according to the actual occurrence position of the entity text in the medical text to be identified.
[0064] Specifically, the entity text, entity start position, and entity end position corresponding to each candidate medical entity are read sequentially according to the candidate entity sequence. The text content corresponding to the entity start position to the entity end position in the medical text to be identified is extracted and compared with the entity text. If the text content is consistent with the entity text, the entity start position and entity end position are maintained. If the text content is inconsistent with the entity text, the text content that is completely consistent with the entity text is searched in the medical text to be identified. If no consistent text content is found, the corresponding candidate medical entity is excluded. If a consistent text content is found, the actual start position and actual end position of the consistent text content are updated to the entity start position and entity end position. If more than one consistent text content is found, the absolute difference between each actual start position and the original entity start position and the absolute difference between each actual end position and the original entity end position are obtained respectively. The sum of the two absolute differences is determined as the position deviation of the corresponding consistent text content. The actual start position and actual end position corresponding to the consistent text content with the smallest position deviation are selected to update the entity start position and entity end position. If the position deviations are the same, the consistent text content with the earlier actual start position is selected.
[0065] S2.4: For candidate medical entities of the same entity type in different candidate entity sequences, determine the candidate medical entities corresponding to the same medical entity based on the entity text and entity position, and establish cross-sequence correspondence between the same candidate medical entity and different candidate entity sequences.
[0066] Specifically, candidate medical entities of the same type are selected from different candidate entity sequences according to their order of arrangement. The entity text, start position, and end position of each candidate medical entity are verified. When the entity text is the same, the absolute difference between the start and end positions of the two candidate medical entities are obtained. The sum of these two absolute differences is determined as the candidate entity position difference, and the candidate medical entity with the smallest position difference is identified as the corresponding medical entity. If more than one candidate medical entity has the same position difference, the candidate medical entity with the smaller start position difference is selected. If they are still the same, the candidate medical entity ranked earlier in the corresponding candidate entity sequence is selected. When the entity texts are different, check the continuous character inclusion relationship between the entity texts corresponding to the two candidate medical entities and the overlapping relationship of the position intervals from the entity start position to the entity end position. Candidate medical entities whose entity texts have continuous character inclusion relationships, overlapping position intervals, and the same entity start position or the same entity end position are identified as corresponding to the same medical entity. Associate the candidate medical entities corresponding to the same medical entity according to the order of the candidate entity sequence, and establish cross-sequence candidate medical entity correspondence relationships between different candidate entity sequences for the same candidate medical entity. Set entity identifiers for candidate medical entities for which cross-sequence candidate medical entity correspondence relationships have been established, and candidate medical entities that have participated in cross-sequence candidate medical entity correspondence matching will no longer participate in other matching.
[0067] It should be noted that the continuous character inclusion relationship means that the entity text of one candidate medical entity can appear as a continuous complete character segment in the entity text of another candidate medical entity; the position interval overlap relationship from the entity start position to the entity end position means that the position intervals corresponding to the two candidate medical entities have at least one common character position.
[0068] S2.5: Check the correspondence between cross-sequence candidate medical entities in the order of candidate entity sequence, record the appearance and absence status of the same candidate medical entity in each candidate entity sequence, and associate each appearance and absence status according to the order of the corresponding candidate entity sequence to establish the orderly appearance status of candidate entities.
[0069] Specifically, the candidate entity sequences are read one by one according to their order of arrangement. Based on the cross-sequence correspondence of candidate medical entities, it is checked whether the same candidate medical entity has a corresponding candidate medical entity in each candidate entity sequence. If a corresponding candidate medical entity exists, the occurrence status is recorded; if no corresponding candidate medical entity exists, the absence status is recorded. The occurrence status and absence status are then associated with the order of arrangement of the corresponding candidate entity sequences. After all candidate entity sequences have been checked, the occurrence status and absence status of the same candidate medical entity are recorded according to the order of arrangement of the candidate entity sequences, thus establishing an ordered occurrence status of candidate entities.
[0070] S2.6: Read the start and end positions of the candidate medical entities in the appearing state according to the order of the candidate entity sequence, compare the start and end positions of adjacent candidate medical entities in turn, and record the change relationship between the start and end positions of the entities according to the order of the candidate entity sequence to establish the boundary evolution trajectory of the candidate entities.
[0071] Specifically, candidate medical entities in the order of appearance are read according to the candidate entity sequence, and the order of the candidate entity sequence, the start position, and the end position of the entity are recorded for each appearance. Candidate medical entities corresponding to two adjacent appearances are identified as adjacent candidate medical entities according to the candidate entity sequence. The start and end positions of the latter candidate medical entity and the former candidate medical entity are compared. If the start positions are the same, the start position is recorded as unchanged. If the start position of the latter candidate medical entity increases, the start position is recorded as changing backward. If the start position of the latter candidate medical entity decreases, the start position is recorded as changing forward. The same method is used to record whether the end position remains unchanged, changes backward, or changes forward. The start and end positions of each appearance, as well as the changes in start and end positions between two adjacent appearances, are continuously correlated according to the candidate entity sequence to establish the candidate entity boundary evolution trajectory.
[0072] S3. Utilize the ordered appearance state of candidate entities to determine the degree of continuous support of different sorted candidate entity sequences for the same candidate medical entity. Determine the reliability of the candidate entity structure based on the degree of continuous support of the candidate entity and the relationship between the evolution trajectory of the candidate entity boundary and the position of the candidate medical entity in the pre-trained model. Finally, determine the target boundary of the candidate entity from the evolution trajectory of the candidate entity boundary.
[0073] S3.1: Verify the candidate medical entities of the pre-trained model and the candidate medical entities of the large language model according to entity type, entity text and entity location. Establish cross-model candidate entity correspondence for candidate medical entities with the same entity type, corresponding entity text and overlapping entity location ranges.
[0074] Specifically, for candidate medical entities in the large language model within the cross-sequence candidate medical entity correspondence, the corresponding entity type, entity text, entity start position, and entity end position are read, and the entity position interval is determined according to the entity start position and entity end position. The entity type, entity text, entity start position, and entity end position corresponding to each candidate medical entity in the pre-trained model are read one by one. The correspondence between the entity type and entity text of the pre-trained model candidate medical entities and the candidate medical entities in the large language model is verified. The entity position intervals of the pre-trained model candidate medical entities and the candidate medical entities in the large language model are compared. Pre-trained model candidate medical entities with the same entity type, corresponding entity text, and overlapping entity position intervals are identified as corresponding to the same medical entity as the candidate medical entities in the large language model. When more than one pre-trained model candidate medical entity meets the correspondence condition, they are sorted according to whether the entity text is completely identical or the position deviation is smaller. First, pre-trained model candidate medical entities with completely identical entity text are selected. If no candidate medical entities with completely identical entity text exist, the candidate medical entity with the smallest position difference is used to establish a cross-model candidate entity correspondence.
[0075] It should be noted that the positional deviation is the sum of the differences between the start and end positions of the candidate medical entities in the large language model and the corresponding start and end positions of the candidate medical entities in each pre-trained model.
[0076] A correspondence between candidate medical entities in the pre-trained model and candidate medical entities in the large language model is defined as follows: their entity texts are identical, or their entity texts have a continuous character inclusion relationship and the corresponding entities have the same entity type and overlapping position intervals. The classification of entities as the same medical entity is determined based on changes in entity position boundaries. When two candidate medical entities corresponding to an inclusion relationship only differ in their start or end positions and do not form independent entity boundaries, they are considered to have a correspondence as the same medical entity. When two candidate medical entities corresponding to an inclusion relationship each have independent start and end positions and respectively meet the medical entity recognition conditions, they are considered to have a different entity type. Candidate medical entities are retained, but no correspondence is established between them. For example, if the medical text to be identified is "patient diagnosed with chronic renal insufficiency", the pre-trained model identifies the candidate medical entity "renal insufficiency", and the large language model identifies the candidate medical entity "chronic renal insufficiency". Both entities are of the disease type and their positions overlap, but "renal insufficiency" and "chronic renal insufficiency" have independent entity boundaries, so they are not classified as the same medical entity. If the pre-trained model identifies "chronic renal insufficiency" and the large language model identifies "chronic renal insufficiency syndrome", and the two only have an extension of the entity end position, then they are identified as the same medical entity.
[0077] S3.2: For the same candidate medical entity in the cross-model candidate entity correspondence, read the ordered appearance status of the candidate entities according to the candidate entity sequence arrangement order, and determine the first appearance of the candidate entity sequence arrangement position, the range of consecutive appearances, and the missing positions between the ranges of consecutive appearances.
[0078] Specifically, for the same candidate medical entity in the cross-model candidate entity correspondence, the ordered appearance status of candidate entities is read sequentially according to the order of the candidate entity sequence. Starting from the first position of the sequence, the candidate entity sequence that is first recorded as appearing is searched, and the position of the corresponding candidate entity sequence is determined as the position of the first appearance of the candidate entity sequence. Starting from the position of the first appearance of the candidate entity sequence, the appearance status and missing status are checked according to the order of the candidate entity sequence. The positions of the candidate entity sequences that are continuously recorded as appearing are determined as a continuous appearance range. When a missing status is encountered, the current continuous appearance range ends, and the next continuous appearance range is determined from the next appearance status. The positions of the candidate entity sequences that are recorded as missing between two adjacent continuous appearance ranges are determined as the missing positions between the continuous appearance ranges.
[0079] S3.3: The probability support ratio is determined by the ratio of the sum of probabilities of the whole sentence sequence corresponding to the candidate entity sequence in the occurrence state to the sum of probabilities of the whole sentence sequence of all candidate entity sequences. The continuous support ratio is determined by the ratio of the number of candidate entity sequences contained in the continuous occurrence range with the largest number of candidate entity sequences to the number of candidate entity sequences between the first occurrence position and the last occurrence position. The degree of continuous support of candidate entities is calculated based on the probability support ratio and the continuous support ratio.
[0080] Specifically, for the same candidate medical entity in the cross-model candidate entity correspondence, the ordered appearance state of the candidate entities is read according to the sequence arrangement of the candidate entity sequences, the first appearance position and the last appearance position are determined, and the probability of the candidate entity sequence in the appearance state corresponding to the whole sentence sequence is extracted; the probability of the candidate entity sequence in the appearance state corresponding to the whole sentence sequence is summarized, and the ratio is calculated with the sum of the probability of the candidate entity sequence corresponding to the whole sentence sequence of all candidate entity sequences to obtain the probability support ratio; the number of candidate entity sequences contained in each continuous appearance range is counted, the largest number of candidate entity sequences is obtained, and the ratio of the largest number of candidate entity sequences to the number of candidate entity sequences contained between the first appearance position and the last appearance position is calculated to obtain the continuous support ratio; based on the probability support ratio and the continuous support ratio, the degree of continuous support of the candidate entity is calculated.
[0081] The expression for calculating the sustained support level of a candidate entity is:
[0082] ;
[0083] in, Indicates the level of sustained support for the candidate entity; Indicates the number of candidate entity sequences in a large language model; This indicates the sequence number of the candidate entity sequence, arranged from highest to lowest probability of the entire sentence sequence; Indicates that the same candidate medical entity is in the first The numerical value corresponding to the occurrence state in the sequence of candidate entities, the same candidate medical entity in the _ The value is 1 when the candidate entity sequence is in the present state and 0 when it is in the missing state. Indicates the first The probability of the entire sentence sequence corresponding to each candidate entity sequence; This represents the number of candidate entity sequences contained in the consecutive occurrence range that contains the most candidate entity sequences for the same candidate medical entity. Indicates the sequence number of the last candidate entity to appear in the same candidate medical entity sequence; This indicates the sequence number of the candidate entity that appears for the first time in the same candidate medical entity sequence.
[0084] It should be noted that before calculating the sustained support level of candidate entities, the number of candidate entity sequences in the large language model is limited to being greater than zero, and the same candidate medical entity must appear in at least one candidate entity sequence. The sum of the probabilities of the whole sentence sequences corresponding to all candidate entity sequences is also checked. When the number of candidate entity sequences in the large language model is greater than zero, the denominator of the continuous support ratio will not be zero. When the sum of the probabilities of the whole sentence sequences corresponding to all candidate entity sequences is greater than zero, the sustained support level of candidate entities is calculated according to the probability support ratio and the continuous support ratio. When the sum of the probabilities of the whole sentence sequences corresponding to all candidate entity sequences is equal to zero, the probability support ratio calculation is stopped, and the corresponding candidate medical entity is marked as having an invalid whole sentence sequence probability and is not included in the calculation of the sustained support level of the current candidate entity.
[0085] S3.4: Read the start and end positions of entities in the boundary evolution trajectory of candidate entities according to the order of the candidate entity sequence, obtain the deviation of each entity's start and end positions relative to the start and end positions of the pre-trained model candidate medical entities in the cross-model candidate entity correspondence, and obtain the change in entity boundary between adjacent candidate medical entities.
[0086] Specifically, the starting and ending positions of entities in the boundary evolution trajectory of candidate entities are read according to the order of the candidate entity sequence, and the starting and ending positions of candidate medical entities in the pre-trained model are read according to the cross-model candidate entity correspondence. The absolute difference between the starting position of the entity in the boundary evolution trajectory of the candidate entity and the starting position of the candidate medical entity in the pre-trained model is obtained as the entity starting position deviation, and the absolute difference between the corresponding entity ending positions is obtained as the entity ending position deviation. For two adjacent candidate medical entities, the absolute difference between the entity starting position and the absolute difference between the entity ending position are obtained, and the sum of the two absolute differences is determined as the entity boundary change.
[0087] S3.5: Determine the degree of deviation of the candidate entity boundary structure based on the boundary deviation of the entity's starting and ending positions in the candidate entity boundary evolution trajectory relative to the candidate medical entity positions in the pre-trained model, as well as the change in entity boundary between adjacent candidate medical entities. Determine the reliability of the candidate entity structure based on the inverse relationship between the candidate entity's sustained support and the degree of deviation of the candidate entity boundary structure.
[0088] Specifically, for the same candidate medical entity in the cross-model candidate entity correspondence, the deviations of the entity's starting position and ending position corresponding to each occurrence in the candidate entity's boundary evolution trajectory are summarized, and the average boundary deviation is obtained according to the number of occurrences. The changes in entity boundaries between adjacent candidate medical entities are summarized, and the average changes in entity boundaries are obtained according to the number of adjacent occurrences. The average boundary deviation and the average changes in entity boundaries are used to characterize the deviation of the entity boundary from the position of the candidate medical entity in the pre-trained model. The deviation scale is unified according to the entity text length of the candidate medical entity in the pre-trained model to obtain the degree of deviation of the candidate entity boundary structure. The degree of continuous support of the candidate entity is used as the positive influence quantity, and the degree of deviation of the candidate entity boundary structure is used as the negative influence quantity. According to the relationship that the reliability of the candidate entity structure increases when the continuous support of the candidate entity increases and the degree of deviation of the candidate entity boundary structure decreases, the reliability of the candidate entity structure is calculated.
[0089] The expression for calculating the deviation of the candidate entity boundary structure is:
[0090] ;
[0091] When the same candidate medical entity appears only once, and there is no change in the entity boundary between adjacent candidate medical entities, the expression for calculating the deviation of the candidate entity boundary structure is as follows:
[0092] ;
[0093] The expression for calculating the reliability of candidate entity structures is:
[0094] ;
[0095] in, Indicates the degree of deviation of the candidate entity's boundary structure; This indicates the number of times the same candidate medical entity is in the ordered occurrence state of candidate entities; This indicates the order in which the same candidate medical entity is determined according to the sequence of candidate entities. This is the first occurrence; Indicates the first candidate medical entity The next occurrence corresponds to the starting position of the entity; This indicates the starting position of the candidate medical entity in the pre-trained model within the cross-model candidate entity correspondence; Indicates the first candidate medical entity The next occurrence corresponds to the end position of the entity; This indicates the end position of the candidate medical entity in the pre-trained model in the cross-model candidate entity correspondence; This represents an identifier for the pre-trained model, used to characterize the reference position of candidate medical entities in the pre-trained model within the cross-model candidate entity correspondence; The entity text length of the candidate medical entities in the pre-trained model is determined according to the number of characters corresponding to the candidate medical entities in the pre-trained model. Indicates the first candidate medical entity The next occurrence corresponds to the starting position of the entity; Indicates the first candidate medical entity The next occurrence corresponds to the end position of the entity; This indicates the starting position of the entity when the same candidate medical entity appears only once. This indicates the end position of the entity when the same candidate medical entity appears only once. This indicates the reliability of the candidate entity structure.
[0096] S3.6: For each entity boundary recorded in the candidate entity boundary evolution trajectory, determine the degree of continuous support of the corresponding entity boundary based on the range of continuous occurrence of the candidate entity sequence where the corresponding entity boundary is located in the ordered occurrence state of the candidate entities.
[0097] Specifically, for each entity boundary recorded in the candidate entity boundary evolution trajectory, the candidate entity sequence appearing at the corresponding entity boundary is checked according to the entity's start and end positions, and the continuous occurrence range to which the corresponding candidate entity sequence belongs is determined based on the ordered occurrence state of the candidate entities; the number of candidate entity sequences in each continuous occurrence range whose entity start and end positions are consistent with the corresponding entity boundary is counted, and the number of candidate entity sequences contained in each continuous occurrence range to which the corresponding entity boundary belongs is summarized; the proportion of the total number of candidate entity sequences whose entity start and end positions are consistent with the corresponding entity boundary to the total number of candidate entity sequences contained in each continuous occurrence range to which the corresponding entity boundary belongs is determined as the degree of sustained support of the corresponding entity boundary.
[0098] S3.7: Compare the boundary deviations between each entity boundary and the candidate medical entity positions in the pre-trained model, and select the entity boundary with the highest degree of sustained support from the entity boundaries with the smallest boundary deviation as the candidate entity target boundary.
[0099] Specifically, the starting and ending positions of each entity boundary recorded in the candidate entity boundary evolution trajectory are read and compared with the starting and ending positions of the candidate medical entities in the pre-trained model in the cross-model candidate entity correspondence to obtain the entity starting position deviation and entity ending position deviation. The sum of the entity starting position deviation and entity ending position deviation is determined as the boundary deviation. The entity boundaries are arranged in ascending order of boundary deviation. The entity boundary with the highest degree of continuous support is selected from the entity boundaries with the smallest boundary deviation. If there is more than one entity boundary with the highest degree of continuous support, the entity boundary with the highest order of the corresponding candidate entity sequence when it first appears is selected as the candidate entity target boundary.
[0100] S4. Based on the cross-model candidate entity correspondence between the candidate medical entities in the pre-trained model and the candidate medical entities in the large language model, the candidate medical entities are fused together. The candidate medical entities with conflicting entity boundaries are selected based on the reliability of the candidate entity structure and the target boundary of the candidate entity, and medical named entity recognition information is generated.
[0101] S4.1: Group candidate medical entities from pre-trained models that correspond to the same medical entity and have the same entity type into the same candidate entity fusion group;
[0102] Specifically, based on the cross-model candidate entity correspondence, the pre-trained model candidate medical entities and the large language model candidate medical entities corresponding to the same medical entity are read. After verifying that the entity types are consistent, the pre-trained model candidate medical entities and the large language model candidate medical entities are merged, and the corresponding entity text, entity type, entity start position and entity end position are retained to establish a candidate entity fusion group.
[0103] It should be noted that after establishing the entity correspondence between candidate medical entities in the pre-trained model and candidate medical entities in the large language model, for candidate medical entities with entity correspondence and the same entity type, the corresponding candidate medical entities in the pre-trained model and candidate medical entities in the large language model are grouped into the same candidate entity fusion group; for candidate medical entities in the pre-trained model or candidate medical entities in the large language model that do not have entity correspondence, they are treated as candidate medical entities unique to a single model, and the reliability of the candidate entity structure output by the corresponding model is verified. When the reliability of the candidate entity structure meets the reliability threshold, the candidate medical entity unique to a single model is added to the candidate entity set; when the reliability of the candidate entity structure does not meet the reliability threshold, the corresponding candidate medical entity unique to a single model is excluded.
[0104] The reliability threshold is set based on the structural reliability of candidate entities to determine the retention and exclusion of candidate medical entities unique to a single model. The reliability data of candidate medical entity structures corresponding to labeled medical texts are obtained. The reliability of different candidate medical entity structures is sorted according to the degree of sustained support and the degree of deviation from the candidate entity boundary structure. The lowest structural reliability corresponding to the candidate medical entity in the labeled medical text that corresponds to the labeled medical entity and has a stable entity boundary is used as the reliability threshold. An exemplary value range is 0.75 to 0.90. When the reliability threshold is higher than 0.90, the screening condition is too high, and some candidate medical entities unique to a single model that have valid medical entity information but insufficient candidate entity support may be excluded. When the reliability threshold is lower than 0.75, candidate medical entities with insufficient structural support or large boundary deviation may be retained, affecting subsequent candidate medical entity fusion and boundary conflict handling.
[0105] S4.2: Determine the entity type corresponding to the candidate entity fusion group as the entity type of the fusion candidate medical entity, unify the entity start position and entity end position according to the candidate entity target boundary, and obtain the fusion candidate medical entity.
[0106] Specifically, the entity type and target boundary of the candidate entity fusion group are read, the entity type of the candidate entity fusion group is determined as the entity type of the fused candidate medical entity, and the entity start position and entity end position corresponding to the target boundary of the candidate entity are determined as the entity start position and entity end position of the fused candidate medical entity, respectively. The corresponding text content is obtained from the medical text to be identified according to the entity start position and entity end position as the entity text of the fused candidate medical entity, and the fused candidate medical entity is determined by the entity text, entity type, entity start position and entity end position.
[0107] S4.3: According to the candidate entity target boundary of the fused candidate medical entities, check the entity start position and entity end position to identify entity boundary conflicts that have partial overlap and no inclusion relationship;
[0108] Specifically, based on the entity start position and entity end position corresponding to different fusion candidate medical entities, the position intervals corresponding to the entity start position and entity end position are determined respectively; when comparing the position intervals of any two fusion candidate medical entities, if the two position intervals have a common character position and neither position interval completely covers the other position interval, it is determined that the position intervals of the two fusion candidate medical entities partially overlap, and the two fusion candidate medical entities are determined as fusion candidate medical entities with entity boundary conflicts.
[0109] S4.4: For fusion candidate medical entities with entity boundary conflicts, compare the reliability of the candidate entity structure, retain the fusion candidate medical entity with the highest reliability of the candidate entity structure and exclude the other fusion candidate medical entities with entity boundary conflicts, summarize the entity text, entity type, entity start position and entity end position corresponding to the retained fusion candidate medical entities, and generate medical named entity recognition information.
[0110] Specifically, based on the reliability of the candidate entity structure corresponding to the candidate medical entities with entity boundary conflicts, the candidate medical entities with entity boundary conflicts are ranked from high to low according to the reliability of the candidate entity structure. Starting from the first in the ranking, the current candidate medical entity is retained, and the candidate medical entities with entity boundary conflicts with the current candidate medical entity are excluded. Among the candidate medical entities that have not been excluded, the retention and exclusion process continues in the ranking order until all entity boundary conflicts are checked. When the reliability of the candidate entity structure is the same, the candidate medical entity with the highest continuous support degree of the entity boundary corresponding to the target boundary of the candidate entity is retained first. The entity text, entity type, entity start position and entity end position corresponding to all retained candidate medical entities are summarized and arranged from front to back according to the entity start position to generate medical named entity recognition information.
[0111] In summary, this invention, by establishing the ordered occurrence state of candidate entities and the evolution trajectory of candidate entity boundaries, can preserve the continuity of the same candidate medical entity's occurrence, missing positions, and entity boundary changes in different ordered candidate entity sequences during natural language processing. Furthermore, by combining the sustained support level of candidate entities with the positions of candidate medical entities in the pre-trained model, the reliability of the candidate entity structure and the target boundary of the candidate entities are determined. This allows the retention criteria for candidate medical entities to simultaneously reflect the stability of multi-sequence support and the consistency of boundary structures, which is beneficial for improving the accuracy of boundary determination for long medical terms, nested entities, and entities with similar boundaries. It also provides a clear basis for subsequent candidate medical entity fusion and the selection of entities with conflicting boundary conditions.
[0112] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A medical named entity recognition method integrating a pre-trained model and a large language model, characterized in that, include: Candidate medical entities in the medical text to be identified are identified by a pre-trained model, and the number of candidate entity sequences in the large language model is determined based on the text length and the number of candidate medical entities in the pre-trained model. The medical text to be identified is input into the large language model. A beam search is performed according to the number of candidate entity sequences in the large language model to obtain the candidate sequences and corresponding whole sentence sequence probabilities output by the large language model. The candidate entity sequences are arranged according to the whole sentence sequence probabilities to form candidate entity sequences. The text position of the candidate medical entities in the candidate entity sequences is corrected. The ordered appearance state of the candidate entities and the evolution trajectory of the candidate entity boundaries are established based on the appearance order and entity boundary changes of the same candidate medical entity in different candidate entity sequences. The degree of sustained support of different sorted candidate entity sequences for the same candidate medical entity is determined by the ordered appearance state of candidate entities. The reliability of the candidate entity structure is determined based on the degree of sustained support of candidate entities and the relationship between the evolution trajectory of candidate entity boundaries and the position of candidate medical entities in the pre-trained model. The target boundary of the candidate entity is determined from the evolution trajectory of candidate entity boundaries. Based on the cross-model candidate entity correspondence between candidate medical entities in the pre-trained model and candidate medical entities in the large language model, candidate medical entities are fused together. Then, candidate medical entities with conflicting entity boundaries are selected based on the reliability of the candidate entity structure and the target boundary of the candidate entity, and medical named entity recognition information is generated.
2. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 1, characterized in that, The steps for identifying candidate medical entities in the medical text to be identified are as follows: Obtain the medical text to be recognized, determine the text length according to the number of characters in the medical text to be recognized, input the medical text to be recognized into the pre-trained model for medical named entity recognition, and obtain the candidate medical entities and the number of candidate medical entities in the pre-trained model. For different text lengths of labeled medical texts and the number of candidate medical entities in the pre-trained model, medical named entity recognition of the large language model is performed with different numbers of candidate entity sequences. The number of target candidate entity sequences is determined based on the consistency between the medical named entities corresponding to different numbers of candidate entity sequences and the labeled medical entities, and a correspondence is established. The number of candidate entity sequences of the large language model is determined based on the text length of the medical text to be identified and the number of candidate medical entities in the pre-trained model.
3. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 2, characterized in that, The steps for performing beam search based on the number of candidate entity sequences in the large language model are as follows: The medical text to be recognized is input into the large language model. When the recognition content is generated step by step, the probability of the candidate sequence is updated according to the probability of the word corresponding to each generation position. The candidate sequence with the highest probability is retained according to the number of candidate entity sequences in the large language model until the candidate sequence generation is completed, and the candidate sequence and the probability of the corresponding whole sentence sequence are obtained. Candidate sequences are arranged from high to low probability of whole sentence sequence. The entity text, entity type and entity location corresponding to the candidate medical entity are obtained from each candidate sequence, and a candidate entity sequence is established according to the order of the candidate sequence.
4. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 1, characterized in that, The steps for correcting the text position of candidate medical entities in the candidate entity sequence are as follows: For each candidate medical entity in the candidate entity sequence, check the entity text against the medical text to be identified. If the entity text does not exist in the medical text to be identified, exclude the corresponding candidate medical entity. If the entity text exists but the entity position does not correspond, update the entity start position and entity end position according to the actual occurrence position of the entity text in the medical text to be identified. For candidate medical entities of the same entity type in different candidate entity sequences, candidate medical entities corresponding to the same medical entity are determined based on entity text and entity location, and cross-sequence correspondence between the same candidate medical entity and different candidate entity sequences is established.
5. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 4, characterized in that, The steps for establishing the ordered occurrence state of candidate entities and the evolution trajectory of candidate entity boundaries are as follows: The correspondence between candidate medical entities across sequences is checked sequentially according to the order of the candidate entity sequence. The occurrence and absence states of the same candidate medical entity in each candidate entity sequence are recorded. The occurrence and absence states are then associated according to the order of the corresponding candidate entity sequence to establish an ordered occurrence state of the candidate entities. Read the start and end positions of the candidate medical entities that are in the appearing state according to the order of the candidate entity sequence. Compare the start and end positions of adjacent candidate medical entities in turn. Record the change relationship between the start and end positions of the entities according to the order of the candidate entity sequence to establish the boundary evolution trajectory of the candidate entities.
6. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 1, characterized in that, The steps for determining the degree of sustained support of different ranked candidate entity sequences for the same candidate medical entity are as follows: Verify the candidate medical entities in the pre-trained model and the candidate medical entities in the large language model according to entity type, entity text, and entity location. Establish cross-model candidate entity correspondence for candidate medical entities with the same entity type, corresponding entity text, and overlapping entity location ranges. For the same candidate medical entity in the cross-model candidate entity correspondence, the candidate entity is read in the order of its sequence arrangement to determine the first occurrence position of the candidate entity sequence, the range of consecutive occurrences, and the missing positions between the ranges of consecutive occurrences. The probability support ratio is determined by the proportion of the sum of probabilities of the entire sentence sequence corresponding to the candidate entity sequence in the occurrence state to the sum of probabilities of the entire sentence sequence of all candidate entity sequences. The continuous support ratio is determined by the proportion of the number of candidate entity sequences contained in the continuous occurrence range with the largest number of candidate entity sequences to the number of candidate entity sequences between the first and last occurrence positions. The degree of continuous support for candidate entities is calculated based on the probability support ratio and the continuous support ratio.
7. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 6, characterized in that, The steps for determining the reliability of candidate entity structures are as follows: Read the entity start position and entity end position in the boundary evolution trajectory of the candidate entity according to the order of the candidate entity sequence, obtain the deviation of each entity start position and entity end position relative to the start position and end position of the candidate medical entity in the pre-trained model in the cross-model candidate entity correspondence, and obtain the entity boundary change between adjacent candidate medical entities. The degree of deviation of the candidate entity boundary structure is determined by the boundary deviation of the entity's starting and ending positions relative to the candidate medical entity positions in the pre-trained model in the candidate entity boundary evolution trajectory, as well as the change in entity boundary between adjacent candidate medical entities. The reliability of the candidate entity structure is determined by the inverse relationship between the degree of continuous support of the candidate entity and the degree of deviation of the candidate entity boundary structure.
8. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 7, characterized in that, The steps for determining the candidate entity target boundary from the candidate entity boundary evolution trajectory are as follows: For each entity boundary recorded in the candidate entity boundary evolution trajectory, the degree of continuous support of the corresponding entity boundary is determined based on the range of continuous occurrence of the candidate entity sequence where the corresponding entity boundary is located in the ordered occurrence state of the candidate entities. Compare the boundary deviations between each entity boundary and the candidate medical entity positions in the pre-trained model, and select the entity boundary with the highest degree of sustained support from the entity boundaries with the smallest boundary deviation as the candidate entity target boundary.
9. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 8, characterized in that, The steps for fusing candidate medical entities are as follows: Pre-trained model candidate medical entities that correspond to the same medical entity and have the same entity type are grouped into the same candidate entity fusion group with large language model candidate medical entities. The entity type corresponding to the candidate entity fusion group is determined as the entity type of the fusion candidate medical entity. The starting position and ending position of the entity are unified according to the target boundary of the candidate entity to obtain the fusion candidate medical entity.
10. The medical named entity recognition method based on the fusion of a pre-trained model and a large language model as described in claim 9, characterized in that, The steps for selecting candidate medical entities with conflicting entity boundaries are as follows: By checking the starting and ending positions of entities according to the target boundaries of the fused candidate medical entities, entity boundary conflicts that have partial overlap and no inclusion relationship are identified. For fusion candidate medical entities with entity boundary conflicts, the reliability of the candidate entity structure is compared. The fusion candidate medical entity with the highest reliability of the candidate entity structure is retained, and the other fusion candidate medical entities with entity boundary conflicts are excluded. The entity text, entity type, entity start position and entity end position corresponding to the retained fusion candidate medical entities are summarized to generate medical named entity recognition information.
