CN116860941A - Question answering method and device, electronic equipment and storage medium - Google Patents

Question answering method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116860941A
CN116860941A CN202310854442.1A CN202310854442A CN116860941A CN 116860941 A CN116860941 A CN 116860941A CN 202310854442 A CN202310854442 A CN 202310854442A CN 116860941 A CN116860941 A CN 116860941A
Authority
CN
China
Prior art keywords
sub
question
answer
questions
answered
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310854442.1A
Other languages
Chinese (zh)
Inventor
胡婕
杨明川
李伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Technology Innovation Center
China Telecom Corp Ltd
Original Assignee
China Telecom Technology Innovation Center
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Technology Innovation Center, China Telecom Corp Ltd filed Critical China Telecom Technology Innovation Center
Priority to CN202310854442.1A priority Critical patent/CN116860941A/en
Publication of CN116860941A publication Critical patent/CN116860941A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The disclosure provides a question and answer method, a question and answer device, electronic equipment and a storage medium, and relates to the technical field of natural language processing. The method comprises the steps of obtaining a question to be answered; splitting a question to be answered into a plurality of sub-questions, generating an entity sequence and an action sequence of the question to be answered, wherein the entity sequence comprises a plurality of entities of all the sub-questions in the question to be answered and the entities are ordered according to the order of the sub-questions to be answered, and the action sequence comprises a plurality of actions of all the sub-questions in the question to be answered and the actions are ordered according to the order of the sub-questions to be answered; traversing the entity sequence and the action sequence, acquiring an answer of the first sub-question, generating an answer of the second sub-question according to the answer of the first sub-question, and determining the answer as an answer result of the question to be answered. The question-answering method provided by the disclosure not only increases the accuracy of the answer result, but also increases the speed of obtaining the answer by the user and improves the satisfaction degree of the user.

Description

Question answering method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of natural language processing, and in particular relates to a question answering method, a question answering device, electronic equipment and a storage medium.
Background
Most of traditional question-answering models are end-to-end reading understanding models based on graph structures or graph neural networks, can answer through simple question and paragraph sentence matching, and do not involve complex question disassembly and reasoning. However, many questions can not obtain answer results through simple matching, and in the existing question-answering system, the disassembly of complex questions is not supported, but in a real scene, many complex questions often involve the disassembly and combination of multiple branches. For the current question-answering system, the need of manually adding corresponding templates is needed to support more complicated and various question types, the verification of an external knowledge base is not introduced in the answer generation process of the current question-answering system, the process of acquiring the answers is time-consuming and low in accuracy, the inference of complex questions is not strong, and the inference process of solving the questions cannot be tracked.
Therefore, how to provide a question-answering method, which makes the time consumption of the question-answering system when generating the question answer short and high in accuracy, is a technical problem to be solved urgently.
It should be noted that the information disclosed in the above background section is only for enhancing understanding of the background of the present disclosure and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The disclosure provides a question-answering method, a question-answering device, electronic equipment and a storage medium, which at least overcome the problems of long time consumption and low accuracy of answer generation of a question-answering system in the related art to a certain extent.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to one aspect of the present disclosure, there is provided a question-answering method including: acquiring a question to be answered; splitting the question to be answered into a plurality of sub-questions, wherein each sub-question is represented as an entity action pair comprising: at least one entity and an action performed on the at least one entity; generating an entity sequence and an action sequence of the to-be-answered questions according to entity action pairs of all the sub-questions in the to-be-answered questions, wherein the entity sequence comprises a plurality of entities of all the sub-questions in the to-be-answered questions and the entities are ordered according to the order of the to-be-answered sub-questions, and the action sequence comprises a plurality of actions of all the sub-questions in the to-be-answered questions and the actions are ordered according to the order of the to-be-answered sub-questions; traversing the entity sequence and the action sequence to obtain an answer of a first sub-question, generating an answer of a second sub-question according to the answer of the first sub-question, wherein the first sub-question is a sub-question of which the answer can be obtained by executing an action once in the question to be answered, and the second sub-question is a sub-question of which the answer can be obtained only by relying on the answer of the first sub-question in the question to be answered; and determining the answer of the second sub-question as an answer result of the question to be answered.
In some embodiments, traversing the entity sequence and the action sequence, obtaining an answer to the first sub-question, generating an answer to the second sub-question from the answer to the first sub-question, comprising: repeating the following steps until the entity in the entity sequence and the action in the action sequence are completely traversed: obtaining answers of the first sub-questions, and placing the answers of the first sub-questions in a stack; and taking out the answer of the first sub-question from the stack, and generating the answer of the second sub-question according to the answer of the first sub-question.
In some embodiments, after obtaining the answer to the first sub-question, further comprising: caching answers of the first sub-questions; wherein generating an answer to the second sub-question from the answer to the first sub-question comprises: and generating an answer of the second sub-question according to the cached answer of the first sub-question.
In some embodiments, caching answers to the first sub-question includes: caching answers of the first sub-questions through a stack; generating an answer to the second sub-question from the answer to the first sub-question, comprising: and taking out the answers of the first sub-questions put in the stack, and generating the answer of the second sub-questions according to the answers of the first sub-questions taken out of the stack.
In some embodiments, generating the entity sequence and the action sequence of the question to be answered according to the entity action pairs of all the sub-questions in the question to be answered comprises: acquiring at least one entity contained in each sub-problem and executing actions on the at least one entity; generating an entity sequence of the questions to be answered according to the entities contained in all the sub-questions in the questions to be answered; and generating an action sequence of the questions to be answered according to the actions corresponding to all the sub-questions in the questions to be answered.
In some embodiments, the answer to the first sub-question is obtained by executing a query action in a preset knowledge base, where the query action includes any one of the following query manners: sparse query, dense query, graph query; the sparse query is used for querying the answer of the first sub-problem through the keyword in the preset knowledge base, the dense query is used for querying the answer of the first sub-problem through the vector space model in the preset knowledge base, and the map query is used for querying the answer of the first sub-problem through the knowledge map in the preset knowledge base.
In some embodiments, the above method further comprises: acquiring knowledge text, wherein the knowledge text comprises text in at least one of the following formats: structured text, semi-structured text, and unstructured text; and constructing a preset knowledge base according to the knowledge text.
According to another aspect of the present disclosure, there is also provided a question answering apparatus, including: the question acquisition module is used for acquiring questions to be answered; the system comprises a question splitting module, a question splitting module and a question processing module, wherein the question splitting module is used for splitting a to-be-answered question into a plurality of sub-questions, each sub-question is expressed as an entity action pair, and the entity action pair comprises: at least one entity and an action performed on the at least one entity; the sequence generation module is used for generating an entity sequence and an action sequence of the questions to be answered according to entity action pairs of all the sub-questions in the questions to be answered, wherein the entity sequence comprises a plurality of entities of all the sub-questions in the questions to be answered and the entities are ordered according to the order of the sub-questions to be answered, and the action sequence comprises a plurality of actions of all the sub-questions in the questions to be answered and the actions are ordered according to the order of the sub-questions to be answered; the answer generation module is used for traversing the entity sequence and the action sequence, obtaining an answer of a first sub-question, generating an answer of a second sub-question according to the answer of the first sub-question, wherein the first sub-question is a sub-question of which the answer can be obtained by executing an action once in the questions to be answered, and the second sub-question is a sub-question of which the answer can be obtained only by relying on the answer of the first sub-question in the questions to be answered; and the answer determining module is used for determining the answer of the second sub-question as an answer result of the question to be answered.
According to another aspect of the present disclosure, there is also provided an electronic device including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the question-answering method of any one of the above via execution of the executable instructions.
According to another aspect of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the question-answering method of any one of the above.
According to another aspect of the present disclosure, there is also provided a computer program product comprising a computer program which, when executed by a processor, implements the question-answering method of any one of the above.
The question answering method, the question answering device, the electronic equipment and the storage medium provided by the embodiment of the disclosure are used for acquiring the questions to be answered; splitting a question to be answered into a plurality of sub-questions, generating an entity sequence and an action sequence of the question to be answered according to entity action pairs of all the sub-questions in the question to be answered, wherein the entity sequence comprises a plurality of entities of all the sub-questions in the question to be answered and the entities are ordered according to the order of the sub-questions to be answered, and the action sequence comprises a plurality of actions of all the sub-questions in the question to be answered and the actions are ordered according to the order of the sub-questions to be answered; traversing the entity sequence and the action sequence to obtain an answer of a first sub-question, generating an answer of a second sub-question according to the answer of the first sub-question, wherein the first sub-question is a sub-question of which the answer can be obtained by executing an action once in the question to be answered, and the second sub-question is a sub-question of which the answer can be obtained only by relying on the answer of the first sub-question in the question to be answered; and determining the answer of the second sub-question as an answer result of the question to be answered. According to the embodiment of the disclosure, the questions are decomposed into a plurality of sub-questions and are processed one by one in an orderly manner, so that the condition that the answers are inaccurate due to overlarge or impurity of the obtained answer information is avoided. The answer efficiency is improved, the cost of obtaining the answer is reduced, and the user satisfaction is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort.
FIG. 1 is a schematic diagram of an application question-answering system architecture in an embodiment of the present disclosure;
FIG. 2 illustrates a flow chart of a question-answering method in an embodiment of the present disclosure;
FIG. 3 illustrates a flow chart of yet another question-answering method in an embodiment of the present disclosure;
FIG. 4 illustrates a flow chart of yet another generation entity sequence and action sequence in an embodiment of the present disclosure;
FIG. 5 illustrates a flow chart of yet another question-answering method in an embodiment of the present disclosure;
FIG. 6 illustrates a schematic diagram of an example question and answer in an embodiment of the disclosure;
FIG. 7 illustrates a stack schematic in an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a question-answering apparatus according to an embodiment of the present disclosure;
Fig. 9 shows a schematic diagram of an electronic device in an embodiment of the disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
As mentioned in the foregoing background, the existing question-answering models are all end-to-end reading understanding models based on graph structures or graph neural networks. While these works perform well on many tasks, they also have considerable limitations. In the existing question-answering system facing the complex problem, the complex problem is not disassembled, or only the sequence for splitting the complex problem into sub-problems is supported, but in a real scene, the complex problem often involves the disassembly and combination of a plurality of branches. Splitting into sequences results in limited types of problems supported; for the current question-answering system, to support more complex and diverse question types, the corresponding templates need to be added manually.
Based on the above problems, the embodiments of the present disclosure provide a solution to a question-answer scenario of complex problems, requiring knowledge, and multi-hop reasoning.
The following detailed description of embodiments of the present disclosure refers to the accompanying drawings.
Fig. 1 shows a schematic diagram of a question-answering network system that may be applied to embodiments of the present disclosure.
As shown in fig. 1, the question-answering system 100 may include a terminal device 101, a network 102, and a server 103.
The medium used by the network 102 to provide a communication link between the terminal device 101 and the server 103 may be a wired network or a wireless network.
Alternatively, the wireless network or wired network described above uses standard communication techniques and/or protocols. The network is typically the Internet, but may be any network including, but not limited to, a local area network (Local Area Network, LAN), metropolitan area network (Metropolitan Area Network, MAN), wide area network (Wide Area Network, WAN), mobile, wired or wireless network, private network, or any combination of virtual private networks. In some embodiments, data exchanged over a network is represented using techniques and/or formats including HyperText Mark-up Language (HTML), extensible markup Language (Extensible MarkupLanguage, XML), and the like. All or some of the links may also be encrypted using conventional encryption techniques such as secure sockets layer (Secure Socket Layer, SSL), transport layer security (Transport Layer Security, TLS), virtual private network (Virtual Private Network, VPN), internet protocol security (Internet ProtocolSecurity, IPsec), etc. In other embodiments, custom and/or dedicated data communication techniques may also be used in place of or in addition to the data communication techniques described above.
The terminal device 101 may be a variety of electronic devices including, but not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, wearable devices, augmented reality devices, virtual reality devices, and the like.
Alternatively, the clients of the applications installed in different terminal devices 101 are the same or clients of the same type of application based on different operating systems. The specific form of the application client may also be different based on the different terminal platforms, for example, the application client may be a mobile phone client, a PC client, etc.
The server 103 may be a server providing various services, such as a background management server providing support for devices operated by the user with the terminal apparatus 101. The background management server can analyze and process the received data such as the request and the like, and feed back the processing result to the terminal equipment.
The server 103 may, for example, obtain a question to be answered; the server 103 may split the question to be answered into a plurality of sub-questions, for example; the server 103 may generate an entity sequence and an action sequence of the questions to be answered, for example, according to entity action pairs of all sub-questions in the questions to be answered; the server 103 may, for example, traverse the entity sequence and the action sequence, obtain an answer to the first sub-question, generate an answer to the second sub-question according to the answer to the first sub-question, and determine the answer to the second sub-question as the answer result of the question to be answered.
Optionally, the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligence platforms, and the like. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the disclosure is not limited herein.
Those skilled in the art will appreciate that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative, and that any number of terminal devices, networks, and servers may be provided as desired. The embodiments of the present disclosure are not limited in this regard.
Under the system architecture, the embodiment of the disclosure provides a question-answering method, which can be executed by any electronic device with computing processing capability, and in some embodiments, the question-answering method provided in the embodiment of the disclosure can be executed by a terminal device of the system architecture; in other embodiments, the question-answering method provided in the embodiments of the present disclosure may be performed by a server in the system architecture described above; in other embodiments, the question-answering method provided in the embodiments of the present disclosure may be implemented by the terminal device and the server in the system architecture in an interactive manner.
Fig. 2 shows a flowchart of a question-answering method in an embodiment of the present disclosure, and as shown in fig. 2, the question-answering method provided in the embodiment of the present disclosure includes the following steps:
s202, obtaining a question to be answered.
It should be noted that, in the embodiment of the present disclosure, the question to be answered refers to a text of the question to be answered, and in some embodiments, the question to be answered in a text form may be directly obtained; in other embodiments, the questions to be answered in the form of speech may be obtained first and then converted into corresponding question text. Of course, it is also possible to extract questions to be answered in text form from video or other forms of data. Questions to be answered can be classified into simple questions and complex questions. Where simple questions generally refer to questions that can be answered directly from information in the question, e.g., "What is the capital of China? The answer "beijin" in this question (what is the first of china. In contrast, complex questions often require more complex processing and reasoning to get an answer. Rather than directly deriving answers from information in the questions, complex questions require answers to be obtained by way of reasoning, data queries, knowledge bases, and the like. For example, "same table of reddish and who of bluish is higher? "this question is not a question that can be answered simply by searching, but a question that requires reasoning, querying to be answered.
The question answering method provided by the embodiment of the disclosure can solve the solution of various questions to be answered, and the solution of the questions is realized from the questions to be answered by means of reasoning or direct inquiry.
S204, splitting the question to be answered into a plurality of sub-questions, wherein each sub-question is expressed as an entity action pair, and the entity action pair comprises: at least one entity, and an action performed on the at least one entity.
It should be explained that the question to be answered is split into a plurality of sub-questions, each of which is represented as an entity action pair. Multiple sub-questions are obtained by splitting the original question to be answered, in question "same table of reddish and who is higher than bluish? By way of example, the problems of 'who is on the same desk with reddish body', 'height of bluish body' and comparison of height can be split into four sub-problems.
Wherein each sub-question may be represented by an entity action pair, which may be understood as a tuple shaped as an "entity-action", wherein an entity is an object in a question-and-answer system, such as a person, a city, a company, etc.; an action then represents a behavior for this entity, such as query, modification, deletion, addition, comparison, summation, etc. Each sub-problem may contain at least one entity and an action performed on that entity, such as: entity: "Small red same table"; the actions are as follows: "who is queried"; entity: "height of little red same table"; the actions are as follows: "how high to query"; entity: "height of small blue"; the actions are as follows: "how high to query"; entity: "height"; the actions are as follows: "comparison".
In this way, the split sub-questions are simpler and easier to process than the entire question to be answered. It should be noted that, multiple entities and multiple actions generate entity sequences and action sequences, and the entities and actions in all the sub-questions need to be ordered according to the order of the sub-questions to be answered to generate entity sequences and action sequences.
S206, generating an entity sequence and an action sequence of the questions to be answered according to entity action pairs of all the sub-questions in the questions to be answered, wherein the entity sequence comprises a plurality of entities of all the sub-questions in the questions to be answered and the entities are ordered according to the order of the sub-questions to be answered, and the action sequence comprises a plurality of actions of all the sub-questions in the questions to be answered and the actions are ordered according to the order of the sub-questions to be answered.
It should be noted that, by ordering the entities and actions involved in all the sub-questions, the execution order of the sub-questions may be determined. The method is beneficial to optimizing the processing flow of the problem and improving the processing efficiency. In the case of sub-problems that can be executed in parallel, determining the entity sequence and the action sequence separately facilitates parallel distributed execution for a given problem. Facilitating the handling of questions and data processing: the division into the entity sequence and the action sequence can make the problems and the data structure clearer, and is convenient for searching and organizing the data in the processing process.
Thus, for solutions to multiple sub-problems, the purpose of generating the entity sequence and the action sequence is to determine the execution order of the sub-problems, improve processing efficiency, and facilitate data organization.
S208, traversing the entity sequence and the action sequence, obtaining an answer of a first sub-question, generating an answer of a second sub-question according to the answer of the first sub-question, wherein the first sub-question is a sub-question of which the answer can be obtained by executing an action once in the questions to be answered, and the second sub-question is a sub-question of which the answer can be obtained only by relying on the answer of the first sub-question in the questions to be answered.
It should be noted that, the questions to be answered are solved according to the generated entity sequences and action sequences, and the entity sequences and action sequences are traversed first to obtain the answers of the first sub-questions. Then, based on this answer, an answer to the second sub-question is generated.
The first sub-question is of a type that can be answered by performing an action once, so this action only needs to be performed once to obtain an answer. Next, a second sub-question of the questions to be answered needs to be found that depends on the answer of the first sub-question to obtain the answer. After finding this sub-question, the answer of the first sub-question needs to be input, and then the corresponding operation is performed to obtain the answer of the second sub-question.
Specifically, according to the sub-questions sequentially arranged in the entity action sequence, the following steps may be performed: traversing all sub-questions in the entity sequence and the action sequence to obtain the entity and the action of the first sub-question; executing the action of the first sub-question to obtain an answer to the first sub-question; traversing the entity sequence and the action sequence, finding a second sub-problem. The answer to the second sub-question may be obtained by performing an action with the answer to the first sub-question as a parameter (e.g., query the database with the first answer as a key), or the result may be directly dependent on the answer to the first question (e.g., further calculation based on the first question); after the second sub-question is obtained, the answer of the first sub-question is used as input, and corresponding operation is executed to obtain the answer of the second sub-question.
With "same table of reddish and who is higher than bluish? For example, the first sub-question includes "who is the same red with the table", "height of the same blue", the action of the first sub-question is executed, the corresponding action is inquiry, two heights of 1.8 m and 1.7 m are obtained by respectively inquiring the result, the answer of the second sub-question depends on the first sub-question, the answer of the first sub-question is used as input, and the comparison action is executed to complete the question answering.
And obtaining an answer according to the first sub-question, and leading out a second sub-question which can be obtained only by relying on the answer of the first question. The method can iteratively find a method for solving the problem in an orderly state, and can solve the related problem by utilizing the answer of the previous problem when the answer of the previous problem needs to be known.
S210, determining the answer of the second sub-question as the answer result of the question to be answered.
The embodiment of the disclosure further realizes the method for iteratively searching the answers in an orderly state by splitting the questions to be answered into a plurality of sub-questions and generating the entity sequence and the action sequence. The problem is processed by adopting an ordered method and the entity sequence and the action sequence are generated, so that the repeated processing of the same entity or action can be avoided. This may reduce processing time and computational resource requirements, improving execution efficiency. The process of generating the sequence of entities and actions may help the system find entities or actions that may be performed in parallel and group and schedule accordingly. When the answer of a certain sub-question needs to depend on the answer of a previous sub-question, the problem can be solved only by using the answer, and the logic and the space for solving the problem are greatly expanded. At this time, answers are obtained by sequentially traversing the entity sequence and the action sequence, so that the position of the question can be easily located, and the answers can be obtained quickly. The embodiment of the disclosure supports the solution of complex problems and improves the processing efficiency of the problems.
In some embodiments of the present disclosure, fig. 3 illustrates another question-answering method provided by the embodiments of the present disclosure, and as shown in fig. 3, traversing an entity sequence and an action sequence, obtaining an answer to a first sub-question, and generating an answer to a second sub-question according to the answer to the first sub-question, including the following steps:
repeating the following steps until the entity in the entity sequence and the action in the action sequence are completely traversed:
s302, obtaining an answer of the first sub-question, and placing the answer of the first sub-question on a stack.
It should be noted that, the answers obtained by the first sub-questions are put on a stack, which is a data structure that is often used in computer science and programming. Stacks are typically used for fast temporary storage and access to temporary data. The principle of stacking is very simple: first in last out, last in first out. In other words, the last placed data will be accessed and removed first.
A stack can be seen as a vertical container with only two basic operations: push and pop. When a new element is pushed onto the stack, it is placed at the top of the stack (also referred to as the top of the stack). Only the top element can be accessed and no other element is visible. When an element is popped off the stack, the top of stack element is removed and the top of stack pointer points to the next element.
The stack is used for pushing the answers of the first sub-questions according to the principle, and the answers of the sub-questions are sequentially pushed into the stack according to the sequence of 'first-in last-out', so that the question-answer reasoning process is trackable and has higher interpretability.
It should be further explained that there may be multiple first sub-problems, and thus, it is necessary to repeatedly perform until the entities in the entity sequence and the actions in the action sequence are all traversed.
S304, the answer of the first sub-question is taken out from the stack, and the answer of the second sub-question is generated according to the answer of the first sub-question.
Specifically, when an answer to the first sub-question is generated and retrieved, the answer may be pushed onto the stack. Then, when the second sub-question is answered, the answers in the stack can be acquired according to the sequence of the first and the last according to the answers of the sub-questions which are generated before, and the generation of the subsequent sub-questions is completed in sequence.
This has the advantage that the answers to each sub-question are stored separately, so that the answers to each sub-question can be analyzed and checked at any time as required, and a clear association is made with the previous answer to the sub-question. Not only can the reasoning process of the system be more easily tracked and understood, but also better maintenance of the system and resolution of the problem is facilitated. So that the processing of the generated temporary data becomes very efficient and compact when answering the question.
In some embodiments of the present disclosure, after obtaining the answer to the first sub-question, the method further comprises: caching answers of the first sub-questions;
wherein generating an answer to the second sub-question from the answer to the first sub-question comprises: and generating an answer of the second sub-question according to the cached answer of the first sub-question.
In particular, when the answer to the first sub-question is generated, it may be cached (typically in memory), which in embodiments of the present disclosure may be stored in a stack, so that use of this answer may be required later. Then, when the answer of the second sub-question is generated, if the second sub-question has correlation with the first sub-question which has been generated previously, the answer of the second sub-question can be directly generated according to the cached answer without recalculating and acquiring the answer of the first sub-question. Therefore, the reasoning efficiency can be improved, the calculation time is reduced, and the problem solving is accelerated.
In some embodiments of the present disclosure, caching answers to a first sub-question includes: caching answers of the first sub-questions through a stack;
generating an answer to the second sub-question from the answer to the first sub-question, comprising:
and taking out the answers of the first sub-questions put in the stack, and generating the answer of the second sub-questions according to the answers of the first sub-questions taken out of the stack.
By stacking and caching the answer of the first sub-question, the answer can be conveniently taken out and used for generating answers of other related sub-questions, so that the reasoning efficiency is improved.
Specifically, after the answer to the first sub-question is generated, it may be pushed onto the stack. Then, when generating an answer to a second sub-question related to the first sub-question, a new answer to the sub-question may be generated by popping up the previously cached answer to the first sub-question from the stack.
This has the advantage that by using stack cache answers, answers that have been computed before can be accessed quickly, creatively optimizing the computation process. In addition, because the stack top element of the stack can be accessed and modified at any time, the data in the previous calculation process can be conveniently tracked and checked, and the debugging and modification problems are facilitated. By using the stack to cache the answer of the first sub-question and taking the answer from the stack to generate the answer of the new sub-question, the calculation efficiency and the interpretability can be improved, the problem solving speed is faster, the reliability is more reliable, and the repeatability is better.
In some embodiments of the present disclosure, the second sub-question is a sub-question of the questions to be answered that depends on the answer of the first sub-question to obtain the answer, and may be a new sub-question generated according to the answer of the first sub-question.
In particular, the second sub-question may depend on the answer to the first sub-question because the question to be answered typically has a plurality of sub-questions, the answer to some of which may need to be calculated before the answer (e.g., the answer to the previous sub-question is needed), at which time the answer to the first sub-question may be used to calculate the answer to the next associated sub-question because for some questions there is a correlation between the sub-questions.
On the other hand, the second sub-question may also be a new sub-question generated from the answer to the first sub-question. Because there may be many new sub-questions that need to be generated from the answers to the previous sub-questions when processing the questions to be answered. These new sub-questions remain later associated with answers to the previous sub-questions because they were generated based on answers to the previous sub-questions.
The second sub-question may be a sub-question that depends on the answer of the first sub-question to obtain the answer, or may be a new sub-question generated from the answer of the first sub-question. The sub-questions are processed sequentially through a stack, are related in the reasoning process, are trackable in the question-and-answer reasoning process, and have higher interpretability.
In some embodiments of the present disclosure, as shown in fig. 4, according to the entity action pairs of all the sub-questions in the questions to be answered, an entity sequence and an action sequence of the questions to be answered are generated, and further including the following steps:
s402, at least one entity contained in each sub-problem and actions executed on the at least one entity are acquired;
s404, generating an entity sequence of the questions to be answered according to the entities contained in all the sub-questions in the questions to be answered;
s406, generating an action sequence of the questions to be answered according to the actions corresponding to all the sub-questions in the questions to be answered.
By generating the entity sequence and the action sequence, the embodiment of the disclosure can more clearly determine the entity range involved in the questions to be answered, and is helpful for reducing the range of answer sets which we need to search, thereby improving the solving efficiency of the questions. With the generated entity sequences and action sequences, we can make inferences and answers more targeted. When answering a question, we can analyze the entities and actions listed in the entity sequence and action sequence, helping the system to deduce possible answers more effectively, improving the accuracy and precision of the answers. By generating the entity sequence and the action sequence, the method and the system provide more concise, clear and easy-to-understand problem expression, simplify interaction and communication between the user and the system and improve user experience.
In some embodiments of the present disclosure, the answer to the first sub-question is obtained by executing a query action in a preset knowledge base, where the query action includes any one of the following query manners: sparse queries, dense queries, graph queries.
The sparse query is used for querying the answer of the first sub-problem through the keyword in the preset knowledge base, the dense query is used for querying the answer of the first sub-problem through the vector space model in the preset knowledge base, and the map query is used for querying the answer of the first sub-problem through the knowledge map in the preset knowledge base.
It should be noted that, specifically, the three query modes have the following characteristics:
sparse query: sparse queries are a way to obtain relevant information in a preset knowledge base by simple keyword searches. Such query methods are typically used for text or unstructured data, are simple to use and easy to implement, but the query results may be inaccurate or cumbersome.
Dense query: the dense query is calculated based on a vector space model, and an answer can be obtained by calculating similarity between the query vector and vectors in a preset knowledge base. This approach to querying requires the use of more advanced techniques and algorithms and typically requires extensive computation.
Graph query: the graph query is to obtain the result in the preset knowledge base through a knowledge graph model or other modeling technology. It obtains answers by querying the knowledge graph and finding nodes similar to the query results. This query approach typically requires expertise and specialized software.
In summary, the query action of the preset knowledge base may query the preset knowledge base in a plurality of manners such as sparse query, dense query, and graph query, so as to obtain the answer of the first sub-question. Each query approach has its own advantages and disadvantages and requires the selection of the appropriate method to complete the query task depending on the particular task and scenario.
In some embodiments of the present disclosure, there is further provided a question-answering method, further comprising, before question-answering, as shown in fig. 5, the steps of:
s502, acquiring a knowledge text, wherein the knowledge text comprises at least one of the following formats: structured text, semi-structured text, and unstructured text.
It should be noted that structured text, semi-structured text and unstructured text are three data types common in information storage and processing, and refer to different data storage and presentation forms respectively.
Specifically, the structured text refers to text information with well-defined, fixed format and data type, and may be stored in forms, relational databases, spreadsheets, and the like. The structured text has the greatest characteristics of clear data organization form, simple operation and easy statistical analysis. For example, a bank customer's basic information form, including customer name, identification number, home address, contact phone, etc., may be stored and managed using a relational database or electronic form.
Semi-structured text refers to text information that has some structure, but does not fully define or define the complete structure, and may be stored in XML, HTML, or the like. The semi-structured text contains metadata, but the relationship of the data and metadata is not defined in the data itself, requiring parsing and analysis using specific tools. For example, a text having a certain structure such as a paper, news report, etc. may describe the structure using XML, which may be converted into various types of text such as HTML as an intermediate format.
Unstructured text is text information lacking a structure, nor is the storage form of a fixed format and data type, usually appearing in plain text, containing natural language text, email, social media data, picture files, audio files, video files, and the like. Unstructured text is inconvenient for automatic processing by a computer and generally requires processing such as intent extraction, key information recognition, and the like using natural language processing algorithms.
It should be construed that knowledge text is extracted from a variety of data sources including, but not limited to, databases, files, networks, etc.
S504, constructing a preset knowledge base according to the knowledge text.
The method has the advantages that the information management and query tool based on data driving is provided, the efficiency, the accuracy and the reliability of information processing and searching can be improved, the text information can be preprocessed and marked by the preset knowledge base, and customized query and search functions can be provided. Through the efficient utilization of the knowledge base, the information processing efficiency and speed can be improved, and the time and cost of manual processing and inquiry are reduced.
Embodiments of the present disclosure are specifically described below in conjunction with fig. 6.
The questions to be answered are obtained taking as an example "which band members are more of the a band (tiger) and the B band (Tfboys)".
To answer the question, "which band members are more for a band (tiger) and B band (Tfboys)", sub-question 1: how many a band members are? Sub-problem 2: how many B band members are? Sub-problem 3: what is the number of a band members and the number of B band members? Sub-problem 1 and sub-problem 2 are first sub-problems in embodiments of the present disclosure, and sub-problem 3 is second sub-problem in embodiments of the present disclosure. The entity action pair is expressed as 'A band-inquiry', 'B band-inquiry', 'quantity-comparison', the entity sequence and the action sequence are shown in figure 6, the entity sequence and the action sequence are traversed, the answer of the first sub-question is obtained, the answer of the second sub-question is generated according to the answer of the first sub-question, the first sub-question is a sub-question of which the answer can be obtained by executing one action in the questions to be answered, and the second sub-question is a sub-question of which the answer can be obtained only by relying on the answer of the first sub-question in the questions to be answered.
The specific action of the first sub-problem is a query action, wherein the query is performed in a preset knowledge base, the preset knowledge base is generated through a large amount of corpus and structured data text, unstructured data text and semi-structured data text, and the preset knowledge base stores a large amount of knowledge about various bands, including basic information and member information of the bands and the like. The answer of the first sub-question can be queried in a preset knowledge base through the query action.
The second sub-question is a sub-question which is to be answered and which depends on the answer of the first sub-question to obtain the answer. And comparing the answers of the first sub-questions to obtain answer results of which of the questions to be answered, namely the A band (tiger) and the B band (Tfboys) has more members.
In some embodiments of the present disclosure, as shown in fig. 7, the answer 701 to the first sub-question may be stored in the stack 700, and when the answer 701 to the first sub-question is generated, the answer may be pushed onto the stack 700. Then, when the second sub-question related to the first sub-question is solved, the answers in the stack can be acquired according to the sequence of the first and last answers of the first sub-question which are generated before, and the generation of the subsequent sub-questions can be completed sequentially.
The embodiment of the disclosure stores the answers of each sub-question in a stack, can analyze and check the answers of each sub-question at any time according to the needs, and forms clear association with the answers of the previous sub-questions. The reasoning process of the system can be more easily tracked and understood.
Based on the same inventive concept, the embodiments of the present disclosure also provide a question answering device, as follows. Since the principle of solving the problem of the embodiment of the device is similar to that of the embodiment of the method, the implementation of the embodiment of the device can be referred to the implementation of the embodiment of the method, and the repetition is omitted.
Fig. 8 shows a schematic structural diagram of a question-answering apparatus according to an embodiment of the present disclosure, and as shown in fig. 8, the question-answering apparatus 80 includes:
a question obtaining module 801, configured to obtain a question to be answered.
A question splitting module 802, configured to split a question to be answered into a plurality of sub-questions, where each sub-question is represented as an entity action pair, and the entity action pair includes: at least one entity, and an action performed on the at least one entity.
The sequence generating module 803 is configured to generate an entity sequence and an action sequence of the to-be-answered question according to entity action pairs of all the sub-questions in the to-be-answered question, where the entity sequence includes a plurality of entities of all the sub-questions in the to-be-answered question and the plurality of entities are ordered according to the order of the sub-questions in the to-be-answered question, and the action sequence includes a plurality of actions of all the sub-questions in the to-be-answered question and the plurality of actions are ordered according to the order of the sub-questions in the to-be-answered question.
The answer generation module 804 is configured to traverse the entity sequence and the action sequence, obtain an answer of a first sub-question, generate an answer of a second sub-question according to the answer of the first sub-question, where the first sub-question is a sub-question in which an answer can be obtained by performing an action once in the question to be answered, and the second sub-question is a sub-question in which the answer can be obtained only by relying on the answer of the first sub-question.
The answer determining module 805 determines the answer of the second sub-question as the answer result of the question to be answered.
In some embodiments of the present disclosure, the answer generation module is further configured to repeatedly perform the following steps until the entities in the entity sequence and the actions in the action sequence are all traversed: obtaining answers of the first sub-questions, and placing the answers of the first sub-questions in a stack; and taking out the answer of the first sub-question from the stack, and generating the answer of the second sub-question according to the answer of the first sub-question.
In some embodiments of the present disclosure, the answer generation module is further configured to cache an answer to the first sub-question; wherein generating an answer to the second sub-question from the answer to the first sub-question comprises: and generating an answer of the second sub-question according to the cached answer of the first sub-question.
In some embodiments of the present disclosure, the answer generation module is further configured to implement a question answering method according to claim 3, wherein caching the answer of the first sub-question comprises: caching answers of the first sub-questions through a stack; generating an answer to the second sub-question from the answer to the first sub-question, comprising: and taking out the answers of the first sub-questions put in the stack, and generating the answer of the second sub-questions according to the answers of the first sub-questions taken out of the stack.
In some embodiments of the present disclosure, the sequence generation module is further configured to obtain at least one entity included in each sub-problem and an action performed on the at least one entity; generating an entity sequence of the questions to be answered according to the entities contained in all the sub-questions in the questions to be answered; and generating an action sequence of the questions to be answered according to the actions corresponding to all the sub-questions in the questions to be answered.
Those skilled in the art will appreciate that the various aspects of the present disclosure may be implemented as a system, method, or program product. Accordingly, various aspects of the disclosure may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system.
An electronic device 900 according to such an embodiment of the present disclosure is described below with reference to fig. 9. The electronic device 900 shown in fig. 9 is merely an example and should not be construed to limit the functionality and scope of use of embodiments of the present disclosure in any way.
As shown in fig. 9, the electronic device 900 is embodied in the form of a general purpose computing device. Components of electronic device 900 may include, but are not limited to: the at least one processing unit 910, the at least one storage unit 920, and a bus 930 connecting the different system components (including the storage unit 920 and the processing unit 910).
Wherein the storage unit stores program code that is executable by the processing unit 910 such that the processing unit 910 performs steps according to various exemplary embodiments of the present disclosure described in the above-described "exemplary methods" section of the present specification. For example, the processing unit 910 may perform the following steps in the method embodiment described above, for example: XXXX.
The storage unit 920 may include readable media in the form of volatile storage units, such as Random Access Memory (RAM) 9201 and/or cache memory 9202, and may further include Read Only Memory (ROM) 9203.
The storage unit 920 may also include a program/utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
The bus 930 may be one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 900 may also communicate with one or more external devices 940 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 900, and/or any devices (e.g., routers, modems, etc.) that enable the electronic device 900 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 950. Also, electronic device 900 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 960. As shown, the network adapter 960 communicates with other modules of the electronic device 900 over the bus 930. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 900, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the question-answering method of any one of the above.
In an exemplary embodiment of the present disclosure, a computer-readable storage medium, which may be a readable signal medium or a readable storage medium, is also provided. On which a program product is stored which enables the implementation of the method described above of the present disclosure. In some possible implementations, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to carry out the steps according to the various exemplary embodiments of the disclosure as described in the "exemplary methods" section of this specification, when the program product is run on the terminal device.
More specific examples of the computer readable storage medium in the present disclosure may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In this disclosure, a computer readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Alternatively, the program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
In particular implementations, the program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Furthermore, although the steps of the methods in the present disclosure are depicted in a particular order in the drawings, this does not require or imply that the steps must be performed in that particular order or that all illustrated steps be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform, etc.
From the description of the above embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A question-answering method, comprising:
acquiring a question to be answered;
splitting the question to be answered into a plurality of sub-questions, wherein each sub-question is represented as an entity action pair, and the entity action pair comprises: at least one entity and an action performed on the at least one entity;
generating an entity sequence and an action sequence of the questions to be answered according to entity action pairs of all the sub-questions in the questions to be answered, wherein the entity sequence comprises a plurality of entities of all the sub-questions in the questions to be answered and the entities are ordered according to the order of the sub-questions to be answered, and the action sequence comprises a plurality of actions of all the sub-questions in the questions to be answered and the actions are ordered according to the order of the sub-questions to be answered;
Traversing the entity sequence and the action sequence, obtaining an answer of a first sub-question, and generating an answer of a second sub-question according to the answer of the first sub-question, wherein the first sub-question is a sub-question of which the answer can be obtained by executing an action once in the questions to be answered, and the second sub-question is a sub-question of which the answer can be obtained only by relying on the answer of the first sub-question in the questions to be answered;
and determining the answer of the second sub-question as an answer result of the question to be answered.
2. The question-answering method according to claim 1, wherein traversing the entity sequence and the action sequence, obtaining an answer to a first sub-question, generating an answer to a second sub-question from the answer to the first sub-question, comprises:
repeating the following steps until the entity in the entity sequence and the action in the action sequence are all traversed:
obtaining answers of the first sub-questions, and placing the answers of the first sub-questions in a stack;
and taking out the answer of the first sub-question from the stack, and generating the answer of the second sub-question according to the answer of the first sub-question.
3. The question-answering method according to claim 1, wherein after obtaining the answer to the first sub-question, the method further comprises:
Caching answers of the first sub-questions;
wherein generating an answer to the second sub-question from the answer to the first sub-question comprises: and generating an answer of the second sub-question according to the cached answer of the first sub-question.
4. A question-answering method according to claim 3, wherein caching answers to the first sub-question comprises: caching answers of the first sub-questions through a stack;
generating an answer to the second sub-question from the answer to the first sub-question, comprising:
and taking out the answers of the first sub-questions put in the stack, and generating the answer of the second sub-questions according to the answers of the first sub-questions taken out of the stack.
5. The question answering method according to claim 1, wherein generating the entity sequence and the action sequence of the question to be answered according to the entity action pairs of all the sub-questions in the question to be answered comprises:
acquiring at least one entity contained in each sub-problem and executing actions on the at least one entity;
generating an entity sequence of the questions to be answered according to the entities contained in all the sub-questions in the questions to be answered;
and generating an action sequence of the questions to be answered according to the actions corresponding to all the sub-questions in the questions to be answered.
6. The question-answering method according to claim 1, wherein the answer to the first sub-question is obtained by executing a query action in a preset knowledge base, and the query action includes any one of the following query modes: sparse query, dense query, graph query;
the sparse query is used for querying the answer of the first sub-question through keywords in the preset knowledge base, the dense query is used for querying the answer of the first sub-question through a vector space model in the preset knowledge base, and the map query is used for querying the answer of the first sub-question through a knowledge map in the preset knowledge base.
7. The question-answering method according to claim 6, further comprising:
obtaining knowledge text, wherein the knowledge text comprises text in at least one of the following formats: structured text, semi-structured text, and unstructured text;
and constructing the preset knowledge base according to the knowledge text.
8. A question answering apparatus, comprising:
the question acquisition module is used for acquiring questions to be answered;
the question splitting module is configured to split the question to be answered into a plurality of sub-questions, where each sub-question is represented as an entity action pair, and the entity action pair includes: at least one entity and an action performed on the at least one entity;
The sequence generation module is used for generating an entity sequence and an action sequence of the to-be-answered questions according to entity action pairs of all the sub-questions in the to-be-answered questions, wherein the entity sequence comprises a plurality of entities of all the sub-questions in the to-be-answered questions and the entities are ordered according to the order of the sub-questions, and the action sequence comprises a plurality of actions of all the sub-questions in the to-be-answered questions and the actions are ordered according to the order of the sub-questions;
the answer generation module is used for traversing the entity sequence and the action sequence, obtaining an answer of a first sub-question, and generating an answer of a second sub-question according to the answer of the first sub-question, wherein the first sub-question is a sub-question of which the answer can be obtained by executing an action once in the questions to be answered, and the second sub-question is a sub-question of which the answer can be obtained only by relying on the answer of the first sub-question in the questions to be answered;
and the answer determining module is used for determining the answer of the second sub-question as the answer result of the question to be answered.
9. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
Wherein the processor is configured to perform the question-answering method of any one of claims 1 to 7 via execution of the executable instructions.
10. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the question answering method according to any one of claims 1 to 7.
CN202310854442.1A 2023-07-12 2023-07-12 Question answering method and device, electronic equipment and storage medium Pending CN116860941A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310854442.1A CN116860941A (en) 2023-07-12 2023-07-12 Question answering method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310854442.1A CN116860941A (en) 2023-07-12 2023-07-12 Question answering method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116860941A true CN116860941A (en) 2023-10-10

Family

ID=88223116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310854442.1A Pending CN116860941A (en) 2023-07-12 2023-07-12 Question answering method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116860941A (en)

Similar Documents

Publication Publication Date Title
CN108090351B (en) Method and apparatus for processing request message
US20210026860A1 (en) Method and device for generating ranking model
CN110321544B (en) Method and device for generating information
WO2020206910A1 (en) Product information pushing method, apparatus, computer device, and storage medium
WO2024036662A1 (en) Parallel graph rule mining method and apparatus based on data sampling
CN112182255A (en) Method and apparatus for storing media files and for retrieving media files
CN112582073B (en) Medical information acquisition method, device, electronic equipment and medium
CN113010542B (en) Service data processing method, device, computer equipment and storage medium
CN111984745B (en) Database field dynamic expansion method, device, equipment and storage medium
US11449461B2 (en) Metadata-driven distributed dynamic reader and writer
CN113220710A (en) Data query method and device, electronic equipment and storage medium
US8924431B2 (en) Pluggable domain-specific typing systems and methods of use
CN111488386A (en) Data query method and device
CN116127143A (en) Data query method, device, electronic equipment and readable storage medium
CN116860941A (en) Question answering method and device, electronic equipment and storage medium
CN111897884B (en) Data relationship information display method and terminal equipment
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN110555053B (en) Method and apparatus for outputting information
CN113127496A (en) Method, apparatus, medium, and device for determining change data in database
CN112988778A (en) Method and device for processing database query script
CN110990528A (en) Question answering method and device and electronic equipment
CN117473129A (en) Cloud product data management method and device, electronic equipment and storage medium
CN110807089B (en) Question answering method and device and electronic equipment
CN110795424B (en) Characteristic engineering variable data request processing method and device and electronic equipment
CN115563183B (en) Query method, query device and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination