Intelligent medication question-answering system and method based on knowledge graph

By constructing a drug use knowledge graph for multiple rounds of dialogue and using large language models for intention analysis, the reasoning chain of drug use knowledge was determined, and the intelligent drug use question-and-answer system answered ambiguity under fuzzy questions, achieving more accurate and coherent drug use answers.

CN120164568AInactive Publication Date: 2025-06-17AFFILIATED HOSPITAL CHONGQING THREE GORGES MEDICAL COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510270694.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing intelligent drug use question and answer system based on knowledge graphs is difficult to accurately answer medication when users use fuzzy questions, resulting in ambiguity in the answer.

Method used

By constructing a drug knowledge graph in multiple rounds of dialogue, using a pre-trained large language model for intention analysis, the semantic dependence relationship between drug knowledge graphs is determined, the reasoning chain of drug knowledge is inferred, and contextual correlation information is generated based on the semantic coherence of dialogue keywords, and finally the drug answer is generated.

Benefits of technology

In the absence or vague question information, the system can accurately identify the user's core needs, reduce answer ambiguity, and generate more accurate and coherent drug answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120164568A_ABST
    Figure CN120164568A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent medication question-answering system and method based on a knowledge graph. The method comprises the following steps: constructing a medication knowledge graph of different question instructions; performing intention analysis on the problem instruction under each dialogue round to obtain an intention feature under each dialogue round; according to the semantic relevancy between the question instructions and the semantic space of each drug use knowledge graph, determining a semantic dependency relationship between the drug use knowledge graphs, and through the semantic dependency relationship and the intention characteristics under each dialogue round, determining a reasoning chain of drug use knowledge in a drug use question and answer process; according to the semantic coherence degree of each dialogue keyword in the current question and answer scene and the reasoning chain of the drug use knowledge in the drug use question and answer process, determining context association information of a dialogue instruction in the current question and answer scene, and based on the context association information and the large language model, generating a drug use answer of the dialogue instruction in the current question and answer scene. By adopting the scheme of the invention, the inference complementation of the medicine answering under the condition that the question information is lost can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of knowledge graphs. More specifically, this application relates to an intelligent medication Q&A system and method based on a knowledge graph. Background Art

[0002] Knowledge graph technology organizes entities and their relationships in the form of a graph to help computers understand and reason about complex information networks. In the field of Q&A, knowledge graphs enhance the ability of natural language understanding by providing structured background knowledge, enabling the system to more accurately understand user questions and quickly find relevant information from a large amount of data. By associating knowledge points in different fields, semantic search and reasoning are supported, thus improving traditional keyword-based search methods and providing users with more intelligent and accurate answers. The application of knowledge graphs has greatly promoted the development of intelligent Q&A systems.

[0003] Existing intelligent medication Q&A methods based on knowledge graphs mainly rely on constructing knowledge graphs between entities such as drugs, diseases, symptoms, and treatment methods. Through natural language processing technology, the user's medication questions are converted into understandable queries, and then reasoning is carried out through the nodes and edges in the knowledge graph to obtain drug information and recommended medication plans related to the questions. However, since users use relatively ambiguous question representations during the medication Q&A process, the system lacks detailed descriptions of user questions, resulting in different answers to the user's medication feedback information, thus causing ambiguity in the medication answers. Therefore, how to infer and complete medication answers in the absence of question information has become a difficult problem faced by the industry. Summary of the Invention

[0004] This application provides an intelligent medication Q&A system and method based on a knowledge graph, which can infer and complete medication answers in the absence of question information.

[0005] In a first aspect, this application provides an intelligent medication Q&A method based on a knowledge graph, including the following steps: Obtain the question instructions of the target user in different dialogue turns, and then construct a medication knowledge graph for different question instructions; Based on a pre-trained large language model, perform intent analysis on the question instructions in each dialogue turn to obtain the intent features of the target user in each dialogue turn; Determine the semantic dependency relationship between each medication knowledge graph according to the semantic relevance between the question instructions in each dialogue turn and the semantic space of each medication knowledge graph, and determine the reasoning chain of medication knowledge in the medication Q&A process through the semantic dependency relationship and the intent features of the target user in each dialogue turn; Extract keywords from the dialogue instructions of the target user in the current Q&A scenario to obtain multiple dialogue keywords, and determine the semantic coherence degree of each dialogue keyword in the current Q&A scenario based on all the dialogue keywords and the semantic features of each medication knowledge graph; Determine the context association information of the dialogue instructions in the current Q&A scenario according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario and the reasoning chain of medication knowledge in the medication Q&A process, and generate a medication answer to the dialogue instructions in the current Q&A scenario based on the context association information and the large language model.

[0006] In some embodiments, based on a pre-trained large language model, perform intent analysis on the question instructions in each dialogue turn to obtain the intent features of the target user in each dialogue turn, specifically including: Select a dialogue turn as the selected dialogue turn; Based on a pre-trained large language model, extract multiple intent keywords from the question instructions in the selected dialogue turn; Extract the dependency relationship between every two intent keywords to obtain the dependency relationship between every two intent keywords; Determine the intent features of the target user in the selected dialogue turn according to the dependency relationship between every two intent keywords; Continue to determine the intent features of the target user in the remaining dialogue turns.

[0007] In some embodiments, determine the semantic dependency relationship between each medication knowledge graph according to the semantic relevance between the question instructions in each dialogue turn and the semantic space of each medication knowledge graph, specifically including: According to the semantic relevance between the question instructions in each dialogue turn and the multiple intent keywords of the question instructions in each dialogue turn, determine the dependency relationship graph of the question instructions in each dialogue turn; Determine the semantic dependency relationship between each medication knowledge graph through the semantic space of each medication knowledge graph and the dependency relationship graph of the question instructions in each dialogue turn.

[0008] In some embodiments, determine the reasoning chain of medication knowledge in the medication Q&A process through the semantic dependency relationship and the intent features of the target user in each dialogue turn, specifically including: Obtain the medication knowledge graph of the question instructions in each dialogue turn, and then perform element analysis on all the medication knowledge graphs to obtain the logical element graph of the medication knowledge in the medication Q&A process; Determine the reasoning path of the medication knowledge in each dialogue turn according to the logical element graph of the medication knowledge in the medication Q&A process and the intent features of the target user in each dialogue turn; Determine the inference chain of medication knowledge in the medication Q&A process through the inference path of medication knowledge in each dialogue turn and the semantic dependencies.

[0009] In some embodiments, keyword extraction is performed on the dialogue instructions of the target user in the current Q&A scenario to obtain multiple dialogue keywords, specifically including: Based on the large language model, semantic enhancement is performed on the dialogue instructions of the target user in the current Q&A scenario to obtain the semantic enhancement features of the dialogue instructions of the target user in the current Q&A scenario; According to the semantic enhancement features, key information extraction is performed on the dialogue instructions of the target user in the current Q&A scenario to obtain multiple dialogue keywords.

[0010] In some embodiments, determining the semantic coherence degree of each dialogue keyword in the current Q&A scenario through all the dialogue keywords and the semantic features of each medication knowledge graph specifically includes: Determine the semantic change amount of each dialogue keyword in the current Q&A scenario according to all the dialogue keywords and all the intent keywords; Determine the semantic coherence degree of each dialogue keyword in the current Q&A scenario through the semantic change amount of each dialogue keyword in the current Q&A scenario and the semantic features of each medication knowledge graph.

[0011] In some embodiments, determining the context association information of the dialogue instructions in the current Q&A scenario according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario and the inference chain of medication knowledge in the medication Q&A process specifically includes: Determine the context features of the dialogue instructions in the current Q&A scenario according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario; Determine the context association information of the dialogue instructions in the current Q&A scenario through the context features and the inference chain of medication knowledge in the medication Q&A process.

[0012] In a second aspect, the present application provides an intelligent medication Q&A system based on a knowledge graph, including: A construction module, configured to obtain the question instructions of the target user in different dialogue turns, and then construct a medication knowledge graph for different question instructions; A processing module, configured to perform intent analysis on the question instructions in each dialogue turn based on a pre-trained large language model to obtain the intent features of the target user in each dialogue turn; The processing module is further configured to determine the semantic dependencies between each medication knowledge graph according to the semantic relevance between the question instructions in each dialogue turn and the semantic space of each medication knowledge graph, and determine the inference chain of medication knowledge in the medication Q&A process through the semantic dependencies and the intent features of the target user in each dialogue turn; The processing module is further configured to extract keywords from the dialogue instructions of the target user in the current Q&A scenario to obtain multiple dialogue keywords, and determine the semantic coherence degree of each dialogue keyword in the current Q&A scenario based on all the dialogue keywords and the semantic features of each medication knowledge graph; The execution module is configured to determine the context association information of the dialogue instruction in the current Q&A scenario according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario and the reasoning chain of the medication knowledge in the medication Q&A process, and generate a medication answer to the dialogue instruction in the current Q&A scenario based on the context association information and the large language model.

[0013] In a third aspect, the present application provides a computer device, which includes a memory and a processor. The memory stores code, and the processor is configured to obtain the code and execute the above-mentioned intelligent medication Q&A method based on a knowledge graph.

[0014] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned intelligent medication Q&A method based on a knowledge graph is implemented.

[0015] The technical solution provided by the disclosed embodiments of the present application has the following beneficial effects: In the intelligent medication Q&A system and method based on a knowledge graph provided by the present application, by obtaining the question instructions of the target user in different dialogue rounds, a medication knowledge graph for different question instructions is constructed; based on a pre-trained large language model, the intent analysis of the question instructions in each dialogue round is performed to obtain the intent features of the target user in each dialogue round; according to the semantic relevance between the question instructions in each dialogue round and the semantic space of each medication knowledge graph, the semantic dependency relationship between each medication knowledge graph is determined, and the reasoning chain of the medication knowledge in the medication Q&A process is determined through the semantic dependency relationship and the intent features of the target user in each dialogue round; keywords are extracted from the dialogue instructions of the target user in the current Q&A scenario to obtain multiple dialogue keywords, and the semantic coherence degree of each dialogue keyword in the current Q&A scenario is determined based on all the dialogue keywords and the semantic features of each medication knowledge graph; the context association information of the dialogue instruction in the current Q&A scenario is determined according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario and the reasoning chain of the medication knowledge in the medication Q&A process, and a medication answer to the dialogue instruction in the current Q&A scenario is generated based on the context association information and the large language model.

[0016] It can be seen that in this application, the context - related information of the dialogue instruction in the current Q&A scenario can be determined according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario and the inference chain of medical knowledge in the medical Q&A process. Among them, first, by constructing a medical knowledge graph for different question instructions, the medical - related knowledge is structured and semanticized, enabling the system to systematically store and call medical information. The medical knowledge graph can provide complete medical background information, ensuring the accuracy and integrity of medical answers. Second, based on the pre - trained large - language model, the intention of the question instruction in each dialogue turn is analyzed, enabling the system to accurately identify the core needs of the user even when question information is missing, reducing ambiguity caused by unclear question expressions. Third, through the semantic dependency relationships between each medical knowledge graph, the potential connections between questions in different dialogue turns can be effectively identified. When the question information is incomplete, the semantic dependency relationships provide clues for the system to reason and help fill in the missing parts. Combining the intention features of the user in each dialogue turn, the system can automatically complete the missing medical knowledge according to the inference chain and generate more accurate answers. This process ensures the coherence and accuracy of medical Q&A and can provide reasonable inference and completion even when the information is incomplete. Then, by extracting keywords from the dialogue instruction of the target user in the current Q&A scenario and combining with the semantic features of the medical knowledge graph, the semantic coherence degree of these keywords in the current Q&A scenario is obtained and evaluated. When the question information is missing, the system relies on the semantic coherence degree of these keywords to infer the actual needs of the user, thereby completing the missing information. This process helps the system to more accurately understand the core of the user's question. Further, the context - related information of the dialogue instruction in the current Q&A scenario is determined, where the context - related information represents the information set composed of the mutually related medical knowledge between the historical dialogue and the current dialogue. Finally, based on the context - related information and the large - language model, a medical answer to the dialogue instruction in the current Q&A scenario is generated. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 is an exemplary flowchart of an intelligent medical Q&A method based on a knowledge graph according to some embodiments of the present application; Figure 2 is a schematic flowchart for determining the semantic dependency relationships between each medical knowledge graph according to some embodiments of the present application; Figure 3 is a schematic flowchart for determining the inference chain of medical knowledge according to some embodiments of the present application; Figure 4 is a schematic structural diagram of an intelligent medical Q&A system based on a knowledge graph according to some embodiments of the present application; Figure 5Schematic structural diagram of a computer device for implementing an intelligent medication Q&A method based on a knowledge graph as shown in some embodiments of the present application. Detailed implementation manners

[0018] To better understand the technical solutions of the present application, the technical solutions of the present application will be described in detail below in conjunction with the accompanying drawings of the specification and specific implementation manners.

[0019] Refer to Figure 1 , which is an exemplary flowchart of an intelligent medication Q&A method based on a knowledge graph as shown in some embodiments of the present application. The intelligent medication Q&A method 100 based on a knowledge graph mainly includes the following steps: In step 101, obtain the question instructions of the target user in different conversation rounds, and then construct a medication knowledge graph for different question instructions.

[0020] Specifically, obtain the question instructions of the target user in different conversation rounds from the historical conversation records.

[0021] It should be noted that the question instructions in the present application refer to the description information of the target user's medication problems during the historical conversation process.

[0022] In specific implementation, the medication knowledge graph for constructing different problem instructions can be implemented in the following way, that is: First, use natural language processing technology (such as the Transformers model) to parse each problem instruction to obtain the parsing result of each problem instruction; Second, input the parsing results of each problem instruction into a medical database (such as the Chinese Medical Information Query Platform, the Pharmcube Database) to query the medication data in the medication field where each problem instruction is located; Then, select a problem instruction as the selected problem instruction, and use named entity recognition technology (such as the BioBERT model) to extract multiple entities from the medication data in the medication field corresponding to the selected problem instruction, and use the obtained entities as the key information entities of the selected problem instruction (such as drugs, diseases, symptoms, dosages, side effects, etc., which are not limited here). Among them, the key information entity represents the core entity composed of medication-related knowledge. Further, use a deep learning model (such as BiLSTM-CRF) to extract the association relationships between each key information entity from the medication data of the selected problem instruction. Among them, the association relationship represents the characteristics of mutual influence between key information entities. For example, the association relationship between a drug and a disease (such as "aspirin" treats "headache"), the association relationship between a drug and a side effect (such as "aspirin" may cause "gastric bleeding"). Then, use all the key information entities as nodes, use the association relationships between each key information entity as edges, and then construct a graph structure, and use the obtained graph structure as the medication knowledge graph of the selected problem instruction, and continue to determine the medication knowledge graphs of the remaining problem instructions.

[0023] It should be noted that the medication data described in this application is a set composed of different information such as drug basic information (such as drug name, chemical composition, manufacturer, etc., which are not limited here), drug indication information (such as treating specific diseases, indications, etc., which are not limited here), drug usage and dosage information (such as administration route, dosage, medication time, treatment course, etc., which are not limited here), and medication side effect information (such as common side effects, serious adverse reactions, long-term use effects, etc., which are not limited here).

[0024] In step 102, based on the pre-trained large language model, perform intention analysis on the problem instructions in each dialogue turn to obtain the intention characteristics of the target user in each dialogue turn.

[0025] In some embodiments, performing intention analysis on the problem instructions in each dialogue turn based on the pre-trained large language model to obtain the intention characteristics of the target user in each dialogue turn can be implemented by the following steps: Select a dialogue turn as the selected dialogue turn; Based on the pre-trained large language model, extract multiple intention keywords from the problem instructions in the selected dialogue turn; Extract the dependency relationship between every two intent keywords to obtain the dependency relationship between every two intent keywords; Determine the intent feature of the target user in the selected conversation turn according to the dependency relationship between every two intent keywords; Continue to determine the intent feature of the target user in the remaining conversation turns.

[0026] It should be noted that the large language model pre-trained in this application uses the GPT-4o model. The GPT-4o model is a large-scale language model based on the Transformer architecture. It pre-trains a large amount of text data through unsupervised learning, and can generate coherent and natural language texts. Its core is the self-attention mechanism, which can effectively capture long-distance dependencies in the text. Through a large number of pre-training and fine-tuning processes, the GPT-4o model learns multi-level language knowledge such as grammar, semantics, and common sense reasoning, and has various application capabilities such as text generation, translation, question answering, and summarization.

[0027] When specifically implemented, extracting multiple intent keywords from the question instruction in the selected conversation turn based on the pre-trained large language model can be achieved by the following method, that is: First, use the pre-trained large language model to generate multiple question instruction variants similar to the question instruction in the selected conversation turn, so as to form a set of question instructions with all similar question instructions and the question instruction in the selected conversation turn; Second, use named entity recognition technology (such as the BioBERT model) to extract entities from each question instruction in the set of question instructions, so as to obtain multiple entities, and then use a keyword extraction algorithm (such as TextRank) to screen out important entities from all entities, and use all the screened entities as intent keywords, so as to obtain multiple intent keywords. In other embodiments, other methods can also be used to implement, which is not limited here.

[0028] It should be noted that the intent keyword described in this application represents the keyword for the question instruction to express the user's intent.

[0029] When specifically implemented, extracting the dependency relationship between every two intent keywords to obtain the dependency relationship between every two intent keywords can be achieved by the following method, that is: Use the Word2Vec model to convert each intent keyword into a vector, and use the obtained vectors as the feature vectors of each intent keyword, and then calculate the cosine similarity of the feature vectors of every two intent keywords, and use the obtained cosine similarity as the dependency relationship between every two intent keywords. In other embodiments, other methods can also be used to implement, which is not limited here.

[0030] It should be noted that the dependency relationship described in this application represents the characteristic parameter of the semantic dependency degree between every two intent keywords.

[0031] In specific implementation, to determine the intent feature of the target user in the selected conversation turn according to the dependency relationship between every two intent keywords, the following method can be adopted, that is: calculate the average value of the dependency relationships between all intent keywords, and use the obtained average value as the global dependency value. Then, select the dependency relationships greater than or equal to the global dependency value from the dependency relationships between all intent keywords, and use the set composed of the intent keywords corresponding to each dependency relationship as the intent feature of the target user in the selected conversation turn. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.

[0032] It should be noted that the intent feature described in this application represents the descriptive feature reflecting the core intent of the user in the conversation, where the intent feature is composed of multiple intent keywords.

[0033] In step 103, according to the semantic relevance between the question instructions in each conversation turn and the semantic space of each medication knowledge graph, determine the semantic dependency relationship between each medication knowledge graph, and determine the inference chain of the medication knowledge in the medication Q&A process through the semantic dependency relationship and the intent feature of the target user in each conversation turn.

[0034] In some embodiments, as shown in Figure 2 This figure is a schematic flowchart of determining the semantic dependency relationship between each medication knowledge graph in some embodiments of this application. In this embodiment, to determine the semantic dependency relationship between each medication knowledge graph according to the semantic relevance between the question instructions in each conversation turn and the semantic space of each medication knowledge graph, the following steps can be adopted: First, in step 1031, according to the semantic relevance between the question instructions in each conversation turn and the multiple intent keywords of the question instructions in each conversation turn, determine the dependency relationship graph of the question instructions in each conversation turn; Then, in step 1032, determine the semantic dependency relationship between each medication knowledge graph through the semantic space of each medication knowledge graph and the dependency relationship graph of the question instructions in each conversation turn.

[0035] It should be noted that the semantic relevance in this application represents the degree of semantic relevance between each question instruction. The greater the semantic relevance, the higher the degree of semantic relevance between each question instruction. Use a pre-trained sentence embedding model (such as Sentence-BERT) to convert each question instruction into a vector representation, then calculate the cosine similarity between each two vector representations, and then select the smallest cosine similarity from them, and use the smallest cosine similarity as the semantic relevance between the question instructions in each conversation turn.

[0036] In specific implementation, to determine the dependency graph of the question instructions in each dialogue turn according to the semantic relevance between the question instructions in each dialogue turn and multiple intent keywords of the question instructions in each dialogue turn, the following method can be adopted, that is: select a dialogue turn as the selected dialogue turn, use a pre-trained sentence embedding model (such as Sentence-BERT) to convert multiple intent keywords of the question instructions in the selected dialogue turn into vector representations, then calculate the Euclidean distance between each two vector representations, and use the obtained Euclidean distance as the dependency distance between the corresponding two intent keywords respectively. Further, based on graph theory, all intent keywords are used as nodes, and the dependency distance between each two intent keywords is used as the weight of the edge, so as to construct a graph structure. Then, divide the weights of all edges in the graph structure by the semantic relevance between the question instructions in each dialogue turn, so as to update the weights of all edges in the graph structure, and use the updated graph structure as the dependency graph of the question instructions in the selected dialogue turn. Continue to determine the dependency graph of the question instructions in the remaining dialogue turns. In other embodiments, other methods can also be used to implement this, which is not limited here.

[0037] It should be noted that the dependency graph described in this application represents a graph structure formed by the mutual association between multiple intent keywords of the question instructions in a dialogue turn.

[0038] In addition, it should also be noted that the semantic space described in this application represents a high-dimensional vector space composed of vector representations of each key information entity in the medication knowledge graph and vector representations of the association relationships between each key information entity. The vector representations of each key information entity in the medication knowledge graph and the association relationships between each key information entity can be converted by using knowledge graph embedding technology (such as TransE). In other embodiments, other methods can also be used to implement this, which is not limited here.

[0039] In specific implementation, the semantic dependency relationship between each medication knowledge graph can be determined by the semantic space of each medication knowledge graph and the dependency graph of the question instructions in each dialogue turn in the following way: select a medication knowledge graph as the selected medication knowledge graph, calculate the dot product of the vector representations of every two key information entities in the semantic space of the selected medication knowledge graph, then sum up all the values obtained after the dot product, and take the sum value as the key entity weight. Further, calculate the dot product of the vector representations of the association relationships between every two key information entities in the semantic space of the selected medication knowledge graph, then sum up all the values obtained after the dot product, and take the sum value as the entity association weight. Then, divide the key entity weight by the entity association weight, and take the obtained quotient as the semantic association weight of the selected medication knowledge graph. Sum up the weights of all the edges in the dependency graph of the question instructions corresponding to the selected medication knowledge graph in the dialogue turn, then multiply the obtained sum value by the semantic association weight of the selected medication knowledge graph, and take the obtained product value as the semantic dependency coefficient of the selected medication knowledge graph. Continue to determine the semantic dependency coefficients of the remaining medication knowledge graphs. Furthermore, select the maximum semantic dependency coefficient and the minimum semantic dependency coefficient from all the semantic dependency coefficients, divide the maximum semantic dependency coefficient by the minimum semantic dependency coefficient, and take the obtained quotient as the semantic dependency relationship between each medication knowledge graph. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.

[0040] It should be noted that the semantic dependency relationship described in this application represents the characteristic parameter of the mutual dependency between each medication knowledge graph at the semantic level.

[0041] In some embodiments, as shown in Figure 3 This figure is a schematic flowchart of the process for determining the inference chain of medication knowledge in some embodiments of this application. In this embodiment, the inference chain of medication knowledge in the medication Q&A process can be determined by the semantic dependency relationship and the intention characteristics of the target user in each dialogue turn in the following steps: Obtain the medication knowledge graph of the question instructions in each dialogue turn, and then perform element analysis on all the medication knowledge graphs to obtain the logical element graph of the medication knowledge in the medication Q&A process; Determine the inference path of the medication knowledge in each dialogue turn according to the logical element graph of the medication knowledge in the medication Q&A process and the intention characteristics of the target user in each dialogue turn; Determine the inference chain of the medication knowledge in the medication Q&A process through the inference path of the medication knowledge in each dialogue turn and the semantic dependency relationship.

[0042] In specific implementation, for all medication knowledge graphs, element analysis is performed to obtain the logical element graph of medication knowledge in the medication Q&A process. The following method can be used to achieve this, that is: based on an inference engine (such as Pellet), first, define various inference rules (such as inference rules for the treatment relationship between drugs and diseases, which are not limited here), then read the information in each medication knowledge graph through the inference engine, and then use the inference engine to perform inference on each medication knowledge graph, so as to obtain various new knowledge in each medication knowledge graph. Then, form all the obtained new knowledge into a graph, and use the obtained graph as the logical element graph of medication knowledge in the medication Q&A process. For example: in the medication knowledge graph, it is known that "drug A treats disease B" and "disease B causes symptom C", and the inference engine can deduce the new knowledge that "drug A may relieve symptom C". In other embodiments, other methods can also be used to achieve this, which are not limited here.

[0043] It should be noted that the logical element graph described in this application represents a new knowledge graph composed of all new knowledge logically deduced from each medication knowledge graph. Among them, new knowledge refers to the new connection features obtained by logically reasoning about each key information entity in all medication knowledge graphs and the association relationships between each key information entity. In addition, all entities in the logical element graph are regarded as element entities, where the element entity represents the key information entity in the medication knowledge graph of the problem instruction, and the weight of the edge between every two element entities in the logical element graph is set to the cosine similarity of the vector representations of every two element entities. In other embodiments, other methods can also be used to achieve this, which will not be elaborated here.

[0044] In specific implementation, to determine the inference path of medication knowledge in each dialogue turn according to the logical element graph of medication knowledge in the medication Q&A process and the intention features of the target user in each dialogue turn, the following method can be used to achieve this, that is: select a dialogue turn as the selected dialogue turn, and perform fuzzy matching between each intention keyword in the intention features of the selected dialogue turn and the name of each element entity in the logical element graph, so as to map each intention keyword in the intention features to an element entity in the logical element graph, and regard all entities as mapped entities. The mapping method is that after satisfying the fuzzy matching, the intention keyword and the element entity are regarded as the same. Then, use the connection path of each mapped entity in the logical element graph as the inference path of medication knowledge in the selected dialogue turn, and continue to determine the inference path of medication knowledge in the remaining dialogue turns. In other embodiments, other methods can also be used to achieve this, which are not limited here.

[0045] It should be noted that the inference path described in this application represents the connection path of each mapped entity in the logical element graph after mapping each intention keyword in the intention features to each mapped entity of the logical element graph.

[0046] In specific implementation, the inference chain of medication knowledge in the medication Q&A process can be determined through the inference path of medication knowledge and the semantic dependency relationship in each dialogue turn, which can be implemented in the following way: connect the inference paths of medication knowledge in each dialogue turn to obtain interconnected inference paths, then update the weights of the edges of the interconnected inference paths, and use the updated interconnected inference paths as the inference chain of medication knowledge in the medication Q&A process. Specifically, to update the weights of the edges of the interconnected inference paths, the weight of each edge on each inference path can be multiplied by the semantic dependency relationship, so as to correspondingly replace the weights of the edges of each inference path with the values obtained by all multiplications. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.

[0047] It should be noted that the inference chain in this application represents the inference link that forms a logical relationship among various medication knowledge in the medication Q&A process, where the medication knowledge represents information related to medication.

[0048] In step 104, keywords are extracted from the dialogue instruction of the target user in the current Q&A scenario to obtain multiple dialogue keywords, and the semantic coherence degree of each dialogue keyword in the current Q&A scenario is determined through all the dialogue keywords and the semantic features of each medication knowledge graph.

[0049] In some embodiments, the extraction of keywords from the dialogue instruction of the target user in the current Q&A scenario to obtain multiple dialogue keywords can be implemented through the following steps: Semantically enhance the dialogue instruction of the target user in the current Q&A scenario based on the large language model to obtain the semantic enhancement features of the dialogue instruction of the target user in the current Q&A scenario; Extract key information from the dialogue instruction of the target user in the current Q&A scenario according to the semantic enhancement features to obtain multiple dialogue keywords.

[0050] It should be noted that the dialogue instruction in this application is the description information of the target user about the medication problem in the current dialogue process.

[0051] In specific implementation, semantic enhancement is performed on the dialogue instruction of the target user in the current Q&A scenario based on a preset large language model. The semantic enhancement feature of the dialogue instruction of the target user in the current Q&A scenario can be implemented in the following manner, that is: input the dialogue instruction into the large language model, and use the output result of the large language model as semantic enhancement information. Further, use the Word2Vec model to convert both the semantic enhancement information and the dialogue instruction into vector representations, thereby calculating the cosine similarity between the two vector representations, and using the obtained cosine similarity as the semantic enhancement feature of the dialogue instruction of the target user in the current Q&A scenario. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.

[0052] It should be noted that the semantic enhancement feature described in this application represents the feature parameters for enhancing the semantic representation of the dialogue instruction.

[0053] In specific implementation, key information extraction is performed on the dialogue instruction of the target user in the current Q&A scenario according to the semantic enhancement feature to obtain multiple dialogue keywords. The following method can be used for implementation, that is: use named entity recognition technology (such as the BioBERT model) to extract entities from the dialogue instruction, thereby obtaining multiple entities. Then, use the TextRank algorithm to calculate the PageRank value of each entity name, and then multiply the PageRank value of each entity noun by the semantic enhancement feature. Then, select the three entity nouns corresponding to the largest three PageRank values, and use the obtained entity nouns as dialogue keywords. In other embodiments, other methods can also be used for implementation, which are not limited here.

[0054] In some embodiments, the semantic coherence degree of each dialogue keyword in the current Q&A scenario can be determined by all the dialogue keywords and the semantic features of each medication knowledge graph through the following steps: Determine the semantic change amount of each dialogue keyword in the current Q&A scenario according to all the dialogue keywords and all the intent keywords; Determine the semantic coherence degree of each dialogue keyword in the current Q&A scenario through the semantic change amount of each dialogue keyword in the current Q&A scenario and the semantic features of each medication knowledge graph.

[0055] When specifically implemented, to determine the semantic change amount of each dialogue keyword in the current Q&A scenario based on all dialogue keywords and all intent keywords, the following method can be used, that is: use the Word2Vec model to convert all dialogue keywords and all intent keywords into vectors, so as to obtain the vector representation of each dialogue keyword and the vector representation of each intent keyword. Then, select a dialogue keyword as the selected dialogue keyword, perform dot product operations on the vector representation of the selected dialogue keyword and the vector representation of each intent keyword, and then calculate the mean value of all the values obtained after the dot product operations, and use the obtained mean value as the semantic change amount of the selected dialogue keyword in the current Q&A scenario. Continue to determine the semantic change amount of the remaining dialogue keywords in the current Q&A scenario. In other embodiments, other methods can also be used to implement this, which will not be elaborated here.

[0056] It should be noted that the semantic change amount described in this application represents a measurement parameter for the degree of semantic change between the current dialogue and each historical dialogue.

[0057] In addition, it should also be noted that the semantic feature described in this application reflects the eigenvalue of the semantic distribution of all key information entities and the association relationships between various key information entities in the entire medication knowledge graph. The knowledge graph embedding technology (such as TransE) can be used to convert each key information entity and the association relationships between various key information entities in the medication knowledge graph into vector representations. Then, convert all the vector representations into Euclidean norms, and use the obtained Euclidean norms as semantic meaning amounts. Then, use existing clustering algorithms (such as hierarchical clustering) to cluster all the semantic meaning amounts, so as to obtain multiple data clusters. Then, calculate the distance between the cluster centers of every two data clusters, and further sum up all the obtained distances, and use the obtained sum value as the semantic feature of the medication knowledge graph. In other embodiments, other methods can also be used to implement this, which will not be elaborated here.

[0058] When specifically implemented, to determine the semantic coherence degree of each dialogue keyword in the current Q&A scenario based on the semantic change amount of each dialogue keyword in the current Q&A scenario and the semantic feature of each medication knowledge graph, the following method can be used, that is: multiply the semantic change amount of each dialogue keyword in the current Q&A scenario by the semantic feature of each medication knowledge graph respectively, and then sum up the multiplied values, and use the obtained sum value as the semantic coherence degree of each dialogue keyword in the current Q&A scenario. In other embodiments, other methods can also be used to implement this, which is not limited here.

[0059] It should be noted that the semantic coherence degree described in this application represents the degree of semantic coherence between the current dialogue and each historical dialogue. The greater the semantic coherence degree, the higher the degree of semantic coherence between the dialogue and each historical dialogue in the current Q&A scenario, and vice versa.

[0060] In step 105, according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario and the inference chain of medication knowledge in the medication Q&A process, determine the context correlation information of the dialogue instruction in the current Q&A scenario, and generate a medication answer for the dialogue instruction in the current Q&A scenario based on the context correlation information and the large language model.

[0061] In some embodiments, determining the context correlation information of the dialogue instruction in the current Q&A scenario according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario and the inference chain of medication knowledge in the medication Q&A process can be implemented by the following steps: Determine the context features of the dialogue instruction in the current Q&A scenario according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario; Determine the context correlation information of the dialogue instruction in the current Q&A scenario through the context features and the inference chain of medication knowledge in the medication Q&A process.

[0062] When specifically implemented, determining the context features of the dialogue instruction in the current Q&A scenario according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario can be implemented in the following manner, that is: select the maximum semantic coherence degree and the minimum semantic coherence degree from all semantic coherence degrees, and use the difference between the maximum semantic coherence degree and the minimum semantic coherence degree as the context features of the dialogue instruction in the current Q&A scenario. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.

[0063] It should be noted that the context features described in this application represent feature parameters that enhance the mutual connection of the current dialogue and each historical dialogue in the overall context.

[0064] When specifically implemented, determining the context correlation information of the dialogue instruction in the current Q&A scenario through the context features and the inference chain of medication knowledge in the medication Q&A process can be implemented in the following manner, that is: multiply each context feature by the weight on each inference path in the inference chain of medication knowledge, and replace the weight on each inference path in the inference chain with the multiplied value. Then, calculate the average value of the weights on all inference paths, and use the obtained average value as the inference correlation threshold. Select the edges on the inference paths whose weights are greater than or equal to the inference correlation threshold from the weights on all inference paths, and use the set composed of the element entities connected by the edges on each inference path as the context correlation information of the dialogue instruction in the current Q&A scenario. In other embodiments, other methods can also be used for implementation, which are not limited here.

[0065] It should be noted that the context-related information described in this application represents a set of information composed of the medication knowledge that is mutually related between the historical conversation and the current conversation. Among them, the context-related information is a set composed of multiple element entities.

[0066] In specific implementation, generating a medication answer for the conversation instruction in the current Q&A scenario based on the context-related information and the large language model can be achieved in the following manner, that is: taking the conversation instruction in the current Q&A scenario as the question description and inputting it into the large language model, and then obtaining the output result of the conversation instruction in the current Q&A scenario. Then, taking the names of all element entities of the context-related information as supplementary information for the conversation instruction in the current Q&A scenario, and then inputting the supplementary information into the large language model. After the large language model performs reasoning, taking the reasoning result of the large language model as the medication answer for the conversation instruction in the current Q&A scenario. In other embodiments, other methods can also be used to achieve this, which is not limited here.

[0067] In addition, on the other hand of this application, in some embodiments, this application provides an intelligent medication Q&A system based on a knowledge graph. Refer to Figure 4 , this figure is a schematic structural diagram of an intelligent medication Q&A system based on a knowledge graph according to some embodiments of this application. The intelligent medication Q&A system 400 based on a knowledge graph includes: a construction module 401, a processing module 402, and an execution module 403, which are described as follows: The construction module 401. In this application, the construction module 401 is mainly used to obtain the question instructions of the target user in different conversation rounds, and then construct a medication knowledge graph for different question instructions; The processing module 402. In this application, the processing module 402 is used to perform intention analysis on the question instructions in each conversation round based on a pre-trained large language model to obtain the intention features of the target user in each conversation round; It should be noted that in this application, the processing module 402 is also used to determine the semantic dependence relationship between each medication knowledge graph according to the semantic relevance between the question instructions in each conversation round and the semantic space of each medication knowledge graph, and determine the reasoning chain of the medication knowledge in the medication Q&A process through the semantic dependence relationship and the intention features of the target user in each conversation round; In addition, in this application, the processing module 402 is also used to extract keywords from the conversation instruction of the target user in the current Q&A scenario to obtain multiple conversation keywords, and determine the semantic coherence degree of each conversation keyword in the current Q&A scenario through all the conversation keywords and the semantic features of each medication knowledge graph; Execution module 403. In this application, the execution module 403 is mainly used to determine the context association information of the dialogue instruction in the current Q&A scenario according to the semantic coherence degree of each dialogue keyword in the current Q&A scenario and the reasoning chain of medication knowledge in the medication Q&A process, and generate a medication answer to the dialogue instruction in the current Q&A scenario based on the context association information and the large language model.

[0068] In addition, this application also provides a computer device, which includes a memory and a processor. The memory stores code, and the processor is configured to obtain the code and execute the above-mentioned intelligent medication Q&A method based on the knowledge graph.

[0069] In some embodiments, refer to Figure 5 , this figure is a schematic structural diagram of a computer device for implementing the intelligent medication Q&A method based on the knowledge graph according to some embodiments of this application. The intelligent medication Q&A method based on the knowledge graph in the above embodiments can be implemented by Figure 5 the computer device shown. The computer device 500 includes at least one processor 501, a communication bus 502, a memory 503, and at least one communication interface 504.

[0070] The processor 501 can be a general-purpose central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more for controlling the execution of the intelligent medication Q&A method based on the knowledge graph in this application.

[0071] The communication bus 502 can be used to transmit information between the above components.

[0072] The memory 503 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disks, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 503 can exist independently and be connected to the processor 501 through the communication bus 502. The memory 503 can also be integrated with the processor 501.

[0073] Among them, the memory 503 is used to store the program code for executing the solution of this application, and is controlled by the processor 501 to execute. The processor 501 is used to execute the program code stored in the memory 503. The program code can include one or more software modules. The methods described in the above method embodiments can be implemented by one or more software modules in the program code in the processor 501 and the memory 503.

[0074] The communication interface 504 uses any device such as a transceiver to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.

[0075] In a specific implementation, as an embodiment, the computer device can include multiple processors, and each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. Here, the processor can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).

[0076] The computer device described above can be a general-purpose computer device or a special-purpose computer device. In specific implementations, the computer device can be a desktop computer, a laptop computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, or an embedded device. The embodiments of the present application do not limit the type of the computer device.

[0077] In addition, the present application also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-mentioned intelligent medication Q&A method based on a knowledge graph is implemented.

[0078] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the present application.

[0079] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. An intelligent medication question-answering method based on knowledge graph, characterized in that: The steps include: Obtain the target user's question instructions in different conversation rounds, and then build a medication knowledge graph for different question instructions; Based on the pre-trained large language model, the intent of the question instruction in each dialogue round is analyzed to obtain the intent features of the target user in each dialogue round; Determine the semantic dependency between each medication knowledge graph based on the semantic relevance between question instructions in each dialogue round and the semantic space of each medication knowledge graph, and determine the reasoning chain of medication knowledge in the medication question and answer process through the semantic dependency and the intention features of the target user in each dialogue round; Extract keywords from the target user's dialogue instructions in the current question-and-answer scenario to obtain multiple dialogue keywords. Determine the semantic coherence of each dialogue keyword in the current question-and-answer scenario through all the dialogue keywords and the semantic features of each medication knowledge graph. The context-related information of the dialogue instructions in the current question-and-answer scenario is determined according to the semantic coherence of each dialogue keyword in the current question-and-answer scenario and the reasoning chain of medication knowledge in the medication question-and-answer process, and the medication answer of the dialogue instructions in the current question-and-answer scenario is generated based on the context-related information and the large language model.

2. The method according to claim 1, characterized in that Based on the pre-trained large language model, the intent of the question instruction in each dialogue round is analyzed to obtain the target user's intent features in each dialogue round, including: Select a dialogue turn as the selected dialogue turn; Extract multiple intent keywords from the question instructions in the selected dialogue turn based on the pre-trained large language model; Extract the dependency relationship between every two intent keywords to obtain the dependency relationship between every two intent keywords; Determine the target user's intention characteristics in the selected conversation turn based on the dependency relationship between every two intention keywords; Continue to determine the target user's intent characteristics for the remaining conversation turns.

3. The method according to claim 1, characterized in that The semantic dependency relationship between each medication knowledge graph is determined based on the semantic relevance between the question instructions in each dialogue round and the semantic space of each medication knowledge graph, including: Determine a dependency graph of the question instructions in each dialogue round according to the semantic relevance between the question instructions in each dialogue round and multiple intention keywords of the question instructions in each dialogue round; The semantic dependency relationship between each medication knowledge graph is determined through the semantic space of each medication knowledge graph and the dependency graph of question instructions in each dialogue round.

4. The method according to claim 1, characterized in that The reasoning chain of medication knowledge in the medication question-answering process is determined by the semantic dependency relationship and the intention features of the target user in each dialogue round, including: Obtain the medication knowledge graph of the question instructions in each dialogue round, and then perform factor analysis on all medication knowledge graphs to obtain the logical factor graph of medication knowledge in the medication question and answer process; Determine the reasoning path of medication knowledge in each dialogue round based on the logical element map of medication knowledge in the medication question-answering process and the intention characteristics of the target user in each dialogue round; The reasoning chain of medication knowledge in the medication question and answer process is determined through the reasoning path of medication knowledge in each dialogue round and the semantic dependency relationship.

5. The method according to claim 1, characterized in that Keyword extraction is performed on the target user's dialogue instructions in the current question-and-answer scenario to obtain multiple dialogue keywords, including: Based on the large language model, semantic enhancement is performed on the dialogue instructions of the target user in the current question-answering scenario to obtain semantic enhancement features of the dialogue instructions of the target user in the current question-answering scenario; Key information is extracted from the target user's dialogue instructions in the current question-answering scenario according to the semantic enhancement features to obtain a plurality of dialogue keywords.

6. The method according to claim 1, characterized in that The semantic coherence of each conversation keyword in the current question-answering scenario is determined through the semantic features of all conversation keywords and each medication knowledge graph, including: Determine the semantic change of each conversation keyword in the current question-answering scenario based on all conversation keywords and all intent keywords; The semantic coherence of each conversation keyword in the current question-and-answer scenario is determined by the semantic change of each conversation keyword in the current question-and-answer scenario and the semantic features of each medication knowledge graph.

7. The method according to claim 1, characterized in that The contextual information of the dialogue instructions in the current question-and-answer scenario is determined based on the semantic coherence of each dialogue keyword in the current question-and-answer scenario and the reasoning chain of medication knowledge in the medication question-and-answer process, including: Determine the contextual features of the dialogue instructions in the current question-answering scenario based on the semantic coherence of each dialogue keyword in the current question-answering scenario; The contextual association information of the dialogue instructions in the current question-and-answer scenario is determined through the contextual features and the reasoning chain of medication knowledge in the medication question-and-answer process.

8. An intelligent medication question-answering system based on knowledge graph, characterized in that: include: A construction module is used to obtain the question instructions of the target user in different conversation rounds, and then construct the medication knowledge graph of different question instructions; The processing module is used to analyze the intent of the question instructions in each dialogue round based on the pre-trained large language model to obtain the intent features of the target user in each dialogue round; The processing module is further used to determine the semantic dependency between each medication knowledge graph according to the semantic relevance between the question instructions in each dialogue round and the semantic space of each medication knowledge graph, and determine the reasoning chain of medication knowledge in the medication question and answer process through the semantic dependency and the intention characteristics of the target user in each dialogue round; The processing module is further used to extract keywords from the dialogue instructions of the target user in the current question-answering scenario to obtain multiple dialogue keywords, and determine the semantic coherence of each dialogue keyword in the current question-answering scenario through all the dialogue keywords and the semantic features of each medication knowledge graph; An execution module is used to determine the context-related information of the dialogue instructions in the current question-and-answer scenario based on the semantic coherence of each dialogue keyword in the current question-and-answer scenario and the reasoning chain of medication knowledge in the medication question-and-answer process, and generate medication answers for the dialogue instructions in the current question-and-answer scenario based on the context-related information and the large language model.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the intelligent medication question-and-answer method based on the knowledge graph described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the intelligent medication question-and-answer method based on a knowledge graph as described in any one of claims 1 to 7 is implemented.