Query method and related equipment

CN119585726APending Publication Date: 2025-03-07HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280097858.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-07-19
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

Existing computer search technology is difficult to give correct answers to common sense, opinion, complex queries and new queries, and the credibility and interpretability of queries are low.

Method used

By obtaining user queries, we generate query results that include answers obtained through deductive reasoning, major and minor premises, and evidence used to prove the major and minor premises. We use semantic representation models and neural network models for reasoning and automatically select appropriate major premises. Premise and minor premise evidence to achieve effective prediction and path completion of queries.

Benefits of technology

It improves the accuracy and credibility of queries, enhances the interpretability of queries, and can effectively handle common sense, opinion, complex queries and new queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119585726A_ABST
    Figure CN119585726A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence and computer search, and provides a query method and related equipment. The method comprises the steps of obtaining query of a user; generating a query result, wherein the query result comprises a first answer of the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, a first major premise evidence for proving the first major premise, and a first minor premise evidence for proving the first minor premise; or the query result comprises a first answer of the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and a first minor premise evidence for proving the first minor premise. By adopting the method and the device, correct answers of common sense type query, viewpoint type query, complex query and new query can be given.
Need to check novelty before this filing date? Find Prior Art

Description

Query method and related equipment Technical Field

[0001] The embodiments of the present application relate to the fields of artificial intelligence and computer search technology, and in particular to a query method and related equipment. Background Art

[0002] Computer search technology has begun to be applied to the search systems of many companies. To achieve accurate search, the following methods are currently commonly used:

[0003] (1) Search + Extraction Method: Search to obtain relevant content web pages, then read and extract the web pages to obtain the answer to the query;

[0004] (2) Parsing + graph query method: For search queries, natural statements are first converted into graph query statements (such as SPARQL, the full name of which is SPARQL Protocol and RDF Query Language) through parsing, and then the graph is searched through the graph query statement to obtain the answer to the query.

[0005] The search-and-extraction approach can obtain a set of possible results through search, and then obtain the answer through complex extraction. The parsing-and-graph query approach can answer some manually summarized common-sense queries. However, these approaches still have many shortcomings. For example, they struggle to provide correct answers to common-sense queries, opinion-based queries, complex queries, and novel queries, and their credibility and interpretability are low.

[0006] Summary of the Invention

[0007] The present application provides a query method and related equipment that can provide correct answers to common sense queries, opinion queries, complex queries, and new queries.

[0008] In a first aspect, embodiments of the present application provide a query method, applied to a first electronic device. The method comprises: obtaining a user's query; and generating a query result, wherein the query result comprises: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, first major premise evidence for proving the first major premise, and first minor premise evidence for proving the first minor premise; or the query result comprises: the first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first minor premise evidence for proving the first minor premise. The first major premise evidence and the first minor premise evidence are evidence information retrieved in response to the user's query. The first major premise is obtained by inductive reasoning based on the first major premise evidence, or the first major premise is common sense information retrieved in response to the user's query. It should be understood that when the first major premise is retrieved common sense information, the query result does not include the major premise evidence; when the first major premise is obtained by inductive reasoning based on the first major premise evidence, the query result includes the first major premise evidence. The first minor premise is generated based on the first minor premise evidence. In embodiments of the present application, the first electronic device can retrieve relevant major premise evidence and minor premise evidence in response to the user's query. For example, a first electronic device can absorb knowledge from the vast amount of information on the internet as major premise evidence and minor premise evidence. The major premise evidence can be used to derive the major premise, and the minor premise evidence can be used to derive the minor premise, significantly improving query coverage. Furthermore, the first electronic device can directly retrieve relevant major premises for a user's query. For example, the first electronic device can retrieve common sense information as the major premise for deductive reasoning. Based on the retrieved major premise evidence, the first electronic device can inductively reason to derive the major premise for deductive reasoning, and generate the minor premise for deductive reasoning based on the retrieved minor premise evidence. The electronic device then performs deductive reasoning based on the retrieved and / or inductively derived major premise and the generated minor premise to obtain the answer to the query. In this way, because the first electronic device can derive the answer to a query through deductive reasoning, it can provide correct answers to common sense queries, opinion-based queries, complex queries, and new queries. Furthermore, because the query results include not only the answer to the query but also the major premise and minor premise of the answer derived through deductive reasoning, as well as the major premise evidence used to support the major premise and the minor premise evidence used to support the minor premise, the query's credibility and interpretability are enhanced.

[0009] In one possible implementation, generating a query result includes: obtaining N second major premises based on a first vector, where the first vector is used to represent a target text, and the target text indicates the query; the N second major premises include the first major premise, and N is a positive integer; searching a first database based on the N second vectors to obtain P second minor premise evidences, where the N second vectors correspond to the N second major premises, any one of the N second vectors is used to represent the second major premise corresponding to the target text and the any one second vector, and the P second minor premise evidences include the first minor premise evidence, and P is a positive integer; generating M second minor premises based on the target text, the N second major premises, and the P second minor premise evidences, where the M second minor premises include the first minor premise, and M is a positive integer less than or equal to P; performing deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer; wherein the first major premise evidence is retrieved from the first database based on the first vector. Among them, the first vector can be obtained by performing vector representation of the target text through the semantic representation model, and the second vector can be obtained by performing vector representation of the target text and the second major premise through the semantic representation model. It should be understood that the target text and a major premise are represented as a second vector, and since there are N major premises, there are N second vectors. Among them, the first database can be a web page library. In this implementation, in response to the user's query, the first electronic device can automatically select a suitable major premise, and then automatically select a suitable minor premise evidence from the first database (such as a web page library) to generate a minor premise, thereby completing the reasoning path of deductive reasoning, thereby achieving effective prediction of the answer to the query.

[0010] In one possible implementation, obtaining N second major premises based on the first vector includes: searching the first database based on the first vector to obtain L second major premise evidences, where L is a positive integer greater than or equal to N; and performing inductive reasoning based on the L second major premise evidences to obtain the N second major premises. Exemplarily, the L second major premise evidences may include the first major premise evidence. In this implementation, in response to a user's query, the first electronic device can automatically select appropriate major premise evidence from the first database (e.g., a web page library) to obtain the major premise through inductive reasoning, which is conducive to completing the reasoning path of deductive reasoning.

[0011] In one possible implementation, performing inductive reasoning based on the L second-premise evidence to obtain the N second-premise includes: searching the first database based on the first vector to obtain a negative example of the third-premise evidence, the L second-premise evidence including the third-premise evidence, the third-premise evidence being used for inductive reasoning to obtain the third-premise; performing inductive reasoning based on the negative example of the third-premise evidence to obtain a fourth-premise; if the third-premise and the fourth-premise do not contradict each other, the third-premise is one of the N second-premise; if the third-premise and the fourth-premise contradict each other, searching the first database based on the first vector to obtain a fourth-premise evidence, and performing inductive reasoning based on the fourth-premise evidence to obtain a fifth-premise, the fifth-premise being one of the N second-premise. In this implementation, the first electronic device obtains the major premise of the deductive reasoning through inductive reasoning based on negative example induction. The process of a negative example induction is as follows: based on the major premise evidence, a major premise is obtained through inductive reasoning, and based on the negative example of the major premise evidence, another major premise is obtained through inductive reasoning. Then, it is determined whether the two major premises obtained through induction are contradictory. If the two major premises are not contradictory, the major premise obtained through inductive reasoning based on the major premise evidence is accurate and credible and can be used for deductive reasoning. If the two major premises are contradictory, the major premise evidence is re-retrieved for the user's query, and negative example induction is performed again based on the re-retrieved major premise evidence. In this way, the first electronic device has a high accuracy and credibility in inductive reasoning, adapts to the noisy and inconsistent characteristics of Internet information, and imitates the process of human cognitive development (that is, based on the newly input information that does not meet expectations, it continuously corrects). It should be noted that when the first electronic device obtains the major premise of deductive reasoning through inductive reasoning based on negative example induction, the first electronic device may re-retrieve the major premise evidence. Therefore, the L second major premise evidence does not necessarily include the first major premise evidence. The first major premise evidence may be the re-retrieved major premise evidence, for example, the first major premise evidence is the fourth major premise evidence.

[0012] In one possible implementation, obtaining N second major premises based on the first vector includes: searching the first database based on the first vector to obtain R second major premise evidences, where R is a positive integer; searching the second database based on the first vector to obtain target common sense information; and performing inductive reasoning based on the R second major premise evidences and the target common sense information to obtain Q second major premises, where Q is a positive integer less than or equal to R; wherein the N second major premises include the target common sense information and the Q second major premises. Exemplarily, the R second major premise evidences may include the first major premise evidence. The second data may be a common sense database. In this implementation, in response to a user's query, the first electronic device can automatically select appropriate major premise evidence from the first database (e.g., a webpage database) to inductively reason and obtain the major premise, and can also automatically select appropriate common sense information from the second database (e.g., a common sense database) as the major premise, which facilitates completing the reasoning path of deductive reasoning. The common sense information is obtained through pre-inductive reasoning, and the retrieved common sense information can be used as the major premise, reducing the workload of inductive reasoning during online queries. Inductive reasoning is performed based on the common sense information retrieved and the major premise evidence retrieved from the web page library. Common sense information can assist in the inductive reasoning of the major premise evidence, thereby facilitating obtaining the correct major premise.

[0013] In one possible implementation, the method further includes writing the Q second major premises into the second database. In this implementation, during the online query process, the first electronic device can store the major premises obtained by inductive reasoning in the common sense database, thereby continuously refreshing the common sense database and enriching the common sense information in the common sense database.

[0014] In one possible implementation, performing deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer includes: determining a first premise combination from N×M premise combinations, the N×M premise combination being obtained by combining each second major premise from the N second major premises with each second minor premise from the M second minor premises, the first premise combination comprising the first major premise and the first minor premise; and performing deductive reasoning based on the first premise combination to obtain the first answer. In this implementation, for a query, multiple major premises and multiple minor premises may be derived by induction. The first electronic device combines each major premise with each minor premise, and selects the most appropriate premise combination from all the resulting premise combinations for deductive reasoning to obtain the answer to the query. In this manner, deductive reasoning based on premise combinations can form an explicit reasoning path. For example, the resulting premise combinations can be scored and ranked based on a specific scoring strategy to facilitate selection of the most appropriate premise combination for deductive reasoning. In this manner, the optimal reasoning path can be selected to generate the answer to the query.

[0015] In one possible implementation, performing deductive reasoning based on the first premise combination to obtain the first answer includes inputting the term graph into a deductive engine to obtain the first answer, wherein the term graph represents the first premise combination, and the deductive engine is a neural network model for performing deductive reasoning. In this implementation, the premise combination of the free text is converted into a term graph as input to the deductive engine, allowing the deductive engine to directly model the logical relationships of the free text, effectively improving the deductive engine's logical reasoning capabilities for the free text and facilitating the deductive engine's output of the correct answer to the query.

[0016] In one possible implementation, the method further includes: calculating the loss based on the term graph encoding and the three-paragraph text encoding, wherein the term graph encoding is the encoded representation of the term graph, and the three-paragraph text encoding is the encoded representation of the three-paragraph text consisting of the first answer, the first major premise, and the first minor premise; and adjusting the model parameters of the deducer based on the loss. In this implementation, in the process of performing deductive reasoning, the first electronic device also calculates the loss based on the encoded representation of the term graph and the encoded representation of the three-paragraph text, thereby adjusting the model parameters of the deducer. That is, in the process of performing deductive reasoning using the deducer, the loss is also calculated using the input and output of the deducer to adjust the model parameters of the deducer, thereby achieving training optimization of the deducer. This is conducive to improving the deductive reasoning accuracy of the deducer.

[0017] In one possible implementation, determining the first premise combination from the N×M premise combinations includes: determining a second premise combination from the N×M premise combinations; performing deductive reasoning based on the second premise combination to obtain a second answer; and determining the first premise combination from the N×M premise combinations based on feedback from the user and / or the answer verification module regarding the second answer, wherein the answer verification module is used to determine whether the answer obtained by deductive reasoning conforms to factual logic. In this implementation, since the premise combinations obtained by the combination are numerous and all can produce conclusions of deductive reasoning, feedback from the user and / or the answer verification module on the conclusions of the deductive reasoning can be used to instantly adjust and select the most appropriate premise combination for deductive reasoning, thereby improving the speed of query effect tuning of the first electronic device and facilitating the correct answer to the query.

[0018] In a possible implementation, the target text further includes user context information of the user. In this implementation, the first electronic device obtains the user's query and user context information for retrieval, which can improve the user's query experience.

[0019] In one possible implementation, the method further includes displaying a query interface on a screen of the first electronic device, the query interface including the query results. In this implementation, the first electronic device may include a screen on which a user may enter a query, after which the first electronic device displays the query interface on its screen. In addition to displaying the answer to the query, the query interface also displays the major and minor premises of the deductive reasoning, as well as evidence for the major and minor premises. This displays the entire reasoning process and related evidence for the query, greatly enhancing the credibility and interpretability of the query.

[0020] In one possible implementation, obtaining a user's query includes receiving the query from a second electronic device; the method further includes sending the query result to the second electronic device. In this implementation, the second electronic device includes a screen, and the user can enter a query on the screen of the second electronic device. The second electronic device sends the query to the first electronic device, and the first electronic device generates a query result for the query and sends the query result back to the second electronic device. The second electronic device then displays a query interface on its screen, thereby feeding the query result back to the user. This enriches the application scenarios of queries.

[0021] In a second aspect, an embodiment of the present application provides a query method, applied to a second electronic device, the method comprising: obtaining a user's query; sending the query to a first electronic device; receiving a query result from the first electronic device, the query result comprising: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, first major premise evidence for proving the first major premise, and first minor premise evidence for proving the first minor premise; or the query result comprising: the first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first minor premise evidence for proving the first minor premise; and displaying a query interface on a screen of the second electronic device, the query interface comprising the query result. In an embodiment of the present application, the second electronic device comprises a screen, a user may enter a query on the screen of the second electronic device, the second electronic device sends the query to the first electronic device, the first electronic device generates a query result for the query and sends the query result back to the second electronic device, and the second electronic device then displays a query interface on its screen, thereby feeding back the query result to the user. In this way, the application scenarios of the query are enriched.

[0022] In a third aspect, an embodiment of the present application provides a query method, which is applied to an electronic device, the electronic device including a screen displaying an input box, the method comprising: obtaining a query entered by a user in the input box; displaying on the screen the answer to the query, the major premise and minor premise of the answer, as well as evidence for the major premise and evidence for the minor premise, the major premise evidence being used to prove the major premise, and the minor premise evidence being used to prove the minor premise; or displaying on the screen the answer to the query, the major premise and minor premise of the answer, as well as evidence for the minor premise, the minor premise evidence being used to prove the minor premise. In this embodiment, the electronic device may include a screen, and a user may enter a query on the screen, after which the electronic device displays on its screen the answer to the query, the major premise and minor premise of the deductive reasoning, evidence for the major premise, and evidence for the minor premise. In this way, the entire reasoning process of the query and related evidence are displayed, greatly enhancing the credibility and interpretability of the query.

[0023] In one possible implementation, the screen displays a first display frame, a second display frame, and a third display frame, wherein the first display frame displays the answer, the second display frame displays the major premise and the minor premise, and the third display frame displays the major premise evidence and the minor premise evidence, or the third display frame displays the minor premise evidence.

[0024] In one possible implementation, the screen displays a fourth display frame, and the fourth display frame displays the answer, the major premise, the minor premise, the evidence for the major premise, and the evidence for the minor premise, or the fourth display frame displays the answer, the major premise, the minor premise, and the evidence for the minor premise.

[0025] In a possible implementation, the screen displays a fifth display frame and a sixth display frame, and the sixth display frame is a pop-up display frame of the fifth display frame; the fifth display frame displays the answer, and the fifth display frame displays the major premise, the minor premise, the major premise evidence, and the minor premise evidence, or the fifth display frame displays the major premise, the minor premise, and the minor premise evidence.

[0026] In a possible implementation, the method further includes: displaying direct evidence on the screen, where the direct evidence is used to prove the answer.

[0027] In a possible implementation, the screen further displays a seventh display frame, and the seventh display frame displays the direct evidence.

[0028] In a possible implementation, the fourth display frame also displays the direct evidence.

[0029] In a possible implementation, the sixth display frame also displays the direct evidence.

[0030] In a fourth aspect, an embodiment of the present application provides a query device, which is applied to a first electronic device, and the device includes: an acquisition unit, which is used to obtain a user's query; a processing unit, which is used to generate a query result, and the query result includes: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first major premise evidence for proving the first major premise, and first minor premise evidence for proving the first minor premise; or the query result includes: the first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first minor premise evidence for proving the first minor premise.

[0031] In one possible implementation, the processing unit is specifically configured to: obtain N second major premises based on a first vector, where the first vector is used to represent a target text, and the target text indicates the query; the N second major premises include the first major premise, and N is a positive integer; search a first database based on the N second vectors to obtain P second minor premise evidences, where the N second vectors correspond to the N second major premises, any one of the N second vectors is used to represent the second major premise corresponding to the target text and the any one second vector, and the P second minor premise evidences include the first minor premise evidence, and P is a positive integer; generate M second minor premises based on the target text, the N second major premises, and the P second minor premise evidences, where the M second minor premises include the first minor premise, and M is a positive integer less than or equal to P; perform deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer; wherein the first major premise evidence is retrieved from the first database based on the first vector.

[0032] In one possible implementation, the processing unit is specifically used to: search the first database according to the first vector to obtain L second-premise evidences, where L is a positive integer greater than or equal to N; and perform inductive reasoning based on the L second-premise evidences to obtain the N second-premise.

[0033] In one possible implementation, the processing unit is specifically used to: search in the first database according to the first vector to obtain a negative example of the third major premise evidence, the L second major premise evidence includes the third major premise evidence, and the third major premise evidence is used for inductive reasoning to obtain the third major premise; perform inductive reasoning according to the negative example of the third major premise evidence to obtain the fourth major premise; if the third major premise is not inconsistent with the fourth major premise, then the third major premise is one of the N second major premises; if the third major premise is inconsistent with the fourth major premise, then search in the first database according to the first vector to obtain the fourth major premise evidence, and perform inductive reasoning according to the fourth major premise evidence to obtain the fifth major premise, and the fifth major premise is one of the N second major premises.

[0034] In one possible implementation, the processing unit is specifically used to: search in the first database according to the first vector to obtain R second-major premise evidences, where R is a positive integer; search in the second database according to the first vector to obtain target common sense information; perform inductive reasoning based on the R second-major premise evidences and the target common sense information to obtain Q second-major premises, where Q is a positive integer less than or equal to R; wherein the N second-major premises include the target common sense information and the Q second-major premises.

[0035] In one possible implementation, the processing unit is specifically used to: determine a first premise combination from N×M premise combinations, where the N×M premise combinations are obtained by combining each second major premise of the N second major premises with each second minor premise of the M second minor premises, and the first premise combination includes the first major premise and the first minor premise; and perform deductive reasoning based on the first premise combination to obtain the first answer.

[0036] In one possible implementation, the processing unit is specifically configured to input a term graph into a deduction engine to obtain the first answer, wherein the term graph represents the first premise combination, and the deduction engine is a neural network model for performing deductive reasoning.

[0037] In one possible implementation, the processing unit is further used to: calculate the loss based on the term graph encoding and the three-paragraph text encoding, wherein the term graph encoding is the encoded representation of the term graph, and the three-paragraph text encoding is the encoded representation of the three-paragraph text consisting of the first answer, the first major premise and the first minor premise; and adjust the model parameters of the deducer based on the loss.

[0038] In one possible implementation, the processing unit is specifically used to: determine a second premise combination from the N×M premise combinations; perform deductive reasoning based on the second premise combination to obtain a second answer; and determine the first premise combination from the N×M premise combinations based on feedback from the user and / or the answer verification module regarding the second answer, and the answer verification module is used to determine whether the answer obtained by deductive reasoning conforms to factual logic.

[0039] In a possible implementation, the processing unit is further configured to: display a query interface on a screen of the first electronic device, where the query interface includes the query result.

[0040] In a possible implementation, the acquiring unit is specifically configured to: receive the query from the second electronic device; and the processing unit is further configured to: send the query result to the second electronic device.

[0041] It should be noted that the beneficial effects brought about by the embodiment of the fourth aspect can be referred to the corresponding description of the embodiment of the first aspect.

[0042] In a fifth aspect, an embodiment of the present application provides a query device, which is applied to a second electronic device, and the device includes: an acquisition unit, which is used to acquire a user's query; a sending unit, which is used to send the query to a first electronic device; a receiving unit, which is used to receive a query result from the first electronic device, and the query result includes: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first major premise evidence for proving the first major premise, and first minor premise evidence for proving the first minor premise; or the query result includes: the first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first minor premise evidence for proving the first minor premise; a display unit, which is used to display a query interface on the screen of the second electronic device, and the query interface includes the query result.

[0043] It should be noted that the beneficial effects brought about by the embodiment of the fifth aspect can be referred to the corresponding description of the embodiment of the second aspect.

[0044] In a sixth aspect, an embodiment of the present application provides a query device, which is applied to an electronic device, wherein the electronic device includes a screen, and the screen displays an input box. The device includes: an acquisition unit, which is used to acquire a query entered by a user in the input box; a display unit, which is used to display the answer to the query, the major premise and minor premise of the answer, and the major premise evidence and the minor premise evidence on the screen, wherein the major premise evidence is used to prove the major premise, and the minor premise evidence is used to prove the minor premise; or the display unit, which is used to display the answer to the query, the major premise and minor premise of the answer, and the minor premise evidence on the screen, wherein the minor premise evidence is used to prove the minor premise.

[0045] In one possible implementation, the screen displays a first display frame, a second display frame, and a third display frame, wherein the first display frame displays the answer, the second display frame displays the major premise and the minor premise, and the third display frame displays the major premise evidence and the minor premise evidence, or the third display frame displays the minor premise evidence.

[0046] In one possible implementation, the screen displays a fourth display frame, and the fourth display frame displays the answer, the major premise, the minor premise, the evidence for the major premise, and the evidence for the minor premise, or the fourth display frame displays the answer, the major premise, the minor premise, and the evidence for the minor premise.

[0047] In a possible implementation, the screen displays a fifth display frame and a sixth display frame, and the sixth display frame is a pop-up display frame of the fifth display frame; the fifth display frame displays the answer, and the fifth display frame displays the major premise, the minor premise, the major premise evidence, and the minor premise evidence, or the fifth display frame displays the major premise, the minor premise, and the minor premise evidence.

[0048] In a possible implementation manner, the display unit is further configured to: display direct evidence on the screen, where the direct evidence is used to prove the answer.

[0049] In a possible implementation, the screen further displays a seventh display frame, and the seventh display frame displays the direct evidence.

[0050] In a possible implementation, the fourth display frame also displays the direct evidence.

[0051] In a possible implementation, the sixth display frame also displays the direct evidence.

[0052] It should be noted that the beneficial effects brought about by the embodiment of the sixth aspect can be referred to the corresponding description of the embodiment of the third aspect.

[0053] In the seventh aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory coupled to the processor and storing a computer program executed by the processor, wherein, when the computer program is executed by the processor, the electronic device executes the method described in any one of the first aspect, the second aspect, or the third aspect.

[0054] In an eighth aspect, an embodiment of the present application provides a chip, comprising: a processor for calling and running a computer program from a memory, so that a device equipped with the chip executes any one of the methods in the first aspect, the second aspect, or the third aspect.

[0055] In a ninth aspect, an embodiment of the present application provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed by a processor, the method described in any one of the first aspect, the second aspect, or the third aspect is implemented.

[0056] In a tenth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method described in any one of the first aspect, the second aspect, or the third aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The following is an introduction to the drawings used in the embodiments of this application.

[0058] FIG1 is a flow chart of a query method provided in an embodiment of the present application;

[0059] FIG2 is a flow chart of another query method provided in an embodiment of the present application;

[0060] FIG3 is a schematic diagram of the architecture of a system 300 for computer search provided in an embodiment of the present application;

[0061] FIG4 is a schematic diagram comparing a traditional common sense query interface and a common sense query interface provided in an embodiment of the present application;

[0062] FIG5 is a schematic diagram of a common sense query interface provided by an embodiment of the present application;

[0063] FIG6 is a schematic diagram comparing a traditional opinion query interface and an opinion query interface provided in an embodiment of the present application;

[0064] FIG7 is a schematic diagram of a process of executing a query by the system 300 shown in FIG3 ;

[0065] FIG8 is a flowchart of a specific example of query execution by the system 300 shown in FIG3 ;

[0066] FIG9 is a flow chart of another query method provided in an embodiment of the present application;

[0067] FIG10 is a flow chart of another query method provided in an embodiment of the present application;

[0068] FIG11 is a flow chart of another query method provided in an embodiment of the present application;

[0069] FIG12 is a schematic structural diagram of a query device provided in an embodiment of the present application;

[0070] FIG13 is a schematic diagram of the structure of another query device provided in an embodiment of the present application;

[0071] FIG14 is a schematic structural diagram of another query device provided in an embodiment of the present application;

[0072] FIG15 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0073] First, some technical terms in the embodiments of the present application are introduced to facilitate those skilled in the art to understand the present application.

[0074] Query: The search term entered by a user during a computer search. A query can be a question (e.g., a question), a keyword, or a paragraph.

[0075] Inductive reasoning: A method of reasoning from the specific to the general. It involves moving from a certain perspective on a particular thing to a broader perspective, and deriving general principles from specific examples.

[0076] Deductive reasoning: A method of reasoning from the general to the specific. In contrast to inductive reasoning, it is a method of reasoning that establishes a necessary connection between the premises and the conclusion.

[0077] Syllogism: A deductive reasoning that uses two property judgments containing a common term as premises to derive a new property judgment as a conclusion. A syllogism is a general pattern of deductive reasoning, consisting of a major premise, a minor premise, and a conclusion. The major premise is known general knowledge (or information). The minor premise is the specific knowledge (or information) being studied. It should be understood that the specificity here is relative to the general knowledge in the major premise. The conclusion is a judgment made about the specific knowledge based on general knowledge. Major premise: A premise in deductive reasoning that contains general knowledge.

[0078] Major Premise Evidence: The basis used to prove the major premise. In other words, the information used to confirm the description of the major premise.

[0079] Minor premise: A premise in deductive reasoning that contains specific knowledge.

[0080] Minor premise evidence: The evidence used to prove the minor premise. In other words, the information used to confirm the description of the minor premise.

[0081] For example, if "fruit can be eaten" is the major premise, then "peaches are fruit" can be considered the minor premise. Here, fruit can be considered general knowledge, while peaches are specific knowledge. "Peaches can be eaten" can be considered the conclusion drawn from these two premises. Web pages or encyclopedias containing information related to the major premise "fruit can be eaten" can be considered major premise evidence for the major premise, and web pages or encyclopedias containing information related to the minor premise "peaches are fruit" can be considered minor premise evidence for the minor premise.

[0082] Knowledge graph: A structured semantic knowledge base used to describe the concepts of various things and their relationships.

[0083] Semantic representation model: A representation model based on deep learning. The main function of the representation model is to obtain the vector representation of text.

[0084] Web page library: A database that contains a large number of Internet web pages.

[0085] Web page library retrieval: Based on a given query, search for relevant web page information in the web page library and return it.

[0086] Multi-hop query: refers to the web page that answers the query and cannot be retrieved through a single retrieval of the web page library. It requires continuous retrieval based on the previously retrieved web page information to answer the query. One retrieval is considered one hop, and multiple retrievals are considered multiple hops.

[0087] Common sense query: A query that requires common sense information as support.

[0088] Opinion query: Query results must not only be supported by common sense, but also provide multiple results based on what others say. Instead, they must provide opinionated answers based on observed web evidence and common sense derived from inductive reasoning.

[0089] Formalized query: Compared with natural statement query, the query is converted into a structured statement and the missing parts of the query structure are completed.

[0090] User context information: user profile, user environment, search status, historical behavior and other user-related information.

[0091] Term: The basic unit of logical analysis. In traditional logic, a term is the subject and predicate of a categorical proposition; anything that can serve as the subject and predicate of a proposition is called a concept.

[0092] Term graph: A directed connected graph constructed by combining terms with sentence relationships.

[0093] Negative example: To prove that a proposition is false, we can usually give an example that meets the conditions of the proposition but does not have the conclusion of the proposition. This example is called a negative example, also called a counterexample.

[0094] Secondly, the relevant technologies involved in the embodiments of this application are introduced to further analyze the technical queries to be solved by this application.

[0095] Related technology 1:

[0096] Please refer to Figure 1, which is a flow chart of a query method provided by an embodiment of the present application. The query method is applied to a query system and includes the following steps:

[0097] 101: Get the user's query.

[0098] 102: Rewrite the query.

[0099] Among them, rewriting the query may include core word recognition, synonym expansion / replacement, query pattern conversion (converting rare patterns into common patterns), etc.

[0100] 103: Perform a web page library search.

[0101] That is, a search is performed in the web page library based on the rewritten query.

[0102] 104: Extract answers from the search results.

[0103] For example, answers are extracted from the search results retrieved from the web page library, that is, the web page information retrieved based on the above query, and the extracted answers are sorted.

[0104] 105: Determine whether the answer is found or whether the number of searches exceeds the set number.

[0105] Specifically, if the top answer in the above ranking cannot answer the query and the number of searches for this query does not exceed the set number, then execute step 106. If the top answer in the above ranking can answer the query or the number of searches for this query exceeds the set number, then execute step 107.

[0106] 106: Adjust or expand the query based on the search results.

[0107] Specifically, the query content is adjusted or expanded based on the web page information returned by the search, usually by adding the keywords obtained in the current search to the current query content as the query content for the next search.

[0108] 107: Output the answer or no answer.

[0109] That is, the extracted answer or no answer is returned to the user.

[0110] As shown in Figure 1, related technology 1 addresses multi-hop queries through multiple searches. However, this approach relies solely on a search path, resulting in an unexplainable search path. This can easily lead to a correct answer but an incorrect search path, meaning the correct answer was found by chance. Furthermore, it remains difficult to provide correct answers for common-sense queries.

[0111] Analysis reveals the following reasons for these shortcomings: Related technology 1 only performs simple information search and lacks reasoning capabilities. For common-sense queries, the knowledge supporting the answer is often not simply contained in webpage information but requires reasoning. Therefore, Related technology 1 struggles to provide correct answers to common-sense queries and lacks interpretability.

[0112] Related technology 2:

[0113] Please refer to Figure 2, which is a flow chart of another query method provided by an embodiment of the present application. The query method is applied to a query system and includes the following steps:

[0114] 201: Get the user's query.

[0115] 202: Parse the query.

[0116] Parsing the query may include core entity recognition, syntax parsing, and the like.

[0117] 203: Formal query statement generation.

[0118] Specifically, based on the parsing results of step 202, the natural query statement is converted into a formal statement based on a graph query (e.g., SPARQL). For queries with complex query components, the query can be first broken down into subqueries, and then corresponding formal statements are generated for the subqueries. The formal statements corresponding to the subqueries are then combined into a complex formal statement.

[0119] 204: Knowledge base search.

[0120] Specifically, the formalized statement generated in step 203 is used to retrieve the results of the static knowledge graph constructed offline.

[0121] 205: Determine whether the answer is retrieved.

[0122] If no answer is found, step 206 is executed; if an answer is found, step 207 is executed.

[0123] 206: Output no answer.

[0124] 207: Output the answer.

[0125] As shown in Figure 2, whether the related technology 2 can give correct results depends largely on the correct parsing of the query statement. If the parsing is incorrect, the correct answer cannot be retrieved; the knowledge graph is static and cannot give correct answers to new queries or common sense queries that are not included in the knowledge graph; and the answers given lack explainability.

[0126] Analysis reveals the following reasons for these shortcomings: Related Technology 2 is still just a simple information search. While unlike Related Technology 1, Related Technology 2 employs a formalized search approach, it still lacks reasoning capabilities. For new and common-sense queries, some of the knowledge needed to support answering them is typically not contained within the knowledge graph and requires reasoning. Therefore, Related Technology 2 struggles to provide correct answers to these queries, and it only presents simple answers without providing interpretability.

[0127] Based on the above analysis, the technical queries to be addressed by this application include but are not limited to:

[0128] (1) The query system lacks reasoning capabilities and cannot effectively answer common sense or opinion queries.

[0129] (2) The query system has a weak ability to process complex queries and can only find answers through retrieval. It is unable to perform induction or reasoning to create new knowledge and use new knowledge to answer queries.

[0130] (3) The query system lacks explainability. For complex queries or common sense queries, if it can answer them, it only gives simple answers and cannot provide an explainable answer process.

[0131] The technical solution provided in this application is introduced in detail below in conjunction with specific implementation methods.

[0132] Please refer to Figure 3, which is a schematic diagram of the architecture of a system 300 for computer search provided in an embodiment of the present application. System 300 includes: a user device 310, a query system 320, and a network 330. A user operates user device 310 and enters a query on user device 310. User device 310 sends the query to query system 320 via network 330. Query system 320 performs evidence retrieval, inductive reasoning, deductive reasoning, etc. to obtain query results, and sends the query results to user device 310 via network 330. User device 310 then feeds the query results back to the user.

[0133] User device 310 includes a user interface (UI) 311, memory 312, and processor 313. Memory 312 may be random access memory (RAM). User interface 311 is used to receive queries and display query results. Query results include answers to queries, inductive and deductive reasoning processes, and so on. This increases the credibility and interpretability of queries.

[0134] Query system 320 includes an inductive-deductive system 321, a search engine 324, a database 325, and an indexing engine 328. Inductive-deductive system 321 includes an inductor 322 and a deductor 323. In one possible implementation, database 325 may be a database external to query system 320, meaning query system 320 does not include database 325. Database 325 includes a webpage library 326 and a common sense library 327. Database 325 is used to quickly search for evidence information. Webpage library 326 is an index built based on common webpages and is used for retrieving major and minor premise evidence. Common sense library 327 is an index built based on inductive common sense and is used to provide common sense information; common sense information is the major premise obtained through pre-inductive reasoning. Indexing engine 328 is a set of engineering algorithm engines used to construct webpage library 326 and common sense library 327. Search engine 324 is used to retrieve major premise evidence from database 325. Inductor 322 is used to inductively reason the major premise based on the major premise evidence. The retriever 324 is also used to retrieve minor premise evidence from the webpage library 326 to facilitate the generation of the minor premise. The deductive unit 323 is used to perform deductive reasoning based on the major premise and minor premise to obtain the answer to the query. This is described in detail below.

[0135] The retriever 324 may be a neural network model. Specifically, the retriever 324 may at least implement the following functions:

[0136] (1) Major premise evidence retrieval. Retriever 324 automatically selects appropriate major premise evidence from the vast web pages in webpage library 326 and retrieves appropriate common sense information from common sense library 327 in response to a query. Retriever 324, when combined with inductor 322, enables free access to Internet knowledge.

[0137] It should be noted that, during the process of retrieving major premise evidence, the retriever 324 may also retrieve direct evidence used to prove the answer to the query.

[0138] (2) Minor premise evidence retrieval: After the inductor 322 generates the major premise, the retriever 324 can automatically retrieve the minor premise evidence from the web page library 326.

[0139] In one possible implementation, the query system 320 may further include a generator (not shown in FIG3 ). The generator is a generative model that inputs a natural language text and outputs another natural language text. In this application, the text output by the generator serves as the minor premise of deductive reasoning. The minor premise evidence retrieved by the retriever 324 can be sent to the generator to facilitate the generation of the minor premise required for deductive reasoning. In this way, the deductive reasoning path is completed.

[0140] In this application, the retriever 324 retrieves major premise evidence for the query and inputs the retrieved major premise evidence into the inductor 322 for inductive reasoning to obtain the major premise. The retriever 324 further retrieves minor premise evidence and inputs the retrieved minor premise evidence into the generator to obtain the minor premise. Thus, the query system 320 automatically completes the reasoning path of deductive reasoning.

[0141] The inductor 322 may be a neural network model. Specifically, the inductor 322 may at least implement the following functions:

[0142] (1) Online Induction. The inductor 322 can perform inductive reasoning based on the major premise evidence retrieved by the retriever 324 to obtain the major premise. In this way, on-demand induction is achieved, avoiding queries that are difficult to expand or have insufficient coverage in static graphs.

[0143] (2) Negative example induction. The retriever 324 can also retrieve negative examples of the major premise evidence. The inductor 322 performs inductive reasoning on the major premise evidence and the negative example of the major premise evidence respectively, and determines whether the result obtained by inductive reasoning based on the major premise evidence is inconsistent with the result obtained by inductive reasoning based on the negative example of the major premise evidence. If not, the result obtained by inductive reasoning based on the major premise evidence is used as the major premise of deductive reasoning. If contradictory, it is necessary to re-retrieve the major premise evidence and perform negative example induction based on the re-retrieved major premise evidence.

[0144] For example, for any major premise evidence A, the retriever 324 can also retrieve a negative example of major premise evidence A. The inductor 322 performs inductive reasoning on major premise evidence A to obtain major premise A1. The inductor 322 performs inductive reasoning on the negative example of major premise evidence A to obtain major premise A2. If major premise A1 and major premise A2 do not contradict each other, then major premise A1 can be used for deductive reasoning. If major premise A1 and major premise A2 contradict each other, the retriever 324 re-retrieves the major premise evidence, such as re-retrieving major premise evidence B; retrieves a negative example of major premise evidence B, and performs negative example induction based on major premise evidence B and the negative example of major premise evidence B.

[0145] In one possible implementation, the query system 320 may further include a conditional phase container (not shown in FIG3 ). The conditional phase container is a discriminant model used to determine whether two input conclusions are compatible (consistent or non-conflicting) or contradictory. Thus, when performing negative example induction, the inductor 322 may input the result obtained by inductive reasoning based on the major premise evidence and the result obtained by negative example inductive reasoning based on the major premise evidence into the conditional phase container to determine whether the two results are contradictory.

[0146] Inductor 322 uses negative example induction to derive the major premise required for deductive reasoning. This makes Inductor 322 highly accurate and reliable, adapting to the noisy and diverse nature of internet information. It also mimics the process of human cognitive development, which involves continuous correction based on new input information that doesn't meet expectations.

[0147] (3) Inductive long-term and short-term memory. The inductor 322 is also used to memorize the major premise obtained by its inductive reasoning. That is, the inductor 322 memorizes the major premise obtained by its induction as common sense information. Knowledge memory can take into account both long-term memory and short-term memory. Long-term memory is stored in the common sense library 327 and can be continuously updated. Short-term memory is related to the user query and is stored in a neural unit group, which is a group of neural networks in the inductor 322. In this way, it can help the inductor 322 obtain the required common sense information during the inductive reasoning process.

[0148] In one possible implementation, the summarizer 322 may also extract common sense information from the Internet (eg, the web page library 326 ) through offline reasoning, and store the information in the common sense library 327 as the long-term memory of the query system.

[0149] In this application, the summarizer 322 continuously summarizes more advanced common sense information from the internet (e.g., webpage library 326) and continuously corrects historically summarized common sense information through negative example summarization, thereby improving the accuracy of common sense information. For specific query scenarios, the summarizer can also combine long-term and short-term memory with information retrieved from the internet (e.g., webpage library 326) to provide common sense information support for the query.

[0150] In one possible implementation, the query system 320 may also include an action selector (not shown in FIG3 ). The action selector may be a neural network model. The action selector uses a reinforcement learning method to score the premise combination. It should be noted that the inductor 322 can generate multiple major premises, and the generator can generate multiple minor premises. The query system 320 combines each minor premise with each major premise to obtain multiple premise combinations. The query system 320 inputs the multiple premise combinations into the action selector, and the action selector scores each premise combination and sorts the multiple premise combinations according to the scoring, so as to select the most appropriate premise combination to input into the deducer 323. In this way, not only can an explicit reasoning path be formed, but the best reasoning path can also be selected to generate an answer.

[0151] The deducer 323 may be a neural network model. Specifically, the deducer 323 may at least implement the following functions:

[0152] (1) Feedback signal real-time deduction. The action selector can receive feedback signals and optimize and adjust the selection of premise combinations so as to obtain greater positive feedback later. The feedback signal includes the user's feedback signal and the feedback signal of the answer verification module. The user's feedback signal is the user's feedback on the answer displayed on the user interface 311, such as explicit feedback that the result is incorrect, or implicit click / no click. The answer verification module can be a neural network model. The answer verification module is used to determine whether the output answer conforms to the factual logic. For example, after the deducer 323 performs each deductive reasoning, the answer of this deductive reasoning will be displayed on the user interface 311. The user can use the answer of this deductive reasoning as feedback, thereby sending a feedback signal to the action selector. At the same time, the answer verification module will also verify the answer of this deductive reasoning and send a feedback signal to the action selector. After receiving the user's feedback signal and the feedback signal of the answer verification module, the action selector adjusts the premise combination for deductive reasoning and reselects the most appropriate premise combination to input into the deducer 323. The deducer 323 then performs deductive reasoning on the reselected premise combination. In this way, the feedback from users and the answer verification module on the answers to deductive reasoning can be used to adjust the selection of the premise combination of deductive reasoning in real time, thereby increasing the speed of effect tuning of the query system and continuously improving the effect of deductive reasoning.

[0153] (2) Enhancement of the deductive model based on term graph representation. The premise combination is a free text. The query system 320 can convert the premise combination into a term graph, and then input the converted term graph into the deductive engine 323 for deductive reasoning. For example, the query system 320 can convert the premise combination in the form of free text into a term graph. In this way, the free text is represented as a term graph as the input of deductive reasoning, so that the deductive engine 323 can directly model the logical relationship of the free text, thereby improving the deductive engine 323's perception of the logical relationship of the text. In addition, the method of logical relationship pre-training can be used to enable the deductive engine 323 to pre-perceive the conjunction relationship, effectively improving the deductive engine 323's deductive reasoning ability for the free text.

[0154] (3) Model parameter adjustment. The deducer 323 can calculate the loss based on the term graph encoding and the three-paragraph text encoding, and adjust the model parameters of the deducer 323 based on the calculated loss. The term graph encoding is the encoding representation of the term graph. The three-paragraph text encoding is the encoding representation of the three-paragraph text; that is, the major premise text, the minor premise text and the answer text are spliced ​​together to obtain the three-paragraph text, and then encoded. For example, in the deductive reasoning process, the query system 320 converts the premise combination into a term graph, uses the term graph as the input of the deducer 323, and obtains the answer. At the same time, the query system 320 can encode the term graph to obtain the term graph encoding corresponding to the term graph. In addition, the query system 320 splices the major premise and minor premise in the premise combination with the answer to the deductive reasoning into a three-paragraph text, and encodes the three-paragraph text to obtain the three-paragraph text encoding corresponding to the three-paragraph text. Afterwards, the query system 320 may calculate the loss based on the term graph encoding and the three-paragraph text encoding, and adjust the model parameters of the deducer 323 based on the calculated loss.

[0155] In the offline phase, the system shown in Figure 3 uses the inductor 322, searcher 324, and webpage library 326 to continuously retrieve and summarize common sense information from internet information and build or update the common sense library 327. In the online phase, after a user enters a query in the user interface 311, the system simultaneously searches the webpage library 326 and the common sense library 327 to obtain evidence for the major premise. The evidence for the major premise obtained from the webpage library 326 and the common sense library 327 is then fed into the inductor 322 for inductive reasoning to obtain the major premise. After inductive reasoning obtains the major premise, the system further searches the webpage library 326 to obtain the minor premise supporting the reasoning path. The system then feeds the major and minor premises into the deductive unit 323 for deductive reasoning to obtain the answer to the query. After the answer is verified, the query interface is displayed on the user interface 311. The query interface not only displays the answer but also the reasoning process for the query.

[0156] Please refer to Figure 4, which is a schematic diagram comparing a traditional common sense query interface and the common sense query interface provided in an embodiment of the present application. The traditional common sense query interface only displays the query, the answer, and the source title and webpage address (URL) of the answer. The common sense query interface provided in this application includes the following elements: a query input box 3111, a query card 3112, an answer display box 3113, a reasoning path display box 3114, and a premise evidence display box 3115. The query input box 3111 is used to input and display queries, such as "Is Socrates mortal?" The answer display box 3113 is used to display the answer to the query in the query input box 3111, such as "Socrates is mortal." The reasoning path display box 3114 is used to display the reasoning path of inductive and deductive reasoning to obtain the answer displayed in the answer display box 3113, including a major premise and a minor premise. The major premise evidence is used to inductively reason the major premise, and the minor premise evidence is used to generate the minor premise; for example, "Major premise: All people are mortal" and "Minor premise: Socrates is a man." The premise evidence display box 3115 is used to display the evidence (such as a web page address) proving the inductive and deductive reasoning displayed in the reasoning path display box 3114, including major premise evidence and minor premise evidence, such as "major premise evidence: URL1, URL2, URL3", "minor premise evidence: URL4".

[0157] It should be noted that the elements of the common sense query interface shown in FIG4 are displayed in a flat format, but can also be displayed in a selected pop-up format or other formats as shown in FIG5. In FIG5, the reasoning path display box 3114 and the premise evidence display box 3115 are located within the pop-up query card 3118. This application does not limit this.

[0158] Please refer to Figure 6, which is a schematic diagram comparing a traditional opinion query interface and the opinion query interface provided in an embodiment of the present application. A traditional opinion query interface only displays the query, the answer, and the source title and web address of the answer. The opinion query interface provided in this application includes the following elements: a query input box 3111, a query card 3112, an answer display box 3113, a premise evidence display box 3115, a direct evidence display box 3116, and a common sense and reasoning path display box 3117. Query input box 3111 is used to input and display a query, such as "Is troperazine addictive?" Answer display box 3113 is used to display the answer to the query in query input box 3111, such as "Taking more than 300mg is addictive." Direct evidence display box 3116 is used to display direct evidence (e.g., a web address) that supports the answer displayed in answer display box 3113, such as "Direct evidence: URL5, URL6, ..." The direct evidence may be retrieved by the retriever 324 when performing a major premise evidence retrieval. Common sense and reasoning path display box 3117 is used to display the reasoning path and supporting common sense (common sense information) supporting the answer displayed in answer display box 3113. The reasoning path includes a major premise and a minor premise, for example, "Supporting common sense: Trastorone is addictive," "Major premise: Valium is addictive," and "Minor premise: Trastorone contains Valium." Premise evidence display box 3115 is used to display the evidence (such as a webpage address) supporting the inductive and deductive reasoning displayed in reasoning path display box 3114, including major premise evidence and minor premise evidence, for example, "Major premise evidence: URL7, URL8, URL9," and "Minor premise evidence: URL10."

[0159] It should be noted that the elements of the viewpoint query interface shown in FIG6 can also be displayed in a selected pop-up or other manner. This application does not limit this. It should be further noted that the above URLs 1 to 10 respectively represent the content of the web page corresponding to the web page address.

[0160] This application uses an inductive-deductive system 321 to empower query system 320 with the ability to summarize common sense and reason based on it, enabling better responses to common sense queries or complex queries requiring reasoning. Query system 320 performs deductive reasoning based on major and minor premises, providing answers to queries and the reasoning path leading to the answers. Query system 320 also displays the reasoning process through a user interface, making the reasoning process of the answers explainable and enhancing the credibility and explainability of query system 320.

[0161] Please refer to FIG7, which is a schematic diagram of the process of executing a query by the system 300 shown in FIG3. The process includes but is not limited to the following steps:

[0162] 701: Perceiving user query and user context information.

[0163] Specifically, after the user enters a query on the user device 310, the user device 310 sends the query and user context information to a unified application programming interface (API), and converts the text of the query and user context information into a vector representation through a semantic representation model to obtain a first vector.

[0164] 702: Retrieve evidence for the major premise.

[0165] Specifically, the retriever 324 searches for relevant evidence web pages based on the first vector in the web page library 326 to obtain major premise evidence. The major premise evidence retrieved from the web page library 326 can be grouped to facilitate inductive reasoning of multiple major premises in step 703.

[0166] Furthermore, the retriever 324 can also search the common sense repository 327 based on the first vector to obtain common sense information. The common sense information retrieved from the common sense repository 327 can be input into the inductor along with the retrieved major premise evidence to assist the inductor in performing inductive reasoning and obtaining a more accurate major premise. Furthermore, the common sense information retrieved from the common sense repository 327 can also be directly used as the major premise for deductive reasoning.

[0167] 703: Major premise of inductive reasoning.

[0168] Specifically, the summarizer 322 may perform inductive reasoning to obtain the major premise based on the major premise evidence retrieved in step 702. It should be understood that, for a query, the summarizer 322 may perform inductive reasoning to obtain one or more major premises.

[0169] In one possible implementation, for the major premise evidence used to inductively obtain any major premise, the retriever 324 may retrieve a negative example of the major premise evidence. The inductor 322 performs negative example induction based on the major premise evidence and the negative example of the major premise evidence to obtain the major premise.

[0170] In one possible implementation, the summarizer 322 stores the major premise obtained by inductive reasoning in the common sense library 327. When performing online induction, the summarizer 322 can obtain common sense information from the common sense library 327 for online induction to assist the summarizer 322 in making better induction.

[0171] 704: Retrieve minor premise evidence and generate minor premise.

[0172] Specifically, the major premise, query, and user context information generated by inductive reasoning by inductor 322 are represented as a second vector using the semantic representation model. It should be noted that since there may be multiple major premises, each major premise is represented as a second vector along with the query and user context information, resulting in multiple second vectors, each of which is used to retrieve corresponding minor premise evidence. Retriever 324 searches for minor premise evidence in web page library 326 based on the second vectors and inputs the query, user context information, major premise, and retrieved minor premise evidence into the generator to generate the minor premise.

[0173] 705: Deductive reasoning.

[0174] Specifically, the retriever 324 can combine each minor premise with each major premise to obtain multiple premise combinations. The action selector selects the most appropriate premise combination from the multiple premise combinations and inputs it into the deduction engine 323 for deductive reasoning. After each deduction engine 323 performs deductive reasoning, if the deduction results in an answer, the process proceeds to step 706; otherwise, the process returns to step 704.

[0175] In one possible implementation, after each deductive reasoning by the deducer 323, the action selector will receive feedback signals from the user and the answer verification module, thereby adjusting and selecting the most appropriate premise combination and re-inputting it into the deducer 323 in the hope of obtaining positive feedback, that is, obtaining a more accurate answer.

[0176] In one possible implementation, query system 320 can convert premise combinations into term graphs, which are then fed into deductive engine 323 for deductive reasoning. By representing free text as term graphs and using them as input for deductive reasoning, deductive engine 323 can directly model the logical relationships within the free text, improving its understanding of these relationships. Furthermore, logical relationship pre-training can be employed to enable deductive engine 323 to pre-perceive conjunction relationships, effectively enhancing its deductive reasoning capabilities for free text.

[0177] In one possible implementation, during the deductive reasoning process, query system 320 converts the premise combination into a term graph, using the term graph as input to deducer 323. Simultaneously, query system 320 may encode the term graph to obtain a term graph encoding corresponding to the term graph. Furthermore, query system 320 concatenates the major and minor premises of the premise combination with the answer to the deductive reasoning into a three-paragraph text, and encodes the three-paragraph text to obtain a three-paragraph text encoding corresponding to the three-paragraph text. Query system 320 may then calculate a loss based on the term graph encoding and the three-paragraph text encoding, and adjust the model parameters of deducer 323 based on the calculated loss.

[0178] 706: Display the query interface.

[0179] Specifically, the query interface is displayed on user interface 311. In addition to displaying the answer to the query, the query interface also displays the reasoning process for the query. For example, the query interface displays content including: query, answer, major premise, minor premise, evidence for the major premise, evidence for the minor premise, supporting common sense, direct evidence, etc. For details, please refer to Figures 4 to 6.

[0180] It should be noted that the description of the embodiment shown in FIG. 7 may correspond to the description of the embodiments shown in FIG. 3 to FIG. 6 .

[0181] Please refer to FIG8 , which is a flowchart of a specific example of executing a query by the system 300 shown in FIG3 . The flowchart includes but is not limited to the following steps:

[0182] Step 1: Obtain the user's query and perceived user context information, and generate a vector representation of the user's query and user context information based on the semantic representation model through a unified API to obtain the first vector.

[0183] For example, if a user's query is "What should I wear tomorrow?", the query "What should I wear tomorrow?" and user context information are input into the semantic representation model, and the semantic representation model outputs a first vector. The user context information includes personalized information related to the user, such as occupation, age, etc.

[0184] Step ②: Based on the first vector, use the search engine to search the common sense database and web page database respectively to obtain common sense information and the major premise evidence required to summarize the major premise.

[0185] For example, the common sense information retrieved based on the first vector is "wear a coat on snowy days" and "wear a suit on weekdays." The major premise evidence retrieved is "wear a formal dress for a charity dinner," "wear a low-key dress for a wedding banquet," "wear a suit for a business banquet," and "casual attire is acceptable for a banquet with close friends."

[0186] Step 3: Input the common sense information and major premise evidence retrieved in step 2 into the inductor for negative example induction to obtain multiple major premises.

[0187] For example, if we input “A formal dress is required for a charity dinner,” “A low-key dress is required for a wedding banquet,” “A suit is required for a business banquet,” and “Casual clothes are acceptable for a banquet with close friends” into the inductor, we get the major premise “A formal dress is required for a formal banquet.”

[0188] Step ④: Send the major premise obtained by inductive reasoning in step ③ to the retriever and deducer for subsequent deductive reasoning.

[0189] Step 5: Based on the semantic representation model, the user's query, user context information and major premise are represented as a second vector.

[0190] It should be understood that since there are multiple major premises, there are multiple second vectors. Furthermore, the multiple second vectors correspond to the multiple major premises, and any one of the multiple second vectors is used to represent the user's query, user context information, and the major premise corresponding to the any one second vector.

[0191] For example, based on the semantic representation model, the query "What to wear tomorrow", user context information, and the major premises "You need to wear a coat on snowy days", "You need to wear a suit on weekdays", and "You need to wear a dress to attend a formal banquet" are represented by vectors, and the second vector corresponding to each major premise is obtained.

[0192] Step 6: Based on the second vector obtained in step 5, the web page library is searched to generate multiple small premises.

[0193] For example, based on the second vector representing the query "What to wear tomorrow", user context information, and the major premises "You need to wear a coat on a snowy day", "You need to wear a suit on a weekday", and "You need to wear a dress to attend a formal banquet", the web page library is searched and minor premises are generated respectively. The obtained minor premises are "Tomorrow is a snowy day", "Tomorrow is a weekday", and "You need to attend a formal banquet tomorrow".

[0194] Step 7: Combine each major premise obtained in step 3 with each minor premise obtained in step 6 to obtain multiple premise combinations, and select the most appropriate premise combination to input into the deduction engine for deductive reasoning to obtain the answer to the query.

[0195] For example, consider combining the major premises "It's snowy, so you need to wear a coat," "It's workday, so you need to wear a suit," and "For a formal dinner, you need to wear a dress" with the minor premises "Tomorrow is snowy," "Tomorrow is workday," and "You need to attend a formal dinner tomorrow." From all the resulting premise combinations, select the most appropriate combination: "You need to wear a dress for a formal dinner" and "You need to attend a formal dinner tomorrow." This combination is then output to the deductive reasoning engine, yielding the answer "Wear a dress tomorrow."

[0196] Step ⑧: Input the answer obtained by deductive reasoning into the answer verification module for answer verification to determine whether the answer is consistent with facts and common sense logic.

[0197] Step 9: Display the results of the correct answers verified by the answer verification module, which includes both the answer itself and the reasoning process of the answer.

[0198] For example, for the user query "What to wear tomorrow?", the answer "A formal dress tomorrow" is displayed. The deductive reasoning process is also shown: "A formal dress is required for a formal dinner" + "A formal dinner is required tomorrow" => "A formal dress is required tomorrow." The inductive reasoning process is also shown: "A formal dress is required for a charity dinner," "A low-key dress is required for a wedding dinner," "A suit is required for a business dinner," "Casual attire is acceptable for a dinner with close friends" => "A formal dress is required for a formal dinner." Furthermore, for the inductive evidence for the major premise and the minor premise, the webpage source information (such as the URL and title) is also provided.

[0199] It should be noted that the description of the embodiment shown in FIG. 8 may correspond to the description of the embodiments shown in FIG. 3 to FIG. 7 .

[0200] In the application scenarios shown in Figures 3 to 8 , user device 310 and query system 320 are connected via network 330 , and user device 310 and query system 320 are different electronic devices. For example, user device 310 may be a user terminal, and query system 320 may be a server. It should be understood that the application scenario shown in Figures 3 to 8 is merely one example of an application scenario for query system 320 , and other application scenarios are possible, and this application does not specifically limit this. For example, query system 320 is implemented in an electronic device that includes a screen or user interface for a user to perform a query operation.

[0201] Please refer to Figure 9, which is a flowchart of another query method provided in the embodiments of the present application. The query method is applied to a first electronic device, which can be a server or a terminal, for example, an electronic device including a query system 320. The query method includes but is not limited to the following steps:

[0202] 901: Get the user's query;

[0203] 902: Generate a query result, the query result including: the first answer to the query, the first major premise and the first minor premise of the first answer obtained by deductive reasoning, the first major premise evidence used to prove the first major premise, and the first minor premise evidence used to prove the first minor premise; or the query result includes: the first answer to the query, the first major premise and the first minor premise of the first answer obtained by deductive reasoning, and the first minor premise evidence used to prove the first minor premise.

[0204] The first major premise evidence and the first minor premise evidence are evidence information retrieved in response to the user's query. The first major premise is derived through inductive reasoning based on the first major premise evidence, or the first major premise is common sense information retrieved in response to the user's query. It should be understood that when the first major premise is retrieved common sense information, the query results do not include the major premise evidence; when the first major premise is derived through inductive reasoning based on the first major premise evidence, the query results do include the first major premise evidence. The first minor premise is generated based on the first minor premise evidence.

[0205] In an embodiment of the present application, a first electronic device can retrieve relevant major premise and minor premise evidence in response to a user's query. For example, the first electronic device can absorb knowledge from the vast amount of information on the internet as major premise and minor premise evidence. The major premise evidence can be used to derive the major premise, and the minor premise evidence can be used to derive the minor premise, thereby significantly improving query coverage. Furthermore, the first electronic device can directly retrieve relevant major premises for a user's query. For example, the first electronic device can retrieve common sense information as the major premise for deductive reasoning. The first electronic device can inductively reason based on the retrieved major premise evidence to derive the major premise for deductive reasoning, and generate the minor premise for deductive reasoning based on the retrieved minor premise evidence. The electronic device then performs deductive reasoning based on the retrieved and / or inductively derived major premise and the generated minor premise to obtain the answer to the query. In this way, because the first electronic device can obtain the answer to the query through deductive reasoning, it can provide correct answers to common sense queries, opinion-based queries, complex queries, and new queries. Furthermore, because the query results include not only the answer to the query but also the major premise and minor premise of the answer derived through deductive reasoning, as well as the major premise evidence used to support the major premise and the minor premise evidence used to support the minor premise, the credibility and interpretability of the query are enhanced.

[0206] In one possible implementation, generating a query result includes: obtaining N second major premises based on a first vector, where the first vector is used to represent a target text, and the target text indicates the query; the N second major premises include the first major premise, and N is a positive integer; searching a first database based on the N second vectors to obtain P second minor premise evidences, where the N second vectors correspond to the N second major premises, any one of the N second vectors is used to represent the second major premise corresponding to the target text and the any one second vector, and the P second minor premise evidences include the first minor premise evidence, and P is a positive integer; generating M second minor premises based on the target text, the N second major premises, and the P second minor premise evidences, where the M second minor premises include the first minor premise, and M is a positive integer less than or equal to P; performing deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer; wherein the first major premise evidence is retrieved from the first database based on the first vector.

[0207] The first vector can be obtained by vectorizing the target text using a semantic representation model, and the second vector can be obtained by vectorizing the target text and the second major premise using a semantic representation model. It should be understood that the target text and a major premise are represented as one second vector. Since there are N major premises, there are N second vectors.

[0208] The first database may be a web page library. In one example, the first database is the web page library 326. In addition, the first database may be a database within the first electronic device or a database outside the first electronic device.

[0209] In this implementation, in response to a user's query, the first electronic device can automatically select a suitable major premise, and then automatically select suitable minor premise evidence from a first database (such as a web page library) to generate a minor premise, thereby completing the reasoning path of deductive reasoning and achieving effective prediction of the answer to the query.

[0210] In one possible implementation, obtaining N second major premises based on the first vector includes: searching the first database based on the first vector to obtain L second major premise evidences, where L is a positive integer greater than or equal to N; and performing inductive reasoning based on the L second major premise evidences to obtain the N second major premises.

[0211] Exemplarily, the L second-premise evidences may include the first-premise evidence.

[0212] In this implementation, in response to a user's query, the first electronic device can automatically select appropriate major premise evidence from the first database (such as a web page library) to inductively reason and obtain the major premise, which is helpful in completing the reasoning path of deductive reasoning.

[0213] In one possible implementation, performing inductive reasoning based on the L second-premise evidences to obtain the N second-premise includes: searching in the first database according to the first vector to obtain a negative example of the third-premise evidence, the L second-premise evidences include the third-premise evidence, and the third-premise evidence is used for inductive reasoning to obtain the third-premise; performing inductive reasoning based on the negative example of the third-premise evidence to obtain the fourth-premise; if the third-premise is not inconsistent with the fourth-premise, then the third-premise is one of the N second-premise; if the third-premise is inconsistent with the fourth-premise, then searching in the first database according to the first vector to obtain the fourth-premise evidence, and performing inductive reasoning based on the fourth-premise evidence to obtain a fifth-premise, and the fifth-premise is one of the N second-premise.

[0214] In this implementation, the first electronic device obtains the major premise of deductive reasoning through inductive reasoning based on negative example induction. The process of a negative example induction is as follows: a major premise is obtained through inductive reasoning based on the major premise evidence, and another major premise is obtained through negative example induction based on the major premise evidence, and then it is judged whether the two major premises obtained through induction are contradictory; if the two major premises are not contradictory, then the major premise obtained through inductive reasoning based on the major premise evidence is accurate and credible, and can be used for deductive reasoning; if the two major premises are contradictory, then the major premise evidence is re-retrieved based on the user's query, and a negative example induction is performed again based on the re-retrieved major premise evidence. In this way, the first electronic device has a higher accuracy and credibility in inductive reasoning, adapts to the noisy and inconsistent characteristics of Internet information, and imitates the process of human cognitive development (that is, constantly correcting based on newly input information that does not meet expectations). It should be noted that when the first electronic device obtains the major premise of deductive reasoning through inductive reasoning based on negative example induction, the first electronic device may re-retrieve the major premise evidence, so the L second major premise evidences do not necessarily include the first major premise evidence, and the first major premise evidence may be the re-retrieved major premise evidence, for example, the first major premise evidence is the fourth major premise evidence.

[0215] In one possible implementation, obtaining N second major premises based on the first vector includes: searching in the first database based on the first vector to obtain R second major premise evidences, where R is a positive integer; searching in the second database based on the first vector to obtain target common sense information; performing inductive reasoning based on the R second major premise evidences and the target common sense information to obtain Q second major premises, where Q is a positive integer less than or equal to R; wherein the N second major premises include the target common sense information and the Q second major premises.

[0216] Exemplarily, the R second-premise evidences may include the first-premise evidence.

[0217] The second data may be a common sense database. The common sense information stored in the common sense database is a major premise obtained through pre-inductive reasoning. For example, the first electronic device may extract common sense information from the Internet (e.g., a webpage library) through offline inductive reasoning and store it in the common sense database. In one example, the second database is the common sense database 327. Furthermore, the second database may be a database within the first electronic device or a database outside the first electronic device.

[0218] In this implementation, in response to the user's query, the first electronic device can automatically select appropriate major premise evidence from the first database (such as a web page library) to inductively reason and obtain the major premise, and can automatically select appropriate common sense information from the second database (such as a common sense library) as the major premise, which is conducive to completing the reasoning path of deductive reasoning. Among them, the common sense information is obtained by inductive reasoning in advance, and the retrieved common sense information can be used as the major premise to reduce the workload of inductive reasoning during online queries. Based on the retrieved common sense information and the major premise evidence retrieved from the web page library, inductive reasoning is performed, and the common sense information can assist in the inductive reasoning of the major premise evidence, thereby facilitating the acquisition of a correct major premise. For example, the retrieved common sense information and the retrieved major premise evidence are input into the inductor together to assist the inductor in performing inductive reasoning and obtain a more accurate major premise.

[0219] In a possible implementation, the method further includes: writing the Q second major premises into the second database.

[0220] In this implementation, during the online query process, the first electronic device may store the major premise obtained by inductive reasoning in the common sense database, thereby continuously refreshing the common sense database and enriching the common sense information in the common sense database.

[0221] In one possible implementation, performing deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer includes: determining a first premise combination from N×M premise combinations, the N×M premise combinations being obtained by combining each second major premise of the N second major premises with each second minor premise of the M second minor premises, the first premise combination including the first major premise and the first minor premise; and performing deductive reasoning based on the first premise combination to obtain the first answer.

[0222] In this implementation, for a query, multiple major premises may be summarized and multiple minor premises may be generated. The first electronic device combines each major premise with each minor premise, and selects the most appropriate premise combination from all the premise combinations obtained by deductive reasoning to obtain the answer to the query. In this way, deductive reasoning based on the premise combination can form an explicit reasoning path. For example, the premise combinations obtained by combination can be scored and ranked based on a specific scoring strategy, thereby facilitating the selection of the most appropriate premise combination for deductive reasoning. In this way, the optimal reasoning path can be selected to generate the answer to the query.

[0223] In one possible implementation, performing deductive reasoning based on the first premise combination to obtain the first answer includes: inputting the term graph into a deducer to obtain the first answer, the term graph represents the first premise combination, and the deducer is a neural network model for performing deductive reasoning.

[0224] In this implementation, the premise combination of the free text is converted into a term graph as the input of the deducer, so that the deducer can directly model the logical relationship of the free text, effectively improving the deducer's logical reasoning ability for the free text, and facilitating the deducer to output the correct answer to the query.

[0225] In one possible implementation, the method further includes: calculating a loss based on a term graph encoding and a three-paragraph text encoding, wherein the term graph encoding is an encoded representation of the term graph, and the three-paragraph text encoding is an encoded representation of a three-paragraph text consisting of the first answer, the first major premise, and the first minor premise; and adjusting the model parameters of the deducer based on the loss.

[0226] In this implementation, during deductive reasoning, the first electronic device also calculates loss based on the encoded representation of the term graph and the encoded representation of the syllabary text to adjust the model parameters of the deductive machine. That is, during deductive reasoning using the deductive machine, the loss is calculated using the deductive machine's input and output to adjust the model parameters, thereby optimizing the training of the deductive machine. This helps improve the deductive machine's deductive reasoning accuracy.

[0227] In one possible implementation, determining the first premise combination from the N×M premise combinations includes: determining a second premise combination from the N×M premise combinations; performing deductive reasoning based on the second premise combination to obtain a second answer; and determining the first premise combination from the N×M premise combinations based on feedback from the user and / or an answer verification module regarding the second answer, wherein the answer verification module is used to determine whether the answer obtained by the deductive reasoning conforms to factual logic.

[0228] In this implementation, since there are many premise combinations obtained and they can all produce conclusions of deductive reasoning, through the feedback of the conclusions of deductive reasoning by the user and / or the answer verification module, the most appropriate premise combination can be adjusted and selected for deductive reasoning, thereby improving the speed of query effect optimization of the first electronic device and facilitating the provision of the correct answer to the query.

[0229] In a possible implementation manner, the target text further includes user context information of the user.

[0230] In this implementation, the first electronic device obtains the user's query and user context information for retrieval, which can improve the user's query experience.

[0231] In a possible implementation, the method further includes: displaying a query interface on a screen of the first electronic device, where the query interface includes the query result.

[0232] In this implementation, the first electronic device may include a screen on which a user may enter a query, which then displays a query interface. In addition to displaying the answer to the query, the query interface also displays the major and minor premises of the deductive reasoning, as well as the evidence for the major and minor premises. This displays the entire reasoning process and related evidence for the query, greatly enhancing the credibility and interpretability of the query.

[0233] In a possible implementation, obtaining the user's query includes: receiving the query from a second electronic device; and the method further includes: sending the query result to the second electronic device.

[0234] In this implementation, the second electronic device includes a screen, and the user can enter a query on the screen of the second electronic device. The second electronic device then sends the query to the first electronic device. The first electronic device generates a query result for the query and sends the query result back to the second electronic device. The second electronic device then displays the query interface on its screen, thereby feeding the query result back to the user. This enriches the application scenarios of queries.

[0235] It should be noted that the description of the embodiment shown in FIG. 9 may correspond to the description of the embodiments shown in FIG. 3 to FIG. 8 .

[0236] Please refer to FIG10 , which is a flowchart of another query method provided in the embodiment of the present application. The query method is applied to a second electronic device, for example, the second electronic device is a user device 310. The query method includes but is not limited to the following steps:

[0237] 1001: Get the user's query;

[0238] 1002: Send the query to the first electronic device;

[0239] 1003: Receive a query result from the first electronic device, the query result including: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, first major premise evidence for proving the first major premise, and first minor premise evidence for proving the first minor premise; or the query result including: the first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first minor premise evidence for proving the first minor premise.

[0240] 1004: Display a query interface on the screen of the second electronic device, where the query interface includes the query result.

[0241] In an embodiment of the present application, the second electronic device includes a screen. A user can enter a query on the screen of the second electronic device. The second electronic device sends the query to the first electronic device. The first electronic device generates a query result for the query and sends the query result back to the second electronic device. The second electronic device then displays a query interface on its screen, thereby feeding back the query result to the user. This enriches the application scenarios of queries.

[0242] It should be noted that the description of the embodiment shown in FIG. 10 may correspond to the description of the embodiments shown in FIG. 3 to FIG. 9 .

[0243] Please refer to Figure 11, which is a flow chart of another query method provided in the embodiments of the present application. The query method is applied to an electronic device, for example, an electronic device including a query system 320. Exemplarily, the electronic device is a first electronic device or a second electronic device. The electronic device includes a screen displaying an input box. The query method includes but is not limited to the following steps:

[0244] 1101: Obtain the query entered by the user in the input box;

[0245] 1102: Displaying the answer to the query, the major premise and minor premise of the answer, as well as the evidence for the major premise and the evidence for the minor premise on the screen, wherein the evidence for the major premise is used to prove the major premise, and the evidence for the minor premise is used to prove the minor premise; or displaying the answer to the query, the major premise and minor premise of the answer, as well as the evidence for the minor premise on the screen, wherein the evidence for the minor premise is used to prove the minor premise.

[0246] For example, the input box displayed on the screen is query input box 3111. The answer displayed on the screen is the first answer. The major premise displayed on the screen is the first major premise, and the minor premise displayed on the screen is the first minor premise. The evidence for the major premise displayed on the screen is the evidence for the first major premise, and the evidence for the minor premise displayed on the screen is the evidence for the first minor premise.

[0247] Schematic diagrams of interfaces displaying the answer, major premise, minor premise, evidence for the major premise, and evidence for the minor premise on the screen may be shown in Figures 4 to 6. It should be noted that when the screen displays the answer, major premise, minor premise, evidence for the major premise, and evidence for the minor premise, the query entered by the user may not be displayed, for example, the query input box (e.g., query input box 3111) may no longer be displayed. In other words, when the user operates the electronic device to query, after entering the query in the input box, the screen interface jumps, and the interface after the jump no longer displays the input box, but only displays the answer, major premise, minor premise, evidence for the major premise, and evidence for the minor premise.

[0248] In this embodiment, the electronic device can include a screen on which a user can enter a query. The electronic device then displays the answer to the query, the major and minor premises of the deductive reasoning, and the evidence for the major and minor premises. This displays the entire reasoning process and related evidence for the query, greatly enhancing the credibility and interpretability of the query.

[0249] In one possible implementation, the screen displays a first display frame, a second display frame, and a third display frame, wherein the first display frame displays the answer, the second display frame displays the major premise and the minor premise, and the third display frame displays the major premise evidence and the minor premise evidence, or the third display frame displays the minor premise evidence.

[0250] For example, the first display box is the answer display box 3113, the second display box is the reasoning path display box 3114 or the common sense and reasoning path display box 3117, and the third display box is the premise evidence display box 3115. The answer displayed in the first display box is the first answer. The major premise displayed in the second display box is the first major premise, and the minor premise displayed in the second display box is the first minor premise. The evidence for the major premise displayed in the third display box is the evidence for the first major premise, and the evidence for the minor premise displayed in the third display box is the evidence for the first minor premise.

[0251] In one possible implementation, the screen displays a fourth display frame, and the fourth display frame displays the answer, the major premise, the minor premise, the evidence for the major premise, and the evidence for the minor premise, or the fourth display frame displays the answer, the major premise, the minor premise, and the evidence for the minor premise.

[0252] For example, the fourth display frame is the query card 3112 .

[0253] In a possible implementation, the screen displays a fifth display frame and a sixth display frame, and the sixth display frame is a pop-up display frame of the fifth display frame; the fifth display frame displays the answer, and the fifth display frame displays the major premise, the minor premise, the major premise evidence, and the minor premise evidence, or the fifth display frame displays the major premise, the minor premise, and the minor premise evidence.

[0254] For example, the fifth display frame is a query card 3112 or an answer display frame 3113 , and the sixth display frame is a pop-up query card 3118 .

[0255] In a possible implementation, the method further includes: displaying direct evidence on the screen, where the direct evidence is used to prove the answer.

[0256] In a possible implementation, the screen further displays a seventh display frame, and the seventh display frame displays the direct evidence.

[0257] For example, the seventh display frame is the direct evidence display frame 3116 .

[0258] In a possible implementation, the fourth display frame also displays the direct evidence.

[0259] In a possible implementation, the sixth display frame also displays the direct evidence.

[0260] It should be noted that the description of the embodiment shown in FIG. 11 may correspond to the description of the embodiments shown in FIG. 3 to FIG. 10 .

[0261] Please refer to FIG12, which is a schematic diagram of the structure of a query device provided in an embodiment of the present application. The query device 1200 is applied to a first electronic device, and the query device 1200 includes:

[0262] An acquisition unit 1201 is used to acquire a user's query;

[0263] Processing unit 1202 is used to generate a query result, wherein the query result includes: the first answer to the query, the first major premise and the first minor premise of the first answer obtained by deductive reasoning, the first major premise evidence for proving the first major premise, and the first minor premise evidence for proving the first minor premise; or the query result includes: the first answer to the query, the first major premise and the first minor premise of the first answer obtained by deductive reasoning, and the first minor premise evidence for proving the first minor premise.

[0264] In one possible implementation, the processing unit 1202 is specifically configured to: obtain N second major premises based on a first vector, where the first vector is used to represent a target text, and the target text indicates the query; the N second major premises include the first major premise, and N is a positive integer; search a first database based on the N second vectors to obtain P second minor premise evidences, where the N second vectors correspond to the N second major premises, any one of the N second vectors is used to represent the target text and the second major premise corresponding to the any one second vector, the P second minor premise evidences include the first minor premise evidence, and P is a positive integer; generate M second minor premises based on the target text, the N second major premises, and the P second minor premise evidences, where the M second minor premises include the first minor premise, and M is a positive integer less than or equal to P; perform deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer; wherein the first major premise evidence is retrieved from the first database based on the first vector.

[0265] In one possible implementation, the processing unit 1202 is specifically used to: search the first database according to the first vector to obtain L second-premise evidences, where L is a positive integer greater than or equal to N; and perform inductive reasoning based on the L second-premise evidences to obtain the N second-premise.

[0266] In one possible implementation, the processing unit 1202 is specifically used to: search in the first database according to the first vector to obtain a negative example of the third major premise evidence, the L second major premise evidence includes the third major premise evidence, and the third major premise evidence is used for inductive reasoning to obtain the third major premise; perform inductive reasoning according to the negative example of the third major premise evidence to obtain the fourth major premise; if the third major premise is not inconsistent with the fourth major premise, then the third major premise is one of the N second major premises; if the third major premise is inconsistent with the fourth major premise, then search in the first database according to the first vector to obtain the fourth major premise evidence, and perform inductive reasoning according to the fourth major premise evidence to obtain the fifth major premise, and the fifth major premise is one of the N second major premises.

[0267] In one possible implementation, the processing unit 1202 is specifically used to: search in the first database according to the first vector to obtain R second-major premise evidences, where R is a positive integer; search in the second database according to the first vector to obtain target common sense information; perform inductive reasoning based on the R second-major premise evidences and the target common sense information to obtain Q second-major premises, where Q is a positive integer less than or equal to R; wherein the N second-major premises include the target common sense information and the Q second-major premises.

[0268] In one possible implementation, the processing unit 1202 is specifically used to: determine a first premise combination from N×M premise combinations, where the N×M premise combinations are obtained by combining each second major premise of the N second major premises with each second minor premise of the M second minor premises, and the first premise combination includes the first major premise and the first minor premise; and perform deductive reasoning based on the first premise combination to obtain the first answer.

[0269] In one possible implementation, the processing unit 1202 is specifically configured to input a term graph into a deduction engine to obtain the first answer, wherein the term graph represents the first premise combination, and the deduction engine is a neural network model for performing deductive reasoning.

[0270] In one possible implementation, the processing unit 1202 is further used to: calculate the loss based on the term graph encoding and the three-paragraph text encoding, wherein the term graph encoding is the encoded representation of the term graph, and the three-paragraph text encoding is the encoded representation of the three-paragraph text consisting of the first answer, the first major premise and the first minor premise; and adjust the model parameters of the deducer based on the loss.

[0271] In one possible implementation, the processing unit 1202 is specifically used to: determine a second premise combination from the N×M premise combinations; perform deductive reasoning based on the second premise combination to obtain a second answer; and determine the first premise combination from the N×M premise combinations based on feedback from the user and / or the answer verification module regarding the second answer, and the answer verification module is used to determine whether the answer obtained by deductive reasoning conforms to factual logic.

[0272] In a possible implementation, the processing unit 1202 is further configured to: display a query interface on a screen of the first electronic device, where the query interface includes the query result.

[0273] In a possible implementation, the acquiring unit 1201 is specifically configured to receive the query from the second electronic device; and the processing unit 1202 is further configured to send the query result to the second electronic device.

[0274] It should be noted that the implementation of each operation of the query device 1200 described in FIG12 can also correspond to the corresponding description of the embodiment shown in FIG9 . Moreover, the beneficial effects brought about by the query device 1200 described in FIG12 can also refer to the corresponding description of the embodiment shown in FIG9 , and will not be repeated here.

[0275] Please refer to FIG13, which is a schematic diagram of another query device provided in an embodiment of the present application. The query device 1300 is applied to a second electronic device, and the query device 1300 includes:

[0276] An acquisition unit 1301 is used to acquire a user's query;

[0277] The sending unit 1302 is configured to send the query to the first electronic device;

[0278] Receiving unit 1303 is configured to receive a query result from the first electronic device, the query result including: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, first major premise evidence for proving the first major premise, and first minor premise evidence for proving the first minor premise; or the query result including: the first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first minor premise evidence for proving the first minor premise;

[0279] The display unit 1304 is configured to display a query interface on the screen of the second electronic device, where the query interface includes the query result.

[0280] It should be noted that the implementation of each operation of the query device 1300 described in FIG13 can also correspond to the corresponding description of the embodiment shown in FIG10. Moreover, the beneficial effects brought about by the query device 1300 described in FIG13 can also refer to the corresponding description of the embodiment shown in FIG10, and will not be repeated here.

[0281] Please refer to FIG14, which is a schematic diagram of the structure of another query device provided in the embodiment of the present application. The query device 1400 is applied to an electronic device, wherein the electronic device includes a screen having an input box displayed on the screen, and the query device 1400 includes:

[0282] An acquiring unit 1401 is configured to acquire a query input by a user in the input box;

[0283] Display unit 1402 is used to display the answer to the query, the major premise and minor premise of the answer, as well as the major premise evidence and the minor premise evidence on the screen, the major premise evidence is used to prove the major premise, and the minor premise evidence is used to prove the minor premise; or the display unit 1402 is used to display the answer to the query, the major premise and minor premise of the answer, as well as the minor premise evidence on the screen, the minor premise evidence is used to prove the minor premise.

[0284] In one possible implementation, the screen displays a first display frame, a second display frame, and a third display frame, wherein the first display frame displays the answer, the second display frame displays the major premise and the minor premise, and the third display frame displays the major premise evidence and the minor premise evidence, or the third display frame displays the minor premise evidence.

[0285] In one possible implementation, the screen displays a fourth display frame, and the fourth display frame displays the answer, the major premise, the minor premise, the evidence for the major premise, and the evidence for the minor premise, or the fourth display frame displays the answer, the major premise, the minor premise, and the evidence for the minor premise.

[0286] In a possible implementation, the screen displays a fifth display frame and a sixth display frame, and the sixth display frame is a pop-up display frame of the fifth display frame; the fifth display frame displays the answer, and the fifth display frame displays the major premise, the minor premise, the major premise evidence, and the minor premise evidence, or the fifth display frame displays the major premise, the minor premise, and the minor premise evidence.

[0287] In a possible implementation, the display unit 1402 is further configured to: display direct evidence on the screen, where the direct evidence is used to prove the answer.

[0288] In a possible implementation, the screen further displays a seventh display frame, and the seventh display frame displays the direct evidence.

[0289] In a possible implementation, the fourth display frame also displays the direct evidence.

[0290] In a possible implementation, the sixth display frame also displays the direct evidence.

[0291] It should be noted that the implementation of each operation of the query device 1400 described in FIG14 can also correspond to the corresponding description of the embodiment shown in FIG11. In addition, the beneficial effects brought about by the query device 1400 described in FIG14 can also refer to the corresponding description of the embodiment shown in FIG11, and will not be repeated here.

[0292] Please refer to Figure 15, which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 1510 can be a first electronic device or a second electronic device. The electronic device 1510 includes a processor 1511, a memory 1512, and a communication interface 1513. The processor 1511, memory 1512, and communication interface 1513 are interconnected via a bus 1514.

[0293] Memory 1512 includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or compact disc read-only memory (CD-ROM). Memory 1512 is used for storing computer programs and data. Communication interface 1513 is used to receive and send data.

[0294] The processor 1511 may be one or more central processing units (CPUs). When the processor 1511 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.

[0295] The processor 1511 in the electronic device 1510 is configured to read and execute the computer program stored in the memory 1512 to perform the method in the embodiment shown in FIG. 9 , FIG. 10 , or FIG. 11 .

[0296] It should be noted that the implementation of each operation of the electronic device 1510 described in FIG15 may also correspond to the corresponding description of the embodiment shown in FIG9 , FIG10 , or FIG11 . Furthermore, the beneficial effects brought about by the electronic device 1510 described in FIG15 may refer to the corresponding description of the embodiment shown in FIG9 , FIG10 , or FIG11 , and will not be repeated here.

[0297] An embodiment of the present application provides an electronic device, comprising: a processor; and a memory coupled to the processor and storing a computer program executed by the processor, wherein, when the computer program is executed by the processor, the electronic device executes the method in the embodiment shown in Figure 9, Figure 10, or Figure 11.

[0298] An embodiment of the present application provides a chip, including: a processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes the method in the embodiment shown in FIG. 9 , FIG. 10 , or FIG. 11 .

[0299] An embodiment of the present application provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed by a processor, the method in the embodiment shown in FIG. 9 , FIG. 10 , or FIG. 11 is implemented.

[0300] An embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the method in the embodiment shown in Figure 9, Figure 10, or Figure 11 is implemented.

[0301] It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0302] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAMbus RAM (DR RAM).

[0303] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) is integrated into the processor.

[0304] It should be noted that the memory described herein is intended to include, but not be limited to, these and any other suitable types of memory.

[0305] It should also be understood that the first, second, third, fourth and various numerical numbers involved in this document are only distinctions made for the convenience of description and are not intended to limit the scope of this application.

[0306] It should be understood that the term "and / or" in this document simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the related objects are in an "or" relationship.

[0307] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0308] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0309] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0310] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0311] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0312] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0313] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method shown in each embodiment of the present application. The aforementioned storage medium includes: various media that can store computer programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0314] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.

[0315] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.

[0316] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A query method, characterized in that: Applied to a first electronic device, the method includes: Get the user's query; Generate a query result, the query result including: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, first major premise evidence used to prove the first major premise, and first minor premise evidence used to prove the first minor premise; Or the query result includes: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first minor premise evidence used to prove the first minor premise.

2. The method according to claim 1, characterized in that Generating the query result includes: Obtaining N second major premises according to the first vector, wherein the first vector is used to represent a target text, and the target text indicates the query; the N second major premises include the first major premise, and N is a positive integer; Searching a first database based on N second vectors to obtain P second minor premise evidences, wherein the N second vectors correspond to the N second major premises, any one of the N second vectors is used to represent the target text and the second major premise corresponding to the any one second vector, and the P second minor premise evidences include the first minor premise evidence, where P is a positive integer; generating M second minor premises according to the target text, the N second major premises, and the P second minor premise evidences, wherein the M second minor premises include the first minor premise, and M is a positive integer less than or equal to P; Perform deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer; The first major premise evidence is retrieved from the first database according to the first vector.

3. The method according to claim 2, characterized in that The N second premises are obtained according to the first vector, including: Searching the first database according to the first vector to obtain L second premise evidences, where L is a positive integer greater than or equal to N; Inductive reasoning is performed based on the L second-major premise evidences to obtain the N second-major premises.

4. The method according to claim 3, characterized in that The inductive reasoning based on the L second-major premise evidences to obtain the N second-major premises includes: Searching the first database according to the first vector to obtain a negative example of the third premise evidence, wherein the L second premise evidences include the third premise evidence, and the third premise evidence is used for inductive reasoning to obtain the third premise; Make inductive inference based on the negative example of the evidence of the third premise to obtain the fourth premise; If the third premise does not contradict the fourth premise, then the third premise is one of the N second premises; If the third premise contradicts the fourth premise, then search the first database according to the first vector to obtain evidence for the fourth premise, and perform inductive reasoning based on the evidence for the fourth premise to obtain a fifth premise, where the fifth premise is one of the N second premises.

5. The method according to claim 2, characterized in that The N second premises are obtained according to the first vector, including: Searching the first database according to the first vector to obtain R second premise evidences, where R is a positive integer; Searching the second database according to the first vector to obtain target common sense information; Perform inductive reasoning based on the R second-premise evidences and the target common sense information to obtain Q second-premise, where Q is a positive integer less than or equal to R; The N second major premises include the target common sense information and the Q second major premises.

6. The method according to any one of claims 2 to 5, characterized in that: The performing deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer includes: Determining a first premise combination from the N×M premise combinations, the N×M premise combinations being obtained by combining each second major premise of the N second major premises with each second minor premise of the M second minor premises, the first premise combination including the first major premise and the first minor premise; Perform deductive reasoning based on the first premise combination to obtain the first answer.

7. The method according to claim 6, characterized in that The performing deductive reasoning based on the first premise combination to obtain the first answer includes: A term graph is input into a deduction engine to obtain the first answer, wherein the term graph represents the first premise combination, and the deduction engine is a neural network model for performing deductive reasoning.

8. The method according to claim 7, characterized in that The method further comprises: Calculating the loss based on a term graph encoding and a three-paragraph text encoding, wherein the term graph encoding is an encoded representation of the term graph, and the three-paragraph text encoding is an encoded representation of the three-paragraph text consisting of the first answer, the first major premise, and the first minor premise; Model parameters of the deducer are adjusted according to the loss.

9. The method according to any one of claims 6 to 8, characterized in that: Determining the first premise combination from the N×M premise combinations includes: Determine a second premise combination from the N×M premise combinations; Perform deductive reasoning based on the second combination of premises to obtain a second answer; Based on the feedback from the user and / or the answer verification module regarding the second answer, the first premise combination is determined from the N×M premise combinations. The answer verification module is used to determine whether the answer obtained by deductive reasoning conforms to factual logic.

10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: A query interface is displayed on the screen of the first electronic device, where the query interface includes the query result.

11. The method according to any one of claims 1 to 9, characterized in that The obtaining of the user's query includes: receiving the query from a second electronic device; The method further includes sending the query result to the second electronic device.

12. A query method, characterized in that: Applied to a second electronic device, the method includes: Get the user's query; sending the query to the first electronic device; receiving a query result from the first electronic device, the query result comprising: a first answer to the query, a first major premise and a first minor premise of the first answer, first major premise evidence for proving the first major premise, and first minor premise evidence for proving the first minor premise; or the query result comprising: the first answer to the query, a first major premise and a first minor premise of the first answer, and first minor premise evidence for proving the first minor premise; A query interface is displayed on the screen of the second electronic device, where the query interface includes the query result.

13. A query method, characterized in that: Applied to an electronic device, the electronic device includes a screen, the screen displays an input box, and the method includes: Get the query entered by the user in the input box; Displaying on the screen the answer to the query, the major premise and minor premise of the answer, as well as evidence for the major premise and evidence for the minor premise, wherein the evidence for the major premise is used to prove the major premise, and the evidence for the minor premise is used to prove the minor premise; Or the answer to the query, the major premise and minor premise of the answer, and the minor premise evidence are displayed on the screen, where the minor premise evidence is used to prove the minor premise.

14. The method according to claim 13, characterized in that The screen displays a first display frame, a second display frame, and a third display frame. The first display frame displays the answer, the second display frame displays the major premise and the minor premise, and the third display frame displays the major premise evidence and the minor premise evidence, or the third display frame displays the minor premise evidence.

15. The method according to claim 13, characterized in that The screen displays a fourth display frame, which displays the answer, the major premise, the minor premise, the evidence for the major premise, and the evidence for the minor premise, or the fourth display frame displays the answer, the major premise, the minor premise, and the evidence for the minor premise.

16. The method according to claim 13, characterized in that The screen displays a fifth display frame and a sixth display frame, wherein the sixth display frame is a pop-up display frame of the fifth display frame; the fifth display frame displays the answer, and the fifth display frame displays the major premise, the minor premise, the major premise evidence, and the minor premise evidence, or the fifth display frame displays the major premise, the minor premise, and the minor premise evidence.

17. The method according to any one of claims 13 to 15, characterized in that: The method further comprises: Direct evidence is displayed on the screen, the direct evidence being used to prove the answer.

18. The method according to claim 17, characterized in that The screen also displays a seventh display frame, and the seventh display frame displays the direct evidence.

19. The method according to claim 17, wherein The fourth display frame also displays the direct evidence.

20. The method according to claim 17, wherein The sixth display frame also displays the direct evidence.

21. A query device, characterized in that: Applied to a first electronic device, the device includes: An acquisition unit, used to acquire a user's query; a processing unit configured to generate a query result, the query result comprising: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, first major premise evidence used to prove the first major premise, and first minor premise evidence used to prove the first minor premise; Or the query result includes: a first answer to the query, a first major premise and a first minor premise of the first answer obtained by deductive reasoning, and first minor premise evidence used to prove the first minor premise.

22. The device according to claim 21, characterized in that The processing unit is specifically configured to: Obtaining N second major premises according to the first vector, wherein the first vector is used to represent a target text, and the target text indicates the query; the N second major premises include the first major premise, and N is a positive integer; Searching a first database based on N second vectors to obtain P second minor premise evidences, wherein the N second vectors correspond to the N second major premises, any one of the N second vectors is used to represent the target text and the second major premise corresponding to the any one second vector, and the P second minor premise evidences include the first minor premise evidence, where P is a positive integer; generating M second minor premises according to the target text, the N second major premises, and the P second minor premise evidences, wherein the M second minor premises include the first minor premise, and M is a positive integer less than or equal to P; Perform deductive reasoning based on the N second major premises and the M second minor premises to obtain the first answer; The first major premise evidence is retrieved from the first database according to the first vector.

23. The device according to claim 22, characterized in that The processing unit is specifically configured to: Searching the first database according to the first vector to obtain L second premise evidences, where L is a positive integer greater than or equal to N; Inductive reasoning is performed based on the L second-major premise evidences to obtain the N second-major premises.

24. The device according to claim 23, characterized in that The processing unit is specifically configured to: Searching the first database according to the first vector to obtain a negative example of the third premise evidence, wherein the L second premise evidences include the third premise evidence, and the third premise evidence is used for inductive reasoning to obtain the third premise; Make inductive inference based on the negative example of the evidence of the third premise to obtain the fourth premise; If the third premise does not contradict the fourth premise, then the third premise is one of the N second premises; If the third premise contradicts the fourth premise, then search the first database according to the first vector to obtain evidence for the fourth premise, and perform inductive reasoning based on the evidence for the fourth premise to obtain a fifth premise, where the fifth premise is one of the N second premises.

25. The device according to claim 22, characterized in that The processing unit is specifically configured to: Searching the first database according to the first vector to obtain R second premise evidences, where R is a positive integer; Searching the second database according to the first vector to obtain target common sense information; Perform inductive reasoning based on the R second-premise evidences and the target common sense information to obtain Q second-premise, where Q is a positive integer less than or equal to R; The N second major premises include the target common sense information and the Q second major premises.

26. The device according to any one of claims 22 to 25, characterized in that The processing unit is specifically configured to: Determining a first premise combination from the N×M premise combinations, the N×M premise combinations being obtained by combining each second major premise of the N second major premises with each second minor premise of the M second minor premises, the first premise combination including the first major premise and the first minor premise; Perform deductive reasoning based on the first premise combination to obtain the first answer.

27. The device according to claim 26, characterized in that The processing unit is specifically configured to: A term graph is input into a deduction engine to obtain the first answer, wherein the term graph represents the first premise combination, and the deduction engine is a neural network model for performing deductive reasoning.

28. The device according to claim 27, characterized in that The processing unit is further configured to: Calculating the loss based on a term graph encoding and a three-paragraph text encoding, wherein the term graph encoding is an encoded representation of the term graph, and the three-paragraph text encoding is an encoded representation of the three-paragraph text consisting of the first answer, the first major premise, and the first minor premise; Model parameters of the deducer are adjusted according to the loss.

29. The device according to any one of claims 26 to 28, characterized in that The processing unit is specifically configured to: Determine a second premise combination from the N×M premise combinations; Perform deductive reasoning based on the second combination of premises to obtain a second answer; Based on the feedback from the user and / or the answer verification module regarding the second answer, the first premise combination is determined from the N×M premise combinations. The answer verification module is used to determine whether the answer obtained by deductive reasoning conforms to factual logic.

30. The device according to any one of claims 21 to 29, characterized in that The processing unit is further configured to: A query interface is displayed on the screen of the first electronic device, where the query interface includes the query result.

31. The device according to any one of claims 21 to 29, characterized in that The acquiring unit is specifically configured to: receive the query from the second electronic device; The processing unit is further configured to send the query result to the second electronic device.

32. A query device, characterized in that: Applied to a second electronic device, the device includes: An acquisition unit, used to acquire a user's query; a sending unit, configured to send the query to the first electronic device; a receiving unit, configured to receive a query result from the first electronic device, the query result including: a first answer to the query, a first major premise and a first minor premise of the first answer, evidence of the first major premise for proving the first major premise, and evidence of the first minor premise for proving the first minor premise; or the query result including: the first answer to the query, the first major premise and the first minor premise of the first answer, and evidence of the first minor premise for proving the first minor premise; A display unit is used to display a query interface on the screen of the second electronic device, where the query interface includes the query result.

33. A query device, characterized in that: Applied to an electronic device, the electronic device includes a screen, the screen displays an input box, and the device includes: An acquiring unit, configured to acquire a query input by a user in the input box; a display unit configured to display on the screen an answer to the query, a major premise and a minor premise of the answer, and evidence for the major premise and evidence for the minor premise, wherein the evidence for the major premise is used to prove the major premise, and the evidence for the minor premise is used to prove the minor premise; or the display unit is configured to display on the screen the answer to the query, the major premise and minor premise of the answer, and the minor premise evidence, wherein the minor premise evidence is used to prove the minor premise.

34. The device according to claim 33, characterized in that The screen displays a first display frame, a second display frame, and a third display frame. The first display frame displays the answer, the second display frame displays the major premise and the minor premise, and the third display frame displays the major premise evidence and the minor premise evidence, or the third display frame displays the minor premise evidence.

35. The device according to claim 33, characterized in that The screen displays a fourth display frame, which displays the answer, the major premise, the minor premise, the evidence for the major premise, and the evidence for the minor premise, or the fourth display frame displays the answer, the major premise, the minor premise, and the evidence for the minor premise.

36. The device according to claim 33, characterized in that The screen displays a fifth display frame and a sixth display frame, wherein the sixth display frame is a pop-up display frame of the fifth display frame; the fifth display frame displays the answer, and the fifth display frame displays the major premise, the minor premise, the major premise evidence, and the minor premise evidence, or the fifth display frame displays the major premise, the minor premise, and the minor premise evidence.

37. The device according to any one of claims 33 to 35, characterized in that The display unit is further configured to: Direct evidence is displayed on the screen, the direct evidence being used to prove the answer.

38. The device according to claim 37, characterized in that The screen also displays a seventh display frame, and the seventh display frame displays the direct evidence.

39. The device according to claim 37, characterized in that The fourth display frame also displays the direct evidence.

40. The device according to claim 37, wherein The sixth display frame also displays the direct evidence.

41. An electronic device, characterized in that: include: processor; A memory, coupled to the processor and storing a computer program executed by the processor, wherein the computer program, when executed by the processor, causes the electronic device to perform the method of any one of claims 1-11 or 12 or 13-20.

42. A chip, characterized in that: include: A processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes the method according to any one of claims 1 to 11 or 12 or 13 to 20.

43. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the method according to any one of claims 1-11 or 12 or 13-20 is implemented.

44. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 11 or 12 or 13 to 20.