A knowledge graph large model question and answer method and system for traditional Chinese prescription recommendation
By constructing a dynamic TCM knowledge graph and utilizing heterogeneous graph neural networks for multi-hop neighborhood aggregation and dual-channel fusion, the problem of insufficient information utilization in existing TCM prescription recommendations is solved, achieving a balance between accuracy and recall in TCM prescription recommendations and meeting the actual needs of clinical applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- UNIV OF SCI & TECH BEIJING
- Filing Date
- 2026-02-24
- Publication Date
- 2026-06-02
AI Technical Summary
Most existing TCM prescription recommendation technologies rely solely on single text feature modeling, failing to fully utilize the complex structural information of TCM knowledge graphs. Multimodal features are simply concatenated, making it difficult to adaptively enhance interactions. Furthermore, multi-label outputs lack adaptive threshold optimization, making it difficult to balance precision and recall, thus failing to meet actual clinical needs.
A dynamic TCM knowledge graph is constructed and modeled as a heterogeneous graph. A heterogeneous graph neural network is used to perform multi-hop neighborhood aggregation on nodes in the heterogeneous graph. An adaptive weighted fusion of text features and graph structure features is performed by combining a large language model. A dual-channel two-level gating fusion mechanism is used to predict multi-label TCM prescriptions, and the recommendation results are retrieved in the dynamic knowledge graph.
It improves the accuracy and recall of TCM prescription recommendations, meets actual clinical needs, and realizes the rationality of adaptive interactive enhancement and multi-label output in TCM prescription recommendations.
Smart Images

Figure CN122135936A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information technology in traditional Chinese medicine, and in particular to a knowledge graph-based question-and-answer method and system for recommending traditional Chinese medicine prescriptions. Background Technology
[0002] Traditional Chinese medicine (TCM) has a long history and wide clinical applications. With the rapid development of artificial intelligence and big data technologies, automating and refining TCM diagnosis and prescription recommendation using intelligent technologies has become an important research direction. By mining and modeling TCM clinical cases, treatment guidelines, and classical literature through technologies such as natural language processing, knowledge graphs, and deep learning, it is possible to effectively assist physicians in making clinical decisions and improve the standardization and efficiency of TCM diagnosis and treatment.
[0003] Most existing methods for recommending TCM prescriptions use traditional machine learning or a single pre-trained language model to analyze case texts. Some solutions combine knowledge graphs to complete the structured storage and relational query of knowledge in the TCM field, and achieve multi-source information fusion through simple feature concatenation or weighting. Then, they use conventional classification loss functions to complete model training in order to output appropriate prescriptions.
[0004] However, most existing TCM prescription recommendation technologies rely solely on single text feature modeling, failing to fully utilize the complex structural information of TCM knowledge graphs. Multimodal features are simply concatenated, making it difficult to adaptively enhance interactions. Furthermore, multi-label outputs lack adaptive threshold optimization, making it difficult to balance precision and recall, resulting in an unreasonable number of recommendations that cannot meet actual clinical needs. Summary of the Invention
[0005] To address the technical problems that existing TCM prescription recommendation technologies mostly rely on single text feature modeling, failing to fully utilize the complex structural information of TCM knowledge graphs, simply concatenating multimodal features without adaptive interaction enhancement, and lacking adaptive threshold optimization for multi-label outputs, resulting in difficulty balancing precision and recall, unreasonable recommendation numbers, and inability to meet actual clinical needs, this invention provides a knowledge graph-based large-scale model question answering method and system for TCM prescription recommendation.
[0006] The technical solutions provided by the embodiments of the present invention are as follows: The first aspect of this invention provides a knowledge graph-based question-answering method for recommending traditional Chinese medicine prescriptions, comprising: S1: Obtain multi-source data on traditional Chinese medicine; S2: Standardize the preprocessed TCM multi-source data using a large language model to form entity sets and relation triple sets; S3: Construct a dynamic TCM knowledge graph by combining entity sets and relation triple sets; S4: Input the instruction fine-tuning dataset into the pre-trained Chinese instruction large language model and output the semantic vector of the case text; S5: Model the dynamic TCM knowledge graph as a heterogeneous graph; S6: By constructing a heterogeneous graph neural network based on the heterogeneous graph, multi-hop neighborhood aggregation is performed on each node in the heterogeneous graph to obtain the case graph structure vector; S7: Through a dual-channel, two-level gating fusion mechanism, the semantic vector of the case text and the structural vector of the case graph are weighted and fused step by step to obtain the prediction score of multi-label TCM prescriptions; S8: Determine the recommended set of TCM prescriptions based on the prediction probabilities corresponding to the prediction scores of multi-label TCM prescriptions; S9: Based on the recommended set of TCM prescriptions, a search is performed in the dynamic TCM knowledge graph using TCM prescription nodes as indexes to obtain the Q&A results of TCM prescription recommendations.
[0007] A second aspect of this invention provides a knowledge graph-based question-answering system for recommending traditional Chinese medicine prescriptions, comprising: processor; The memory stores computer-readable instructions, which, when executed by the processor, implement the knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions as described in the first aspect.
[0008] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following: In this embodiment of the invention, a dynamic TCM knowledge graph is constructed and modeled as a heterogeneous graph. A heterogeneous graph neural network is used to perform multi-hop neighborhood aggregation on the nodes of the heterogeneous graph to obtain a case graph structure vector. Then, the case text semantic vector and the case graph structure vector are input into a dual-channel, two-level gating fusion mechanism to achieve adaptive weighted fusion and enhanced interaction between text features and graph structure features. This helps reduce reliance on single text features, fully explores and utilizes the complex structural information of the TCM knowledge graph, reduces the limitations of simple splicing fusion, and improves the adaptive interaction and expressive ability between text semantics and graph structure information. Simultaneously, the recommended TCM prescription set is determined based on the prediction probability corresponding to the multi-label TCM prescription prediction score. This helps alleviate the problem of insufficient adaptive threshold optimization in multi-label output, better balances the precision and recall of prescription recommendations, and makes the number of recommendations more reasonable, thereby better meeting the needs of practical clinical applications. Attached Figure Description
[0009] 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.
[0010] Figure 1 This is a flowchart illustrating a knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions, provided in an embodiment of the present invention.
[0011] Figure 2 This is a schematic diagram of the structure of a knowledge graph-based question-and-answer system for recommending traditional Chinese medicine prescriptions, provided in an embodiment of the present invention. Detailed Implementation
[0012] The technical solution of the present invention will now be described with reference to the accompanying drawings.
[0013] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.
[0014] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.
[0015] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.
[0016] 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.
[0017] Reference manual attached Figure 1 The diagram illustrates a flowchart of a knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions, provided by an embodiment of the present invention.
[0018] This invention provides a knowledge graph-based question-answering method for recommending traditional Chinese medicine (TCM) prescriptions. This method can be implemented using a knowledge graph-based question-answering device for TCM prescription recommendations, which can be a terminal or a server. The processing flow of this knowledge graph-based question-answering method for TCM prescription recommendations may include the following steps:
[0019] S1: Obtain multi-source data on traditional Chinese medicine.
[0020] Optionally, the multi-source data for traditional Chinese medicine includes: ancient Chinese medicine books and documents, medical records from interviews with renowned veteran Chinese medicine experts, and electronic clinical medical records.
[0021] In one possible implementation, after S1 and before S2, the process further includes: preprocessing the multi-source data of traditional Chinese medicine.
[0022] Preprocessing specifically includes: The system performs image scanning, OCR recognition, information completion, and translation on ancient Chinese medicine texts.
[0023] OCR, or Optical Character Recognition, refers to the process of analyzing images, scanned documents, or photographs containing text using image acquisition and processing technologies, extracting the outlines and features of the characters, and then converting the text in image form into editable and searchable text characters through pattern matching or deep learning models. It can achieve automatic conversion of unstructured image and text data into structured text data.
[0024] Information filtering was performed on medical records from interviews with renowned veteran TCM experts.
[0025] The clinical electronic medical records are analyzed, screened, and processed for missing values, outliers, and privacy-sensitive information.
[0026] It should be noted that the patient's basic information is also deleted or replaced at the same time.
[0027] Furthermore, the multi-source data of traditional Chinese medicine is converted into a unified text type description. The obtained unified text data is then deduplicated, segmented into sentences and paragraphs, and error-corrected.
[0028] It should be noted that the data is divided into two categories: the first category is used for the construction and updating of the TCM knowledge graph. The second category is used to construct a command fine-tuning dataset to support the adaptation of large language models to TCM semantic understanding and prescription recommendation tasks.
[0029] In this embodiment of the invention, targeted preprocessing of multi-source data, including ancient Chinese medicine texts, interview records with renowned veteran TCM experts, and electronic clinical medical records, enables the efficient conversion of unstructured TCM data into standardized, normalized, and usable text data. This ensures data accuracy and integrity while effectively removing noise, missing information, anomalies, and privacy-sensitive information, thus improving data quality. By unifying data formats, deduplication, sentence segmentation, and error correction, the difficulty of subsequent knowledge graph construction and instruction fine-tuning dataset creation is significantly reduced, improving the stability and convergence speed of model training. Furthermore, the reasonable division of data into graph construction data and fine-tuning datasets provides high-quality, professional data support for the structured expression of TCM knowledge and adaptation to large-scale models, thereby improving the reliability, generalization ability, and clinical applicability of TCM prescription recommendation models.
[0030] Furthermore, we will standardize the entities and terminology in the field of traditional Chinese medicine.
[0031] It should be noted that a unified set of entity types for defining core concepts in Traditional Chinese Medicine (TCM) is required. Entity types must include at least one or more of the following: symptoms, tongue appearance, pulse appearance, prescriptions, herbs, disease differentiation, syndrome differentiation, treatment methods, and decoction methods. A unified set of relationship types between these entities must also be designed. Relationship types must include at least one or more of the following: "Prescription-Indications-Symptoms / Tongue Appearance / Pulse Appearance", "Prescription-Inclusion-Herbs", "Symptoms-Correspondence-Disease Differentiation / Syndrome Differentiation", and "Prescription-Application-Decoction Method". Directionality, cardinality constraints, and consistency rules must be defined for each relationship.
[0032] In this embodiment of the invention, by standardizing the design of entities and terms in the field of traditional Chinese medicine, a unified set of entity types such as symptoms, tongue appearance, pulse appearance, prescriptions, herbs, disease differentiation, syndrome differentiation, treatment methods, and decoction methods are defined. Furthermore, the relationship types, directions, cardinality constraints, and consistency rules between various entities are standardized. This can effectively eliminate problems such as inconsistent expressions of traditional Chinese medicine terminology, entity ambiguity, and chaotic relationships, and provide a standardized semantic framework for subsequent knowledge graph construction, information extraction, and model understanding.
[0033] S2: Standardize the preprocessed multi-source TCM data using a large language model to form entity sets and relation triple sets.
[0034] Specifically, named entity recognition, relation extraction, and normalization mapping are performed on the preprocessed multi-source TCM data.
[0035] Among them, the Large Language Model (LLM) is a language understanding and generation model built on a deep learning architecture and pre-trained with massive amounts of text data. It has the ability to perform semantic understanding, text encoding, information extraction, content generation, and logical reasoning of natural language. It can learn contextual relationships and deep semantic information from input text and output continuous feature representations or context-aware text content. It is widely used in scenarios such as instruction understanding, entity extraction, relation extraction, semantic encoding, and intelligent question answering.
[0036] It should be noted that, under the constraints of preset prompt words, the large language model is used to perform named entity recognition, relation extraction and normalization mapping on TCM text, and ChatGPT-4 is used to perform prompt word engineering to generate structured extraction results.
[0037] The prompts specifically include: a predefined set of entity types, a predefined set of relation types, standardized mapping rules, output format specifications, and example constraints.
[0038] Furthermore, after obtaining the output of the large language model, quality control is carried out by combining manual review and rule verification, including deleting erroneous annotations, merging synonymous or duplicate entities, correcting unreasonable or conflicting relationships, and completing missing fields, thus forming a high-quality set of entities and set of relation triples for knowledge graph construction.
[0039] In this embodiment of the invention, a large language model is used to perform named entity recognition, relation extraction, and normalization mapping on TCM text under a preset prompt word engineering. Combined with manual review and rule verification for quality control, this method can efficiently and accurately extract standardized and structured entity and relation triples from unstructured TCM data. This approach fully utilizes the powerful semantic understanding and context learning capabilities of the large model, significantly improving the automation and accuracy of knowledge extraction while reducing the limitations of traditional rule extraction. Simultaneously, the quality control process effectively eliminates errors, merges duplicates, corrects conflicts, and fills in missing information, significantly improving the reliability and standardization of the knowledge graph construction data, providing a solid data guarantee for the high-quality construction of subsequent TCM knowledge graphs.
[0040] S3: Construct a dynamic TCM knowledge graph by combining entity sets and relation triple sets.
[0041] It should be noted that node and relation types are defined in the Neo4j graph database. The entity and relation triple sets, after manual review and quality control, are standardized to generate node and edge data conforming to the Neo4j import format. Each entity is assigned a unique identifier, its standard name, attribute fields, and evidence source. The relation type, direction, and weight are recorded for each relation. Batch import is used to write node and edge data into Neo4j to form a dynamic TCM knowledge graph. After import, indexes and uniqueness constraints are established to support efficient retrieval and consistency maintenance. The TCM knowledge graph supports CRUD operations and version updates. When new entities or relations arrive, normalization merging or incremental writing can be achieved through alias mapping and vector similarity alignment strategies, thereby constructing a dynamic TCM knowledge graph that can be used for subsequent retrieval, reasoning, and integration with prescription recommendation models.
[0042] In one possible implementation, S3 specifically includes: S301: Standardize and transform the entity set and relation triplet set respectively to generate node data and edge data.
[0043] S302: Write node data and edge data into Neo4j to construct a dynamic TCM knowledge graph.
[0044] Neo4j is a native graph database specifically designed for storing, managing, and querying graph-structured data in the form of nodes, relationships, and attributes. It can efficiently express complex relationships between entities, supports fast traversal of graph data, multi-hop queries, and association analysis, and is often used to build, store, and operate knowledge graphs, providing structured knowledge retrieval, relationship reasoning, and data association capabilities for upper-layer applications.
[0045] Furthermore, each entity phrase is vectorized to obtain a query vector. Vectorization is implemented using a pre-trained semantic representation model, with the bge-large-zh-v1.5 model being preferred for generating normalized semantic vector representations. Corresponding indexes are then established according to node type. The cosine similarity between the query vector and node vectors of the same type is calculated, and the similarity scores are sorted from high to low to obtain a candidate node set.
[0046] Among them, the bge-large-zh-v1.5 model is a general Chinese text embedding model. It is based on the BERT-large architecture and is deeply optimized. It adopts a 24-layer Transformer encoder and a 1024-dimensional hidden layer output. Through pre-training and contrastive learning training, it can map any Chinese text into a fixed-dimensional semantic vector. This model is specifically optimized for Chinese semantic understanding and retrieval. It supports the processing of long texts with a maximum of 8192 tokens and performs well in Chinese benchmark tests such as C-MTEB. It can accurately capture the deep semantics and subtle differences of the text.
[0047] Specifically, the similarity is as follows: in, sim Represents cosine similarity. e 1 represents the query vector. e 2 represents a semantic vector.
[0048] Furthermore, the node with the highest similarity ranking is selected from the candidate node set as a candidate, based on a similarity threshold. i Filtering is performed, and the nodes satisfy... At that time, the knowledge graph node identifier information aligned with the entity phrase is obtained; the node satisfies At that time, the corresponding node information will be manually reviewed and the TCM knowledge graph will be dynamically updated.
[0049] In this embodiment of the invention, a dynamic TCM knowledge graph is constructed and stored using the Neo4j graph database based on a high-quality set of entity and relation triples. Simultaneously, entity alignment and incremental updates are achieved by combining the bge-large-zh-v1.5 text embedding model with cosine similarity calculation. This not only efficiently and structurally stores complex relational knowledge such as symptoms, syndromes, prescriptions, and herbs within the TCM field, but also supports real-time addition, deletion, modification, and retrieval of the graph, as well as version maintenance, ensuring the timeliness and accuracy of the knowledge. Automatic entity alignment is achieved through vector semantic similarity matching, which significantly reduces the cost of graph updates, avoids entity redundancy and conflicts, and improves knowledge reuse and reasoning efficiency. This provides stable, reliable, and dynamically expandable TCM knowledge support for subsequent case semantic retrieval, relation reasoning, and prescription recommendation models.
[0050] In one possible implementation, after S3 and before S4, the method further includes: constructing an instruction fine-tuning dataset based on the preprocessed multi-source TCM data.
[0051] It should be noted that, firstly, the preprocessed data is structurally decomposed to extract key information such as "case description, core symptoms, tongue and pulse characteristics, syndrome differentiation results, and applicable prescriptions." Next, an instruction template adapted to the TCM prescription recommendation task is designed. The template includes three parts: "instruction prefix (e.g., 'Analyze the syndrome characteristics of the following cases and output the appropriate prescription'), input text (case description / symptom description), and output text (corresponding appropriate prescription / syndrome-prescription association)." Then, the decomposed TCM data is formatted and filled according to the instruction template to generate "instruction-input-output" triplet samples. Finally, the generated samples are deduplicated, denoised (removing samples with labeling errors / logical conflicts), and class balanced (supplementing samples corresponding to low-frequency prescriptions). The training set, validation set, and test set are then divided in an 8:1:1 ratio to form an instruction fine-tuning dataset adapted to the pre-trained Chinese instruction large language model. This dataset can be used for fine-tuning the model, enabling it to possess the ability to semantically encode TCM case texts and recognize syndrome-prescription associations.
[0052] In this embodiment of the invention, based on preprocessed multi-source TCM data, a high-quality, highly adaptable TCM prescription recommendation instruction fine-tuning dataset is formed through structured decomposition, instruction template construction, sample formatting generation, and dataset cleaning and partitioning. This dataset can provide standardized and scenario-based training samples for large language models, effectively improving the model's semantic understanding, syndrome recognition, and prescription association capabilities for TCM case texts. Through deduplication, noise reduction, and category balancing, the risk of model overfitting can be significantly reduced, enhancing the model's learning effect on low-frequency prescriptions and improving the model's fine-tuning efficiency, generalization ability, and recommendation accuracy in the TCM vertical field.
[0053] S4: Input the instruction fine-tuning dataset into the pre-trained Chinese instruction large language model and output the case text semantic vector.
[0054] It should be noted that the pre-trained large language model LLaMA3-Chinese-8B-Instruct-V3 was used as the base model to segment and encode the symptom text in the case studies. Compared with the original LLaMA3 model, this model, while maintaining the overall model architecture, adds incremental pre-training with a large-scale Chinese corpus, instruction fine-tuning, and alignment training, resulting in a significant improvement in Chinese speech understanding and task controllability, making it more suitable for downstream tasks in Chinese scenarios.
[0055] In one possible implementation, S4 specifically includes: S401: Introduce a low-rank increment matrix in the attention module of the Chinese instruction large language model to construct a weight matrix update method.
[0056] The low-rank increment matrix refers to the increment update matrix generated by the low-rank adapter during the model parameter fine-tuning process. Its rank is much smaller than that of the original weight matrix. This matrix is obtained by multiplying two low-rank matrices. It only requires a very small number of trainable parameters and can achieve a lightweight update of the model's feature representation ability without modifying the weight matrix of the original pre-trained model. This significantly reduces training and computational costs while ensuring model performance.
[0057] It should be noted that during the low-rank adapter (LoRA) fine-tuning process, the original weight matrix of the Chinese instruction large language model is kept frozen and not updated, and a low-rank adapter is introduced into the attention module of the pre-trained Chinese instruction large language model.
[0058] The specific method for updating the weight matrix is as follows: in, W’ Represents the weight matrix. W This represents the original weight matrix. This represents a trainable low-rank increment matrix. B This represents a trainable low-rank matrix. A Both represent trainable low-rank matrices. rank ( ) denotes the rank of the matrix. r’ It represents a low-rank dimension.
[0059] Furthermore, a scaling factor is introduced into the weight matrix to enhance training stability: in, α This represents the scaling factor.
[0060] It should be noted that, based on the weight matrix update method, the forward computation of the linear layer is performed by... Become This eliminates the need to explicitly store the complete weight matrix, allowing training to achieve the desired result. A and B This allows the model to be effectively adapted to downstream TCM prescription recommendation tasks.
[0061] Furthermore, loading the low-rank adapter into the query projection layer, key projection layer, value projection layer, and output projection layer can improve the adaptability to the semantic representation of case texts while maintaining inference efficiency.
[0062] S402: Based on the weight matrix update method, the symptom text in the preprocessed TCM multi-source data is input into the pre-trained Chinese instruction large language model for forward computation, and the hidden state sequence is output.
[0063] S403: Perform weighted average pooling on the hidden state sequence to obtain the semantic vector of the case text.
[0064] Specifically, the semantic vector of the case text is as follows: in, h Represents the semantic vector of the case text. T Indicates the total number of lexical units. t Indices representing lexical elements, H t Indicates the first t The latent vector of each word element m t Indicates the first t Attention mask values for each word.
[0065] In this embodiment of the invention, based on the instruction fine-tuning dataset, the LLaMA3 instruction-based large language model adapted to Chinese scenarios is used in conjunction with a low-rank adapter (LoRA) for efficient fine-tuning. While freezing the backbone parameters and significantly reducing computing power and memory consumption, overfitting and catastrophic forgetting are avoided, enabling the model to be lightweight and fast adapted to the TCM prescription recommendation task. By performing weighted average pooling on the hidden state sequence of the symptom text encoding output, the semantic vector of the case text is obtained, which can accurately and stably extract the contextual semantics and syndrome features of TCM cases, providing high-quality and high-discrimination semantic representation for subsequent fusion with knowledge graph features and prescription recommendation.
[0066] S5: Model the dynamic TCM knowledge graph as a heterogeneous graph.
[0067] In this embodiment of the invention, the dynamic TCM knowledge graph is modeled as a heterogeneous graph, which can fully retain the complex structural information of various entity types and relationship types such as symptoms, tongue appearance, pulse appearance, prescriptions, herbs, and syndrome differentiation. It accurately depicts the multi-level and multi-semantic associations between TCM diagnosis and treatment knowledge, and provides a more structured representation that fits the logic of the TCM field for subsequent graph neural network learning, effectively improving the model's understanding depth and reasoning ability of syndrome-prescription relationship.
[0068] S6: By constructing a heterogeneous graph neural network based on the heterogeneous graph, multi-hop neighborhood aggregation is performed on each node in the heterogeneous graph to obtain the case graph structure vector.
[0069] Among them, the heterogeneous graph neural mesh is a graph deep learning model for multiple types of nodes and multiple types of relationships. Its core is to perform type-aware message passing and feature fusion on heterogeneous graphs (containing multiple entities and multiple semantic edges). By designing independent transformation and aggregation rules for different node / edge types and combining meta-path and attention mechanisms, it accurately captures the complex semantic relationships between cross-type entities and encodes heterogeneous structures and attribute information into a unified low-dimensional vector representation.
[0070] In one possible implementation, the construction of the heterogeneous graph neural mesh specifically includes: Each node in the heterogeneous graph is input into a pre-trained text encoder, which outputs the initial feature vector of the node.
[0071] It should be noted that the names, attributes, and descriptions of each type of node are input into the pre-trained text encoder bge-large-zh-v1.5 to obtain the initial feature vectors of the nodes. The initial feature vectors of the nodes are then normalized and used as the input to the heterogeneous graph neural network.
[0072] The initial feature vectors of the nodes are normalized.
[0073] Based on the normalized initial feature vector of the node, the neighbor features of the target node are aggregated to obtain the neighbor representation within the relationship.
[0074] Specifically, the representation of intra-relationship neighbors is as follows: in, Indicates the first l Layer r The representation of the target node's internal neighbors under each relation type. v Indicates the target node. r Indexes representing relation types, l Index representing the level number, AGG ( ) represents an aggregate function. Indicates the first l Feature vectors of neighboring nodes in the layer u Indicates neighboring nodes, N r Indicates the first r The set of neighbor nodes under each relationship type.
[0075] Based on the neighbor representation within the relation, the neighbor information and its own characteristics of the target node are jointly updated to obtain the intermediate representation within the relation.
[0076] Specifically, the intermediate representation within the relation is as follows: in, Indicates the firstl +1 floor r The intermediate representation within the relation of the target node under each relation type. s Represents a non-linear activation function. Indicates the first l Layer r Learnable weight matrices of neighbor nodes under each relation type Indicates the first l The feature vector of the target node in the layer. Indicates the first l Layer r Learnable bias terms under each relation type.
[0077] By performing cross-relation aggregation on the intermediate representations within a relation, the final representation of the target node is obtained, thus completing the construction of the heterogeneous graph neural mesh.
[0078] Specifically, the final representation is as follows: in, Indicates the first l The final representation of the target node at level +1, R v This represents the set of all relation types associated with the target node. x s Indicates the first s The characteristic values of each element s Indicates the index of the element. S This represents the set of elements to be aggregated.
[0079] Furthermore, after encoding with a heterogeneous graph neural network, a formula node representation matrix integrating semantic and structural relationship information of multiple types of nodes, including prescriptions, symptoms, tongue appearance, pulse appearance, and herbs, can be obtained. Assuming the number of prescription categories is 175 and the graph hidden dimension is 128, the dimension of the formula node representation is 175×128. Subsequently, the formula node representation is input to a linear projection layer to map to an alignment space consistent with the text representation of the large language model, resulting in a formula graph representation with a dimension of 175×4096. The aligned formula graph representation is used for subsequent similarity calculation and gating fusion with the case text representation and the graph-side case representation, thereby achieving joint prescription recommendation based on text semantic information and graph structural information.
[0080] In this embodiment of the invention, a heterogeneous graph neural network is used to perform multi-hop neighborhood aggregation on the modeled TCM heterogeneous graph. Combined with the bge-large-zh-v1.5 model, the initial features of each node are extracted and normalized. Through hierarchical intra-relational neighbor aggregation, joint feature update and cross-relational aggregation, the complex multi-hop associations and deep semantics between various types of TCM entities (symptoms, prescriptions, herbs, etc.) are accurately captured. The structural information and node attribute information of the heterogeneous graph are encoded into a unified low-dimensional case graph structure vector. At the same time, a linear projection layer is used to achieve spatial alignment between the graph structure vector and the text semantic vector, providing highly adaptable and complete graph feature support for subsequent dual-channel two-level gating fusion. This effectively improves the model's reasoning and modeling ability for TCM syndrome-prescription association, and further ensures the accuracy and rationality of prescription recommendations.
[0081] S7: Through a dual-channel, two-level gating fusion mechanism, the semantic vector of the case text and the structural vector of the case graph are weighted and fused step by step to obtain the prediction score of multi-label TCM prescriptions.
[0082] Among them, the dual-channel two-level gating fusion mechanism is a hierarchical, adaptive, and weighted multimodal feature fusion method. It uses text semantic feature channels and graph structure feature channels as dual-channel inputs, and dynamically weights and interacts with the two types of features through two-level gating units. The first-level gating realizes the internal screening and enhancement of single-path features, and the second-level gating learns the adaptive fusion weights between the two-path features, automatically suppressing redundant information and highlighting key features. Finally, it efficiently fuses text semantics and graph structure information into a unified feature representation for subsequent multi-label prescription prediction, effectively improving the model's ability to model the joint information of TCM cases and knowledge graphs.
[0083] In one possible implementation, S7 specifically includes: S701: Combine the semantic vector of the case text and the structural vector of the case diagram to calculate the correlation vector between the case and the prescription.
[0084] Specifically, the case-prescription correlation vector includes: a correlation vector based on the semantic vector of the case text and a correlation vector based on the structural vector of the case graph.
[0085] Specifically, the relevance vector based on the semantic vector of the case text is as follows: in, s t This represents a relevance vector based on the semantic vector of the case text. d This indicates a learnable temperature parameter. This represents the normalized semantic vector of the case text. This represents the normalized formula embedding matrix.
[0086] Specifically, the correlation vector based on the case diagram structure vector is as follows: in, s g This represents a correlation vector based on the case diagram structure vector. This represents the normalized case diagram structure vector.
[0087] S702: Map the correlation vector to a unified feature space to obtain a fused feature vector.
[0088] Specifically, the fused feature vector is as follows: in, z ds Represents the fused feature vector. a The input features representing the linear transformation. W ds The learnable weight matrix representing the dual-channel features. b Represents the learnable bias term of a linear transformation.
[0089] S703: The fusion vector is activated by the Sigmoid function to obtain the prediction score of multi-label TCM prescriptions.
[0090] The specific prediction scores for multi-label TCM formulas are as follows: in, y 2 represents the prediction score for multi-label traditional Chinese medicine prescriptions. l 2 represents the second-level gating coefficient. y 1 represents the initial score after the first level of gating fusion. s Represents a non-linear activation function. i 2 This represents the learnable parameters of the second-level gating. l 1 represents the first-level gating coefficient. i 1 indicates the learnable parameters of the first-level gating.
[0091] Furthermore, a multi-label focusing loss function is adopted to assign higher weights to imbalanced and hard-to-classify samples, thereby improving the recall rate of minority class prescriptions and the overall multi-label prediction performance.
[0092] The multi-label focusing loss function is as follows: in, L This represents the loss value of the multi-label focusing loss function. B This indicates the total number of samples. b Indicates the index of the sample. N This indicates the total number of categories of traditional Chinese medicine prescriptions. i An index representing categories of traditional Chinese medicine prescriptions. α L Represents the category balance coefficient. p t,i Indicates the first i The true category prediction probability for each category of traditional Chinese medicine prescriptions. c This parameter represents the level of attention given to difficult-to-classify samples. y i Indicates the first i The true indicator variable for each category of traditional Chinese medicine prescriptions p i Indicates the first i The probability of predicting each category of traditional Chinese medicine prescription.
[0093] Furthermore, a mixed-precision training, gradient pruning, and multi-learning-rate grouping optimization strategy is adopted, with different learning rates set for the text channel parameters, graph convolution parameters, and classification head parameters to ensure training stability and convergence speed.
[0094] In this embodiment of the invention, a dual-channel, two-level gating fusion mechanism is used to adaptively and progressively weight and fuse the semantic vector of the case text and the structural vector of the case graph. This fully leverages the complementary advantages of the two types of information, namely text semantics and graph structure, automatically learns the optimal fusion weights and suppresses redundant information, thereby improving the model's ability to express the overall characteristics of TCM cases. Combined with a multi-label focusing loss function, the problem of imbalance in prescription data categories can be effectively alleviated, and the learning ability for difficult-to-classify samples and low-frequency prescriptions can be enhanced. At the same time, with the addition of mixed precision training, gradient pruning and multi-learning rate optimization strategies, the model's training stability, convergence speed and final prediction accuracy are significantly improved, thereby outputting multi-label TCM prescription prediction scores that are more in line with clinical practice.
[0095] S8: Determine the recommended set of TCM prescriptions based on the prediction probabilities corresponding to the prediction scores of multi-label TCM prescriptions.
[0096] It should be noted that TCM prescriptions with a predicted probability greater than the global threshold are selected as the recommended set of TCM prescriptions.
[0097] Those skilled in the art can set the size of the global threshold according to actual needs, and this invention does not limit it.
[0098] In one possible implementation, S8 specifically includes: S801: Perform a Sigmoid transformation on the prediction scores of multi-label TCM prescriptions to obtain the prediction probabilities.
[0099] S802: Construct a set of candidate thresholds.
[0100] S803: Compare the predicted probability with each candidate threshold in the candidate threshold set to obtain the multi-label prediction result.
[0101] Those skilled in the art can set the size of the candidate threshold according to actual needs, and the present invention does not limit this.
[0102] S804: Calculate the precision and recall of multi-label prediction results.
[0103] S805: Calculate the F1 score for each candidate threshold based on precision and recall.
[0104] The F1 score is as follows: in, F 1( f ) represents the F1 score of the candidate threshold. Precision Indicates accuracy. recall Indicates recall rate, e Represents a minimal constant. f This represents the candidate threshold.
[0105] S806: Determine the global threshold based on the F1 score.
[0106] It should be noted that the candidate threshold with the largest F1 score is selected as the global threshold.
[0107] S807: Select TCM prescriptions with a predicted probability greater than the global threshold as the recommended set of TCM prescriptions.
[0108] In this embodiment of the invention, the predicted probability is obtained by performing a Sigmoid transformation on the predicted scores of multi-label TCM prescriptions. Then, a candidate threshold set is constructed, and the precision, recall, and F1 score corresponding to each threshold are calculated. The candidate threshold with the largest F1 score is selected as the global threshold. Finally, prescriptions with predicted probabilities higher than this threshold are selected to form a recommendation set. This can achieve adaptive optimization of the global threshold, effectively balance the precision and recall of prescription recommendations, and avoid problems such as too many or too few recommendations or insufficient precision caused by fixed thresholds. This ensures that the recommended TCM prescription set not only fits the symptom characteristics of the patient case but also has high clinical applicability and reliability, providing accurate and reasonable prescription references for clinical diagnosis and treatment.
[0109] S9: Based on the recommended set of TCM prescriptions, a search is performed in the dynamic TCM knowledge graph using TCM prescription nodes as indexes to obtain the Q&A results of TCM prescription recommendations.
[0110] Specifically, based on the obtained set of recommended prescriptions, the system searches the dynamic TCM knowledge graph using prescription nodes as indexes to obtain the herbal composition, dosage information, and decoction method knowledge entries associated with each recommended prescription. The knowledge entries are then structured, organized, and merged according to a preset output template to generate the final question-and-answer output result, which includes the recommended prescription, composition, dosage, decoction method, and the basis for the recommendation.
[0111] Furthermore, the system includes a Vue 3-based front-end interaction module for providing case text input, parameter settings, and recommendation result display; a Django-based back-end service module for providing user authentication, request routing, parameter validation, and interface management, and receiving case text and inference parameters through a preset question-and-answer interface, returning structured or textual recommendation results; a model inference and fusion module for generating prescription prediction scores from input text and performing gated fusion and multi-label decision-making to obtain a set of recommended prescriptions; a knowledge graph retrieval enhancement module for querying knowledge such as herbal composition, dosage, and decoction method of recommended prescriptions in the TCM knowledge graph and completing the output content; and a result generation and storage module for concatenating "recommended prescription - composition - dosage - decoction method - recommendation basis" according to a preset template to generate the final question-and-answer output, and recording request, response, model version, and log information to support traceability and iterative optimization.
[0112] In this embodiment of the invention, a set of recommended TCM prescriptions is used as an index to retrieve core information such as the composition, dosage, and decoction method of related herbs from a dynamic TCM knowledge graph. Combined with front-end and back-end interaction, model reasoning, knowledge retrieval enhancement, and result storage modules, the recommendation results are structured and organized into a question-and-answer output containing the basis for the recommendation. This not only supplements the prescription recommendation results with complete clinical application details, improving the interpretability and practicality of the recommendations, but also enables full-process interaction of case input, parameter setting, and result display through a standardized front-end and back-end architecture. At the same time, it supports request traceability and model iterative optimization, providing clinicians with accurate, comprehensive, and practical TCM prescription recommendation decision support.
[0113] Reference manual attached Figure 2 The diagram shows a schematic of the structure of a knowledge graph-based question-and-answer system for recommending traditional Chinese medicine prescriptions, provided by the present invention.
[0114] This invention also provides a knowledge graph-based large-scale question-answering system 20 for recommending traditional Chinese medicine prescriptions, applied to the aforementioned knowledge graph-based large-scale question-answering method for recommending traditional Chinese medicine prescriptions, including: Processor 201.
[0115] The memory 202 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 201, they implement the knowledge graph large model question-answering method for recommending traditional Chinese medicine prescriptions as described in the method embodiment.
[0116] The knowledge graph large-scale model question-answering system 20 for TCM prescription recommendation provided by this invention can execute the above-mentioned knowledge graph large-scale model question-answering method for TCM prescription recommendation and achieve the same or similar technical effects. To avoid duplication, this invention will not elaborate further.
[0117] It should be understood that the processor in the embodiments of the present invention can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0118] It should also be understood that the memory in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0119] The above embodiments can be implemented, in whole or in part, by software, hardware (such as circuits), firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.
[0120] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. A and B can be singular or plural. Additionally, the character " / " in this article generally indicates an "or" relationship between the preceding and following related objects, but it can also represent an "and / or" relationship. Please refer to the context for a more accurate understanding.
[0121] In this invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be a single item or multiple items.
[0122] It should be understood that, in various embodiments of the present invention, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0123] 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.
[0124] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0125] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0126] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0127] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0128] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0129] This invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the knowledge graph large-scale model question-and-answer method for recommending traditional Chinese medicine prescriptions as described in the method embodiments.
[0130] The present invention provides a computer-readable storage medium that can implement the steps and effects of the knowledge graph large model question-answering method for TCM prescription recommendation in the above-described method embodiments. To avoid repetition, the present invention will not repeat the details.
[0131] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
[0132] The following points need to be explained: (1) The accompanying drawings of the embodiments of the present invention only involve the structures involved in the embodiments of the present invention. Other structures can refer to the general design.
[0133] (2) For clarity, the thickness of layers or regions is enlarged or reduced in the drawings used to describe embodiments of the invention, i.e., these drawings are not drawn to scale. It is understood that when an element such as a layer, film, region or substrate is referred to as being “above” or “below” another element, the element may be “directly” located “above” or “below” the other element or there may be intermediate elements.
[0134] (3) Where there is no conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other to obtain new embodiments.
[0135] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. The scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions, characterized in that... include: S1: Obtain multi-source data on traditional Chinese medicine; S2: Standardize the preprocessed TCM multi-source data using a large language model to form entity sets and relation triple sets; S3: Combine the entity set and the relation triple set to construct a dynamic TCM knowledge graph; S4: Input the instruction fine-tuning dataset into the pre-trained Chinese instruction large language model and output the semantic vector of the case text; S5: Model the dynamic TCM knowledge graph as a heterogeneous graph; S6: By constructing a heterogeneous graph neural network based on the heterogeneous graph, multi-hop neighborhood aggregation is performed on each node in the heterogeneous graph to obtain the case graph structure vector; S7: Through a dual-channel, two-level gating fusion mechanism, the semantic vector of the case text and the structural vector of the case graph are weighted and fused step by step to obtain the prediction score of multi-label TCM prescriptions; S8: Determine the recommended set of traditional Chinese medicine prescriptions based on the prediction probabilities corresponding to the prediction scores of the multi-label traditional Chinese medicine prescriptions; S9: Based on the recommended set of TCM prescriptions, a search is performed in the dynamic TCM knowledge graph using TCM prescription nodes as indexes to obtain the Q&A results of TCM prescription recommendations.
2. The knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions according to claim 1, characterized in that, The aforementioned multi-source TCM data specifically includes: ancient TCM texts, medical records from interviews with renowned veteran TCM experts, and electronic clinical medical records.
3. The knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions according to claim 2, characterized in that, After S1 and before S2, it also includes: The TCM multi-source data were preprocessed. The preprocessing specifically includes: The aforementioned ancient Chinese medicine texts were processed by image scanning, OCR recognition, information completion, and translation. Information filtering was performed on the medical records of interviews with renowned veteran TCM experts. The clinical electronic medical records are analyzed, screened, and processed for missing values, outliers, and privacy-sensitive information.
4. The knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions according to claim 1, characterized in that, S3 specifically includes: S301: Standardize and transform the entity set and the relation triplet set respectively to generate node data and edge data; S302: Write the node data and the edge data into Neo4j to construct the dynamic TCM knowledge graph.
5. The knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions according to claim 1, characterized in that, After S3 and before S4, it also includes: Based on the preprocessed multi-source TCM data, the instruction fine-tuning dataset is constructed.
6. The knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions according to claim 1, characterized in that, S4 specifically includes: S401: Introduce a low-rank increment matrix into the attention module of the Chinese instruction large language model to construct a weight matrix update method; S402: Based on the weight matrix update method, the symptom text in the preprocessed TCM multi-source data is input into the pre-trained Chinese instruction large language model for forward calculation, and the hidden state sequence is output. S403: Perform weighted average pooling on the hidden state sequence to obtain the semantic vector of the case text.
7. The knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions according to claim 1, characterized in that, The construction method of the heterogeneous graph neural mesh specifically includes: Each node in the heterogeneous graph is input into a pre-trained text encoder, which outputs the initial feature vector of the node. The initial feature vectors of the nodes are normalized. Based on the normalized initial feature vector of the node, the neighbor features of the target node are aggregated to obtain the neighbor representation within the relationship; Based on the neighbor representation within the relation, the neighbor information and its own characteristics of the target node are jointly updated to obtain the intermediate representation within the relation; The intermediate representations within the relationships are aggregated across relationships to obtain the final representation of the target node, thus completing the construction of the heterogeneous graph neural mesh.
8. The knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions according to claim 1, characterized in that, Specifically, S7 includes: S701: Combine the semantic vector of the case text and the structural vector of the case diagram to calculate the correlation vector between the case and the prescription; S702: Map the correlation vector to a unified feature space to obtain a fused feature vector; S703: The fused feature vector is activated using the Sigmoid function to obtain the prediction score of the multi-label TCM prescription.
9. The knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions according to claim 1, characterized in that, S8 specifically includes: S801: Perform a Sigmoid transformation on the prediction score of the multi-label TCM prescription to obtain the prediction probability; S802: Construct a candidate threshold set; S803: Compare the predicted probability with each candidate threshold in the candidate threshold set to obtain the multi-label prediction result; S804: Calculate the precision and recall of the multi-label prediction results; S805: Calculate the F1 score for each of the candidate thresholds based on the precision and the recall. S806: Determine the global threshold based on the F1 score; S807: Select the TCM prescriptions whose predicted probability is greater than the global threshold as the recommended TCM prescription set.
10. A knowledge graph-based question-and-answer system for recommending traditional Chinese medicine prescriptions, characterized in that... include: processor; A memory storing computer-readable instructions, which, when executed by the processor, implement the knowledge graph-based question-and-answer method for recommending traditional Chinese medicine prescriptions as described in any one of claims 1 to 9.