Intelligent query and answer system and method for traditional Chinese medicine based on knowledge graph

By constructing a traditional Chinese medicine knowledge graph and using graph algorithms, the problem of obtaining traditional Chinese medicine knowledge is solved, the efficiency and accuracy of intelligent query and question-answering of traditional Chinese medicine are achieved, and users' precise needs for traditional Chinese medicine information are met.

CN118349657BActive Publication Date: 2024-09-27HUNAN VOCATIONAL COLLEGE OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410540264.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-30
Publication Date
2024-09-27
Estimated Expiration
2044-04-30

AI Technical Summary

Technical Problem

It is difficult to achieve efficient and accurate acquisition of traditional Chinese medicine knowledge, and traditional search methods cannot meet users' precise and comprehensive needs for traditional Chinese medicine-related information, especially because the complexity, diversity, and ambiguity of traditional Chinese medicine knowledge increase the difficulty of obtaining information.

Method used

Based on knowledge graph and deep learning technology, we collect and organize data related to traditional Chinese medicine, construct a traditional Chinese medicine knowledge graph, and use graph algorithm to traverse to find the matching results of user query requests and generate answers in natural language form.

Benefits of technology

It improves the efficiency and accuracy of traditional Chinese medicine related information query, realizes intelligent query and question and answer, and meets users' precise and comprehensive needs for traditional Chinese medicine knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118349657B
    Figure CN118349657B
Patent Text Reader

Abstract

The present application relates to the field of intelligent question-answering technology, and specifically discloses a Chinese medicine intelligent query question-answering system and method based on a knowledge graph, which combines knowledge graphs and deep learning technology to collect and organize Chinese medicine-related data, extract Chinese medicine-related entities and Chinese medicine-related relationships to construct a Chinese medicine knowledge graph, and then, when a user inputs a query request, the query entity input by the user is traversed in the Chinese medicine knowledge graph to find a query result that matches the user's query request, and generates an answer in natural language form and returns it to the user. In this way, intelligent query and question-answering of Chinese medicine-related data are realized, and the efficiency and accuracy of users' query of Chinese medicine-related information are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent question-answering technology, and more specifically, to a knowledge graph-based intelligent query and answering system and method for traditional Chinese medicine. Background Art

[0002] As a treasure of traditional Chinese medicine, Chinese medicine has a long history and rich theoretical system. Chinese medicine has unique therapeutic effects in adjusting the balance of yin and yang in the human body, regulating the circulation of qi and blood, and enhancing immunity, and has extremely high research and promotion value. However, with the continuous accumulation and updating of Chinese medicine knowledge, how users can efficiently and accurately obtain Chinese medicine knowledge is also facing challenges.

[0003] The knowledge of traditional Chinese medicine is not simply piled up, but involves multiple aspects such as medicinal materials, prescriptions, efficacy and main indications. However, traditional search methods can often only provide simple keyword matching, such as through traditional search engines such as traditional Chinese medicine websites and Baidu. Although this method can provide users with a large amount of information, this information is often huge and lacks pertinence. In addition, due to the complexity, diversity and ambiguity of traditional Chinese medicine knowledge, it involves multiple aspects such as the nature, taste, meridians, efficacy, main indications, usage and dosage of medicinal materials, making it difficult for users to quickly and accurately obtain the required information. In addition, due to the wide variety of traditional Chinese medicines, phenomena such as the same name but different objects and the same object but different names often occur, which further increases the difficulty of knowledge acquisition and makes it difficult to meet users' needs for accurate and comprehensive information.

[0004] Therefore, we look forward to an optimized knowledge graph-based intelligent query and answer system and method for traditional Chinese medicine. Summary of the invention

[0005] In order to solve the above technical problems, the present application is proposed. The embodiment of the present application provides a knowledge graph-based intelligent query and question-answering system and method for traditional Chinese medicine, which combines knowledge graph and deep learning technology to collect and organize traditional Chinese medicine related data, extract traditional Chinese medicine related entities and traditional Chinese medicine related relationships to construct a traditional Chinese medicine knowledge graph, and then, when a user inputs a query request, the query entity input by the user is traversed in the traditional Chinese medicine knowledge graph to find a query result that matches the user's query request, and generates an answer in natural language form and returns it to the user. In this way, intelligent query and question-answering of traditional Chinese medicine related data are realized, and the efficiency and accuracy of users' query of traditional Chinese medicine related information are improved.

[0006] Accordingly, according to one aspect of the present application, a method for intelligent query and answering of traditional Chinese medicine based on knowledge graph is provided, which comprises:

[0007] Collecting data related to traditional Chinese medicine, including the efficacy, main indications, usage and dosage, precautions for use and modern research of traditional Chinese medicines and prescriptions;

[0008] Preprocessing the Chinese medicine related data using natural language processing technology to extract Chinese medicine related entities and Chinese medicine related relationships from the Chinese medicine related data;

[0009] Using a graph database, the Chinese medicine related entities and the Chinese medicine related relationships are processed to obtain a Chinese medicine knowledge graph;

[0010] Receive user inquiries;

[0011] extracting a query entity from the user query;

[0012] Using a graph algorithm to traverse the traditional Chinese medicine knowledge graph to obtain a query result that matches the query entity;

[0013] Based on the query results, an answer in natural language form is generated.

[0014] In the above-mentioned knowledge graph-based intelligent query and answer method for traditional Chinese medicine, a graph algorithm is used to traverse the traditional Chinese medicine knowledge graph to obtain a query result that matches the query entity, including: extracting a first alternative traditional Chinese medicine related entity from the traditional Chinese medicine knowledge graph; passing the first alternative traditional Chinese medicine related entity and the query entity through an entity semantic editor including a word embedding layer to obtain a first alternative traditional Chinese medicine related entity semantic encoding feature vector and a query entity semantic encoding feature vector; using a feature semantic granularity association encoder to perform semantic association encoding on the first alternative traditional Chinese medicine related entity semantic encoding feature vector and the query entity semantic encoding feature vector to obtain an alternative entity-query entity semantic association feature matrix; performing position-sensitive distributed response stacking optimization on the alternative entity-query entity semantic association feature matrix to obtain an optimized alternative entity-query entity semantic association feature matrix; and determining the query result based on the optimized alternative entity-query entity semantic association feature matrix.

[0015] In the above-mentioned knowledge graph-based intelligent query and answering method for traditional Chinese medicine, a feature semantic granularity association encoder is used to perform semantic association encoding on the first alternative traditional Chinese medicine-related entity semantic encoding feature vector and the query entity semantic encoding feature vector to obtain an alternative entity-query entity semantic association feature matrix, including: performing vector transposition on the query entity semantic encoding feature vector to obtain a transposed query entity semantic encoding feature vector; calculating the vector product between the transposed query entity semantic encoding feature vector and the first alternative traditional Chinese medicine-related entity semantic encoding feature vector to obtain the alternative entity-query entity semantic association feature matrix.

[0016] In the above-mentioned knowledge graph-based intelligent query and answer method for traditional Chinese medicine, the candidate entity-query entity semantic association feature matrix is ​​subjected to position-sensitive distributed response stacking optimization to obtain an optimized candidate entity-query entity semantic association feature matrix, including: using a position sensitivity function to determine the position sensitivity value of each position in the candidate entity-query entity semantic association feature matrix to obtain a position sensitivity feature matrix; expanding the candidate entity-query entity semantic association feature matrix and the position sensitivity feature matrix into a candidate entity-query entity semantic association feature vector and a position sensitivity feature vector, respectively; using a distributed response stacking optimization formula to process the candidate entity-query entity semantic association feature vector and the position sensitivity feature vector to obtain an optimized candidate entity-query entity semantic association feature vector; and reconstructing the dimension of the optimized candidate entity-query entity semantic association feature vector to obtain the optimized candidate entity-query entity semantic association feature matrix.

[0017] In the above-mentioned intelligent query and answer method of traditional Chinese medicine based on knowledge graph, the position sensitivity function is: y=1+0.5*sin(2πx), wherein x represents each position in the candidate entity-query entity semantic association feature matrix, and y represents the position sensitivity value.

[0018] In the above-mentioned intelligent query and answer method for traditional Chinese medicine based on knowledge graph, the distribution response stacking optimization formula is:

[0019]

[0020] Where v1 represents the semantic association feature vector between candidate entity and query entity, v2 represents the position-sensitivity feature vector, (·) T represents the transpose of the eigenvector, ||·||L2 2 represents the square of the L2 norm of the feature vector, * represents the element-by-element multiplication processing, - represents the element-by-element subtraction processing, + represents the element-by-element addition processing, and f(v1, v2) represents the optimized candidate entity-query entity semantic association feature vector.

[0021] In the above-mentioned intelligent query and answer method for traditional Chinese medicine based on knowledge graph, a position sensitivity function is used to determine the position sensitivity value of each position in the candidate entity-query entity semantic association feature matrix to obtain the position sensitivity feature matrix, including: creating a first Spring Boot application, wherein the Spring Boot application includes a controller class and a service class for calculating the position sensitivity value; defining a first controller class, wherein the first controller class includes an endpoint to accept the candidate entity-query entity semantic association feature matrix and return the position sensitivity feature matrix. Creating a first service class, wherein the first service class includes a method for calculating the position sensitivity value; configuring Spring Web in the Spring Boot configuration file, including endpoint mapping and JSON serialization; deploying the first Spring Boot application to a Web server.

[0022] In the above-mentioned intelligent query and answer method for traditional Chinese medicine based on knowledge graph, the query result is determined based on the optimized candidate entity-query entity semantic association feature matrix, including: passing the optimized candidate entity-query entity semantic association feature matrix through a classifier based on a support vector machine to obtain a classification result, and the classification result is used to indicate whether the matching degree between the two exceeds a predetermined threshold; in response to the classification result that the matching degree between the two exceeds a predetermined threshold, the first alternative traditional Chinese medicine related entity and the traditional Chinese medicine related relationship associated with the first alternative traditional Chinese medicine related entity are used as the query result.

[0023] According to another aspect of the present application, a knowledge graph-based intelligent Chinese medicine query and answer system is provided, which includes:

[0024] A Chinese medicine related data collection module is used to collect Chinese medicine related data, including the efficacy, main indications, usage and dosage, usage precautions and modern research of Chinese medicinal materials and prescriptions;

[0025] A natural language processing module, used for preprocessing the traditional Chinese medicine related data using natural language processing technology to extract traditional Chinese medicine related entities and traditional Chinese medicine related relationships from the traditional Chinese medicine related data;

[0026] A Chinese medicine knowledge graph construction module is used to process the Chinese medicine related entities and the Chinese medicine related relationships using a graph database to obtain a Chinese medicine knowledge graph;

[0027] User query acquisition module, used to receive user queries;

[0028] A query entity extraction module, used to extract query entities from the user query;

[0029] A knowledge graph traversal module, used to traverse the traditional Chinese medicine knowledge graph using a graph algorithm to obtain a query result matching the query entity;

[0030] The answer generation module is used to generate an answer in natural language based on the query result.

[0031] Compared with the prior art, the intelligent query and question-answering system and method for Chinese medicine based on knowledge graph provided by the present application collects and organizes Chinese medicine related data by combining knowledge graph and deep learning technology, extracts Chinese medicine related entities and Chinese medicine related relationships to construct Chinese medicine knowledge graph, and then, when the user inputs a query request, the query entity input by the user is traversed in the Chinese medicine knowledge graph to find the query result matching the user's query request, and generates an answer in natural language form and returns it to the user. In this way, intelligent query and question-answering of Chinese medicine related data are realized, and the efficiency and accuracy of users' query of Chinese medicine related information are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] By describing the embodiments of the present application in more detail in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present application will become more apparent. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.

[0033] Figure 1 It is a flowchart of the intelligent query and answer method of traditional Chinese medicine based on knowledge graph according to an embodiment of the present application.

[0034] Figure 2 The present invention is a flowchart of using a graph algorithm to traverse the traditional Chinese medicine knowledge graph to obtain a query result that matches the query entity in the traditional Chinese medicine intelligent query and answer method based on the knowledge graph according to an embodiment of the present application.

[0035] Figure 3 The present invention is a schematic diagram of an architecture for using a graph algorithm to traverse the traditional Chinese medicine knowledge graph to obtain a query result that matches the query entity in the traditional Chinese medicine intelligent query and answer method based on the knowledge graph according to an embodiment of the present application.

[0036] Figure 4 The present invention is a flowchart for determining the query result based on the optimized candidate entity-query entity semantic association feature matrix in the knowledge graph-based intelligent query and answer method for traditional Chinese medicine according to an embodiment of the present application.

[0037] Figure 5 It is a block diagram of a traditional Chinese medicine intelligent query and answer system based on a knowledge graph according to an embodiment of the present application. DETAILED DESCRIPTION

[0038] To facilitate the understanding of the embodiments of the present invention, the specific embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the specific embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.

[0039] Figure 1 FIG. 1 is a flow chart of a method for intelligent query and answering questions of traditional Chinese medicine based on a knowledge graph according to an embodiment of the present application. Figure 1 As shown, according to the embodiment of the present application, the intelligent query and answer method for traditional Chinese medicine based on the knowledge graph includes the following steps: S110, collecting traditional Chinese medicine related data, wherein the traditional Chinese medicine related data includes the efficacy, main indications, usage and dosage, usage precautions and modern research of Chinese medicinal materials and prescriptions; S120, using natural language processing technology to pre-process the traditional Chinese medicine related data to extract traditional Chinese medicine related entities and traditional Chinese medicine related relationships from the traditional Chinese medicine related data; S130, using a graph database to process the traditional Chinese medicine related entities and the traditional Chinese medicine related relationships to obtain a traditional Chinese medicine knowledge graph; S140, receiving a user query; S150, extracting a query entity from the user query; S160, using a graph algorithm to traverse the traditional Chinese medicine knowledge graph to obtain a query result that matches the query entity; S170, generating an answer in natural language form based on the query result.

[0040] As mentioned in the above background technology, traditional search methods can often only provide simple keyword matching, and the information provided is often huge in quantity and lacks pertinence. In addition, due to the complexity, diversity and fuzziness of Chinese medicine knowledge, the difficulty of knowledge acquisition is further increased, making it difficult for users to quickly and accurately obtain the required information. In view of the above technical problems, the technical concept of the present application is to collect and organize Chinese medicine related data in combination with knowledge graph and deep learning technology, extract Chinese medicine related entities and Chinese medicine related relationships to construct Chinese medicine knowledge graph, and then, when the user inputs a query request, the query entity based on the user input is traversed in the Chinese medicine knowledge graph to find the query result that matches the user's query request, and generate an answer in natural language form to return to the user. In this way, intelligent query and question-answering of Chinese medicine related data are realized, and the efficiency and accuracy of user query of Chinese medicine related information are improved.

[0041] In the above-mentioned intelligent query and answer method for traditional Chinese medicine based on knowledge graph, the step S110 collects data related to traditional Chinese medicine, and the data related to traditional Chinese medicine includes the efficacy, main indications, usage and dosage, usage precautions and modern research of traditional Chinese medicine materials and prescriptions. It should be understood that the relevant knowledge of traditional Chinese medicine involves multiple aspects such as the nature and taste of medicinal materials, meridians, efficacy and main indications, usage and dosage. Therefore, in order to build a complete and accurate traditional Chinese medicine knowledge graph, it is necessary to collect comprehensive data related to traditional Chinese medicine, such as the efficacy, main indications, usage and dosage, usage precautions and modern research of traditional Chinese medicine materials and prescriptions. Specifically, the information of traditional Chinese medicine materials includes basic information such as the names and nature and taste of various traditional Chinese medicines. The prescription data contains the name, composition of the medicinal materials, usage and dosage of the classic traditional Chinese medicine prescriptions. The efficacy and main indications information is used to describe the therapeutic effect and the symptoms of the disease targeted by the medicinal materials or prescriptions in traditional Chinese medicine theory. In other words, the efficacy, main indications, usage and dosage, usage precautions and modern research of traditional Chinese medicine materials and prescriptions are the basis for building the knowledge graph of traditional Chinese medicine. Based on this, in the technical solution of this application, by collecting the efficacy, main indications, usage and dosage, usage precautions and modern research of Chinese herbal medicines and prescriptions, the completeness and accuracy of the Chinese herbal medicine knowledge map are ensured, and the system's ability to accurately respond to user queries is improved. In addition, when collecting the Chinese herbal medicine related data, various channels such as public publications, professional databases, and medical records of medical institutions can be used to ensure the accuracy and authority of the data.

[0042] In the above-mentioned Chinese medicine intelligent query and answer method based on knowledge graph, the step S120 uses natural language processing technology to pre-process the Chinese medicine related data to extract Chinese medicine related entities and Chinese medicine related relationships from the Chinese medicine related data. It should be understood that Chinese medicine related entities refer to the basic elements in the Chinese medicine knowledge graph, such as the name of Chinese medicinal materials, the name of prescriptions, etc. Chinese medicine related relationships describe the relationship between these entities, such as the composition relationship between Chinese medicinal materials and prescriptions, the association relationship between Chinese medicinal materials and efficacy, etc. In the technical solution of the present application, in order to extract Chinese medicine related entities and Chinese medicine related relationships from the Chinese medicine related data, natural language processing technology is further used to pre-process the Chinese medicine related data. Specifically, first, the key entities in the Chinese medicine related data, such as the name of medicinal materials, the name of prescriptions, etc., can be identified by named entity recognition technology, laying the foundation for constructing a knowledge graph. At the same time, relationship extraction technology can also be used to identify the relationship between entities, such as what efficacy a certain medicinal material has, what disease a certain prescription can treat, etc., so as to establish connections between entities and enrich the content of the knowledge graph.

[0043] Here, we provide a specific example of using natural language processing technology to extract the efficacy of Chinese herbal medicine and prescriptions for treating diseases from text. The example text is: Ginseng has the effects of greatly replenishing vital energy, restoring pulse and consolidating deficiency, replenishing spleen and lung, promoting fluid and nourishing blood, calming the mind and improving intelligence. Ginseng is often used to treat symptoms such as physical weakness and weakness, cold limbs and weak pulse, spleen deficiency and poor appetite, lung deficiency and wheezing and coughing, and thirst due to fluid loss. Ginseng prescriptions such as "Ginseng Yangrong Decoction" can be used to treat symptoms such as spleen and lung qi deficiency, insufficient blood, palpitations and forgetfulness, night sweats and fever, and poor appetite. First, in the preprocessing step, text cleaning is used to remove punctuation marks in the text and convert all text into a unified character encoding. Then, the text is decomposed into words through word segmentation, such as "ginseng", "has", "greatly replenishing vital energy", etc. Then, through named entity recognition, we get "name of medicinal material: ginseng", "name of prescription: ginseng nourishing soup", and then through relationship extraction, we get "relationship between medicinal material and efficacy: ginseng - greatly replenishes vital energy, restores pulse and consolidates collapse, nourishes spleen and lungs, produces body fluid and nourishes blood, calms the mind and improves intelligence", "relationship between medicinal material and treatment symptoms: ginseng - physical weakness and collapse, cold limbs and weak pulse, spleen deficiency and poor appetite, lung deficiency and wheezing and coughing, loss of body fluid and thirst", "relationship between prescription and treatment symptoms: ginseng nourishing soup - treats spleen and lung qi deficiency, insufficient blood, palpitations and forgetfulness, night sweats and fever, and poor appetite". The extracted information is then stored in a structured database to facilitate the construction and query of knowledge graphs.

[0044] In the above-mentioned intelligent query and answer method of traditional Chinese medicine based on knowledge graph, the step S130 uses a graph database to process the traditional Chinese medicine related entities and the traditional Chinese medicine related relationships to obtain a traditional Chinese medicine knowledge graph. It should be understood that a graph database is a database specifically used to store and operate graph structure data, which can effectively store and process graph structure data composed of nodes (traditional Chinese medicine related entities) and edges (traditional Chinese medicine related relationships). In the technical solution of the present application, by storing the traditional Chinese medicine related entities and the traditional Chinese medicine related relationships in a graph database, a complete traditional Chinese medicine knowledge graph can be constructed, which clearly shows the association between different entities, presents the complexity and diversity of traditional Chinese medicine knowledge, and provides a data basis for subsequent intelligent query and question and answer. In addition, the graph database has efficient graph query and graph analysis capabilities, which can quickly query and analyze the information in the traditional Chinese medicine knowledge graph, so that users can easily obtain and understand traditional Chinese medicine related knowledge, and improve user query efficiency and accuracy.

[0045] In the above-mentioned intelligent query and answer method of traditional Chinese medicine based on knowledge graph, the step S140 receives user queries. It should be understood that user queries are the main way to trigger information retrieval and return relevant information. By receiving user queries, the user's needs can be understood, and then search and match are performed in the traditional Chinese medicine knowledge graph according to the user's needs to provide accurate answers to the user. In a specific embodiment of the present application, a user can initiate a query request by entering a query statement in natural language. For example, a user can enter a query statement such as "What are the traditional Chinese medicines for treating colds?"

[0046] In the above-mentioned intelligent query and answer method of traditional Chinese medicine based on knowledge graph, the step S150 extracts the query entity from the user query. It should be understood that the query entity is the key information in the user query and is the basis for information search and matching. In the technical solution of the present application, by extracting the query entity from the user query, the user's needs can be better understood, the subject or object that the user is concerned about can be grasped more accurately, and then the entities and relationships related to the user query can be found in the traditional Chinese medicine knowledge graph, so as to provide more relevant and targeted answers. In a specific embodiment of the present application, the user query can be parsed and analyzed using natural language processing technology to extract the key entities therein. For example, for a query statement such as "What are the traditional Chinese medicines for treating colds?" input by the user, the two key entities of "cold" and "traditional Chinese medicine" can be extracted as the basis for subsequent search and matching in the knowledge graph.

[0047] In the above-mentioned intelligent query and answer method for traditional Chinese medicine based on knowledge graph, the step S160 uses a graph algorithm to traverse the traditional Chinese medicine knowledge graph to obtain a query result that matches the query entity. It should be understood that a graph algorithm is an algorithm for searching and matching information in graph data, which can efficiently process graph structure data and mine associations and paths between nodes. In the technical solution of the present application, by using a graph algorithm to traverse the traditional Chinese medicine knowledge graph, it is possible to find the association path between the query entity and each traditional Chinese medicine-related entity, quickly find the traditional Chinese medicine-related entities and traditional Chinese medicine-related relationships that match the query entity, generate query results related to user needs, and provide users with more comprehensive and in-depth traditional Chinese medicine information.

[0048] Figure 2 The present invention is a flowchart of using a graph algorithm to traverse the traditional Chinese medicine knowledge graph to obtain a query result that matches the query entity in the traditional Chinese medicine intelligent query and answer method based on the knowledge graph according to an embodiment of the present application. Figure 3 The present invention is a schematic diagram of an architecture for using a graph algorithm to traverse the Chinese medicine knowledge graph to obtain a query result matching the query entity in the Chinese medicine intelligent query and answer method based on the knowledge graph according to an embodiment of the present application. Figure 2 and Figure 3 As shown, the step S160 includes: S161, extracting a first alternative Chinese medicine related entity from the Chinese medicine knowledge graph; S162, passing the first alternative Chinese medicine related entity and the query entity through an entity semantic editor including a word embedding layer to obtain a first alternative Chinese medicine related entity semantic encoding feature vector and a query entity semantic encoding feature vector; S163, using a feature semantic granularity association encoder to perform semantic association encoding on the first alternative Chinese medicine related entity semantic encoding feature vector and the query entity semantic encoding feature vector to obtain an alternative entity-query entity semantic association feature matrix; S164, performing position-sensitive distributed response stacking optimization on the alternative entity-query entity semantic association feature matrix to obtain an optimized alternative entity-query entity semantic association feature matrix; S165, determining the query result based on the optimized alternative entity-query entity semantic association feature matrix.

[0049] Specifically, the step S161 extracts the first alternative TCM-related entity from the TCM knowledge graph. That is, each node (TCM-related entity) in the TCM knowledge graph is used as an alternative TCM-related entity, and the degree of association between the alternative TCM-related entity and the query entity is calculated to determine whether it matches the user's needs, thereby screening out the alternative TCM-related entities that meet the user's needs.

[0050] Specifically, in step S162, the first alternative TCM-related entity and the query entity are passed through an entity semantic editor including a word embedding layer to obtain a semantically encoded feature vector of the first alternative TCM-related entity and a semantically encoded feature vector of the query entity. It should be understood that the word embedding layer is a technology for converting text data into a vector representation, which can map words in the text into a high-dimensional space and retain the semantic relationship between words. In the technical solution of the present application, the first alternative TCM-related entity and the query entity are processed using an entity semantic editor including a word embedding layer, which can convert the first alternative TCM-related entity and the query entity from complex text structure data into a vector representation, and effectively capture the semantic feature information of the first alternative TCM-related entity and the query entity, so as to facilitate subsequent semantic association encoding and feature matching processing.

[0051] Specifically, in step S163, the semantic encoding feature vector of the first alternative TCM-related entity and the semantic encoding feature vector of the query entity are semantically associated with each other using a feature semantic granularity association encoder to obtain an alternative entity-query entity semantic association feature matrix. It should be understood that the semantic encoding feature vector of the first alternative TCM-related entity and the semantic encoding feature vector of the query entity respectively represent the feature representations of the first alternative TCM-related entity and the query entity in the semantic space, in order to mine the potential semantic association relationship between the first alternative TCM-related entity and the query entity to evaluate the degree of semantic matching between the two. In the technical solution of the present application, the semantic encoding feature vector of the first alternative TCM-related entity and the semantic encoding feature vector of the query entity are semantically associated with each other using a feature semantic granularity association encoder to effectively capture and integrate semantic information of different granularities, thereby obtaining an alternative entity-query entity semantic association feature matrix, which is used to describe the degree of association between the first alternative TCM-related entity and the query entity in the semantic space, and provides an important basis for determining subsequent query results.

[0052] In a specific example of the present application, the step S163 includes: performing a vector transposition on the query entity semantic encoding feature vector to obtain a transposed query entity semantic encoding feature vector; calculating the vector product between the transposed query entity semantic encoding feature vector and the first alternative Chinese medicine-related entity semantic encoding feature vector to obtain the alternative entity-query entity semantic association feature matrix.

[0053] Specifically, the step S164 performs a position-sensitive distribution response stacking optimization on the candidate entity-query entity semantic association feature matrix to obtain an optimized candidate entity-query entity semantic association feature matrix. It should be understood that, considering that the first candidate TCM-related entity and the query entity come from different data sources, there may be certain semantic feature differences and position sensitivity in the semantic space, which leads to the problem of uneven distribution of semantic association features or insufficient response due to position sensitivity in the candidate entity-query entity semantic association feature matrix obtained after the semantic association encoding of the first candidate TCM-related entity semantic encoding feature vector and the query entity semantic encoding feature vector. In order to solve this problem, in the technical solution of the present application, the candidate entity-query entity semantic association feature matrix is ​​further optimized by a position-sensitive distribution response stacking optimization to consider the dependency between different positions, and by adjusting and optimizing the distribution of semantic association features in the candidate entity-query entity semantic association feature matrix, it can more accurately reflect the semantic association relationship between the first candidate TCM-related entity and the query entity, so as to improve the accuracy and efficiency of the query.

[0054] Specifically, the step S164 includes: using a position sensitivity function to determine the position sensitivity value of each position in the candidate entity-query entity semantic association feature matrix to obtain a position sensitivity feature matrix; expanding the candidate entity-query entity semantic association feature matrix and the position sensitivity feature matrix into a candidate entity-query entity semantic association feature vector and a position sensitivity feature vector, respectively; using a distributed response stacking optimization formula to process the candidate entity-query entity semantic association feature vector and the position sensitivity feature vector to obtain an optimized candidate entity-query entity semantic association feature vector; and reconstructing the dimension of the optimized candidate entity-query entity semantic association feature vector to obtain the optimized candidate entity-query entity semantic association feature matrix.

[0055] More specifically, the position sensitivity function is: y=1+0.5*sin(2πx), wherein x represents each position in the candidate entity-query entity semantic association feature matrix, and y represents the position sensitivity value.

[0056] More specifically, the distributed response stacking optimization formula is:

[0057]

[0058] Where v1 represents the semantic association feature vector between candidate entity and query entity, v2 represents the position-sensitivity feature vector, (·) T represents the transpose of the eigenvector, ||·|| L2 2 represents the square of the L2 norm of the feature vector, * represents the element-by-element multiplication processing, - represents the element-by-element subtraction processing, + represents the element-by-element addition processing, and f(v1, v2) represents the optimized candidate entity-query entity semantic association feature vector.

[0059] In response to the above problems, in the technical solution of the present application, the sensitivity of different positions is quantified by calculating the positional sensitivity value of each position in the candidate entity-query entity semantic association feature matrix to obtain a positional sensitivity matrix. Then, the candidate entity-query entity semantic association feature matrix and the positional sensitivity feature matrix are respectively expanded into vector forms, and the distributed response stacking optimization is performed on each position of the candidate entity-query entity semantic association feature vector based on the expanded positional sensitivity vector, so that it can more accurately reflect the semantic association information between the first alternative Chinese medicine-related entity and the query entity, thereby achieving more accurate semantic matching. Finally, the optimized candidate entity-query entity semantic association feature vector is dimensionally reconstructed to reorganize it into the original matrix form to achieve the correspondence of data dimensions.

[0060] In a specific example of the present application, a location sensitivity function is used to determine the location sensitivity value of each position in the candidate entity-query entity semantic association feature matrix to obtain the location sensitivity feature matrix, including: creating a first Spring Boot application, wherein the Spring Boot application includes a controller class and a service class for calculating location sensitivity values; defining a first controller class, wherein the first controller class includes an endpoint to accept the candidate entity-query entity semantic association feature matrix and return the location sensitivity feature matrix. Creating a first service class, wherein the first service class includes a method for calculating the location sensitivity value; configuring Spring Web in the SpringBoot configuration file, including endpoint mapping and JSON serialization; and deploying the first Spring Boot application to a Web server.

[0061] Here, the Spring Web mechanism is used to deploy the implementation of "using the position sensitivity function to determine the position sensitivity value in the candidate entity-query entity semantic association feature matrix and obtain the position sensitivity feature matrix". Specifically, Spring Web provides a convenient way to create a RESTful API, allowing client applications to communicate with the server through HTTP requests, and the client application and server implementation are loosely coupled, allowing independent development and deployment, making it easy to deploy and use the implementation. In addition, Spring Web is a lightweight framework with low resource overhead, making it very suitable for deployment in resource-constrained environments. Therefore, Spring Web applications can be deployed on various platforms such as Windows, Linux, and macOS, and can also be easily deployed to various web servers such as Apache Tomcat and Nginx. At the same time, Spring Web allows applications to be easily extended to support other functions or integrate other services, and also provides built-in security features such as cross-site request forgery (CSRF) protection and role-based access control to help protect applications from attacks. In general, the Spring Web mechanism provides a robust, extensible, and easy-to-use platform for deploying the implementation of determining the position sensitivity value in the candidate entity-query entity semantic association feature matrix using the position sensitivity function.

[0062] In a specific embodiment of the present application, the code implementation portion of "using the position sensitivity function to determine the position sensitivity value of each position in the candidate entity-query entity semantic association feature matrix to obtain the position sensitivity feature matrix" is as follows:

[0063]

[0064]

[0065] Specifically, the step S165 determines the query result based on the optimized candidate entity-query entity semantic association feature matrix. Specifically, Figure 4 The present invention is a flowchart of determining the query result based on the optimized candidate entity-query entity semantic association feature matrix in the intelligent query and answer method for traditional Chinese medicine based on the knowledge graph according to the embodiment of the present application. Figure 4 As shown, the step S165 includes: S1651, passing the optimized alternative entity-query entity semantic association feature matrix through a support vector machine-based classifier to obtain a classification result, and the classification result is used to indicate whether the matching degree between the two exceeds a predetermined threshold; S1652, in response to the classification result that the matching degree between the two exceeds a predetermined threshold, taking the first alternative Chinese medicine-related entity and the Chinese medicine-related relationship associated with the first alternative Chinese medicine-related entity as the query result.

[0066] Specifically, in step S1651, the optimized candidate entity-query entity semantic association feature matrix is ​​passed through a classifier based on a support vector machine to obtain a classification result, and the classification result is used to indicate whether the degree of match between the two exceeds a predetermined threshold. It should be understood that support vector machine (SVM) is a widely used classification algorithm that can find an optimal hyperplane in a high-dimensional space to maximize the interval between different categories, thereby achieving a classification task. In the technical solution of the present application, a classifier based on a support vector machine is used to perform feature learning and classification judgment on the semantic association features between the first alternative Chinese medicine-related entity and the query entity contained in the optimized candidate entity-query entity semantic association feature matrix, so as to evaluate the degree of match between the first alternative Chinese medicine-related entity and the query entity, and output a binary classification result to indicate whether the degree of match between the first alternative Chinese medicine-related entity and the query entity exceeds a predetermined threshold.

[0067] Specifically, in step S1652, in response to the classification result that the degree of match between the two exceeds a predetermined threshold, the first alternative Chinese medicine-related entity and the Chinese medicine-related relationship associated with the first alternative Chinese medicine-related entity are used as the query result. That is, when the support vector machine-based classifier determines that the degree of match between the first alternative Chinese medicine-related entity and the query entity exceeds a predetermined threshold, it indicates that there is a strong semantic association between the first alternative Chinese medicine-related entity and the query entity. Therefore, the first alternative Chinese medicine-related entity and the Chinese medicine-related relationship associated with it can be used as the query result to provide users with accurate Chinese medicine knowledge information.

[0068] In the above-mentioned intelligent query and answer method for traditional Chinese medicine based on knowledge graph, the step S170 generates an answer in natural language based on the query result. It should be understood that in the technical solution of the present application, the query result is converted into an answer in natural language and returned to the user, which can provide the user with intuitive and easy-to-understand query results, so that the user can intuitively obtain the required information, which is easy to understand and use, thereby improving the user's experience.

[0069] In summary, the intelligent query and question-answering method of traditional Chinese medicine based on the knowledge graph according to the embodiment of the present application is explained, which combines the knowledge graph and deep learning technology to collect and organize the data related to traditional Chinese medicine, extract the entities related to traditional Chinese medicine and the relationships related to traditional Chinese medicine to construct the knowledge graph of traditional Chinese medicine, and then, when the user inputs a query request, the query entity based on the user input is traversed in the knowledge graph of traditional Chinese medicine to find the query result that matches the user's query request, and generates an answer in natural language form and returns it to the user. In this way, intelligent query and question-answering of traditional Chinese medicine related data are realized, and the efficiency and accuracy of users' query of traditional Chinese medicine related information are improved.

[0070] Figure 5 FIG. 1 is a block diagram of a Chinese medicine intelligent query and answer system based on a knowledge graph according to an embodiment of the present application. Figure 5 As shown, according to the embodiment of the present application, the intelligent query and answer system 100 of traditional Chinese medicine based on the knowledge graph includes: a traditional Chinese medicine related data collection module 110, which is used to collect traditional Chinese medicine related data, and the traditional Chinese medicine related data includes the efficacy, main indications, usage and dosage, usage precautions and modern research of Chinese medicinal materials and prescriptions; a natural language processing module 120, which is used to use natural language processing technology to pre-process the traditional Chinese medicine related data to extract traditional Chinese medicine related entities and traditional Chinese medicine related relationships from the traditional Chinese medicine related data; a traditional Chinese medicine knowledge graph construction module 130, which is used to use a graph database to process the traditional Chinese medicine related entities and the traditional Chinese medicine related relationships to obtain a traditional Chinese medicine knowledge graph; a user query acquisition module 140, which is used to receive user queries; a query entity extraction module 150, which is used to extract query entities from the user queries; a knowledge graph traversal module 160, which is used to traverse the traditional Chinese medicine knowledge graph using a graph algorithm to obtain a query result matching the query entity; an answer generation module 170, which is used to generate an answer in natural language form based on the query result.

[0071] Here, those skilled in the art can understand that the specific operations of each module in the above-mentioned Chinese medicine intelligent query question-answering system based on knowledge graph have been referred to above. Figures 1 to 4 It has been introduced in detail in the description of the intelligent query and answering method of traditional Chinese medicine based on knowledge graph, and therefore, its repeated description will be omitted.

[0072] The basic principle of the present invention is described above in conjunction with specific embodiments. However, it should be pointed out that the advantages, strengths, effects, etc. mentioned in the present invention are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. must be possessed by each embodiment of the present invention. In addition, the specific details of the above embodiments are only for the purpose of illustration and facilitation of understanding, rather than limitation, and the above details do not limit the present invention to being implemented by adopting the above specific details.

[0073] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, please refer to the relevant description of other embodiments. In the several embodiments provided by the present invention, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiment described above is only schematic. For example, the module division is only a logical function division, and there may be other division methods in actual implementation. The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0074] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference to a figure in a claim should not be considered as limiting the claim to which it relates.

[0075] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units stated in the system claims can also be implemented by one unit through software or hardware.

[0076] Finally, it should be noted that the above description has been given for the purpose of illustration and description. In addition, the above embodiments are only used to illustrate the technical solution of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for intelligent query and answering of traditional Chinese medicine based on knowledge graph, characterized in that: include: Collecting data related to traditional Chinese medicine, including the efficacy, main indications, usage and dosage, precautions for use and modern research of traditional Chinese medicines and prescriptions; Preprocessing the Chinese medicine related data using natural language processing technology to extract Chinese medicine related entities and Chinese medicine related relationships from the Chinese medicine related data; Using a graph database, the Chinese medicine related entities and the Chinese medicine related relationships are processed to obtain a Chinese medicine knowledge graph; Receive user inquiries; extracting a query entity from the user query; Using a graph algorithm to traverse the traditional Chinese medicine knowledge graph to obtain a query result that matches the query entity; Based on the query results, generate an answer in natural language; Wherein, using a graph algorithm to traverse the traditional Chinese medicine knowledge graph to obtain a query result matching the query entity includes: Extracting a first candidate TCM-related entity from the TCM knowledge graph; The first candidate TCM-related entity and the query entity are passed through an entity semantic editor including a word embedding layer to obtain a first candidate TCM-related entity semantic encoding feature vector and a query entity semantic encoding feature vector; Using a feature semantic granularity association encoder to perform semantic association encoding on the first candidate Chinese medicine related entity semantic encoding feature vector and the query entity semantic encoding feature vector to obtain a candidate entity-query entity semantic association feature matrix; Performing position-sensitive distributed response stacking optimization on the candidate entity-query entity semantic association feature matrix to obtain an optimized candidate entity-query entity semantic association feature matrix; Determining the query result based on the optimized candidate entity-query entity semantic association feature matrix; The method of performing position-sensitive distributed response stacking optimization on the candidate entity-query entity semantic association feature matrix to obtain an optimized candidate entity-query entity semantic association feature matrix includes: Using a position sensitivity function to determine the position sensitivity value of each position in the candidate entity-query entity semantic association feature matrix to obtain a position sensitivity feature matrix; Expanding the candidate entity-query entity semantic association feature matrix and the position-sensitivity feature matrix into a candidate entity-query entity semantic association feature vector and a position-sensitivity feature vector respectively; Using a distributed response stacking optimization formula, the candidate entity-query entity semantic association feature vector and the position-sensitivity feature vector are processed to obtain an optimized candidate entity-query entity semantic association feature vector; Reconstructing the dimension of the optimized candidate entity-query entity semantic association feature vector to obtain the optimized candidate entity-query entity semantic association feature matrix; The position sensitivity function is: y=1+0.5*sin(2πx), wherein x represents each position in the candidate entity-query entity semantic association feature matrix, and y represents the position sensitivity value; The distribution response stacking optimization formula is: Where v1 represents the semantic association feature vector between candidate entity and query entity, v2 represents the position-sensitivity feature vector, (·) T represents the transpose of the eigenvector, ||·|| L2 2 represents the square of the L2 norm of the feature vector, * represents the element-by-element multiplication processing, - represents the element-by-element subtraction processing, + represents the element-by-element addition processing, and f(v1, v2) represents the optimized candidate entity-query entity semantic association feature vector.

2. The intelligent query and answer method for traditional Chinese medicine based on knowledge graph according to claim 1 is characterized in that: Using a feature semantic granularity association encoder to perform semantic association encoding on the first candidate Chinese medicine related entity semantic encoding feature vector and the query entity semantic encoding feature vector to obtain a candidate entity-query entity semantic association feature matrix, including: Performing vector transposition on the query entity semantic encoding feature vector to obtain a transposed query entity semantic encoding feature vector; The vector product between the transposed query entity semantic encoding feature vector and the first candidate Chinese medicine-related entity semantic encoding feature vector is calculated to obtain the candidate entity-query entity semantic association feature matrix.

3. The intelligent query and answer method for traditional Chinese medicine based on knowledge graph according to claim 2 is characterized in that: Using a position sensitivity function to determine the position sensitivity value of each position in the candidate entity-query entity semantic association feature matrix to obtain a position sensitivity feature matrix includes: Creating a first Spring Boot application, wherein the Spring Boot application includes a controller class and a service class for calculating a position sensitivity value; defining a first controller class, the first controller class comprising an endpoint to receive the candidate entity-query entity semantic association feature matrix and return the location-sensitivity feature matrix; Creating a first service class, wherein the first service class includes a method for calculating the position saliency value; Configure Spring Web in the Spring Boot configuration file, including endpoint mapping and JSON serialization; Deploy the first Spring Boot application to a web server.

4. The intelligent query and answer method for traditional Chinese medicine based on knowledge graph according to claim 3 is characterized in that: Determining the query result based on the optimized candidate entity-query entity semantic association feature matrix includes: The optimized candidate entity-query entity semantic association feature matrix is ​​passed through a classifier based on a support vector machine to obtain a classification result, wherein the classification result is used to indicate whether the matching degree between the two exceeds a predetermined threshold; In response to the classification result that the matching degree between the two exceeds a predetermined threshold, the first candidate Chinese medicine-related entity and the Chinese medicine-related relationship associated with the first candidate Chinese medicine-related entity are used as the query result.

5. A knowledge graph-based intelligent query and answer system for traditional Chinese medicine of the method for intelligent query and answer of traditional Chinese medicine based on knowledge graph according to claim 1, characterized in that: include: A Chinese medicine related data collection module is used to collect Chinese medicine related data, including the efficacy, main indications, usage and dosage, usage precautions and modern research of Chinese medicinal materials and prescriptions; A natural language processing module, used for preprocessing the traditional Chinese medicine related data using natural language processing technology to extract traditional Chinese medicine related entities and traditional Chinese medicine related relationships from the traditional Chinese medicine related data; A Chinese medicine knowledge graph construction module is used to process the Chinese medicine related entities and the Chinese medicine related relationships using a graph database to obtain a Chinese medicine knowledge graph; User query acquisition module, used to receive user queries; A query entity extraction module, used to extract query entities from the user query; A knowledge graph traversal module, used to traverse the traditional Chinese medicine knowledge graph using a graph algorithm to obtain a query result matching the query entity; The answer generation module is used to generate an answer in natural language based on the query result.