A knowledge graph query method, electronic device and storage medium

By determining the entity words and attribute words of the original question in the knowledge graph of the intelligent question-answer system, the problem that users' colloquialization questions are difficult to retrieve answers by the knowledge graph is solved, and the success rate of the question-and-answer process and the accuracy of the answers are improved.

CN113094467BActive Publication Date: 2025-05-23ZTE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911336981.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-23
Publication Date
2025-05-23
Estimated Expiration
2039-12-23

AI Technical Summary

Technical Problem

In the prior art, in the intelligent question-and-answer system, in the process of question-and-answer based on the knowledge graph, the answers to the colloquial questions raised by users are difficult to retrieve by the knowledge graph, resulting in low success rate and accuracy of the answers.

Method used

By querying the answers to the original question in the knowledge graph, if it cannot be found, the entity words of the original question are determined and pre-processed to obtain the similarity to the pre-stored equivalent sentence, determine the attribute words, and then query the answers in the knowledge graph.

Benefits of technology

The success rate and accuracy of the answers to the user's original question in the intelligent question answer process are improved, and the probability and accuracy of attribute words are improved by utilizing the semantic relationships in the knowledge graph.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113094467B_ABST
    Figure CN113094467B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention relates to the field of communications, and discloses a query method, electronic device and storage medium for a knowledge graph. In the present invention, the query method includes: if the answer to the original question cannot be directly queried in the knowledge graph, then determine the entity words of the original question; perform entity word preprocessing on the original question, and determine the attribute words of the original question according to the pre-stored equivalent sentences whose similarity with the original question after entity word preprocessing is greater than a preset threshold; query and feedback the answer to the queried original question according to the determined entity words and attribute words. When the answer cannot be directly queried, perform entity word preprocessing on the original question, and determine the attribute words of the original question according to the pre-stored equivalent sentences whose similarity with the processed original question is greater than a preset threshold, so that the pre-stored equivalent sentences in the knowledge graph are applied to the attribute word determination process of similar semantic questions, thereby increasing the probability of determining the attribute words of the original question, and thus increasing the probability of querying the answer to the original question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of communications, and in particular to a knowledge graph query method, electronic device, and storage medium. Background Art

[0002] With the development of communication technology, the development of artificial intelligence has gradually matured, and intelligent question and answer belongs to a relatively basic function. In the question and answer system based on the knowledge graph, because the construction of the knowledge graph is based on relatively standard and short words (entity words and attribute words), and there will be relatively similar situations between attribute words, such as "activation method" and "activation conditions", and the words used in the user's question will be more colloquial (such as for "activation method", the user will ask "how to activate"), if the question and answer system lacks large-scale corpus for machine learning training, there will be a situation where the answer cannot be retrieved based on the knowledge graph. The solution adopted in the prior art is to directly expand the selected question and answer pair based on the sentence template of the equivalent sentence of a certain question and answer pair, add relatively colloquial equivalent sentences to the corresponding attributes, and increase the success rate of answering user questions by increasing the equivalent sentences in the question and answer pair.

[0003] The inventors have discovered that there are at least the following problems in the related art: since equivalent sentences are added in a colloquial manner to the selected question and answer pairs according to a set template, the probability of successfully finding answers to questions raised by users during the question and answer process is still low, and the accuracy of the answers is also poor. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a knowledge graph query method, electronic device and storage medium to improve the success rate of querying answers to the original questions input by the user and the accuracy of the queried answers during the intelligent question-answering process.

[0005] To solve the above technical problems, an embodiment of the present invention provides a method for querying a knowledge graph, including: querying the answer to an original question in a pre-established knowledge graph; if the answer to the original question cannot be found, determining the entity words of the original question; performing entity word preprocessing on the original question, obtaining the similarity between each pre-stored equivalent sentence in the knowledge graph and the original question after entity word preprocessing, and determining the attribute words of the original question based on the pre-stored equivalent sentences whose similarity to the original question after entity word preprocessing is greater than a preset threshold; querying the answer to the original question in the knowledge graph based on the entity words and attribute words of the original question, and feeding back the queried answer.

[0006] An embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned knowledge graph query method.

[0007] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, characterized in that the computer program implements the above-mentioned knowledge graph query method when executed by a processor.

[0008] Compared with the prior art, in the process of question-answering, when the answer to the original question cannot be directly queried from the knowledge graph, the embodiment of the present invention determines the entity words of the original question, pre-processes the original question with the entity words, and then determines the attribute words of the original question based on the pre-stored equivalent sentences whose similarity with the processed original question is greater than a preset threshold, and then retrieves and feeds back the answer based on the entity words and attribute words of the original question. By utilizing the semantic relationship in the knowledge graph, the pre-stored equivalent sentences in the knowledge graph are applied to the attribute word determination process of the original question with similar semantics, thereby improving the probability of determining the attribute words of the original question and the accuracy of the determined attribute words, and then query feedback of the answer to the original question is performed based on the determined entity words and attribute words, thereby improving the success rate of the original question answer query and the accuracy of the queried answer.

[0009] In addition, the original question is preprocessed with entity words to obtain the similarity between each pre-stored equivalent sentence in the knowledge graph and the original question after entity word preprocessing, and the attribute words of the original question are determined according to the pre-stored equivalent sentences whose similarity with the original question after entity word preprocessing is greater than a preset threshold, including: determining the target entity words according to the entity words of each pre-stored equivalent sentence; wherein the target entity words are entity words of each pre-stored equivalent sentence whose similarity with the entity words of the original question is greater than a first preset threshold; replacing the entity words of the original question with the target entity words to generate a derived question of the original question; determining the target pre-stored equivalent sentence according to the similarity between the derived question and each pre-stored equivalent sentence; wherein the target pre-stored equivalent sentence is a pre-stored equivalent sentence of each pre-stored equivalent sentence whose similarity with the derived question is greater than a second preset threshold; determining the attribute words of the original question according to the attribute words of the target pre-stored equivalent sentence. The entity words in the original question are replaced by the similarity between the entity words in the original question and the entity words in the pre-stored equivalent sentences, and then the attribute words of the original question are determined according to the attribute words of the target pre-stored equivalent sentences. Thus, the attribute words of the original question are determined by using the attribute words of the existing pre-stored equivalent sentences, which increases the probability of determining the attribute words of the original question, and further increases the probability of successfully querying the answer to the original question.

[0010] In addition, according to the similarity between the derived question and each pre-stored equivalent sentence, a target pre-stored equivalent sentence is determined, including: if no pre-stored equivalent sentence with a similarity greater than a second preset threshold to the derived question is detected, all pre-stored equivalent sentences containing the target entity word are output; according to the received user feedback, the target pre-stored equivalent sentence is determined. By performing a secondary query on the user based on the pre-stored equivalent sentence containing the target entity word and determining the target pre-stored equivalent sentence based on the user feedback, the user intention is accurately obtained; by determining the user intention through the secondary query, the probability of finding the answer to the original question and the accuracy of the answer found are improved.

[0011] In addition, the original question is preprocessed with entity words to obtain the similarity between each pre-stored equivalent sentence in the knowledge graph and the original question after entity word preprocessing, and the attribute words of the original question are determined based on the pre-stored equivalent sentences whose similarity with the original question after entity word preprocessing is greater than a preset threshold, including: removing the entity words of the original question to generate a derived question of the original question; removing the entity words of each pre-stored equivalent sentence, and determining the target pre-stored equivalent sentence based on the similarity between the derived question and each pre-stored equivalent sentence after removing the entity words; wherein the target pre-stored equivalent sentence is a pre-stored equivalent sentence whose similarity with the derived question is greater than a second preset threshold among the pre-stored equivalent sentences after removing the entity words; and determining the attribute words of the original question based on the attribute words of the target pre-stored equivalent sentence. By removing the entity words of the original question and the pre-stored equivalent sentences, the influence of the entity words on the semantic similarity of the questions is avoided, ensuring that the target equivalent sentences corresponding to the derived questions can be accurately determined; then the attribute words of the original question are determined based on the attribute words of the target equivalent sentences, which improves the probability of determining the attribute words of the original question, thereby increasing the probability of querying the answer to the original question.

[0012] In addition, after determining the target pre-stored equivalent sentence, it also includes: generating an equivalent sentence of the original question according to the target pre-stored equivalent sentence, and adding the equivalent sentence of the original question into the knowledge graph. By determining the equivalent sentence of the original question according to the target pre-stored equivalent sentence, it is realized that the existing pre-stored equivalent sentence is applied to the process of determining the equivalent sentence of the original question, the generalization ability of the equivalent sentence is improved, and the limitation of adding equivalent sentences according to fixed sentence templates is avoided; the determined equivalent sentence is added into the knowledge graph, and the efficiency of knowledge graph expansion is improved.

[0013] In addition, determining the entity words of the original question includes: detecting whether there are entity words matching the original question in the pre-stored entity words of the knowledge graph; wherein the pre-stored entity words are entity words of each pre-stored equivalent sentence; if there are entity words matching the original question in the pre-stored entity words, the pre-stored entity words matching the original question are used as the entity words of the original question; if there are no entity words matching the original question in the pre-stored entity words, the query statement is output, the original question is updated according to the received query feedback, and the pre-stored entity words are re-detected to see whether there are entity words matching the original question. The entity words of the original question are determined according to the matching degree between the pre-stored entity words in the knowledge graph and the original question, ensuring that the entity words of the original question can be queried in the knowledge graph; when the entity words cannot be directly determined, the original question is updated according to the query feedback and the entity words are re-detected to maximize the probability of identifying the entity words of the original question.

[0014] In addition, before outputting the query statement, it also includes: detecting whether the number of times the query statement is currently output has reached a preset threshold; if the number of times the query statement is currently output has not reached the preset threshold, then executing the output query statement again; if the number of times the query statement is currently output has reached the preset threshold, then outputting a query result indicating that no answer has been found. By multiple inquiries, the probability of determining the entity word of the original question is increased; when the number of inquiries is too many, the result of not finding the answer to the original question is output, avoiding multiple meaningless inquiries and improving feedback efficiency.

[0015] In addition, determining the target pre-stored equivalent sentence includes: if multiple pre-stored equivalent sentences with similarities to the derived question sentence greater than a second preset threshold are detected, then the pre-stored equivalent sentence with the greatest similarity to the derived question sentence is used as the target pre-stored equivalent sentence. By selecting the pre-stored equivalent sentence with the highest similarity as the target pre-stored equivalent sentence, the consistency between the obtained attribute words and the original question sentence is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] One or more embodiments are exemplarily described by the pictures in the corresponding drawings, and these exemplary descriptions do not constitute limitations on the embodiments.

[0017] Figure 1 is a flow chart of a method for querying a knowledge graph according to a first embodiment of the present invention;

[0018] Figure 2 is a flow chart of a method for querying a knowledge graph according to a second embodiment of the present invention;

[0019] Figure 3 FIG. 4 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention. DETAILED DESCRIPTION

[0020] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.

[0021] The first embodiment of the present invention relates to a method for querying a knowledge graph. In this embodiment, the answer to the original question is queried based on a pre-established knowledge graph; if the answer to the original question cannot be queried, the entity words of the original question are determined based on the knowledge graph; the original question is pre-processed with entity words to obtain the similarity between the pre-stored equivalent sentences in the knowledge graph and the original question after the entity word pre-processing, and the attribute words of the original question are determined based on the pre-stored equivalent sentences whose similarity with the original question after the entity word pre-processing is greater than a preset threshold; based on the entity words and attribute words of the original question, the original question is queried in the knowledge graph. The method can obtain an answer and feed back the queried answer. When the answer to the original question cannot be directly determined, the entity words of the original question are obtained, the original question is pre-processed with the entity words, and the attribute words of the original question are determined according to the pre-stored equivalent sentences whose similarity with the processed original question is greater than a preset threshold. The pre-stored equivalent sentences are applied to the attribute words of the original question with similar semantics through semantic relationships, thereby improving the probability and accuracy of determining the attribute words of the original question, thereby improving the probability of finding the answer when searching and feeding back the answer to the original question according to the entity words and attribute words, and ensuring the accuracy of the queried answer.

[0022] The implementation details of the knowledge graph query method of this implementation mode are described in detail below. The following content is only the implementation details provided for easy understanding and is not necessary for this implementation mode.

[0023] The specific process of a knowledge graph query method in this embodiment is as follows: Figure 1 As shown, the specific steps include:

[0024] Step 101: Obtain the original question.

[0025] Specifically, when performing intelligent question and answering, the terminal analyzes the information input by the user through voice recognition or text recognition to determine the original question input by the user.

[0026] Step 102 is to detect whether the answer to the original question can be found. If the answer to the original question can be found, the process proceeds to step 106 . If the answer to the original question cannot be found, the process proceeds to step 103 .

[0027] Specifically, after obtaining the original question of the user, the terminal searches for the answer to the original question in the pre-established knowledge graph and tries to obtain the answer to the original question. If the unique entity word and attribute word of the original question can be obtained at the same time, it is determined that the answer to the original question can be found. The entity word of the original question is the entity object contained in the original question, and the attribute word of the original question is the specific intention of the entity object contained in the original question. For example, if the original question input by the user is "How to clean the laptop?", the entity word of the original question is the entity object "laptop" contained in the original question; the attribute word of the original question is the specific intention of the original question for the entity object "laptop" contained in the original question "cleaning method". The answer to the original question is searched according to the entity word and attribute word of the original question, and the process goes to step 106 to feedback the answer. If the unique entity word and attribute word of the original question cannot be obtained at the same time, it is determined that the answer to the original question cannot be found, and the process goes to step 103.

[0028] Step 103: determine the entity words of the original question.

[0029] Specifically, when the answer to the original question cannot be directly queried, the entity words of the original question are determined based on the entity words of each pre-stored equivalent sentence in the knowledge graph, and it is detected whether the original question contains the entity words pre-stored in the knowledge graph, and the entity words pre-stored in the knowledge graph contained in the original question are used as the entity words of the original question.

[0030] In one example, when determining the entity words of the original question based on the entity words pre-stored in the knowledge graph, it is detected whether there are entity words matching the original question in the pre-stored entity words in the knowledge graph; wherein the pre-stored entity words are the entity words of each pre-stored equivalent sentence; if there are entity words matching the original question in the pre-stored entity words, the pre-stored entity words matching the original question are used as the entity words of the original question; if there are no entity words matching the original question in the pre-stored entity words, a query statement is output, the original question is updated according to the received query feedback, and it is re-detected whether there are entity words matching the original question in the pre-stored entity words.

[0031] For example, the original question obtained by the terminal is "How to bind Alipay", and when the original question is matched according to the pre-stored entity words in the knowledge graph, no entity word matching the original question is found, that is, it is impossible to obtain the specific object in the original question that needs to be opened for online banking, then a query statement is output to the user in the interactive interface, prompting the user to re-enter the question or supplement the original question, and obtain the question re-entered by the user or the supplementary information of the original question. After updating the original question in the terminal, the entity word is re-matched and determined. For example, the user supplements the original question, and according to the user's supplementary information, the original question is changed to "How to bind a bank card to Alipay", then the knowledge graph pre-stored entity words are re-detected to see if there are entity words matching the original question, and it is detected that "bank card" in the original question is in the pre-stored entity words in the knowledge graph, then "bank card" is used as the entity word of the original question "How to bind a bank card to Alipay".

[0032] Step 104: determine the attribute words of the original question.

[0033] Specifically, after determining the entity words of the original question, the original question is preprocessed with the entity words according to the entity words of the original question, and the similarity between the pre-stored equivalent sentences in the knowledge graph and the original question after the entity word preprocessing is obtained. Based on the pre-stored equivalent sentences whose similarity with the original question after the entity word preprocessing is greater than a preset threshold, the attribute words of the original question are determined.

[0034] In one example, after the entity words of the original question are determined, the target entity words are determined based on the entity words of each pre-stored equivalent sentence; wherein the target entity words are entity words of each pre-stored equivalent sentence, whose similarity with the entity words of the original question is greater than a first preset threshold; the entity words of the original question are replaced with the target entity words to generate a derived question sentence of the original question; according to the similarity between the derived question sentence and each pre-stored equivalent sentence, the target pre-stored equivalent sentence is a pre-stored equivalent sentence of each pre-stored equivalent sentence, whose similarity with the derived question sentence is greater than a second preset threshold; according to the attribute words of the target pre-stored equivalent sentence, the attribute words of the original question are determined.

[0035] For example, the original question input by the user is "My newly purchased Mercedes-Benz has a fault. How can I protect my rights?" By comparing the matching degree between the pre-stored entity words in the knowledge graph and the original question, it is determined that the entity word of the original question is "Mercedes-Benz". Then, the similarity between the entity words of the original question and the pre-stored entity words is calculated according to the semantic similarity algorithm. The pre-stored entity word with a semantic similarity greater than 85% with the entity word of the original question is "Mercedes-Benz car". Then, "Mercedes-Benz car" is used as the target entity word, and the entity word in the original question is replaced with the target entity word to generate a derived question of the original question, "My newly purchased Mercedes-Benz car has a fault. How can I protect my rights?" Then, the semantic similarity is calculated for the derived question and the pre-stored question in the knowledge graph. The equivalent sentence "My newly purchased Changan car has a problem. How can I protect my rights" on the existing entity attribute pair "Changan Automobile - Rights Protection Channel" is obtained. If the similarity with the derived question is greater than 75%, the attribute word "Rights Protection Channel" of the target pre-stored equivalent sentence is used as the attribute word of the original question.

[0036] In practical applications, the specific values ​​of the first preset threshold and the second preset threshold can be set according to actual conditions, and this implementation does not limit the setting of the preset thresholds.

[0037] In another example, when determining a target pre-stored equivalent sentence based on the similarity between a derived question and each pre-stored equivalent sentence, if no pre-stored equivalent sentence having a similarity with the derived question greater than a second preset threshold is detected, all pre-stored equivalent sentences containing the target entity word are output; and the target pre-stored equivalent sentence is determined based on the received user feedback.

[0038] For example, the original question input by the user is "My newly purchased Mercedes-Benz has a problem. How can I protect my rights?" By matching with the pre-stored entity words in the knowledge graph, the target entity word is determined to be "Mercedes-Benz car". After replacing the entity word, no pre-stored equivalent sentences and derived question sentences with a semantic similarity greater than 75% are detected. At this time, it is detected that the pre-stored equivalent sentences containing the target entity word "Mercedes-Benz car" are "My newly purchased Mercedes-Benz car has a problem. How can I protect my rights?" and "My newly purchased Mercedes-Benz car has a problem. What are the channels for protecting my rights?" Then, based on the attribute words of these two pre-stored equivalent sentences, a query statement is output to the user, and the user chooses which pre-stored equivalent sentence he wants to know about. If the user chooses to know about the rights protection channels for Mercedes-Benz cars, "My newly purchased Mercedes-Benz car has a problem. What are the channels for protecting my rights?" is used as the target pre-stored equivalent sentence, and the attribute word "rights protection channel" of the target pre-stored equivalent sentence is used as the attribute word of the original question.

[0039] Step 105, searching for the answer to the original question based on the entity words and attribute words of the original question.

[0040] Specifically, after obtaining the entity words and attribute words of the original question input by the user, the terminal searches for the answer to the original question in the knowledge graph based on the entity words and attribute words of the original question.

[0041] Step 106: Feedback the query answer.

[0042] Specifically, the terminal feeds back the answer to the original question to the user through an interactive interface, such as voice broadcast, video playback, text display, etc., based on the answer to the original question retrieved.

[0043] Therefore, this embodiment provides a query method for a knowledge graph. When the answer to the original question cannot be directly queried, the entity words of the original question are determined based on the degree of match between the entity words of the pre-stored equivalent sentences in the knowledge graph and the original question, and then the original question is pre-processed with the entity words. The attribute words of the original question are determined based on the pre-stored equivalent sentences whose similarity with the processed original question is greater than a preset threshold. Then, the answer is queried and fed back based on the entity words and attribute words of the original question, and the attribute words of the original question are determined through the target pre-stored equivalent sentences. This makes it possible to determine the entity words and attribute words of the original question based on the existing equivalent sentences, thereby improving the probability of determining the entity words and attribute words of the original question, and thereby improving the probability of querying the answer to the original question.

[0044] The second embodiment of the present invention relates to a method for querying a knowledge graph. This embodiment is roughly the same as the first embodiment. In this embodiment, in the process of determining the entity words of the original question, if the entity words of the original question cannot be determined after multiple inquiries, a direct feedback that the answer cannot be found is given, thereby avoiding multiple meaningless inquiries and improving query efficiency. When determining the attribute words of the original question, the entity words of the pre-stored equivalent sentences and the original question are first removed, and then the target question is determined based on the similarity between the questions after removing the entity words, thereby avoiding the influence of the entity words on the similarity between the determined questions, and then The attribute words of the original question are determined according to the attribute words of the target question, and then the answer is queried and fed back according to the attribute words and entity words of the original question, so that all pre-stored equivalent sentences are applied to the process of determining the entity words and attribute words of the original question; after determining the target pre-stored equivalent sentence, the equivalent sentence of the original question is generated according to the target pre-stored equivalent sentence, thereby improving the generalization ability of the knowledge graph for equivalent sentences and avoiding the limitations of generalizing equivalent sentences according to fixed sentence patterns; the determined equivalent sentence of the original question is added to the knowledge graph, so as to automatically and efficiently expand the knowledge graph.

[0045] The specific process of a knowledge graph query method in this embodiment is as follows: Figure 2 As shown, the specific steps include:

[0046] Step 201, obtaining an original question.

[0047] Step 202 is to detect whether the answer to the original question can be found. If the answer to the original question can be found, the process proceeds to step 207 . If the answer to the original question cannot be found, the process proceeds to step 203 .

[0048] Step 201 and step 202 of this embodiment are similar to step 101 and step 102 of the first embodiment, and are not described in detail here.

[0049] Step 203 is to detect whether the entity word of the original question can be determined. If the entity word of the original question can be determined, the process proceeds to step 204 . If the entity word of the original question cannot be determined, the process proceeds to step 207 .

[0050] Specifically, when the answer to the original question cannot be directly queried, the terminal matches the original question according to the entity words of the equivalent sentences pre-stored in the knowledge graph, and tries to determine the entity words of the original question. When the entity words of the original question cannot be directly determined, the user is queried in the interactive interface, and the original question is updated according to the feedback obtained from the query, and the entity words of the updated original question are re-detected. Before querying the user, it is detected whether the number of times the current query statement is output reaches a preset threshold; if the number of times the current query statement is output has not reached the preset threshold, the query statement is output again until the entity words of the original question are determined, and then the process proceeds to step 204; if the number of times the current query statement is output reaches the preset threshold, the process proceeds to step 207, and a query result indicating that no answer has been found is output.

[0051] In practical applications, the value of the preset threshold of the number of inquiries can be set according to actual conditions and needs. This implementation does not limit the setting of the preset threshold.

[0052] Step 204: determine the attribute words of the original question.

[0053] Specifically, after determining the entity words of the original question, the original question is preprocessed with the entity words according to the entity words of the original question, and the similarity between the pre-stored equivalent sentences in the knowledge graph and the original question after the entity word preprocessing is obtained. Based on the pre-stored equivalent sentences whose similarity with the original question after the entity word preprocessing is greater than a preset threshold, the attribute words of the original question are determined.

[0054] In one example, after determining the entity words of the original question, the entity words of the original question are removed to generate a derived question of the original question; the entity words of each pre-stored equivalent sentence are removed, and a target pre-stored equivalent sentence is determined based on the similarity between the derived question and the pre-stored equivalent sentences after the entity words are removed; wherein the target pre-stored equivalent sentence is a pre-stored equivalent sentence among the pre-stored equivalent sentences after the entity words are removed, whose similarity with the derived question is greater than a second preset threshold; and the attribute words of the original question are determined based on the attribute words of the target pre-stored equivalent sentence.

[0055] For example, the original question input by the user is "I have completed the application for IPTV, how do I activate it?" After the terminal parses the original question based on the entity words of the pre-stored equivalent sentences in the knowledge graph, the terminal obtains the entity word of the original question as "IPtv". The terminal then removes the entity words in the original question to obtain a derived question of the original question "I have completed the application, how do I activate it?", and then removes the entity words of all pre-stored equivalent sentences in the knowledge graph, and calculates the semantic similarity of the derived question and each pre-stored equivalent sentence after removing the entity words through a semantic similarity algorithm, and detects whether there is a target pre-stored equivalent sentence with a similarity greater than 70% with the derived question. After similarity calculation, the pre-stored equivalent sentence on the entity attribute pair "solidification - activation method" is obtained, "The solidification application has been completed, how do I activate it myself?" After removing the entity words, the similarity with the derived question is greater than 70%. In this case, "The solidification application has been completed, how do I activate it myself" is used as the target pre-stored equivalent sentence, and then the attribute word "activation method" in the target pre-stored equivalent sentence is used as the attribute word of the original question.

[0056] In practical applications, the second preset threshold can be set according to actual conditions, and this implementation does not limit the specific value of the second preset threshold.

[0057] In another example, after the original question is preprocessed with entity words according to the entity words of the original question, it is detected whether there is a pre-stored equivalent sentence whose similarity with the original question after entity word preprocessing is greater than the second preset threshold. If multiple pre-stored equivalent sentences whose similarity with the derived question is greater than the second preset threshold are detected, the pre-stored equivalent sentence with the greatest similarity with the derived question is used as the target pre-stored equivalent sentence. For example, the original question is "The application for iptv has been completed, how do I activate it myself?", and two pre-stored equivalent sentences with a similarity greater than 70% with the derived question of the original question are detected. The pre-stored equivalent sentence 1 "The solidification application has been completed, how do I activate it myself?" has a similarity of 85% with the derived question after removing the entity words, and the pre-stored equivalent sentence 2 "The bank card application has been completed, what are the conditions for credit card activation?" has a similarity of 78% with the derived question after removing the entity words, then the pre-stored equivalent sentence 1 is selected as the target pre-stored equivalent sentence, and the attribute word "activation method" of the target pre-stored equivalent sentence is used as the attribute word of the original question.

[0058] Step 205: Add equivalent sentences of the original question into the knowledge graph.

[0059] Specifically, after determining the target pre-stored question, an equivalent sentence of the original question is generated based on the target pre-stored equivalent sentence, and the equivalent sentence of the original question is added to the knowledge graph.

[0060] In one example, after determining the target pre-stored question, the target pre-stored equivalent sentence is generalized in combination with the entity words of the original question to determine the equivalent sentence of the original question, and then the entity attribute pair corresponding to the equivalent sentence is determined based on the entity words and attribute words in the equivalent sentence of the original question, and the obtained equivalent sentence is added to the equivalent sentence storage interval of the entity attribute, the pre-stored equivalent sentences in the knowledge graph are automatically expanded, and the mapping relationship between the equivalent sentences and the entity attribute pairs to which the equivalent sentences belong is saved in the knowledge graph to facilitate the subsequent call of the stored equivalent sentences.

[0061] For example, the original question input by the user is "The newly purchased Mercedes-Benz car has a problem, how can I protect my rights?" By matching with the pre-stored entity words in the knowledge graph, it is determined that the entity word is "Mercedes-Benz car". According to the similarity of the question after removing the entity word, the target pre-stored equivalent sentence obtained is "The newly purchased Changan car has a problem, how can I protect my rights". Combined with the entity word "Mercedes-Benz car" of the original question, the target pre-stored equivalent sentence is generalized to obtain the equivalent sentence of the original question "The newly purchased Mercedes-Benz car has a problem, how can I protect my rights". Then, based on the entity word "Mercedes-Benz car" and the attribute word "rights protection process" contained in the equivalent sentence, it is determined that the entity attribute pair to which the equivalent sentence of the original question belongs is "Mercedes-Benz car-rights protection process", the equivalent sentence of the original question is stored in the corresponding storage interval, and the mapping relationship between the equivalent sentence and the entity attribute pair is saved.

[0062] Step 206: Query the answer to the original question based on the entity words and attribute words of the original question.

[0063] Specifically, after obtaining the entity words and attribute words of the original question input by the user, the terminal searches for the answer to the original question in the knowledge graph based on the entity words and attribute words of the original question to determine the answer to the original question.

[0064] Step 207: Feedback the query result.

[0065] Specifically, after the terminal searches for the answer to the original question, if the answer to the original question cannot be retrieved based on the entity words and attribute words of the original question or the entity words and attribute words of the original question cannot be obtained, the terminal outputs that the answer to the original question cannot be found; if the answer to the original question can be directly queried or the answer to the original question can be queried based on the entity words and attribute words, the terminal outputs the queried answer to the original question.

[0066] Therefore, this embodiment provides a method for querying a knowledge graph. When querying the answer to the original question, if the answer cannot be directly queried, the entity words of the original question are determined, the pre-stored equivalent sentences and the entity words of the original question are removed, and the target pre-stored equivalent sentences are determined based on the similarity between the processed questions, and then the attribute words of the original question are determined, and the answer is queried based on the entity words and attribute words of the original question; an equivalent sentence of the original question is generated based on the target pre-stored equivalent sentence and the entity words of the original question, and the equivalent sentence of the original question is added to the knowledge graph. The target pre-stored equivalent sentence is determined by the similarity between questions after removing entity words, and the attribute words of the original question are determined according to the attribute words of the target pre-stored equivalent sentence, so that the existing equivalent sentences in the knowledge graph are applied to the process of determining the attribute words of the original question, and the probability of determining the attribute words of the original question is improved; after determining the target pre-stored equivalent sentence, an equivalent sentence of the original question is generated according to the target pre-stored question, and the equivalent sentence of the original question is automatically added to the knowledge graph, which improves the generalization ability of the knowledge graph equivalent sentence and the efficiency of knowledge graph expansion; the equivalent sentence with the highest similarity is selected from multiple equivalent sentences that meet the similarity requirements, which ensures the degree of consistency between the determined attribute words and the original question, thereby improving the probability of querying the answer to the original question and the accuracy of the queried answer.

[0067] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.

[0068] A third embodiment of the present invention relates to an electronic device, such as Figure 3 As shown, it includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned knowledge graph query method.

[0069] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor.

[0070] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.

[0071] A fourth embodiment of the present invention relates to a computer-readable storage medium storing a computer program, which implements the above method embodiment when executed by a processor.

[0072] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0073] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present invention, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.

Claims

1. A knowledge graph query method, It is characterized in that include: Query the answer to the original question in the pre-built knowledge graph; If the answer to the original question cannot be found, then determining the entity word of the original question; Perform entity word preprocessing on the original question, obtain the similarity between each pre-stored equivalent sentence in the knowledge graph and the original question after the entity word preprocessing, and determine the attribute word of the original question according to the pre-stored equivalent sentence whose similarity with the original question after the entity word preprocessing is greater than a preset threshold; According to the entity words and attribute words of the original question, searching the knowledge graph for the answer to the original question, and feeding back the found answer; The performing entity word preprocessing on the original question, obtaining the similarity between each pre-stored equivalent sentence in the knowledge graph and the original question after the entity word preprocessing, and determining the attribute word of the original question according to the pre-stored equivalent sentence whose similarity with the original question after the entity word preprocessing is greater than a preset threshold, includes: Determining a target entity word according to the entity words of each of the pre-stored equivalent sentences; wherein the target entity word is an entity word among the entity words of each of the pre-stored equivalent sentences, whose similarity with the entity word of the original question sentence is greater than a first preset threshold; Replacing the entity words of the original question with the target entity words to generate a derived question of the original question; Determining a target pre-stored equivalent sentence according to the similarity between the derived question sentence and each of the pre-stored equivalent sentences; wherein the target pre-stored equivalent sentence is a pre-stored equivalent sentence among the pre-stored equivalent sentences whose similarity with the derived question sentence is greater than a second preset threshold; Determining the attribute words of the original question sentence according to the attribute words of the target pre-stored equivalent sentence; The entity words of the original question are the entity objects contained in the original question, and the attribute words of the original question are the specific intentions of the original question with respect to the entity objects contained in the original question.

2. The knowledge graph query method according to claim 1, It is characterized in that Determining a target pre-stored equivalent sentence according to the similarity between the derived question sentence and each of the pre-stored equivalent sentences includes: If no pre-stored equivalent sentence having a similarity with the derived question sentence greater than the second preset threshold is detected, outputting all the pre-stored equivalent sentences containing the target entity word; The target pre-stored equivalent sentence is determined according to the received user feedback.

3. The knowledge graph query method according to claim 1, It is characterized in that The performing entity word preprocessing on the original question, obtaining the similarity between each pre-stored equivalent sentence in the knowledge graph and the original question after the entity word preprocessing, and determining the attribute word of the original question according to the pre-stored equivalent sentence whose similarity with the original question after the entity word preprocessing is greater than a preset threshold, includes: Removing entity words from the original question to generate a derived question from the original question; Removing entity words from each of the pre-stored equivalent sentences, and determining a target pre-stored equivalent sentence according to the similarity between the derived question sentence and each of the pre-stored equivalent sentences after the entity words are removed; wherein the target pre-stored equivalent sentence is a pre-stored equivalent sentence whose similarity with the derived question sentence is greater than a second preset threshold value among the pre-stored equivalent sentences after the entity words are removed; The attribute words of the original question sentence are determined according to the attribute words of the target pre-stored equivalent sentence.

4. A method for querying a knowledge graph according to any one of claims 1 to 3, It is characterized in that After determining the target pre-stored equivalent sentence, the method further includes: Generate an equivalent sentence of the original question sentence according to the target pre-stored equivalent sentence; Adding equivalent sentences of the original question into the knowledge graph.

5. The knowledge graph query method according to claim 1, It is characterized in that The determining of the entity words of the original question sentence includes: Detecting whether there is an entity word matching the original question in the pre-stored entity words of the knowledge graph; wherein the pre-stored entity words are entity words of each of the pre-stored equivalent sentences; If there is an entity word matching the original question in the pre-stored entity words, the pre-stored entity word matching the original question is used as the entity word of the original question; If there is no entity word matching the original question in the pre-stored entity words, a query statement is output, the original question is updated according to the received query feedback, and the pre-stored entity words are re-detected to see if there is an entity word matching the original question.

6. The knowledge graph query method according to claim 5, It is characterized in that Before the output query statement, it also includes: Detecting whether the number of times the query statement is currently outputted reaches a preset threshold; If the number of times the query statement is currently output has not reached the preset threshold, then the output query statement is executed again; If the number of times the query statement is currently outputted reaches the preset threshold, a query result indicating that no answer has been found is outputted.

7. The method for querying a knowledge graph according to any one of claims 1 to 3, It is characterized in that The determining of the target pre-stored equivalent sentence comprises: If a plurality of pre-stored equivalent sentences whose similarity to the derived question sentence is greater than the second preset threshold are detected, the pre-stored equivalent sentence with the greatest similarity to the derived question sentence is used as the target pre-stored equivalent sentence.

8. An electronic device, It is characterized in that include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the knowledge graph query method as described in any one of claims 1 to 7.

9. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the method for querying the knowledge graph described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Question and answer method and device based on knowledge graph, computer equipment and storage medium

    CN110457431A

  • Statement response method and device based on artificial intelligence and electronic equipment

    CN110489538A