Question answer obtaining method and device, electrical equipment and storage medium
By determining the most suitable answer mode based on the preset information or tag information of the question information in the question and answer system, and using this mode to obtain answers is preferred, the problem of fixed answer mode order in the prior art is solved, and the efficiency and accuracy of answers are improved.
Patent Information
- Application Number
- CN202311069960.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-23
- Publication Date
- 2025-02-28
AI Technical Summary
In existing question and answer systems, the answer mode has a fixed order of use, resulting in the preferred answer mode that may not be the most suitable mode for user questions, which affects the efficiency and accuracy of obtaining answers.
By obtaining preset information or tag information for the question information, determine the most suitable answer mode as the target answer mode, and use this mode to obtain answers first; if the target answer mode fails to successfully obtain answers, continue to use its candidate answer mode.
Improves the efficiency of obtaining answers and the accuracy of answers, and avoids the inaccurate answer questions caused by fixed answer patterns.
Smart Images

Figure CN119537517A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of intelligent question answering, for example, to a method and apparatus, electrical equipment, and storage medium for obtaining answers to questions. Background Art
[0002] The question-answering system is an advanced form of information retrieval system, which can answer questions raised by users in natural language accurately and concisely. In related technologies, the question-answering system is usually configured with multiple answer modes. Different answer modes can be used to obtain answers to the same user question, ensuring that the corresponding answer can be fed back for each user question.
[0003] The related technology discloses a method for obtaining answers to questions through multi-strategy intelligent search in the field of power grids, including: obtaining user questions; extracting semantic features from the user questions and a FAQ question-answer pair library consisting of knowledge content in the professional field of power grids, converting the user questions into vector form, and extracting semantic feature vectors from each FAQ question-answer pair; using the FAISS vector search engine to construct a vector index for each question-answer pair based on the semantic feature vector of the FAQ question-answer pair, thereby obtaining a vector index matrix for the FAQ question-answer pair library; using FAISS to perform vector retrieval based on the index of each question-answer pair and the vector form corresponding to the user question and answer, first performing L2 normalization on the user question vector and the constructed FAQ question-answer pair library vector index matrix, and then performing cosine Similarity calculation is performed, and the obtained score is used as the similarity basis to obtain N vectors with the highest similarity to the user's question, and the N question-answer pairs with the highest similarity to the user's question are retrieved from the FAQ question-answer pair library; the N question-answer pairs with the highest similarity obtained based on the recall stage are sorted, and the K answers with the highest similarity are returned; wherein N and K are both positive integers greater than 0, and K is less than or equal to N. If no standard question similar to the user's question is found, the module switches to the KBQA module, and uses the graph question-answering service to process the question asked by the user; the KBQA module searches and matches in the FAQ question-answer pair library to see if there are similar standard questions, and returns the corresponding answer if there are; if there are no standard questions, the question is added to the FAQ knowledge base and the answer is given manually; at the same time, the questions that the user is dissatisfied with are also added to the FAQ knowledge base and the answer is given manually; the manually given answer is used as the training data sample for the next iteration, and is used to reconstruct the FAQ question-answer pair library.
[0004] In the related art, three answer modes, namely, question-answer pair, KBQA module and manual, are provided for user questions. These three answer modes have a fixed order of use, that is, the question-answer pair mode is used to obtain the answer first. If the question-answer pair mode does not successfully obtain the answer, the KBQA module mode is then used to obtain the answer. If the KBQA module mode does not successfully obtain the answer, the manual mode is used to obtain the answer. Since the three answer modes in the related art have a fixed order of use, the answer mode used first may not be the most suitable answer mode for the user's question, thereby affecting the efficiency of obtaining answers and the accuracy of the answers.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0007] The embodiments of the present disclosure provide a method and apparatus, an electrical device, and a storage medium for obtaining answers to questions, which can improve the efficiency of obtaining answers and the accuracy of answers.
[0008] According to a first aspect of the present disclosure, a method for obtaining an answer to a question is provided. The method for obtaining an answer to a question includes:
[0009] When question information is obtained, a target answer mode is determined from a plurality of answer modes based on the question information, wherein each answer mode corresponds to a candidate answer mode;
[0010] Use the target answer mode to obtain answers to question information;
[0011] If the answer to the question information is not obtained using the target answer pattern, the answer to the question information is continuously obtained using the candidate answer patterns of the target answer pattern.
[0012] In some embodiments, determining a target answer mode from a plurality of answer modes includes:
[0013] Acquiring preset information of the question information, wherein the preset information is used to indicate an answer mode suitable for the question information;
[0014] When the preset information is obtained, a target answer mode is determined from a plurality of answer modes based on the preset information;
[0015] When the preset information is not obtained, a default answer mode among the multiple answer modes is used as the target answer mode.
[0016] In some embodiments, the preset information is label information, and the label information includes an answer mode; when the preset information is obtained, a target answer mode is determined from multiple answer modes based on the preset information, including:
[0017] When the label information is obtained, determining the answer mode contained in the label information;
[0018] The answer pattern included in the label information is determined as the target answer pattern.
[0019] In some embodiments, the preset information is intention information; when the preset information is obtained, a target answer mode is determined from multiple answer modes based on the preset information, including:
[0020] When the intent information is obtained, a target intent matching the intent information is determined from a plurality of candidate intents, wherein each candidate intent corresponds to an answer mode;
[0021] The answer mode corresponding to the target intention is determined as the target answer mode.
[0022] In some embodiments, the multiple answer modes include a knowledge graph retrieval mode; when the target answer mode is the knowledge graph retrieval mode, using the target answer mode to obtain an answer to the question information includes:
[0023] Determine the search type corresponding to the question information based on the preset information, and extract the slot information from the question information based on the search type;
[0024] Fill the slot information into the query statement template corresponding to the retrieval type to obtain the target query statement;
[0025] Obtain the answer to the target query statement according to the knowledge graph retrieval mode, and use the answer to the target query statement as the answer to the question information.
[0026] In some embodiments, the preset information is label information or intent information; when the preset information is label information, a search type in the knowledge graph search mode contained in the label information is used as the search type corresponding to the question information;
[0027] In the case where the preset information is intent information, a retrieval type in the knowledge graph retrieval mode corresponding to the target intent matching the intent information is used as the retrieval type corresponding to the question information.
[0028] In some embodiments, the multiple answer modes include a question-answer pair matching mode; when the target answer mode is the question-answer pair matching mode, using the target answer mode to obtain an answer to the question information includes:
[0029] Determine the standard question corresponding to the question information based on the preset information;
[0030] The answers to the standard questions are obtained according to the question-answer pair matching pattern, and the answers to the standard questions are used as the answers to the question information.
[0031] In some embodiments, the preset information is tag information or intention information;
[0032] In the case where the preset information is label information, a standard question in the question-answer pair matching mode contained in the label information is used as the standard question corresponding to the question information;
[0033] In the case where the preset information is intent information, a standard question in the question-answer pair matching mode corresponding to the target intent matching the intent information is used as the standard question corresponding to the question information.
[0034] In some embodiments, multiple answer modes include a knowledge graph retrieval mode and a question-answer pair matching mode, the candidate answer mode of the knowledge graph retrieval mode is the question-answer pair matching mode, and the candidate answer mode of the question-answer pair matching mode is a preset generative large model answer mode.
[0035] According to a second aspect of the present disclosure, a device for obtaining answers to questions is provided, the device comprising a processor and a memory storing program instructions, the processor being configured to execute the method for obtaining answers to questions provided in the first aspect when running the program instructions.
[0036] According to a third aspect of the present disclosure, an electrical device is provided, comprising a device body and the apparatus for obtaining answers to questions provided in the second aspect; the apparatus for obtaining answers to questions is installed on the device body.
[0037] According to a fourth aspect of the present disclosure, a storage medium is provided, storing program instructions, characterized in that when the program instructions are run, the method for obtaining answers to questions provided in the first aspect is executed.
[0038] The method and device for obtaining answers to questions, electrical equipment, and storage medium provided in the embodiments of the present disclosure can achieve the following technical effects:
[0039] The present disclosure does not directly use the default answer mode to obtain the answer to the question information, but first determines the target answer mode that best suits the question information from multiple answer modes, and then prioritizes the target answer mode to obtain the answer to the question information, thereby improving the efficiency of obtaining the answer and the accuracy of the answer. In addition, if the answer to the question information is not obtained using the target answer mode, the answer to the question information can be obtained using the candidate answer mode to avoid interruption in the process of obtaining the answer.
[0040] The foregoing general description and the following description are exemplary and explanatory only and are not intended to limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0042] Figure 1 is a schematic diagram of a method for obtaining an answer to a question provided by an embodiment of the present disclosure;
[0043] Figure 2 is a schematic diagram of another method for obtaining an answer to a question provided by an embodiment of the present disclosure;
[0044] Figure 3 is a schematic diagram of another method for obtaining an answer to a question provided by an embodiment of the present disclosure;
[0045] Figure 4 is a schematic diagram of another method for obtaining an answer to a question provided by an embodiment of the present disclosure;
[0046] Figure 5 is a schematic diagram of another method for obtaining an answer to a question provided by an embodiment of the present disclosure;
[0047] Figure 6 is a schematic diagram of a device for obtaining an answer to a question provided by an embodiment of the present disclosure;
[0048] Figure 7 It is a schematic diagram of an electrical device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0049] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0050] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0051] Unless otherwise stated, the term "plurality" means two or more.
[0052] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0053] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0054] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0055] The method for obtaining answers to questions provided by the embodiments of the present disclosure can be applied to a question-answering dialogue system. In a question-answering dialogue system, the question knowledge required by the user is usually accurately located in a one-question-one-answer format, and personalized information services are provided to website users by interacting with website users. The intelligent question-answering system organizes the accumulated disordered corpus information in an orderly and scientific manner, and establishes a knowledge-based classification model; these classification models can guide the newly added corpus consultation and service information, save human resources, improve the automation of information processing, and reduce website operation costs.
[0056] The method for obtaining answers to questions provided by the embodiments of the present disclosure pre-configures multiple answer modes. For example, the multiple answer modes may include a knowledge graph retrieval mode, a question-answer pair matching mode, and a generative large model answer mode.
[0057] The knowledge graph retrieval mode is a mode of using the knowledge graph to obtain the answer to a question. Knowledge graph question answering, also known as knowledge-based QA or KBQA, is an intelligent method for obtaining answers to questions based on a structured knowledge base (i.e., knowledge graph). Given a natural language question, this type of method understands the question based on the knowledge graph, and searches or infers the answer to the question from the knowledge graph based on the result of the question understanding.
[0058] Knowledge graph is called knowledge domain visualization or knowledge domain mapping map in the library and information industry. It is a series of various graphics that show the development process and structural relationship of knowledge. It uses visualization technology to describe knowledge resources and their carriers, and to mine, analyze, construct, draw and display knowledge and their interrelationships.
[0059] The question-answer pair matching mode is a mode that obtains answers to questions through question-answer pair matching. Its basic logic is to first build a question-answer pair library consisting of questions and corresponding answers based on the questions that users often ask when using the search system or communicating with human customer service; then, write different variations of the questions to expand the question-answer pair library; finally, build a text matching algorithm / model. When a question is received, the text matching algorithm / model will match a question that is closest to the received question from the question-answer pair library, and then return the answer corresponding to the close question.
[0060] The generative big model answering mode is a mode in which a question is input into the generative big model answer and the answer to the question is obtained through the generative big model answer. It should be noted here that the generative big model is an artificial intelligence model, which can also be called a generative AI (Artificial Intelligence) model. The generative big model can realize the automatic generation of various tasks such as from text to text, from image to text, and from text to image through large-scale data training and powerful computing power.
[0061] The embodiment of the present disclosure also provides a device for obtaining an answer to a question, the device comprising a processor and a memory storing program instructions. When the processor obtains question information, it can obtain an answer based on the question information using a suitable answer mode.
[0062] In conjunction with the apparatus for obtaining answers to questions provided in the embodiments of the present disclosure, the embodiments of the present disclosure provide a method for obtaining answers to questions, such as Figure 1 As shown, the method comprises the following steps:
[0063] Step 101 : When the processor obtains question information, it determines a target answer mode from multiple answer modes based on the question information.
[0064] Here, each answer mode corresponds to a candidate answer mode. For example, multiple answer modes may include a knowledge graph retrieval mode and a question-answer pair matching mode, wherein the candidate answer mode of the knowledge graph retrieval mode may be a question-answer pair matching mode, and the candidate answer mode of the question-answer pair matching mode may be a generative large model answer mode. In step 101, based on the question information, a target answer mode is determined from the knowledge graph retrieval mode and the question-answer pair matching mode.
[0065] In step 101, the target answer mode is determined from multiple answer modes by analyzing the question information or the associated information of the question information. It should be noted that the process of determining the target answer mode from multiple answer modes can be achieved by calling the candidate relationship based on multiple answer modes in sequence, rather than directly determining a target answer mode as the final answer mode through a dedicated routing distribution module.
[0066] For example, the target answer mode can be determined from one of the knowledge graph retrieval mode and the question-answer pair matching mode. It can be understood that the target answer mode is an answer mode that is initially determined to be suitable for obtaining an answer to the question information. In step 102, the processor uses the target answer mode to obtain an answer to the question information.
[0067] It is understandable that, when the answer to the question information is obtained by using the target answer mode, the answer can be directly fed back; when the answer to the question information is not obtained by using the target answer mode, step 103 is continued.
[0068] Step 103 : If the processor fails to obtain an answer to the question information by using the target answer mode, the processor continues to use the candidate answer mode of the target answer mode to obtain an answer to the question information.
[0069] Take the multiple answer modes in step 101 as an example, which may include a knowledge graph retrieval mode and a question-answer pair matching mode. If the determined target answer mode is the knowledge graph retrieval mode, if the answer to the question information is not obtained using the knowledge graph retrieval mode, the question-answer pair matching mode is continued to be used to obtain the answer to the question information; if the answer to the question information is obtained using the question-answer pair matching mode, the answer can be fed back; if the answer to the question information is not obtained using the question-answer pair matching mode, the generative large model answer mode is continued to be used to obtain the answer to the question information.
[0070] If the determined target answer mode is the question-answer pair matching mode, and if the answer to the question information is not obtained using the question-answer pair matching mode, continue to use the generative large model answer mode to obtain the answer to the question information.
[0071] The method for obtaining answers to questions provided by the embodiments of the present disclosure does not directly use the default answer mode to obtain answers to question information, but first determines the target answer mode that best suits the question information from multiple answer modes, and then prioritizes the target answer mode to obtain answers to the question information, thereby improving the efficiency of obtaining answers and the accuracy of answers. In addition, if the answer to the question information is not obtained using the target answer mode, the answer to the question information can be obtained using the candidate answer mode to avoid interruption in the process of obtaining answers.
[0072] In some embodiments, based on the question information, a target answer mode is determined from multiple answer modes, including: obtaining preset information of the question information, wherein the preset information is used to indicate an answer mode suitable for the question information; when the preset information is obtained, determining the target answer mode from multiple answer modes based on the preset information; when the preset information is not obtained, using the default answer mode among the multiple answer modes as the target answer mode, that is, the default answer mode can be used subsequently to obtain the answer to the question information.
[0073] In some embodiments, multiple answer modes include a knowledge graph retrieval mode and a question-answer pair matching mode, the candidate answer mode of the knowledge graph retrieval mode is the question-answer pair matching mode, and the candidate answer mode of the question-answer pair matching mode is a preset generative large model answer mode.
[0074] Combination Figure 2 As shown, the embodiment of the present disclosure provides another method for obtaining an answer to a question, the method comprising the following steps:
[0075] Step 201: When the processor obtains question information, it obtains preset information of the question information.
[0076] Here, the preset information is used to indicate the answer mode suitable for the question information.
[0077] In some embodiments, the preset information is label information. Here, only the question information corresponding to the wrong reply found by the background data analyst will be configured with label information, and the label information is configured by the background data analyst for the corresponding question information offline. These question information configured with label information are question information that has not been successfully answered using the knowledge graph retrieval mode or the question-answer pair matching mode. By configuring labels for question information, the question information corresponding to the wrong reply can be quickly repaired based on the label information.
[0078] After step 201, step 202 or step 203 may be performed. Specifically, if the preset information is obtained, step 202 is performed; if the preset information is not obtained, step 203 is performed.
[0079] For example, if the preset information is label information, if the label information of the question information is obtained, step 202 is executed to enter the quick repair process, and the answer to the question information is obtained based on the quick repair process; if the question information is not configured with label information, the label information of the question information cannot be obtained in step 201, and step 203 is executed to use the default process to obtain the answer to the question information.
[0080] Step 202: When the processor obtains the preset information, it determines a target answer mode from multiple answer modes based on the preset information.
[0081] After step 202 , step 204 may be performed.
[0082] Step 203: When the processor fails to obtain the preset information, the processor uses a default answer mode among the multiple answer modes as the target answer mode.
[0083] Taking the multiple answer modes in step 201 as an example, the default answer mode may include a knowledge graph retrieval mode and a question-answer pair matching mode. For example, the knowledge graph retrieval mode may be set as the default answer mode. If the target answer mode is not determined in step 202, the knowledge graph retrieval mode may be directly determined as the default answer mode in step 203.
[0084] After step 203 , step 204 may be performed.
[0085] In step 204, the processor uses the target answer mode to obtain the answer to the question information.
[0086] Step 205 : If the processor fails to obtain an answer to the question information by using the target answer mode, the processor continues to use the candidate answer modes of the target answer mode to obtain an answer to the question information.
[0087] Take the multiple answer modes in step 201 as an example, which may include a knowledge graph retrieval mode and a question-answer pair matching mode. If the determined target answer mode is the knowledge graph retrieval mode, if the answer to the question information is not obtained by using the knowledge graph retrieval mode, the question-answer pair matching mode is continued to be used to obtain the answer to the question information; if the determined target answer mode is the question-answer pair matching mode, if the answer to the question information is not obtained by using the question-answer pair matching mode, the generative large model answer mode is continued to be used to obtain the answer to the question information.
[0088] In some embodiments, the preset information is label information, and the label information includes an answer mode. When the preset information is obtained, based on the preset information, a target answer mode is determined from multiple answer modes, including: when the label information is obtained, determining the answer mode included in the label information; determining the answer mode included in the label information as the target answer mode.
[0089] In some embodiments, the multiple answer modes include a knowledge graph retrieval mode. When the target answer mode is the knowledge graph retrieval mode, using the target answer mode to obtain an answer to the question information includes: determining a retrieval type corresponding to the question information based on preset information, and extracting slot information from the question information based on the retrieval type; filling the slot information into a query statement template corresponding to the retrieval type to obtain a target query statement; obtaining an answer to the target query statement according to the knowledge graph retrieval mode, and using the answer to the target query statement as the answer to the question information.
[0090] In some embodiments, multiple answer modes include a question-answer pair matching mode; when the target answer mode is the question-answer pair matching mode, the target answer mode is used to obtain the answer to the question information, including: determining the standard question corresponding to the question information based on preset information; obtaining the answer to the standard question according to the question-answer pair matching mode, and using the answer to the standard question as the answer to the question information.
[0091] When the preset information is tag information, the tag information includes a search mode. When the search mode included in the tag information is a knowledge graph search mode, the tag information also includes a search type in the knowledge graph search mode. A search type in the knowledge graph search mode included in the tag information is used as the search type corresponding to the question information.
[0092] Combination Figure 3 As shown, the embodiment of the present disclosure provides another method for obtaining an answer to a question, the method comprising the following steps:
[0093] Step 301: When the processor obtains question information, it obtains label information of the question information.
[0094] After step 301 , step 302 or step 309 may be executed.
[0095] Step 302: When the processor obtains the tag information, it determines the answer mode included in the tag information.
[0096] After step 302 , step 303 may be performed.
[0097] Step 303: The processor determines the answer mode included in the tag information as the target answer mode.
[0098] When the target answer mode is the knowledge graph retrieval mode, after step 303, step 304, step 305 and step 306 are executed in sequence.
[0099] Step 304: The processor determines the search type corresponding to the question information based on the preset information, and extracts the slot information from the question information based on the search type.
[0100] The search type can represent the search logic of the knowledge graph search mode. For example, "given entities and properties, find property values" belongs to a search category, which can be named "search_property_value".
[0101] Take the question "What are the advantages of infrared thermostat" as an example. When searching for the category "Known entities and attributes, find attribute values", the process of extracting slot information from the question information is as follows:
[0102]
[0103] In the above content, node represents a node, the content corresponding to node represents the content of the node, label represents a label, property represents a property, and the content corresponding to property represents the content of the property.
[0104] Step 305: The processor fills the slot information into the query statement template corresponding to the search type to obtain the target query statement.
[0105] Step 306: The processor obtains the answer to the target query statement according to the knowledge graph retrieval mode.
[0106] After step 306, step 307 or step 308 may be performed.
[0107] Step 307: The processor uses the answer to the target query statement as the answer to the question information.
[0108] Step 306: If the processor fails to obtain the answer to the question information by using the graph recognition retrieval mode, the processor continues to use the question-answer pair matching mode to obtain the answer to the question information.
[0109] Specifically, a standard question that is most similar to the question information may be determined in the question-answer database, and then the answer to the standard question may be obtained according to the question-answer pair matching pattern.
[0110] Step 309: When the processor fails to obtain the tag information, the processor uses the default answer mode to obtain the answer to the question information.
[0111] Taking the multiple answer modes in step 301 as an example, which may include a knowledge graph retrieval mode and a question-answer pair matching mode, the default answer mode may be one of the two. For example, the knowledge graph retrieval mode may be set as the default answer mode.
[0112] Here, if the default answer mode is the knowledge graph retrieval mode, the question information can be parsed to determine the retrieval type used by the question information, and the slot information can be extracted from the question information based on the retrieval type. The slot information is filled into the query statement template corresponding to the retrieval type to obtain the target query statement, and the answer to the target query statement is obtained according to the knowledge graph retrieval mode, and the answer to the target query statement is used as the answer to the question information.
[0113] When the preset information is label information, the label information includes a search mode. When the search mode included in the label information is a question-answer pair matching mode, the label information also includes a standard question in the question-answer pair matching mode. The standard question in the question-answer pair matching mode included in the label information is used as the standard question corresponding to the question information.
[0114] Combination Figure 4 As shown, the embodiment of the present disclosure provides a method for obtaining an answer to a question, the method comprising the following steps:
[0115] Step 401: When the processor obtains question information, it obtains label information of the question information.
[0116] After step 401 , step 402 or step 409 may be executed.
[0117] Step 402: When the processor obtains the tag information, it determines the answer mode included in the tag information.
[0118] After step 402, step 403 may be performed.
[0119] Step 403: The processor determines the answer mode included in the tag information as the target answer mode.
[0120] When the target answer mode is a question-answer pair matching mode, after step 403, step 404, step 405 and step 406 are performed in sequence.
[0121] Step 404: The processor determines a standard question corresponding to the question information based on preset information.
[0122] After step 404 , step 405 or step 407 may be executed.
[0123] Step 405: The processor obtains answers to standard questions according to the question-answer pair matching pattern.
[0124] In step 406, the processor uses the answer to the standard question as the answer to the question information.
[0125] Step 407 : If the processor fails to determine the standard question corresponding to the question information, the processor continues to use the generative model answering mode to obtain the answer to the question information.
[0126] Step 408: When the processor fails to obtain tag information, the processor uses a default answer mode to obtain an answer to the question information.
[0127] Taking the multiple answer modes in step 401 as an example, the multiple answer modes may include the knowledge graph search mode and the question-answer pair matching mode, and the default answer mode may be one of the two. For example, the knowledge graph search mode may be set as the default answer mode.
[0128] Here, if the default answer mode is the knowledge graph retrieval mode, the question information can be parsed to determine the retrieval type used by the question information, and the slot information can be extracted from the question information based on the retrieval type. The slot information is filled into the query statement template corresponding to the retrieval type to obtain the target query statement, and the answer to the target query statement is obtained according to the knowledge graph retrieval mode, and the answer to the target query statement is used as the answer to the question information.
[0129] The search type can represent the search logic of the knowledge graph search mode. For example, "given entities and properties, find property values" belongs to a search category, which can be named "search_property_value".
[0130] Combination Figure 5 As shown, the embodiment of the present disclosure provides another method for obtaining an answer to a question, the method comprising the following steps:
[0131] Step 501: When the processor obtains question information, it obtains label information of the question information.
[0132] After step 501 , step 502 or step 513 may be executed.
[0133] Here, only the question information corresponding to the wrong reply found by the backend data analyst will be configured with label information. The label information is configured by the backend data analyst for the corresponding question information offline. These question information with label information are the question information that failed to obtain the answer using the knowledge graph retrieval mode or the question-answer pair matching mode. By configuring labels for question information, the question information corresponding to the wrong reply can be quickly repaired based on the label information.
[0134] If the label information of the question information is obtained, execute step 502 to enter the quick repair process and obtain the answer to the question information based on the quick repair process; if the question information is not configured with label information, the label information of the question information cannot be obtained in step 501, then execute step 513 and use the default process to obtain the answer to the question information.
[0135] Step 502: When the processor obtains the tag information, it determines the answer mode included in the tag information.
[0136] After step 502, step 503 may be performed.
[0137] Step 503: The processor determines the answer mode included in the tag information as the target answer mode.
[0138] When the retrieval mode included in the tag information is a knowledge graph retrieval mode, the tag information also includes a retrieval type in the knowledge graph retrieval mode. The retrieval type in the knowledge graph retrieval mode included in the tag information is used as the retrieval type corresponding to the question information.
[0139] When the retrieval mode included in the tag information is a question-answer pair matching mode, the tag information also includes a standard question in the question-answer pair matching mode. The standard question in the question-answer pair matching mode included in the tag information is used as the standard question corresponding to the question information.
[0140] When the target answer mode is the knowledge graph retrieval mode, after step 503, step 504, step 505 and step 506 are executed in sequence.
[0141] When the target answer mode is the knowledge graph retrieval mode, after step 503, steps 509 and 510 are executed in sequence.
[0142] Step 504 : The processor determines the search type corresponding to the question information based on the tag information, and extracts the slot information from the question information based on the search type.
[0143] Here, if the processor does not determine the search type corresponding to the question information based on the tag information, step 508 is directly executed without extracting the slot information from the question information and without continuing to execute steps 505, 506 and 507.
[0144] Step 505: The processor fills the slot information into the query statement template corresponding to the search type to obtain the target query statement.
[0145] Step 506: The processor obtains the answer to the target query statement according to the knowledge graph retrieval mode.
[0146] After step 506, step 507 or step 508 may be performed.
[0147] Step 507: The processor uses the answer to the target query statement as the answer to the question information.
[0148] Step 508: If the processor fails to obtain the answer to the question information using the knowledge graph retrieval mode, the processor continues to use the question-answer pair matching mode to obtain the answer to the question information.
[0149] Specifically, the standard question that is most similar to the question information can be determined in the question and answer library, and then the answer to the standard question can be obtained according to the question and answer matching mode. If the standard question that is most similar to the question information is determined in the question and answer library, the generative model answering mode can continue to be used to obtain the answer to the question information. Here, the question and answer library records the mapping relationship between various questions and standard questions. Its main function is to identify the different ways of asking and expressing the same standard question that users may ask, which is used to train the text matching model, and also serves as a basic library for online text matching. Therefore, the standard question that is most similar to the question information can be determined in the question and answer library based on text similarity.
[0150] Step 509: The processor determines the standard question corresponding to the question information based on the tag information.
[0151] After step 509 , step 510 or step 512 may be performed.
[0152] Step 510: The processor obtains answers to standard questions according to the question-answer pair matching pattern.
[0153] In step 511, the processor uses the answer to the standard question as the answer to the question information.
[0154] Step 512: If the processor fails to determine the standard question corresponding to the question information, the processor continues to use the generative model answering mode to obtain the answer to the question information.
[0155] Here, the answers obtained by the generative model answer mode can be supervised and analyzed. If the answer meets the preset specifications (such as laws and regulations, etc.), the answer and the corresponding reliability statement will be fed back; if the answer does not meet the preset specifications, no answer will be fed back, and fixed words will be fed back. Among them, the reliability statement informs the user that the answer is generated by the generative large model, is not completely true, and needs to be identified.
[0156] Step 513: When the processor fails to obtain the tag information, the processor uses the default answer mode to obtain the answer to the question information.
[0157] Here, if the default answer mode is the knowledge graph retrieval mode, the question information can be parsed to determine the retrieval type used by the question information, and the slot information can be extracted from the question information based on the retrieval type. The slot information is filled into the query statement template corresponding to the retrieval type to obtain the target query statement, and the answer to the target query statement is obtained according to the knowledge graph retrieval mode, and the answer to the target query statement is used as the answer to the question information.
[0158] The search type can represent the search logic of the knowledge graph search mode. For example, "given entities and properties, find property values" belongs to a search category, which can be named "search_property_value".
[0159] In step 513, the default answer mode is the knowledge graph retrieval mode. If the answer to the question information is obtained using the knowledge graph retrieval mode, the answer can be fed back; if the answer to the question information is not obtained using the knowledge graph retrieval mode, the question-answer pair matching mode is continued to be used to obtain the answer to the question information. If the answer to the question information is obtained using the question-answer pair matching mode, the answer can be fed back; if the answer to the question information is not obtained using the question-answer pair matching mode, the generative large model answer mode is continued to be used to obtain the answer to the question information.
[0160] When using the question-answer pair matching mode to obtain the answer to the question information, you can determine the standard question that is most similar to the question information in the question-answer library, and then obtain the answer to the standard question according to the question-answer pair matching mode. If the standard question that is most similar to the question information is determined in the question-answer library, you can continue to use the generative model answer mode to obtain the answer to the question information. Here, the question-answer library records the mapping relationship between various questions and standard questions. Its main function is to identify the different ways of asking and expressing the same standard question that users may ask, which is used to train the text matching model and also serves as a basic library for online text matching. Therefore, the standard question that is most similar to the question information can be determined in the question-answer library based on text similarity.
[0161] The method for obtaining answers to questions provided by the embodiments of the present disclosure forms a layout in which the question-answer pair matching mode is used as a backup, and the generative model answer mode is used as a backup for the question-answer pair matching mode. In this way, the knowledge graph retrieval mode does not have to achieve a high coverage (that is, the retrieval mode does not have to have comprehensive coverage) and can be launched first, and then gradually iterated. This effectively reduces the difficulty of implementing and iterating the knowledge graph retrieval mode, making the knowledge graph retrieval mode that was originally difficult to implement feasible.
[0162] By configuring label information for problem information, we can ensure that we can respond quickly to various types of problem information, minimize the impact of the uncontrollable aspects of the model on users, and form a highly controllable and feasible engineering implementation plan as a whole.
[0163] In some embodiments, the preset information is intent information. The intent information is obtained by identifying the question using a preset intent recognition algorithm. When the preset information is obtained, a target answer mode is determined from multiple answer modes based on the preset information, including: when the intent information is obtained, a target intent matching the intent information is determined from multiple candidate intents; and the answer mode corresponding to the target intent is determined as the target answer mode. Here, each candidate intent corresponds to an answer mode.
[0164] In some embodiments, the preset information is tag information or intent information. When the preset information is intent information, a search type in the knowledge graph search mode corresponding to the target intent matching the intent information is used as the search type corresponding to the question information.
[0165] In some embodiments, the preset information is intent information. In the case where the preset information is intent information, a standard question in the question-answer pair matching mode corresponding to the target intent matching the intent information is used as the standard question corresponding to the question information.
[0166] In some embodiments, the preset information is label information and intention information, and the label information includes an answer mode. When the preset information is obtained, a target answer mode is determined from multiple answer modes based on the preset information, including:
[0167] When the tag information is acquired, the answer mode included in the tag information is determined; and the answer mode included in the tag information is determined as the first target answer mode.
[0168] When the intent information is obtained, a target intent matching the intent information is determined from multiple candidate intents, and an answer mode corresponding to the target intent is determined as a second target answer mode. Here, each candidate intent corresponds to one answer mode.
[0169] If the first target answer mode and the second target answer mode are the same, use the first target answer mode to obtain the answer to the question information; if the answer to the question information is obtained using the first target answer mode, feed back the answer; if the answer to the question information is not obtained using the first target answer mode, continue to use the candidate answer mode of the first target answer mode to obtain the answer to the question information.
[0170] If the answers of the first target answer mode and the second target answer mode are different, the answer to the question information is obtained using the first target answer mode;
[0171] If the answer to the question information is obtained using the first target answer mode, the answer is fed back; if the answer to the question information is not obtained using the first target answer mode, the answer to the question information is continued to be obtained using the candidate answer mode of the second target answer mode;
[0172] If the answer to the question information is obtained using the second target answer mode, the answer is fed back; if the answer to the question information is not obtained using the second target answer mode, the answer to the question information is continued to be obtained using the candidate answer mode of the second target answer mode.
[0173] Combination Figure 6 As shown, the embodiment of the present disclosure provides an operating device 600 for a processor, and the image adjustment module 600 includes a processor (processor) 601 and a memory (memory) 602. Optionally, the device may also include a communication interface (Communication Interface) 603 and a bus 604. Among them, the processor 601, the communication interface 603, and the memory 602 can communicate with each other through the bus 604. The communication interface 603 can be used for information transmission. The processor 601 can call the logic instructions in the memory 602 to execute the method for obtaining the answer to the question in the above corresponding embodiment.
[0174] In addition, the logic instructions in the memory 602 described above may be implemented in the form of software functional units and when sold or used as independent products, may be stored in a computer-readable storage medium.
[0175] The memory 602 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the methods in the embodiments of the present disclosure. The processor 601 executes the functional application and data processing by running the program instructions / modules stored in the memory 602, that is, the method for obtaining the answer to the question in the above corresponding embodiment is implemented.
[0176] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 602 may include a high-speed random access memory and may also include a non-volatile memory.
[0177] The device for obtaining answers to questions provided by the embodiments of the present disclosure does not directly use the default answer mode to obtain answers to question information, but first determines the target answer mode that best suits the question information from multiple answer modes, and then prioritizes the target answer mode to obtain answers to the question information, thereby improving the efficiency of obtaining answers and the accuracy of answers. In addition, if the answer to the question information is not obtained using the target answer mode, the answer to the question information can be obtained using the candidate answer mode to avoid interruption in the process of obtaining answers.
[0178] Combination Figure 7 As shown, the embodiment of the present disclosure provides an electrical device 700, which may be a refrigerator, an air conditioner, a washing machine, etc. The electrical device 700 includes a device body 710 and the above-mentioned device 600 for obtaining an answer to a question, and the device 600 for obtaining an answer to a question is installed in the device body 710.
[0179] The embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute the method for ... The computer-readable storage medium may be a transient computer-readable storage medium or a non-transient computer-readable storage medium.
[0180] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: 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, and other media that can store program codes, or a transient storage medium.
[0181] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in the present disclosure are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in the present disclosure refers to any and all possible combinations of one or more associated listings. In addition, when used in the present disclosure, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method or device including the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0182] 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 may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0183] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other 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. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0184] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for obtaining an answer to a question, characterized in that: include: In the case where question information is obtained, a target answer mode is determined from a plurality of answer modes based on the question information, wherein each answer mode corresponds to a candidate answer mode; Using the target answer mode to obtain an answer to the question information; If the answer to the question information is not obtained using the target answer pattern, the answer to the question information is continuously obtained using the candidate answer patterns of the target answer pattern.
2. The method for obtaining answers to questions according to claim 1, characterized in that: The step of determining a target answer mode from a plurality of answer modes based on the question information includes: Acquire preset information of the question information, wherein the preset information is used to indicate an answer mode suitable for the question information; In the case where the preset information is acquired, determining a target answer mode from a plurality of answer modes based on the preset information; In the case where the preset information is not obtained, a default answer mode among the multiple answer modes is used as the target answer mode.
3. The method for obtaining answers to questions according to claim 2, characterized in that: The preset information is label information, and the label information includes an answer mode; In the case where the preset information is obtained, determining a target answer mode from a plurality of answer modes based on the preset information includes: When the label information is obtained, determining the answer mode contained in the label information; The answer pattern included in the label information is determined as the target answer pattern.
4. The method for obtaining answers to questions according to claim 2, characterized in that: The preset information is intention information; In the case where the preset information is obtained, determining a target answer mode from a plurality of answer modes based on the preset information includes: When the intent information is obtained, a target intent matching the intent information is determined from a plurality of candidate intents, wherein each candidate intent corresponds to an answer mode; The answer mode corresponding to the target intention is determined as the target answer mode.
5. The method for obtaining an answer to a question according to any one of claims 2 to 4, characterized in that: The multiple answer modes include a knowledge graph retrieval mode; In the case where the target answer mode is the knowledge graph retrieval mode, the step of using the target answer mode to obtain an answer to the question information includes: Determining a search type corresponding to the question information based on the preset information, and extracting slot information from the question information based on the search type; Filling the slot information into the query statement template corresponding to the search type to obtain a target query statement; The answer to the target query statement is obtained according to the knowledge graph retrieval mode, and the answer to the target query statement is used as the answer to the question information.
6. The method for obtaining answers to questions according to claim 5, characterized in that: The preset information is label information or intention information; In the case where the preset information is label information, a search type in the knowledge graph search mode contained in the label information is used as the search type corresponding to the question information; In the case where the preset information is intent information, a retrieval type in the knowledge graph retrieval mode corresponding to the target intent matching the intent information is used as the retrieval type corresponding to the question information.
7. The method for obtaining answers to questions according to claim 5, characterized in that: The preset information is label information or intention information; In the case where the preset information is label information, a standard question in the question-answer pair matching mode contained in the label information is used as the standard question corresponding to the question information; In the case where the preset information is intent information, a standard question in the question-answer pair matching mode corresponding to the target intent matching the intent information is used as the standard question corresponding to the question information.
8. A device for obtaining an answer to a question, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to execute the method for obtaining an answer to a question as claimed in any one of claims 1 to 7 when running the program instructions.
9. An electrical device, characterized in that: include: Equipment body; The device for obtaining answers to questions as described in claim 8 is installed in the device body.
10. A storage medium storing program instructions, characterized in that: When the program instructions are executed, the method for obtaining an answer to a question as claimed in any one of claims 1 to 7 is executed.