Intelligent question and answer method and device based on knowledge graph
By configuring keywords and synonyms, using N-gram and editing distance algorithm for entity linking and disambiguation, and generating database query statements, the existing intelligent question-and-answer system solves the problem of low accuracy in handling enterprise business, and achieves efficient intelligent question-and-answer effect.
Patent Information
- Application Number
- CN202510002654.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-05-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When existing intelligent question-and-answer systems deal with problems with keyword information in corporate business, it is difficult to avoid designing a large number of templates or labeling corpus, and the accuracy is not high, especially the labeling cost based on neural semantic analysis methods, making it difficult to deal with complex questions.
By configuring keywords and synonyms, using N-gram technology to obtain candidate objects, combining editing distance algorithms for entity linking and disambiguation, intent recognition, database query statements, and finally query results in the knowledge graph, combining business needs and question habit optimization steps.
It realizes intelligent Q&A with high accuracy, avoids a large number of template design and labeling corpus, and improves the practicality of the system and the ability to deal with complex problems.
Smart Images

Figure CN119938838A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent question answering technology, and specifically provides an intelligent question answering method and device based on a knowledge graph. Background Art
[0002] The characteristic of the intelligent question-answering system based on knowledge graph is that the answers to questions need to be obtained from the knowledge graph. The mainstream solutions can be divided into three categories.
[0003] The first is the traditional solution, which is to manually define templates and rules to parse the problem. It is flexible, accurate and customizable, but the coverage is not high, and a large number of templates and rules need to be customized.
[0004] The second is the information retrieval-based method, which uses features to represent questions and candidate answers, calculates similarities, and selects answers with high similarity. It does not require customized templates, but has low accuracy and poor interpretability, and cannot handle complex problems.
[0005] The third is a method based on neural semantic parsing, which converts questions into database query statements. This includes using neural networks to build a semantic parser and using the Encoder-Decoder framework. It is characterized by high query accuracy and the ability to handle complex questions. However, the difficulty lies in the high cost of corpus annotation and the difficulty in obtaining a reasonable logical paradigm.
[0006] In addition, there are some other solutions, but they cannot be widely used due to various problems. For example, using Seq2Seq models or large models to directly convert questions into database query statements cannot be implemented due to problems such as low accuracy and high annotation costs.
[0007] In enterprises, due to the particularity of the business, questions often contain keyword information, which can be used to assist in extracting key objects. For example, in the knowledge graph of power equipment, a typical question is "check the manufacturer of the No. 1 main transformer of a certain substation". "Substation", "main transformer" and "manufacturer" are such keywords. For such typical problems, how to combine the method based on neural semantic parsing with the traditional solution to avoid designing a large number of templates or a large number of annotated corpora is an urgent problem to be solved by technicians in this field. Summary of the invention
[0008] The present invention aims to address the deficiencies of the above-mentioned prior art and provides a highly practical intelligent question-answering method based on knowledge graph.
[0009] A further technical task of the present invention is to provide a reasonably designed, safe and applicable intelligent question-answering device based on knowledge graph.
[0010] The technical solution adopted by the present invention to solve its technical problem is:
[0011] An intelligent question answering method based on knowledge graph has the following steps:
[0012] S1. Configure keywords and synonyms for extracting objects;
[0013] S2. Using N-gram technology, with the keyword as the center, obtain words with a context distance less than N as candidate objects for the keyword;
[0014] S3, entity linking, linking candidate objects to entities, relationships or attributes in the knowledge graph;
[0015] S4, entity disambiguation;
[0016] S5, perform intention recognition;
[0017] S6, generating a database query statement;
[0018] S7. Execute the query and return the result, using the query statement to query the results in the knowledge graph.
[0019] Further, in step S2, the candidate objects include entities, relations and attributes, and the larger the N value of N-gram is, the higher the recall rate of candidate object extraction is;
[0020] On the contrary, the higher the accuracy of the candidate, the more accurate it is, based on actual business needs and questioning habits.
[0021] Furthermore, in step S3, entity linking uses the edit distance algorithm, combined with the object string length and distance, to calculate the edit distance between the candidate object and the object in the knowledge graph, and selects the object with the smallest edit distance as the link object, thus completing the linking of the candidate object to the entity, relationship or attribute in the knowledge graph.
[0022] Furthermore, in step S4, when multiple link objects are found in the knowledge graph, entity disambiguation is performed in combination with context words to select the correct link object.
[0023] Furthermore, in step S5, intent recognition is performed to divide objects into matching objects, condition objects, and return objects. Matching objects refer to objects used for matching, condition objects refer to objects used as conditions in query statements, and return objects refer to the results to be asked for.
[0024] Furthermore, considering the matching of the object and the position of the object in the question, if the matching object and the condition object have been matched, the remaining object is likely to be the returned object;
[0025] In addition, the return object is near the end of the question. According to the comprehensive situation, the score of the object is calculated as a matching object, a conditional object or a return object, and then the object with the largest score is selected.
[0026] Furthermore, in step S6, a database query statement is generated, and the result of intent recognition is used in combination with the structure of the knowledge graph to obtain a matching path in the knowledge graph based on the link object obtained in step S4, and the path is converted into a query statement.
[0027] An intelligent question-answering device based on a knowledge graph, comprising: at least one memory and at least one processor;
[0028] The at least one memory is used to store a machine-readable program;
[0029] The at least one processor is used to call the machine-readable program to execute an intelligent question-answering method based on a knowledge graph.
[0030] Compared with the prior art, the intelligent question-answering method and device based on knowledge graph of the present invention has the following outstanding beneficial effects:
[0031] The present invention has the advantages of high accuracy based on neural semantic parsing methods and traditional solutions and can solve complex problems, while avoiding the problem of designing a large number of templates or a large amount of annotated corpus, and has high practicality. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Attached Figure 1 It is a flowchart of an intelligent question-answering method based on knowledge graph. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than 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.
[0035] A best embodiment is given below:
[0036] like Figure 1As shown, an intelligent question answering method based on a knowledge graph in this embodiment has the following steps:
[0037] S1. Configure keywords and synonyms for extracting objects;
[0038] Configure keywords for extracting objects, such as "substation", "main transformer" and "manufacturer" in the power equipment knowledge graph, as well as synonyms of these words.
[0039] S2. Using N-gram technology, with the keyword as the center, obtain words with a context distance less than N as candidate objects for the keyword;
[0040] Using N-gram technology, with keywords as the center, words with context distance less than N are obtained as candidate objects for keywords. Candidate objects include entities, relationships and attributes.
[0041] The larger the N value of N-gram, the higher the recall rate of candidate object extraction. Conversely, the higher the accuracy of candidate objects. It is often determined based on actual business needs and question-asking habits. Generally, N is 2 or 3, which produces better results.
[0042] S3, entity linking, linking candidate objects to entities, relationships or attributes in the knowledge graph;
[0043] Using the edit distance algorithm, combined with the object string length and distance, the edit distance between the candidate object and the object in the knowledge graph is calculated, and the object with the smallest edit distance is selected as the link object to complete the linking of the candidate object to the entity, relationship or attribute in the knowledge graph.
[0044] S4, entity disambiguation;
[0045] Entity disambiguation: When multiple link objects are found in the knowledge graph, such as the voltage level may refer to the voltage level of the substation or the voltage level of the main transformer, entity disambiguation should be performed in combination with the context words to see whether the context words contain the substation or the main transformer, and select the correct link object.
[0046] S5, perform intention recognition;
[0047] Intent recognition divides objects into matching objects, condition objects, and return objects. Matching objects refer to objects used for matching, condition objects refer to objects used as conditions in query statements, and return objects refer to the results to be asked.
[0048] Considering factors such as the object's matching and the object's position in the question, if the matching object and the conditional object have been matched, the remaining object is likely to be returned.
[0049] In addition, the returned object is usually near the end of the question. Based on the above comprehensive situation, the score of the three categories of objects is calculated, and then the object with the largest score is selected;
[0050] S6, generating a database query statement;
[0051] Generate a database query statement, use the results of intent recognition, combine with the structure of the knowledge graph, based on the link object obtained in the fourth step, obtain the matching path in the knowledge graph, and convert the path into a query statement.
[0052] S7. Execute the query and return the result, using the query statement to query the results in the knowledge graph.
[0053] Based on the above method, an intelligent question-answering device based on a knowledge graph in this embodiment includes: at least one memory and at least one processor;
[0054] The at least one memory is used to store a machine-readable program;
[0055] The at least one processor is used to call the machine-readable program to execute an intelligent question-answering method based on a knowledge graph.
[0056] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any technical solutions that conform to the above-mentioned specific implementations of the present invention and any appropriate changes or substitutions made by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.
[0057] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An intelligent question-answering method based on knowledge graph, characterized in that: The steps are as follows: S1. Configure keywords and synonyms for extracting objects; S2. Using N-gram technology, with the keyword as the center, obtain words with a context distance less than N as candidate objects for the keyword; S3, entity linking, linking candidate objects to entities, relationships or attributes in the knowledge graph; S4, entity disambiguation; S5, perform intention recognition; S6, generating a database query statement; S7. Execute the query and return the result, using the query statement to query the results in the knowledge graph.
2. According to claim 1, the intelligent question-answering method based on knowledge graph is characterized in that: In step S2, the candidate objects include entities, relations and attributes. The larger the N value of N-gram is, the higher the recall rate of candidate object extraction is. On the contrary, the higher the accuracy of the candidate, the more accurate it is, based on actual business needs and questioning habits.
3. The intelligent question-answering method based on knowledge graph according to claim 2, characterized in that: In step S3, entity linking uses the edit distance algorithm, combined with the object string length and distance, to calculate the edit distance between the candidate object and the object in the knowledge graph, and selects the object with the smallest edit distance as the link object, completing the linking of the candidate object to the entity, relationship or attribute in the knowledge graph.
4. The intelligent question-answering method based on knowledge graph according to claim 3, characterized in that: In step S4, when multiple link objects are found in the knowledge graph, entity disambiguation is performed in combination with context words to select the correct link object.
5. The intelligent question-answering method based on knowledge graph according to claim 4, characterized in that: In step S5, intent recognition is performed to divide objects into matching objects, condition objects, and return objects. Matching objects refer to objects used for matching, condition objects refer to objects used as conditions in query statements, and return objects refer to the results to be asked for.
6. The intelligent question-answering method based on knowledge graph according to claim 5, characterized in that: Combined with the object's matching situation and the object's position in the question, if the matching object and the condition object have been matched, the remaining object is likely to be the returned object; In addition, the return object is near the end of the question. According to the comprehensive situation, the score of the object is calculated as a matching object, a conditional object or a return object, and then the object with the largest score is selected.
7. The intelligent question-answering method based on knowledge graph according to claim 6, characterized in that: In step S6, a database query statement is generated, and the results of intent recognition are used in combination with the structure of the knowledge graph. Based on the link object obtained in step S4, a matching path in the knowledge graph is obtained, and the path is converted into a query statement.
8. An intelligent question-answering device based on knowledge graph, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Knowledge graph question-answering method and system based on entity relationship disambiguation, and terminal
CN111259653A
Automatic question and answer method, device and equipment based on knowledge graph, and storage medium
CN111949787A
Knowledge graph question and answer method and system based on path sorting
CN113742446A
Knowledge graph question and answer method and device, equipment and storage medium
CN117290478A