A method for locating ancient book discussions for clinical scenario queries

By constructing a text generation network and utilizing deep learning models and attention mechanisms, the semantic matching problem between ancient Chinese medicine texts and modern clinical contexts was solved, achieving efficient and accurate key argument location and enhancing the intelligent utilization of knowledge from ancient Chinese medicine texts.

CN121096685BActive Publication Date: 2026-05-01SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-05
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently and accurately locate key statements in ancient Chinese medical texts that correspond to modern clinical contexts, resulting in low efficiency and poor accuracy. In particular, when faced with significant differences between ancient and modern concepts, simple keyword matching methods cannot understand deep semantic relationships.

Method used

A text generation network is constructed, including a discourse proposal generation module, a target context semantic encoder, and a guided discourse localization decoder. Through attention mechanisms and deep learning models, relevant discourses in ancient Chinese medicine books are accurately located using modern clinical context query terms. Weakly supervised learning and a three-classification prediction head are used for fine screening.

Benefits of technology

It enables efficient and automated location of relevant key statements in a vast amount of ancient Chinese medicine texts, significantly improving the accuracy and efficiency of location, eliminating the dependence on large-scale labeled data, and ensuring the high relevance and usability of the output results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121096685B_ABST
    Figure CN121096685B_ABST
Patent Text Reader

Abstract

The application discloses a kind of ancient books discussion positioning method for clinical situation query, including the construction text generation network, the text generation network includes discussion proposal generation module, target situation semantic encoder and guided discussion positioning decoder;Discussion proposal generation module is used to extract the candidate discussion segment features and global context features of traditional Chinese medical ancient books;Target situation semantic encoder is used to encode query term into target situation feature vector;Candidate discussion segment features, global context features and target situation feature vector are jointly input into guided discussion positioning decoder to accurately position the traditional Chinese medical ancient books discussion segment most matched with target situation;The present application realizes accurate positioning under weak supervision by introducing target situation as strong guiding signal, greatly improves the efficiency and accuracy of ancient and modern clinical knowledge association mining.
Need to check novelty before this filing date? Find Prior Art

Description

A method for locating ancient texts in clinical context Technical Field

[0001] This invention belongs to the field of natural language processing and artificial intelligence technology, and in particular relates to a method for locating ancient texts for clinical context queries. Background Technology

[0002] Currently, the utilization of ancient Chinese medicine texts mainly relies on manual reading, collation, and compilation by experts and scholars. This traditional method has significant limitations: First, it is inefficient and time-consuming. Faced with a vast amount of texts, manual sorting is like finding a needle in a haystack, making it difficult to conduct large-scale, systematic knowledge mining. Second, it is highly subjective and lacks consistent standards. Different experts may have different understandings and summaries of the same ancient text, leading to repetition and inconsistency in knowledge collation. Third, there are differences between ancient and modern medical systems, making matching difficult. There are huge differences between ancient disease names and symptom descriptions and the disease and syndrome systems of modern medicine (i.e., "domain differences"). How to establish an accurate correspondence between modern clinical needs (such as research on ancient descriptions of "hypertension") and relevant descriptions in ancient texts (such as "headache," "dizziness," and "liver yang hyperactivity") is a recognized challenge in this field.

[0003] In recent years, with the development of Natural Language Processing (NLP) technology, some attempts have emerged to perform preliminary processing of ancient texts using techniques such as information retrieval and keyword matching. For example, keyword dictionaries are constructed to retrieve relevant entries from ancient text databases. However, most of these methods remain at a superficial level of string matching. They struggle to handle complex linguistic phenomena in ancient texts, such as synonyms and polysemy, and are unable to understand deeper semantic connections such as pathogenesis and treatment principles. When faced with clinical situations where ancient and modern concepts differ significantly, simple keyword searches often produce a large number of irrelevant results (low precision) or miss crucial information (low recall), failing to meet the needs of precise clinical decision support.

[0004] Therefore, there is an urgent need for an intelligent technology that can deeply understand the semantics of ancient texts and modern clinical contexts, and can automatically and accurately establish a connection between the two, so as to provide a new and efficient technical path for realizing the revitalization and intelligent inheritance of knowledge from traditional Chinese medicine classics. Summary of the Invention

[0005] (1) Technical problems to be solved

[0006] This invention discloses a method for locating ancient texts in a clinical context, aiming to solve the problems of difficulty, low efficiency, and poor accuracy in locating key knowledge in ancient texts due to the large difference between ancient and modern clinical contexts, semantic complexity, and lack of labeled data in existing technologies.

[0007] (2) Technical solution

[0008] In view of this, it is necessary to provide a method for locating ancient texts for clinical context queries, addressing the aforementioned technical problems, including the following steps:

[0009] Step 1: Construct a text generation network for locating arguments in ancient Chinese medicine texts that correspond to modern clinical contexts. The text generation network includes an argument proposal generation module, a target context semantic encoder, and a guided argument localization decoder.

[0010] Step 2: Using the digitized text of ancient Chinese medicine books as input, the argument proposal generation module is used to identify and extract features of multiple candidate argument fragments related to etiology, pathogenesis, symptoms or prescriptions in ancient Chinese medicine books, as well as global context features of ancient Chinese medicine books.

[0011] Step 3: Using query terms from modern clinical contexts as input, the query terms are encoded into target context feature vectors containing deep semantic information using a target context semantic encoder.

[0012] Step 4: Input the candidate argument fragment features, the global context features of the ancient Chinese medicine texts, and the target context feature vector into the guided argument localization decoder. The attention mechanism is used to accurately locate the ancient Chinese medicine text argument fragments that best match the target context.

[0013] Step 5: Use the publicly available dataset of accurate matching of ancient and modern medical cases to train the text generation network end-to-end;

[0014] Step 6: Input the query language based on modern clinical context into the trained text generation network to obtain key discussions related to the topic in a large number of ancient Chinese medicine books with automated and high-precision positioning.

[0015] Furthermore, the argument proposal generation module includes a text encoding backbone network based on a pre-trained language model and a multilayer perceptron classification head;

[0016] The text encoding backbone network is responsible for reading and encoding the ancient Chinese medicine text, and extracting the deep context features of each character or word in the ancient Chinese medicine text to obtain the global context features of the ancient Chinese medicine text.

[0017] The multilayer perceptron classification head processes the output of the text encoding backbone network, fuses each text span feature in the ancient Chinese medicine text with the global context features, performs binary classification, and selects the top N text span features with the highest classification confidence as candidate discourse fragment features.

[0018] Furthermore, the target context semantic encoder is a Transformer encoder that is independent of the text encoding backbone network structure in the argument proposal generation module. It is pre-trained and initialized through contrastive learning on a large-scale modern medical literature corpus to enhance the understanding of traditional Chinese medicine concepts.

[0019] The contrastive learning pre-training aims to enable the target context semantic encoder to learn to distinguish between different but semantically similar modern clinical contexts, thereby generating a highly discriminative target context feature vector for the input modern clinical context query terms.

[0020] Furthermore, step 4 specifically involves the following steps:

[0021] Step 401: Use all candidate argument fragment features, global context features of ancient Chinese medicine books, and target context feature vector as input to the guided argument localization decoder; the guided argument localization decoder includes a factorized self-attention layer, a multi-scale deformable cross attention layer, and a context-argument cross attention layer.

[0022] Step 402: Model the relationships between the candidate discourse fragments and between the candidate discourse fragments and the ancient Chinese medicine texts by using a factorized self-attention layer and a multi-scale deformable cross-attention layer;

[0023] Step 403: The context-argument cross-attention layer is the core guiding component. Using the target context feature vector as the query and the features of each candidate argument fragment as the key and value, the original relevance score between each candidate argument fragment and the target context is calculated through attention. The specific expression is as follows:

[0024]

[0025] in, This represents the original relevance score. For the target context feature vector, Features of candidate argument fragments This represents the standard scaled dot product attention mechanism. This represents a query in the attention mechanism. This represents a key in the attention mechanism. This represents the value in the attention mechanism;

[0026] Step 404: Normalize all original relevance scores using the Softmax function to generate attention weights, and sum all candidate argument feature vectors by weight to generate a new output feature vector that aggregates all candidate information and is dominated by the target context.

[0027] Step 405, the guided argument localization decoder further includes a three-class prediction head, which judges the classification result of the candidate argument segment with the highest matching degree based on the original relevance score and the corresponding candidate argument segment features, and finally outputs the argument segment judged as the target matching argument and its precise start and end positions in the ancient Chinese medicine book.

[0028] Furthermore, the factorized self-attention layer is used to capture the correlation between features of different candidate argument fragments; the multi-scale deformable cross-attention layer is used to fuse the features of candidate argument fragments with the global context features of ancient Chinese medical books.

[0029] Furthermore, step 5 specifically includes the following steps:

[0030] Step 501: Collect and construct a small-scale dataset of accurately matched ancient and modern medical cases manually annotated by TCM experts. The dataset contains various ancient TCM books, query terms for various modern clinical scenarios, and several real argument fragments annotated by experts. Each real argument fragment contains triple information.

[0031] Step 502: In each iteration of training, the query terms and ancient Chinese medicine books in the dataset are input into the text generation network to obtain a series of predicted discourse fragments and their corresponding categories and positions. The optimal predicted discourse fragments and their corresponding categories and positions are selected and utilized to calculate the combined loss function.

[0032] Step 503: Based on the combined loss function, calculate the loss gradient using the backpropagation algorithm, and use the optimizer to update all trainable parameters in the text generation network. Repeat this process until the model converges.

[0033] Furthermore, in step 502, a bipartite graph matching strategy based on the Hungarian algorithm is adopted to improve the matching effectiveness between the prediction results and the actual annotations. The specific steps are as follows:

[0034] Step 50201, define the argument fragment used to measure the model's predictions. Authentic excerpts with expert annotations Cost function of matching degree between The cost function is composed of the predicted classification confidence. and predicted positioning loss The weighted composition is expressed as follows:

[0035]

[0036] in, and These are the weighting coefficients;

[0037] Step 50202: Based on the cost function, calculate the matching cost between all predicted argument fragments and all true argument fragments and construct a cost matrix. Use the cost matrix as input for executing the Hungarian algorithm to efficiently find the unique allocation scheme that minimizes the total matching cost. The allocation scheme This was used to find the best match among all predicted argument fragments for each real argument fragment;

[0038] Step 50203, regarding the allocation scheme For successfully matched predicted argument fragments and real argument fragment pairs, calculate the classification loss. and positioning loss and used in the combined loss function Final calculation:

[0039]

[0040] in, To control classification loss The hyperparameters of the weights, To control positioning loss The hyperparameters of the weights.

[0041] Furthermore, the classification loss The focus loss is used to penalize models that mispredict the category of candidate argument fragments;

[0042] The positioning loss The text span intersection-union ratio loss is used to penalize models that have excessive deviations between the predicted start and end positions of argument segments and the actual positions annotated by experts.

[0043] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0044] This invention proposes a novel, weakly supervised framework for locating key arguments in ancient Chinese medicine texts. Its core advantages lie in significantly reducing application costs and improving accuracy. Furthermore, through an innovative two-stage "proposal-filtering" architecture, this invention only requires query terms related to modern clinical contexts as guiding signals to accurately locate target arguments in ancient texts. This eliminates reliance on large-scale, finely annotated "location-text" corpora of ancient texts, making intelligent knowledge mining of massive, heterogeneous Chinese medicine classics possible. The core context-argument cross-attention mechanism designed in this invention allows the model to match based on the deep semantics of modern clinical contexts, rather than simple keyword retrieval, effectively overcoming the semantic gap caused by inconsistencies in disease names and symptom descriptions between ancient and modern times. In addition, by introducing a three-class predictive head for secondary screening, this method can accurately extract target arguments from massive texts, ensuring high relevance of the final output and greatly improving the signal-to-noise ratio and usability of subsequent knowledge utilization. Attached Figure Description

[0045] Figure 1 shows a flowchart of the method for implementing the present invention; Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] For the sake of clarity and reference, the technical terms, abbreviations, or acronyms used below are summarized and explained as follows:

[0048] Transformer: A neural network architecture based on attention mechanisms for processing sequential data.

[0049] Cross-entropy loss: A commonly used loss function in machine learning, used to measure the difference between the probability distribution predicted by the model and the true label distribution. The goal of model training is to minimize this loss value.

[0050] Attention mechanism: A mechanism that mimics human visual attention, allowing neural networks to dynamically assign different "attention" weights to different parts when processing information.

[0051] Contrastive learning: a self-supervised learning method that learns feature representations by "bringing similar samples closer together and pushing dissimilar samples apart".

[0052] Focus loss: An improved cross-entropy loss function, primarily used to address class imbalance by reducing the weight of a large number of "easy" samples during training, allowing the model to focus more on learning those "difficult" samples that are hard to classify.

[0053] Text span intersection-union ratio loss: a metric and loss function used to measure the degree of overlap between two text segments. It is inspired by bounding box regression in computer vision. It accurately quantifies the accuracy of localization by calculating the intersection length of the predicted location and the actual location divided by the union length, and guides the model to optimize its predicted start and end positions.

[0054] Weak supervision: refers to using low-cost, imperfect labels to enable models to learn effectively even in scenarios where manually labeled data is scarce.

[0055] This invention discloses a method for locating ancient texts in clinical contexts, in order to solve many problems existing in the prior art.

[0056] Figure 1 illustrates a flowchart of an embodiment of the present invention, a method for locating ancient texts for clinical context queries, comprising the following steps:

[0057] Step 1: Construct a text generation network for locating arguments in ancient Chinese medicine texts that correspond to modern clinical contexts. The text generation network includes an argument proposal generation module, a target context semantic encoder, and a guided argument localization decoder.

[0058] Step 2: Using the digitized text of ancient Chinese medicine books as input, the argument proposal generation module is used to identify and extract features of multiple candidate argument fragments related to etiology, pathogenesis, symptoms or prescriptions in ancient Chinese medicine books, as well as global context features of ancient Chinese medicine books.

[0059] Step 3: Using query terms from modern clinical contexts as input, the query terms are encoded into target context feature vectors containing deep semantic information using a target context semantic encoder.

[0060] Step 4: Input the candidate argument fragment features, the global context features of the ancient Chinese medicine texts, and the target context feature vector into the guided argument localization decoder. The attention mechanism is used to accurately locate the ancient Chinese medicine text argument fragments that best match the target context.

[0061] Step 5: Use the publicly available dataset of accurate matching of ancient and modern medical cases to train the text generation network end-to-end;

[0062] Step 6: Input the query language based on modern clinical context into the trained text generation network to obtain key discussions related to the topic in a large number of ancient Chinese medicine books with automated and high-precision positioning.

[0063] The following example illustrates the process of locating ancient texts for clinical context-oriented queries:

[0064] Step 1 involves constructing a text generation network for locating arguments in ancient Chinese medicine texts that correspond to modern clinical contexts. The text generation network includes an argument proposal generation module, a target context semantic encoder, and a guided argument localization decoder.

[0065] Specifically, the overall architecture of the text generation network can be viewed as a "proposal-filtering" model, consisting of three main modules: a discourse proposal generation module, a target context semantic encoder, and a guided discourse localization decoder. These three modules work together to accurately find relevant discourses from a massive amount of ancient Chinese medicine texts based on a modern clinical context query.

[0066] Step 2 involves using the digitized text of ancient Chinese medicine texts as input. The argument proposal generation module identifies and extracts features from multiple candidate argument fragments related to etiology, pathogenesis, symptoms, and prescriptions, as well as global contextual features of the ancient Chinese medicine texts. Specifically, this includes the following steps:

[0067] Step 201: First, extract digitized ancient Chinese medicine texts from databases of ancient Chinese medicine books (such as the Siku Quanshu and the Chinese Medical Classics). These texts are usually unstructured long documents.

[0068] Step 202: Input the TCM ancient text into the argument proposal generation module, identify and extract features of multiple candidate argument segments related to etiology, pathogenesis, symptoms and prescriptions in the TCM ancient text, as well as global context features of the TCM ancient text; wherein, the argument proposal generation module includes a text encoding backbone network based on a pre-trained language model (BERT) and a multilayer perceptron (MLP) classification head;

[0069] Step 20201: The text encoding backbone network is responsible for reading and encoding the ancient Chinese medicine text, and extracting the deep context features of each character or word in the ancient Chinese medicine text to obtain the global context features of the ancient Chinese medicine text.

[0070] Step 20202: The multilayer perceptron classification head processes the output of the text encoding backbone network, fuses each possible text span feature in the ancient Chinese medicine text with the global context feature and performs a binary classification judgment ("is a medical discourse" / "is not a medical discourse"). Finally, the top N text span features with the highest classification confidence are selected as candidate discourse fragment features.

[0071] For example, a passage from the *Huangdi Neijing Suwen* states: "Wind is the chief of all diseases; when it changes, it becomes another disease."

[0072] Input: Input the entire text into BERT to obtain the context vector features of each character (such as "wind", "illness", "long", etc.) and the global features;

[0073] Candidate fragment (partial): "Wind is the chief of all diseases" is identified and extracted as a candidate for "cause of disease";

[0074] Classification: MLP judges this segment as a high-confidence "causal" argument based on "local + global" features.

[0075] At the same time, for texts such as the Treatise on Febrile and Miscellaneous Diseases, this module can identify "the disease of Taiyang is characterized by a floating pulse, stiffness and pain in the head and neck, and aversion to cold" as candidate descriptions, while ignoring title-like texts such as "Differentiation of Taiyang Disease Pulse and Symptoms and Treatment (Part 1)".

[0076] Step 3 involves using query terms from a modern clinical context as input and employing a target context semantic encoder to encode the query terms into target context feature vectors containing deep semantic information. This process includes the following steps:

[0077] Step 301: The user enters a query term related to a modern clinical context, such as "type 2 diabetes";

[0078] Step 302: Input the query term into the target context semantic encoder for encoding;

[0079] The target context semantic encoder is a Transformer encoder that is independent of the text encoding backbone network structure in the argument proposal generation module. It can be pre-trained and initialized through contrastive learning on a large-scale modern medical literature corpus to enhance its understanding of traditional Chinese medicine concepts.

[0080] The contrastive learning pre-training aims to enable the target context semantic encoder to learn to distinguish between different but semantically similar modern clinical contexts, thereby generating highly discriminative target context feature vectors for input modern clinical context query terms; for example, bringing the semantic representations of "diabetes" and "diabetes" closer together, while pushing the representations of "diabetes" and "edema" further apart.

[0081] Step 303: Finally, a high-dimensional target context feature vector containing deep semantic information is output to accurately represent the modern clinical context of "type 2 diabetes", that is, the deep semantic representation of "type 2 diabetes" is obtained.

[0082] Step 4 involves inputting the candidate argument fragment features, the global context features of the ancient Chinese medical texts, and the target context feature vector into the guided argument localization decoder. This decoder uses an attention mechanism to precisely locate the ancient Chinese medical text argument fragment that best matches the target context. The specific steps include:

[0083] Step 401: The features of all candidate argument fragments generated in Step 2, the global context features of ancient Chinese medicine books, and the target context feature vector generated in Step 3 are used together as the input of the guided argument localization decoder; the guided argument localization decoder includes a factorized self-attention layer, a multi-scale deformable cross attention layer, and a context-argument cross attention layer.

[0084] Step 402: Model the relationships between the candidate discourse fragments and between the candidate discourse fragments and the ancient Chinese medicine texts by using a factorized self-attention layer and a multi-scale deformable cross-attention layer;

[0085] The factorized self-attention layer is used to capture the correlation between features of different candidate argument fragments; the multi-scale deformable cross attention layer is used to fuse the features of candidate argument fragments with the global context features of ancient Chinese medical books.

[0086] Step 403: The context-discourse cross-attention layer is the core guiding component. Using the target context feature vector as the query, and the features of each candidate discourse fragment as the key and value, the original relevance score between each candidate discourse fragment and the target context is calculated through attention. The specific expression is as follows:

[0087]

[0088] in, This represents the original relevance score (the higher the original relevance score, the higher the match between the candidate argument and the target context). For the target context feature vector, Features of candidate argument fragments This represents the standard scaled dot product attention mechanism. This represents a query in the attention mechanism. This represents a key in the attention mechanism. This represents the value in the attention mechanism;

[0089] Step 404: Normalize all original relevance scores using the Softmax function to generate attention weights, and sum all candidate argument feature vectors by weight to generate a new output feature vector that aggregates all candidate information and is dominated by the target context.

[0090] For example, when the query context is "type 2 diabetes," its feature vector will be used as the query. The ancient text *Jinkui Lueyao* may contain multiple candidate passages, such as passage A: "Thirst with a thirst and dry mouth and tongue," passage B: "Men with diabetes experience excessive urination; after drinking one dou (a unit of volume) of water, they urinate one dou," and other irrelevant passages. Because the model has learned during pre-training in step 3 that the core semantics of "diabetes" and terms like "thirst" and "excessive urination" have extremely high vector similarity in semantic space, the dot product of the query vector for "type 2 diabetes" and the key vector of passage B will be much larger than its dot product with the key vector of passage A, which only contains the single symptom of "thirst." After Softmax normalization, passage B will receive a higher attention weight, while passage A will receive a smaller secondary weight. In the final weighted summation, the feature information of passage B will dominate, its original features will be significantly enhanced and passed to the subsequent classification head, thus guiding the decoder to accurately lock onto passage B.

[0091] By using the core context-discussion cross-attention mechanism to force the model to match the deep semantics of modern clinical contexts, the semantic gap caused by the inconsistency between ancient and modern disease names and symptom descriptions can be effectively overcome.

[0092] Step 405, the guided argument localization decoder further includes a three-class prediction head. The three-class prediction head, based on the original relevance score and the corresponding candidate argument fragment features, classifies the candidate argument fragment with the highest matching degree into one of the following three categories: 1) target matching argument, 2) non-target medical argument, 3) non-medical text. The model outputs the argument fragments classified as "target matching argument" and their precise start and end positions in ancient Chinese medicine books, thereby achieving accurate filtering and localization of target arguments.

[0093] By introducing a three-class prediction head for secondary screening, the target argument can be accurately extracted from massive amounts of text, ensuring high relevance of the final output and greatly improving the signal-to-noise ratio and usability of subsequent knowledge utilization.

[0094] Step 5 involves using a publicly available dataset of precise matching ancient and modern medical case records to train the text generation network end-to-end. This includes the following steps:

[0095] Step 501: First, collect and construct a small-scale dataset of precise matching of ancient and modern medical cases manually annotated by TCM experts. The dataset contains various ancient TCM books, query terms for various modern clinical scenarios, and several real argument fragments annotated by experts, which are used to train the text generation network end-to-end.

[0096] Each real argument fragment in this dataset contains triplet information (modern clinical context query term, source in ancient Chinese medicine texts, and the precise start and end positions of the target argument in ancient Chinese medicine texts).

[0097] Step 502: In each iteration of training, the query terms and ancient Chinese medicine texts in the dataset are input into the text generation network to obtain a series of predicted discourse fragments and their corresponding categories and positions. The optimal predicted discourse fragment and its corresponding category and position are selected and utilized to calculate the combined loss function. ;

[0098] Specifically, in step 502, a bipartite graph matching strategy based on the Hungarian algorithm is adopted to improve the matching effectiveness between the prediction results and the true annotations. The specific steps are as follows:

[0099] Step 50201, define the argument fragment used to measure the model's predictions. Authentic excerpts with expert annotations Cost function of matching degree between The cost function is composed of the predicted classification confidence. and predicted positioning loss The weighted composition is expressed as follows:

[0100]

[0101] in, and These are the weighting coefficients;

[0102] Step 50202: Based on the cost function, calculate the matching cost between all predicted argument fragments and all true argument fragments and construct a cost matrix. Use the cost matrix as input for executing the Hungarian algorithm to efficiently find the unique allocation scheme that minimizes the total matching cost. The allocation scheme This was used to find the best match among all predicted argument fragments for each real argument fragment;

[0103] Step 50203, regarding the allocation scheme For successfully matched predicted argument fragments and real argument fragment pairs, calculate the classification loss. and positioning loss and used in the combined loss function Final calculation:

[0104]

[0105] in, To control classification loss The hyperparameters of the weights, To control positioning loss The hyperparameters of the weights;

[0106] Specifically, the classification loss Focus loss is used to penalize models that mispredict the category (target matching / non-target / non-medical) of candidate argument fragments;

[0107] The positioning loss The text span intersection-union ratio loss is used to penalize models that have excessive deviations between the predicted start and end positions of argument segments and the actual positions annotated by experts.

[0108] Step 503, according to the combined loss function The loss gradient is calculated using the backpropagation algorithm, and the Adam optimizer is used to update all trainable parameters in the text generation network. This process is repeated until the model converges.

[0109] Step 6 involves inputting query language based on modern clinical scenarios into the trained text generation network to obtain key arguments that are automatically and accurately located in a vast amount of ancient Chinese medicine texts.

[0110] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0111] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0112] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0113] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for locating ancient texts in clinical contexts, characterized in that, Includes the following steps: Step 1: Construct a text generation network for locating the corresponding arguments in ancient Chinese medicine texts and modern clinical contexts. The text generation network includes an argument proposal generation module, a target context semantic encoder, and a guided argument localization decoder. Step 2: Using the digitized text of ancient Chinese medicine texts as input, the argument proposal generation module identifies and extracts features of multiple candidate argument fragments related to etiology, pathogenesis, symptoms, or prescriptions in ancient Chinese medicine texts, as well as global context features of ancient Chinese medicine texts. Step 3: Using query terms from modern clinical contexts as input, the query terms are encoded into target context feature vectors containing deep semantic information using a target context semantic encoder; 4. Input the candidate argument fragment features, the global context features of the ancient Chinese medical texts, and the target context feature vector into the guided argument localization decoder. The attention mechanism is used to accurately locate the ancient Chinese medical text argument fragment that best matches the target context.

5. Use a publicly available dataset of precise matching ancient and modern medical case studies to train the text generation network end-to-end.

6. Input query language based on modern clinical scenarios into the trained text generation network to obtain automatically and accurately located key arguments relevant to a vast amount of ancient Chinese medical texts. The specific steps of step 4 are as follows: Step 401, use all candidate argument fragment features, the global context features of the ancient Chinese medical texts, and the target context feature vector as input to the guided argument localization decoder. The guided argument localization decoder includes a factorized self-attention layer, a multi-scale deformable cross-attention layer, and a context-argument cross-attention layer. Step 402: Model the relationships between the candidate discourse fragments and between the candidate discourse fragments and the ancient Chinese medicine texts by using a factorized self-attention layer and a multi-scale deformable cross-attention layer; Step 403: The context-argument cross-attention layer is the core guiding component. Using the target context feature vector as the query and the features of each candidate argument fragment as the key and value, the original relevance score between each candidate argument fragment and the target context is calculated through attention. The specific expression is as follows: ;in, This represents the original relevance score. For the target context feature vector, Features of candidate argument fragments This represents the standard scaled dot product attention mechanism. This represents a query in the attention mechanism. This represents a key in the attention mechanism. The value in the attention mechanism is represented; Step 404, all original relevance scores are normalized using the Softmax function to generate attention weights and all candidate argument feature vectors are weighted and summed to generate a new output feature vector that aggregates all candidate information and is dominated by the target context; Step 405, the guided argument localization decoder also includes a three-class prediction head, which judges the classification result of the candidate argument segment with the highest matching degree based on the original relevance scores and the corresponding candidate argument segment features, and finally outputs the argument segment judged as the target matching argument and its precise start and end positions in the ancient Chinese medicine book.

2. The method for locating ancient texts based on clinical context queries according to claim 1, characterized in that, The argument proposal generation module includes a text encoding backbone network based on a pre-trained language model and a multilayer perceptron classification head; the text encoding backbone network is responsible for reading and encoding the ancient Chinese medicine text, and extracting the deep context features of each character or word in the ancient Chinese medicine text to obtain the global context features of the ancient Chinese medicine text. The multilayer perceptron classification head processes the output of the text encoding backbone network, fuses each text span feature in the ancient Chinese medicine text with the global context features, performs binary classification, and selects the top N text span features with the highest classification confidence as candidate discourse fragment features.

3. The method for locating ancient texts based on clinical context queries according to claim 1, characterized in that, The target context semantic encoder is a Transformer encoder that is independent of the text encoding backbone network structure in the argument proposal generation module. It enhances the understanding of traditional Chinese medicine concepts by performing contrastive learning pre-training and initialization on a large-scale modern medical literature corpus. The contrastive learning pre-training aims to enable the target context semantic encoder to learn to distinguish between different but semantically similar modern clinical contexts, thereby generating highly discriminative target context feature vectors for the input modern clinical context query terms.

4. The method for locating ancient texts based on clinical context queries according to claim 1, characterized in that, The factorized self-attention layer is used to capture the correlation between features of different candidate argument fragments; the multi-scale deformable cross-attention layer is used to fuse the features of candidate argument fragments with the global context features of ancient Chinese medical books.

5. The method for locating ancient texts based on clinical context queries according to claim 1, characterized in that, Step 5 specifically includes the following steps: Step 501, collecting and constructing a small-scale dataset of accurately matched ancient and modern medical cases manually annotated by TCM experts. The dataset contains various ancient TCM books, query terms for various modern clinical scenarios, and several real argument fragments annotated by experts. Each real argument fragment contains triple information. Step 502, in each iteration of training, the query terms and ancient TCM books in the dataset are input into the text generation network to obtain a series of predicted argument fragments and their corresponding categories and positions. The optimal predicted argument fragment and its corresponding category and position are selected and used to calculate the combined loss function. Step 503, based on the combined loss function, the loss gradient is calculated using the backpropagation algorithm, and the optimizer is used to update all trainable parameters in the text generation network. This process is repeated until the model converges.

6. The method for locating ancient texts for clinical context-oriented queries according to claim 5, characterized in that, In step 502, a bipartite graph matching strategy based on the Hungarian algorithm is adopted to improve the matching effectiveness between the prediction results and the ground truth labels. The specific steps are as follows: Step 50201, define the argument fragment used to measure the model prediction. Authentic excerpts with expert annotations Cost function of matching degree between The cost function is composed of the predicted classification confidence. and predicted positioning loss The weighted composition is expressed as follows: ;in, and The weighting coefficients are used in step 50202. Based on the cost function, the matching cost between all predicted argument fragments and all true argument fragments is calculated, and a cost matrix is ​​constructed. The cost matrix is ​​used as input for executing the Hungarian algorithm to efficiently solve for the unique allocation scheme that minimizes the total matching cost. The allocation scheme This step is used to find an optimal match from all predicted argument fragments for each real argument fragment; step 50203, regarding the allocation scheme... For successfully matched predicted argument fragments and real argument fragment pairs, calculate the classification loss. and positioning loss and used in the combined loss function Final calculation: ;in, To control classification loss The hyperparameters of the weights, To control positioning loss The hyperparameters of the weights.

7. The method for locating ancient texts based on clinical context queries according to claim 6, characterized in that, The classification loss The focus loss is used to penalize models that mispredict the category of candidate argument fragments; the localization loss... The text span intersection-union ratio loss is used to penalize models that have excessive deviations between the predicted start and end positions of argument segments and the actual positions annotated by experts.

Citation Information

Patent Citations

  • Method for constructing knowledge map of traditional Chinese medicine (TCM) theoretical books and records

    CN109190113A

  • Precise structured representation and semantic comparison method for traditional Chinese medicine situation information

    CN119943435A