A medical text key information extraction method and system based on an attention mechanism

CN122528895APending Publication Date: 2026-08-07BEIJING WANBO ORIENTAL SOFTWARE ENGINEERING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING WANBO ORIENTAL SOFTWARE ENGINEERING CO LTD
Filing Date
2026-06-02
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]然而,现有方案在实际医疗文本处理场景下存在显著局限:首先,病例文本通常由主诉、现病史、既往史、辅助检查、诊断结论等多个具有明显结构性差异的子区段组成,通用模型并未在字符向量层面引入病例特有的结构次序信息,难以体现不同子区段之间的层级关系;其次,医学实体之间存在大量诸如疾病与症状、药物与适应症等专业领域的临床逻辑约束,通用注意力机制无法感知这些临床逻辑约束,容易在不相关的字符之间产生噪声关联;再次,病例文本中跨段落的依赖现象普遍存在,例如既往史子区段所记载的慢性病信息往往对当前主诉子区段的实体判别具有决定性影响,而现有方案在段落分界处缺乏专门的跨段注意力交互机制,难以准确捕获跨段依赖特征;最后,现有方案在医学实体边界位置的判别环节多仅依赖字符级类别概率,未对实体的起始端点、内部节点以及结束端点之间的位置转移关系进行联合建模,导致医学实体边界容易出现拦截偏差

Benefits of technology

[0016]本申请通过对病例文本序列进行区段划分并将病例结构向量与初始字符向量进行融合,打破了传统通用领域命名实体识别方案仅在字符语义层面进行向量化表征的局限,使得病例文本所特有的主诉、现病史、既往史等子区段层级关系能够在字符向量层面被显式建模,为后续临床逻辑约束下的注意力交互奠定了结构化基础;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122528895A_ABST
    Figure CN122528895A_ABST
Patent Text Reader

Abstract

The application provides a medical text key information extraction method and system based on an attention mechanism, and relates to the technical field of medical text information processing. The application first splits and converts a case text sequence into an initial character vector; then performs section division and structure order value distribution on the case text sequence to obtain a case structure vector, and fuses the case structure vector with the initial character vector to obtain a fused character vector; further, the application matches the corresponding clinical logical attributes of the fused character vector in a medical knowledge graph to construct a clinical correlation matrix; determines an attention interaction range based on the clinical correlation matrix to obtain a local case vector; then performs an attention interaction operation on the local case vector across paragraph boundary markers to obtain a global case vector; finally, the application performs character interception on the case text sequence to obtain different medical entity boundary positions and corresponding medical entity labels. The application effectively combines medical field knowledge and case structure information to improve the accuracy of medical text key information extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of medical text information processing technology, and in particular to a method and system for extracting key information from medical text based on an attention mechanism. Background Technology

[0002] With the rapid development of medical informatization, hospitals have accumulated massive amounts of electronic medical record text data during daily diagnosis and treatment. Automatically extracting medical entities (such as disease names, symptoms, test indicators, drug names, surgical procedures, etc.) and their boundary locations from medical record texts is an important foundation for building medical knowledge bases, assisting clinical decision-making, and promoting precision medicine.

[0003] Existing solutions for extracting key information from medical texts often employ general-domain named entity recognition models. For example, pre-trained language models trained on general corpora are directly concatenated with sequence labeling layers for case text processing. While some solutions introduce character-level attention mechanisms to capture semantic relationships between characters, they generally adopt a globally undifferentiated interaction approach in terms of the scope of attention interactions, meaning that each character is associated with all other characters in the sequence.

[0004] However, existing solutions have significant limitations in real-world medical text processing scenarios: First, case texts typically consist of multiple sub-segments with distinct structural differences, such as chief complaint, present illness, past medical history, auxiliary examinations, and diagnostic conclusions. General models do not incorporate case-specific structural order information at the character vector level, making it difficult to reflect the hierarchical relationships between different sub-segments. Second, there are numerous clinical logical constraints between medical entities, such as those related to diseases and symptoms, or drugs and indications. General attention mechanisms cannot perceive these clinical logical constraints, easily leading to noisy associations between unrelated characters. Third, cross-segment dependencies are prevalent in case texts. For example, chronic disease information recorded in the past medical history sub-segment often has a decisive influence on entity identification in the current chief complaint sub-segment. Existing solutions lack a dedicated cross-segment attention interaction mechanism at paragraph boundaries, making it difficult to accurately capture cross-segment dependency features. Finally, existing solutions rely primarily on character-level category probabilities in the identification of medical entity boundaries, failing to jointly model the positional transfer relationships between the entity's starting endpoint, internal nodes, and ending endpoints, resulting in interception biases at medical entity boundaries. Summary of the Invention

[0005] To address the problems existing in the prior art, the purpose of this application is to provide a method and system for extracting key information from medical text based on an attention mechanism. This method introduces the order information of the case structure by fusing the case structure vector with the initial character vector, and constructs a clinical association matrix based on the clinical logical attributes provided by the medical knowledge graph to constrain the scope of attention interaction. Then, it captures cross-segment dependency features through cross-segment attention interaction, and finally intercepts characters in the case text sequence by combining the category belonging probability and the position transition probability. This significantly improves the accuracy and robustness of extracting key information from medical text in complex case text scenarios.

[0006] To achieve the above objectives, this application adopts the following technical solution: Firstly, this application provides a method for extracting key information from medical text based on an attention mechanism, including: The case text sequence is segmented and converted into an initial character vector based on a pre-stored character mapping dictionary; The case text sequence is divided into segments and the structural order is numerically assigned to obtain a case structure vector, and the case structure vector is fused with the initial character vector to obtain a fused character vector; In a pre-built medical knowledge graph, the clinical logical attributes corresponding to the fused character vectors are matched, and a clinical association matrix between the characters represented by different fused character vectors is constructed based on the clinical logical attributes. The interaction range of the fused character vector during attention interaction is determined based on the clinical correlation matrix, and the local case vector is determined based on the interaction range. Perform attention interaction operations across paragraph boundary markers on the local case vector, capture the cross-segment dependency features contained in the local case vector, and update the local case vector to the global case vector based on the cross-segment dependency features; Based on the global case vector, character interception is performed on the case text sequence to obtain the boundary positions of different medical entities and their corresponding medical entity labels.

[0007] Optionally, the case text sequence is segmented and converted into an initial character vector based on a pre-stored character mapping dictionary, including: Scan the word boundary points of the case text sequence, and segment the case text sequence along the word boundary points to obtain a text segmentation sequence composed of multiple medical basic word fragments; Extract the semantic distribution values ​​of the corresponding medical basic word fragments from the pre-stored character mapping dictionary; Record the character arrangement order of the medical basic word fragments in the case text sequence, and convert the character arrangement order into an absolute position sequence; The semantic distribution values ​​are combined with the absolute position sequence to generate a composite character state; The composite character state is subjected to a dimension uniform transformation process, and the transformed composite state value is determined as the initial character vector.

[0008] Optionally, the case text sequence is segmented and structural order numerically assigned to obtain a case structure vector, and the case structure vector is fused with the initial character vector to obtain a fused character vector, including: Scan the case text sequence and identify the title introductory markers and line break characters contained in the case text sequence; Using the identified title guide and line break as breakpoints, the case text sequence is divided into multiple sub-case segments; Based on the arrangement order of each sub-case segment in the case text sequence, a structural order value is assigned to each sub-case segment; The structural order values ​​are converted into a numerical spatial distribution state, and the numerical spatial distribution state is used as the case structure vector; The case structure vector is superimposed onto the initial character vector by numerical addition to obtain the fused character vector.

[0009] Optionally, the clinical logical attributes corresponding to the fused character vectors are matched in a pre-built medical knowledge graph, and a clinical association matrix between characters represented by different fused character vectors is constructed based on the clinical logical attributes, including: Extract the local vector fragments contained in the fused character vector according to the paragraph boundaries of the sub-case segment; The local vector fragment is matched with the entity nodes contained in the pre-set medical knowledge graph by attribute matching, and reference entity nodes that have a mapping relationship with the local vector fragment are extracted from the medical knowledge graph. Read the network topology connection category of the reference entity node in the medical knowledge graph, and determine the network topology connection category as a clinical logical attribute; Based on the clinical logical attributes, determine the clinical constraint relationships between the characters represented by different fused character vectors; Record the coordinate positions of the fused character vectors with the aforementioned clinical constraints in the vector space, and aggregate all coordinate positions to generate a clinical association matrix.

[0010] Optionally, determining the interaction range of the fused character vector during attention interaction operations based on the clinical correlation matrix, and determining local case vectors based on the interaction range, includes: Read the set of coordinates that are allowed to generate interactive associations recorded in the clinical association matrix; Block the data interaction path of other vector channels outside the coordinate set in the fused character vector; Extract the attribute association weights corresponding to clinical constraints between different fused character vectors within the coordinate set; The fused character vectors within the coordinate set are numerically weighted and merged based on the attribute association weights. The vector state output after numerical weighting and merging is determined as the feature aggregation result, and the feature aggregation result is used as the local case vector.

[0011] Optionally, an attention interaction operation across paragraph boundary markers is performed on the local case vector to capture the cross-paragraph dependency features contained in the local case vector, and the local case vector is updated to a global case vector based on the cross-paragraph dependency features, including: Perform numerical aggregation on the feature dimension on the local case vectors corresponding to each sub-case segment, and extract the segment condensation vector after aggregation as the representative case vector; The cross-segment interaction paths between the representative case vectors are constructed using the segment boundary markers as connection nodes. Calculate the logical dependency weights between representative case vectors of different sub-case segments along the cross-segment interaction path; Based on the logical dependency weights, the representative case vectors on the cross-segment interaction path are summarized to output cross-segment dependency features; The cross-segment dependency features are applied to perform feature overlay processing on the current local case vector to obtain the global case vector.

[0012] Optionally, character interception is performed on the case text sequence based on the global case vector to obtain the boundary positions of different medical entities and their corresponding medical entity labels, including: Extract the character order of the case text sequence, and input the global case vector into a preset label mapping matrix along the character order; The category attribution probability of the global case vector corresponding to different medical entity classification categories is extracted using the label mapping matrix; The position transition probabilities of the global case vector as the start endpoint, internal node, and end endpoint of the medical entity are calculated in parallel. The category attribution probability and the location transfer probability are numerically superimposed, the probability extreme value path is found based on the numerical superposition result, and the target entity category mapped by the probability extreme value path is analyzed. Based on the probability extreme value path, character interception is performed in the case text sequence to obtain the entity boundary position, and medical entity labels corresponding to the entity boundary position are extracted from the target entity category.

[0013] Secondly, this application provides a medical text key information extraction system based on an attention mechanism, comprising: The conversion module is used to segment the case text sequence and convert it into an initial character vector based on a pre-stored character mapping dictionary; and to divide the case text sequence into segments and assign structural order values ​​to obtain a case structure vector, and to fuse the case structure vector with the initial character vector to obtain a fused character vector; The matrix construction module is used to match the clinical logical attributes corresponding to the fused character vectors in a pre-set medical knowledge graph, and construct a clinical association matrix between the characters represented by different fused character vectors based on the clinical logical attributes. A local aggregation module is used to determine the interaction range of the fused character vector when performing attention interaction operations based on the clinical correlation matrix, and to determine local case vectors based on the interaction range; The cross-segment interaction module is used to perform attention interaction operations across segment boundary markers on the local case vector, capture the cross-segment dependency features contained in the local case vector, and update the local case vector to the global case vector based on the cross-segment dependency features. The entity interception module is used to intercept characters in the case text sequence based on the global case vector to obtain the boundary positions of different medical entities and their corresponding medical entity labels.

[0014] Thirdly, this application provides a computing device, including a processing component and a storage component; the storage component stores one or more computer instructions; the one or more computer instructions are invoked and executed by the processing component to implement a method for extracting key information from medical text based on an attention mechanism as described in the first aspect above.

[0015] Fourthly, this application provides a computer storage medium storing a computer program, which, when executed by a computer, implements a method for extracting key information from medical text based on an attention mechanism as described in the first aspect.

[0016] This application breaks through the limitation of traditional general domain named entity recognition schemes that only perform vectorized representation at the character semantic level by dividing the case text sequence into segments and fusing the case structure vector with the initial character vector. This allows the hierarchical relationship of sub-segments such as chief complaint, present illness, and past medical history unique to the case text to be explicitly modeled at the character vector level, laying a structured foundation for attention interaction under subsequent clinical logic constraints. Furthermore, this application introduces a pre-built medical knowledge graph and establishes the network topology connection category of the reference entity node as a clinical logical attribute. Then, it constructs a clinical association matrix based on the clinical logical attribute to constrain the scope of attention interaction. This avoids the noisy associations generated between unrelated characters in the global undifferentiated interaction mode of the general attention mechanism, and suppresses the interference of non-clinically reasonable associations on entity discrimination from the source. Furthermore, this application constructs cross-segment interaction paths and captures cross-segment dependency features by using paragraph boundary markers as connection nodes, thereby updating local case vectors to global case vectors. This solves the deficiency of existing solutions in lacking a dedicated cross-segment attention interaction mechanism at paragraph boundaries, enabling the effective perception of remote dependencies such as the historical sub-segment to the chief complaint sub-segment. Furthermore, this application finds the extreme probability path by numerically superimposing the category classification probability with the position transition probability between the starting endpoint, internal nodes, and ending endpoint, thus overcoming the entity boundary interception bias caused by traditional schemes that rely solely on character-level category probabilities. Overall, it significantly improves the accuracy, robustness, and adaptability to the structural characteristics of case texts and medical domain knowledge in the extraction of key information from medical texts.

[0017] These or other aspects of this application will become more apparent in the following description of the embodiments. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 A flowchart illustrating a method for extracting key information from medical text based on an attention mechanism, provided in an embodiment of this application; Figure 2 A schematic diagram illustrating the processing principle of fusing the case structure vector and the initial character vector to obtain the fused character vector, as provided in the embodiments of this application; Figure 3 A schematic diagram illustrating the logical relationship of constructing a clinical association matrix based on a medical knowledge graph, provided for embodiments of this application; Figure 4 A schematic diagram of the local attention interaction range based on clinical association matrix constraints provided in an embodiment of this application; Figure 5 A schematic diagram of the cross-segment attention interaction path for crossing paragraph boundary markers provided in this application embodiment; Figure 6This is a schematic diagram of the structure of a medical text key information extraction system based on an attention mechanism, provided in an embodiment of this application. Detailed Implementation

[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0021] To facilitate understanding of the embodiments of this application, some non-publicly known terms involved in this application will be briefly explained first.

[0022] The case text sequence refers to an electronic text character stream exported from the hospital information system, which records the driver's entire medical process information in character order. In this application, the case text sequence is presented as a continuous character stream without any segmentation or preprocessing, covering sub-case sections such as chief complaint, present illness, past medical history, auxiliary examinations, and diagnostic conclusions.

[0023] A character mapping dictionary is a pre-constructed mapping lookup table that records basic medical word fragments and their corresponding semantic distribution values. In this application, the character mapping dictionary is trained based on a large-scale medical corpus, which can be obtained, for example, through pre-trained word vector algorithms such as Word2Vec and BERT. The specific size can be set according to the scale of the case text corpus.

[0024] The initial character vector refers to the vectorized numerical value output after the basic word fragments are queried by the character mapping dictionary and fused with the absolute position sequence, which is used to represent the basic information of character semantics and position. In this application, the initial character vector does not incorporate case text structure information.

[0025] The case structure vector is a vectorized numerical value generated based on the arrangement order of the sub-case segments divided according to the case text sequence, used to represent the hierarchical relationship of the sub-case segment to which the character belongs. In this application, the case structure vector and the initial character vector are fused by numerical addition to obtain the fused character vector.

[0026] A fused character vector is a composite vector obtained by fusing the case structure vector with the initial character vector, carrying both character semantic location information and sub-case segment structure information.

[0027] A pre-built medical knowledge graph refers to a directed graph constructed in advance, with medical entities such as diseases, symptoms, drugs, test indicators, and anatomical sites as nodes and clinical relationships such as diagnosis, treatment, complications, and examinations as edges. In this application, the pre-built medical knowledge graph can be constructed based on publicly available medical knowledge graphs (such as SNOMED CT, UMLS, etc.), and can be tailored according to the clinical departments involved in the case text.

[0028] Clinical logical attributes refer to the network topology connection categories of reference entity nodes matched in a pre-set medical knowledge graph by the characters represented by the fused character vector. In this application, the relationship type of the edges connected between reference entity nodes (e.g., disease-symptom, drug-indication, test indicator-disease, etc.) is used as the specific manifestation of clinical logical attributes.

[0029] The clinical association matrix is ​​a two-dimensional matrix formed by the coordinate positions of fused character vectors with clinical constraints in the vector space. In this application, the clinical association matrix exists in the form of 0, 1 or weight values, and is used to control the opening and closing of interaction pathways between different characters in attention interaction operations.

[0030] Local case vectors refer to the feature aggregation results output by merging character vectors after attention-weighted merging under the constraints of the clinical association matrix. In this application, local case vectors only carry feature aggregation relationships within the coordinate set allowed by the clinical association matrix.

[0031] Cross-segment dependency features refer to the summary results of logical dependencies calculated along the cross-segment interaction path between representative case vectors corresponding to different sub-case segments. In this application, cross-segment dependency features are used to capture cross-segment remote semantic associations such as past history to chief complaint and auxiliary examinations to diagnostic conclusions.

[0032] The global case vector is the final vector representation obtained by superimposing the local case vectors with cross-segment dependency features, which carries both local clinical constraints and cross-segment dependencies.

[0033] The boundary position of a medical entity and the label of a medical entity refer to the starting and ending character positions of the medical entity in the character arrangement order that is finally intercepted from the sequence of medical case texts, as well as the name of the medical category to which the entity belongs. In this application, the labels of medical entities include, but are not limited to, specific categories such as diseases, symptoms, drugs, test indicators, and surgical procedures.

[0034] Figure 1 This is a flowchart illustrating a method for extracting key information from medical text based on an attention mechanism, as provided in an embodiment of this application. Figure 1As shown in the figure, the medical text key information extraction method based on attention mechanism provided in this application includes steps S100 to S600. The steps are described in detail below with reference to the accompanying drawings.

[0035] Step S100: The case text sequence is segmented and converted into an initial character vector based on a pre-stored character mapping dictionary.

[0036] In this step, to enable subsequent attention-based interactive operations to unfold based on computable numerical objects, the case text sequence, existing as a continuous character stream, needs to be converted into an initial character vector. The reason for using segmentation followed by character mapping dictionary lookup for vectorization is that the case text contains numerous medical terminology fragments composed of multiple Chinese characters, such as sinus arrhythmia and metformin. Vectorizing these fragments individually would destroy their overall semantic meaning; therefore, segmentation along word boundaries followed by dictionary lookup is necessary to preserve the complete medical meaning of the fragments.

[0037] Specifically, the process of generating the initial character vector in this step includes: First, the word boundary points of the case text sequence are scanned, and the case text sequence is segmented along these word boundary points to obtain a text segmentation sequence composed of multiple medical basic word fragments. The word boundary points refer to the semantic boundary positions between adjacent word fragments in the case text sequence. Specifically, the scanning of word boundary points can be implemented using a medical word segmentation algorithm based on conditional random fields. This algorithm calculates the posterior probability of each character as a word boundary point based on pre-trained character transition probabilities and emission probabilities, and marks positions with posterior probabilities higher than a preset segmentation threshold as word boundary points. The medical basic word fragment refers to the smallest semantically complete word unit obtained after segmentation; for example, sinus arrhythmia is retained as a complete medical basic word fragment.

[0038] Secondly, semantic distribution values ​​corresponding to the medical basic word fragments are extracted from the pre-stored character mapping dictionary. The character mapping dictionary is trained on a large-scale medical corpus during pre-construction. The training algorithm can be, for example, the Word2Vec algorithm based on Skip-gram or the BERT pre-training algorithm based on the Transformer encoder, which can be set according to the size of the case text corpus. The semantic distribution value refers to the fixed-dimensional floating-point vector (for example, it can be set to 768 dimensions, which can be adjusted according to the computing resources of downstream tasks) corresponding to each medical basic word fragment stored in the character mapping dictionary, which is used to characterize the distribution position of the word fragment in the medical semantic space.

[0039] Next, the character arrangement order of the medical basic word fragments in the case text sequence is recorded, and the character arrangement order is converted into an absolute position sequence. The character arrangement order refers to the integer index of each medical basic word fragment starting from the beginning position of the case text sequence; the absolute position sequence refers to the floating-point vector sequence output after inputting the integer indices into a preset position encoding function. The position encoding function can, for example, be implemented using sine and cosine position encoding, and the specific calculation formula for the sine and cosine position encoding can be expressed as follows: in, This is an absolute position encoded value. For the order of character arrangement, Dimension index for location encoding The position encoding dimension is set to 768 dimensions (e.g., 768 dimensions). The reason for using sine and cosine position encoding is that this encoding method can express the relative distance between any two positions through a linear transformation relationship, which is convenient for relative position perception during attention interaction.

[0040] Then, the semantic distribution value and the absolute position sequence are merged to generate a composite character state. Specifically, this merging can be achieved by adding values ​​along corresponding dimensions, that is, adding the semantic distribution value and the absolute position sequence along each dimension to obtain a composite character state that carries both semantic and positional information.

[0041] Finally, a dimension unification transformation is performed on the composite character state, and the transformed composite state value is determined as the initial character vector. Specifically, this dimension unification transformation can be implemented using linear projection, that is, by using a preset learnable transformation matrix to map the composite character state to a unified hidden dimension space (e.g., 768 dimensions), and the output transformed composite state value is the initial character vector. The reason for performing the dimension unification transformation is to ensure that the vector dimensions operated on in different subsequent processing stages are consistent, avoiding computational anomalies caused by dimension mismatch.

[0042] Step S200: The case text sequence is divided into segments and the structural order values ​​are assigned to obtain a case structure vector, and the case structure vector is fused with the initial character vector to obtain a fused character vector.

[0043] Since the initial character vector obtained in step S100 only carries the semantic and absolute positional information of the characters and does not introduce the sub-segment structural information unique to case texts, and case texts are usually composed of multiple sub-segments with obvious structural differences, such as chief complaint, present illness, past medical history, auxiliary examinations, and diagnostic conclusions, different sub-segments have different contextual roles in entity discrimination, it is necessary to further inject case structure information on the basis of the initial character vector. The following is combined with Figure 2 Please provide a detailed explanation.

[0044] Figure 2 This is a schematic diagram illustrating the processing principle of fusing the case structure vector and the initial character vector to obtain the fused character vector, as provided in the embodiments of this application. Figure 2 As shown, the case text sequence 201 is divided into multiple sub-case segments 203 (e.g., chief complaint sub-segment, present illness sub-segment, past medical history sub-segment, auxiliary examination sub-segment, diagnosis conclusion sub-segment, etc.) by the segmentation unit 202. Each sub-case segment 203 is assigned a corresponding structural order value 205 by the structural order allocation unit 204. The structural order value 205 is transformed into a case structure vector 207 by the numerical spatial distribution transformation unit 206. The case structure vector 207 and the initial character vector 208 output from step S100 are superimposed at the fusion unit 209 by numerical addition, and finally the fused character vector 210 is output.

[0045] Specifically, the process of generating the fused character vector in this step includes: First, the case text sequence is scanned to identify title introductory markers and line break characters contained within it. Title introductory markers refer to fixed text patterns used to introduce the beginning of sub-case sections in the case text sequence, such as "Chief Complaint:", "Present Illness:", "Past Medical History:", "Ancillary Examinations:", "Diagnosis Conclusion:", etc.; line break characters refer to carriage returns or newlines used to separate different paragraphs in the case text sequence. The identification of title introductory markers can be implemented, for example, using a string matching algorithm based on regular expressions, where the regular expressions pre-include common sub-case section title patterns.

[0046] Secondly, using the identified title guide markers and line break symbols as breakpoints, the case text sequence is divided into multiple sub-case segments. The character segments between each two adjacent breakpoints constitute an independent sub-case segment. The reason for using both title guide markers and line break symbols as breakpoints is that some case texts may lack standardized title guide markers, and relying solely on line break symbols can serve as a fallback for segmentation, ensuring the robustness of segment division.

[0047] Next, based on the arrangement order of each sub-case segment in the case text sequence, a structural order value is assigned to each sub-case segment. The arrangement order refers to the index of each sub-case segment from the beginning of the case text sequence; the structural order value is an integer identifier starting from 1 and incrementing according to the arrangement order. For example, the chief complaint sub-case is assigned 1, the present illness sub-case is assigned 2, the past medical history sub-case is assigned 3, and so on. All characters within the same sub-case segment share the same structural order value.

[0048] Then, the structural order values ​​are converted into a numerical spatial distribution state, and this numerical spatial distribution state is used as the case structure vector. The numerical spatial distribution state refers to the floating-point vector output after mapping the integer structural order values ​​through a preset embedding function. The embedding function can be implemented, for example, using a learnable embedding matrix. The number of rows in the embedding matrix is ​​equal to the number of sub-case segment categories, and the number of columns is equal to the hidden dimension of the initial character vector (for example, it can be set to 768 dimensions). Each structural order value is mapped to the corresponding floating-point vector by a lookup table, which is the case structure vector.

[0049] Finally, the case structure vectors are numerically added to the initial character vectors to obtain the fused character vector. This numerical addition involves adding the case structure vector of the sub-case segment to which the character belongs to each character position element-wise along each dimension to the character's own initial character vector. The resulting sum is the fused character vector. The reason for using numerical addition instead of concatenation is to ensure that structural information is evenly distributed across all dimensions without increasing the vector dimension, facilitating subsequent attention interactions with equal-dimensional elements.

[0050] Step S300: Match the clinical logical attributes corresponding to the fused character vectors in the preset medical knowledge graph, and construct a clinical association matrix between the characters represented by different fused character vectors based on the clinical logical attributes.

[0051] Because the general attention mechanism uses a globally undifferentiated interaction approach—that is, allowing each character to form an attentional association with all other characters in the sequence—this approach introduces a large amount of noisy associations between clinically irrelevant characters in medical texts. To ensure that attentional interactions occur only between characters with reasonable clinical relevance, this step constructs a clinical association matrix to constrain the scope of attentional interactions by introducing clinical logical attributes carried by a pre-built medical knowledge graph. The following section will combine... Figure 3 Please provide a detailed explanation.

[0052] Figure 3 This is a schematic diagram illustrating the logical relationships involved in constructing a clinical association matrix based on a medical knowledge graph, as provided in the embodiments of this application. Figure 3 As shown, the fused character vector sequence 301 is divided into multiple local vector segments 303 by the local vector segment extraction unit 302 according to the segment boundaries of the sub-case area; the local vector segments 303 are matched with the entity nodes 305 contained in the pre-set medical knowledge graph 304 for attributes, and the successfully matched entity nodes are used as reference entity nodes 306; the network topology connection category 307 of the reference entity nodes 306 (such as disease-symptom relationship, drug-indication relationship, test indicator-disease relationship, etc.) is read and established as clinical logical attributes 308; the clinical logical attributes 308 drive the clinical constraint relationship judgment unit 309 to identify the clinical constraint relationship between the fused character vectors, and finally generate a clinical association matrix 310.

[0053] Specifically, the process of constructing the clinical correlation matrix in this step includes: First, local vector segments contained in the fused character vector are extracted according to the paragraph boundaries of the sub-case section. The local vector segment refers to the set of character vectors located within the same sub-case section in the fused character vector sequence; the extraction process can be specifically performed, for example, by slicing the vector sequence based on the position of the title guide marker and line break character identified in step S200, and the vector slice between every two adjacent breakpoints is a local vector segment.

[0054] Secondly, the local vector fragment is matched with the entity nodes contained in the pre-set medical knowledge graph for attributes, and reference entity nodes that have a mapping relationship with the local vector fragment are extracted from the medical knowledge graph. Specifically, the attribute matching can be implemented using a nearest neighbor retrieval algorithm based on vector similarity. The cosine similarity is calculated between the fused character vector of each character in the local vector fragment and the node embedding vectors of all entity nodes in the pre-set medical knowledge graph. Entity nodes with a similarity higher than a preset matching threshold (e.g., 0.8, which can be adjusted according to the sparsity of the knowledge graph) are used as reference entity nodes. The node embedding vector refers to the fixed-dimensional floating-point vector corresponding to each entity node in the pre-set medical knowledge graph, which can be pre-trained using graph embedding algorithms (e.g., TransE, Node2Vec, etc.).

[0055] Next, the network topology connection category of the reference entity node in the medical knowledge graph is read, and the network topology connection category is determined as a clinical logical attribute. The network topology connection category refers to the relationship type of the edges connecting the reference entity node and its adjacent entity nodes in the pre-defined medical knowledge graph; common network topology connection categories include, for example, disease-symptom, drug-indication, test indicator-disease, anatomical location-disease, etc.; the network topology connection category can be obtained by querying the type of the outgoing and incoming edges of the reference entity node in the medical knowledge graph.

[0056] Then, based on the clinical logical attributes, the clinical constraint relationship between the characters represented by the different fused character vectors is determined. The clinical constraint relationship refers to the reasonable association between the entities represented by the two characters at the clinical medical level; the specific determination method can be expressed as follows: if the reference entity nodes corresponding to the two characters have a direct connecting edge in the medical knowledge graph or can be indirectly connected within a preset number of hops (e.g., 2 hops, which can be set according to the density of the knowledge graph), then it is determined that there is a clinical constraint relationship between the two characters; otherwise, there is no clinical constraint relationship.

[0057] Finally, the coordinate positions of the fused character vectors with the aforementioned clinical constraints are recorded in the vector space, and all coordinate positions are aggregated to generate a clinical correlation matrix. The coordinate position refers to the character index of the fused character vector in the case text sequence; the coordinate positions of all character pairs with clinical constraints are recorded in an L×L two-dimensional matrix M (where L is the total number of characters in the case text sequence). With characters If there is a clinical constraint relationship, then the corresponding position in the matrix is... The value is 1 if it is not 1, and 0 otherwise; the output after collection This is the clinical association matrix. The clinical association matrix can be used as a mask in subsequent attention-based interaction operations, restricting attention-based interactions to only... It occurs between pairs of characters.

[0058] Step S400: Determine the interaction range of the fused character vector when performing attention interaction operation based on the clinical association matrix, and determine the local case vector based on the interaction range.

[0059] Step S300 has already constructed the clinical association matrix carrying clinical constraints. This step further utilizes the clinical association matrix as a mask to constrain the attention interaction range, ensuring that the fused character vectors only undergo feature aggregation within the coordinate set with reasonable clinical relevance. The following section combines... Figure 4 Please provide a detailed explanation.

[0060] Figure 4 This is a schematic diagram illustrating the local attention interaction range based on clinical association matrix constraints, provided for an embodiment of this application. Figure 4 As shown, the fused character vector sequence 401 is input to the attention interaction unit 402 in the form of a query matrix Q, a key matrix K, and a value matrix V. The clinical association matrix 403 is used as a mask and multiplied element-wise with the inner product of the query matrix Q and the key matrix K, so that the values ​​located in the clinical association matrix are... The attention score corresponding to the coordinates is forcibly set to negative infinity; the normalized attention weight 404 is only used in... The coordinate set contains non-zero values; after weighting and merging the non-zero attention weights on the value matrix V, the output feature aggregation result 405 is the local case vector 406.

[0061] Specifically, the process of generating the local case vector in this step includes: First, the set of coordinates allowed to generate interactive associations is read from the clinical association matrix. This set of coordinates allowed to generate interactive associations refers to the set of coordinates in the clinical association matrix. All positions in the array that have a value of 1 ( , The set consisting of ) is denoted as This set of coordinates is the specific representation of clinically appropriate associations in vector space.

[0062] Secondly, the data interaction paths of other vector channels outside the coordinate set in the fused character vector are blocked. This blocking can be implemented, for example, using an attention mask. Specifically, a clinical correlation matrix mask is applied to the attention score matrix S obtained by multiplying the query matrix Q and the key matrix K of the fused character vector. The mask application method can be specifically expressed as: for the coordinate set... Within the location ( , (Preserve the original attention score) For those located in Other locations ( , ), forcibly setting its score to negative infinity. After Softmax normalization, located at The attention weights for locations outside these areas will approach 0, thus blocking the data interaction pathway.

[0063] Next, the attribute association weights corresponding to clinical constraints between different fused character vectors within the coordinate set are extracted. These attribute association weights refer to the weights of the masked attention score matrix after row-wise softmax normalization. The weight values ​​corresponding to the internal positions reflect the relative intensity of attention between characters under the reasonable clinical relevance.

[0064] Then, based on the attribute association weights, the fused character vectors within the coordinate set are subjected to numerical weighted merging. Specifically, the numerical weighted merging refers to using the attribute association weights as weighting coefficients to perform a weighted summation of the vectors at corresponding positions in the value matrix V. The specific calculation formula for the numerical weighted merging can be expressed, for example, as follows: in, For characters The output vector state after weighted merging For characters For characters Attribute association weights, For characters The corresponding value vectors are summed and the coordinate set is traversed. inner and character All characters j that have clinical constraints.

[0065] Finally, the vector state output after numerical weighting and merging is determined as the feature aggregation result, and this feature aggregation result is used as the local case vector. This is because the vector state output for each character... Only by The local case vectors are contributed by characters that have clinical constraints with the case, so the output local case vectors always remain within the range of clinically reasonable correlations at the feature aggregation level, thus suppressing the noisy correlations generated by the general global attention mechanism from the source.

[0066] Step S500: Perform attention interaction operation across paragraph boundary markers on the local case vector to capture the cross-segment dependency features contained in the local case vector, and update the local case vector to a global case vector based on the cross-segment dependency features.

[0067] Although the local case vector obtained in step S400 has completed feature aggregation within the sub-case segment under clinical constraints, its interaction range is still limited to the same sub-case segment, making it difficult to capture cross-segment dependencies such as the impact of chronic disease information recorded in the past history sub-segment on the current chief complaint sub-segment. This step constructs cross-segment interaction paths and calculates logical dependency weights to back-add cross-segment dependency features to the local case vector, thereby obtaining the global case vector. The following section will combine... Figure 5 Please provide a detailed explanation.

[0068] Figure 5 This is a schematic diagram of a cross-segment attention interaction path that crosses paragraph boundary markers, as provided in an embodiment of this application. Figure 5As shown, multiple sub-case segments 501 (including chief complaint sub-segment, present illness sub-segment, past medical history sub-segment, auxiliary examination sub-segment, and diagnostic conclusion sub-segment, etc.) each correspond to a local case vector segment 502; each local case vector segment 502 is processed by the feature dimension numerical aggregation unit 503 to output the corresponding representative case vector 504; the segment boundary marker 505 (i.e., the boundary position between each sub-case segment) serves as a connection node to construct a cross-segment interaction path 506; the logical dependency weight 507 between each representative case vector 504 is calculated along the cross-segment interaction path 506; the logical dependency weight 507 is used to weight and summarize the representative case vectors on the cross-segment interaction path to output the cross-segment dependency feature 508; the cross-segment dependency feature 508 is back-stacked onto the local case vector segment 502, and finally the global case vector 509 is output.

[0069] Specifically, the process of generating the global case vector in this step includes: First, a numerical aggregation operation along the feature dimension is performed on the local case vectors corresponding to each sub-case segment, and the aggregated segment condensation vector is extracted as the representative case vector. Specifically, the numerical aggregation operation along the feature dimension can be implemented using mean pooling, that is, averaging the local case vectors of all characters within the same sub-case segment along the dimension; the output mean vector is the segment condensation vector of that sub-case segment, and is used as the representative case vector for that sub-case segment. Mean pooling is used instead of methods such as taking the first character to ensure that the representative case vector can evenly reflect the feature contribution of all characters within the sub-case segment, avoiding bias introduced by a single character.

[0070] Secondly, cross-segment interaction paths are constructed between the representative case vectors using the paragraph boundary markers as connection nodes. The paragraph boundary markers refer to the specific positions in the vector sequence corresponding to the title guide markers and line break symbols identified in step S200. The cross-segment interaction paths can be implemented, for example, using a fully connected structure, that is, connecting the representative case vectors of all sub-case segments pairwise to form a complete graph with the representative case vectors as vertices and the paragraph boundary markers as connection nodes. The reason for using a fully connected structure is to ensure that all sub-case segments have the potential to generate cross-segment interactions without introducing prior assumptions, and the actual interaction strength is determined by the subsequent logical dependency weights.

[0071] Next, the logical dependency weights between the representative case vectors of different sub-case segments are calculated along the cross-segment interaction path. The specific process of calculating the logical dependency weights is as follows: using a self-attention mechanism, the representative case vector of one segment is mapped to a query vector, and the representative case vectors of the other segments on the cross-segment interaction path are mapped to key vectors. By calculating the dot product of the two and processing it through the Softmax normalization function, the logical dependency weight values ​​representing the semantic relevance between segments are finally output.

[0072] Then, the representative case vectors on the cross-segment interaction path are summarized according to the logical dependency weights to output cross-segment dependency features. Specifically, the summation refers to weighting the representative case vectors of all sub-case segments using the logical dependency weights as weighting coefficients. The specific calculation formula for the output cross-segment dependency features can be expressed, for example, as follows: in, For sub-case segment Cross-segment dependency features For sub-case segment Pair of cases Logical dependency weights, For sub-case segment The representative case vector is summed and iterated through all sub-case segments. The cross-segment dependency feature carries the long-range semantic dependency relationship between the subcase segment and other subcase segments.

[0073] Finally, the cross-segment dependency features are applied to the current local case vectors to perform feature overlay processing to obtain the global case vector. Specifically, the feature overlay can be implemented using a residual join method, whereby the cross-segment dependency features are broadcast and copied to each character position within the corresponding sub-case segment, and then added element-wise along the dimension to the local case vector of that character. The output of the sum is the global case vector for that character. The reason for using a residual join method instead of a complete replacement method is to ensure that the global case vector retains the local clinical constraint information obtained in step S400 while introducing cross-segment dependencies, avoiding the bias caused by a single information source.

[0074] Step S600: Based on the global case vector, perform character interception on the case text sequence to obtain the boundary positions of different medical entities and their corresponding medical entity labels.

[0075] The global case vector obtained in step S500 already carries a comprehensive representation of local clinical constraints and cross-segment dependencies at each character position. This step further maps the global case vector to the medical entity category space and jointly considers the positional transfer relationships between the entity's starting endpoint, internal nodes, and ending endpoint. Finally, the character interception of the medical entity is completed by finding the probability extreme value path.

[0076] Specifically, the process of generating the medical entity boundary location and the medical entity label in this step includes: First, the character order of the case text sequence is extracted, and the global case vector is input into a preset label mapping matrix along the character order. The character order refers to the integer index of each character in the case text sequence, starting from the beginning position. The label mapping matrix is ​​a pre-trained learnable linear transformation matrix used to map the global case vector to the medical entity category space. Its number of rows is equal to the hidden dimension of the global case vector (e.g., it can be set to 768 dimensions), and its number of columns is equal to the product of the total number of medical entity categories and the position label subclasses (e.g., 5 entity categories such as disease, symptom, drug, test indicator, and surgical procedure multiplied by 4 position labels B (start), I (internal), E (end), and O (non-entity), for a total of 20 columns). The specific values ​​can be set according to the medical entity category system.

[0077] Secondly, the category assignment probability of the global case vector corresponding to different medical entity classification categories is extracted through the label mapping matrix. The category assignment probability refers to the probability distribution obtained after normalizing the category scores of each category output by multiplying the global case vector by the label mapping matrix using the Softmax function, reflecting the relative probability of each character belonging to each candidate medical entity category.

[0078] Next, the position transition probabilities of the global case vector as the start endpoint, internal node, and end endpoint of the medical entity are calculated in parallel. The position transition probability refers to the probability of the character... The previous character label is a certain category. Under the condition that the current label is another category The conditional probability; specifically, the position transition probability can be calculated using a Conditional Random Field (CRF) model, which is pre-trained on a large-scale labeled case corpus. The model maintains a transition score matrix of size (total number of labels × total number of labels), where each item corresponds to the transition score of a label pair. The transition score, after row-wise Softmax normalization, becomes the corresponding position transition probability. The specific calculation of the position transition probability can be implemented using a CRF model, which learns the dependency matrix between labels to obtain the transition scores between different medical entity labels (such as starting endpoint B, internal node I, and ending endpoint E). The specific algorithm for finding the probability extreme path can use the Viterbi dynamic programming algorithm, which uses global decoding to find the optimal label path with the highest overall sequence score.

[0079] The reason for parallel computation of position transition probabilities is that there are strict positional constraints between the starting endpoint, internal nodes, and ending endpoint of a medical entity (for example, an I label must be preceded by a B label or an I label, and cannot be preceded by an O label or an E label). Relying solely on the category attribution probability cannot guarantee the positional legitimacy of the label sequence.

[0080] Then, the category attribution probability and the position transition probability are numerically superimposed. Based on the superposition result, the extreme probability path is found, and the target entity category mapped by the extreme probability path is analyzed. Specifically, the numerical superposition can be implemented using logarithmic probability addition, where the logarithm of the category attribution probability is taken and added to the logarithmic score of the position transition probability sequentially according to character position. The output superposition score is used for joint decoding of the entire sequence. Finding the extreme probability path can be implemented using the Viterbi algorithm, which uses dynamic programming to find the path with the highest joint probability among all possible label sequences. The specific calculation formula for Viterbi decoding can be expressed as follows: in, For probability extreme value paths, For characters Candidate tags, For the probability of class assignment, To find the position transition probability, sum the positions of all characters in the case text sequence. The operation selects the label sequence that maximizes the cumulative log probability from all possible label sequences. This is done along the path of probability extrema. The corresponding tag sequence can be used to parse the target entity category to which each character belongs.

[0081] Finally, character interception is performed on the case text sequence according to the probabilistic extreme value path to obtain the entity boundary positions, and medical entity labels corresponding to the entity boundary positions are extracted from the target entity category. Specifically, character interception refers to scanning along the probabilistic extreme value path and extracting the character fragments corresponding to adjacent B, I, and E position labels as a complete medical entity. The starting character position (where the B label is located) is used as the entity's starting boundary, and the ending character position (where the E label is located) is used as the entity's ending boundary; together, they constitute the medical entity boundary position. The medical entity label refers to the target entity category name (e.g., disease, symptom, drug, etc.) to which the entity fragment belongs, and its value is determined by the category field commonly corresponding to the B, I, and E labels on the probabilistic extreme value path. The final output medical entity boundary positions and medical entity labels can be stored in a medical database to support downstream applications such as clinical decision support, medical knowledge base construction, or patient profile generation.

[0082] In summary, the embodiments of this application achieve objective, robust, and structured extraction of key information from medical texts without relying on large-scale manually annotated corpora by integrating case structure information into character vectors, constructing clinical association matrices based on medical knowledge graphs, capturing cross-segment dependency features through cross-segment interaction, and finding probability extreme paths by combining category attribution probability and position transition probability.

[0083] The following is combined with Figure 6 The medical text key information extraction system based on attention mechanism provided in the embodiments of this application will be described. Figure 6 This is a schematic diagram illustrating the structure of a medical text key information extraction system based on an attention mechanism, provided as an embodiment of this application. Figure 6 As shown, the medical text key information extraction system 600 based on attention mechanism includes a conversion module 601, a matrix construction module 602, a local aggregation module 603, a cross-segment interaction module 604, and an entity interception module 605.

[0084] The conversion module 601 is used to segment the case text sequence and convert it into an initial character vector based on a pre-stored character mapping dictionary; it also performs segmentation and structural order numerical allocation on the case text sequence to obtain a case structure vector, and merges the case structure vector with the initial character vector to obtain a fused character vector. The conversion module 601 is communicatively connected to an external case text data source, and its specific implementation is the same as steps S100 and S200 of the aforementioned method, and will not be repeated here.

[0085] The matrix construction module 602 is used to match the clinical logical attributes corresponding to the fused character vectors in a pre-set medical knowledge graph, and construct a clinical association matrix between characters represented by different fused character vectors based on the clinical logical attributes. The input end of the matrix construction module 602 is connected to the output end of the conversion module 601, and its specific implementation is the same as the aforementioned method step S300.

[0086] The local aggregation module 603 is used to determine the interaction range of the fused character vector when performing attention interaction operations based on the clinical correlation matrix, and to determine local case vectors based on the interaction range. The input of the local aggregation module 603 is connected to the output of the matrix construction module 602, and its specific implementation is the same as the aforementioned method step S400.

[0087] The cross-segment interaction module 604 is used to perform attention interaction operations across segment boundary markers on the local case vector, capture the cross-segment dependency features contained in the local case vector, and update the local case vector to the global case vector based on the cross-segment dependency features. The input of the cross-segment interaction module 604 is connected to the output of the local aggregation module 603, and its specific implementation is the same as the aforementioned method step S500.

[0088] The entity interception module 605 is used to intercept characters in the case text sequence based on the global case vector to obtain the boundary positions of different medical entities and their corresponding medical entity labels. The input of the entity interception module 605 is connected to the output of the cross-segment interaction module 604. The output of the entity interception module 605 can be connected to a medical database or a clinical decision support system, for example, and its specific implementation is the same as the aforementioned method step S600.

[0089] It should be noted that the above modules can be physically deployed on a single computing device or distributed across multiple computing devices; this application does not impose any restrictions on this.

[0090] This application also provides a computing device, including a processing component and a storage component. The processing component may be implemented using a general-purpose microprocessor, digital signal processor, or field-programmable gate array (FPGA); the storage component may be implemented using a non-volatile memory. The storage component stores one or more computer instructions, which are invoked and executed by the processing component to implement the attention-based medical text key information extraction method described in any of the above embodiments of this application.

[0091] This application also provides a computer storage medium storing a computer program. When the computer program is executed by a computer, it implements the medical text key information extraction method based on the attention mechanism described in any of the above embodiments of this application. The computer storage medium can be any physical medium capable of storing a computer program, such as a read-only memory, random access memory, disk, or optical disk.

[0092] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this application. It should be understood that the above description is only a specific embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for extracting key information from medical text based on an attention mechanism, characterized in that, include: The case text sequence is segmented and converted into an initial character vector based on a pre-stored character mapping dictionary; The case text sequence is divided into segments and the structural order is numerically assigned to obtain a case structure vector, and the case structure vector is fused with the initial character vector to obtain a fused character vector; In a pre-built medical knowledge graph, the clinical logical attributes corresponding to the fused character vectors are matched, and a clinical association matrix between the characters represented by different fused character vectors is constructed based on the clinical logical attributes. The interaction range of the fused character vector during attention interaction is determined based on the clinical correlation matrix, and the local case vector is determined based on the interaction range. Perform attention interaction operations across paragraph boundary markers on the local case vector, capture the cross-segment dependency features contained in the local case vector, and update the local case vector to the global case vector based on the cross-segment dependency features; Based on the global case vector, character interception is performed on the case text sequence to obtain the boundary positions of different medical entities and their corresponding medical entity labels.

2. The method according to claim 1, characterized in that, The case text sequence is segmented and converted into an initial character vector based on a pre-stored character mapping dictionary, including: Scan the word boundary points of the case text sequence, and segment the case text sequence along the word boundary points to obtain a text segmentation sequence composed of multiple medical basic word fragments; Extract the semantic distribution values ​​of the corresponding medical basic word fragments from the pre-stored character mapping dictionary; Record the character arrangement order of the medical basic word fragments in the case text sequence, and convert the character arrangement order into an absolute position sequence; The semantic distribution values ​​are combined with the absolute position sequence to generate a composite character state; The composite character state is subjected to a dimension uniform transformation process, and the transformed composite state value is determined as the initial character vector.

3. The method according to claim 1, characterized in that, The case text sequence is segmented and its structural order is numerically assigned to obtain a case structure vector. This case structure vector is then fused with the initial character vector to obtain a fused character vector, including: Scan the case text sequence and identify the title introductory markers and line break characters contained in the case text sequence; Using the identified title guide and line break as breakpoints, the case text sequence is divided into multiple sub-case segments; Based on the arrangement order of each sub-case segment in the case text sequence, a structural order value is assigned to each sub-case segment; The structural order values ​​are converted into a numerical spatial distribution state, and the numerical spatial distribution state is used as the case structure vector; The case structure vector is superimposed onto the initial character vector by numerical addition to obtain the fused character vector.

4. The method according to claim 3, characterized in that, Matching the clinical logical attributes corresponding to the fused character vectors in a pre-built medical knowledge graph, and constructing a clinical association matrix between characters represented by different fused character vectors based on the clinical logical attributes, including: Extract the local vector fragments contained in the fused character vector according to the paragraph boundaries of the sub-case segment; The local vector fragment is matched with the entity nodes contained in the pre-set medical knowledge graph by attribute matching, and reference entity nodes that have a mapping relationship with the local vector fragment are extracted from the medical knowledge graph. Read the network topology connection category of the reference entity node in the medical knowledge graph, and determine the network topology connection category as a clinical logical attribute; Based on the clinical logical attributes, determine the clinical constraint relationships between the characters represented by different fused character vectors; Record the coordinate positions of the fused character vectors with the aforementioned clinical constraints in the vector space, and aggregate all coordinate positions to generate a clinical association matrix.

5. The method according to claim 1, characterized in that, Based on the clinical correlation matrix, the interaction range of the fused character vector during attention interaction operations is determined, and based on the interaction range, local case vectors are determined, including: Read the set of coordinates that are allowed to generate interactive associations recorded in the clinical association matrix; Block the data interaction path of other vector channels outside the coordinate set in the fused character vector; Extract the attribute association weights corresponding to clinical constraints between different fused character vectors within the coordinate set; The fused character vectors within the coordinate set are numerically weighted and merged based on the attribute association weights. The vector state output after numerical weighting and merging is determined as the feature aggregation result, and the feature aggregation result is used as the local case vector.

6. The method according to claim 1, characterized in that, Perform attention interaction operations across paragraph boundary markers on the local case vectors, capture the cross-paragraph dependency features contained in the local case vectors, and update the local case vectors to global case vectors based on the cross-paragraph dependency features, including: Perform numerical aggregation on the feature dimension on the local case vectors corresponding to each sub-case segment, and extract the segment condensation vector after aggregation as the representative case vector; The cross-segment interaction paths between the representative case vectors are constructed using the segment boundary markers as connection nodes. Calculate the logical dependency weights between representative case vectors of different sub-case segments along the cross-segment interaction path; Based on the logical dependency weights, the representative case vectors on the cross-segment interaction path are summarized to output cross-segment dependency features; The cross-segment dependency features are applied to perform feature overlay processing on the current local case vector to obtain the global case vector.

7. The method according to claim 1, characterized in that, Based on the global case vector, character interception is performed on the case text sequence to obtain the boundary positions of different medical entities and their corresponding medical entity labels, including: Extract the character order of the case text sequence, and input the global case vector into a preset label mapping matrix along the character order; The category attribution probability of the global case vector corresponding to different medical entity classification categories is extracted using the label mapping matrix; The position transition probabilities of the global case vector as the start endpoint, internal node, and end endpoint of the medical entity are calculated in parallel. The category attribution probability and the location transfer probability are numerically superimposed, the probability extreme value path is found based on the numerical superposition result, and the target entity category mapped by the probability extreme value path is analyzed. Based on the probability extreme value path, character interception is performed in the case text sequence to obtain the entity boundary position, and medical entity labels corresponding to the entity boundary position are extracted from the target entity category.

8. A medical text key information extraction system based on attention mechanism, characterized in that, include: The conversion module is used to segment the case text sequence and convert it into an initial character vector based on a pre-stored character mapping dictionary; The case text sequence is segmented and its structural order is numerically assigned to obtain a case structure vector, which is then fused with the initial character vector to obtain a fused character vector. The matrix construction module is used to match the clinical logical attributes corresponding to the fused character vectors in a pre-set medical knowledge graph, and construct a clinical association matrix between the characters represented by different fused character vectors based on the clinical logical attributes. A local aggregation module is used to determine the interaction range of the fused character vector when performing attention interaction operations based on the clinical correlation matrix, and to determine local case vectors based on the interaction range; The cross-segment interaction module is used to perform attention interaction operations across segment boundary markers on the local case vector, capture the cross-segment dependency features contained in the local case vector, and update the local case vector to the global case vector based on the cross-segment dependency features. The entity interception module is used to intercept characters in the case text sequence based on the global case vector to obtain the boundary positions of different medical entities and their corresponding medical entity labels.

9. A computing device, characterized in that, It includes a processing component and a storage component; the storage component stores one or more computer instructions; the one or more computer instructions are invoked and executed by the processing component to implement a method for extracting key information from medical text based on an attention mechanism as described in any one of claims 1 to 7.

10. A computer storage medium, characterized in that, The device contains a computer program that, when executed by a computer, implements a method for extracting key information from medical text based on an attention mechanism as described in any one of claims 1 to 7.