A traditional Chinese medicine efficacy-effect intelligent semantic alignment and reasoning method and device

By employing BERT embedding technology and a two-layer bidirectional long short-term memory network for intelligent semantic alignment, the problem of semantic conversion between traditional and modern medicine has been solved, achieving efficient alignment of the efficacy and therapeutic effects of traditional Chinese medicine, and contributing to the research of traditional Chinese medicine and the cross-cultural application of drugs.

CN121191794BActive Publication Date: 2026-05-08MINZU UNIVERSITY OF CHINA +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MINZU UNIVERSITY OF CHINA
Filing Date
2025-10-29
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing technologies have failed to effectively address the semantic translation problem between traditional and modern medicine. In particular, the lack of a systematic evaluation model in the process of "traditionalizing" foreign medicinal resources makes it difficult to translate the efficacy and therapeutic effects of foreign drugs, which restricts the efficiency of TCM research and development and the application of cross-cultural drugs.

Method used

We employ an intelligent semantic alignment and reasoning method based on BERT embedding technology. By using word segmentation, a two-layer bidirectional long short-term memory network, and a cross-attention layer, we dynamically allocate matching weights between efficacy and efficacy, construct a fusion model of efficacy and efficacy of traditional Chinese medicine, and realize semantic alignment and reasoning between efficacy and efficacy.

Benefits of technology

It achieves efficient semantic alignment of the efficacy and effects of Chinese herbal medicines, assists TCM practitioners in understanding drug efficacy, facilitates research on Chinese herbal medicines and the introduction of new drugs, and improves the efficiency of Chinese medicine research and development and the scientific basis for cross-cultural drug application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121191794B_ABST
    Figure CN121191794B_ABST
Patent Text Reader

Abstract

The application provides a traditional Chinese medicine efficacy-effect intelligent semantic alignment and reasoning method and device, and relates to the technical field of natural language processing. The method comprises the following steps: obtaining Chinese herbal medicine efficacy text and corresponding Chinese herbal medicine effect text, segmenting to obtain efficacy subword units and effect subword units, inputting into a fine-tuned BERT model to obtain word vectors; inputting into a double-layer bidirectional long short-term memory network to obtain efficacy multi-granularity features and effect multi-granularity features; inputting into a cross-attention layer to dynamically allocate matching weights between efficacy and effect, and classifying through a Softmax function to obtain predicted Chinese herbal medicine effect text. Through the fusion of the deep learning model, the accurate conversion of efficacy and effect is effectively realized, and new technical support is provided for the efficacy analysis in the field of traditional Chinese medicine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to an intelligent semantic alignment and reasoning method and apparatus for the efficacy and therapeutic effects of traditional Chinese medicine. Background Technology

[0002] The exchange of traditional medicine and the introduction of new medicinal resources have presented a historic opportunity, especially for the traditional medicine systems of ethnic minorities, which have developed unique drug applications and treatment methods. Against this backdrop, the introduction of foreign medicinal resources faces strict constraints from the "Drug Registration Management Measures" and modern ethics, preventing their direct integration into traditional Chinese medicine clinical practice. However, current technical requirements focus more on addressing the drug-likeness of drugs from a modern pharmaceutical perspective, lacking systematic evaluation standards for the traditional medical characteristics and "Chinese medicine-ization" of these foreign medicinal resources. This has become a key bottleneck restricting the effective introduction of foreign medicinal resources.

[0003] In the field of Traditional Chinese Medicine (TCM), there is a significant difference in the understanding of efficacy and drug efficacy. Efficacy is a high-level summary of the clinical effects of Chinese medicine based on TCM theory, usually categorized into effects on the disease, symptoms, and syndrome. Drug efficacy, on the other hand, is the pharmacological action based on modern biomedical theory, which is the result of a drug causing physiological or biochemical reactions in the body. This semantic difference between traditional and modern medicine makes it difficult to translate the concepts of drug efficacy and drug efficacy of foreign drugs.

[0004] Currently, existing technologies fail to provide an effective way to solve the semantic translation problem between traditional and modern medicine, especially in the process of "traditionalizing" foreign medicinal resources. There is still a lack of effective technical means to organically connect the efficacy descriptions under different traditional medical systems and form a systematic evaluation model. For the efficacy translation of medicinal materials such as Moringa leaves, there are significant barriers to communication between traditional medicine and modern pharmacy, which greatly restricts the systematic introduction and application of foreign medicinal resources.

[0005] Therefore, developing a model that can realize the conversion of efficacy and pharmacodynamics of foreign drugs in the context of traditional Chinese medicine, and providing a scientific basis for their "traditionalization", has become an important issue for improving the efficiency of traditional Chinese medicine research and development, promoting the modernization of traditional Chinese medicine, and facilitating the application of cross-cultural drugs.

[0006] Existing rule-matching methods construct a set of manually defined rules and match them to descriptions of the efficacy and effects of traditional Chinese medicine (TCM). These rules are typically based on structured information or empirical knowledge from TCM literature. For example, keywords or phrases are defined to match the relationship between efficacy and effects. Disadvantages include: the rules struggle to comprehensively cover all expressions, are highly dependent on the text, and lack flexibility and scalability.

[0007] Statistical and machine learning-based methods include traditional machine learning algorithms such as SVM (Support Vector Machine) and random forests, which are typically applied to training on labeled data. Feature engineering is used to extract key features of efficacy and therapeutic effects (such as word frequency, grammatical structure, and contextual information in text) to train a classifier for semantic matching. A drawback is that machine learning methods have limited effectiveness for complex natural language expressions, especially when the amount of data is insufficient.

[0008] Deep learning-based methods include NLP (Natural Language Processing) models, such as those based on CNN (Convolutional Neural Networks), RNN (Recurrent Neural Networks), and LSTM (Long Short-Term Memory) networks for semantic analysis. These deep learning models automatically learn semantic features in text and match and align drug efficacy with therapeutic effects. Disadvantages include the need for large amounts of labeled data and computational resources, and the black-box nature of these models may lead to a lack of interpretability.

[0009] Methods based on graphs and knowledge graphs include: Traditional Chinese Medicine (TCM) knowledge graphs: These methods construct a graph of relationships between entities such as efficacy, therapeutic effects, pathology, and symptoms of TCM, and then semantically align efficacy and therapeutic effects. They utilize entities and relationships within the graph and employ graph embedding techniques for semantic mapping between efficacy and therapeutic effects. Finally, they apply graph neural networks to process the knowledge graph, performing semantic reasoning and alignment based on the relationships between nodes and edges. Disadvantages: Constructing the knowledge graph is labor-intensive, requiring expert knowledge and domain experience, and the computational cost of graph neural networks is also significant.

[0010] Cross-modal learning methods include multimodal information fusion: understanding the efficacy and effects of traditional Chinese medicine (TCM) relies not only on text but may also involve information from other modalities such as images, audio, and video. Therefore, cross-modal learning methods can combine data from different modalities to perform semantic transformation and alignment of efficacy and effects. For example, this can be achieved by combining chemical composition maps and literature descriptions of TCM for comprehensive analysis. Disadvantages: It requires support from multiple data sources, and fusing data from different modalities places high technical demands.

[0011] In summary, while existing methods for semantic transformation and alignment of efficacy in traditional Chinese medicine (TCM) have achieved theoretical and technical breakthroughs, they still face unique linguistic and semantic challenges specific to the field. Whether based on rules, dictionaries, ontology, machine learning, or deep learning and knowledge graphs, each method has its own advantages and disadvantages. In practical applications, it may be necessary to combine multiple methods and employ multimodal and multi-level semantic analysis to improve accuracy and robustness.

[0012] From an application perspective, significant barriers exist in communication between traditional medicine and modern pharmacy, which greatly restricts the systematic introduction and application of foreign medicinal resources. Therefore, developing a model that can realize the conversion of efficacy and pharmacodynamics of foreign drugs within the context of traditional Chinese medicine, and providing a scientific basis for their "Chinese medicineification," has become an important issue for improving the efficiency of traditional Chinese medicine research and development, promoting the modernization of traditional Chinese medicine, and facilitating the cross-cultural application of drugs.

[0013] Technically, a large pre-trained language model is used to semantically represent and align the efficacy and therapeutic effects of traditional Chinese medicine. BERT embedding technology is employed, which provides rich semantic representations and effectively measures semantic similarity. The model can capture semantic information by pre-learning linguistic features from a large corpus, effectively handling complex natural language expressions, and the deep learning model exhibits strong generalization capabilities. Summary of the Invention

[0014] To address the existing technological challenge of developing a model capable of converting the efficacy and pharmacodynamics of foreign drugs within the context of Traditional Chinese Medicine (TCM), and to provide a scientific basis for their "TCM-ification," thereby improving the efficiency of TCM research and development, promoting the modernization of TCM, and facilitating cross-cultural drug applications, this invention provides an intelligent semantic alignment and reasoning method and apparatus for TCM efficacy-pharmacodynamics. The technical solution is as follows:

[0015] On the one hand, an intelligent semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine is provided. This method is implemented by an intelligent semantic alignment and reasoning device and includes:

[0016] S1. Obtain the medicinal efficacy texts of Chinese herbal medicines and the corresponding efficacy texts of Chinese herbal medicines to construct a sample dataset.

[0017] S2. The text on the efficacy of Chinese herbal medicines and the text on the effects of Chinese herbal medicines are segmented by a word segmenter to obtain the efficacy sub-word units and the effects sub-word units. The efficacy sub-word units and the effects sub-word units are then input into the fine-tuned BERT model based on bidirectional transformers. Through the word embedding layer, sentence embedding layer and position embedding layer of the fine-tuned BERT model, the word vector of each efficacy sub-word unit and the word vector of each effects sub-word unit are obtained.

[0018] S3. Input the word vectors of the drug efficacy sub-word unit and the word vectors of the efficacy sub-word unit into a two-layer bidirectional long short-term memory network to obtain drug efficacy multi-granularity features and efficacy multi-granularity features.

[0019] S4. Input the multi-granular features of drug efficacy and multi-granular features of efficacy into the cross-attention layer, dynamically allocate the matching weights between drug efficacy and efficacy, and classify them through the Softmax function to obtain the predicted text of Chinese herbal medicine efficacy.

[0020] S5. Based on the predicted efficacy texts of Chinese herbal medicines and the efficacy texts of Chinese herbal medicines in the sample dataset, train the fusion model constructed based on the BERT model, a two-layer bidirectional long short-term memory network, and a cross-attention layer to obtain the trained fusion model.

[0021] S6. Input the text of the efficacy of Chinese herbal medicines to be inferred into the trained fusion model to obtain the inference result of the text of efficacy of Chinese herbal medicines.

[0022] Optionally, the method for constructing the fine-tuned BERT model in S2 includes:

[0023] By enabling error correction, decoupling gradient updates from weight decay, and skipping weight decay for bias terms and layer normalization parameters, the gradient update formula of the Adam algorithm is constructed, and the BERT model is trained.

[0024] The BERT model is trained by gradually freezing the encoder block in the BERT model.

[0025] Adjust the learning rate during the BERT model training process.

[0026] Optionally, the learning rate during the BERT model training process can be adjusted, including:

[0027] Iterative training is performed at a learning rate lower than a preset first threshold, warm-up is performed at a learning rate higher than a preset second threshold, and decay is performed at a learning rate lower than the preset first threshold.

[0028] Alternatively, the gradient update formula for the Adam algorithm is shown in equation (1) below:

[0029] (1)

[0030] In the formula, Indicates the model parameters at the th The value of the step, Indicates a time step. Indicates the learning rate. This represents the first moment estimate of the gradient. This represents the first-order moment estimate after bias correction. This represents the second-order moment estimate of the gradient. This represents the second-order moment estimate after bias correction. A constant representing numerical stability. This represents the weight decay coefficient.

[0031] Optionally, in S3, the word vectors of the pharmacodynamic sub-word units and the word vectors of the efficacy sub-word units are respectively input into a two-layer bidirectional long short-term memory network to obtain pharmacodynamic multi-granular features and efficacy multi-granular features, including:

[0032] The word vectors of the pharmacodynamics sub-word unit and the efficacy sub-word unit are input into the first forward long short-term memory network unit and the first backward long short-term memory network unit of the first layer bidirectional long short-term memory network, respectively, to obtain the first forward hidden state and the first backward hidden state. The features of the first forward hidden state and the first backward hidden state are concatenated to obtain the pharmacodynamic local phrase features and the efficacy local phrase features.

[0033] The local phrase features of drug efficacy and the local phrase features of drug effect are input into the second forward long short-term memory network unit and the second backward long short-term memory network unit of the second layer bidirectional long short-term memory network, respectively, to obtain the second forward hidden state and the second backward hidden state. The features of the second forward hidden state and the second backward hidden state are concatenated to obtain the global semantic features of drug efficacy and the global semantic features of drug effect.

[0034] Layered normalization is applied to the local phrase features of drug efficacy, the local phrase features of drug effect, the global semantic features of drug efficacy, and the global semantic features of drug effect. The layered normalized local phrase features of drug efficacy and the global semantic features of drug effect are concatenated to obtain the multi-granular features of drug efficacy. The layered normalized local phrase features of drug effect and the global semantic features of drug effect are concatenated to obtain the multi-granular features of drug effect.

[0035] Optionally, in S4, the multi-granular features of drug efficacy and multi-granular features of drug effect are input into the cross-attention layer, and the matching weights between drug efficacy and drug effect are dynamically assigned, including:

[0036] Obtain the query vector of multi-granular features of drug efficacy and the key-value vector of multi-granular features of drug efficacy, perform similarity calculation, and obtain the weights.

[0037] Use the Softmax function to normalize the weights.

[0038] The normalized weights and their corresponding key-value vectors are weighted and summed to obtain the matching weights between drug efficacy and therapeutic effect.

[0039] Optionally, the calculation process of the cross-attention layer is shown in equation (2) below:

[0040] (2)

[0041] In the formula, This represents the attentional interaction results between pharmacodynamic features and efficacy features. Indicates the characteristics of drug efficacy. , Indicates efficacy characteristics, The scaling factor representing the feature dimension. express The transpose of .

[0042] On the other hand, an intelligent semantic alignment and reasoning device for the efficacy-effect of traditional Chinese medicine is provided. This device is applied to the intelligent semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine. The device includes:

[0043] The data acquisition module is used to acquire texts on the efficacy of Chinese herbal medicines and their corresponding effects to construct a sample dataset.

[0044] The word vector construction module is used to segment the text on the efficacy of Chinese herbal medicines and the text on the effects of Chinese herbal medicines using a word segmenter, to obtain the efficacy sub-word units and the effects sub-word units. The efficacy sub-word units and the effects sub-word units are then input into the fine-tuned BERT model based on bidirectional transformers. Through the word embedding layer, sentence embedding layer and position embedding layer of the fine-tuned BERT model, the word vectors of each efficacy sub-word unit and each effects sub-word unit are obtained.

[0045] The feature construction module is used to input the word vectors of the pharmacodynamic sub-word unit and the efficacy sub-word unit into a two-layer bidirectional long short-term memory network to obtain pharmacodynamic multi-granular features and efficacy multi-granular features.

[0046] The efficacy prediction module is used to input multi-granular features of drug efficacy and multi-granular features of efficacy into the cross-attention layer, dynamically allocate matching weights between drug efficacy and efficacy, and classify them through the Softmax function to obtain the predicted efficacy text of Chinese herbal medicine.

[0047] The training module is used to train the fusion model based on the BERT model, a two-layer bidirectional long short-term memory network, and a cross-attention layer, based on the predicted efficacy text of Chinese herbal medicines and the efficacy text of Chinese herbal medicines in the sample dataset, so as to obtain the trained fusion model.

[0048] The output module is used to input the text of Chinese herbal medicine efficacy to be inferred into the trained fusion model to obtain the inference result of the Chinese herbal medicine efficacy text.

[0049] On the other hand, an intelligent semantic alignment and reasoning device is provided, the intelligent semantic alignment and reasoning device comprising: a processor; a memory, the memory storing computer-readable instructions, which, when executed by the processor, implement any one of the methods in the above-mentioned intelligent semantic alignment and reasoning methods for the efficacy-effect of traditional Chinese medicine.

[0050] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement any of the above-mentioned methods of intelligent semantic alignment and reasoning of efficacy-effect of traditional Chinese medicine.

[0051] The beneficial effects of the technical solutions provided by the embodiments of the present invention include at least the following:

[0052] In this invention, a machine learning fusion model can be used to effectively learn the efficacy and therapeutic information of Chinese medicinal materials from a large amount of data.

[0053] By calculating the correlation between the efficacy and effects of traditional Chinese medicine, semantic alignment and narrative transformation of efficacy-effect can be achieved.

[0054] It assists traditional Chinese medicine practitioners in understanding the efficacy and effects of drugs, and helps them in practicing the efficacy of Chinese herbal medicines and introducing new herbs.

[0055] For foreign or unknown Chinese herbal medicines, this method can provide a general prediction and understanding of their efficacy based on their medicinal properties, greatly assisting in the research of Chinese herbal medicines. Attached Figure Description

[0056] 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.

[0057] Figure 1 This is a flowchart of an intelligent semantic alignment and reasoning method for the efficacy and therapeutic effects of traditional Chinese medicine provided in an embodiment of the present invention;

[0058] Figure 2 This is an example of model training data (traditional Chinese medicine - efficacy) provided in an embodiment of the present invention.

[0059] Figure 3 This is an example of model training data (Traditional Chinese Medicine - Efficacy) provided in an embodiment of the present invention.

[0060] Figure 4 This is a word embedding layer hierarchy diagram provided in an embodiment of the present invention;

[0061] Figure 5 This is a schematic diagram of the frozen BERT main structure layer provided in an embodiment of the present invention;

[0062] Figure 6 This is a diagram illustrating the impact of freezing a specific encoder block on model performance, provided in an embodiment of the present invention.

[0063] Figure 7 This is a diagram of the Bi-LSTM model structure provided in an embodiment of the present invention;

[0064] Figure 8 This is a Bi-LSTM hierarchical structure diagram provided in the embodiments of the present invention;

[0065] Figure 9 This is a functional structure diagram of the Attention mechanism provided in the embodiments of the present invention;

[0066] Figure 10 This is a structural diagram of the Attention mechanism provided in an embodiment of the present invention;

[0067] Figure 11 This is a flowchart of the model training process provided in an embodiment of the present invention;

[0068] Figure 12 This is a semantic alignment and inference graph of the efficacy and therapeutic effects of traditional Chinese medicine provided in the embodiments of the present invention;

[0069] Figure 13 This is an example diagram of semantic reasoning of drug efficacy and therapeutic effect provided in the embodiments of the present invention;

[0070] Figure 14 This is a structural diagram of the fusion model provided in an embodiment of the present invention;

[0071] Figure 15 This is a diagram showing the semantic reasoning results of the pharmacodynamics-efficacy provided in the embodiments of the present invention;

[0072] Figure 16 This is a block diagram of an intelligent semantic alignment and reasoning device for the efficacy and therapeutic effects of traditional Chinese medicine provided in an embodiment of the present invention;

[0073] Figure 17 This is a schematic diagram of the structure of an intelligent semantic alignment and reasoning device provided in an embodiment of the present invention. Detailed Implementation

[0074] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0075] 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.

[0076] 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.

[0077] 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.

[0078] 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.

[0079] This invention provides an intelligent semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine. This method can be implemented by an intelligent semantic alignment and reasoning device, which can be a terminal or a server. Figure 1 The flowchart shown is for an intelligent semantic alignment and reasoning method for the efficacy and therapeutic effects of traditional Chinese medicine. The processing flow of this method may include the following steps:

[0080] S1. Obtain the medicinal efficacy texts of Chinese herbal medicines and the corresponding efficacy texts of Chinese herbal medicines to construct a sample dataset.

[0081] In one feasible implementation, the data sources and inclusion / exclusion criteria for traditional Chinese medicine in this invention are based on the "purgative" treatment principle of traditional Chinese medicine. Traditional Chinese medicines with "purgative" effects (purging, diuresis, purging, sedation, calming, penetrating, seeping, lubricating, overcoming, guiding, and descending) are collected from the Chinese Pharmacopoeia (2020 edition). Considering the properties of the drugs, animal and mineral drugs are not included in this study; and only traditional Chinese medicines with cold, cool, or neutral properties are retained.

[0082] Furthermore, the efficacy descriptions of the aforementioned Chinese medicines were extracted, processed, and semantically standardized, and then standardized with reference to the "Chinese Thesaurus of Traditional Chinese Medicine," breaking them down into the smallest semantic units according to the verb-object relationship.

[0083] Furthermore, the collection, processing, and semantic standardization of pharmacological effects were primarily based on the "Handbook of Modern Chinese Medicine Pharmacology and Clinical Application" (3rd edition, edited by Mei Quanxi, China Traditional Chinese Medicine Press, 2016), and also referenced experimental literature obtained from CNKI and PubMed databases (with search time limits set according to literature quality) to collect and standardize the pharmacological effect information of the aforementioned Chinese medicines. The standardization work referenced MeSH (Medical Subject Headings) and implemented expert intervention.

[0084] Examples of training data for the model constructed in this invention (Traditional Chinese Medicine - Efficacy) are as follows: Figure 2 As shown, an example of the training data for the constructed model (Traditional Chinese Medicine - Efficacy) is as follows: Figure 3 As shown.

[0085] S2. The text on the efficacy of Chinese herbal medicines and the text on the effects of Chinese herbal medicines are segmented by a word segmenter to obtain the efficacy sub-word units and the effects sub-word units. The efficacy sub-word units and the effects sub-word units are then input into the fine-tuned BERT model based on bidirectional transformers. Through the word embedding layer, sentence embedding layer and position embedding layer of the fine-tuned BERT model, the word vector of each efficacy sub-word unit and the word vector of each effects sub-word unit are obtained.

[0086] Optionally, the method for constructing the fine-tuned BERT model in S2 includes:

[0087] By enabling error correction, decoupling gradient updates from weight decay, and skipping weight decay for bias terms and layer normalization parameters, the gradient update formula of the Adam algorithm is constructed, and the BERT model is trained.

[0088] The BERT model is trained by gradually freezing the encoder block in the BERT model.

[0089] Adjust the learning rate during the BERT model training process: perform iterative training with a learning rate lower than a preset first threshold, warm up with a learning rate higher than a preset second threshold, and decay with a learning rate lower than the preset first threshold.

[0090] In one feasible implementation, the BERT (Bidirectional Encoder Representations from Transformers) model is a pre-trained language model based on the Transformer architecture, capable of generating context-related representations of words through bidirectional learning of contextual information. In this invention, the BERT model is used to transform natural language descriptions related to the efficacy of traditional Chinese medicine into efficient word vector representations, thereby enabling subsequent efficacy prediction.

[0091] Specifically, the input text is first segmented into tokens by a tokenizer. This step includes text conversion, punctuation removal, and tokenization. Words are first broken down into smaller sub-word units to optimize the vocabulary size and improve the model's generalization ability.

[0092] like Figure 4 The diagram shows the word embedding layer hierarchy. The Token Embeddings layer transforms each word into a one-dimensional vector, and these word vectors represent the words in the input text. The specific steps are as follows:

[0093] ① Input Processing: First, the text is tokenized, segmenting it into tokens (words or sub-words). For Chinese, single characters are used directly as input units, avoiding the complexity of word segmentation.

[0094] ② Special Tokens: Insert a [CLS] token at the beginning of the text to classify tasks; insert a [SEP] token at the end of the text to separate two sentences.

[0095] ③ Embedding Mapping: Each token is mapped to a fixed-size vector by looking up the pre-trained embedding matrix, forming Token Embeddings, which are used for subsequent model computation.

[0096] The Segment Embeddings layer is used to distinguish between two sentences in the input text. BERT not only performs language modeling tasks but can also handle sentence pair classification tasks. The specific steps are as follows:

[0097] ① Sentence tokenization: BERT distinguishes input sentence pairs through Segment Embeddings. The token for the first sentence is assigned a value of 0, and the token for the second sentence is assigned a value of 1, to identify them as two independent sentences.

[0098] ② Input concatenation: Two sentences are input into the model by concatenation. Segment Embeddings help the model understand the relationship between the two sentences, which is particularly suitable for question answering systems and text classification tasks.

[0099] ③ Text classification: In the single-sentence text classification task, all tokens in Segment Embeddings are 0, indicating that there is only one sentence.

[0100] The Position Embeddings layer provides the model with the position information of the token in the sequence. The specific steps are as follows:

[0101] ① Position encoding: Since the Transformer model itself does not have the ability to process the position information of tokens in the sequence, it is necessary to provide this information through position embedding vectors, with each position corresponding to a unique vector.

[0102] ② Semantic differences: Tokens in different positions carry different semantic information. For example, although "heat" and "sweat" are similar in "sweating to relieve fever" and "fever relieves sweating", their different positions will lead to different meanings. The Position Embeddings layer solves this problem.

[0103] ③ Embedding synthesis: Token Embeddings, Segment Embeddings and Position Embeddings are added together to obtain the final input embedding of each Token, which is then used by the model for subsequent processing.

[0104] Furthermore, this invention fine-tunes BERT to improve performance. First, Adam optimization enables error correction. By using `correct_bias=True`, model training efficiency is significantly improved, achieving the training loss without error correction in fewer training steps, effectively accelerating convergence and slightly improving the final model accuracy. The complete gradient update formula under Adam is as follows:

[0105] (1)

[0106] In the formula, Indicates the model parameters at the th The value of the step, Indicates the model parameters at the th The value of the step, This represents the weight decay coefficient. A constant representing numerical stability. This represents the second-order moment estimate after bias correction. This represents the learning rate, which controls the step size for parameter updates. The exponential decay rate (momentum coefficient) of the first-order moment estimate controls historical gradient information. The retention ratio, Represents the loss function In the Step time parameters The gradient indicates the direction of parameter updates (gradient descent direction).

[0107] Furthermore, the part related to the parameters is the upper right corner, in the direction where the gradient change is greater. The larger the value of , the smaller the corresponding weight constraint, which is clearly unreasonable. Furthermore, L2 and weight decay are isotropic in all directions. Therefore, to address this issue, one adjustment method is to decouple gradient updates from weight decay, skipping the weight decay term for the bias term and LayerNorm normalization parameters. AdamW's update formula:

[0108] (2)

[0109] In the formula, This indicates that the model parameters (weights) are in the th... The value of the step (iteration / time step); Indicates the time step or number of iterations; This represents the learning rate. The first moment estimate of the gradient (uncorrected exponential moving average) is used to estimate the mean (momentum) of the gradient and reduce the influence of noise. This represents the first-order moment estimate after bias correction, addressing the initial stage of the Adam optimizer. The deviation problem (when it is relatively small); The second-moment estimate of the gradient (uncorrected exponential moving average) is used to estimate the variance of the gradient, and the learning rate is adaptively adjusted. This represents the second-order moment estimate after bias correction, used to correct for initial bias. A constant representing numerical stability to prevent the denominator from being zero; This represents the weight decay coefficient, which penalizes large weight values ​​and prevents overfitting.

[0110] Secondly, freeze some layer parameters, such as Figure 5 As shown, the encoder block is gradually frozen and fine-tuned while the model performance is evaluated. Figure 6 The experiment shows the impact of freezing specific encoder blocks on model performance. The results show that training only the first 5 encoder blocks is sufficient to achieve performance close to that of training all encoder blocks.

[0111] Finally, there's the learning rate adjustment. The model iterates initially with a small learning rate, then warms up with a larger learning rate, and finally decays with a smaller learning rate as it iterates. In the initial stages of Transformer training, the expected gradient near the output layer is very large; without warmup, the model optimization process would be very unstable.

[0112] This invention freezes some layers of the BERT main structure and only updates the classification head, improving training speed while ensuring efficiency.

[0113] S3. Input the word vectors of the drug efficacy sub-word unit and the word vectors of the efficacy sub-word unit into a two-layer bidirectional long short-term memory network to obtain drug efficacy multi-granularity features and efficacy multi-granularity features.

[0114] Specifically, the word vectors of the drug efficacy sub-word unit and the word vectors of the efficacy sub-word unit are input into the first forward long short-term memory network unit and the first backward long short-term memory network unit of the first layer bidirectional long short-term memory network, respectively, to obtain the first forward hidden state and the first backward hidden state. The features of the first forward hidden state and the first backward hidden state are concatenated to obtain the drug efficacy local phrase features and the efficacy local phrase features.

[0115] The local phrase features of drug efficacy and the local phrase features of drug effect are input into the second forward long short-term memory network unit and the second backward long short-term memory network unit of the second layer bidirectional long short-term memory network, respectively, to obtain the second forward hidden state and the second backward hidden state. The features of the second forward hidden state and the second backward hidden state are concatenated to obtain the global semantic features of drug efficacy and the global semantic features of drug effect.

[0116] Layered normalization is applied to the local phrase features of drug efficacy, the local phrase features of drug effect, the global semantic features of drug efficacy, and the global semantic features of drug effect. The layered normalized local phrase features of drug efficacy and the global semantic features of drug effect are concatenated to obtain the multi-granular features of drug efficacy. The layered normalized local phrase features of drug effect and the global semantic features of drug effect are concatenated to obtain the multi-granular features of drug effect.

[0117] In one feasible implementation, Bi-LSTM (Bidirectional Long Short-Term Memory) is an extension of LSTM (Long Short-Term Memory), capturing contextual relationships by simultaneously considering both forward and backward information of the input sequence. In this invention, Bi-LSTM layers are used to capture the contextual dependencies between terms related to the efficacy of traditional Chinese medicine, accurately representing the semantic relationship between efficacy and therapeutic effect.

[0118] like Figure 7 The diagram shows the structure of the Bi-LSTM model. In Bi-LSTM, the process of encoding a sentence "Externally used to detoxify, kill insects, and heal sores; internally used to tonify fire, assist yang, and relieve constipation" is as follows: the forward LSTM_L is fed with "detoxify, heal sores, heal sores, tonify fire, assist yang, and relieve constipation" in sequence to obtain 6 vectors. The backward LSTM_R is then fed with the following inputs in sequence: "relieve constipation, invigorate yang, replenish fire, heal sores, heal sores, detoxify", resulting in 6 vectors. Finally, the implicit vectors of the forward and backward directions are concatenated to obtain... .

[0119] As Figure 8 shown in the hierarchical structure diagram of Bi-LSTM, the first layer of Bi-LSTM: input word embeddings (vectors generated by Word2Vec / BERT, etc.). Capturing local phrases (such as "clearing heat and cooling blood") through bidirectional context (forward + backward), and outputting the hidden state at each time step. The forward LSTM sees "clearing heat" → predicts "cooling blood". The backward LSTM sees "cooling blood" → associates with "clearing heat".

[0120] The second layer of Bi-LSTM: input the hidden state sequence of the first layer. Integrating local phrases at a higher level and modeling global semantics (such as "clearing heat and cooling blood" and "detoxifying and removing stasis" jointly targeting "excessive heat-toxin in blood"). Combining "clearing heat and cooling blood" and "detoxifying and removing stasis" to infer "synergistically treating excessive heat-toxin in blood". Each layer of Bi-LSTM contains forward and backward propagation to ensure that context information is fully captured.

[0121] The bidirectional long short-term memory network is a deep learning model based on LSTM units and a bidirectional encoding structure. It integrates the forward and backward temporal features of sequential data and is usually used to handle context-dependent problems in natural language processing. It is a neural network architecture that can capture both local syntactic structures and global semantic associations, and can effectively improve the accuracy of text representation. The output of Bi-LSTM is represented by H. The higher the dimension of H, the richer the semantic information captured by the model. H is composed of two sets of feature vectors concatenated together, namely h→ reflecting forward context dependence, h← reflecting backward context dependence, and deep semantic features integrated through the hierarchical structure. Bi-LSTM comprehensively considers the distributional features at the word level and phrase level through a two-layer architecture, and can more comprehensively model the hierarchical semantic information of the text. Therefore, in deep learning-based text classification tasks, Bi-LSTM is selected as the core feature extraction module. In this invention, the Bi-LSTM network is implemented using the PyTorch framework. First, the input text is converted into a sequence of word vectors, then the local phrase features are extracted through the bidirectional LSTM layer, and finally the global semantic information is integrated through the second layer of LSTM. Since there are differences in the feature scales at different levels, layer normalization is performed before feature concatenation to ensure the training stability of the subsequent classifier.

[0122] This invention adopts hierarchical BiLSTM. The first layer captures local phrases and captures each word. The second layer models global semantics and pays more attention to long-distance dependencies and overall semantics.

[0123] This invention conducts experimental comparative analysis, as shown in Table 1 Influence of attention granularity on model performance:

[0124] Table 1 Influence of attention granularity on model performance

[0125]

[0126] Because the numerical ranges of features at different granularities vary significantly (e.g., the weights of local n-gram features differ in scale from those of global sentence-level weights), this invention employs Min-Max normalization to standardize both local and global features to eliminate the influence of dimensionality. Specifically, local granular features... and global granular features Normalize them as follows:

[0127] (3)

[0128] (4)

[0129] Normalized features can participate more evenly in subsequent cross-attention calculations, preventing a single feature with a large numerical range from dominating the model's learning process. In the feature fusion stage, this invention uses normalized local features... and global features The features are concatenated to form a multi-granularity feature representation Hmulti, which is then input into the cross-attention module to calculate the semantic association weights between the efficacy description and the therapeutic effect description.

[0130] S4. Input the multi-granular features of drug efficacy and multi-granular features of efficacy into the cross-attention layer, dynamically allocate the matching weights between drug efficacy and efficacy, and classify them through the Softmax function to obtain the predicted text of Chinese herbal medicine efficacy.

[0131] Optionally, in S4, the multi-granular features of drug efficacy and multi-granular features of drug effect are input into the cross-attention layer, and the matching weights between drug efficacy and drug effect are dynamically assigned, including:

[0132] Obtain the query vector of multi-granular features of drug efficacy and the key-value vector of multi-granular features of drug efficacy, perform similarity calculation, and obtain the weights.

[0133] Use the Softmax function to normalize the weights.

[0134] The normalized weights and their corresponding key-value vectors are weighted and summed to obtain the matching weights between drug efficacy and therapeutic effect.

[0135] One feasible implementation method is, for example Figure 9The diagram shows the functional structure of the Attention mechanism. Attention is a weighted mechanism used to assign different attention weights to different parts of a sequence, enabling the model to better focus on important information. In this invention, the Attention layer processes each temporal vector with weights, emphasizing the relevance to specific efficacy, thereby improving the model's understanding of the semantics of drug efficacy and therapeutic effects. The main steps for calculating the Attention value include:

[0136] 1. Calculate the similarity between the sequence and the key value to obtain the weight;

[0137] 2. Normalize the weights using the Softmax function;

[0138] 3. The weights and corresponding key values ​​are summed in a weighted manner to obtain the final Attention value.

[0139] like Figure 10 The diagram showing the Attention mechanism structure illustrates the vanishing gradient problem and the neglect of contextual meaning inherent in Bi-LSTM. To address these issues, this invention introduces an Attention mechanism. By distinguishing the importance of different features, ignoring unimportant features, and focusing attention on important features, classification accuracy is improved. The Attention model addresses the problems of Bi-LSTM in three steps:

[0140] 1. Retain the intermediate output results of the Bi-LSTM encoder on the input sequence;

[0141] 2. Train a selective learning model, using the result from the previous step as input;

[0142] 3. When outputting the Attention sequence, associate the output sequence with the model from step 2.

[0143] Furthermore, the calculation process for cross-attention is as follows:

[0144] (5)

[0145] In the formula, This represents the attention interaction results between pharmacodynamic features and efficacy features, quantifies the degree of attention that pharmacodynamic features pay to efficacy features, and extracts weighted efficacy information. Indicates the characteristics of drug efficacy. , Indicates efficacy characteristics, The scaling factor representing the feature dimension. The transpose of the key vector Key in attention computation, pharmacodynamic features ( ) and efficacy characteristics ( The model uses a pairwise similarity matrix. Through cross-attention, the model can dynamically assign matching weights between drug efficacy and therapeutic effect, thereby achieving more accurate semantic alignment.

[0146] In the experimental phase, this invention compared the performance differences of three strategies: using only local attention, using only global attention, and multi-granularity attention fusion. Experimental results show that multi-granularity attention fusion can significantly improve the accuracy and F1-score of efficacy-effect alignment, especially when dealing with complex efficacy descriptions.

[0147] In summary, the multi-granularity attention mechanism proposed in this invention effectively integrates the local details and global semantics of pharmacological efficacy description through hierarchical feature extraction and dynamic weight allocation, providing reliable technical support for the intelligent alignment of pharmacological efficacy and therapeutic effects in traditional Chinese medicine.

[0148] The core of the intelligent semantic alignment and reasoning method for TCM efficacy and therapeutic effects lies in leveraging the powerful semantic representation capabilities provided by BERT, combined with BiLSTM and Attention mechanisms to capture complex sequence dependencies and information focal points, thereby achieving efficient and accurate conversion between TCM efficacy and therapeutic effects. Through training the fusion model, it can fully learn the information transmitted and converged between nodes through walk sequences.

[0149] This invention combines multi-granularity attention with interactive attention. Local granularity extracts pharmacodynamic terms through a sliding window, such as "activating blood circulation" in "activating blood circulation and removing blood stasis." Global granularity generates semantic weights for long sentences, such as the overall efficacy of "activating blood circulation and removing blood stasis." Interactive alignment calculates the semantic association between pharmacodynamics and efficacy, such as "expelling phlegm" and "clearing heat and promoting urination."

[0150] S5. Based on the predicted efficacy texts of Chinese herbal medicines and the efficacy texts of Chinese herbal medicines in the sample dataset, train the fusion model constructed based on the BERT model, a two-layer bidirectional long short-term memory network, and a cross-attention layer to obtain the trained fusion model.

[0151] One feasible implementation method is, for example Figure 11 The model training flowchart shown illustrates a fusion model that, while using BERT for word vectors and training, employs a Bi-LSTM model with an added Attention layer. In the Bi-LSTM, the output vector of the last time step is used as the feature vector, and the Softmax function is selected for classification. The Attention layer first calculates the weights for each time step, then weights the vectors from all time steps, uses the result as the feature vector, and finally selects the Softmax function for classification.

[0152] Through training and learning the fusion model, it is possible to fully learn the information transmitted and converged between nodes through walk sequences (such as...). Figure 12 The discovery of correlations “efficacy 1-efficacy 2”, “efficacy 2-efficacy 3”, and “efficacy 3-efficacy 1” indicates a strong semantic correlation between them, meaning that semantic conversion between efficacy and efficacy of traditional Chinese medicine can be performed.

[0153] like Figure 13 The diagram shown is an example of semantic reasoning of efficacy and efficacy. This invention uses data on Chinese herbal medicines and their efficacy to train a fusion model in multiple rounds to generate a high-performance model, thereby capturing the corresponding semantic relationship between the efficacy and efficacy of Chinese herbal medicines.

[0154] like Figure 14 The diagram shows the fusion model structure. After inputting drug efficacy information, the model processes it through a deep learning model. First, the model extracts features from the efficacy data, uses BERT for semantic understanding, and captures contextual information from the efficacy description using BiLSTM. Next, the model uses an attention mechanism to focus on key parts of the efficacy description, learning the mapping relationship between efficacy and therapeutic effect. Finally, after a series of calculations and optimizations, the model outputs the corresponding therapeutic effect and assigns a probability value to each effect, representing the likelihood of that effect given the efficacy. In this way, the model can effectively predict and transform drug efficacy into corresponding therapeutic effect descriptions, providing a more accurate efficacy-therapeutic effect mapping.

[0155] Furthermore, analyzing the top-ranked effects allows us to identify which effects the model considers most closely associated with this "medicinal effect." This provides prediction and understanding for the narrative transformation of this medicinal effect; the semantic reasoning results of the medicinal effect-efficacy relationship are as follows: Figure 15 As shown.

[0156] The inference results show that the efficacy of "expectorant" is ranked as follows: ('clearing heat', 7.03%) > ('diuresis', 6.84%) > ('cooling blood', 6.34%) > ('promoting urination', 5.89%) > ('stopping bleeding', 5.70%) > ('clearing lungs', 4.87%) > ('stopping cough', 4.27%) > ('resolving phlegm', 3.89%)... That is, the effects closely related to this efficacy include "clearing heat", "diuresis", "cooling blood", and "promoting urination", which is consistent with the understanding of efficacy.

[0157] S6. Input the text of the efficacy of Chinese herbal medicines to be inferred into the trained fusion model to obtain the inference result of the text of efficacy of Chinese herbal medicines.

[0158] This invention combines the BERT model, Bi-LSTM layers, and Attention layers to achieve semantic alignment and inference of the efficacy and therapeutic effects of traditional Chinese medicine (TCM) through deep learning technology. First, the BERT model trains efficacy-related word vectors, converting natural language words related to TCM efficacy into computer-recognizable vectors. Weighted calculations yield sentence vectors, generating the text vector for the entire document. Then, Bi-LSTM captures the dependencies between words, selecting the output of the last time sequence as the feature vector. Finally, an attention layer weights each time sequence vector, synthesizing the temporal information to output the target efficacy, and uses Softmax classification for efficacy prediction. This approach, through the fusion of deep learning models, effectively achieves accurate conversion between efficacy and therapeutic effects, providing novel technical support for efficacy analysis in the field of TCM.

[0159] In this embodiment of the invention, a machine learning fusion model can be used to effectively learn the efficacy and therapeutic information of Chinese medicinal materials from a large amount of data.

[0160] By calculating the correlation between the efficacy and effects of traditional Chinese medicine, semantic alignment and narrative transformation of efficacy-effect can be achieved.

[0161] It assists traditional Chinese medicine practitioners in understanding the efficacy and effects of drugs, and helps them in practicing the efficacy of Chinese herbal medicines and introducing new herbs.

[0162] For foreign or unknown Chinese herbal medicines, this method can provide a general prediction and understanding of their efficacy based on their medicinal properties, greatly assisting in the research of Chinese herbal medicines.

[0163] Figure 16 This is a block diagram illustrating an intelligent semantic alignment and reasoning device for the efficacy and therapeutic effects of traditional Chinese medicine, according to an exemplary embodiment. The device is used in a method for intelligent semantic alignment and reasoning of the efficacy and therapeutic effects of traditional Chinese medicine. (Refer to...) Figure 16 The device includes a data acquisition module 310, a word vector construction module 320, a feature construction module 330, a power prediction module 340, a training module 350, and an output module 360. Among them:

[0164] The data acquisition module 310 is used to acquire texts on the efficacy of Chinese herbal medicines and corresponding texts on the effects of Chinese herbal medicines to construct a sample dataset.

[0165] The word vector construction module 320 is used to segment the text on the efficacy of Chinese herbal medicines and the text on the effects of Chinese herbal medicines using a word segmenter to obtain the efficacy sub-word units and the effects sub-word units. The efficacy sub-word units and the effects sub-word units are then input into the fine-tuned BERT model based on bidirectional transformers. Through the word embedding layer, sentence embedding layer and position embedding layer of the fine-tuned BERT model, the word vectors of each efficacy sub-word unit and each effects sub-word unit are obtained.

[0166] The feature construction module 330 is used to input the word vectors of the drug efficacy sub-word unit and the word vectors of the efficacy sub-word unit into a two-layer bidirectional long short-term memory network to obtain drug efficacy multi-granular features and efficacy multi-granular features.

[0167] The efficacy prediction module 340 is used to input the multi-granular features of drug efficacy and multi-granular features of efficacy into the cross-attention layer, dynamically allocate the matching weights between drug efficacy and efficacy, and classify them through the Softmax function to obtain the predicted efficacy text of Chinese herbal medicine.

[0168] Training module 350 is used to train a fusion model based on BERT, a two-layer bidirectional long short-term memory network, and a cross-attention layer, based on the predicted efficacy text of Chinese herbal medicines and the efficacy text of Chinese herbal medicines in the sample dataset, so as to obtain a trained fusion model.

[0169] The output module 360 ​​is used to input the text of the efficacy of Chinese herbal medicines to be inferred into the trained fusion model to obtain the inference result of the text of efficacy of Chinese herbal medicines.

[0170] In this embodiment of the invention, a machine learning fusion model can be used to effectively learn the efficacy and therapeutic information of Chinese medicinal materials from a large amount of data.

[0171] By calculating the correlation between the efficacy and effects of traditional Chinese medicine, semantic alignment and narrative transformation of efficacy-effect can be achieved.

[0172] It assists traditional Chinese medicine practitioners in understanding the efficacy and effects of drugs, and helps them in practicing the efficacy of Chinese herbal medicines and introducing new herbs.

[0173] For foreign or unknown Chinese herbal medicines, this method can provide a general prediction and understanding of their efficacy based on their medicinal properties, greatly assisting in the research of Chinese herbal medicines.

[0174] Figure 17 This is a schematic diagram of the structure of an intelligent semantic alignment and reasoning device provided in an embodiment of the present invention, as shown below. Figure 17 As shown, the intelligent semantic alignment and reasoning device may include the above-mentioned Figure 16 The illustrated intelligent semantic alignment and reasoning device for the efficacy and therapeutic effects of traditional Chinese medicine. Optionally, the intelligent semantic alignment and reasoning device 410 may include a first processor 2001.

[0175] Optionally, the intelligent semantic alignment and reasoning device 410 may also include a memory 2002 and a transceiver 2003.

[0176] The first processor 2001, memory 2002, and transceiver 2003 can be connected via a communication bus.

[0177] The following is combined Figure 17 The various components of the intelligent semantic alignment and reasoning device 410 are described in detail below:

[0178] The first processor 2001 is the control center of the intelligent semantic alignment and reasoning device 410. It can be a single processor or a collective term for multiple processing elements. For example, the first processor 2001 can be one or more central processing units (CPUs), application-specific integrated circuits (ASICs), or one or more integrated circuits configured to implement embodiments of the present invention, such as one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs).

[0179] Optionally, the first processor 2001 can perform various functions of the intelligent semantic alignment and reasoning device 410 by running or executing software programs stored in the memory 2002 and calling data stored in the memory 2002.

[0180] In a specific implementation, as one example, the first processor 2001 may include one or more CPUs, for example... Figure 17 CPU0 and CPU1 are shown in the diagram.

[0181] In a specific implementation, as one example, the intelligent semantic alignment and reasoning device 410 may also include multiple processors, for example... Figure 17 The first processor 2001 and the second processor 2004 are shown in the diagram. Each of these processors can be a single-core processor or a multi-core processor. Here, a processor can refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).

[0182] The memory 2002 is used to store the software program that executes the present invention, and is controlled by the first processor 2001 to execute it. The specific implementation method can be referred to the above method embodiment, and will not be repeated here.

[0183] Optionally, the memory 2002 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory 2002 may be integrated with the first processor 2001 or may exist independently, and may be connected via the interface circuit of the intelligent semantic alignment and inference device 410. Figure 17 (Not shown in the image) is coupled to the first processor 2001, and this embodiment of the invention does not specifically limit this.

[0184] The transceiver 2003 is used to communicate with network devices or with terminal devices.

[0185] Alternatively, transceiver 2003 may include a receiver and a transmitter. Figure 17 (Not shown separately). The receiver is used to implement the receiving function, and the transmitter is used to implement the transmitting function.

[0186] Optionally, the transceiver 2003 can be integrated with the first processor 2001 or exist independently, and can be connected to the interface circuit of the intelligent semantic alignment and inference device 410. Figure 17 (Not shown in the image) is coupled to the first processor 2001, and this embodiment of the invention does not specifically limit this.

[0187] It should be noted that, Figure 17 The structure of the intelligent semantic alignment and reasoning device 410 shown in the figure does not constitute a limitation on the router. Actual knowledge structure recognition devices may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0188] 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.

[0189] 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.

[0190] 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.

Claims

1. A method for intelligent semantic alignment and reasoning of the efficacy and therapeutic effects of traditional Chinese medicine, characterized in that, The method includes: S1. Obtain the medicinal efficacy texts of Chinese herbal medicines and the corresponding efficacy texts of Chinese herbal medicines to construct a sample dataset; S2. The herbal medicine efficacy text and herbal medicine effect text are segmented by a word segmenter to obtain efficacy sub-word units and effect sub-word units. The efficacy sub-word units and effect sub-word units are respectively input into the fine-tuned BERT encoding representation model based on bidirectional transformer. Through the word embedding layer, sentence embedding layer and position embedding layer of the fine-tuned BERT model, the word vector of each efficacy sub-word unit and the word vector of each effect sub-word unit are obtained. S3. Input the word vectors of the pharmacodynamic sub-word units and the word vectors of the efficacy sub-word units into a two-layer bidirectional long short-term memory network to obtain pharmacodynamic multi-granularity features and efficacy multi-granularity features. S4. Input the multi-granular features of drug efficacy and multi-granular features of efficacy into the cross-attention layer, dynamically allocate the matching weights between drug efficacy and efficacy, and classify them through the Softmax function to obtain the predicted text of Chinese herbal medicine efficacy. S5. Based on the predicted efficacy text of Chinese herbal medicines and the efficacy text of Chinese herbal medicines in the sample dataset, train the fusion model constructed based on the BERT model, a two-layer bidirectional long short-term memory network and a cross-attention layer to obtain the trained fusion model. S6. Input the text of the efficacy of Chinese herbal medicine to be inferred into the trained fusion model to obtain the text inference result of the efficacy of Chinese herbal medicine. In step S3, the word vectors of the pharmacodynamic sub-word units and the efficacy sub-word units are respectively input into a two-layer bidirectional long short-term memory network to obtain pharmacodynamic multi-granular features and efficacy multi-granular features, including: The word vectors of the pharmacodynamic sub-word units and the word vectors of the efficacy sub-word units are respectively input into the first forward long short-term memory network unit and the first backward long short-term memory network unit of the first layer bidirectional long short-term memory network to obtain the first forward hidden state and the first backward hidden state. The first forward hidden state and the first backward hidden state are concatenated to obtain the pharmacodynamic local phrase features and the efficacy local phrase features. The local phrase features of pharmacodynamics and local phrase features of efficacy are respectively input into the second forward long short-term memory network unit and the second backward long short-term memory network unit of the second layer bidirectional long short-term memory network to obtain the second forward hidden state and the second backward hidden state. The features of the second forward hidden state and the second backward hidden state are concatenated to obtain the global semantic features of pharmacodynamics and the global semantic features of efficacy. The local phrase features of efficacy, local phrase features of drug efficacy, global semantic features of efficacy, and global semantic features of drug efficacy are subjected to layer normalization. The layer-normalized local phrase features of efficacy and global semantic features of drug efficacy are concatenated to obtain multi-granularity features of efficacy. The layer-normalized local phrase features of drug efficacy and global semantic features of drug efficacy are concatenated to obtain multi-granularity features of drug efficacy.

2. The intelligent semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine according to claim 1, characterized in that, The method for constructing the fine-tuned BERT model in S2 includes: By enabling error correction, decoupling gradient updates from weight decay, and skipping weight decay for bias terms and layer normalization parameters, the gradient update formula of the Adam algorithm is constructed, and the BERT model is trained. The BERT model is trained by gradually freezing the encoder block in the BERT model; Adjust the learning rate during the BERT model training process.

3. The intelligent semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine according to claim 2, characterized in that, The adjustment of the learning rate during the BERT model training process includes: Iterative training is performed at a learning rate lower than a preset first threshold, warm-up is performed at a learning rate higher than a preset second threshold, and decay is performed at a learning rate lower than the preset first threshold.

4. The intelligent semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine according to claim 2, characterized in that, The gradient update formula of the Adam algorithm is shown in equation (1) below: (1) In the formula, Indicates the model parameters at the th The value of the step, Indicates a time step. Indicates the learning rate. This represents the first moment estimate of the gradient. This represents the first-order moment estimate after bias correction. This represents the second-order moment estimate of the gradient. This represents the second-order moment estimate after bias correction. A constant representing numerical stability. This represents the weight decay coefficient.

5. The intelligent semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine according to claim 1, characterized in that, The step S4 involves inputting the multi-granular features of drug efficacy and multi-granular features of drug effect into the cross-attention layer and dynamically allocating matching weights between drug efficacy and drug effect, including: Obtain the query vector of multi-granular features of drug efficacy and the key-value vector of multi-granular features of drug efficacy, perform similarity calculation, and obtain the weights; The weights are normalized using the Softmax function; The normalized weights and their corresponding key-value vectors are weighted and summed to obtain the matching weights between drug efficacy and therapeutic effect.

6. The intelligent semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine according to claim 1, characterized in that, The calculation process of the cross-attention layer is shown in the following equation (2): (2) In the formula, This represents the attentional interaction results between pharmacodynamic features and efficacy features. Indicates the characteristics of drug efficacy. , Indicates efficacy characteristics, The scaling factor representing the feature dimension. express The transpose of .

7. A smart semantic alignment and reasoning device for the efficacy-effect of traditional Chinese medicine, wherein the smart semantic alignment and reasoning device for the efficacy-effect of traditional Chinese medicine is used to implement the smart semantic alignment and reasoning method for the efficacy-effect of traditional Chinese medicine as described in any one of claims 1-6, characterized in that, The device includes: The data acquisition module is used to acquire texts on the efficacy of Chinese herbal medicines and their corresponding effects to construct a sample dataset. The word vector construction module is used to segment the text on the efficacy of Chinese herbal medicines and the text on the effects of Chinese herbal medicines using a word segmenter to obtain efficacy sub-word units and effects sub-word units. The efficacy sub-word units and effects sub-word units are then input into the fine-tuned BERT encoding representation model based on bidirectional transformers. Through the word embedding layer, sentence embedding layer and position embedding layer of the fine-tuned BERT model, the word vectors of each efficacy sub-word unit and each effects sub-word unit are obtained. The feature construction module is used to input the word vectors of the pharmacodynamic sub-word units and the word vectors of the efficacy sub-word units into a two-layer bidirectional long short-term memory network to obtain pharmacodynamic multi-granular features and efficacy multi-granular features. The efficacy prediction module is used to input the multi-granular features of drug efficacy and multi-granular features of efficacy into the cross-attention layer, dynamically allocate the matching weights between drug efficacy and efficacy, and classify them through the Softmax function to obtain the predicted efficacy text of Chinese herbal medicine. The training module is used to train the fusion model based on the BERT model, the two-layer bidirectional long short-term memory network and the cross attention layer according to the predicted efficacy text of Chinese herbal medicine and the efficacy text of Chinese herbal medicine in the sample dataset, so as to obtain the trained fusion model. The output module is used to input the text of the efficacy of Chinese herbal medicines to be inferred into the trained fusion model to obtain the inference result of the text of efficacy of Chinese herbal medicines.

8. An intelligent semantic alignment and reasoning device, characterized in that, The intelligent semantic alignment and reasoning device includes: processor; A memory storing computer-readable instructions that, when executed by the processor, implement the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains program code that can be invoked by a processor to execute the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Text pair semantic matching method oriented to bank consultation service and based on multi-granularity alignment

    CN113065358A

  • Chinese keyword extraction method and device with multi-granularity semantic enhancement representation

    CN118395990A