Knowledge graph question answering method, electronic device, and storage medium
By identifying the target domain of the question to be answered in the knowledge graph question answering system, and using cluster center vectors and similarity thresholds to narrow down the answer retrieval range, the problem of inaccurate answer identification in multi-domain knowledge graph question answering is solved, and more efficient answer provision is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MASHANG CONSUMER FINANCE CO LTD
- Filing Date
- 2023-02-09
- Publication Date
- 2026-04-28
AI Technical Summary
Existing knowledge graph question answering systems perform poorly in multi-domain applications, struggling to accurately identify the domain of user questions and provide accurate answers, resulting in a decline in user experience.
By determining the similarity between the confirmation vector of the question to be answered and the cluster center vectors of the knowledge graphs of various domains, the target domain knowledge graph is determined using a preset similarity threshold, the scope of answer retrieval is narrowed, and the answer is provided based on the target domain knowledge graph.
It improves the accuracy and efficiency of answer recognition in knowledge graph question answering systems across multiple domains, and enhances the user experience.
Smart Images

Figure CN116150399B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a knowledge graph question answering method, electronic device and storage medium. Background Technology
[0002] Knowledge-based question answering (KBQA) is a current research hotspot in the field of natural language processing, involving numerous related technologies, including linguistics, deep learning, and machine learning. Knowledge graphs use nodes to represent entities or concepts in the real world, connected by directed edges that represent various relationships between these entities or concepts. In other words, by mapping natural language questions (NLQs) to structured graphs for querying using different methods, knowledge graphs, with their rich semantic associations and powerful semantic processing capabilities, can deeply understand user questions and provide answers.
[0003] However, many current question-answering methods fall under the category of multi-domain knowledge graph question answering. Most commonly used knowledge graph question answering schemes are only suitable for single-domain knowledge graph question answering and perform poorly in multi-domain knowledge graph question answering. Therefore, how to accurately perform multi-domain knowledge graph question answering has become a hot research topic in this field. Summary of the Invention
[0004] This application provides a knowledge graph question answering method, an electronic device, and a storage medium.
[0005] Firstly, this application provides a knowledge graph question-answering method, which includes:
[0006] A confirmation vector corresponding to the question to be answered is determined, and the similarity between the confirmation vector and the cluster center vectors corresponding to each domain knowledge graph is determined. Based on a preset similarity threshold and the similarity between the confirmation vector and the cluster center vectors corresponding to each domain knowledge graph, the target domain knowledge graph to which the question to be answered belongs is determined from the domain knowledge graphs. Based on the target domain knowledge graph to which the question to be answered belongs, the answer corresponding to the question to be answered is determined.
[0007] Secondly, this application provides a knowledge graph question-answering device, the device comprising:
[0008] The determining module is configured to determine the confirmation vector corresponding to the question to be answered, and to determine the similarity between the confirmation vector and the cluster center vectors corresponding to each domain knowledge graph; the determining module is further configured to determine the target domain knowledge graph to which the question to be answered belongs from the various domain knowledge graphs based on a preset similarity threshold and the similarity between the confirmation vector and the cluster center vectors corresponding to each domain knowledge graph; the answering module is configured to determine the answer corresponding to the question to be answered based on the target domain knowledge graph to which the question to be answered belongs.
[0009] Thirdly, this application provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the knowledge graph question answering method described above.
[0010] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described knowledge graph question-answering method.
[0011] The embodiments provided in this application can determine which domain knowledge graphs are more likely to yield corresponding answers to a question by using the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph. Based on a preset similarity threshold and the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph, the target domain knowledge graph to which the question belongs can be determined, thus narrowing the retrieval scope of the query answer. Therefore, when determining the answer to a question based on the target domain knowledge graph, the accuracy and efficiency of answer recognition can be improved, thereby enhancing the question-answering recognition capability.
[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0013] The accompanying drawings are provided to further illustrate the present application and form part of the specification. They are used together with the embodiments of the present application to explain the application and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed exemplary embodiments described with reference to the accompanying drawings.
[0014] Figure 1A schematic diagram of a knowledge graph question-answering system provided for related technologies.
[0015] Figure 2 This is a flowchart illustrating a knowledge graph question-answering method provided in an embodiment of this application.
[0016] Figure 3 This is a flowchart illustrating a knowledge graph question-answering method provided in an embodiment of this application.
[0017] Figure 4 This is a block diagram illustrating the composition of a knowledge graph question-answering device provided in an embodiment of this application.
[0018] Figure 5 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] To enable those skilled in the art to better understand the technical solutions of this application, exemplary embodiments of this application are described below in conjunction with the accompanying drawings, including various details of the embodiments of this application to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0020] Where there is no conflict, the various embodiments of this application and the features thereof may be combined with each other.
[0021] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0022] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Terms such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0023] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0024] In related technologies, the process involves: obtaining entity mentions in the user's question; linking these entity mentions to entity nodes in a knowledge graph to obtain linked entities; querying the knowledge graph based on the linked entities to obtain at least one query path and candidate answers for each query path; obtaining the most suitable query path based on the similarity between each query path and the user's question; and obtaining the final answer to the user's question based on the candidate answers corresponding to the most suitable query path.
[0025] However, the above-described answer retrieval process uses information retrieval, linking to graph nodes through entity recognition and entity linking to obtain candidate paths. Then, it sorts the candidate paths based on their similarity and returns the final answer. When a user switches between different domains, or when their question doesn't belong to the current knowledge graph, the current knowledge graph-based question processing terminates. This prevents the search for a suitable domain knowledge graph to analyze the user's question, thus degrading the user experience.
[0026] In another related technology, Figure 1 A schematic diagram of a knowledge graph question-answering system provided for related technologies. For example... Figure 1 As shown, for each question-answer training sample in the question-answer training set, a question-predicate sequence dataset is constructed based on a knowledge graph, and then a predicate sequence detector is trained. For a question that needs to be answered, the predicate sequence of the question is first identified by the predicate sequence detector. The core path is constructed by the question's focus words, predicate sequence, and entity label values. Then, the question identification constraints are analyzed, and a query path is constructed based on the core path. According to the question, and based on the candidate answers and query path obtained from the core path, the final answer is selected.
[0027] Knowledge graphs can include knowledge from different fields, covering a wide range of knowledge. When using sequence detectors to mine information from questions, the range of paths in the knowledge graph that need to be queried is wide, making it difficult to accurately determine whether the answer to the question is within or outside a certain field. This increases the difficulty of finding the answer and reduces the accuracy of the answer.
[0028] The knowledge graph question answering method provided in this application can determine the target domain knowledge graph to which the question to be answered belongs by the similarity between the confirmation vector corresponding to the question to be answered and the cluster center vector corresponding to each domain knowledge graph, so as to narrow the search range of the answer and answer the question based on the target domain knowledge graph, thereby improving the accuracy of the identification of the answer to the question to be answered and improving the question answering recognition capability.
[0029] The knowledge graph question-answering method according to embodiments of this application can be executed by electronic devices such as terminal devices or servers. Terminal devices can be user equipment (UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (PDAs), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. Servers can be independent physical servers, server clusters consisting of multiple servers, or cloud servers capable of cloud computing. Specifically, the knowledge graph question-answering method can be implemented by a processor in an electronic device calling computer-readable program instructions stored in memory.
[0030] The first aspect of this application provides a knowledge graph question-answering method.
[0031] Figure 2 This is a flowchart illustrating a knowledge graph question-answering method provided in an embodiment of this application. Figure 2 As shown, this knowledge graph question-answering method includes, but is not limited to, the following steps:
[0032] Step S201: Determine the confirmation vector corresponding to the question to be answered, and determine the similarity between the confirmation vector and the cluster center vector corresponding to each domain knowledge graph.
[0033] Domain knowledge graphs are knowledge graphs within different domains (such as entertainment, insurance, and sports). A knowledge graph visualizes a knowledge domain, creating a corresponding knowledge domain mapping. In practical applications, knowledge graphs can describe various entities and concepts, as well as the relationships between them, and can be viewed as a semantic network. In some optional implementations, the basic building blocks of a domain knowledge graph are "entity-relationship-entity" triples, and entities and their associated attribute-value pairs. Entities are interconnected through relations, forming a network-like knowledge structure.
[0034] By vectorizing the questions to be answered, we obtain the confirmation vectors corresponding to the questions. These confirmation vectors clearly define the direction and value of the information covered by the questions, facilitating more accurate analysis. Furthermore, the cluster center vectors corresponding to each domain knowledge graph represent the core information within that domain's knowledge graph, enabling accurate determination of the coverage of different domain knowledge graphs based on these vectors.
[0035] Furthermore, calculating the similarity between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain can clarify the relationship between the vector to be confirmed and the knowledge graphs of each domain, that is, the intended coverage of which domain knowledge graph the vector to be confirmed can be specifically classified into, thus narrowing the search range for the answer to the question and speeding up the response speed.
[0036] In some optional implementations, step S201, determining the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph, includes: determining the distance value between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph; and calculating the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph based on the determined distance value. The smaller the distance value, the greater the similarity.
[0037] It should be noted that when the distance between the vector to be confirmed and the cluster center vector corresponding to a certain domain knowledge graph is less than or equal to a preset distance threshold, it indicates that the vector to be confirmed is similar to the cluster center vector corresponding to that domain knowledge graph. When the distance between the vector to be confirmed and the cluster center vector corresponding to a certain domain knowledge graph is greater than the preset distance threshold, it indicates that the vector to be confirmed is not similar to the cluster center vector corresponding to that domain knowledge graph, and the answer to the question corresponding to the vector to be confirmed cannot be found in that domain knowledge graph. Searching only in the domain knowledge graph where the answer can be found can narrow the search scope, quickly obtain the answer to the question, and thus speed up the response to the question.
[0038] In some optional implementations, each domain knowledge graph includes multiple entity nodes of the corresponding domain and connections representing the relationships between the entity nodes. Any two or more entity nodes and their corresponding connections constitute a path. For example, paths in the domain knowledge graph corresponding to the insurance domain, paths in the domain knowledge graph corresponding to the entertainment domain, paths in the domain knowledge graph corresponding to the sports domain, and so on.
[0039] Before executing step S201, the electronic device needs to calculate the cluster center vectors corresponding to the knowledge graphs of each domain. As an optional implementation, calculating the cluster center vectors corresponding to the knowledge graphs of each domain may include: learning paths in multiple domain knowledge graphs in an unsupervised manner to obtain a pre-trained model; clustering each path in the multiple domain knowledge graphs based on the pre-trained model to obtain the knowledge graph space of each domain; and performing path clustering on the paths in the knowledge graph space of each domain to obtain the cluster center vectors corresponding to the knowledge graphs of each domain.
[0040] During the training of the pre-trained model, it is obtained by training on test positive examples and test negative examples. Test positive examples consist of any two paths within the same domain's knowledge graph, while test negative examples consist of any two paths within the knowledge graphs of different domains. When performing cluster analysis using paths from multiple test positive and negative examples, paths within the same domain's knowledge graph can be grouped into one domain, and paths within different domains can be grouped into two different domains. Then, based on the divided domains, the central region of each domain is determined, thereby defining the knowledge graph space of each domain. Furthermore, path clustering is performed on the knowledge graph space of the same domain to obtain the cluster center vector corresponding to the domain's knowledge graph, representing the core region of that domain.
[0041] By clustering paths in multiple knowledge graphs from different domains, we can obtain cluster center vectors for each domain knowledge graph. Different cluster center vectors can represent the core regions of different domain knowledge graphs, thereby determining the coverage of the domain knowledge graph. Based on different coverage, we can confirm the domain to which the question to be answered belongs, narrow down the search range of the answer to the question, and improve the accuracy of the response to the question.
[0042] It should be noted that unsupervised learning refers to constructing different positive and negative test cases by utilizing paths in multiple domain knowledge graphs; that is, multiple positive and negative test cases can be determined without relying on any other labeled data.
[0043] For example, a pre-trained model can be obtained by learning paths in multiple domain knowledge graphs (e.g., paths based on Resource Description Framework (RDF)) in an unsupervised manner.
[0044] In some embodiments, a domain knowledge graph constructed based on RDF paths can perform triple analysis on questions to be answered. RDF is a markup language for describing web resources, characterized by self-description, and its data model is in the form of a subject-predicate-object (SPO) triple (s, p, o). Here, s represents the subject, i.e., a Uniform Resource Identifier (URI) of a data source; o represents the object, i.e., a URI of a data source or a textual description; and p represents the predicate, a URI describing the relationship between s and o.
[0045] RDF triples have a simple and intuitive data structure. Compared to traditional relational database storage, RDF data offers better scalability and collaborative capabilities. Therefore, when using RDF triple data to analyze questions, the meaning represented by the question can be quickly obtained. Furthermore, in a knowledge graph built based on RDF triple data, semantic analysis and judgment can be performed on information other than entities in the question, leading to more accurate answers and improving the accuracy of knowledge-based question answering.
[0046] In this embodiment of the application, RDF graphs under each domain knowledge graph can be constructed one by one, resulting in N domain knowledge graphs. Here, N is an integer greater than or equal to 2.
[0047] For example, domain knowledge graph A includes RDF node paths A1->A2->A3; domain knowledge graph B includes RDF node paths B1->B2->B3. For all paths in domain knowledge graph A, each pair of paths serves as a positive test case; however, for paths in domain knowledge graphs A and B that do not belong to the same domain knowledge graph, each pair of paths serves as a negative test case. Using these different positive and negative test cases as sample data, a model is constructed. This model can use the following loss function L. i Represented as:
[0048] Where K represents the batch value during training; j is a value greater than or equal to 0 and less than or equal to K; i represents the i-th vector; j represents the j-th vector; τ represents the hyperparameter, and the smaller τ is, the more the model focuses on separating the test negatives that are most similar to the test positives.
[0049] This represents the vector corresponding to a path in the same domain knowledge graph (e.g., the vector z corresponding to path 1 in domain knowledge graph A). iThe vector corresponding to path 2 in domain knowledge graph A Similarity between vectors z; i with vector They serve as positive test examples for each other;
[0050] S(z i , z j ) represents the vector corresponding to paths in different domain knowledge graphs (e.g., the vector z corresponding to path 1 in domain knowledge graph A). i And the vector z corresponding to path 3 in domain knowledge graph B j Similarity between vectors z; i With vector z j They serve as negative examples for each other.
[0051] It should be noted that the loss function L i The optimization goal is to increase the similarity of the numerators, that is, to decrease the distance between paths in the same domain knowledge graph; and to decrease the similarity of the denominators, that is, to increase the distance between paths in different domain knowledge graphs, thereby obtaining a spatial vector of N domain knowledge graphs.
[0052] Through the above operations, paths in all domain knowledge graphs can be clustered based on different positive and negative test examples to obtain the cluster center vector corresponding to each domain knowledge graph. Furthermore, each cluster center vector is compared with the confirmation vector corresponding to the question to be answered to determine whether the question to be answered belongs to an external question, thereby determining the target domain knowledge graph to which the question to be answered belongs, narrowing the search scope of the question to be answered, speeding up the response to the question to be answered, and improving the accuracy of the response to the question to be answered.
[0053] Step S202: Based on the preset similarity threshold and the similarity between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain, determine the target domain knowledge graph to which the question to be answered belongs from the knowledge graphs of each domain.
[0054] The process of comparing the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph with a preset similarity threshold is equivalent to determining whether the vector to be confirmed belongs to the domain (IND) or the out-of-domain (OOD) for each domain knowledge graph. If the vector to be confirmed belongs to the domain of a certain domain knowledge graph, it means that the intent expressed by the vector to be confirmed is within the scope of the intent of that domain knowledge graph; if the vector to be confirmed belongs to the out-of-domain of a certain domain knowledge graph, it means that the intent expressed by the vector to be confirmed is outside the scope of the intent of that domain knowledge graph.
[0055] For example, if the similarity between the vector to be confirmed and the cluster center vector corresponding to a certain domain knowledge graph (or several domain knowledge graphs) is greater than or equal to a preset similarity threshold, it means that the vector to be confirmed is similar to the cluster center vector, and the question to be answered corresponding to the vector to be confirmed is related to the one (or several domain knowledge graphs).
[0056] Conversely, if the similarity between the vector to be confirmed and the cluster center vector corresponding to a certain domain knowledge graph (or several domain knowledge graphs) is less than the preset similarity threshold, it means that the vector to be confirmed is not similar to the cluster center vector, and the question to be answered corresponding to the vector to be confirmed has a very low correlation with the one (or several) domain knowledge graphs. When determining the answer to the question to be answered, the one (or several) domain knowledge graphs can be excluded.
[0057] It should be noted that "within the domain" and "outside the domain" are relative concepts and are not limited to specific domains. For example, domain A and domain B, domain B is outside the domain relative to domain A, and similarly, domain A is outside the domain relative to domain B.
[0058] In some embodiments, multiple positive test cases for IND and multiple negative test cases for OOD are constructed; then, the multiple positive test cases and multiple negative test cases are trained respectively to obtain an in-domain and out-of-domain classification model. This in-domain and out-of-domain classification model can be used to analyze the question to be answered, improve the efficiency of identifying OOD questions, and enable users to obtain more accurate answers.
[0059] The in-domain and out-of-domain classification model can be implemented using the target domain knowledge graph and other domain knowledge graphs in this application. When the intent expressed by the confirmation vector corresponding to a question to be answered belongs to the target domain knowledge graph, it represents that the question to be answered is an in-domain question; if the intent expressed by the confirmation vector corresponding to a question to be answered belongs to other domain knowledge graphs, it represents that the question to be answered is an out-of-domain question.
[0060] It should be noted that when there is a small amount of OOD sample data, it can be obtained by comparing it with the cluster center vector corresponding to the domain knowledge graph. However, when both the number of OOD sample data and the number of IND sample data exceed the preset threshold, a binary classification method can be used to identify the OOD sample data in order to improve the identification speed of the sample data.
[0061] In some optional implementations, when the electronic device determines the target domain knowledge graph to which the question to be answered belongs from each domain knowledge graph in step S202 based on a preset similarity threshold and the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph, it can do so in the following way:
[0062] Among the similarities between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain, the cluster center vectors with similarities greater than a preset similarity threshold are determined as candidate cluster center vectors; the candidate cluster center vectors are sorted to obtain similarity ranking results; the domain knowledge graph corresponding to the cluster center vector with the highest similarity in the similarity ranking results is extracted as the target domain knowledge graph.
[0063] If the similarity between the vector to be confirmed and the cluster center vector is less than or equal to a preset similarity threshold, then the vector to be confirmed is outside the scope of the domain knowledge graph corresponding to the cluster center vector, and the cluster center vector needs to be deleted.
[0064] It should be noted that by comparing the similarity between the vector to be confirmed and the cluster center vector with a preset similarity threshold, and determining the cluster center vectors corresponding to the similarity between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain that are greater than the preset similarity threshold, the cluster center vectors are identified as candidate cluster center vectors. Cluster center vectors that are obviously not the answer corresponding to the vector to be confirmed are deleted, thereby narrowing the search range of answers and speeding up the response to the questions to be answered.
[0065] For example, suppose there are initially M cluster center vectors, where M is an integer greater than or equal to 2. Furthermore, if the vector to be confirmed is not within the domain knowledge graph corresponding to two of these cluster center vectors (i.e., the distance between the cluster center vector and the vector to be confirmed is greater than a preset distance threshold, or in other words, the similarity between the cluster center vector and the vector to be confirmed is less than a preset similarity threshold), then M-2 candidate cluster center vectors can be obtained.
[0066] Then, the M-2 candidate cluster center vectors are sorted by similarity to obtain the similarity ranking result. The domain knowledge graph corresponding to the cluster center vector with the highest similarity is selected from the similarity ranking result as the target domain knowledge graph, thereby further narrowing the search scope and speeding up the response to the questions to be answered.
[0067] Step S203: Based on the target domain knowledge graph to which the question to be answered belongs, determine the answer corresponding to the question to be answered.
[0068] Specifically, in the knowledge graph of the target domain to which the question to be answered belongs, alternative answers that match the question to be answered are searched, and the answer corresponding to the question to be answered is obtained from the alternative answers, thereby improving the accuracy of the answer.
[0069] In some optional implementations, the target domain knowledge graph includes multiple entity nodes and connections used to represent the relationships between the multiple entities, and any two or more entity nodes and their corresponding connections form a path.
[0070] When the electronic device determines the answer to the question based on the target domain knowledge graph to which the question belongs in step S203, it can do so in the following way: traverse each entity node in the target domain knowledge graph to obtain multiple paths to be used for the question; match the confirmation vector based on the multiple paths to be used to determine the answer to the question.
[0071] Among them, the information type of the entity node in each of the multiple paths to be used reflects the information type of the entity, and the relevance between ...
[0072] For example, multiple entity nodes under all RDF-based paths in the target graph domain can be traversed, for example, multiple entity nodes can be traversed based on different node types, thereby obtaining multiple paths to be used corresponding to the question to be answered.
[0073] By traversing each entity node in the target domain knowledge graph, and based on the relevance between the information type of the entity reflected by each entity node in the multiple paths to be used and the information type included in the question to be answered, multiple paths that meet the preset relevance threshold are selected, thereby obtaining multiple paths to be used corresponding to the question to be answered. This allows for subsequent matching of the confirmation vector based on these paths to determine the answer to the question to be answered.
[0074] In some optional implementations, the entity nodes in the target domain knowledge graph are traversed to obtain multiple paths to be used corresponding to the question to be answered, including:
[0075] Traverse each entity node, and identify the target head node from multiple entity nodes based on the information type of the head node required by the question to be answered and the information type of the entity reflected by each entity node. Based on the relevance between the information type of the entity reflected by each entity node in each candidate path corresponding to the target head node and the question to be answered, sort the multiple candidate paths to obtain the path sorting result. From the path sorting result, select multiple paths with a relevance greater than a preset relevance threshold as multiple paths to be used corresponding to the question to be answered.
[0076] The target header node corresponds to multiple candidate paths. The information type includes at least one of product information, attribute information, and channel information.
[0077] When a target head node is identified in the target geographic domain, it is necessary to extract the information type of the entity reflected by each entity node in each candidate path corresponding to the target head node. Then, the relevance between the information type of the entity reflected by each entity node in each candidate path and the information type of the entity node required by the question to be answered is calculated. Based on the calculated relevance, multiple candidate paths are sorted to obtain the path sorting result. Then, from the path sorting result, multiple paths with a relevance greater than a preset relevance threshold are selected as multiple paths to be used for the question to be answered.
[0078] In practice, the information types represented by different entity nodes can be separated using [SEP] to achieve concatenation between entity nodes and different information types. Then, the concatenated information is used to train a large-scale unlabeled corpus training model based on a bidirectional encoder (Bidirectional Encoder Representations from Transformer, BERT) to obtain at least one of the following: product ranking model, attribute ranking model, and channel ranking model.
[0079] Furthermore, a product ranking model can be used to rank multiple candidate paths based on the relevance between the product information of the entity nodes in each candidate path corresponding to the target head node and the product information of the head node required by the question to be answered, thereby obtaining a path ranking result that matches the product information.
[0080] And / or, using an attribute ranking model, based on the relevance between the attribute information of each entity node in each candidate path corresponding to the target head node and the attribute information of the head node required by the question to be answered, multiple candidate paths are ranked to obtain a path ranking result that matches the attribute information.
[0081] And / or, using a channel ranking model, based on the relevance between the channel information of each entity node in each candidate path corresponding to the target head node and the channel information of the head node required by the question to be answered, multiple candidate paths are ranked to obtain a path ranking result that matches the channel information.
[0082] By ranking multiple candidate paths based on relevance using the different models described above, different path ranking results can be obtained.
[0083] For example, if the product information with the highest relevance among the path ranking results matching the product information is greater than a preset relevance threshold, this product information can be used as the target retrieval information. Based on this target retrieval information, the paths corresponding to multiple entity nodes in the target domain knowledge graph can be traversed and queried, and intent analysis can be performed. If the intent of the question to be answered is determined to be a product list (e.g., "health insurance purchase method"), after identifying "health insurance" at the product node and "purchase method" at the attribute node, the insurance domain knowledge graph can be queried based on multiple health insurance products (e.g., children's health insurance, adult health insurance, etc.) to obtain multiple paths to be used.
[0084] In some alternative implementations, the information type of the head node required by the question to be answered includes at least one of product information, attribute information, and channel information. The information type of the head node required by the question to be answered can be extracted using the self-attention mechanism in the BERT model.
[0085] Based on the information type of the head node required by the question to be answered and the information type of the entity reflected by each entity node, the target head node is identified from multiple entity nodes, including:
[0086] Based on the relevance between the product information of the head node required by the question to be answered and the product information of the entity reflected by each entity node, the product information of the entity reflected by each entity node is sorted to obtain the product sorting result.
[0087] Based on the relevance between the attribute information of the head node required by the question to be answered and the attribute information of the entity reflected by each entity node, the attribute information of the entity reflected by each entity node is sorted to obtain the attribute sorting result.
[0088] Based on the relevance between the channel information of the head node required by the question to be answered and the channel information of the entity reflected by each entity node, the channel information of the entity reflected by each entity node is sorted to obtain the channel sorting result.
[0089] The target head node is determined based on at least one of the following: the product information with the highest relevance in the product ranking results, the attribute information with the highest relevance in the attribute ranking results, and the channel information with the highest relevance in the channel ranking results.
[0090] If the type of information required by the head node for the question to be answered is determined to be attribute information, the attribute information with the highest relevance in the attribute ranking results is obtained. Then, the product information with the highest relevance in the product ranking results and the channel information with the highest relevance in the channel ranking results are obtained. The above three types of information are considered comprehensively. Based on at least one of product information, channel information and attribute information, the target head node is determined. Then, based on the path in the domain knowledge graph corresponding to the target head node, multiple paths to be used are obtained.
[0091] For example, in the insurance field, based on the relevance between the product information in the header node required by the question to be answered and the product information of the entity reflected by each entity node, the product information of the entity reflected by each entity node is sorted to obtain the product sorting result. The product information can be represented as follows:
[0092] [('[CLS]I want to buy compulsory traffic accident liability insurance for my motorcycle[SEP]**Personal medical insurance[SEP]',0),
[0093] ('[CLS]I want to buy compulsory traffic accident liability insurance for my motorcycle[SEP]**Compulsory Traffic Accident Liability Insurance (2020 Edition)[SEP]',1)。
[0094] Here, "[CLS]" represents the vector representation of the feature; "[SEP]" represents the separator used to separate entity and product information (or attribute information, or channel information, etc.) in the user's question to be answered.
[0095] "0" indicates a negative test case (i.e., motorcycles and related vehicle entities will not have service types such as "personal medical insurance" for the entity "person"); "1" indicates a positive test case (i.e., motorcycles and related vehicle entities have the service type of "compulsory traffic accident insurance").
[0096] For example, based on the relevance between the attribute information of the head node required by the question to be answered and the attribute information of the entity reflected by each entity node, the attribute information of the entity reflected by each entity node is sorted to obtain the attribute sorting result. The attribute information can be represented as follows:
[0097] [('[CLS]By the way, could you please inquire about this year's vehicle insurance premiums [SEP] and the eligibility requirements for policyholders [SEP]', 0),
[0098] ('[CLS]By the way, could you please inquire about this year's vehicle insurance premium? [SEP]Contact information [SEP]', 0),
[0099] ('[CLS]By the way, could you please tell me the vehicle insurance premium quote for this year?', 1).
[0100] In this context, "0" represents a negative test case (i.e., the vehicle insurance premium will not contain information such as "policyholder conditions" or "contact information"); "1" represents a positive test case (i.e., the vehicle insurance premium will contain corresponding "quotation" information).
[0101] For example, based on the relevance between the channel information of the head node required by the question to be answered and the channel information of each entity node, the channel information of each entity node is sorted to obtain the channel sorting result. The channel information can be represented as follows:
[0102] [('Does [CLS] have motorcycle insurance? [SEP] offline [SEP]', 1),
[0103] ('Does [CLS] have motorcycle insurance? [SEP] WeChat Official Account [SEP]', 0);
[0104] or,
[0105] (1) How to buy motorcycle insurance [CLS] offline [SEP]
[0106] ('[CLS] How to buy motorcycle insurance [SEP] WeChat Official Account [SEP]', 0);
[0107] or,
[0108] (1) Can I buy compulsory traffic accident liability insurance for motorcycles? (COLS) Offline (SEP)
[0109] ('Can I buy compulsory traffic accident liability insurance for motorcycles? [CLS] WeChat Official Account [SEP]', 0)
[0110] ('[CLS] Can car insurance be processed online? [SEP] Offline? [SEP]', 0).
[0111] In this context, "0" represents a negative test case, and "1" represents a positive test case. That is, motorcycle insurance can only be purchased offline; compulsory motorcycle liability insurance also needs to be purchased offline; and vehicle insurance can only be processed offline.
[0112] By using the different positive and negative test examples mentioned above, the corresponding ranking results are obtained. Based on at least one of the following: the product information with the highest relevance in the product ranking results, the attribute information with the highest relevance in the attribute ranking results, and the channel information with the highest relevance in the channel ranking results, the target head node is determined. This allows for more accurate querying of the path corresponding to the target head node, resulting in more accurate retrieved information and improved detection precision for the questions being answered.
[0113] It should be noted that during the process of answering questions, there may be switching between different domain knowledge graphs. By pausing the current response to the question and outputting different prompts, the text input by the user can be obtained, and the question can be further answered to provide the user with the information they need more accurately and improve the user experience.
[0114] In some optional implementations, before determining the target head node based on at least one of the following: the product information with the highest relevance in the product ranking results, the attribute information with the highest relevance in the attribute ranking results, and the channel information with the highest relevance in the channel ranking results, the method further includes:
[0115] If the information type of the entity reflected by the head node is determined to be product information, and the highest relevance in the product ranking result is less than the preset relevance threshold, the first prompt message is output; the text input by the user is obtained, and the steps of re-executing the product information of the entity reflected by each entity node based on the relevance of the product information of the head node required by the question to be answered and the product information of the entity reflected by each entity node are re-executed to obtain the product ranking result.
[0116] If it is determined that the information type of the entity reflected by the head node is attribute information, and the highest relevance in the attribute ranking result is less than the preset relevance threshold, output the second prompt information; obtain the text input by the user, and re-execute the steps of ranking the attribute information of the entity reflected by each entity node based on the relevance between the attribute information of the head node required by the question to be answered and the attribute information of the entity reflected by each entity node, and obtain the attribute ranking result.
[0117] The first prompt message prompts the user to enter text including product information; the second prompt message prompts the user to enter text including attribute information.
[0118] Product information is used to characterize the type of product, such as vehicle insurance or personal insurance. Product information is extracted from user-input text by proactively posing questions to the user.
[0119] For example, if the question to be answered is "How to buy?", it can be identified that the question asks about the purchase method, but it cannot identify which specific entity's purchase method it refers to (i.e., the relevance between the product information retrieved from multiple entity nodes and the product information to be confirmed is less than a preset relevance threshold). In this case, to further clarify the user's intent, it is necessary to output initial prompt information to the user (e.g., "Which specific product do you want to know about?"). Then, by acquiring the text input by the user, more accurate product information can be extracted from the user's input text. For example, the product information extracted from the user's input text includes: the product name provided by the user, such as "motorcycle" or "car," etc.
[0120] Furthermore, the process of re-executing the steps of sorting the product information of the head node based on the relevance between the product information of the head node required by the question to be answered and the product information of the entity reflected by each entity node, thereby obtaining the product sorting result, is repeated, and the product sorting result is updated. This implementation method can obtain the missing information by asking follow-up questions when the information contained in the user's question is incomplete, so as to more accurately identify the category of information the user expects to obtain and improve the accuracy of the response to the question.
[0121] For example, based on proactively providing a second prompt to the user, attribute information can be extracted from the user's input text. If the question to be answered is "How to buy car insurance?", it can be identified that the question asks about the purchase method of "car insurance," but it cannot identify the specific type of car insurance (i.e., the highest relevance in the attribute ranking results is less than a preset relevance threshold). In this case, to further clarify the user's intent, a second prompt needs to be provided to the user (e.g., "What type of car insurance do you specifically want to know about?"). Then, by obtaining the user's input text, attribute information can be extracted from that text. For example, the extracted attribute information from the user's input text might be "motorcycle insurance" or "car insurance," etc.
[0122] It should be noted that when the attribute information in the text input by the user is obtained, the step of re-executing the relevance between the attribute information of the head node required by the question to be answered and the attribute information of the entity reflected by each entity node is re-executed, and the attribute information of the entity reflected by each entity node is sorted to obtain the attribute sorting result, so as to more accurately determine the answer that the user expects to obtain based on the updated attribute sorting result.
[0123] In this embodiment, by using the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph, it is possible to determine in which domain knowledge graphs the answer to the question is more likely to be found. Based on the preset similarity threshold and the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph, the target domain knowledge graph to which the question to be answered belongs is determined from each domain knowledge graph, thus narrowing the retrieval scope of the query answer. Therefore, when determining the answer to the question to be answered based on the target domain knowledge graph, the accuracy and efficiency of answer recognition can be improved, thereby enhancing the question-answering recognition capability.
[0124] Figure 3 This is a flowchart illustrating a knowledge graph question-answering method provided in an embodiment of this application. Figure 3 As shown, this knowledge graph question-answering method includes, but is not limited to, the following steps.
[0125] Step S301: Determine the knowledge graph space for multiple domains.
[0126] In some embodiments, unsupervised learning can be used to learn paths in multiple domain knowledge graphs to obtain a pre-trained model; based on the pre-trained model, each path in the multiple domain knowledge graphs can be clustered to obtain the knowledge graph space of each domain.
[0127] It should be noted that during the training process of the pre-trained model, the pre-trained model is obtained by training on test positive examples and test negative examples. Test positive examples consist of any two paths within the domain knowledge graph of the same domain, while test negative examples consist of any two paths within the domain knowledge graph of different domains.
[0128] Step S302: Perform path clustering on the paths in the knowledge graph space of each domain to obtain the cluster center vector corresponding to the knowledge graph of each domain.
[0129] Step S303: Determine the similarity between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain.
[0130] The vector to be confirmed is the vector corresponding to the question to be answered. By vectorizing the question to be answered, the vector to be confirmed corresponding to the question to be answered is obtained. The vector to be confirmed can clarify the direction and value of the information covered by the question to be answered, which is convenient for more accurate analysis of the question to be answered.
[0131] In some specific implementations, the distance between the vector to be confirmed and the cluster center vector corresponding to each domain knowledge graph can be determined separately, and this distance value can be used as a measure of the similarity between the vector to be confirmed and each cluster center vector.
[0132] The smaller the distance between the vector to be confirmed and a certain cluster center vector, the greater the similarity between the vector to be confirmed and the cluster center vector. In other words, the vector to be confirmed is more similar to the cluster center vector.
[0133] Step S304: Among the similarities between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain, the cluster center vectors corresponding to the similarities that are greater than the preset similarity threshold are determined as candidate cluster center vectors.
[0134] It should be noted that if the similarity between the vector to be confirmed and the cluster center vector corresponding to a certain domain knowledge graph is greater than a preset similarity threshold, the cluster center vector corresponding to that domain knowledge graph will be determined as a candidate cluster center vector.
[0135] If the similarity between the vector to be confirmed and the cluster center vector corresponding to a certain domain knowledge graph is less than or equal to a preset similarity threshold (i.e., the vector to be confirmed is outside the range of the domain knowledge graph), the cluster center vector corresponding to the domain knowledge graph is deleted.
[0136] Step S305: Sort the candidate cluster center vectors to obtain the similarity ranking results; extract the domain knowledge graph corresponding to the cluster center vector with the highest similarity in the similarity ranking results as the target domain knowledge graph.
[0137] Step S306: Traverse each entity node in the target domain knowledge graph to obtain multiple paths to be used corresponding to the questions to be answered.
[0138] In this context, the information type of the entity node in each of the multiple paths to be used corresponds to a pre-set relevance threshold with the information type included in the question to be answered. Each entity node corresponds to multiple paths.
[0139] It should be noted that if the target domain knowledge graph is an RDF-based triple knowledge graph, and the target domain knowledge graph includes multiple node types, then it is necessary to traverse the entity nodes of each node type one by one, and use a point-wise ranking learning method to traverse the entity nodes under each node type to obtain multiple paths to be used that meet the preset threshold.
[0140] For example, a multi-level node ranking model can be obtained by training the BERT model, and multiple paths to be used that meet a preset threshold can be determined based on the model.
[0141] For example, if the target domain knowledge graph is an insurance domain graph, a random sampling method can be used to match the information type of the entity reflected by each entity node in the insurance domain (such as at least one of product information, attribute information, and channel information) with the information type of the head node required by the question to be answered, so as to identify the target head node from multiple entity nodes.
[0142] The target head node can be obtained in the following ways: Based on the relevance between the product information of the head node required by the question to be answered and the product information of the entity reflected by each entity node, the product information of the entity reflected by each entity node is sorted to obtain a product sorting result; based on the relevance between the attribute information of the head node required by the question to be answered and the attribute information of the entity reflected by each entity node, the attribute information of the entity reflected by each entity node is sorted to obtain an attribute sorting result; based on the relevance between the channel information of the head node required by the question to be answered and the channel information of the entity reflected by each entity node, the channel information of the entity reflected by each entity node is sorted to obtain a channel sorting result; the target head node is determined based on at least one of the following: the product information with the highest relevance in the product sorting result, the attribute information with the highest relevance in the attribute sorting result, and the channel information with the highest relevance in the channel sorting result.
[0143] Furthermore, based on the relevance between the information type of the entity reflected by each entity node in each candidate path corresponding to the target head node and the question to be answered, multiple candidate paths are sorted to obtain a path sorting result; from the path sorting result, multiple paths with a relevance greater than a preset relevance threshold are selected as multiple paths to be used corresponding to the question to be answered.
[0144] Step S307: Match the vector to be confirmed based on multiple paths to be used to determine the answer to the question to be answered.
[0145] It should be noted that if the question to be answered is related to product information, the target domain knowledge graph will be queried based on the sorted product information, channel information, and attribute information to obtain multiple alternative answers, which will be displayed to the user in a list; or, the answer with the highest matching degree to the question to be answered will be selected from the multiple alternative answers and sent to the user.
[0146] If the question to be answered is about the product's attributes, then the corresponding attribute value of the product will be provided to the user as the answer to the question.
[0147] In this embodiment, test positive and negative examples are constructed based on multiple domain knowledge graphs and all paths within each domain knowledge graph. Based on different test positive and negative examples, the paths in all domain knowledge graphs are clustered to obtain the cluster center vector corresponding to each domain knowledge graph. For the question to be answered, its corresponding confirmation vector is determined, and the similarity between the confirmation vector and the cluster center vector corresponding to each domain knowledge graph is measured. This enables the detection of the response range for different domain knowledge graphs, including the detection of domain-specific boundaries, thereby clarifying the target domain knowledge graph to which the question to be answered belongs and narrowing the search range for the answer to the question.
[0148] Furthermore, entity information and corresponding attribute information (product information or channel information, etc.) from multiple domain knowledge graphs are used as node information to construct a domain knowledge graph based on RDF triples. Further, based on the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph, it can be determined in which domain knowledge graphs the answer to the question is more likely to be found. Based on a preset similarity threshold and the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph, the target domain knowledge graph to which the question belongs can be determined, narrowing the retrieval scope of the answer. Therefore, when determining the answer to the question based on the target domain knowledge graph, the accuracy and efficiency of answer recognition can be improved, thereby enhancing question-answering recognition capabilities.
[0149] A second aspect of this application provides a knowledge graph question-answering device.
[0150] Figure 4 This is a block diagram of a knowledge graph question-answering device provided in an embodiment of this application. Figure 4 As shown, the knowledge graph question-answering device 400 includes, but is not limited to, the following modules.
[0151] The determination module 401 is configured to determine the confirmation vector corresponding to the question to be answered, and to determine the similarity between the confirmation vector and the cluster center vector corresponding to each domain knowledge graph.
[0152] The determination module 401 is also configured to determine the target domain knowledge graph to which the question to be answered belongs from each domain knowledge graph based on a preset similarity threshold and the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph.
[0153] The answer module 402 is configured to determine the answer to the question based on the target domain knowledge graph to which the question belongs.
[0154] The questions to be answered can be from any of the following fields: insurance, entertainment, and sports.
[0155] In some optional implementations, the knowledge graph question answering device 400 further includes: an acquisition module (not shown in the figure), configured to learn paths in multiple domain knowledge graphs in an unsupervised manner to obtain a pre-trained model, wherein, during the training process of the pre-trained model, the pre-trained model is obtained by training on test positive examples and test negative examples, wherein test positive examples consist of any two paths within the domain knowledge graph of the same domain, and test negative examples consist of any two paths within the domain knowledge graph of different domains; clustering each path in the multiple domain knowledge graphs based on the pre-trained model to obtain the knowledge graph space of each domain; and performing path clustering on the paths in the knowledge graph space of each domain to obtain the cluster center vector corresponding to each domain knowledge graph.
[0156] Each domain knowledge graph includes multiple entity nodes in the corresponding domain and connections used to represent the relationships between the multiple entity nodes. Any two or more entity nodes and their corresponding connections form a path.
[0157] In some optional implementations, the determining module 401 is further configured to: determine the distance values between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph; calculate the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph based on the determined distance values; wherein, the smaller the distance value, the greater the similarity.
[0158] In some optional implementations, the determining module 401 is further configured to: determine the cluster center vectors whose similarity to the vector to be confirmed and the cluster center vectors corresponding to the corresponding domain knowledge graphs is greater than a preset similarity threshold as candidate cluster center vectors; sort the candidate cluster center vectors to obtain a similarity ranking result; and extract the domain knowledge graph corresponding to the cluster center vector with the highest similarity in the similarity ranking result as the target domain knowledge graph. In some optional implementations, the target domain knowledge graph includes multiple entity nodes and connections used to represent the relationships between multiple entities, and any two or more entity nodes and their corresponding connections form a path. The answering module 402 is further configured to: traverse each entity node in the target domain knowledge graph to obtain multiple paths to be used corresponding to the question to be answered, wherein the information type of the entity reflected by each entity node in each path to be used satisfies a preset relevance threshold with the relevance between the entity type included in the question to be answered; and match the vector to be confirmed based on the multiple paths to be used to determine the answer to the question to be answered.
[0159] In some optional implementations, when the answering module 402 traverses each entity node in the target domain knowledge graph to obtain multiple paths to be used corresponding to the question to be answered, it performs the following steps:
[0160] Traverse each entity node, and identify the target head node from multiple entity nodes based on the information type of the head node required by the question to be answered and the information type of the entity reflected by each entity node. The target head node corresponds to multiple candidate paths. Based on the relevance between the information type of the entity reflected by each entity node in each candidate path corresponding to the target head node and the question to be answered, sort the multiple candidate paths to obtain the path sorting result. From the path sorting result, select multiple paths with a relevance greater than a preset relevance threshold as multiple paths to be used corresponding to the question to be answered.
[0161] In some alternative implementations, the information type includes at least one of product information, attribute information, and channel information; the information type of the header node required by the question to be answered includes at least one of product information, attribute information, and channel information.
[0162] When the answer module 402 identifies the target head node from multiple entity nodes based on the information type of the head node required by the question to be answered and the information type of the entity reflected by each entity node, it performs the following steps:
[0163] Based on the relevance between the product information of the head node required by the question to be answered and the product information of the entity reflected by each entity node, the product information of the entity reflected by each entity node is sorted to obtain the product sorting result.
[0164] Based on the relevance between the attribute information of the head node required by the question to be answered and the attribute information of the entity reflected by each entity node, the attribute information of the entity reflected by each entity node is sorted to obtain the attribute sorting result.
[0165] Based on the relevance between the channel information of the head node required by the question to be answered and the channel information of the entity reflected by each entity node, the channel information of the entity reflected by each entity node is sorted to obtain the channel sorting result.
[0166] The target head node is determined based on at least one of the following: the product information with the highest relevance in the product ranking results, the attribute information with the highest relevance in the attribute ranking results, and the channel information with the highest relevance in the channel ranking results.
[0167] In some optional implementations, the knowledge graph question answering device 400 further includes: an update module (not shown in the figure), configured to output a first prompt message when it is determined that the information type of the entity reflected by the head node is product information and the highest relevance in the product ranking result is less than a preset relevance threshold, wherein the first prompt message is used to prompt the user to input text including product information; obtain the text input by the user, and re-execute the steps of sorting the product information of the entity reflected by each entity node based on the relevance between the product information of the head node required by the question to be answered and the product information of the entity reflected by each entity node, and obtaining the product ranking result;
[0168] If it is determined that the information type of the entity reflected by the head node is attribute information, and the highest relevance in the attribute ranking result is less than the preset relevance threshold, a second prompt message is output, which is used to prompt the user to input text including attribute information; the user input text is obtained, and the steps of re-executing the attribute information of the entity reflected by each entity node based on the relevance between the attribute information of the head node required by the question to be answered and the attribute information of the entity reflected by each entity node are re-executed to obtain the attribute ranking result.
[0169] In this embodiment, the determination module determines the confirmation vector corresponding to the question to be answered and the similarity between the confirmation vector and the cluster center vectors corresponding to each domain knowledge graph. This allows for clarification of whether the question can be answered in one or more domain knowledge graphs based on the similarity between the confirmation vector and the cluster center vectors, enabling responses to questions for different domain knowledge graphs and facilitating subsequent processing. The determination module, based on a preset similarity threshold and multiple similarities, determines the target domain knowledge graph to which the question belongs, accurately identifying the question as belonging to the target domain knowledge graph and narrowing the search scope for answers. Finally, the answering module, based on the target domain knowledge graph to which the question belongs, determines the corresponding answer, improving the accuracy of answer recognition and enhancing question-and-answer recognition capabilities.
[0170] It is understood that the various method embodiments mentioned above in this application can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this application will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.
[0171] In addition, this application also provides electronic devices and computer-readable storage media, all of which can be used to implement any of the question-answering methods based on multi-domain knowledge graphs provided in this application. The corresponding technical solutions and descriptions are described in the corresponding descriptions in the method section and will not be repeated here.
[0172] Figure 5 This is a block diagram of an electronic device provided in an embodiment of this application.
[0173] like Figure 5 As shown, this application embodiment provides an electronic device 500, which includes: at least one processor 501; at least one memory 502; and one or more I / O interfaces 503 connected between the processor 501 and the memory 502; wherein, the memory 502 stores one or more computer programs that can be executed by at least one processor 501, and the one or more computer programs are executed by at least one processor 501 to enable at least one processor 501 to execute the above-described question-answering method based on multiple domain knowledge graphs.
[0174] This application also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor / processor core, implements the aforementioned question-answering method based on multiple domain knowledge graphs. The computer-readable storage medium can be volatile or non-volatile.
[0175] This application also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described question-answering method based on multiple domain knowledge graphs.
[0176] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0177] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0178] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0179] The computer program instructions used to perform the operations of this application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state information from the computer-readable program instructions. These electronic circuits can execute the computer-readable program instructions to implement various aspects of this application.
[0180] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0181] Various aspects of this application are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0182] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0183] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0184] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0185] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for general illustrative purposes only and should not be construed as limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this application as set forth by the appended claims.
Claims
1. A knowledge graph question-answering method, characterized in that, include: Determine the confirmation vector corresponding to the question to be answered, and determine the similarity between the confirmation vector and the cluster center vector corresponding to each domain knowledge graph; Based on a preset similarity threshold and the similarity between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain, the target domain knowledge graph to which the question to be answered belongs is determined from the knowledge graphs of each domain. Based on the knowledge graph of the target domain to which the question to be answered belongs, the answer corresponding to the question to be answered is determined.
2. The method according to claim 1, characterized in that, Each domain knowledge graph includes multiple entity nodes in the corresponding domain and connections used to represent the relationships between the multiple entity nodes. Any two or more entity nodes and their corresponding connections form a path. The method further includes: An unsupervised approach is used to learn paths in knowledge graphs of multiple domains to obtain a pre-trained model. During the training process of the pre-trained model, the model is obtained by training on test positive examples and test negative examples. The test positive examples consist of any two paths within the knowledge graph of the same domain, and the test negative examples consist of any two paths within the knowledge graph of different domains. Based on the pre-trained model, cluster the paths in the multiple domain knowledge graphs to obtain the knowledge graph space of each domain; Path clustering is performed on the paths in the knowledge graph space of each domain to obtain the cluster center vector corresponding to the knowledge graph of each domain.
3. The method according to claim 1, characterized in that, The step of determining the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph includes: Determine the distance between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph; The similarity between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain is calculated based on the determined distance value; where the smaller the distance value, the greater the similarity.
4. The method according to claim 1, characterized in that, The step of determining the target domain knowledge graph to which the question to be answered belongs from the various domain knowledge graphs based on a preset similarity threshold and the similarity between the vector to be confirmed and the cluster center vectors corresponding to each domain knowledge graph includes: Among the similarities between the vector to be confirmed and the cluster center vectors corresponding to the knowledge graphs of each domain, the cluster center vectors with similarities greater than a preset similarity threshold are determined as candidate cluster center vectors. The candidate cluster center vectors are sorted to obtain similarity ranking results; The domain knowledge graph corresponding to the cluster center vector with the highest similarity in the similarity ranking results is extracted as the target domain knowledge graph.
5. The method according to any one of claims 1 to 4, characterized in that, The target domain knowledge graph includes multiple entity nodes and connections used to represent the relationships between the multiple entities, and any two or more entity nodes and their corresponding connections form a path. The step of determining the answer to the question based on the knowledge graph of the target domain to which the question belongs includes: Traverse each entity node in the target domain knowledge graph to obtain multiple paths to be used corresponding to the question to be answered. The information type of the entity reflected by the entity node in each of the multiple paths to be used satisfies a preset relevance threshold with the information type included in the question to be answered. The answer to the question to be answered is determined by matching the vector to be confirmed based on the multiple paths to be used.
6. The method according to claim 5, characterized in that, The process of traversing each entity node in the target domain knowledge graph to obtain multiple paths to be used corresponding to the question to be answered includes: Traverse each entity node, and identify the target head node from the multiple entity nodes based on the information type of the head node required by the question to be answered and the information type of the entity reflected by each entity node. The target head node corresponds to multiple candidate paths. Based on the relevance between the information type of the entity reflected by each entity node in each candidate path corresponding to the target head node and the question to be answered, the multiple candidate paths are sorted to obtain the path sorting result; From the path sorting results, select multiple paths with a relevance greater than the preset relevance threshold as the multiple paths to be used corresponding to the question to be answered.
7. The method according to claim 6, characterized in that, The information type includes at least one of product information, attribute information, and channel information; the information type of the header node required by the question to be answered includes at least one of product information, attribute information, and channel information. The step of identifying the target head node from the plurality of entity nodes based on the information type of the head node required by the question to be answered and the information type of the entity reflected by each entity node includes: Based on the relevance between the product information of the head node required by the question to be answered and the product information of the entity reflected by each entity node, the product information of the entity reflected by each entity node is sorted to obtain the product sorting result. Based on the relevance between the attribute information of the head node required by the question to be answered and the attribute information of the entity reflected by each entity node, the attribute information of the entity reflected by each entity node is sorted to obtain the attribute sorting result. Based on the relevance between the channel information of the head node required by the question to be answered and the channel information of the entity reflected by each entity node, the channel information of the entity reflected by each entity node is sorted to obtain the channel sorting result. The target head node is determined based on at least one of the following: the product information with the highest relevance in the product ranking results, the attribute information with the highest relevance in the attribute ranking results, and the channel information with the highest relevance in the channel ranking results.
8. The method according to claim 7, characterized in that, Before determining the target head node based on at least one of the following: the product information with the highest relevance in the product ranking results, the attribute information with the highest relevance in the attribute ranking results, and the channel information with the highest relevance in the channel ranking results, the method further includes: If it is determined that the information type of the entity reflected by the head node is product information, and the highest relevance in the product ranking result is less than a preset relevance threshold, a first prompt message is output, wherein the first prompt message is used to prompt the user to input text including the product information; The steps are as follows: obtain the text input by the user, re-execute the steps of sorting the product information of the entity to which the entity belongs based on the relevance of the product information of the head node required by the question to be answered and the product information of the entity to which the entity belongs as reflected by each entity node, and obtain the product sorting result. If it is determined that the information type of the entity reflected by the head node is attribute information, and the highest relevance in the attribute sorting result is less than a preset relevance threshold, a second prompt message is output, wherein the second prompt message is used to prompt the user to input text including the attribute information; The steps are as follows: obtain the text input by the user, re-execute the steps of sorting the attribute information of the entity to which the entity belongs based on the relevance of the attribute information of the head node required by the question to be answered and the attribute information of the entity to which the entity belongs as reflected by each entity node, and obtain the attribute sorting result.
9. An electronic device, 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 one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the knowledge graph question answering method as described in any one of claims 1-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the knowledge graph question-answering method as described in any one of claims 1-8.
Citation Information
Patent Citations
Intelligent question-answering method based on knowledge graph and performance evaluation method thereof
CN111090735A
Knowledge graph question and answer method and system based on path sorting
CN113742446A
Question and answer method and device executed by electronic equipment
CN113868383A
Question answering method and device based on knowledge graph
CN114647718A