Named entity recognition and extraction method based on traditional Chinese medicine text
Through the method of parallel processing of dual models and mutual verification between models, multiple challenges in naming entity recognition in traditional Chinese medicine texts are solved, and higher recognition accuracy and comprehensiveness are achieved, and the robustness of the system is enhanced.
Patent Information
- Application Number
- CN202411300914.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-02-18
AI Technical Summary
The existing basic model faces difficulty in term recognition, difficulty in analyzing polysynonyms, difficulty in distinguishing synonyms and synonyms, difficulty in processing complex sentence patterns, inaccurate extraction of proper nouns, strong context dependence, sparse data and generalization of model The problem of insufficient ability.
Using the dual-model parallel processing method, the pre-trained basic language model and large language model extract the first named entity list and the second named entity list respectively, and embed them into the preset prompt word template, and input the general big model to extract it. The third named entity list. Through mutual verification and complementation between models, the accuracy and comprehensiveness of entity recognition are improved.
It significantly improves the accuracy and comprehensiveness of the recognition of named entities in traditional Chinese medicine texts, ensures that all key traditional Chinese medicine entities in the sentences can be accurately captured, and enhances the robustness and reliability of the system.
Smart Images

Figure CN119476284A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traditional Chinese medicine text processing, and in particular to a named entity recognition and extraction method based on traditional Chinese medicine text. Background Art
[0002] Due to the complexity and disorder of TCM terminology, existing basic models, such as pre-trained language models such as BERT, often face challenges when processing TCM texts. These models usually lack a deep understanding of specific terms and concepts in the field of TCM, resulting in problems such as misrecognition, missing key information, and difficulty in distinguishing similar or polysemous TCM terms during entity extraction. These problems not only affect the accuracy of information, but also limit the dissemination and application of TCM knowledge. Specifically, they are reflected in the following aspects: (1) Difficulty in term recognition: The field of traditional Chinese medicine has a large number of professional terms and concepts, which may be difficult for general NER models to recognize.
[0003] (2) Analysis of polysemous words: There are many polysemous words in traditional Chinese medicine terminology, and their meanings need to be accurately judged based on the context.
[0004] (3) Distinguishing between synonyms and near-synonyms: There are many synonyms or near-synonyms in traditional Chinese medicine. Correctly distinguishing these words is crucial to understanding the text.
[0005] (4) Complex sentence processing: Traditional Chinese medicine texts may contain complex sentence structures, which poses a challenge to the accurate extraction of entities.
[0006] (5) Inaccurate extraction of proper nouns: Existing basic models may not be able to accurately identify proper nouns in TCM texts, resulting in inaccurate information extraction.
[0007] (6) Strong context dependence: The understanding of TCM texts is highly dependent on context, requiring the model to be able to capture long-distance dependencies.
[0008] (7) Data sparsity problem: The labeled data in the field of traditional Chinese medicine may be relatively sparse, resulting in insufficient model training.
[0009] (8) Model generalization ability: Existing models may perform well on specific datasets, but lack the ability to generalize to new or different TCM texts. Summary of the invention
[0010] In view of this, the purpose of the present invention is to propose a named entity recognition and extraction method based on traditional Chinese medicine text, which can effectively extract entities from traditional Chinese medicine text, thereby laying a foundation for subsequent tasks.
[0011] According to one aspect of the present invention, a method for named entity recognition and extraction based on traditional Chinese medicine text is provided, the method comprising: Obtain original text data of traditional Chinese medicine and perform preprocessing; The preprocessed raw text data is input into a pre-trained basic language model and a pre-trained large language model respectively, and a first named entity list and a second named entity list corresponding to the raw text data are respectively identified and extracted; The first named entity list and the second named entity list are embedded in a preset prompt word template, and input into a pre-trained general large model to identify and extract a third named entity list corresponding to the original text data.
[0012] In the above technical solution, two complementary models are used, which work together to perform in-depth analysis and entity extraction on the same TCM-related sentence. This dual-model parallel processing method not only broadens the horizon of entity recognition, but also greatly improves the accuracy and comprehensiveness of recognition through mutual verification and complementation between models, ensuring that all key TCM entities in the sentence can be accurately captured.
[0013] In some embodiments, the preprocessed raw text data is respectively input into a pre-trained basic language model to identify and extract a first named entity list corresponding to the raw text data, specifically: The preprocessed raw text data are respectively input into a pre-trained self-feedback neural network model to extract entity feature sequences in the raw text data; Input the entity feature sequence into a fully connected layer to generate a probability distribution corresponding to the entity feature sequence; Based on the probability distribution and entity feature sequence, a CRF layer is input to generate an entity label sequence; The entity tag sequence is used as the first named entity list.
[0014] In the above technical solution, the self-feedback neural network model has strong adaptability and robustness, and has efficient self-adjustment ability, which can well extract entity feature sequences in the original text data, providing a good guarantee for further recognition later.
[0015] In some embodiments, the preprocessed raw text data is respectively input into a pre-trained large language model to identify and extract a second named entity list corresponding to the raw text data, specifically: Collect and preprocess text data in the field of traditional Chinese medicine to generate data sets; Fine-tune the LLAMA model based on the data set to obtain a pre-trained LLAMA model; After the original text data is subjected to retrieval enhancement generation processing, it is input into the pre-trained LLAMA model to output a second named entity list.
[0016] In the above technical solution, a self-built high-quality data set is used. This data set is carefully constructed specifically for the task of extracting Chinese medicine entities. It not only covers a wide range of Chinese medicine knowledge, but also fully considers the diversity and complexity of Chinese medicine terminology. By using this high-quality data set for fine-tuning on a large model, that is, by calling LoRA fine-tuning, the core principle is to introduce small, low-rank matrices in the decisive level of the model to achieve fine-tuning of the model behavior without making major modifications to the entire model structure. The present invention can more accurately understand the language characteristics and entity composition rules in the field of Chinese medicine, thereby meeting the specific needs of Chinese medicine entity extraction tasks to the greatest extent.
[0017] In some embodiments, after the original text data is subjected to retrieval enhancement generation processing, the pre-trained LLAMA model is input to output a second named entity list, and then the following steps are further included: The second named entity list is compared and proofread.
[0018] In the above technical solution, the extracted second named entity list will be further compared and proofread with the TCM terminology document to ensure the accuracy and consistency of the extraction results. Through this step, errors caused by model misjudgment or data noise can be effectively corrected.
[0019] In some embodiments, the first named entity list and the second named entity list are embedded in a preset prompt word template, and a pre-trained general large model is input to identify and extract a third named entity list corresponding to the original text data, specifically: According to the task requirements, a prompt is set, and the names that best match the TCM entities in the first named entity list and the second named entity list are selected and embedded into the prompt respectively. The prompt and the original text of the selected TCM entities are input into a pre-trained general large model to identify and extract the third named entity list corresponding to the original text data.
[0020] In the above technical solution, according to the task requirements, a suitable prompt is set, such as: ***There are two entity lists below: the first named entity list and the second named entity list. Please extract the names that best match the TCM entities in the above two lists and return a list in json format***. The first named entity list and the second named entity list to be verified are embedded in the prompt to guide the large model to perform targeted entity recognition; the extraction process takes into account multiple dimensions such as contextual information and semantic associations. For example, the information related to the TCM text mentioned above can also be embedded in the prompt to prompt the large model to consider the text to extract the most relevant TCM entities, so as to ensure the accuracy and relevance of the extracted third named entity list. In this solution, according to the task requirements, a suitable prompt is set, and the first entity list and the second entity list to be verified are embedded in the prompt to guide the large model to perform targeted entity recognition; the extraction process takes into account multiple dimensions such as contextual information and semantic associations to ensure the accuracy and relevance of the extracted third entity list.
[0021] In some embodiments, identifying and extracting a third named entity list corresponding to the original text data further includes: The third named entity list is compared with the first named entity list and the second named entity list for similarity comparison; if the similarity is lower than a threshold, the third named entity list is manually compared and proofread to obtain a final fourth named entity list.
[0022] In the above technical solution, the entities extracted by the dual models are re-verified to eliminate possible misjudgments or omissions, thereby ensuring that the final output of TCM entity information is both comprehensive and accurate. This multiple verification mechanism greatly enhances the robustness and reliability of the system.
[0023] According to another aspect of the present invention, a named entity recognition and extraction device based on traditional Chinese medicine text is proposed, based on the above method; comprising: The acquisition module is used to obtain the original text data of traditional Chinese medicine and perform preprocessing; A first extraction module is used to input the preprocessed original text data into a pre-trained basic language model and a pre-trained large language model, respectively, to identify and extract a first named entity list and a second named entity list corresponding to the original text data; The second extraction module is used to embed the first named entity list and the second named entity list into a preset prompt word template, and input a pre-trained general large model to identify and extract a third named entity list corresponding to the original text data.
[0024] In the above technical scheme, in order to better use the above method, this application proposes a named entity recognition and extraction device based on traditional Chinese medicine text, each module corresponds to each step of the above method, and its specific principles have been described above and will not be repeated here.
[0025] According to another aspect of the present invention, a named entity recognition and extraction device based on traditional Chinese medicine text is proposed, comprising: at least one processor and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the above method.
[0026] In the above technical solution, in order to better run and process the method, the above method is stored in a memory, and the stored method is executed by a processor. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0027] According to another aspect of the present invention, a computer-readable storage medium is provided, storing a computer program, wherein the computer program implements the above method when executed by a processor.
[0028] In the above technical solution, in order to better run and use the method, the above method is stored in a computer-readable storage medium, and the above method is implemented by a processor. It should be noted that the principle and effect of each step have been described above and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0030] Figure 1 It is a flow chart of an embodiment of a method for named entity recognition and extraction based on traditional Chinese medicine texts of the present invention; Figure 2 It is a schematic diagram of the process architecture of an embodiment of a method for named entity recognition and extraction based on traditional Chinese medicine texts of the present invention; Figure 3 It is a structural schematic diagram of an embodiment of a named entity recognition and extraction device based on traditional Chinese medicine texts of the present invention. DETAILED DESCRIPTION
[0031] The present invention will be further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only used to illustrate the present invention, but are not intended to limit the scope of the present invention. Similarly, the following examples are only partial embodiments of the present invention rather than all embodiments, and all other embodiments obtained by those of ordinary skill in the art without creative work are within the scope of protection of the present invention.
[0032] The present invention provides a named entity recognition and extraction method based on traditional Chinese medicine text, which can effectively extract entities from traditional Chinese medicine text, thereby laying a foundation for subsequent tasks.
[0033] Embodiment 1 See also Figure 1 and Figure 2 , a named entity recognition and extraction method based on traditional Chinese medicine text, the method comprising: S1. Obtain the original text data of traditional Chinese medicine and perform preprocessing; In this embodiment, this step is the first layer of architecture. In the field of traditional Chinese medicine, this embodiment performs preliminary preprocessing on the collected structured and unstructured data, aiming to remove redundant information including illegal characters and invalid data, so as to ensure data quality and the effectiveness of subsequent analysis.
[0034] S2, inputting the preprocessed raw text data into a pre-trained basic language model and a pre-trained large language model, respectively, to identify and extract a first named entity list and a second named entity list corresponding to the raw text data; In this embodiment, the preprocessed original text data is respectively input into a pre-trained basic language model to identify and extract the first named entity list corresponding to the original text data, which belongs to the second layer architecture. The architecture of this layer belongs to the basic model layer block.
[0035] Specifically: S211, respectively inputting the pre-processed raw text data into a pre-trained self-feedback neural network model to extract entity feature sequences in the raw text data; in this step, a self-feedback neural network architecture that takes into account the previous and next contexts (such as ALBERT, a lightweight pre-trained language model proposed by Google) is used to extract deep features in the text; S212, the entity feature sequence is input into a fully connected layer to generate a probability distribution corresponding to the entity feature sequence; based on the probability distribution and the entity feature sequence, a CRF layer is input to generate an entity label sequence; in this step, a fully connected layer is connected after the model to convert the hidden layer state into a probability distribution of each token belonging to different entity categories; at the same time, (3) the output of the full connection is further processed using the CRF layer, taking into account the dependency between the labels to generate the final entity label sequence; S213: Use the entity tag sequence as the first named entity list.
[0036] In this embodiment, the preprocessed original text data is respectively input into a pre-trained large language model to identify and extract the second named entity list corresponding to the original text data, which belongs to the third layer architecture: the large model architecture layer.
[0037] Specifically: S221. Collect text data in the field of traditional Chinese medicine and preprocess it to generate a data set. This step involves data set construction and screening. Collect data in the field of traditional Chinese medicine through various channels (such as ancient documents, modern research results, clinical cases, etc.) to ensure the comprehensiveness, accuracy and timeliness of the data. Strictly clean the collected data to remove irrelevant information and noise, and perform professional annotation to build a high-quality data set for the field of traditional Chinese medicine.
[0038] S222, fine-tune the LLAMA model based on the data set to obtain a pre-trained LLAMA model; in this step, the LLAMA 3 70b model is selected: in view of the excellent performance of the LLAMA model in large language models, the present invention selects the LLAMA3 70b version as the basic model. The LLAMA3 70b model is fine-tuned using the high-quality traditional Chinese medicine data set constructed above, so that the model can better understand the language characteristics and knowledge background in the field of traditional Chinese medicine, thereby improving the entity recognition ability in traditional Chinese medicine texts.
[0039] S223, after the original text data is subjected to retrieval enhancement generation processing, the pre-trained LLAMA model is input to output a second named entity list. In this step, the RAG operation, i.e., retrieval enhancement generation technology, is introduced in the entity extraction process. This technology can retrieve relevant information from pre-processed TCM term documents based on the input text, and provide auxiliary support for the generation of entity names.
[0040] In this embodiment, a self-built high-quality dataset is used. This dataset is carefully constructed specifically for the task of extracting TCM entities. It not only covers a wide range of TCM knowledge, but also fully considers the diversity and complexity of TCM terminology. By fine-tuning this high-quality dataset on a large model, the present invention can more accurately understand the language characteristics and entity composition rules in the field of TCM, thereby meeting the specific needs of the task of extracting TCM entities to the greatest extent.
[0041] In this embodiment, S123, after performing retrieval enhancement generation processing on the original text data, the pre-trained LLAMA model is input to output a second named entity list, and then the following is further included: S224, compare and proofread the second named entity list. The second named entity list extracted in this step will be further compared and proofread with the TCM terminology document to ensure the accuracy and consistency of the extraction results. Through this step, errors caused by model misjudgment or data noise can be effectively corrected.
[0042] S3, embed the first named entity list and the second named entity list into a preset prompt word template, and input a pre-trained general large model to identify and extract the third named entity list corresponding to the original text data. This step belongs to the fourth layer architecture. By calling the general large model and combining it with specific prompt settings, accurate extraction and verification of traditional Chinese medicine entities are achieved.
[0043] Specifically: According to the task requirements, set the prompt, select the names that best match the TCM entities in the first named entity list and the second named entity list, respectively, and embed them into the prompt. Input the prompt and the original text of the selected TCM entities into a pre-trained general large model to identify and extract the third named entity list corresponding to the original text data. According to the task requirements, set a suitable prompt, such as: ***There are two entity lists below: the first named entity list and the second named entity list. Please extract the names that best match the TCM entities in the above two lists and return a list in json format***. Embed the first named entity list and the second named entity list to be verified into the prompt to guide the large model to perform targeted entity recognition; the extraction process takes into account multiple dimensions such as contextual information and semantic associations. For example, the information related to the TCM text mentioned above can also be embedded in the prompt to prompt the large model to consider the text to extract the most relevant TCM entities to ensure the accuracy and relevance of the extracted third named entity list. In this solution, according to the task requirements, a suitable prompt is set, and the first entity list and the second entity list to be verified are embedded in the prompt to guide the large model to perform targeted entity recognition; the extraction process takes into account multiple dimensions such as contextual information and semantic association to ensure the accuracy and relevance of the extracted third entity list.
[0044] In this embodiment, S3, identifying and extracting the third named entity list corresponding to the original text data, and then also including: comparing the third named entity list with the first named entity list and the second named entity list for similarity; if the similarity is lower than the threshold, manually comparing and proofreading the third named entity list to obtain the final fourth named entity list. Specifically, if the first named entity list contains 31 Chinese medicine entities, and the second named entity list contains 29 Chinese medicine entities, after comparison and fusion, the third named entity list contains 35 Chinese medicine entities, then the third named entity list is compared with the first and second for similarity; if the similarity is lower than the threshold, here the threshold is set to 90%, then the similarity between the third named entity list and the first named entity list is 31÷35=88.57%, and the similarity between the third named entity list and the second named entity list is 29÷35=82.86%, both of which are lower than the threshold, then manually comparing and proofreading the third named entity list to obtain the final fourth named entity list.
[0045] In this embodiment, a similarity threshold is set to evaluate the similarity between the extracted third entity list and the first entity list and the second entity list. If the similarity between the extracted third entity list and the first entity list and / or the second entity list is lower than the set threshold, the extraction result is considered abnormal, and the exception handling mechanism is triggered at this time. The exception handling mechanism includes handing over the abnormal case to the manual processing model, and the experts with professional knowledge of traditional Chinese medicine conduct manual proofreading to determine the suitability of the entity extraction. Entity list determination: After the dual verification of automatic extraction of the large model and manual proofreading, the final fourth entity list of traditional Chinese medicine is determined. The fourth entity list is the final entity. This step re-verifies the entities extracted by the dual model to eliminate possible misjudgments or omissions, thereby ensuring that the final output of the traditional Chinese medicine entity information is both comprehensive and accurate. This multiple verification mechanism greatly enhances the robustness and reliability of the system.
[0046] In this embodiment, two complementary models are used, which work together to perform deep parsing and entity extraction on the same TCM-related sentence. This dual-model parallel processing method not only broadens the horizon of entity recognition, but also greatly improves the accuracy and comprehensiveness of recognition through mutual verification and complementation between models, ensuring that all key TCM entities in the sentence can be accurately captured.
[0047] In order to better understand the principle of the present invention, a specific example will be used for explanation, as follows: Assume that there is a section of traditional Chinese medicine text (pre-processed text, that is, the pre-processing of S1 above has been completed): "In traditional Chinese medicine theory, ginseng (Ren Shen) is known as the 'king of herbs'. It is sweet, slightly bitter, warm, and enters the spleen and lung meridians. It has the effects of greatly replenishing vital energy, restoring pulse and consolidating deficiency, replenishing spleen and lung, calming the mind and improving intelligence. It is often used to treat symptoms of qi deficiency and impending deficiency, and when combined with astragalus (Huang Qi), it can enhance the power of replenishing qi and raising yang. Angelica (Dang Gui) is famous for its blood-tonifying and blood-activating effects, regulating menstruation and relieving pain. It is a commonly used medicinal material for women to regulate their bodies, especially for symptoms of blood deficiency, sallow complexion, dizziness, palpitations, and irregular menstruation. In addition, wolfberry (Gou Qi Zi), as a good product for nourishing the liver and kidneys, improving intelligence and improving eyesight, is often paired with chrysanthemum (Ju Hua) to relieve visual fatigue, improve eyesight and clear the liver. Honeysuckle (Jin Yin Hua) is cold in nature and sweet in taste. It has the effects of clearing away heat and detoxifying, and evacuating wind-heat. It is a good medicine for preventing and treating colds and sore throats in summer. There is also Poria (Fu "Chen Pi (Chen Pi) can regulate Qi and invigorate the spleen, dry out dampness and resolve phlegm, and is often used to treat abdominal distension, poor appetite, vomiting and diarrhea, and cough with excessive phlegm. Finally, several commonly used Chinese medicinal materials are mentioned, such as Coptis chinensis (Huang Lian, clearing away heat and dampness, purging fire and detoxifying), Cassia seed (Jue Ming Zi, clearing the liver and improving eyesight, moistening the intestines and facilitating bowel movements), Zhen Zhu Fen (Zhen Zhu Fen, calming the nerves and calming the nerves, improving eyesight and removing cataracts), Chuanxiong (Chuan Xiong, promoting blood circulation and promoting Qi, dispelling wind and relieving pain), and Licorice (Gan Cao, tonifying the spleen and replenishing Qi, clearing heat and detoxifying, and harmonizing various medicines). They each play an irreplaceable role in the field of traditional Chinese medicine." S2, inputting the preprocessed raw text data into a pre-trained basic language model and a pre-trained large language model, respectively, to identify and extract a first named entity list and a second named entity list corresponding to the raw text data; (1) The first named entity list contains 31 entities, as follows: Ginseng (Ren Shen) Spleen Meridian Lung Meridian Replenishing Qi and Raising Yang Dang Gui Nourishes blood and promotes blood circulation Regulate menstruation and relieve pain Gou Qi Zi Nourishes the liver and kidneys Chrysanthemum (Ju Hua) Improve eyesight and clear liver Jin Yin Hua Clearing away heat and detoxifying Evacuate wind-heat Fu Ling Diuresis and moisture removal Strengthens the spleen and calms the mind Chen Pi Regulates Qi and strengthens the spleen Drying dampness and resolving phlegm Huang Lian Clears away heat and dries dampness Clearing away heat and detoxification Cassia seed Cleanses the liver and improves eyesight Lubricates the intestines and promotes bowel movements Pearl powder (Zhen Zhu Fen) Calming the nerves and calming the nerves Improve eyesight Chuan Xiong Activate blood circulation and promote qi (2) The second entity list contains 29 entities, as follows: Ginseng (Ren Shen) Spleen Meridian Lung Meridian Replenishing Qi and Raising Yang Dang Gui Nourishes blood and promotes blood circulation Regulate menstruation and relieve pain Gou Qi Zi Nourishes the liver and kidneys Chrysanthemum (Ju Hua) Improve eyesight and clear liver Jin Yin Hua Clearing away heat and detoxifying Evacuate wind-heat Fu Ling Diuresis and moisture removal Strengthens the spleen and calms the mind Chen Pi Regulates Qi and strengthens the spleen Pearl powder (Zhen Zhu Fen) Calming the nerves and calming the nerves Improve eyesight and remove cataracts Chuan Xiong Activate blood circulation and promote qi Dispel wind and relieve pain Licorice (Gan Cao) Tonify the spleen and replenish qi Reconcile the medicines S3, embed the first named entity list and the second named entity list into a preset prompt word template, and input a pre-trained general large model to identify and extract the third named entity list corresponding to the original text data. The third entity list contains 35 entities, as follows: Ginseng (Ren Shen) Spleen Meridian Lung Meridian Replenishing Qi and Raising Yang Dang Gui Nourishes blood and promotes blood circulation Regulate menstruation and relieve pain Gou Qi Zi Nourishes the liver and kidneys Chrysanthemum (Ju Hua) Improve eyesight and clear liver Jin Yin Hua Clearing away heat and detoxifying Evacuate wind-heat Fu Ling Diuresis and moisture removal Strengthens the spleen and calms the mind Chen Pi Regulates Qi and strengthens the spleen Drying dampness and resolving phlegm Huang Lian Clears away heat and dries dampness Clearing away heat and detoxification Cassia seed Cleanses the liver and improves eyesight Lubricates the intestines and promotes bowel movements Pearl powder (Zhen Zhu Fen) Calming the nerves and calming the nerves Improve eyesight and remove cataracts Chuan Xiong Activate blood circulation and promote qi Dispel wind and relieve pain Licorice (Gan Cao) Tonify the spleen and replenish qi Reconcile the medicines S4, compare the third named entity list with the first named entity list and / or the second named entity list for similarity; if the similarity is lower than the threshold, manually compare and proofread the third named entity list to obtain the final fourth named entity list. If the similarity between the third and the first is 88.57%, and the third and the second is 82.86%, both of which are lower than the threshold, the fourth entity list is manually extracted, otherwise it is extracted through the third entity list.
[0048] Based on the above embodiments, it can be known that the present invention has achieved a significant performance leap in the entity recognition of proper nouns in the field of traditional Chinese medicine, which is mainly due to its innovative fusion of multiple strategies. Specifically, the invention cleverly uses two complementary models that work together to perform deep analysis and entity extraction on the same traditional Chinese medicine-related sentence. This dual-model parallel processing method not only broadens the field of entity recognition, but also greatly improves the accuracy and comprehensiveness of recognition through mutual verification and supplementation between models, ensuring that all key traditional Chinese medicine entities in the sentence can be accurately captured.
[0049] In addition, in order to further improve the accuracy of recognition, the present invention also innovatively introduces a verification module. This module is like a strict quality inspector, re-verifying the entities extracted by the dual models to eliminate possible misjudgments or omissions, thereby ensuring that the final output of the TCM entity information is both comprehensive and accurate. This multiple verification mechanism greatly enhances the robustness and reliability of the system.
[0050] It is particularly worth mentioning that the present invention uses a self-built high-quality dataset in the model fine-tuning stage. This dataset is carefully constructed specifically for the task of extracting TCM entities. It not only covers a wide range of TCM knowledge, but also fully considers the diversity and complexity of TCM terminology. By using this high-quality dataset for fine-tuning on a large model, the present invention can more accurately understand the language characteristics and entity composition rules in the field of TCM, thereby meeting the specific needs of the task of extracting TCM entities to the greatest extent.
[0051] In summary, the advantages of the present invention lie in its innovative dual-model collaborative recognition strategy, the introduced verification module and the self-built high-quality data set. These measures work together to achieve a significant improvement in the recognition effect of TCM proper noun entities.
[0052] Embodiment 2 See also Figure 3 , a named entity recognition and extraction device based on traditional Chinese medicine text, based on the above method; comprising: The acquisition module is used to obtain the original text data of traditional Chinese medicine and perform preprocessing; A first extraction module is used to input the preprocessed original text data into a pre-trained basic language model and a pre-trained large language model, respectively, to identify and extract a first named entity list and a second named entity list corresponding to the original text data; The second extraction module is used to embed the first named entity list and the second named entity list into a preset prompt word template, and input a pre-trained general large model to identify and extract a third named entity list corresponding to the original text data.
[0053] In this embodiment, in order to better use the above method, the present application proposes a named entity recognition and extraction device based on traditional Chinese medicine text, and each module corresponds to each step of the above method. The specific principles have been described above and will not be repeated here.
[0054] In this embodiment, a verification module is also connected thereafter, and the verification module is specifically used to: Comparing the third named entity list with the first named entity list and / or the second named entity list for similarity comparison; If the similarity is lower than the threshold, the third named entity list is manually compared and proofread to obtain a final fourth named entity list.
[0055] Embodiment 3 A named entity recognition and extraction device based on traditional Chinese medicine text, comprising: at least one processor and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in one of the embodiments.
[0056] In this embodiment, in order to better run and process the method described in one of the embodiments, the above method is stored in a memory, and a processor is used to execute the stored method. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0057] Embodiment 4 A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the method described in one of the embodiments is implemented.
[0058] In this embodiment, in order to better run and use the method described in one of the embodiments, the method is stored in a computer-readable storage medium and implemented by a processor. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0059] The above descriptions are only some embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any equivalent device or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A named entity recognition and extraction method based on traditional Chinese medicine text, characterized in that: The method comprises: Obtain original text data of traditional Chinese medicine and perform preprocessing; The preprocessed raw text data is input into a pre-trained basic language model and a pre-trained large language model respectively, and a first named entity list and a second named entity list corresponding to the raw text data are respectively identified and extracted; The first named entity list and the second named entity list are embedded in a preset prompt word template, and input into a pre-trained general large model to identify and extract a third named entity list corresponding to the original text data.
2. A method for named entity recognition and extraction based on traditional Chinese medicine text as claimed in claim 1, characterized in that: The preprocessed raw text data are respectively input into a pre-trained basic language model to identify and extract the first named entity list corresponding to the raw text data, specifically: The pre-processed original text data are respectively input into a pre-trained self-feedback neural network model to extract entity feature sequences in the original text data; Input the entity feature sequence into a fully connected layer to generate a probability distribution corresponding to the entity feature sequence; Based on the probability distribution and entity feature sequence, a CRF layer is input to generate an entity label sequence; The entity tag sequence is used as the first named entity list.
3. A method for named entity recognition and extraction based on traditional Chinese medicine text as claimed in claim 1, characterized in that: The preprocessed raw text data are respectively input into a pre-trained large language model to identify and extract a second named entity list corresponding to the raw text data, specifically: Collect and preprocess text data in the field of traditional Chinese medicine to generate data sets; Fine-tune the LLAMA model based on the data set to obtain a pre-trained LLAMA model; After the original text data is subjected to retrieval enhancement generation processing, it is input into the pre-trained LLAMA model to output a second named entity list.
4. A method for named entity recognition and extraction based on traditional Chinese medicine text as described in claim 1 or 3, characterized in that: After the original text data is processed for retrieval enhancement generation, it is input into the pre-trained LLAMA model to output the second named entity list, which also includes: The second named entity list is compared and proofread.
5. The method for named entity recognition and extraction based on traditional Chinese medicine text according to claim 1, characterized in that: The first named entity list and the second named entity list are embedded in a preset prompt word template, and a pre-trained general large model is input to identify and extract a third named entity list corresponding to the original text data, specifically: According to the task requirements, a prompt is set, and the names that best match the TCM entities in the first named entity list and the second named entity list are selected and embedded into the prompt respectively. The prompt and the original text of the selected TCM entities are input into a pre-trained general large model to identify and extract the third named entity list corresponding to the original text data.
6. A method for named entity recognition and extraction based on traditional Chinese medicine text as claimed in claim 1, characterized in that: Identify and extract a third named entity list corresponding to the original text data, and then include: Comparing the third named entity list with the first named entity list and / or the second named entity list for similarity comparison; If the similarity is lower than the threshold, the third named entity list is manually compared and proofread to obtain a final fourth named entity list.
7. A named entity recognition and extraction device based on traditional Chinese medicine text, characterized in that: A method according to any one of claims 1 to 6; comprising: The acquisition module is used to obtain the original text data of traditional Chinese medicine and perform preprocessing; A first extraction module is used to input the preprocessed original text data into a pre-trained basic language model and a pre-trained large language model, respectively, to identify and extract a first named entity list and a second named entity list corresponding to the original text data; The second extraction module is used to embed the first named entity list and the second named entity list into a preset prompt word template, and input a pre-trained general large model to identify and extract a third named entity list corresponding to the original text data.
8. A named entity recognition and extraction device based on traditional Chinese medicine text, characterized in that: include: at least one processor and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.