Method and system for determining logical expression based on decomposition-combination knowledge graph

CN115905488BActive Publication Date: 2026-09-22BEIJING KNOWLEDGE ATLAS TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211446572.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-18
Publication Date
2026-09-22
Estimated Expiration
2042-11-18

AI Technical Summary

Technical Problem

[0004]本申请提供基于分解-组合知识图谱的逻辑表达式确定方法及系统,以至少解决逻辑表式的确定精度较低、速度较慢且泛化问题严重的技术问题

Benefits of technology

[0040]本申请提出了基于分解-组合知识图谱的逻辑表达式确定方法及系统,所述方法包括:获取问句,并将所述问句分解为原子知识信息和逻辑形式;确定所述原子知识信息对应的关系候选集、类候选集和实体候选集;利用预先训练好的第一生成模型解析所述逻辑形式,得到所述逻辑形式对应的逻辑形式候选集;将所述原子知识信息对应的关系候选集、类候选集、实体候选集、所述逻辑形式对应的逻辑形式候选集组合,得到所述问句对应的逻辑表达式,供执行所述逻辑表达式从知识库中确定所述问句的答案。本申请提出的技术方案,可以快速准确的确定出逻辑表式,进而更好地回答泛化问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115905488B_ABST
    Figure CN115905488B_ABST
Patent Text Reader

Abstract

The application provides a logic expression determination method and system based on a decomposition-combination knowledge graph. The method comprises the following steps: acquiring a question sentence, and decomposing the question sentence into atomic knowledge information and a logic form; determining a relation candidate set, a class candidate set and an entity candidate set corresponding to the atomic knowledge information; analyzing the logic form by using a pre-trained first generation model to obtain a logic form candidate set corresponding to the logic form; combining the relation candidate set, the class candidate set, the entity candidate set and the logic form candidate set corresponding to the logic form to obtain a logic expression corresponding to the question sentence, so as to execute the logic expression to determine an answer of the question sentence from a knowledge base. The technical scheme provided by the application can quickly and accurately determine a logic expression, and further better answer a generalization question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer science, and in particular to a method and system for determining logical expressions based on decomposition-combination knowledge graphs. Background Technology

[0002] Knowledge graphs contain rich structured information, but accessing them requires sophisticated query statements. Knowledge Graph Question Answering (KBQA) aims to provide a user-friendly way to access large-scale knowledge bases (KBs) through natural language questions. Existing knowledge graph question answering models can be broadly categorized into two types: retrieval-based methods and semantic parsing (SP)-based methods. Retrieval-based methods extract relevant subgraphs from the knowledge graph based on the question and use entities in the subgraphs as candidate answers, scoring the relevance between the question and candidate answers. [Feng, 2021], [He, 2021], and [Qiu, 2020] are classic retrieval-based methods. However, because they directly measure candidate answers, these models are difficult to apply to complex problems involving logical operators such as comparison and aggregation. On the other hand, SP-based methods, such as [Das, 2021] and [Cao, 2022], first translate the question into a query statement such as SPARQL, and then execute the query statement on the knowledge graph to obtain the answer. These methods can theoretically solve any complex problem and have achieved good results on most datasets. In recent years, with the development of pre-trained language models (PLMs), SP methods based on PLM models such as BART and T5, for example [Cao, kqa, 2022], have shown good performance. However, these methods rely excessively on knowledge combination and distribution information in the training set, and perform poorly for knowledge that does not appear in the training set, exhibiting serious generalization problems.

[0003] GrailQA [Cu, 2021] overcomes the generalization problem through an enumeration-sorting strategy. Since the enumeration process is independent of the model, and the sorting process captures the similarity between the expression as a whole and the question, this strategy can solve the generalization problem. However, limited by the large scale of the knowledge graph, GrailQA [Cu, 2021] cannot enumerate across the entire knowledge graph, resulting in low model coverage and consequently low accuracy. [Ye, 2022] adds a generative model to GrailQA [Cu, 2021] to overcome the coverage problem. However, atomic knowledge and logical forms are coupled together in the logical expressions, and some logical expressions are still limited by the size of the knowledge graph and cannot be enumerated. These unenumerated logical expressions still suffer from the generalization problem. [Cao, 2022] separates atomic knowledge and logical forms, but the learning of atomic knowledge in each hop depends on previously extracted atomic knowledge, which increases the difficulty of discovering new knowledge combinations. Summary of the Invention

[0004] This application provides a method and system for determining logical expressions based on decomposition-combination knowledge graphs, in order to at least solve the technical problems of low accuracy, slow speed and serious generalization problem in determining logical expressions.

[0005] The first aspect of this application proposes a method for determining logical expressions based on decomposition-combination knowledge graphs, the method comprising:

[0006] Obtain the question and decompose it into atomic knowledge information and logical form;

[0007] Determine the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information;

[0008] The logical form is parsed using a pre-trained first generative model to obtain a candidate set of logical forms corresponding to the logical form;

[0009] The candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical forms are combined to obtain the logical expression corresponding to the question, which is then used to execute the logical expression to determine the answer to the question from the knowledge base.

[0010] Preferably, determining the candidate set of relations and the candidate set of classes corresponding to the atomic knowledge information includes:

[0011] Based on the question, the BM25 algorithm is used to perform coarse screening of relations and classes in the knowledge graph to obtain an initial candidate set of relations and an initial candidate set of classes.

[0012] Each relation and question in the initial candidate set of relations is input into the pre-trained first BERT model to obtain the similarity between each relation and the question. Then, the obtained similarity is input into a linear classifier to map the similarity score between each relation in the initial candidate set of relations and the question.

[0013] Relations in the initial candidate set of relations whose similarity score with the question is greater than a preset first score are filtered out to form a candidate set of relations;

[0014] Each class and question in the initial candidate set is input into the pre-trained second BERT model to obtain the similarity between each class and the question. Then, the obtained similarity scores are input into a linear classifier to map the similarity scores between each class in the initial candidate set and the question.

[0015] Classes in the initial candidate set whose similarity score with the question is greater than a preset second score are selected to form a class candidate set.

[0016] Preferably, determining the entity candidate set corresponding to the atomic knowledge information includes:

[0017] A Trie tree is built using the surface names of all entities in the knowledge base. A reference candidate set containing all noun phrases mentioned in the question is searched based on the Trie tree. The reference candidate set containing all noun phrases mentioned in the question is used as the reference candidate set corresponding to the atomic knowledge information.

[0018] The ED tool is used to link each mention in the mention candidate set with the entity in the knowledge graph to obtain the initial entity candidate set;

[0019] Entities in the initial candidate set of entities that cannot be connected to any relationship in the candidate set of relationships are deleted, and the remaining entities in the initial candidate set of entities are sorted in descending order of popularity to obtain the entity candidate set.

[0020] Furthermore, the step of using a pre-trained first generative model to parse the logical form and obtain a candidate set of logical forms corresponding to the logical form includes:

[0021] The entity information in the question is covered, and an initial candidate set in logical form is obtained through the pre-trained first generative model;

[0022] Filter out logical forms that do not belong to the preset set of correct logical forms in the initial candidate set of logical forms, and determine the edit distance between each filtered logical form and each logical form in the preset set of correct logical forms;

[0023] Each selected logical form is replaced with the logical form in the preset set of correct logical forms that is closest to it in terms of editing distance, and the initial candidate set of the replaced logical forms is used as the candidate set of logical forms corresponding to the logical form.

[0024] Preferably, the step of combining the candidate set of relations, candidate set of classes, candidate set of entities, and candidate set of logical forms corresponding to the atomic knowledge information to obtain the logical expression corresponding to the question includes:

[0025] By using a pre-trained ranking model or a second generation model, the candidate sets of relations, classes, entities, and logical forms corresponding to the atomic knowledge information are combined to obtain the logical expression corresponding to the question.

[0026] Furthermore, the step of combining the candidate sets of relations, classes, entities, and logical forms corresponding to the atomic knowledge information using a pre-trained ranking model to obtain the logical expression corresponding to the question includes:

[0027] For the knowledge placeholders in the logical form candidate set, the parameters in the relation candidate set, class candidate set, and entity candidate set are enumerated sequentially using the sorting model to obtain multiple sets of executable logical expressions;

[0028] The executable logical expressions are concatenated with the question, and then input into the pre-trained third BERT model to obtain the similarity between each executable logical expression and the question.

[0029] The executable logical expression with the highest similarity is used as the logical expression corresponding to the question.

[0030] Furthermore, the step of combining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical form, using a pre-trained second generative model, to obtain the logical expression corresponding to the question, includes:

[0031] Based on the candidate sets of relations, classes, and entities, the connected atomic knowledge pairs are enumerated. Then, the atomic knowledge pairs are concatenated with the logical forms in the candidate sets of logical forms and input into the pre-trained second generative model to obtain the logical expression corresponding to the question.

[0032] A second aspect of this application proposes a logical expression determination system based on a decomposition-combination knowledge graph, the system comprising:

[0033] The acquisition module is used to acquire questions and decompose the questions into atomic knowledge information and logical forms.

[0034] The first determining module is used to determine the candidate set of relations, candidate set of classes, and candidate set of entities corresponding to the atomic knowledge information;

[0035] The second determining module is used to parse the logical form using a pre-trained first generative model to obtain a candidate set of logical forms corresponding to the logical form.

[0036] The third determining module is used to combine the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical forms, to obtain the logical expression corresponding to the question, for executing the logical expression to determine the answer to the question from the knowledge base.

[0037] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the method described in the first aspect embodiment.

[0038] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the method described in the first aspect.

[0039] The technical solutions provided by the embodiments of this application bring at least the following beneficial effects:

[0040] This application proposes a method and system for determining logical expressions based on decomposition-combination knowledge graphs. The method includes: acquiring a question and decomposing the question into atomic knowledge information and a logical form; determining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information; parsing the logical form using a pre-trained first generative model to obtain a candidate set of logical forms corresponding to the logical form; and combining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, along with the candidate set of logical forms corresponding to the logical form, to obtain a logical expression corresponding to the question, which is then used to execute the logical expression to determine the answer to the question from a knowledge base. The technical solution proposed in this application can quickly and accurately determine logical expressions, thereby better answering generalization questions.

[0041] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0042] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0043] Figure 1 This is a flowchart illustrating a method for determining logical expressions based on a decomposition-combination knowledge graph, according to an embodiment of this application.

[0044] Figure 2 The following is a flowchart illustrating a method for determining logical expressions based on a decomposition-combination knowledge graph according to an embodiment of this application.

[0045] Figure 3 This is a structural diagram of a system for determining logical expressions based on a decomposition-combination knowledge graph, according to an embodiment of this application.

[0046] Figure 4 This is a structural diagram of a second determining module provided according to an embodiment of this application. Detailed Implementation

[0047] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0048] This application proposes a method and system for determining logical expressions based on decomposition-combination knowledge graphs. The method includes: acquiring a question and decomposing the question into atomic knowledge information and a logical form; determining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information; parsing the logical form using a pre-trained first generative model to obtain a candidate set of logical forms corresponding to the logical form; and combining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, along with the candidate set of logical forms corresponding to the logical form, to obtain a logical expression corresponding to the question, which is then used to execute the logical expression to determine the answer to the question from a knowledge base. The technical solution proposed in this application can quickly and accurately determine logical expressions, thereby better answering generalization questions.

[0049] The following describes, with reference to the accompanying drawings, a method and system for determining logical expressions based on decomposition-combination knowledge graphs according to embodiments of this application.

[0050] Example 1

[0051] Figure 1 This is a flowchart illustrating a method for determining logical expressions based on a decomposition-combination knowledge graph according to an embodiment of this application. Figure 1 As shown, the method includes:

[0052] Step 1: Obtain the question and decompose it into atomic knowledge information and logical form;

[0053] Step 2: Determine the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information;

[0054] In this embodiment of the disclosure, determining the candidate set of relations and the candidate set of classes corresponding to the atomic knowledge information includes:

[0055] Based on the question, the BM25 algorithm is used to perform coarse screening of relations and classes in the knowledge graph to obtain an initial candidate set of relations and an initial candidate set of classes.

[0056] Each relation and question in the initial candidate set of relations is input into the pre-trained first BERT model to obtain the similarity between each relation and the question. Then, the obtained similarity is input into a linear classifier to map the similarity score between each relation in the initial candidate set of relations and the question.

[0057] Relations in the initial candidate set of relations whose similarity score with the question is greater than a preset first score are filtered out to form a candidate set of relations;

[0058] Each class and question in the initial candidate set is input into the pre-trained second BERT model to obtain the similarity between each class and the question. Then, the obtained similarity scores are input into a linear classifier to map the similarity scores between each class in the initial candidate set and the question.

[0059] Classes in the initial candidate set whose similarity score with the question is greater than a preset second score are selected to form a class candidate set.

[0060] In this embodiment of the disclosure, determining the entity candidate set corresponding to the atomic knowledge information includes:

[0061] A Trie tree is built using the surface names of all entities in the knowledge base. A reference candidate set containing all noun phrases mentioned in the question is searched based on the Trie tree. The reference candidate set containing all noun phrases mentioned in the question is used as the reference candidate set corresponding to the atomic knowledge information.

[0062] The ED tool is used to link each mention in the mention candidate set with the entity in the knowledge graph to obtain the initial entity candidate set;

[0063] Entities in the initial candidate set of entities that cannot be connected to any relationship in the candidate set of relationships are deleted, and the remaining entities in the initial candidate set of entities are sorted in descending order of popularity to obtain the entity candidate set.

[0064] Step 3: Use the pre-trained first generative model to parse the logical form and obtain the candidate set of logical forms corresponding to the logical form;

[0065] In this embodiment of the disclosure, step 3 specifically includes:

[0066] Step 3-1: Cover the entity information in the question and obtain an initial candidate set of logical forms through the pre-trained first generative model;

[0067] Step 3-2: Filter out the logical forms in the initial candidate set of logical forms that do not belong to the preset set of correct logical forms, and determine the edit distance between each filtered logical form and each logical form in the preset set of correct logical forms;

[0068] Step 3-3: Replace each selected logical form with the logical form that is closest to it in the preset set of correct logical forms, and use the initial candidate set of the replaced logical forms as the candidate set of logical forms corresponding to the logical forms.

[0069] Step 4: Combine the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical form, to obtain the logical expression corresponding to the question, which is then used to execute the logical expression to determine the answer to the question from the knowledge base.

[0070] In this embodiment of the disclosure, step 4 specifically includes:

[0071] By using a pre-trained ranking model or a second generation model, the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, as well as the candidate sets of logical forms corresponding to the logical forms, are combined to obtain the logical expression corresponding to the question, so as to execute the logical expression to determine the answer to the question from the knowledge base.

[0072] The step of combining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical forms, using a pre-trained ranking model to obtain the logical expression corresponding to the question, includes:

[0073] For the knowledge placeholders in the logical form candidate set, the parameters in the relation candidate set, class candidate set, and entity candidate set are enumerated sequentially using the sorting model to obtain multiple sets of executable logical expressions;

[0074] The executable logical expressions are concatenated with the question, and then input into the pre-trained third BERT model to obtain the similarity between each executable logical expression and the question.

[0075] The executable logical expression with the highest similarity is used as the logical expression corresponding to the question.

[0076] The step of combining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical forms, using a pre-trained second generative model to obtain the logical expression corresponding to the question, includes:

[0077] Based on the candidate sets of relations, classes, and entities, the connected atomic knowledge pairs are enumerated. Then, the atomic knowledge pairs are concatenated with the logical forms in the candidate sets of logical forms and input into the pre-trained second generative model to obtain the logical expression corresponding to the question.

[0078] To more clearly illustrate the implementation flow of a logical expression determination method based on decomposition-combination knowledge graphs according to an embodiment of this application, such as... Figure 2 As shown, a specific method embodiment will be described in detail below:

[0079] Step F1: Extract the relationships involved in the problem

[0080] Get a question q Figure 2 The question is: What railway does Antonio's terminuses belong to? The corresponding target logical expression s, as shown in the diagram, is: (AND rail.railway(JOIN rail.railway.terminuses m.01zsrrk)). This embodiment uses a relation extraction model to extract the set of relations appearing in s from q. First, coarse-screened relation candidates are obtained from the knowledge graph based on the word overlap between relation names and q. Then, BERT is applied as a cross-encoder to more accurately measure the semantic similarity between q and each relation candidate r. The encoder accepts the connection between q and r as input, then uses the output CLS embedding vector to represent the similarity, and inputs it into a linear classifier to map out the score. This embodiment uses relation name, relation domain (the category of the head entity), and relation range (the category of the tail entity) to describe r. The input is represented as [CLS]q[SEP]name(r)[D]domain(r)[R]range(r), where [CLS], [SEP], [D], and [R] are special labels. Then, the contrastive loss is optimized to improve the score of correct relations and penalize incorrect relations. This embodiment selects relations with the same domain or range as correct relations as strong incorrect relations, making the encoder more effective in distinguishing between correct and incorrect relations. During the testing phase, this real-time example uses the pre-trained first BERT model to retrieve the top-k relation set, using R... q express.

[0081] Step F2: Extract the categories involved in the problem

[0082] The model architecture for class extraction is the same as that for relation extraction. In this embodiment, a class is represented by its name and domain, and classes within the same domain are selected as negative examples in training. The set of the top k relevant classes is represented by C. q express.

[0083] Step F3: Extract the entities involved in the problem

[0084] This embodiment constructs a Trie tree based on the surface names (including entity names and aliases) of all entities in the knowledge base, and efficiently searches a candidate mention set M containing all noun phrases mentioned in the question based on the Trie tree. q For M q Each mention in the knowledge graph is linked to an entity in the knowledge graph using the state-of-the-art ED tool BLINK to obtain an initial candidate set of entities. Similar to most KBQA models, this embodiment selects the top candidate entity for each mention. Simultaneously, for each entity e and R in the initial candidate set... q For each relation r in R, check if e has a relation r, and delete those that cannot be related to r. q Any entities connected by any relationship are identified, and the remaining entities are ranked according to their popularity to obtain the entity candidate set E. q .

[0085] This implementation uses a GrailQA-like approach to calculate entity popularity. Because it uses top-k relationships as constraints, the pruned entities are more accurate, which can further improve the performance of subsequent QA. For numerical information appearing in q, especially numbers and years, this implementation defines regular expressions to extract them.

[0086] Step F4: Overlay the entity information in q and obtain logical representation candidates through the sequence generation model.

[0087] Logical form parsing aims to parse a given question (question q) into a logical form (l). Unlike logical expressions (s) which contain both knowledge-related and knowledge-unrelated skeletons, logical forms only represent the skeleton and are easier to parse and generate than logical expressions. Logical form parsing can be generalized across knowledge graphs without generalization issues. This embodiment uses the state-of-the-art first generation model, generation model T5, to parse logical forms. Since many entity names contain markers such as "and" and "of," which may mislead the parsing of logical forms, this embodiment uses special markers. <entity0> 、 <entity1>... to replace each mention of m in the question.

[0088] Experiments show that when the top-1 logical form is incorrect, beam search also struggles to include the correct logical form in the top-5 predictions. A typical error is... <rel>and <rel> <rel>Misinterpretation. For example, the question "Thomas Guppy was the designer of what ship?" is easily translated into a single-hop relation "ship designer". However, in Freebase, "ship designer" is represented by boats.ship_designer.boats_design and boats.ship.designer, which is a two-hop path. Therefore, when <rel>When performing top-1 prediction for T5, this embodiment manually adds... <rel> <rel>As top-2 candidates, instead of the top 2 candidates selected using a beam search. The set in logical form is represented as L. q Since the logical form generated by T5 cannot guarantee syntactic correctness, this embodiment performs additional post-processing to correct syntax errors. Specifically, if the logical form is not in the set of correct logical forms, this embodiment replaces it with the logical form most similar to the correct logical form in the set, i.e., the logical form with the closest editing distance.

[0089] Step F5: Integrate the candidate blocks using a sorting model or a second generative model to obtain the final logical expression.

[0090] This embodiment proposes two methods that combine atomic knowledge and logically formal candidates: sorting and generation.

[0091] The ranking model first enumerates all executable combinations and then selects the combination most relevant to the problem. Specifically, for the logical representation candidate set L... q Knowledge placeholders in ( <rel> 、 <class> 、 <entity>and <literal>), sequentially enumerate the retrieved atomic knowledge R q C q and E q This yields a set of executable logical expressions, denoted as S. q Then, S q Each s in the algorithm is concatenated with q and used as input to a BERT-based cross-encoder to measure the correlation between q and s.

[0092] The second generative model cannot enumerate the complete logical expression required by the rank model; instead, it can only accept individual atomic knowledge and candidate logical forms as input to the encoder to decode executable logical expressions. However, since individual knowledge may be disconnected within the knowledge base, the generated logical expressions often cannot be executed. To reduce the disconnection issues, this embodiment proposes a partial enumeration strategy for knowledge graph constraints, which only enumerates atomic knowledge pairs, including (entity, relation), (relation, relation), and (relation, class). For example, in... Figure 2 In this model, since the class `railway.railway` is connected to the relation `rail.railway.terminuses`, the pair `(railway.railway, rail.railway.terminuses)` is added to the input of the generative model. These are then concatenated with candidate logical forms and used as input to the second generative model to generate the target logical expression.

[0093] Experiments show that existing technologies like RNG-KBQA and GrailQA-Rank require enumerating all logical expressions in a 2-hop subgraph, and the ranking model needs to score each question, resulting in thousands of scores per sample, which is very time-consuming. The ranking model in this embodiment first retrieves the most relevant atomic knowledge and logical forms, and then enumerates combinations based on the filtered candidate set, which significantly reduces inference time. Experiments show that the model in this embodiment is three times faster than RNG-KBQA on a 24GB GPU. It is worth noting that the enumeration time of the 2-hop subgraph is not included in the calculation of RNG-KBQA's inference time because enumeration is too time-consuming and not worth reproducing; therefore, in reality, RNG-KBQA's online inference time is slower.

[0094] The method in this embodiment outperforms the baseline, especially on the combinatorial generalization and zero-shot generalization test sets. Compared to the best published model RNG-KBQA, the method in this embodiment achieves absolute gains of 6.3% and 6.1% in F1 and EM scores, respectively. Whether combining the ranking model or the generative model, the method achieves better performance than RNG-KBQA, demonstrating the effectiveness of the decomposition-composition framework, where each component can improve the final performance. The ranking model outperforms the generative model, especially on the combinatorial generalization and zero-shot generalization test sets. The former performs model-independent enumeration on the complete combination, while the latter only enumerates partial combinations and still relies on the model to generate the complete combination. Therefore, the ranking model has better generalization ability than the generative model, further demonstrating that the method provided in this embodiment is more efficient and accurate.

[0095] In summary, the logical expression determination method based on decomposition-combination knowledge graph proposed in this embodiment can quickly and accurately determine the logical expression, thereby better answering generalization questions.

[0096] Example 2

[0097] Figure 3 To illustrate the structure diagram of a system for determining a system based on a decomposition-combination knowledge graph according to an embodiment of this application, such as... Figure 3 As shown, the system includes:

[0098] The acquisition module 100 is used to acquire a question and decompose the question into atomic knowledge information and logical form;

[0099] The first determining module 200 is used to determine the candidate set of relations, candidate set of classes, and candidate set of entities corresponding to the atomic knowledge information;

[0100] The second determining module 300 is used to parse the logical form using a pre-trained first generative model to obtain a candidate set of logical forms corresponding to the logical form.

[0101] The third determining module 400 is used to combine the candidate set of relations, candidate set of classes, candidate set of entities, and candidate set of logical forms corresponding to the atomic knowledge information to obtain the logical expression corresponding to the question, so as to execute the logical expression to determine the answer to the question from the knowledge base.

[0102] In this embodiment of the disclosure, determining the candidate set of relations and the candidate set of classes corresponding to the atomic knowledge information includes:

[0103] Based on the question, the BM25 algorithm is used to perform coarse screening of relations and classes in the knowledge graph to obtain an initial candidate set of relations and an initial candidate set of classes.

[0104] Each relation and question in the initial candidate set of relations is input into the pre-trained first BERT model to obtain the similarity between each relation and the question. Then, the obtained similarity is input into a linear classifier to map the similarity score between each relation in the initial candidate set of relations and the question.

[0105] Relations in the initial candidate set of relations whose similarity score with the question is greater than a preset first score are filtered out to form a candidate set of relations;

[0106] Each class and question in the initial candidate set is input into the pre-trained second BERT model to obtain the similarity between each class and the question. Then, the obtained similarity scores are input into a linear classifier to map the similarity scores between each class in the initial candidate set and the question.

[0107] Classes in the initial candidate set whose similarity score with the question is greater than a preset second score are selected to form a class candidate set.

[0108] In this embodiment of the disclosure, determining the entity candidate set corresponding to the atomic knowledge information includes:

[0109] A Trie tree is built using the surface names of all entities in the knowledge base. A reference candidate set containing all noun phrases mentioned in the question is searched based on the Trie tree. The reference candidate set containing all noun phrases mentioned in the question is used as the reference candidate set corresponding to the atomic knowledge information.

[0110] The ED tool is used to link each mention in the mention candidate set with the entity in the knowledge graph to obtain the initial entity candidate set;

[0111] Entities in the initial candidate set of entities that cannot be connected to any relationship in the candidate set of relationships are deleted, and the remaining entities in the initial candidate set of entities are sorted in descending order of popularity to obtain the entity candidate set.

[0112] In the embodiments disclosed herein, such as Figure 4 As shown, the second determining module 300 includes:

[0113] The first determining unit 301 is used to cover the entity information in the question and obtain an initial candidate set of logical forms through the pre-trained first generative model.

[0114] The second determining unit 302 is used to filter out logical forms that do not belong to the preset set of correct logical forms in the initial candidate set of logical forms, and to determine the edit distance between each filtered logical form and each logical form in the preset set of correct logical forms.

[0115] The third determining unit 303 is used to replace each selected logical form with the logical form that is closest to it in the preset set of correct logical forms, and to use the initial candidate set of the replaced logical forms as the candidate set of logical forms corresponding to the logical forms.

[0116] In this embodiment of the disclosure, the third determining module 400 is specifically used for:

[0117] By using a pre-trained ranking model or a second generation model, the candidate sets of relations, classes, entities, and logical forms corresponding to the atomic knowledge information are combined to obtain the logical expression corresponding to the question.

[0118] Furthermore, the step of combining the candidate sets of relations, classes, entities, and logical forms corresponding to the atomic knowledge information using a pre-trained ranking model to obtain the logical expression corresponding to the question includes:

[0119] For the knowledge placeholders in the logical form candidate set, the parameters in the relation candidate set, class candidate set, and entity candidate set are enumerated sequentially using the sorting model to obtain multiple sets of executable logical expressions;

[0120] The executable logical expressions are concatenated with the question, and then input into the pre-trained third BERT model to obtain the similarity between each executable logical expression and the question.

[0121] The executable logical expression with the highest similarity is used as the logical expression corresponding to the question.

[0122] Furthermore, the step of combining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical form, using a pre-trained second generative model, to obtain the logical expression corresponding to the question, includes:

[0123] Based on the candidate sets of relations, classes, and entities, the connected atomic knowledge pairs are enumerated. Then, the atomic knowledge pairs are concatenated with the logical forms in the candidate sets of logical forms and input into the pre-trained second generative model to obtain the logical expression corresponding to the question.

[0124] In summary, the logical expression determination system based on decomposition-combination knowledge graph proposed in this embodiment can quickly and accurately determine logical expressions, thereby better answering generalization questions.

[0125] Example 3

[0126] To implement the above embodiments, this disclosure also proposes an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the method described in Embodiment 1.

[0127] Example 4

[0128] To implement the above embodiments, this disclosure also proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in Embodiment 1.

[0129] In the description of this specification, the references to "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0130] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0131] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.< / literal> < / entity> < / class> < / rel> < / rel> < / rel> < / rel> < / rel> < / rel> < / rel> < / entity0>

Claims

1. A method for determining logical expressions based on decomposition-combination knowledge graphs, characterized in that, The method includes: Obtain the question and decompose it into atomic knowledge information and logical form; Determine the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information; The logical form is parsed using a pre-trained first generative model to obtain a candidate set of logical forms corresponding to the logical form; The candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical forms are combined to obtain the logical expression corresponding to the question, which is then used to determine the answer to the question from the knowledge base by executing the logical expression. The step of combining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical form, to obtain the logical expression corresponding to the question, includes: By using a pre-trained ranking model or a second generation model, the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical forms are combined to obtain the logical expression corresponding to the question. The logical expression corresponding to the question is obtained using a pre-trained ranking model, including: For the knowledge placeholders in the logical form candidate set, the parameters in the relation candidate set, class candidate set, and entity candidate set are enumerated sequentially using the sorting model to obtain multiple sets of executable logical expressions; The executable logical expressions are concatenated with the question, and then input into the pre-trained third BERT model to obtain the similarity between each executable logical expression and the question. The executable logical expression with the highest similarity is taken as the logical expression corresponding to the question; The logical expression corresponding to the question is obtained using the second generative model, including: Based on the candidate sets of relations, classes, and entities, the connected atomic knowledge pairs are enumerated. Then, the atomic knowledge pairs are concatenated with the logical forms in the candidate sets of logical forms and input into the pre-trained second generative model to obtain the logical expression corresponding to the question.

2. The method as described in claim 1, characterized in that, Determining the candidate set of relations and candidate set of classes corresponding to the atomic knowledge information includes: Based on the question, the BM25 algorithm is used to perform coarse screening of relations and classes in the knowledge graph to obtain an initial candidate set of relations and an initial candidate set of classes. Each relation and question in the initial candidate set of relations is input into the pre-trained first BERT model to obtain the similarity between each relation and the question. Then, the obtained similarity is input into a linear classifier to map the similarity score between each relation in the initial candidate set of relations and the question. Relations in the initial candidate set of relations whose similarity score with the question is greater than a preset first score are filtered out to form a candidate set of relations; Each class and question in the initial candidate set is input into the pre-trained second BERT model to obtain the similarity between each class and the question. Then, the obtained similarity scores are input into a linear classifier to map the similarity scores between each class in the initial candidate set and the question. Classes in the initial candidate set whose similarity score with the question is greater than a preset second score are selected to form a class candidate set.

3. The method as described in claim 1, characterized in that, Determining the entity candidate set corresponding to the atomic knowledge information includes: A Trie tree is built using the surface names of all entities in the knowledge base. A reference candidate set containing all noun phrases mentioned in the question is searched based on the Trie tree. The reference candidate set containing all noun phrases mentioned in the question is used as the reference candidate set corresponding to the atomic knowledge information. The ED tool is used to link each mention in the mention candidate set with the entity in the knowledge graph to obtain the initial entity candidate set; Entities in the initial candidate set of entities that cannot be connected to any relationship in the candidate set of relationships are deleted, and the remaining entities in the initial candidate set of entities are sorted in descending order of popularity to obtain the entity candidate set.

4. The method as described in claim 3, characterized in that, The step of using a pre-trained first generative model to parse the logical form and obtain a candidate set of logical forms corresponding to the logical form includes: The entity information in the question is covered, and an initial candidate set in logical form is obtained through the pre-trained first generative model; Filter out logical forms that do not belong to the preset set of correct logical forms in the initial candidate set of logical forms, and determine the edit distance between each filtered logical form and each logical form in the preset set of correct logical forms; Each selected logical form is replaced with the logical form that is closest to it in the preset set of correct logical forms, and the initial candidate set of the replaced logical forms is used as the candidate set of logical forms corresponding to the logical form.

5. A logical expression determination system based on decomposition-combination knowledge graphs, characterized in that, include: The acquisition module is used to acquire questions and decompose the questions into atomic knowledge information and logical forms. The first determining module is used to determine the candidate set of relations, candidate set of classes, and candidate set of entities corresponding to the atomic knowledge information; The second determining module is used to parse the logical form using a pre-trained first generative model to obtain a candidate set of logical forms corresponding to the logical form. The third determining module is used to combine the candidate set of relations, candidate set of classes, candidate set of entities, and candidate set of logical forms corresponding to the atomic knowledge information to obtain the logical expression corresponding to the question, so as to execute the logical expression to determine the answer to the question from the knowledge base; The step of combining the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical form, to obtain the logical expression corresponding to the question, includes: By using a pre-trained ranking model or a second generation model, the candidate sets of relations, classes, and entities corresponding to the atomic knowledge information, and the candidate sets of logical forms corresponding to the logical forms are combined to obtain the logical expression corresponding to the question. The logical expression corresponding to the question is obtained using a pre-trained ranking model, including: For the knowledge placeholders in the logical form candidate set, the parameters in the relation candidate set, class candidate set, and entity candidate set are enumerated sequentially using the sorting model to obtain multiple sets of executable logical expressions; The executable logical expressions are concatenated with the question, and then input into the pre-trained third BERT model to obtain the similarity between each executable logical expression and the question. The executable logical expression with the highest similarity is taken as the logical expression corresponding to the question; The logical expression corresponding to the question is obtained using the second generative model, including: Based on the candidate sets of relations, classes, and entities, the connected atomic knowledge pairs are enumerated. Then, the atomic knowledge pairs are concatenated with the logical forms in the candidate sets of logical forms and input into the pre-trained second generative model to obtain the logical expression corresponding to the question.

6. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any one of claims 1-4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Relation detection method for question-answering system based on a knowledge graph

    CN111400455A

  • Information interaction method and equipment

    CN113139036A