A traditional Chinese medicine textbook question generation method and device based on a generative model
Patent Information
- Application Number
- CN202311447327.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2043-11-02
AI Technical Summary
然而现有的习题生成方法大多数是应用于英文数据集,应用于中医学领域生成的习题在专业性和准确性上都有所欠缺
[0039] (1) A method for calculating the information richness of paragraph texts applicable to professional fields is proposed, which helps to select high-quality paragraphs and thus improve the quality of generated exercises.
Smart Images

Figure CN117453881B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of language models, answer extraction, and question generation in natural language processing, specifically to a method and apparatus for generating questions and answers in traditional Chinese medicine textbooks based on generative models. Background Technology
[0002] Traditional Chinese medicine (TCM) has a history of thousands of years. It is a valuable summary of the Chinese nation's experience in understanding life, maintaining health, and overcoming diseases through long-term production and life practices. It is the crystallization of traditional Chinese culture. TCM has accumulated rich experience in disease prevention and treatment through long-term medical practice, and on this basis, it has formed a unique theoretical system. For beginners, it is quite difficult to grasp the key knowledge in the vast theoretical system of TCM and master it proficiently. Learning through exercises is an effective method. However, relying solely on manually designing exercises is a time-consuming and laborious process.
[0003] Exercise generation is the process of automatically generating exercises from given text using natural language processing (NLP) techniques. Exercise generation can be divided into two main directions: First, template- or rule-based methods. These methods use lexical and syntactic analysis, employing manually designed rules and templates to convert declarative sentences into interrogative sentences. This approach requires significant human effort to design rules and relies on deep grammatical knowledge, resulting in poor generalization and scalability. Second, neural network-based methods. Neural networks use an encoder-decoder framework. The encoder transforms the input raw text into a fixed-length vector representation, and the decoder processes this vector representation and outputs the generated exercises, thus realizing the process of generating exercises from raw text.
[0004] Neural network-based problem generation methods have become mainstream, especially with the rise of generative pre-trained models in recent years, which have greatly improved the performance of problem generation tasks. Applying generative pre-trained models to problem generation tasks in the field of Traditional Chinese Medicine (TCM) can help TCM scholars and enthusiasts conduct systematic learning more efficiently and conveniently. However, most existing problem generation methods are applied to English datasets, and the problems generated for the TCM field lack professionalism and accuracy. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and apparatus for generating questions and answers in traditional Chinese medicine textbooks based on generative models.
[0006] The objective of this invention is achieved through the following technical solution: Firstly, this invention provides a method for generating questions and answers in traditional Chinese medicine textbooks based on a generative model, the method comprising the following steps:
[0007] (1) Construction of textbook exercise dataset: OCR processing is performed on the paper textbook exercise set in the field of traditional Chinese medicine to obtain the source data of the exercise set. Data classification, data cleaning and structuring processing are performed on the source data of the exercise set to obtain the metadata of each question, including the question stem, question answer and question analysis. The question metadata is converted into fixed format text using the template method to construct the exercise dataset.
[0008] (2) Acquisition of the thesaurus of Traditional Chinese Medicine: Acquire the thesaurus of Traditional Chinese Medicine and perform OCR processing to obtain the source data of the thesaurus. Perform structured processing on the source data of the thesaurus to obtain detailed information of each word.
[0009] (3) Model training: The model is trained using the prompt learning method. The TCM thesaurus obtained in step (2) is used to supplement the information of the question answers obtained in step (1). The supplemented information is filled into the prompt template. Then the prompt template is combined with the question analysis and answers obtained in step (2) to obtain a complete input sample. The corresponding exercise data obtained in step (1) is used as the output sample to obtain the model training sample. The model training sample is input into the t5-pegasus model for training to obtain the TCM question and answer textbook exercise generation model.
[0010] (4) Original text construction: OCR processing is performed on textbooks in the field of traditional Chinese medicine to obtain the source data of the textbooks. The source data is then processed in a structured manner to obtain the title content and text content of the three levels of "article-chapter-section" as the original text;
[0011] (5) Paragraph selection: Input the original text, chapter number, section number and subsection number of the TCM subject textbook for which exercises need to be generated, calculate the TCM text richness of each paragraph in the selected section, and select paragraphs with a text information richness threshold as the paragraph source for generating TCM Q&A textbook exercises;
[0012] (6) Answer extraction: The selected paragraphs in step (5) are segmented into words, and stop words are filtered out. Then, words related to traditional Chinese medicine are selected, the keyness of the words is calculated, and words with higher keyness are selected as the answer text.
[0013] (7) Exercise generation: The paragraphs selected in step (5) and the answer text extracted in step (6) are constructed as model inputs according to the input sample construction method in step (3), and transmitted to the TCM Q&A textbook exercise generation model trained in (3) to obtain the output as generated questions, which together with the answer text extracted in step (6) form TCM Q&A textbook exercises.
[0014] Furthermore, the dataset construction method used in step (1) designs suitable templates for different question types to construct the dataset; the question types include single-choice questions, multiple-choice questions, and open-ended questions, and the template includes the question stem, the answer, and the explanation.
[0015] Furthermore, in step (3), the prompt-learning method is used to embed the result of supplementing the answer with information into the prompt template, and then the prompt template is concatenated with the original input to obtain the complete input sample.
[0016] Furthermore, step (5) of calculating the information richness of paragraph text is as follows:
[0017] Step 5-1: The chapters for which questions need to be generated are denoted as S = {p1, p2, ..., p...} n}, p i Let n represent the total number of paragraphs in chapter S, and let n represent the number of paragraphs in chapter S. Using the medical domain word segmentation model provided by the pkusg toolkit, S is segmented. After filtering out stop words, the TCM thesaurus obtained in step (2) is used for further filtering. The total number of TCM-related words in S is tcm_word_count, and the TCM-related thesaurus W in chapter S is... tcm :
[0018]
[0019] in For the i-th word The frequency of occurrence, where m is the number of words related to traditional Chinese medicine;
[0020] Step 5-2: For paragraph p in S i The medical domain word segmentation model provided by the pkusg toolkit was used to segment S, and p was calculated after filtering out stop words. i The number of words in the dictionary is denoted as word_count. i p was obtained by filtering according to the thesaurus of traditional Chinese medicine. i Glossary of Traditional Chinese Medicine
[0021]
[0022] in For the j-th word In paragraph p i The number of times it appears in paragraph p, k is the number of times paragraph p appears in paragraph p. i The number of words related to traditional Chinese medicine in Chinese.
[0023] Step 5-3: Calculate paragraph p i The formula for text richness is:
[0024]
[0025] Furthermore, the steps for extracting keywords in step (6) are as follows:
[0026] Step 6-1: Denote the paragraph from which the answer needs to be extracted as P. Perform word segmentation on P, filter out stop words, and obtain the word sequence of P as Seq(P) = [v1, v2, ..., v n ], v i Let be the i-th word in paragraph P, and n be the total number of words in P;
[0027] Step 6-2: Based on the TCM thesaurus obtained in step (2), filter the words in Seq(P) to obtain the TCM-related thesaurus of P, and after deduplication, denote it as W={w1,w2,……,w m}, w i Let m be the i-th TCM-related word after filtering Seq(P), and m be the number of duplicate TCM-related words in P.
[0028] Step 6-3: Record w i The nearest neighbor list is Close(w i ):
[0029] Close(w i )={w j |w i =v l And w j =v k And |lk|≤window_size}
[0030] v l ,v k ∈Seq(P)
[0031] l is a word v l In paragraph P, k represents the word v. k In paragraph P, the word `window_size` sets the window size to 8. `Close(w`... i ) indicates the relationship with w i The set of words in P whose distance does not exceed window_size;
[0032] Step 6-4: Memorize the word "w" i The keyness is I(w) i ), I(w i The initial value is set to 1, for I(w) i Perform iterative calculations:
[0033]
[0034] Where d is the damping coefficient set to 0.85, TF-IDF(w) j ) is the word w j Relative to the term frequency-inverse document frequency of the current paragraph, through multiple rounds of iteration I(w i The computation gradually converges until all I(w) are calculated. i If the difference between the result of the previous iteration and the result of the previous iteration is less than a set threshold or the set maximum number of iterations is reached, then w is finally obtained. i Importance I (w i );
[0035] Step 6-5: Select Importance I (w) i The highest-ranking word is used as the answer to the question that needs to be generated.
[0036] Secondly, the present invention also provides a question-and-answer generation device for traditional Chinese medicine textbooks based on a generative model, including a memory and one or more processors. The memory stores executable code, and when the processor executes the executable code, it implements the aforementioned question-and-answer generation method for traditional Chinese medicine textbooks based on a generative model.
[0037] Thirdly, the present invention also provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the aforementioned method for generating questions and answers in traditional Chinese medicine textbooks based on a generative model.
[0038] The advantages of this invention compared to the prior art are as follows:
[0039] (1) A method for calculating the information richness of paragraph texts applicable to professional fields is proposed, which helps to select high-quality paragraphs and thus improve the quality of generated exercises.
[0040] (2) An improved TextRank-based keyword selection method is proposed, which integrates word importance with word context relevance to improve the quality of answer text.
[0041] (3) A prompt-based problem generation method is proposed, which applies the prompt learning method to model training to enhance the accuracy of generated problems and answers.
[0042] (4) The method described in this invention is general and can be used to generate exercises in different professional knowledge fields. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the 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.
[0044] Figure 1 This is a flowchart of a method for generating questions and answers in traditional Chinese medicine textbooks based on a generative model.
[0045] Figure 2 This invention provides a structural diagram of a question-and-answer generation device for traditional Chinese medicine textbooks based on a generative model. Detailed Implementation
[0046] The present invention will be further described in detail below with reference to specific examples and accompanying drawings.
[0047] This invention provides a method for generating questions and answers in traditional Chinese medicine textbooks based on generative models. The method includes the following steps:
[0048] Step 1) Construction of the textbook exercise dataset. The 14 printed exercise sets included in the "13th Five-Year Plan" textbooks for higher education in traditional Chinese medicine nationwide, including *Traditional Chinese Medicine Basic Learning Guide and Exercise Set*, *Traditional Chinese Medicine Preparation Exercise Set*, *Traditional Chinese Medicine Basic Theory Exercise Set*, *Traditional Chinese Medicine Diagnosis Exercise Set*, *Medicinal Plants Exercise Set*, *Acupuncture Exercise Set*, *Selected Readings from the Inner Canon of Medicine Exercise Set*, *Traditional Chinese Medicine Pediatrics Exercise Set*, *Traditional Chinese Medicine Pharmacology Exercise Set*, *Traditional Chinese Medicine Surgery Exercise Set*, *Meridian and Acupoint Exercise Set*, *Classical Medical Texts Exercise Set*, *Essential Prescriptions of the Golden Chamber Exercise Set*, and *Warm Diseases Exercise Set*, were processed using OCR to obtain the source data for these exercise sets. The source data was then classified, cleaned, and structured to obtain the metadata for each question, including the question stem, answer, and explanation. A template method was used to convert the question metadata into a fixed-format text to construct the exercise dataset. Here, single-choice, multiple-answer, and open-ended questions were selected as the source questions for dataset construction.
[0049] The original format of the multiple-choice questions is as follows:
[0050] Original question stem: Option 1, Option 2, Option 3, ..., Option n Answer: Options k Analysis;
[0051] The data construction template is as follows:
[0052] [Question]: "Original question stem" + "What is it?"; [Answer] The answer to this question is "Options" k "; [Analysis]: "Analysis"
[0053] The original question format for multiple-choice questions is as follows:
[0054] Original question stem:
[0055] The data construction template is as follows:
[0056]
topic
[0057]
[0058] The original format of the question-and-answer exercises is as follows:
[0059] Original question; Answer; Explanation;
[0060] The data construction template is as follows:
[0061] [Question]: "Original Question Stem"; [Answer]: The answer to this question is "Answer"; [Analysis]: "Answer";
[0062] Step 2) Obtaining the Thesaurus of Traditional Chinese Medicine. The source data of the Thesaurus of Traditional Chinese Medicine is obtained by OCR processing, and the source data is then structured to obtain detailed information for each term.
[0063] Step 3) Model Training. Using the prompt-learning method, the TCM thesaurus obtained in Step 2) is used to supplement the information in the answers to the questions obtained in Step 1). The supplemented information is then filled into the prompt template, which is constructed as follows:
[0064] [Hint]: "e1" is..., "e2" is..., ..., "e l "Yes..., generate questions using 'answer' as the answer."
[0065] Where e i The i-th term related to traditional Chinese medicine in the answer.
[0066] Then, the prompt template is concatenated with the question analysis and answer obtained in step 2) to obtain the complete input sample. The corresponding exercise obtained in step 1) is used as the output sample to obtain the model training sample. The method for constructing the input sample is as follows:
[0067] For the transformed exercises:
[0068] [Title]: "Title"; [Answer]: "Answer"; [Analysis]: "Analysis";
[0069] Extract the entities from the answer to obtain the corresponding entity set {e1, e2, ..., e lFor each entity e i If the entity information can be found in the TCM subject thesaurus obtained in step 2), then the information is supplemented and combined with the question analysis and answer to obtain the complete input sample as follows:
[0070] [Original Text]: "parse", [Hint]: "e1" is..., "e2" is..., ..., "e l "Yes..., generate questions using 'answer' as the answer."
[0071] The constructed model training samples are input into the t5-pegasus model for training to obtain the exercise generation model. The model training parameters are set as follows:
[0072]
[0073]
[0074] Step 4) Original Text Construction. OCR processing was performed on 14 printed textbooks included in the "13th Five-Year Plan" textbooks for higher education in the national TCM industry, including *Traditional Chinese Medicine*, *Traditional Chinese Medicine Pharmaceutics*, *Basic Theory of Traditional Chinese Medicine*, *Traditional Chinese Medicine Diagnostics*, *Medicinal Botany*, *Acupuncture and Moxibustion*, *Selected Readings from the Inner Canon of Medicine*, *Traditional Chinese Medicine Pediatrics*, *Pharmacology of Traditional Chinese Medicine*, *Traditional Chinese Medicine Surgery*, *Meridian Acupoints*, *Classical Chinese Medicine*, *Synopsis of Prescriptions of the Golden Chamber*, and *Wenbing*. The source data of these textbooks was obtained, and the text was structured to obtain the title content and text content at three levels: "section-chapter-section".
[0075] Step 5) Paragraph Selection. Input the original text, chapter number, section number, and subsection number of the TCM textbook from which exercises are to be generated. Calculate the TCM text richness of each paragraph in the selected subsections, and select paragraphs with higher text information richness as the source of exercises. During the calculation of TCM text richness, the medical domain word segmentation toolkit provided by pkuseg is used for word segmentation. Here, paragraphs with a text richness of the top-50% are selected as the source of exercises.
[0076] The steps for calculating the information richness of paragraph text are as follows:
[0077] Step 5-1: The chapters for which questions need to be generated are denoted as S = {p1, p2, ..., p...} n}, p i Let n represent the total number of paragraphs in chapter S, and let n represent the number of paragraphs in chapter S. Using the medical domain word segmentation model provided by the pkusg toolkit, S is segmented. After filtering out stop words, the TCM thesaurus obtained in step (2) is used for further filtering. The total number of TCM-related words in S is tcm_word_count, and the TCM-related thesaurus W in chapter S is...tcm :
[0078]
[0079] in For the i-th word The frequency of occurrence, where m is the number of words related to traditional Chinese medicine;
[0080] Step 5-2: For paragraph p in S i The medical domain word segmentation model provided by the pkusg toolkit was used to segment S, and p was calculated after filtering out stop words. i The number of words in the dictionary is denoted as word_count. i p was obtained by filtering according to the thesaurus of traditional Chinese medicine. i Glossary of Traditional Chinese Medicine
[0081]
[0082] in For the j-th word In paragraph p i The number of times it appears in paragraph p, k is the number of times paragraph p appears in paragraph p. i The number of words related to traditional Chinese medicine in Chinese.
[0083] Step 5-3: Calculate paragraph p i The formula for text richness is:
[0084]
[0085] Step 6) Answer Extraction. Keywords are extracted from the paragraphs selected in Step 5) using an improved TextRank algorithm as the answer text. The parameters and initial values are set as follows during the calculation:
[0086] Damping coefficient d 0.85 Maximum number of iterations 100 Convergence threshold 0.001
[0087] Keyness I(w) of each word i The initial value is set to 1. Here, words with a keyness of top-k are selected as answer text based on the number of questions to be generated, k.
[0088] The steps for extracting keywords are as follows:
[0089] Step 6-1: Denote the paragraph from which the answer needs to be extracted as P. Perform word segmentation on P, filter out stop words, and obtain the word sequence of P as Seq(P) = [v1, v2, ..., v n ], v i Let be the i-th word in paragraph P, and n be the total number of words in P;
[0090] Step 6-2: Based on the TCM thesaurus obtained in step (2), filter the words in Seq(P) to obtain the TCM-related thesaurus of P, and after deduplication, denote it as W={w1,w2,……,w m}, w i Let m be the i-th TCM-related word after filtering Seq(P), and m be the number of duplicate TCM-related words in P.
[0091] Step 6-3: Record w i The nearest neighbor list is Close(w i ):
[0092] Close(w i )={w j |w i =v l And w j =v k And |lk|≤window_size}
[0093] v l ,v k ∈Seq(P)
[0094] l is a word v l In paragraph P, k represents the word v. k In paragraph P, the word `window_size` sets the window size to 8. `Close(w`... i ) indicates the relationship with w i The set of words in P whose distance does not exceed window_size;
[0095] Step 6-4: Memorize the word "w" i The keyness is I(w) i ), I(w i The initial value is set to 1, for I(w) i Perform iterative calculations:
[0096]
[0097] Where d is the damping coefficient set to 0.85, TF-IDF(w) j ) is the word w j Relative to the term frequency-inverse document frequency of the current paragraph, through multiple rounds of iteration I(w i The computation gradually converges until all I(w) are calculated. i If the difference between the result of the previous iteration and the result of the previous iteration is less than a set threshold or the set maximum number of iterations is reached, then w is finally obtained. i Importance I (w i );
[0098] Step 6-5: Select Importance I (w) i The highest-ranking word is used as the answer to the question that needs to be generated.
[0099] Step 7) Exercise generation. The paragraphs selected in Step 5) and the answers extracted in Step 6) are used as model inputs according to the input sample construction method in Step 3). The inputs are then transmitted to the TCM Q&A textbook exercise generation model trained in Step 3) to obtain the output, which is the generated questions. The questions and the answers extracted in Step 6) together form the final TCM Q&A textbook Q&A exercises.
[0100] Example
[0101] (1) Example of model training samples:
[0102] Original format of multiple-choice questions:
[0103] The person who established the theory of differentiation of syndromes in febrile diseases using the three jiaos was ( ).
[0104] A. *Jingyue Quanshu* B. *Wenre Lun* C. *Wenyi Lun*
[0105] D. *Wenbing Tiaobian* (Treatise on Warm Diseases) E. *Shire Tiaobian* (Treatise on Damp-Heat)
[0106]
Correct Answer
[0107] [Answer Analysis] The reason for the error in this question is the confusion between *Wenbing Tiaobian* and *Shire Tiaobian*. *Wenbing Tiaobian* was written by Wu Tang, who established the theory of Sanjiao differentiation; *Shire Tiaobian* was written by Xue Xue, who established the damp-heat etiology of *Wenbing*. Therefore, the correct answer is D.
[0108] The transformed question format:
[0109]
Question
Answer
Explanation
[0110] Original multiple-choice question:
[0111] 1. For patients exhibiting symptoms of coldness, the underlying pathology could be ( ).
[0112] A. Yang deficiency B. Yin deficiency C. Yang excess
[0113] D. Yin excess E. Yin and Yang deficiency
[0114]
Correct Answer
[0115] [Answer Analysis] There are two mechanisms for the development of cold: one is that yang deficiency can generate cold, which is called deficiency cold; the other is that yin excess can generate cold, which is called excess cold. It should be noted that yin deficiency produces heat symptoms, i.e., deficiency heat. Multiple selections or incorrect selections are both incorrect.
[0116] The transformed question:
[0117] [Question] In cases of Yang deficiency, Yin deficiency, Yang excess, Yin excess, and both Yin and Yang deficiency, what could be the underlying pathology of a patient presenting with cold symptoms? [Answer]
[0118] The answer to this question is Yang deficiency and Yin excess. [Analysis] There are two mechanisms that produce cold: one is Yang deficiency, which can generate cold (deficiency-cold); the other is Yin excess, which can generate cold (excess-cold). It should be noted that Yin deficiency produces heat symptoms, i.e., deficiency-heat.
[0119] Original question and answer:
[0120] 1. What are the basic contents of the Yin-Yang theory?
[0121] [Correct Answer] The basic content of Yin-Yang theory includes six aspects: ① Yin-Yang interaction; ② Yin-Yang opposition; ③ Yin-Yang interdependence; ④ Yin-Yang waxing and waning; ⑤ Yin-Yang transformation; ⑥ Yin-Yang self-harmony.
[0122] The transformed question:
[0123]
Question
Answer
[0124] ② Yin and Yang are opposites; ③ Yin and Yang are interdependent; ④ Yin and Yang wax and wane; ⑤ Yin and Yang transform; ⑥ Yin and Yang are in harmony. [Analysis] The basic content of Yin-Yang theory includes six aspects: ① Yin and Yang interact; ② Yin and Yang are opposites; ③ Yin and Yang are interdependent; ④ Yin and Yang wax and wane; ⑤ Yin and Yang transform; ⑥ Yin and Yang are in harmony.
[0125] (2) The training samples for the model built for the transformed questions are as follows:
[0126] The transformed question format:
[0127]
Question
Answer
Explanation
[0128] [Input]: [Original Text] The author of *Wenbing Tiaobian* is Wu Tang, who established the theory of differentiation of syndromes in the Sanjiao (Triple Energizer); the author of *Shire Tiaobian* is Xue Xue, who established the damp-heat etiology of febrile diseases. [Hint] *Wenbing Tiaobian* is a work on febrile diseases; it was written by Wu Tang in 1798 during the Qing Dynasty.
[0129] Published in 1812; 6 volumes, with a preface volume; the first 3 volumes discuss the methods of differentiation and treatment of various febrile diseases using the three jiaos (triple burner), while the last 3 volumes contain miscellaneous writings, rescuing from adverse reactions, resolving difficult childbirth, and resolving difficulties in infants; this book provides concise and systematic discussions on the pathogenesis, differentiation, treatment, and prescriptions of febrile diseases.
[0130] Practical and relevant, it is a renowned work on febrile diseases reflecting the highest level of understanding at the time. Questions will be generated using *Wenbing Tiaobian* as the answer.
[0131] [Output]: [Question] What established the theory of differentiation of syndromes in the three jiaos of febrile diseases?
[0132] (3) Enter the textbook text as follows:
[0133] (II) Pathogenesis of Stomach Diseases
[0134] The stomach is responsible for receiving and digesting food, and its qi flows smoothly downwards; it is known as the "sea of water and grain." The spleen and stomach are connected by a membrane, forming an internal-external relationship. The spleen is responsible for distributing the stomach's fluids, and together they complete the digestion and absorption of food and drink, as well as the distribution of its essential nutrients to generate qi and blood to nourish the whole body. Therefore, they are collectively called the "foundation of acquired constitution," and are the source of qi and blood production. Pathological changes in the stomach, being a fundamental organ, manifest as deficiency in stomach qi, stomach yang, and stomach yin; while excess often manifests as stomach heat, food stagnation, and blood stasis. When the stomach is diseased in conjunction with other organs, the pathological connections between the stomach and spleen, stomach and intestines, and stomach and liver are often observed.
[0135] 1. Pathogenesis of the Stomach as a Functional Organ: Stomach Qi Deficiency: Stomach Qi deficiency refers to the decline in the stomach's function of receiving and digesting food. Its causes are mostly due to irregular eating habits, damaging stomach Qi; or internal injury from overwork, resulting in malnutrition; or serious or prolonged illness affecting stomach Qi; or it can also be due to inherent weakness.
[0136] Stomach qi is the material basis for maintaining various physiological functions of the stomach. When stomach qi is deficient, all stomach functions may decline. For example, a decline in the function of receiving and digesting food will result in loss of appetite and a bland taste in the mouth; a decline in the function of digestion and absorption will result in abdominal distension after eating, and food easily stagnates; if stomach qi is deficient and unable to transform food, it will stagnate in the middle, resulting in abdominal distension and discomfort in the diaphragm; if stomach qi is deficient and unable to descend, it will rise upwards, leading to belching, nausea, and vomiting. Furthermore, because food and water cannot be properly digested and transported, it will inevitably affect the spleen's function of transporting and transforming food, often resulting in loose stools, diarrhea, fatigue, pale tongue, and weak pulse.
[0137] Humans rely on food and water for sustenance, and the stomach is the source of all internal organs. When stomach qi is strong, all five internal organs benefit; when stomach qi is weak, all five internal organs suffer. Thus, the rise and fall of stomach qi is related to human life activities and even survival. Therefore, in clinical diagnosis and treatment, great importance is attached to stomach qi, and "protecting stomach qi" is often considered one of the key principles. As stated in *Jingyue Quanshu* (Complete Works of Jingyue), "For those who wish to examine a disease, they must first examine the stomach qi; for those who wish to treat a disease, they must always consider the stomach qi. If the stomach qi is undamaged, there is nothing to worry about."
[0138] Stomach Yang Deficiency: Stomach Yang deficiency is a pathogenesis characterized by weakness of stomach Yang, lack of warmth, internal accumulation of Yin and cold, and impaired digestive function. It is often caused by excessive consumption of raw and cold foods, damaging stomach Yang; or by spleen Yang deficiency, leading to visceral disease affecting the bowels; or by inherent stomach Yang deficiency, resulting in internal cold. Stomach Yang deficiency reduces the digestive function of food, often manifesting as poor appetite, reduced food intake, and indigestion; Yang deficiency also leads to aversion to cold, and the cold nature of cold causes stagnation and contraction, resulting in stagnation of stomach Qi and tightness of the stomach meridians, often manifesting as cold pain in the epigastric region, ranging from mild, dull pain to severe, sharp pain, relieved by warmth and pressure. Stomach Yang deficiency and spleen Yang deficiency can influence each other or occur simultaneously, clinically termed spleen and stomach Yang deficiency or middle Yang deficiency. The main difference between the two is that spleen Yang deficiency is more often associated with chronic diarrhea, and the symptoms of deficiency and cold, such as aversion to cold and cold limbs, are more pronounced.
[0139] Stomach Yin Deficiency: Stomach Yin deficiency refers to the pathogenesis of a severe decline in the stomach's function of receiving and digesting food due to the depletion of its Yin fluids. It often results from the later stages of febrile diseases, where lingering pathogenic heat consumes body fluids and damages stomach Yin; or from prolonged illness leading to the depletion of Yin fluids and essence throughout the body, causing stomach Yin to gradually wither. The stomach prefers moisture and dislikes dryness. When stomach Yin is depleted, its function of receiving and digesting food declines drastically, manifesting as loss of appetite, even an inability to consume food or water, or hunger without desire to eat, frequent heartburn, a bright red tongue without coating, or even a tongue as smooth as a mirror. Stomach Yin deficiency disrupts the stomach's descending function, causing stomach Qi to rise, resulting in symptoms such as abdominal distension and frequent dry retching. If stomach Yin deficiency persists, stomach Qi may also decline, leading to a dual deficiency of both stomach Qi and Yin, potentially resulting in critical conditions such as oral ulcers and a white, moldy tongue coating.
[0140] Excessive Stomach Heat: Heat and fire are of the same kind. Excessive stomach heat, when stagnant, transforms into fire, which is stomach fire. Stomach heat and stomach fire are mostly caused by the invasion of pathogenic heat affecting the stomach; or by excessive consumption of spicy and rich foods, or excessive alcohol consumption, which fuels the fire and generates heat; or by qi stagnation, blood stasis, phlegm dampness, or food accumulation, which stagnate and transform into fire and generate heat. Other factors, such as liver and gallbladder fire, which invade the stomach, can also lead to stomach heat. The pathological changes caused by excessive stomach heat are multifaceted. For example, stomach heat can cause hyperactivity of the stomach's function of receiving and digesting food, resulting in symptoms such as stomach discomfort and excessive hunger; excessive heat and fire deplete the fluids in the stomach, resulting in symptoms such as thirst and excessive drinking. Stomach heat generates dryness, and this dryness and heat accumulate internally in the Yangming meridian, which can lead to constipation. The upward-flaring nature of fire can cause the stomach to lose its descending function, leading to bile leakage and bile rising upwards, resulting in symptoms such as bitter taste in the mouth, nausea, and vomiting of sour, bitter, yellow fluid. If stomach fire rises along the meridians, it can cause toothache and swollen gums, bleeding gums or tongue bleeding, or hot, foul breath. The heat can also scorch the stomach's meridians, causing blood to overflow and manifest as vomiting blood. Prolonged excessive stomach heat will inevitably damage the stomach's Yin fluids, leading to gastric fluid deficiency.
[0141] Stomach stagnation: Stomach stagnation refers to the pathogenesis of food and drink stagnating in the stomach, hindering its digestive function. The causes are often due to irregular eating habits, overeating, leading to indigestion; or a weak spleen and stomach, resulting in impaired digestion and absorption, causing food stagnation even without overeating. It can also be caused by a weakened stomach after illness leading to forced eating. Stomach qi is harmonious when it flows freely and descends smoothly. When food stagnates in the stomach, stomach qi becomes obstructed, inevitably leading to abdominal distension and even stomach pain. Undigested food disrupts the descending function and rises upwards, causing putrid grains and foul-smelling gas to rise, resulting in belching, acid reflux, or vomiting of putrid food. After vomiting, the stagnant food is eliminated, stomach qi flows smoothly again, and stomach pain is reduced. If food stagnation leads to qi stagnation and internal dampness, damp food descends, obstructing the intestines and causing frequent, foul-smelling flatulence, or loose stools with a sour and foul odor. When food stagnates internally, the turbid qi in the stomach rises upwards, resulting in a thick, greasy, and foul-smelling tongue coating. If a person with a strong constitution overeats and causes stagnation in the stomach, their pulse will be smooth and forceful because their vital energy is resisting the pathogenic factors and their qi and blood are abundant.
[0142] Stomach meridian obstruction: Stomach meridian obstruction refers to the pathogenesis of pain or bleeding caused by stagnation of blood in the stomach's meridians. It often develops from stagnation of liver and stomach qi, or from prolonged deficiency of spleen yang, which fails to warm and circulate the stomach's meridians, leading to cold stagnation and obstruction. Stomach meridian obstruction hinders blood flow, causing pain, primarily manifested as epigastric pain, characterized by stabbing pain, tenderness upon pressure, fixed location, and exacerbation after eating. This differs from epigastric distending pain, dull pain, throbbing pain, aching pain, pain relieved by pressure and food intake, which are caused by spleen and stomach qi stagnation and spleen and stomach yang deficiency. If the stagnation persists, the meridians are damaged, and blood cannot circulate properly, resulting in symptoms such as vomiting dark purple blood or passing black stools. Due to internal blood stasis, the tongue is often dark purple, and the pulse is often thin and hesitant. Literature indicates that stomach meridian obstruction, with prolonged blood loss, can lead to two possible outcomes: vomiting blood and passing black stools. One type is blood deficiency leading to qi weakness, characterized by a yellow face, white lips, pale tongue, fatigue, shortness of breath, and a weak, thready pulse; the other type is blood deficiency with signs of heat, characterized by a bright red tongue and a thready, rapid pulse.
[0143] 2. Pathogenesis of simultaneous diseases of the stomach and other internal organs
[0144] Spleen and Stomach Weakness: The stomach and spleen are connected by a membrane and reside in the middle jiao (middle burner). The stomach is responsible for receiving food, while the spleen is responsible for transporting and transforming it; the stomach is responsible for descending turbid substances, while the spleen is responsible for ascending clear substances. Without the coordinated function of the spleen and stomach in receiving and transporting food, and without the coordination of ascending and descending movements, food and water cannot be ingested, clear yang qi cannot be distributed, waste and turbid substances cannot be excreted, and acquired essence cannot be stored. Once the spleen and stomach are both diseased, it not only directly hinders the digestion and absorption of food and drink, but also affects the physiological functions of the whole body. If the spleen is weak, clear yang cannot ascend, and the essence of food flows downward, resulting in loose stools and undigested food; if the stomach is weak, turbid yin cannot descend, and stomach qi rises in reverse, resulting in nausea, belching, abdominal distension, and poor appetite. Long-term spleen and stomach weakness leads to insufficient production of qi and blood, and inadequate acquired constitution, resulting in deficiency of both qi and blood and overall weakness.
[0145] Gastrointestinal heat accumulation: The Foot Yangming Meridian belongs to the Stomach, and the Hand Yangming Meridian belongs to the Large Intestine. The pathogenesis of the so-called Yangming heat accumulation and Yangming bowel obstruction refers to the mutual binding of pathogenic heat and dry stool in the stomach and intestines, which is more common during the peak of exogenous febrile diseases. Clinically, it is often seen as high fever or tidal fever, constipation, abdominal distension and hardness, dry tongue coating, and deep and forceful pulse. The pathogenesis of gastrointestinal heat accumulation can often lead to sudden damage to Yin fluids. The emphasis in the treatment of febrile diseases on "preserving a part of body fluids is to preserve a part of life" and the "urgent purgation to preserve Yin" method in Zhang Zhongjing's "Treatise on Cold Damage" are precisely designed to address this pathogenesis.
[0146] Liver-Stomach Disharmony: This refers to the pathogenesis caused by the liver's failure to regulate the flow of Qi, leading to the stomach's inability to descend and harmonize. The pathogenesis of liver-stomach disharmony can be divided into two pathways. One is emotional distress, leading to liver stagnation and the transformation of liver fire, which then attacks the stomach. Stagnation of liver and stomach Qi manifests as epigastric distension and pain radiating to the hypochondria, fluctuating with emotional changes. The stomach's inability to descend and harmonize causes Qi to flow upwards, resulting in belching and hiccups; internal stagnation of liver and stomach Qi and fire manifests as acid reflux, irritability, and a red tongue with a yellow coating. The other pathway is the invasion of cold pathogens into the liver and stomach. The liver meridian reaches the vertex; cold Qi ascends along this meridian, obstructing the flow of Qi, hence the headache is more severe at the vertex. Coldness is stagnant and requires Yang to function; it congeals when exposed to cold, thus headaches worsen with cold and are relieved by warmth. When the stomach and intestines are diseased, the middle yang is injured, the body fluids cannot be transformed, and the qi flows upward in reverse, resulting in vomiting of clear and thin saliva; when the yang qi is damaged, it cannot warm the skin externally, resulting in cold limbs; when there is yang deficiency and yin coldness inside, the tongue is often pale with a white and slippery coating, and the pulse is deep, wiry, and tight.
[0147] (4) After calculating the text richness of each paragraph, the following paragraphs were selected:
[0148] Excessive Stomach Heat: Heat and fire are of the same kind. Excessive stomach heat, when stagnant, transforms into fire, which is stomach fire. Stomach heat and stomach fire are mostly caused by the invasion of pathogenic heat affecting the stomach; or by excessive consumption of spicy and rich foods, or excessive alcohol consumption, which fuels the fire and generates heat; or by qi stagnation, blood stasis, phlegm dampness, or food accumulation, which stagnate and transform into fire and generate heat. Other factors, such as liver and gallbladder fire, which invade the stomach, can also lead to stomach heat. The pathological changes caused by excessive stomach heat are multifaceted. For example, stomach heat can cause hyperactivity of the stomach's function of receiving and digesting food, resulting in symptoms such as stomach discomfort and excessive hunger; excessive heat and fire deplete the fluids in the stomach, resulting in symptoms such as thirst and excessive drinking. Stomach heat generates dryness, and this dryness and heat accumulate internally in the Yangming meridian, which can lead to constipation. The upward-flaring nature of fire can cause the stomach to lose its descending function, leading to bile leakage and bile rising upwards, resulting in symptoms such as bitter taste in the mouth, nausea, and vomiting of sour, bitter, yellow fluid. If stomach fire rises along the meridians, it can cause toothache and swollen gums, bleeding gums or tongue bleeding, or hot, foul breath. The heat can also scorch the stomach's meridians, causing blood to overflow and manifest as vomiting blood. Prolonged excessive stomach heat will inevitably damage the stomach's Yin fluids, leading to gastric fluid deficiency.
[0149] (5) The results of word segmentation and filtering of TCM-related terms are as follows:
[0150] Excessive stomach heat, stagnation of stomach heat transforming into fire, stomach fire, stomach heat, pathogenic heat invading the stomach, excessive consumption of spicy and rich foods, excessive alcohol consumption generating heat, qi stagnation and blood stasis, phlegm and dampness, food accumulation transforming into fire and generating heat, liver and gallbladder rebellion attacking the stomach, pathogenesis of excessive stomach heat, hyperactive digestive function of stomach, excessive hunger, excessive heat and fire scorching stomach fluids, thirst and excessive drinking, dryness of stomach, constipation due to heat in the Yangming meridian, disharmony of the stomach, gallbladder heat causing bile leakage, bile rising upwards, bitter taste in the mouth, nausea, vomiting, sour and bitter yellow fluid, upward flaring of stomach fire, toothache, swollen gums, bleeding gums, tongue bleeding, hot and foul breath, burning of stomach and viscera, blood overflowing upwards, hematemesis, excessive stomach heat, deficiency of yin fluids in the stomach.
[0151] (6) After calculating the keyword importance, select the answer text "stomach heat".
[0152] (7) Construct the input text as follows:
[0153] [Original Text] Stomach Heat Excess: Heat and fire are of the same kind. Excessive stomach heat, when stagnant, transforms into fire, which is stomach fire. Stomach heat and stomach fire are mostly caused by the invasion of pathogenic heat affecting the stomach; or by excessive consumption of spicy foods, rich foods, or alcohol, which fuel the fire and generate heat; or by qi stagnation, blood stasis, phlegm dampness, or food accumulation, which stagnate and transform into fire and generate heat. Other factors, such as liver and gallbladder fire, which invade the stomach, can also lead to stomach heat. The pathological changes caused by excessive stomach heat are multifaceted. For example, stomach heat can cause hyperactivity of the stomach's function of receiving and digesting food, resulting in symptoms such as stomach discomfort and excessive hunger; excessive heat and fire deplete the fluids in the stomach, resulting in symptoms such as thirst and excessive drinking. Stomach heat generates dryness, and this dryness and heat accumulate internally in the Yangming meridian, which can lead to constipation. The upward-flaring nature of fire and heat can cause the stomach to lose its descending function, leading to bile leakage and upward flow of bile, resulting in symptoms such as bitter taste in the mouth, nausea, and vomiting of sour, bitter, yellow fluid. If stomach fire rises along the meridians, it can cause toothache and swollen gums, bleeding gums or tongue bleeding, or hot, foul breath. The fire and heat can also damage the stomach's meridians, causing hematemesis (vomiting blood). Prolonged, intense stomach heat will inevitably damage the stomach's Yin fluids, leading to gastric fluid deficiency. [Note:] Stomach heat is a syndrome characterized by intense, stagnant fire and heat in the stomach, with common symptoms including burning pain in the stomach, preference for cold, fever, thirst, bad breath, swollen and painful gums, bleeding gums, constipation, dark yellow urine, red tongue with yellow coating, and rapid pulse. (The question is generated using "stomach heat" as the answer.)
[0154] (8) Finally, question-and-answer pairs are generated:
[0155] What symptoms result from a long-term diet high in spicy and rich foods, or excessive alcohol consumption? Answer: Stomach heat.
[0156] Corresponding to the aforementioned embodiment of a method for generating questions and answers in traditional Chinese medicine textbooks based on generative models, the present invention also provides an embodiment of a device for generating questions and answers in traditional Chinese medicine textbooks based on generative models.
[0157] See Figure 2This invention provides a generative model-based question-and-answer generation device for traditional Chinese medicine textbooks, comprising a memory and one or more processors. The memory stores executable code, and when the processor executes the executable code, it is used to implement a generative model-based question-and-answer generation method for traditional Chinese medicine textbooks as described in the above embodiments.
[0158] The present invention provides an embodiment of a generative model-based question-and-answer generation device for traditional Chinese medicine textbooks. This device can be applied to any device with data processing capabilities, such as a computer. The device embodiment can be implemented in software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of any data processing device loading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 2 The diagram shown is a hardware structure diagram of any device with data processing capabilities, which is the question-and-answer generation device for traditional Chinese medicine textbooks based on a generative model provided by the present invention. (Except for...) Figure 2 In addition to the processor, memory, network interface, and non-volatile memory shown, any data processing device in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.
[0159] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0160] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and 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 modules can be selected to achieve the purpose of the present invention according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0161] This invention also provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements a method for generating questions and answers in traditional Chinese medicine textbooks based on a generative model, as described in the above embodiments.
[0162] The computer-readable storage medium can be an internal storage unit of any data processing device as described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device of any data processing device, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., equipped on the device. Furthermore, the computer-readable storage medium can include both internal storage units and external storage devices of any data processing device. The computer-readable storage medium is used to store the computer program and other programs and data required by the data processing device, and can also be used to temporarily store data that has been output or will be output.
[0163] The above embodiments are used to explain and illustrate the present invention, but not to limit the present invention. Any modifications and changes made to the present invention within the spirit and scope of the claims shall fall within the protection scope of the present invention.
Claims
1. A method for generating questions and answers in traditional Chinese medicine textbooks based on generative models, characterized in that, The method includes the following steps: (1) Construction of textbook exercise dataset: OCR processing is performed on the paper textbook exercise set in the field of traditional Chinese medicine to obtain the source data of the exercise set. Data classification, data cleaning and structuring processing are performed on the source data of the exercise set to obtain the metadata of each question, including the question stem, question answer and question analysis. The question metadata is converted into fixed format text using the template method to construct the exercise dataset. (2) Acquisition of TCM subject thesaurus: Acquire the subject thesaurus in the field of TCM and perform OCR processing to obtain the source data of the thesaurus. Perform structured processing on the source data of the thesaurus to obtain detailed information of each word; (3) Model training: The model is trained using the prompt learning method. The TCM subject thesaurus obtained in step (2) is used to supplement the information of the question answers obtained in step (1). The supplemented information is filled into the prompt template. Then the prompt template is combined with the question analysis and answers obtained in step (2) to obtain a complete input sample. The corresponding exercise data obtained in step (1) is used as the output sample to obtain the model training sample. The model training sample is input into the t5-pegasus model for training to obtain the TCM question and answer textbook exercise generation model. (4) Original text construction: OCR processing is performed on textbooks in the field of traditional Chinese medicine to obtain the source data of the textbooks. The source data is then processed in a structured manner to obtain the title content and text content of the three levels of "article-chapter-section" as the original text; (5) Paragraph selection: Input the original text, chapter number, section number and subsection number of the TCM subject textbook for which exercises need to be generated, calculate the TCM text richness of each paragraph in the selected section, and select paragraphs with a text information richness threshold as the paragraph source for generating TCM Q&A textbook exercises; (6) Answer extraction: The paragraphs selected in step (5) are segmented into words, and stop words are filtered out. Then, words related to traditional Chinese medicine are selected, the keyness of the words is calculated, and words with higher keyness are selected as the answer text. (7) Exercise generation: The paragraphs selected in step (5) and the answer texts extracted in step (6) are constructed as model inputs according to the input sample construction method in step (3), and transmitted to the TCM Q&A textbook exercise generation model trained in (3) to obtain the output as generated questions, which together with the answer texts extracted in step (6) form TCM Q&A textbook exercises.
2. The method for generating questions and answers in traditional Chinese medicine textbooks based on generative models according to claim 1, characterized in that, The dataset construction method used in step (1) involves designing appropriate templates for different question types to construct the dataset; the question types include single-choice questions, multiple-choice questions, and open-ended questions, and the template includes the question stem, the answer, and the explanation.
3. The method for generating questions and answers in traditional Chinese medicine textbooks based on generative models according to claim 1, characterized in that, In step (3), the prompt-learning method is used to embed the result of supplementing the answer with information into the prompt template, and then the prompt template is concatenated with the original input to obtain the complete input sample.
4. The method for generating questions and answers in traditional Chinese medicine textbooks based on generative models according to claim 1, characterized in that, Step (5) to calculate the information richness of paragraph text is as follows: Step 5-1: The chapter from which questions need to be generated is denoted as... , For the first There are 10 paragraphs, where n represents the total number of paragraphs in chapter S. Using the medical domain word segmentation model provided by the pkusg toolkit, S is segmented. After filtering out stop words, the TCM thesaurus obtained in step (2) is used for further filtering to obtain the total number of TCM-related words in S. The glossary of traditional Chinese medicine terms in Chapter S : in For the i-th word The frequency of occurrence, where m is the number of words related to traditional Chinese medicine; Step 5-2: Targeting paragraphs in S The medical domain word segmentation model provided by the pkusg toolkit was used to segment S, and stop words were filtered out before calculation. The number of words in the text is denoted as The data was obtained by filtering based on the thesaurus of Traditional Chinese Medicine. Glossary of Traditional Chinese Medicine : in For the j-th word In paragraph The number of times it appears in the paragraph, k is the number of paragraphs. The number of words related to traditional Chinese medicine in the text; Step 5-3: Calculate paragraphs The formula for text richness is: 。 5. The method for generating questions and answers in traditional Chinese medicine textbooks based on generative models according to claim 1, characterized in that, Step (6) for extracting keywords is as follows: Step 6-1: The paragraph from which the answer needs to be extracted is denoted as... ,right After performing word segmentation and filtering out stop words, the result is obtained. The word sequence is denoted as , For paragraph The i-th word in the text, where n is The total number of words in the text; Step 6-2: Based on the TCM thesaurus obtained in step (2), Filter and obtain words from A list of TCM-related terms was compiled and deduplicated. , To The i-th TCM-related term after filtering, m is The number of duplicate terms related to traditional Chinese medicine in the text; Step 6-3: Record The neighbor word list is : For vocabulary In paragraph The position in the middle, For vocabulary In paragraph Position of the word To set the window size, we set it to 8 here. Indicates and exist Medium distance not exceeding A collection of words; Step 6-4: Memorize words The keyness is , The initial value is set to 1. Perform iterative calculations: in The damping coefficient is set to 0.
85. For words Relative to the term frequency - inverse document frequency of the current paragraph, through multiple rounds of iteration Gradually converges, calculated until all If the difference between the result of the previous iteration and the result of the previous iteration is less than a set threshold or the set maximum number of iterations is reached, then the final result is obtained. importance ; Step 6-5: Select Importance The highest-ranking word is used to generate the answer to the question.
6. A question-and-answer generation device for traditional Chinese medicine textbooks based on a generative model, comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that, When the processor executes the executable code, it implements a method for generating questions and answers in traditional Chinese medicine textbooks based on a generative model, as described in any one of claims 1-5.
7. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements a method for generating questions and answers in traditional Chinese medicine textbooks based on a generative model, as described in any one of claims 1-5.
Citation Information
Patent Citations
Research report question and answer generation method and system and computer readable storage medium
CN114492362A
Machine question answering method, device and equipment based on semantic prompt and storage medium
CN115599901A