A Chinese medical question-answering system and method based on knowledge graph
By constructing a Chinese medical knowledge graph and question classification module, combined with template matching and semantic analysis, the problem of inaccuracy in question search and inaccurate answers in the Chinese medical field is solved, achieving more accurate and efficient medical information query, satisfying users consulting needs.
Patent Information
- Application Number
- CN202110763704.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-06
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-07-06
AI Technical Summary
Existing searches for questions in the Chinese medical field are not accurate in matching, answer returns are inaccurate, and personalized search capabilities are insufficient.
Based on the knowledge graph building module, question classification module, database query module, answer integration module and result display module, the Chinese medical knowledge graph is constructed by obtaining data from the medical encyclopedia website, identifying the subject entity, question category and type of the user's question, and converting it into a database Query statements, organize query results into natural language answers and display them visually.
It improves the accuracy of question type classification and answer precision, meets users' medical consultation needs, saves users time searching for medical information, and provides users with convenient and efficient services.
Smart Images

Figure CN113569023B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of knowledge graphs and machine learning, and more specifically to a Chinese medicine question-answering system based on a knowledge graph and a method thereof. Background Art
[0002] As people use the Internet more and more, medical big data has gradually entered people's daily lives. How to analyze large and complex data and obtain usable medical knowledge from it is the key to the practical application of medical big data. The medical question-answering system is a typical application in the medical field that understands user intentions and helps users get answers. The knowledge graph stores and processes data in the form of a graph structure, which can extract useful information from massive data and effectively process massive medical data. At present, it is difficult for web page queries to give targeted answers to medical questions raised by users, and the medical question-answering system can solve such problems.
[0003] A good question parsing algorithm is the key to the quality of the question-answering system. Common question parsing methods include template matching and semantic parsing. Template matching matches the question with the corresponding question template by matching the keywords of the question, and then queries the answer. Semantic parsing is developed based on the bidirectional encoder representation model (Bidirectional Encoder Representations from Transformers, BERT). The BERT model can generate corresponding dynamic word vectors for the same word in different contexts and has a strong semantic understanding ability. Semantic parsing uses BERT text similarity to analyze questions, and then converts it into a database query statement for answer search. Combining these two methods, a Chinese medical question-answering system based on knowledge graph and its method are provided. Summary of the invention
[0004] In order to solve the problems of inaccurate search and matching of existing Chinese medical questions, inaccurate answer returns, insufficient personalized search capabilities, and other problems, considering the knowledge connection and semantic analysis capabilities of the Chinese medical knowledge graph, the present invention provides a medical question-answering system and method based on a knowledge graph, which can more quickly and efficiently find answers to related questions in the medical field.
[0005] The technical solution adopted by the present invention to solve its technical problem is:
[0006] A Chinese medicine question-answering system and method based on knowledge graph, comprising a knowledge graph construction module, a question classification module, a database query module, an answer integration module and a result display module;
[0007] The knowledge graph construction module is used to construct a Chinese medical knowledge graph based on data obtained from the medical encyclopedia website;
[0008] The question classification module is used to identify the subject entity, question category and question type of the user's question. The question categories are factual and yes / no. The factual category is to inquire about a specific entity, such as "What medicine should I take for a cold?" This type of question gives a corresponding factual answer; the yes / no category is to inquire about the relationship between two entities, such as "Can I eat eggs when I have a cold?" This type of question gives a positive or negative answer based on the knowledge graph. There are multiple types of questions, such as asking about medication for a disease, asking about the cure time for a disease, asking about symptoms for a disease, etc.
[0009] The database query module is used to convert the result of question classification into a corresponding database query statement;
[0010] The answer integration module is used to send the database query statement into the database, organize the returned results, and assemble the query content into an answer that conforms to natural language and a corresponding visual data structure;
[0011] The result display module is used to display the front-end chat room and display the query results in text and visual graphs.
[0012] Preferably, the knowledge graph construction module includes a medical data crawling unit, a structure adjustment unit and a medical data storage unit;
[0013] The medical data crawling unit is used to crawl text data from the medical encyclopedia website on the web page and transmit it to the structure adjustment unit;
[0014] The structure adjustment unit is used to organize the text data obtained by the medical data crawling unit, convert it according to the format required by the database, split it into two types: node-corresponding node attributes and node-corresponding nodes, and store them in the database for subsequent analysis;
[0015] The medical data storage unit is used to create nodes, node attributes and relationships between nodes, store the sorted data according to a pre-designed upper structure, and generate a Chinese medical knowledge graph.
[0016] Preferably, the question classification module includes a subject entity recognition unit, a question category determination unit and a question type determination unit;
[0017] The subject entity recognition unit is used to recognize entities in the question. When parsing the user's question, an AC automaton (Aho-Corasick automaton) is used to accelerate the process of searching the subject entity dictionary. The words that appear in the question in the dictionary are extracted, and the words in the question are matched with the pre-built dictionary to recognize the subject entity of the question. When a word in these subject entities is part of another word, the shorter word is removed. For example, in the question "What disease is better for melon-simmered Chinese cabbage", the system will recognize "cabbage" and "melon-simmered Chinese cabbage". "Cabbage" is a part of "melon-simmered Chinese cabbage", so "cabbage" is removed; when the subject entity is not recognized in the question, the subject entity of the previous question will be inherited; if the current question is the first sentence and the subject entity is not recognized, a tactful answer will be given to indicate that the question is incomprehensible;
[0018] The question category determination unit is used to identify whether the question is a question of the yes-or-no type or a question of the fact type. The determination is made according to the defined rules. If two entities are identified in the question and the question contains yes-or-no keywords such as "can" and "can", it is classified as a yes-or-no type. Other cases are classified as fact types.
[0019] The question type determination unit is used to identify question types, such as questions about medication for diseases, questions about symptoms of diseases, etc. For the whether type, the question type is identified by template matching. During identification, it is determined whether the question contains keywords of a certain type of question. If it contains corresponding keywords, the question type is recorded. For the fact type, the question type is identified by BERT semantic parsing. When identifying the question type, the subject entity obtained previously is first taken out, and all candidate attributes and candidate relationships connected to the entity in the knowledge graph are sequentially spliced with the entity as a standard question. Then, the similarity between all standard questions and user questions is calculated using the BERT text similarity model, and the highest result is taken as the content to be queried, and the corresponding question type is recorded.
[0020] The BERT text similarity model requires the system to perform transfer learning on the pre-trained BERT model, and build a BERT text similarity module based on pre-collected standard questions, user questions, and similar data format training. The module can calculate the similarity of two sentences.
[0021] Preferably, the system further comprises a database query module, and the database query module is used to convert the data of the question classification module into a corresponding database query language.
[0022] Preferably, the system also includes an answer integration module, which is used to connect to the graph database, input the query statement into the database, obtain the corresponding query result, and then assemble the query content into an answer that conforms to natural language and corresponding visual data. When the question is about a disease with multiple symptoms, a set of diseases corresponding to each symptom will be generated, and then these sets will be intersected to take the repeated diseases as the final answer.
[0023] Preferably, the result display module is used for displaying medical query results, the system front end is a chat room interface, the answers are displayed in text form, and the visual data are displayed in a graph-structured picture.
[0024] A Chinese medical question answering method based on knowledge graph includes the following steps:
[0025] S1. Obtain the user's query text;
[0026] S2. Parse the user's question to obtain the subject entity, question category and question type;
[0027] S3. Perform relevant queries based on the parsing results and the pre-built Chinese medical knowledge graph to obtain query results;
[0028] S4. Organize the medical query results to form dialogue answers and visual data that conform to natural language;
[0029] S5. Present the text answers and visual data.
[0030] Furthermore, in S3, the steps of constructing the Chinese medicine knowledge graph are:
[0031] S31. Crawl medical text data from medical encyclopedia websites;
[0032] S32. Convert the crawled data into the format required by the database and organize it into a structure of node-corresponding attributes or node-corresponding nodes;
[0033] S33. Create nodes, node attributes and relationships between nodes, store the sorted data according to the pre-designed upper structure, and generate a Chinese medical knowledge graph.
[0034] The process of S2 is:
[0035] S21. Identify the subject entity of the user's question;
[0036] S22. Identify the question category of the user's question, whether it is a fact category or a yes-no category. The judgment basis is that if two entities are identified in the question and the question contains yes-no keywords, such as "can", "can", etc., it is classified as a yes-no category, and other cases are classified as fact categories;
[0037] S23. Identify the question type of the user's question. When the question is of the "yes" type, match the keywords in the question through template matching to identify the question type. When the question is of the fact type, identify the question type through BERT semantic parsing. For the subject entity of the question, all candidate attributes and candidate relationships connected to the entity in the knowledge graph are concatenated with the entity in sequence as a standard question. Then, the similarity between all standard questions and user questions is calculated using the BERT text similarity model. The one with the highest similarity is taken as the content to be queried, and the corresponding question type is recorded.
[0038] It can be seen from the above technical solution that compared with the prior art, the beneficial effects of the present invention are as follows: extracting medical information by constructing a knowledge graph, then analyzing the question by combining template matching and semantic analysis, and finally returning the dialogue answer and the visualization graph. The question is effectively analyzed, and the accuracy of question type classification and answer accuracy are improved. It meets the needs of users for medical consultation, food guides, and auxiliary diagnosis and treatment of diseases, saves users' time in searching for relevant medical information, and provides users with more convenient and efficient services. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of the overall structure of a Chinese medical question-answering system based on a knowledge graph provided by the present invention;
[0040] Figure 2 A schematic diagram of the overall process of a Chinese medical question-answering method based on a knowledge graph provided by the present invention. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] Reference Figure 1 and Figure 2 , a Chinese medicine question-answering system based on knowledge graph, including a knowledge graph construction module, a question classification module, a database query module, an answer integration module and a result display module;
[0043] The knowledge graph construction module is used to construct a Chinese medical knowledge graph based on data obtained from the medical encyclopedia website;
[0044] The question classification module is used to identify the subject entity, question category and question type of the user's question. The question categories are factual and yes / no. The factual category is to inquire about a specific entity, such as "What medicine should I take for a cold?" This type of question gives a corresponding factual answer; the yes / no category is to inquire about the relationship between two entities, such as "Can I eat eggs when I have a cold?" This type of question gives a positive or negative answer based on the knowledge graph. There are multiple types of questions, such as asking about medication for a disease, asking about the cure time for a disease, asking about symptoms for a disease, etc.
[0045] The database query module is used to convert the result of question classification into a corresponding database query statement;
[0046] The answer integration module is used to send the database query statement into the database, organize the returned results, and assemble the query content into an answer that conforms to natural language and a corresponding visual data structure;
[0047] The result display module is used to display the front-end chat room and display the query results in text and visual graphs.
[0048] Preferably, the knowledge graph construction module includes a medical data crawling unit, a structure adjustment unit, and a medical data storage unit;
[0049] The medical data crawling unit is used to crawl text data from the medical encyclopedia website on the web page and transmit it to the structure adjustment unit;
[0050] The structure adjustment unit is used to organize the text data obtained by the medical data crawling unit, convert it according to the format required by the database, split it into two types: node-corresponding node attributes and node-corresponding nodes, and store them in the database for subsequent analysis;
[0051] The medical data storage unit is used to create nodes, node attributes and relationships between nodes, store the sorted data according to a pre-designed upper structure, and generate a Chinese medical knowledge graph.
[0052] Preferably, the question classification module includes a subject entity recognition unit, a question category determination unit, and a question type determination unit;
[0053] The subject entity recognition unit is used to recognize entities in the question. When parsing the user's question, an AC automaton (Aho-Corasick automaton) is used to accelerate the process of searching the subject entity dictionary. The words that appear in the question in the dictionary are extracted, and the words in the question are matched with the pre-built dictionary to recognize the subject entity of the question. When a word in these subject entities is part of another word, the shorter word is removed. For example, in the question "What disease is better for melon-simmered Chinese cabbage", the system will recognize "cabbage" and "melon-simmered Chinese cabbage". "Cabbage" is a part of "melon-simmered Chinese cabbage", so "cabbage" is removed; when the subject entity is not recognized in the question, the subject entity of the previous question will be inherited; if the current question is the first sentence and the subject entity is not recognized, a tactful answer will be given to indicate that the question is incomprehensible;
[0054] The question category determination unit is used to identify whether the question is a question of the yes-or-no type or a question of the fact type. The determination is made according to the defined rules. If two entities are identified in the question and the question contains yes-or-no keywords such as "can" and "can", it is classified as a yes-or-no type. Other cases are classified as fact types.
[0055] The question type determination unit is used to identify question types, such as questions about medication for diseases, questions about symptoms of diseases, etc. For the whether type, the question type is identified by template matching. During identification, it is determined whether the question contains keywords of a certain type of question. If it contains corresponding keywords, the question type is recorded. For the fact type, the question type is identified by BERT semantic parsing. When identifying the question type, the subject entity obtained previously is first taken out, and all candidate attributes and candidate relationships connected to the entity in the knowledge graph are sequentially spliced with the entity as a standard question. Then, the similarity between all standard questions and user questions is calculated using the BERT text similarity model, and the highest result is taken as the content to be queried, and the corresponding question type is recorded.
[0056] The BERT text similarity model requires the system to perform transfer learning on the pre-trained BERT model, and build a BERT text similarity module based on pre-collected standard questions, user questions, and similar data format training. The module can calculate the similarity of two sentences.
[0057] Preferably, the system further comprises a database query module, and the database query module is used to convert the data of the question classification module into a corresponding database query language.
[0058] Preferably, the system also includes an answer integration module, which is used to connect to the graph database, input the query statement into the database, obtain the corresponding query result, and then assemble the query content into an answer that conforms to natural language and corresponding visual data. When the question is about a disease with multiple symptoms, a set of diseases corresponding to each symptom will be generated, and then these sets will be intersected to take the repeated diseases as the final answer.
[0059] Preferably, the result display module is used for displaying medical query results, the system front end is a chat room interface, the answers are displayed in text form, and the visual data are displayed in a graph-structured picture.
[0060] A Chinese medical question answering method based on knowledge graph includes the following steps:
[0061] S1. Obtain the user's query text;
[0062] S2. Parse the user's question to obtain the subject entity, question category, and question type;
[0063] S3. Perform relevant queries based on the parsing results and the pre-built Chinese medical knowledge graph to obtain query results;
[0064] S4. Organize the medical query results to form dialogue answers and visual data that conform to natural language;
[0065] S5. Present the text answers and visual data.
[0066] In order to further implement the above technical solution, in S3, the steps of constructing the Chinese medicine knowledge graph are as follows:
[0067] S31. Crawl medical text data from medical encyclopedia websites;
[0068] S32. Convert the crawled data into the format required by the database and organize it into a structure of node-corresponding attributes or node-corresponding nodes;
[0069] S33. Create nodes, node attributes and relationships between nodes, store the sorted data according to the pre-designed upper structure, and generate a Chinese medical knowledge graph.
[0070] In order to further implement the above technical solution, the process of S2 is:
[0071] S21. Identify the subject entity of the user's question;
[0072] S22. Identify the question category of the user's question, whether it is a fact category or a yes-no category. The judgment basis is that if two entities are identified in the question and the question contains yes-no keywords, such as "can", "can", etc., it is classified as a yes-no category, and other cases are classified as fact categories;
[0073] S23. Identify the question type of the user's question. When the question is of the "yes" type, match the keywords in the question through template matching to identify the question type. When the question is of the fact type, identify the question type through BERT semantic parsing. For the subject entity of the question, all candidate attributes and candidate relationships connected to the entity in the knowledge graph are concatenated with the entity in sequence as a standard question. Then, the similarity between all standard questions and user questions is calculated using the BERT text similarity model. The one with the highest similarity is taken as the content to be queried, and the corresponding question type is recorded.
[0074] As described above, the specific implementation steps of this patent implementation make the present invention clearer. Within the spirit of the present invention and the protection scope of the claims, any modifications and changes made to the present invention fall within the protection scope of the present invention.
Claims
1. A Chinese medical question-answering system based on knowledge graph, characterized in that: The system includes a knowledge graph construction module, a question classification module, a database query module, an answer integration module and a result display module: The knowledge graph construction module is used to construct a Chinese medical knowledge graph based on data obtained from the medical encyclopedia website; The question classification module is used to realize the recognition of the subject entity, question category and question type of the user's question, wherein the question categories are factual and yes / no. The factual category is to inquire about a specific entity, and this type of question gives a corresponding factual answer; the yes / no category is to inquire about the relationship between two entities, and this type of question gives a positive or negative answer based on the knowledge graph. The question type includes multiple categories, such as asking about medication for a disease, asking about the cure time for a disease, or asking about symptoms for a disease; The database query module is used to convert the result of question classification into a corresponding database query statement; The answer integration module is used to send the database query statement into the database, organize the returned results, and assemble the query content into an answer that conforms to natural language and a corresponding visual data structure; The result display module is used to display the front-end chat room and display the query results in text and visual graphs; The question classification module includes a subject entity recognition unit, a question category determination unit and a question type determination unit; The subject entity recognition unit is used to recognize entities in questions. When parsing user questions, an AC automaton is used to accelerate the process of searching the subject entity dictionary. The words that appear in the question in the dictionary are extracted, and the words in the question are matched with the pre-built dictionary to recognize the subject entity of the question. When a word in these subject entities belongs to a part of another word, the shorter words are removed. When the subject entity is not recognized in the question, the subject entity of the previous question is inherited. If the current question is the first sentence and the subject entity is not recognized, a tactful answer is given to indicate that the question is incomprehensible. The question category determination unit is used to identify whether the question is a yes-or-no question or a fact-type question. When determining, the question is classified according to the defined rules. If two entities are identified in the question and the question sentence contains a yes-or-no keyword, the question is classified as a yes-or-no question. Otherwise, the question is classified as a fact-type question. The question type determination unit is used to identify question types, including questions about medication for diseases and questions about symptoms for diseases. For the whether type, template matching is used to identify question types. During identification, it is determined whether the question contains keywords of a certain type of question. If it contains corresponding keywords, the question type is recorded. For the fact type, BERT semantic parsing is used to identify question types. When identifying question types, the previously obtained subject entity is first taken out, and all candidate attributes and candidate relationships connected to the entity in the knowledge graph are sequentially spliced with the entity as standard questions. Then, the similarity between all standard questions and user questions is calculated using the BERT text similarity model. The one with the highest result is taken as the content to be queried, and the corresponding question type is recorded.
2. According to claim 1, a Chinese medical question-answering system based on knowledge graph is characterized in that: The knowledge graph construction module includes a medical data crawling unit, a structure adjustment unit and a medical data storage unit; The medical data crawling unit is used to crawl text data from the medical encyclopedia website on the web page and transmit it to the structure adjustment unit; The structure adjustment unit is used to organize the text data obtained by the medical data crawling unit, convert it according to the format required by the database, split it into two types: node-corresponding node attributes and node-corresponding nodes, and store them in the database for subsequent analysis; The medical data storage unit is used to create nodes, node attributes and relationships between nodes, store the sorted data according to a pre-designed upper structure, and generate a Chinese medical knowledge graph.
3. A Chinese medicine question-answering system based on knowledge graph according to claim 1 or 2, characterized in that: The BERT text similarity model requires the system to perform transfer learning on the pre-trained BERT model, and build a BERT text similarity module based on pre-collected standard questions, user questions, and similar data format training. The module can calculate the similarity of two sentences.
4. A Chinese medicine question-answering system based on knowledge graph according to claim 1 or 2, characterized in that: The system also includes a database query module for converting the data of the question classification module into a corresponding database query language.
5. A Chinese medicine question-answering system based on knowledge graph according to claim 1 or 2, characterized in that: The system also includes an answer integration module for connecting to a graph database, inputting query statements into the database, obtaining corresponding query results, and then assembling the query contents into answers that conform to natural language and corresponding visualization data. When the question is about a disease with multiple symptoms, a set of diseases corresponding to each symptom will be generated, and then these sets will be intersected to take the repeated diseases as the final answers.
6. A Chinese medicine question-answering system based on knowledge graph according to claim 1 or 2, characterized in that: The system also includes a result display module for displaying medical query results. The system front end is a chat room interface, the answers are displayed in text form, and the visual data are displayed in the form of graph-structured pictures.
7. A method for implementing the Chinese medicine question-answering system based on knowledge graph as claimed in claim 1, characterized in that: The question classification module includes a subject entity recognition unit, a question category judgment unit, and a question type judgment unit; The subject entity recognition unit is used to recognize entities in questions. When parsing user questions, an AC automaton is used to accelerate the process of searching the subject entity dictionary. The words that appear in the question in the dictionary are extracted, and the words in the question are matched with the pre-built dictionary to recognize the subject entity of the question. When a word in these subject entities belongs to a part of another word, the shorter words are removed. When the subject entity is not recognized in the question, the subject entity of the previous question is inherited. If the current question is the first sentence and the subject entity is not recognized, a tactful answer is given to indicate that the question is incomprehensible. The question category determination unit is used to identify whether the question is a yes-or-no question or a fact-type question. When determining, the question is classified according to the defined rules. If two entities are identified in the question and the question sentence contains a yes-or-no keyword, the question is classified as a yes-or-no question. Otherwise, the question is classified as a fact-type question. The question type determination unit is used to identify question types, including questions about medication for diseases and questions about symptoms for diseases. For the whether type, the question type is identified by template matching. During identification, it is determined whether the question contains keywords of a certain type of question. If it contains the corresponding keywords, the question type is recorded. For the fact type, the question type is identified by BERT semantic parsing. When identifying the question type, the subject entity obtained previously is first taken out, and all candidate attributes and candidate relationships connected to the entity in the knowledge graph are sequentially spliced with the entity as standard questions. Then, the similarity between all standard questions and user questions is calculated using the BERT text similarity model, and the highest result is taken as the content to be queried, and the corresponding question type is recorded. The method comprises the following steps: S1. Obtain the user's query text; S2. Parse the user's question to obtain the subject entity, question category, and question type; S3. Perform relevant queries based on the parsing results and the pre-built Chinese medical knowledge graph to obtain query results; S4. Organize the medical query results to form dialogue answers and visual data that conform to natural language; S5. Present the text answers and visual data.
8. The method according to claim 7, characterized in that In S3, the steps of constructing the Chinese medical knowledge graph are: S31. Crawl medical text data from medical encyclopedia websites; S32. Convert the crawled data into the format required by the database and organize it into a structure of node-corresponding attributes or node-corresponding nodes; S33. Create nodes, node attributes and relationships between nodes, store the sorted data according to the pre-designed upper structure, and generate a Chinese medical knowledge graph.
9. The method according to claim 7, characterized in that: The process of S2 is: S21. Identify the subject entity of the user's question; S22. Identify the question category of the user's question, whether it is a fact category or a yes-or-no category. The judgment basis is that if two entities are identified in the question and the question contains a yes-or-no keyword, it is classified as a yes-or-no category, and otherwise it is classified as a fact category; S23. Identify the question type of the user's question. When the question is of the "yes" type, match the keywords in the question through template matching to identify the question type. When the question is of the fact type, identify the question type through BERT semantic parsing. For the subject entity of the question, all candidate attributes and candidate relationships connected to the entity in the knowledge graph are concatenated with the entity in sequence as a standard question. Then, the similarity between all standard questions and user questions is calculated using the BERT text similarity model. The one with the highest similarity is taken as the content to be queried, and the corresponding question type is recorded.
Citation Information
Patent Citations
Method and device for obtaining answers based on question classification and electronic equipment
CN109800293A
Medical knowledge graph question-answering system construction method based on BERT and similarity algorithm
CN112131393A
Cited By
System and method of efficient knowledge-enhanced chain-of-thought prompting
US12596731B2
System and method of efficient knowledge-enhanced chain-of-thought prompting
US20250225160A1
