Intelligent comparison method and system for ancient and modern clinical diagnosis and treatment texts based on multi-dimensional similarity
Patent Information
- Application Number
- CN202611204131.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-10
- Publication Date
- 2026-10-13
AI Technical Summary
[0003]现有比对方法多采用单维或双维相似度计算,主要局限于文本层面的字面匹配,或仅结合文本、语义双维度开展相似度比对,算法应用维度较为单一;其次,现有诊疗文本比对体系既未结合患者就诊的时空场景、体质禀赋、诊疗阶段等现代临床情境要素,亦未解析典籍条文所蕴含的古代诊疗情境内涵;综上,当前临床诊疗文本信息比对方法尚未实现文本、语义、临床场景多维度协同融合,无法完整挖掘诊疗文本的多维特征,存在古今诊疗文本比对精准度与有效性偏低、难以有效筛选与现代电子病历相关的典籍记载等问题,导致典籍诊疗经验难以实现转化利用,无法充分发挥其对现代临床诊疗的指导价值
[0009]本发明提供的技术方案带来的有益效果至少包括:
Smart Images

Figure CN122903571A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of natural language processing, machine learning, and traditional Chinese medicine classics-assisted diagnosis and treatment technology, and specifically refers to a method and system for intelligent comparison of ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity. Background Technology
[0002] Traditional Chinese medicine (TCM) classics are the core carriers of TCM's theoretical system, containing rich medical knowledge and valuable practical experience from physicians throughout history. They serve as the embodiment of TCM theory and diagnostic knowledge, and are also an important support for modern TCM clinical practice. Comparing ancient and modern clinical diagnostic and treatment texts allows for the effective selection of ancient diagnostic and treatment experiences to aid in modern TCM clinical decision-making.
[0003] Existing comparison methods mostly employ single-dimensional or two-dimensional similarity calculations, primarily limited to literal matching at the text level, or only combining textual and semantic dimensions for similarity comparison, resulting in a relatively singular application dimension. Secondly, existing diagnostic and treatment text comparison systems neither incorporate modern clinical context elements such as the patient's spatiotemporal setting, physical condition, and treatment stage, nor analyze the ancient diagnostic and treatment contextual connotations contained in classical texts. In summary, current clinical diagnostic and treatment text information comparison methods have not yet achieved multi-dimensional synergistic integration of text, semantics, and clinical context, failing to fully uncover the multi-dimensional features of diagnostic and treatment texts. This leads to problems such as low accuracy and effectiveness in comparing ancient and modern diagnostic and treatment texts, and difficulty in effectively screening classical records related to modern electronic medical records. Consequently, the diagnostic and treatment experience in classical texts is difficult to translate and utilize, and its guiding value for modern clinical diagnosis and treatment cannot be fully realized.
[0004] Therefore, in view of the problem that existing methods for comparing medical texts are limited in scope and do not integrate textual, semantic, and clinical context information, resulting in low accuracy and inability to meet the need for precise matching of ancient and modern medical texts, there is an urgent need for a clinical medical text comparison method that can integrate multi-dimensional similarity and clinical context information. This would enable precise comparison between modern electronic medical records and classical medical texts, promote the integrated application of ancient and modern medical knowledge, and leverage the modern clinical auxiliary diagnostic value of classical knowledge. Summary of the Invention
[0005] To address the technical problems existing in the prior art, this invention provides a method and system for intelligent comparison of ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity. The technical solution is as follows: On the one hand, a method for intelligent comparison of ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity is provided, which includes: S1. Input the natural language text to be compared, which are two types of ancient and modern medical texts: modern electronic medical record text and classical medical text. S2. Combining TCM diagnosis and treatment guidelines with TCM clinical diagnosis and treatment logic, we define the clinical scenarios corresponding to the two types of ancient and modern diagnosis and treatment texts, and divide them into three categories of clinical scenario systems: diagnosis and treatment information scenario, spatiotemporal scenario, and subject scenario. S3. Perform multi-dimensional feature extraction, structured coding and clinical context weight optimization on two types of ancient and modern medical texts. Complete text layer feature extraction and text feature vector construction, semantic layer feature extraction and semantic feature vector construction, clinical context feature extraction and clinical context feature vector construction, and finally output a set of multi-dimensional feature vectors with unified dimensions and clinical priority differences. S4. Based on the multi-dimensional feature vector set, construct similarity calculation rules in different dimensions, complete the hierarchical similarity calculation of ancient and modern medical texts, and obtain multi-dimensional similarity results; S5. Standardize the multi-dimensional similarity results, calculate the comprehensive similarity using multi-dimensional feature decision fusion rules, and select the classical medical records that match modern electronic medical records to complete the intelligent comparison of ancient and modern medical records.
[0006] On the other hand, a multidimensional similarity-based intelligent comparison system for ancient and modern clinical diagnosis and treatment texts is provided, the system comprising: The text input module is used to input the natural language text to be compared, which includes two categories of ancient and modern medical texts: modern electronic medical record texts and classical medical texts. The scenario segmentation module is used to combine TCM diagnosis and treatment guidelines with TCM clinical diagnosis and treatment logic to define the clinical scenarios corresponding to the two types of ancient and modern diagnosis and treatment texts, and divide them into three categories of clinical scenario systems: diagnosis and treatment information scenario, spatiotemporal scenario, and subject scenario. The extraction and construction module is used to perform multi-dimensional feature extraction, structured encoding, and clinical context weight optimization on two types of ancient and modern medical texts. It completes text layer feature extraction and text feature vector construction, semantic layer feature extraction and semantic feature vector construction, and clinical context feature extraction and clinical context feature vector construction. Finally, it outputs a set of multi-dimensional feature vectors with unified dimensions and clinical priority differences. The similarity calculation module is used to construct similarity calculation rules in different dimensions based on the multi-dimensional feature vector set, complete the hierarchical similarity calculation of ancient and modern medical texts, and obtain multi-dimensional similarity results; The filtering module is used to standardize the multi-dimensional similarity results, calculate the comprehensive similarity using multi-dimensional feature decision fusion rules, filter out classical medical records that match modern electronic medical records, and complete the intelligent comparison of ancient and modern medical records.
[0007] On the other hand, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, which is loaded and executed by the processor to implement the above-mentioned intelligent comparison method of ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity.
[0008] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to realize the above-mentioned intelligent comparison method of ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity.
[0009] The beneficial effects of the technical solution provided by this invention include at least the following: This invention proposes a multi-dimensional similarity comparison method for ancient and modern clinical diagnosis texts (MDS-CDCM), combining association mapping, similarity comparison, and artificial intelligence. Compared with traditional similarity calculation, this method compares ancient and modern clinical diagnosis texts and introduces clinical context elements, solving the problems of existing technologies failing to take into account the differences between ancient and modern clinical scenarios, and the lack of synergistic integration and low comparison accuracy of multiple similarity algorithms. By integrating multi-dimensional similarity of ancient and modern clinical diagnosis texts, semantics, and clinical scenarios, this method can achieve intelligent comparison between modern electronic medical records and classical texts, effectively filtering and matching classical diagnosis content, promoting the integration of traditional Chinese medicine classical knowledge with modern clinical practice, and leveraging the modern clinical auxiliary diagnosis value of classical knowledge. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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 the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart of an intelligent comparison method for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity provided in an embodiment of the present invention; Figure 2 This is a block diagram of an intelligent comparison system for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0012] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0013] This invention provides an intelligent comparison method for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity. This method can be implemented by an electronic device, which can be a terminal or a server. Figure 1 The diagram shown is a flowchart of the method. The processing flow may include the following steps: S1. Input the natural language text to be compared, which are two types of ancient and modern medical texts: modern electronic medical record text and classical medical text. S2. Combining TCM diagnosis and treatment guidelines with TCM clinical diagnosis and treatment logic, we define the clinical scenarios corresponding to the two types of ancient and modern diagnosis and treatment texts, and divide them into three categories of clinical scenario systems: diagnosis and treatment information scenario, spatiotemporal scenario, and subject scenario. Optionally, the three types of clinical scenario systems are applicable to the scenario standards for unified comparison of ancient and modern medical texts, including: The first category is diagnostic and treatment information, which covers symptoms and signs collected through observation, auscultation, inquiry, and palpation, as well as disease names, syndrome types, and treatment principles and methods recorded in text. The second category is spatiotemporal context, which is divided according to the season of medical treatment, region, stage of disease course, and diurnal symptom variation patterns. The third category is the main scenario, which refers to the industry standards to clarify the classification rules for patients' age, gender, TCM constitution, complications and comorbidities.
[0014] S3. Perform multi-dimensional feature extraction, structured coding and clinical context weight optimization on two types of ancient and modern medical texts. Complete text layer feature extraction and text feature vector construction, semantic layer feature extraction and semantic feature vector construction, clinical context feature extraction and clinical context feature vector construction, and finally output a set of multi-dimensional feature vectors with unified dimensions and clinical priority differences. Optionally, the text layer feature extraction and text feature vector construction include: Preprocessing of modern electronic medical records and classical medical texts yields word segmentation sequences. The preprocessing includes: simultaneously segmenting the two types of text, filtering out words with no diagnostic value such as function words and conjunctions, and retaining only effective words that can characterize symptoms, signs, and syndrome differentiation, to obtain the preprocessed word segmentation sequence. Based on the segmented word sequence, the N-gram algorithm is used to extract TCM professional terms: Traverse the word segmentation sequence and extract 1-gram single-character basic TCM terms, 2-gram TCM compound terms, and 3-gram fixed diagnostic and treatment phrases in sequence. For terms unique to classical texts, a built-in dictionary of ancient and modern terms is used to associate synonyms (for example, to establish a mapping between the ancient term "insomnia" and the modern term "dizziness", and between the ancient term "vertigo" and the modern term "headache"), thereby covering the differences in the expression of medical terminology between ancient and modern texts; All extracted TCM terms were compiled, a terminology list was constructed, and a corpus text was formed. Perform terminology coding: Based on the terminology list, a one-hot encoded vector is generated for each term in a single text, with 0 and 1 marking whether the corresponding term appears in the vector; Next, calculate the BM25 score for all terms in the text to quantify term importance. The BM25 score calculation formula is as follows: in, This is a term used in Traditional Chinese Medicine. For medical records; For corpus text; The frequency of occurrence of terms in corpus text; Predict the length of the library text; The average length of all ancient and modern texts; , It is an adjustable hyperparameter; Inverse document frequency of terms; The numerical values are replaced by iterating through each dimension of the one-hot encoded vector: if the original one-hot encoded value of a certain dimension is 1, then the value of that dimension is replaced with the BM25 score of the corresponding term; if the original one-hot encoded value is 0, then the dimension value remains unchanged. Next, symptoms and diseases with BM25 scores higher than a preset threshold are selected as core keywords. Syntactic dependency analysis is used to identify typical TCM sentences describing symptoms and making syndrome differentiation diagnoses. 0-1 coding is used to represent the existence status of each type of sentence. If the text contains the sentence type, the coding value is 1; if it does not contain the sentence type, the coding value is 0. Finally, the BM25 weight values of the terms and the sentence structure codes are concatenated. The weight value calculated by BM25 for each N-gram TCM term is used as the first part of the feature sequence, and the various sentence structure codes obtained from syntactic analysis are used as the second part of the feature sequence. At the vector dimension level, the two feature sequences are concatenated end to end in a fixed order to merge them into a complete one-dimensional array. A globally fixed total feature dimension is set. If a single text is missing some terminology or sentence structure features, the corresponding dimension position is filled with 0 to complete dimension alignment, and finally, a modern electronic medical record text feature vector with consistent dimensions is generated. Feature vectors of classical medical texts .
[0015] Optionally, the semantic layer feature extraction and semantic feature vector construction include: Combining the characteristics of concise writing, unique grammatical structures, and significant differences in expression between ancient and modern medical texts, complete modern electronic medical record texts and classical medical texts are input into the TCM fine-tuning pre-trained language model TCMLLM-PR. Based on the large language model ChatGLM-6B, it employs P-Tuning v2 technology for fine-tuning: each layer inserts an independent learnable virtual prefix token, guiding the model layer by layer to capture superficial symptom descriptions, mid-level diagnostic logic, and deep pathogenesis connotations. This accurately captures the semantic connections between ancient and modern clinical texts, enhancing the model's understanding and generation capabilities for domain-specific tasks. Furthermore, it performs global semantic encoding on the entire text without partial sentence truncation, fully preserving the contextual diagnostic logic chain and outputting a unified semantic feature vector of modern electronic medical records. Semantic feature vectors of classical medical texts .
[0016] Specifically: To address the textual heterogeneity issues in ancient medical texts—namely, concise writing style, archaic sentence structure, interchangeable terms between ancient and modern medical texts, and significant differences in grammatical structure—and the dual textual heterogeneity of modern electronic medical records (which contain standardized structured diagnostic and treatment records and standardized expressions in modern Western and Traditional Chinese Medicine), this paper constructs the TCMLLM-PR Traditional Chinese Medicine Clinical Semantic Parsing Model. This model is based on the ChatGLM-6B platform and utilizes P-Tuning v2 for efficient parameter fine-tuning. It enables the input of untruncated original texts from ancient medical texts and complete modern electronic medical records, performing full-text global semantic encoding to uncover deep etiologies, pathogenesis, and dialectical reasoning logic, and outputting domain-specific semantic feature vectors with a unified dimension.
[0017] 1. Selection Criteria for P-Tuning v2: Matching Task Pain Points The domain texts differ greatly: ancient medical books use short classical Chinese sentences, omission of subjects, inverted sentence structures, and metaphorical terms unique to traditional Chinese medicine; modern medical records use standardized narratives, quantitative indicators, and standardized syndrome types, and the general large model has weak native semantic alignment capabilities. Limited dataset size: High-quality paired “ancient medical records - modern medical records” annotated corpus is scarce, making it unsuitable for full-scale fine-tuning and prone to overfitting; The task involves complex NLU deep semantic mining (not simple classification / generation), requiring the model to continuously perceive the implicit dialectical relationship between ancient and modern texts through multiple Transformer layers. P-Tuning v2 inserts an independent learnable virtual prefix token at each layer, guiding the model layer by layer to capture superficial symptom descriptions, mid-level diagnostic logic, and deep pathogenesis connotations. Compared with LoRA and P-Tuning v1, it has the best performance in cross-generational text semantic matching and long-segment whole-text global encoding tasks in traditional Chinese medicine.
[0018] 2. TCMLLM-PR Model Architecture Design 2.1 Basic base Base model: ChatGLM-6B, which has the ability to understand long text context and generate Chinese, and is suitable for inputting long TCM diagnosis and treatment texts in their entirety; all original pre-trained weights of the model are frozen, and only P-Tuning v2 with newly added prefix parameters is trained to reduce memory overhead and retain the base's general language capabilities.
[0019] 2.2 P-Tuning v2 Domain Fine-tuning Custom Configuration Each Transformer layer is pre-assembled with a dedicated learnable soft cue vector, and the number of virtual tokens is set to 48 (to adapt to global semantic modeling of long medical records and ancient medical case studies). Without an additional reparameterized encoder, it directly optimizes each layer of Prefix Embedding, enhancing the capture of the chain-like association between symptoms, pathogenesis, and syndrome types layer by layer; Fine-tuning dual-objective joint training: Objective 1: Semantic alignment task of ancient and modern medical texts; Objective 2: Pre-training for extracting deep diagnostic logic from Traditional Chinese Medicine; Hyperparameter adaptation for the TCM domain: learning rate 2e-4, batch size 8, training epochs 4–8, to alleviate overfitting on small domain datasets.
[0020] 2.3 Input Processing Module (Adaptation for Untruncated Input Segments) Supports direct input of complete original text for two types of text, with unified prior domain hints guiding the model to distinguish text types: Complete text of modern electronic medical record: Chief complaint, present illness, past medical history, four diagnostic methods, physical and chemical examinations, traditional Chinese medicine diagnosis, treatment method and prescription, all paragraphs without splitting; Original texts of ancient medical texts: Input complete sections of ancient medical records, prescriptions, and diagnostic texts, compatible with abbreviated sentences in classical Chinese and variant medical terms.
[0021] Input is formatted as follows: [Domain Identifier Token][P-Tuning v2 Layer Prefix Vector][Original Complete Diagnosis Text]. The model performs global semantic encoding on the entire text, without truncating sentences in certain parts, thus preserving the complete logical chain of contextual dialectics.
[0022] 3. Core capabilities of deep semantic mining Leveraging the cross-historical semantic awareness capabilities of the finely tuned TCMLLM-PR, textual connotations are extracted layer by layer during the global encoding process: Shallow semantics: Extract explicit entities—symptoms, pulse, tongue appearance, Chinese medicine, disease names, and syndrome names from ancient and modern times, and resolve ambiguities in ancient and modern terminology (such as the semantic mapping between "wasting and thirsting" and diabetes). Mid-level semantics: sorting out the surface-level diagnostic correspondence between symptoms and syndrome types, and distinguishing between simplified diagnostic expressions in ancient books and standardized diagnostic expressions in modern times; Deep semantic analysis: uncovering the underlying causes and mechanisms of disease, the balance of Yin and Yang, Qi and Blood, the transmission of diseases through the internal organs, and the logic of treatment principles and combinations, and capturing the common semantic connections between the implicit diagnostic and treatment ideas in ancient medical cases and the diagnostic and treatment thinking in modern medical records; Cross-text association modeling: Establishing implicit semantic mapping between ancient medical texts and modern electronic medical records to eliminate the gap between ancient and modern grammar and expression systems.
[0023] 4. Unified Dimension Semantic Feature Vector Output Process After completing the full-text global Transformer encoding, multi-layer prefix-guided domain semantic information is fused to aggregate the temporal hidden layer representation of the entire text. A pooling layer is used to fuse and compress the global hidden state, masking differences in text length and style (classical Chinese / modern written Chinese); Output a dense semantic feature vector with completely uniform dimensions: Semantic feature vector of modern electronic medical records Semantic feature vectors of classical medical texts The two types of vectors reside in the same semantic feature space and can be directly used for downstream tasks such as similarity calculation, dialectical clustering, matching of ancient and modern medical cases, and TCM-assisted dialectical retrieval.
[0024] 5. Summary of Technological Advantages Adapting to the unique challenges of TCM texts: Relying on P-Tuning v2 to make fine adjustments layer by layer solves the problems of special sentences in ancient medical books and the disconnect between ancient and modern expressions. General fine-tuning solutions cannot achieve deep semantic alignment of pathogenesis. It supports input of long text segments, enables complete global semantic modeling, and avoids loss of dialectical context due to sentence truncation. The parameters are efficiently fine-tuned, requiring only a small number of prefix parameters to be updated. The training cost is low, the domain transfer capability is strong, and it can converge with a small labeled medical case dataset. It outputs a unified representation in the same dimension, bridging the diagnostic and treatment experience in ancient classics with digital data from modern electronic medical records, and providing a standardized numerical representation foundation for evidence-based mining in traditional Chinese medicine and the integration of medical case knowledge from ancient to modern times.
[0025] Optionally, the clinical context feature extraction and clinical context feature vector construction include: Based on the aforementioned three-category context system of diagnosis and treatment information context, spatiotemporal context, and subject context, clinical context features corresponding to ancient and modern diagnosis and treatment texts are extracted. Among them, the clinical context features of the diagnosis and treatment information context include symptoms, signs, etiology and pathogenesis; the clinical context features of the spatiotemporal context include the season of consultation, the region of consultation, the duration of the disease, and the diurnal variation pattern of symptoms; the clinical context features of the subject context include the patient's age, gender, TCM constitution, complications and comorbidities. One-hot encoding is used for discrete contextual features such as season, region, physical condition, and complications; For continuous contextual features such as disease duration, symptom severity, and age, min-max normalization was used to map them to the [0,1] interval (normalization formula: , These are the original feature values; , These represent the minimum and maximum values of this feature across all ancient and modern medical texts. (Eigenvalues after normalization); A three-tiered objective weighting scheme—text mining statistics, contextual completeness correction, and expert fine-tuning—is employed to assign objective weights to all clinical context features. This achieves differentiated and objective weighting of clinical context features, avoiding the distortion of clinical logic caused by equal weighting. This includes: ① Basic weight calculation based on classical text mining Clinical context features were extracted from classical medical texts using named entity recognition, and the frequency of occurrence of each context feature was statistically analyzed. Simultaneously, Point-to-Point Mutual Information (PMI) was used to quantify the correlation between each context feature and key etiological mechanisms and syndrome information. The PMI calculation formula is as follows: in, As a clinical context characteristic, The core pathogenesis or syndrome; The probability of both contextual features and pathogenesis occurring together; , Each represents its independent probability of occurrence; The initial influence score is calculated by combining frequency and association strength, and the basic weights of each context feature are obtained through normalization: in, Let i be the frequency of occurrence of the i-th context feature. The total number of context features is given, and the sum of all basic weights is 1. ② Contextual completeness correction based on classical text type Based on the different levels of information completeness in classical texts, such as paragraphs, short sentences, and medical records, corresponding text correction coefficients are set. The basic weights are adaptively adjusted using the following formula: After correction, normalization is performed again to ensure that the overall weight sum is 1, in order to solve the problem of the difference in contextual richness of different classical texts; ③ Fine-tuning and calibration by clinical experts Clinical experts (senior level or above TCM physicians) combined their clinical diagnostic experience to fine-tune the modified weights without altering the overall weight distribution pattern, resulting in the final weights for each scenario feature that possess both data objectivity and clinical rationality. ; Finally, the weighted clinical context features are unified in dimensions and missing features are added to complete the bidirectional mapping of context features between ancient and modern texts, thus constructing a modern electronic medical record clinical context feature vector with aligned dimensions and clinical priority differences. Clinical context feature vectors of classical medical texts .
[0026] S4. Based on the multi-dimensional feature vector set, construct similarity calculation rules in different dimensions, complete the hierarchical similarity calculation of ancient and modern medical texts, and obtain multi-dimensional similarity results; Optionally, S4 specifically includes: S41: For text-dimensional feature vectors , Cosine similarity is used, relying on the cosine value of the angle between vectors to quantify the degree of matching of surface terms and sentence structures in ancient and modern texts. The text similarity calculation formula is as follows: In the formula: It is the dot product of two vectors; , These are the feature vectors of modern electronic medical records and classical texts, respectively. Norm; Calculation result The value ranges from [0,1]. The closer the value is to 1, the higher the overlap of the surface text features of the two types of text. S42: Targeting semantic dimension feature vectors and Substitute into the following formula to solve. The formula for comparing the semantic similarity of dialectical diagnosis and treatment in ancient and modern medical texts is as follows: S43: Based on the clinical context dimension, first break down the clinical context features within the context of diagnosis and treatment information, time and space, and the main subject, and then divide them into core and secondary levels according to their importance in clinical diagnosis and treatment. Then proceed with the following steps: (1) Sub-feature aggregation at the same level: All sub-feature vectors within the same level are matched pairwise using cosine similarity, and the average value is taken as the local similarity of that level. The formula for local similarity at a single level is: In the formula, For local similarity at a certain level; The number of sub-features contained in this level; (This refers to the corresponding section in modern medical records and classical texts.) Cosine similarity of contextual features of the strip; (2) Cross-level weighted aggregation: Set the weight of the core level Secondary level weights ,satisfy =1, weighted fusion of similarities at each level yields the overall clinical scenario similarity: In the formula: For core level similarity, Secondary level similarity; due to the higher priority of core diagnostic and treatment information, the configuration is... > The final output is the clinical scenario similarity between ancient and modern medical texts. .
[0027] S5. Standardize the multi-dimensional similarity results, calculate the comprehensive similarity using multi-dimensional feature decision fusion rules, and select the classical medical records that match modern electronic medical records to complete the intelligent comparison of ancient and modern medical records.
[0028] Optionally, S5 specifically includes: S51: Normalize the text similarity, semantic similarity, and clinical scenario similarity respectively (the normalization calculation formula is: ,in, These correspond to the textual dimension, semantic dimension, and clinical scenario dimension, respectively. These are the original similarity values for each dimension. , These represent the minimum and maximum similarity values of all compared samples under the corresponding dimension. (This is the normalized, standardized similarity value), eliminating the dimensional differences between different dimensions to obtain the standardized text similarity. Standardized semantic similarity Standardized clinical scenario similarity ; S52: Assign static weights and dynamic decision coefficients to each dimension: Set text similarity weights Semantic similarity weight Clinical scenario similarity weight The weights satisfy the normalization condition. And prioritize assigning higher weight to the clinical scenario dimension; Set dynamic decision coefficients , , This is used to dynamically adjust the actual contribution of each dimension, adapting to the heterogeneity of ancient and modern texts and poor matching accuracy. The coefficient range is [0,1]. Combining similarity distribution characteristics and clinical adaptability, the contribution of each dimension is dynamically and adaptively adjusted. In view of the large differences in the expression of ancient and modern medical texts and the inconsistency in information completeness, the dimension discrimination ability is judged according to the degree of discrete distribution of similarity of each dimension. The corresponding dynamic decision coefficient is increased for dimensions with high discrimination and strong identification ability, and decreased for dimensions with similar samples and weak identification ability. At the same time, it is adjusted in combination with the clinical application scenarios of traditional Chinese medicine. The clinical diagnosis and treatment scenario focuses on strengthening the contribution of the clinical context dimension, and the classical text research and source tracing scenario focuses on strengthening the contribution of the text and semantic dimensions. S53: Based on static weights, dynamic decision coefficients, and standardized similarity, the comprehensive similarity is calculated using a multi-dimensional feature decision fusion algorithm. The calculation formula is as follows: S54: Output comprehensive similarity Based on comprehensive similarity, the medical texts in classical texts are sorted, and combined with preset matching thresholds, the medical texts in classical texts that match modern electronic medical records are selected. At the same time, the comparison details of each dimension are fully preserved, and intelligent comparison of medical texts between ancient and modern times is completed. Specific implementation examples: This section uses a modern electronic medical record and multiple medical case texts from traditional Chinese medicine classics as comparison objects, and conducts a multidimensional similarity-based comparison method for ancient and modern clinical diagnosis and treatment text information (MDS-CDCM). The implementation process includes the following steps: Clinical diagnosis and treatment context segmentation and multi-dimensional feature extraction: First, the two types of texts to be compared are input: modern electronic medical records and TCM classic texts. Combining TCM diagnostic and treatment guidelines and industry standards, clinical scenarios are divided into three categories, forming standardized comparison rules. In the diagnostic and treatment information category, symptoms, signs, disease names, syndrome types, and treatment principles are extracted from both types of texts. In the spatiotemporal category, classification is based on the season of consultation, region, stage of disease, and diurnal symptom variation patterns. In the subject category, patient age, gender, TCM constitution, complications, and comorbidities are extracted.
[0030] Based on this, feature extraction and vectorization were completed at the text layer, semantic layer, and clinical context layer, respectively, to construct three sets of feature vectors corresponding to modern electronic medical records and classical medical texts.
[0031] Dimensional similarity calculation: Based on the obtained feature vectors, similarity is calculated in three dimensions: (1) Text dimension: The vector space algorithm is used to quantify the matching degree of ancient and modern clinical diagnosis and treatment texts at the level of keywords, terminology, etc.; (2) Semantic dimension: Using a pre-trained language model in the field of traditional Chinese medicine, the semantic similarity of ancient and modern diagnosis and treatment texts at the level of deep diagnosis and treatment connotation is calculated; (3) Clinical context dimension: Sub-features are divided into levels according to clinical priority, and the overall clinical scenario similarity is obtained by aggregation at the same level and weighted aggregation across levels.
[0032] Output of multidimensional feature fusion and matching results: First, the similarity results for text, semantics, and clinical scenarios are normalized. Then, weights and dynamic decision coefficients are set for each dimension, and a multi-dimensional feature decision fusion algorithm is used to calculate the comprehensive similarity. Finally, the classical texts are sorted based on the comprehensive similarity, and threshold values are used to filter out classical medical records that match modern electronic medical records. Detailed comparisons of each dimension are retained, completing the intelligent comparison of ancient and modern medical texts.
[0033] like Figure 2 As shown, this embodiment of the invention also provides an intelligent comparison system for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity, the system comprising: The text input module 210 is used to input the natural language text to be compared, which are two types of ancient and modern medical texts: modern electronic medical record texts and classical medical texts. The scenario segmentation module 220 is used to combine the TCM diagnosis and treatment guidelines and the TCM clinical diagnosis and treatment logic to define the clinical scenarios corresponding to the two types of ancient and modern diagnosis and treatment texts, and divide them into three categories of clinical scenario systems: diagnosis and treatment information scenario, spatiotemporal scenario, and subject scenario. The extraction and construction module 230 is used to perform multi-dimensional feature extraction, structured encoding and clinical context weight optimization on two types of ancient and modern medical texts. It completes text layer feature extraction and text feature vector construction, semantic layer feature extraction and semantic feature vector construction, clinical context feature extraction and clinical context feature vector construction, and finally outputs a set of multi-dimensional feature vectors with unified dimensions and clinical priority differences. The similarity calculation module 240 is used to construct similarity calculation rules in different dimensions based on the multi-dimensional feature vector set, complete the hierarchical similarity calculation of ancient and modern medical texts, and obtain multi-dimensional similarity results; The screening module 250 is used to standardize the multi-dimensional similarity results, calculate the comprehensive similarity using multi-dimensional feature decision fusion rules, screen out the classical medical records that match modern electronic medical records, and complete the intelligent comparison of ancient and modern medical records.
[0034] The present invention provides an intelligent comparison system for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity. Its functional structure corresponds to the intelligent comparison method for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity provided in the present invention, and will not be described again here.
[0035] Figure 3 This is a schematic diagram of the structure of an electronic device 300 provided in an embodiment of the present invention. The electronic device 300 may vary considerably due to different configurations or performance. It may include one or more central processing units (CPUs) 301 and one or more memories 302. The memory 302 stores at least one instruction, which is loaded and executed by the processor 301 to implement the steps of the above-mentioned intelligent comparison method of ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity.
[0036] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions that can be executed by a processor in a terminal to complete the above-described intelligent comparison method for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity. For example, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0037] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0038] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for intelligent comparison of ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity, characterized in that, The method includes: S1. Input the natural language text to be compared, which are two types of ancient and modern medical texts: modern electronic medical record text and classical medical text. S2. Combining TCM diagnosis and treatment guidelines with TCM clinical diagnosis and treatment logic, we define the clinical scenarios corresponding to the two types of ancient and modern diagnosis and treatment texts, and divide them into three categories of clinical scenario systems: diagnosis and treatment information scenario, spatiotemporal scenario, and subject scenario. S3. Perform multi-dimensional feature extraction, structured coding and clinical context weight optimization on two types of ancient and modern medical texts. Complete text layer feature extraction and text feature vector construction, semantic layer feature extraction and semantic feature vector construction, clinical context feature extraction and clinical context feature vector construction, and finally output a set of multi-dimensional feature vectors with unified dimensions and clinical priority differences. S4. Based on the multi-dimensional feature vector set, construct similarity calculation rules in different dimensions, complete the hierarchical similarity calculation of ancient and modern medical texts, and obtain multi-dimensional similarity results; S5. Standardize the multi-dimensional similarity results, calculate the comprehensive similarity using multi-dimensional feature decision fusion rules, and select the classical medical records that match modern electronic medical records to complete the intelligent comparison of ancient and modern medical records.
2. The method according to claim 1, characterized in that, The three types of clinical scenario systems are applicable to the scenario standards for unified comparison of ancient and modern medical texts, including: The first category is diagnostic and treatment information, which covers symptoms and signs collected through observation, auscultation, inquiry, and palpation, as well as disease names, syndrome types, and treatment principles and methods recorded in text. The second category is spatiotemporal context, which is divided according to the season of medical treatment, region, stage of disease course, and diurnal symptom variation patterns. The third category is the main scenario, which refers to the industry standards to clarify the classification rules for patients' age, gender, TCM constitution, complications and comorbidities.
3. The method according to claim 1, characterized in that, The text layer feature extraction and text feature vector construction include: Preprocessing of modern electronic medical records and classical medical texts yields word segmentation sequences. Based on the segmented word sequence, the N-gram algorithm is used to extract TCM professional terms: Traverse the word segmentation sequence and extract 1-gram single-character basic TCM terms, 2-gram TCM compound terms, and 3-gram fixed diagnostic and treatment phrases in sequence. For terms unique to classical texts, a built-in dictionary of ancient and modern terms is used to associate synonyms, thereby covering the differences in terminology between ancient and modern medical texts. All extracted TCM terms were compiled, a terminology list was constructed, and a corpus text was formed. Perform terminology coding: Based on the terminology list, a one-hot encoded vector is generated for each term in a single text, with 0 and 1 marking whether the corresponding term appears in the vector; Next, calculate the BM25 score for all terms in the text to quantify term importance. The BM25 score calculation formula is as follows: in, This is a term used in Traditional Chinese Medicine. For medical records; For corpus text; The frequency of occurrence of terms in corpus text; Predict the length of the library text; The average length of all ancient and modern texts; , It is an adjustable hyperparameter; Inverse document frequency of terms; The numerical values are replaced by iterating through each dimension of the one-hot encoded vector: if the original one-hot encoded value of a certain dimension is 1, then the value of that dimension is replaced with the BM25 score of the corresponding term; if the original one-hot encoded value is 0, then the dimension value remains unchanged. Next, symptoms and diseases with BM25 scores higher than a preset threshold are selected as core keywords. Syntactic dependency analysis is used to identify typical TCM sentences describing symptoms and making syndrome differentiation diagnoses. 0-1 coding is used to represent the existence status of each type of sentence. If the text contains the sentence type, the coding value is 1; if it does not contain the sentence type, the coding value is 0. Finally, the BM25 weight values of the terms and the sentence structure codes are concatenated. The weight value calculated by BM25 for each N-gram TCM term is used as the first part of the feature sequence, and the various sentence structure codes obtained from syntactic analysis are used as the second part of the feature sequence. At the vector dimension level, the two feature sequences are concatenated end to end in a fixed order to merge them into a complete one-dimensional array. A globally fixed total feature dimension is set. If a single text is missing some terminology or sentence structure features, the corresponding dimension position is filled with 0 to complete dimension alignment, and finally, a modern electronic medical record text feature vector with consistent dimensions is generated. Feature vectors of classical medical texts .
4. The method according to claim 1, characterized in that, The semantic layer feature extraction and semantic feature vector construction include: Combining the characteristics of concise writing, unique grammatical structures, and significant differences in expression between ancient and modern medical texts, complete modern electronic medical record texts and classical medical texts are input into the TCM fine-tuning pre-trained language model TCMLLM-PR. Based on the large language model ChatGLM-6B, it employs P-Tuning v2 technology for fine-tuning: each layer inserts an independent learnable virtual prefix token, guiding the model layer by layer to capture superficial symptom descriptions, mid-level diagnostic logic, and deep pathogenesis connotations. This accurately captures the semantic connections between ancient and modern clinical texts, enhancing the model's understanding and generation capabilities for domain-specific tasks. Furthermore, it performs global semantic encoding on the entire text without partial sentence truncation, fully preserving the contextual diagnostic logic chain and outputting a unified semantic feature vector of modern electronic medical records. Semantic feature vectors of classical medical texts .
5. The method according to claim 1, characterized in that, The extraction of clinical context features and the construction of clinical context feature vectors include: Based on the aforementioned three-category context system of diagnosis and treatment information context, spatiotemporal context, and subject context, clinical context features corresponding to ancient and modern diagnosis and treatment texts are extracted. Among them, the clinical context features of the diagnosis and treatment information context include symptoms, signs, etiology and pathogenesis; the clinical context features of the spatiotemporal context include the season of consultation, the region of consultation, the duration of the disease, and the diurnal variation pattern of symptoms; the clinical context features of the subject context include the patient's age, gender, TCM constitution, complications and comorbidities. One-hot encoding is used for discrete contextual features such as season, region, physical condition, and complications; For continuous contextual features such as disease duration, symptom severity, and age, minimum-maximum normalization was used to map them to the [0,1] interval. A three-tiered objective weighting scheme—text mining statistics, contextual completeness correction, and expert fine-tuning—is employed to assign objective weights to all clinical context features. This achieves differentiated and objective weighting of clinical context features, avoiding the distortion of clinical logic caused by equal weighting. This includes: ① Basic weight calculation based on classical text mining Clinical context features were extracted from classical medical texts using named entity recognition, and the frequency of occurrence of each context feature was statistically analyzed. Simultaneously, Point-to-Point Mutual Information (PMI) was used to quantify the correlation between each context feature and key etiological mechanisms and syndrome information. The PMI calculation formula is as follows: in, As a clinical context characteristic, The core pathogenesis or syndrome; The probability of both contextual features and pathogenesis occurring together; , Each represents its independent probability of occurrence; The initial influence score is calculated by combining frequency and association strength, and the basic weights of each context feature are obtained through normalization: in, Let i be the frequency of occurrence of the i-th context feature. The total number of context features is given, and the sum of all basic weights is 1. ② Contextual completeness correction based on classical text type Based on the different levels of information completeness in classical texts, such as paragraphs, short sentences, and medical records, corresponding text correction coefficients are set. The basic weights are adaptively adjusted using the following formula: After correction, normalization is performed again to ensure that the overall weight sum is 1, in order to solve the problem of the difference in contextual richness of different classical texts; ③ Fine-tuning and calibration by clinical experts Clinical experts, drawing on their clinical diagnostic experience, fine-tuned the modified weights without altering the overall weight distribution pattern, resulting in final weights for each situational feature that possess both data objectivity and clinical rationality. ; Finally, the weighted clinical context features are unified in dimensions and missing features are added to complete the bidirectional mapping of context features between ancient and modern texts, thus constructing a modern electronic medical record clinical context feature vector with aligned dimensions and clinical priority differences. Clinical context feature vectors of classical medical texts .
6. The method according to claim 1, characterized in that, S4 specifically includes: S41: For text-dimensional feature vectors , Cosine similarity is used, relying on the cosine value of the angle between vectors to quantify the degree of matching of surface terms and sentence structures in ancient and modern texts. The text similarity calculation formula is as follows: In the formula: It is the dot product of two vectors; , These are the feature vectors of modern electronic medical records and classical texts, respectively. Norm; Calculation result The value ranges from [0,1]. The closer the value is to 1, the higher the overlap of the surface text features of the two types of text. S42: Targeting semantic dimension feature vectors and Substitute into the following formula to solve. The formula for comparing the semantic similarity of dialectical diagnosis and treatment in ancient and modern medical texts is as follows: S43: Based on the clinical context dimension, first break down the clinical context features within the context of diagnosis and treatment information, time and space, and the main subject, and then divide them into core and secondary levels according to their importance in clinical diagnosis and treatment. Then proceed with the following steps: (1) Sub-feature aggregation at the same level: All sub-feature vectors within the same level are matched pairwise using cosine similarity, and the average value is taken as the local similarity of that level. The formula for local similarity at a single level is: In the formula, For local similarity at a certain level; The number of sub-features contained in this level; (This refers to the corresponding section in modern medical records and classical texts.) Cosine similarity of contextual features of the strip; (2) Cross-level weighted aggregation: Set the weight of the core level Secondary level weights ,satisfy =1, weighted fusion of similarities at each level yields the overall clinical scenario similarity: In the formula: For core level similarity, Secondary level similarity; due to the higher priority of core diagnostic and treatment information, the configuration is... > The final output is the clinical scenario similarity between ancient and modern medical texts. .
7. The method according to claim 1, characterized in that, S5 specifically includes: S51: Normalize the text similarity, semantic similarity, and clinical scenario similarity separately to eliminate the differences in measurement units between different dimensions and obtain standardized text similarity. Standardized semantic similarity Standardized clinical scenario similarity ; S52: Assign static weights and dynamic decision coefficients to each dimension: Set text similarity weights Semantic similarity weight Clinical scenario similarity weight The weights satisfy the normalization condition. And prioritize assigning higher weight to the clinical scenario dimension; Set dynamic decision coefficients , , This is used to dynamically adjust the actual contribution of each dimension, adapting to the heterogeneity of ancient and modern texts and poor matching accuracy. The coefficient range is [0,1]. Combining similarity distribution characteristics and clinical adaptability, the contribution of each dimension is dynamically and adaptively adjusted. In view of the large differences in the expression of ancient and modern medical texts and the inconsistency in information completeness, the dimension discrimination ability is judged according to the degree of discrete distribution of similarity of each dimension. The corresponding dynamic decision coefficient is increased for dimensions with high discrimination and strong identification ability, and decreased for dimensions with similar samples and weak identification ability. At the same time, it is adjusted in combination with the clinical application scenarios of traditional Chinese medicine. The clinical diagnosis and treatment scenario focuses on strengthening the contribution of the clinical context dimension, and the classical text research and source tracing scenario focuses on strengthening the contribution of the text and semantic dimensions. S53: Based on static weights, dynamic decision coefficients, and standardized similarity, the comprehensive similarity is calculated using a multi-dimensional feature decision fusion algorithm. The calculation formula is as follows: S54: Output comprehensive similarity Based on comprehensive similarity, the medical texts in classical texts are sorted, and combined with preset matching thresholds, the medical texts in classical texts that match modern electronic medical records are selected. At the same time, the comparison details of each dimension are fully preserved, and intelligent comparison of medical texts between ancient and modern times is completed.
8. A smart comparison system for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity, characterized in that, The system includes: The text input module is used to input the natural language text to be compared, which includes two categories of ancient and modern medical texts: modern electronic medical record texts and classical medical texts. The scenario segmentation module is used to combine TCM diagnosis and treatment guidelines with TCM clinical diagnosis and treatment logic to define the clinical scenarios corresponding to the two types of ancient and modern diagnosis and treatment texts, and divide them into three categories of clinical scenario systems: diagnosis and treatment information scenario, spatiotemporal scenario, and subject scenario. The extraction and construction module is used to perform multi-dimensional feature extraction, structured encoding, and clinical context weight optimization on two types of ancient and modern medical texts. It completes text layer feature extraction and text feature vector construction, semantic layer feature extraction and semantic feature vector construction, and clinical context feature extraction and clinical context feature vector construction. Finally, it outputs a set of multi-dimensional feature vectors with unified dimensions and clinical priority differences. The similarity calculation module is used to construct similarity calculation rules in different dimensions based on the multi-dimensional feature vector set, complete the hierarchical similarity calculation of ancient and modern medical texts, and obtain multi-dimensional similarity results; The filtering module is used to standardize the multi-dimensional similarity results, calculate the comprehensive similarity using multi-dimensional feature decision fusion rules, filter out classical medical records that match modern electronic medical records, and complete the intelligent comparison of ancient and modern medical records.
9. An electronic device comprising a processor and a memory, wherein the memory stores at least one instruction, characterized in that, The processor loads and executes at least one instruction to implement the intelligent comparison method for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity as described in any one of claims 1-7.
10. A computer-readable storage medium storing at least one instruction, characterized in that, The at least one instruction is loaded and executed by the processor to implement the intelligent comparison method for ancient and modern clinical diagnosis and treatment texts based on multidimensional similarity as described in any one of claims 1-7.