Question answering method, question answering system and storage medium

By retrieving the target segment data in the preset vector database and calling process planning commands, the problem of low answering capabilities of the conventional question-and-answer system is solved, and transparent visualization of the question-and-answer processing process and improvement of answering capabilities is achieved.

CN119415639AActive Publication Date: 2025-02-11JIHUA LAB +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411575632.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-11
Estimated Expiration
2044-11-06

AI Technical Summary

Technical Problem

When a conventional question-answer system processes multi-source heterogeneous question-and-answer questions, it is difficult to output a clear and visual question-and-answer process flow and answers that are highly correlated with the question-and-answer questions, resulting in low answering ability.

Method used

Search the target segment data of the question to be answered in the preset vector database, and call the process planning command corresponding to the question to be answered and/or the target segment data to be answered, and select the process planning from the preset tool module for executing process planning The command execution submodule. This method improves the answering ability of the answering system through transparent visualization of the question-and-answer process.

Benefits of technology

It realizes transparent visualization of the Q&A processing process, improves the answering ability of the answer system, ensures that the output target answer has a high correlation with the question sentence to be answered, and avoids questions with low answer efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415639A_ABST
    Figure CN119415639A_ABST
Patent Text Reader

Abstract

The invention discloses a question and answer method, a question and answer system and a storage medium, and relates to the technical field of intelligent question and answer, and the question and answer method comprises the following steps: searching in a preset vector database to obtain target text segment data of a to-be-answered question; a process planning command corresponding to the question to be answered and / or the target text segment data is called, an execution sub-module used for executing the process planning command is selected from a preset tool module, the preset tool module comprises a plurality of execution sub-modules, and one execution sub-module corresponds to one process planning command; and inputting the to-be-answered question and / or each target text segment data into the corresponding execution sub-module, and outputting the target answer, thereby solving the technical problems that a conventional question answering system is difficult to realize transparent traceability of a question answering processing flow and is difficult to output an answer having strong relevance with the to-be-answered question, and improving the answering capability of the answering system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent question-answering technology, and in particular to a question-answering method, a question-answering system, and a storage medium. Background Art

[0002] In order to enable the large language model to perform intelligent question and answer operations in specific fields, a question and answer system (RAG) based on retrieval enhanced generation was developed. In this question and answer system, local data can be converted into data vectors to form a local vector library. When a user queries, the question is converted into a question vector, and the cosine similarity between the data vector and the question vector is calculated. The local data corresponding to the data vector with the highest similarity is the relevant text of the question. The question and the relevant text are input into the large language model, which summarizes the information and generates a suitable answer.

[0003] However, due to the diversity of natural languages ​​and the complexity of the working principles of conventional question-answering systems, conventional question-answering systems can only output a single answer, but cannot output a clear and visual question-answering processing flow and answers that are strongly correlated with the questions to be answered based on multi-source heterogeneous questions to be answered. Summary of the invention

[0004] The main purpose of this application is to provide a question-answering method, a question-answering system and a storage medium, aiming to solve the technical problem of low answering ability of conventional question-answering systems.

[0005] To achieve the above purpose, this application proposes a question-answering method, which includes: Retrieving the target text segment data of the question to be answered in the preset vector database; Calling a process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from a preset tool module, wherein the preset tool module includes a plurality of execution submodules, and one execution submodule corresponds to one process planning command; The question to be answered and / or each target text segment data are input into the corresponding execution submodule, and the target answer is output, wherein the target answer is used to answer the question to be answered and / or the target text segment data.

[0006] In one embodiment, the preset vector database includes a plurality of text segment data, and the step of retrieving the target text segment data of the question to be answered from the preset vector database includes: By calculating the probability values ​​of the question to be answered and the data of each paragraph, multiple probability values ​​are obtained; In the case where the probability value is cosine similarity, the text segment data to which the cosine similarity greater than the preset cosine similarity belongs is determined as the target text segment data; or, In the case where the probability value is a probability value to be verified, the probability values ​​to be verified are sequentially superimposed in the output order, and it is determined whether the superimposed probability value after each superposition is greater than a preset given probability value; If it is determined that the superposition probability value after any superposition is greater than the preset given probability value, the text segment data to which the several probability values ​​to be verified included in the superposition probability value greater than the preset given probability value belong are determined as the target text segment data.

[0007] In one embodiment, the cosine similarity is calculated in a text matching model, and the text matching model includes a question calculation module and a text segment calculation module; The steps of calculating the probability value of the question to be answered and each paragraph data include: Inputting the question to be answered into the question calculation module, outputting the question feature vector and several question part vectors, and inputting the text data into the text calculation module, outputting the text feature vector and several text part vectors; Inputting a plurality of question part vectors into a first convolutional neural network module to output a low-dimensional question vector, and inputting a plurality of text part vectors into a second convolutional neural network module to output a low-dimensional text vector; Performing a pooling operation on the low-dimensional question vector and the question feature vector to output the question vector, and performing a pooling operation on the low-dimensional text vector and the text feature vector to output the text data vector; Calculate the cosine similarity between the question vector and the text data vector.

[0008] In one embodiment, the step of calling a process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from a preset tool module includes: In the case where the target text segment data is table data, calling a first process planning command for filtering question and answer information associated with the question to be answered from the table data; A table analysis submodule for executing the first process planning command is selected from the preset tool module, wherein the table analysis submodule is an execution submodule.

[0009] In one embodiment, the step of calling a process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from a preset tool module includes: In the case where the question to be answered includes a query instruction and / or the target text segment data is query data, calling a second process planning command for executing a query task according to the query instruction and / or the query data; A search engine calling submodule for executing the second process planning command is selected from the preset tool module, wherein the search engine calling submodule is an execution submodule.

[0010] In one embodiment, the step of calling a process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from a preset tool module includes: In the case where the target text segment data is program data, calling a third process planning command for generating an execution program according to the question to be answered and the program data, and calling a fourth process planning command for running the execution program; A program generation submodule for executing the third process planning command and a program running submodule for executing the fourth process planning command are selected from the preset tool module, wherein the program generation submodule and the program running submodule are respectively an execution submodule.

[0011] In one embodiment, the step of inputting the question to be answered and / or each target text segment data into the corresponding execution submodule and outputting the target answer includes: Input the question to be answered and / or each target text segment data into the corresponding execution submodule to obtain the execution result; If the execution result includes table data, query data and / or program data, then calling the process planning command corresponding to the question to be answered and the execution result, and executing the step of selecting an execution submodule for executing the process planning command from the preset tool module; If the execution result is answer data associated with the question to be answered, a target answer is generated and output based on the question to be answered, the target text data and the answer data.

[0012] In one embodiment, after the step of outputting the target answer, the method further includes: Receive decision instructions returned based on the target answer; Based on the decision instructions, generate and execute decision commands.

[0013] In addition, to achieve the above-mentioned purpose, the present application also proposes a question-answering system, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the question-answering method as described above.

[0014] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the question-and-answer method as described above are implemented.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: A question-answering method is proposed, which includes: after retrieving target text segment data of a question to be answered in a preset vector database, by calling a process planning command corresponding to the question to be answered and / or the target text segment data, selecting an execution submodule for executing the process planning command from a preset tool module, so that a user can understand the question-answering processing flow based on the corresponding process planning command and the execution submodule, and realize transparent visualization of the question-answering processing flow; finally, the question to be answered and / or each target text segment data are input into the corresponding execution submodule, so that the user can understand the processing method of the question-answering processing flow according to the corresponding execution submodule, and further improve the transparency of the question-answering processing flow. Visualization, and at the same time, the corresponding question to be answered and / or target text data are processed by the corresponding execution sub-module, so as to avoid the situation that the output efficiency and accuracy of the target answer are low due to the large amount of processing and complexity of processing different question to be answered and / or target text data based on one execution module, and the execution result matching the question to be answered and / or target text data is output according to the corresponding execution module, so as to achieve the execution result with strong correlation with the question to be answered and / or target text data based on the corresponding execution module, avoid the defect of low answering efficiency caused by the low correlation between the output target answer and the question to be answered, and improve the answering ability of the answering system. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1 A flowchart diagram of the first embodiment of the question-and-answer method of this application; Figure 2 A schematic diagram of a retrieval enhancement generation process for enhancing the relevance between the question to be answered and the answer for this application; Figure 3 This is a schematic diagram of the structural modules of the question-answering system for this application; Figure 4 A flowchart diagram of the second embodiment of the question-and-answer method of this application; Figure 5 A schematic diagram of mapping question vectors and text data vectors in vector space; Figure 6 This is a schematic diagram of a conventional text matching model; Figure 7 This is a schematic diagram of the improved text matching model for this application; Figure 8 A brief flowchart of the question-answering method provided for this application; Fig. 9 A schematic diagram of the device structure of the hardware operating environment involved in the question-and-answer method in the embodiment of the present application.

[0019] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0020] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0021] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0022] The main solution of the embodiment of the present application is: to obtain the target text data of the question to be answered by retrieving it in a preset vector database; to call the process planning command corresponding to the question to be answered and / or the target text data, and select an execution submodule for executing the process planning command from the preset tool module, wherein the preset tool module includes multiple execution submodules, and one execution submodule corresponds to one process planning command; to input the question to be answered and / or each target text data into the corresponding execution submodule, and output the target answer, wherein the target answer is used to answer the question to be answered and / or the target text data.

[0023] Due to the diversity of natural languages ​​and the complexity of the working principles of conventional question-answering systems, conventional question-answering systems can only output a single answer, and it is usually difficult to output a clear and visual question-answering processing flow based on multi-source heterogeneous questions to be answered.

[0024] The present application provides a solution, which enables users to understand the question and answer processing flow based on the corresponding process planning commands and execution sub-modules, and realize transparent visualization of the question and answer processing flow. At the same time, users can understand the processing method of the question and answer processing flow according to the corresponding execution sub-module, further improving the transparent visualization of the question and answer processing flow, and can also output the execution result that matches the question to be answered and / or the target text data according to the corresponding execution module, so as to realize that the execution result with a strong correlation with the question to be answered and / or the target text data can be obtained based on the corresponding execution module, thereby avoiding the defect of low answering efficiency caused by the low correlation between the output target answer and the question to be answered, and improving the answering ability of the answering system.

[0025] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a question-and-answer system, etc. The following takes the question-and-answer system as an example to illustrate this embodiment and the following embodiments.

[0026] Based on this, the embodiment of the present application provides a question-answering method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the question-and-answer method of this application.

[0027] In this embodiment, the question-answering method includes steps S10 to S30: Step S10, retrieving the target text segment data of the question to be answered from the preset vector database.

[0028] When answering untrained questions, existing generative large language modules often give fictitious and fabricated answers, which are usually not suitable as answers to untrained questions. Therefore, based on this situation, this embodiment proposes the following Figure 2 The retrieval enhancement generation process technology shown in the figure for enhancing the relevance between the question to be answered and the answer is as follows: First, local documents are input into the knowledge base retrieval module (i.e. Figure 2 In the unstructured loader of 10), after obtaining multiple texts to be processed, the multiple texts to be processed are respectively segmented to obtain multiple text segments, and the multiple text segments are embedded into corresponding text segment data vectors and stored in a preset vector database. At the same time, according to the unanswered question in the query instruction input by the user into the knowledge base retrieval module, the unanswered question is embedded into the corresponding question vector, and then the question vector is retrieved in the preset vector data, and the cosine similarity between each text segment data vector and the question vector is calculated. A number of text segment data vectors with high cosine similarity are selected, and the target text segment data corresponding to the selected text segment data vectors are output. After extracting the corresponding prompt module based on the target text segment data, the target text segment data is formatted according to the prompt module and the prompt is output as follows. Figure 3 The large language model shown (i.e. Figure 3 In 20), the prompt is the target text segment data.

[0029] That is, by retrieving target text data with higher cosine similarity with the question to be answered in the preset vector database, the accuracy and effectiveness of the target answer output by the large language model based on the question to be answered and the target text data can be improved, thereby avoiding the situation where the accuracy and effectiveness of the output target answer are too low due to the lack of representativeness and high limitations of a single question to be answered.

[0030] It should be noted that step S10 Figure 3 It is implemented in the knowledge base retrieval module. After the user inputs a question to be answered in the user interface module, the question to be answered is passed to the knowledge base retrieval module to retrieve the corresponding target text segment data, and the retrieved target text segment data is transmitted to the process planning module in the large language model to execute step S20.

[0031] Step S20, calling the process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from the preset tool module, wherein the preset tool module includes multiple execution submodules, and one execution submodule corresponds to one process planning command.

[0032] It should be noted that the target text segment data in this embodiment may be a question similar to the question to be answered, text data, table data, etc. that can answer the question to be answered.

[0033] After the questions to be answered and the retrieved target text data are input into the process planning module, the process planning module calls and executes the process planning commands of the questions to be answered and the target text data according to the received questions to be answered and the target text data, and implements the corresponding process planning commands based on the questions to be answered and the target text data, so that the user can trace the question and answer processing flow according to the process planning commands, and solves the defect of opaque question and answer processing flow due to direct output of answers based on the questions to be answered and the target text data.

[0034] After planning and calling the corresponding process planning command, the execution sub-module that executes the corresponding process planning command is selected in the preset tool module based on the process planning command, so as to avoid the problem of low processing efficiency caused by the large amount of processing and complexity caused by directly processing different process planning commands by one execution module. At the same time, the execution sub-modules corresponding to different process planning commands can make the processing method of the question and answer processing flow transparent, and further enhance the visualization of the question and answer processing flow.

[0035] In a first feasible implementation manner, step S20 may include steps S21-S22: Step S21 : when the target text segment data is table data, calling a first process planning command for filtering question and answer information associated with the question to be answered from the table data.

[0036] Step S22: Selecting a table analysis submodule for executing the first process planning command from the preset tool module, wherein the table analysis submodule is an execution submodule.

[0037] See also Figure 3 It can be seen that the preset tool module (i.e. Figure 330) includes a table analysis submodule, which is used to analyze the table data and extract question-answering information that can answer the question to be answered from the table data.

[0038] Therefore, when there is table data in the retrieved target text segment data, the process planning module will call the first process planning command based on the table data, so that the user can know from the first process planning command that there is a processing flow in the question and answer processing flow for filtering question and answer information associated with the question to be answered from the table data. At the same time, according to the called table analysis submodule, the user can know the specific analysis and filtering process of the table data.

[0039] Assuming that the user inputs a question to be answered on the user interface module about the usage of raw material b in table a in recent months, the knowledge base retrieval module will retrieve the relevant table data (i.e., target text data) from the preset vector database after accessing the question to be answered, and call the first process planning command through the process planning module, input the first process planning command, the table data and the question to be answered into the preset tool module, and select the table analysis submodule from the preset tool module to filter out question and answer information from the table data for answering the usage of raw material b in recent months.

[0040] Because the table analysis submodule is only used to filter the question and answer information associated with the question to be answered from the accessed table data, and is not used to perform other question and answer processing, it can ensure its answer effect and thus ensure the accuracy of the target answer output subsequently.

[0041] In a second feasible implementation manner, step S20 may include steps S23-S24: Step S23, when the question to be answered includes a query instruction and / or the target text segment data is query data, calling a second process planning command for executing a query task according to the query instruction and / or query data.

[0042] Step S24, selecting a search engine calling submodule for executing the second process planning command from the preset tool module, wherein the search engine calling submodule is an execution submodule.

[0043] See also Figure 3 It can be seen that the preset tool module in this embodiment includes a search engine calling submodule, which is used to call the search engine interface to obtain question and answer information associated with the question to be answered and / or the target text segment data through the search engine interface.

[0044] Therefore, when it is determined that the question to be answered includes a query instruction and / or the query data exists in the retrieved target text segment data, the process planning module will call the second process planning command based on the query data, so that the user can know from the second process planning command that there is a processing flow in the question and answer processing flow that requires calling the search engine calling sub-module to obtain question and answer information. At the same time, according to the called search engine calling sub-module, the specific process of obtaining question and answer information based on the query data can be known.

[0045] Among them, the query data is determined by the large language model. The large language module will identify the unanswered questions entered by the user on the user interface and the target text data output by the knowledge base retrieval module. When the unanswered questions are identified as questions that need to be timely, or the target text data cannot accurately return to the unanswered questions, the second process planning command will be called to obtain accurate question and answer information.

[0046] Suppose that the user inputs a question on the user interface module asking about the time and location of a certain ceramic exhibition. Because the time and location of the exhibition are artificially set at a certain point in time, the text data stored in the preset vector database are all local data and do not have the conditions for real-time updating of the text data. Therefore, when the knowledge base retrieval module accesses the question to be answered, it can only retrieve query data about the exhibition similar to the question to be answered (i.e., target text data) in the preset vector database, and call the second process planning command through the process planning module, input the second process planning command and the query data into the preset tool module, and select the search engine calling submodule from the preset tool module to call the search engine interface based on the query data to query the time and location of a certain ceramic exhibition.

[0047] Because the search engine calling submodule is only used to call the search engine interface to execute query tasks based on query data, and is not used to perform other question and answer processing, and the search engine calling submodule can ensure the timeliness of question and answer information, so it can ensure the effect of the answer, and then ensure the accuracy of the target answer output later.

[0048] It should be noted that the user may also directly input the question to be answered on the user interface and simultaneously select to use the search engine submodule, and the question to be answered will include a query instruction.

[0049] In a third feasible implementation manner, step S20 may include steps S25-S26: Step S25, when the target text segment data is program data, calling a third process planning command for generating an execution program according to the question to be answered and the program data, and calling a fourth process planning command for running the execution program.

[0050] Step S26, selecting a program generation submodule for executing the third process planning command and a program running submodule for executing the fourth process planning command from the preset tool module, wherein the program generation submodule and the program running submodule are each an execution submodule.

[0051] See also Figure 3 It can be seen that the preset tool module in this embodiment includes a program generation submodule and a program running submodule. The program generation submodule is used to generate an execution program associated with program data, and the program running submodule is used to run the generated execution program.

[0052] Therefore, when there is program data in the retrieved target text segment data, the process planning module will call the third process planning command and the fourth process planning command based on the program data, so that the user can know from the third process planning command and the fourth process planning command that there is a processing flow in the question and answer processing flow that needs to obtain question and answer information through program running. At the same time, according to the called program generation submodule and program running submodule, the specific information of the generated execution program and the specific information when the execution program is running can be known, so as to obtain the specific process of obtaining question and answer information.

[0053] Assuming that the user inputs a question on the user interface module about how to solve a C fault that occurs on a production line, the knowledge base retrieval module, after accessing the question, will retrieve the program data (i.e., target text segment data) for solving the C fault on the production line from the preset vector database, and call the third process planning command and the fourth process planning command through the process planning module, input the third process planning command, the fourth process planning command, the program data and the question to be answered into the preset tool module, select a program generation submodule from the preset tool module to generate a corresponding execution program based on the program data and the question to be answered, and call the program execution submodule to run the execution program to obtain system instructions that can solve the C fault on the production line.

[0054] Because the program generation submodule is used to generate the execution program, and the program running submodule is only used to run the generated execution program, and not for performing other question and answer processing, its answer effect can be guaranteed, and thus the accuracy of the target answer output later can be guaranteed.

[0055] in, Figure 3 The process planning module, table analysis submodule, program generation submodule, answer generation module, and decision plan generation module are implemented by the large language model playing different roles according to specific prompt commands; the search engine call submodule is implemented by calling the search engine interface; the program execution submodule executes the program through the Python program.

[0056] It should be noted that the first feasible implementation method to the third feasible implementation method are selected and implemented in combination according to the actual question and answer situation, that is, if the target text data includes table data and program data, the first feasible implementation method and the third feasible implementation method are executed; if the target text data includes table data and query data, the first feasible implementation method and the second feasible implementation method are executed, etc.

[0057] Step S30, inputting the question to be answered and / or each target text segment data into the corresponding execution submodule, and outputting the target answer, wherein the target answer is used to answer the question to be answered and / or the target text segment data.

[0058] After calling the corresponding execution submodule, the corresponding question to be answered and / or target text data is directly input into the execution submodule to output the question and answer information, and finally the target answer is output according to the question and answer information output by the execution submodule.

[0059] Because an execution sub-module is only used to execute its specific question and answer processing flow, by dividing a single execution module originally used to execute multiple question and answer processing flows, it avoids the situation where a single execution module is assigned to multiple question and answer processing flows at one time, which causes a large and complex amount of question and answer processing and poor question and answer results.

[0060] In a feasible implementation, step S30 may include steps S31 to S33: Step S31, inputting the question to be answered and / or each target text segment data into the corresponding execution submodule to obtain the execution result.

[0061] Step S32, if the execution result includes table data, query data and / or program data, then call the process planning command corresponding to the question to be answered and the execution result, and execute the step of selecting an execution submodule for executing the process planning command from the preset tool module.

[0062] Assuming that the question to be answered is how to solve the problem when the system receives an abnormal signal from the production line, and the data retrieved through the knowledge base retrieval module is table data, then the question to be answered and the table data are input into the corresponding table analysis submodule, and the execution result obtained is the relevant program data recorded in the table data for solving the problem of the system receiving the abnormal signal from the production line. At this time, the third process planning command and the fourth process planning command corresponding to the program data and the question to be answered are directly called, and the steps of selecting the program generation submodule and the program execution submodule from the preset tool module are executed, and the cycle is repeated until the execution result obtained is the answer data that can answer the question to be answered.

[0063] Step S33: if the execution result is answer data associated with the question to be answered, a target answer is generated and output according to the question to be answered, the target text data and the answer data.

[0064] Assuming that the question to be answered is the exhibit information of a certain ceramic exhibition and includes query data, after the relevant exhibit information (i.e., target text data) is retrieved through the knowledge base retrieval module, the query data included in the question to be answered is input into the search engine calling submodule, and the corresponding search engine interface is called through the search engine calling submodule to query the exhibit information of a certain ceramic exhibition, so as to ensure the comprehensiveness of the output exhibit information. At this time, the exhibit information output after the search engine calling submodule is run can be used to answer the question to be answered (i.e., the answer data associated with the question to be answered). At this time, the question to be answered, the relevant exhibit information retrieved through the knowledge base retrieval module, and the exhibit information output after the search engine calling submodule is run are input into Figure 3 In the answer generation module shown, a target answer for answering the question to be answered is generated and output.

[0065] Each time an execution submodule is called, the execution result corresponding to the execution submodule will be output. Based on the execution result, the generation process of the target answer can be visualized.

[0066] In a feasible implementation manner, steps S41-S42 may be included after step S30: Step S41, receiving a decision instruction returned according to the target answer.

[0067] Step S42, generating and executing a decision command based on the decision instruction.

[0068] In passing Figure 3 After the answer generation module shown generates the target answer, it will output the target answer to the decision solution generation module, and the decision solution generation module will display the target answer to the user for viewing, and the user will make relevant decisions based on the displayed target answer.

[0069] Assume that the system instruction displayed on the decision-making plan generation module is for solving the c fault on a certain production line. The user can decide whether to run the system instruction; if the decision is to run, the decision instruction for running the system instruction is returned, so that the question and answer system can generate and execute a decision command for solving the c fault on the production line based on the returned decision instruction, and make control adjustments to the production line; if the decision is not to run, the decision instruction for not running the system instruction is returned, so that the question and answer system can generate and run a decision command for not executing the system instruction based on the returned decision instruction.

[0070] In this embodiment, after the target text segment data of the question to be answered is retrieved from the preset vector database, the process planning command corresponding to the question to be answered and / or the target text segment data is called, and the execution submodule for executing the process planning command is selected from the preset tool module, so that the user can understand the question and answer processing flow based on the corresponding process planning command and the execution submodule, and realize the transparent visualization of the question and answer processing flow. Finally, the question to be answered and / or each target text segment data is input into the corresponding execution submodule, so that the user can understand the processing method of the question and answer processing flow according to the corresponding execution submodule, and further improve the transparent visualization of the question and answer processing flow. At the same time, the corresponding question to be answered and / or target text data are processed by the corresponding execution sub-module, so as to avoid the situation where the processing volume is large and complicated based on one execution module to process different question to be answered and / or target text data, resulting in low output efficiency and accuracy of the target answer. According to the execution result matched with the question to be answered and / or the target text data output by the corresponding execution module, it is achieved that the execution result with a strong correlation with the question to be answered and / or the target text data can be obtained based on the corresponding execution module, thereby avoiding the defect of low answering efficiency caused by the low correlation between the output target answer and the question to be answered, and improving the answering ability of the answering system.

[0071] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 4 In step S10, the question-answering method further includes steps S11-S12: Step S11, a plurality of probability values ​​are obtained by calculating the probability values ​​of the question to be answered and each text segment data.

[0072] Specifically, in order to improve the accuracy and effectiveness of the target answer output by the large language model based on the question to be answered and the target text data, the present embodiment proposes to calculate the probability value of the similarity between the question to be answered and each text data included in the preset vector database, so as to judge the similarity between the question to be answered and the corresponding text data through the probability value, and judge whether the text data can be used as the target text data of the question to be answered, so as to ensure the accuracy of the output target answer.

[0073] Step S12: when the probability value is cosine similarity, the text segment data to which the cosine similarity greater than the preset cosine similarity belongs is determined as the target text segment data.

[0074] When the cosine similarities between the question to be answered and each text segment data are calculated and multiple preset similarities are obtained, it is determined whether each cosine similarity is greater than the preset cosine similarity.

[0075] It should be noted that the preset cosine similarity is set based on the actual similarity judgment requirements and can be selected between [0, 1]. The closer the cosine similarity is to 0, the lower the similarity is, and the closer the cosine similarity is to 1, the higher the similarity is.

[0076] The cosine similarities calculated in step S11 are judged according to the preset cosine similarity, and the text data to which the cosine similarity greater than the preset cosine similarity belongs is selected, indicating that the text data can correspond to the question to be answered, and the text data is determined as the target text data.

[0077] Step S13, when the probability value is a probability value to be verified, the probability values ​​to be verified are sequentially superimposed in the output order, and it is determined whether the superimposed probability value after each superposition is greater than a preset given probability value.

[0078] When a plurality of probability values ​​to be verified are obtained by calculating the probability values ​​to be verified between the question to be answered and each text segment data, it is determined whether the superimposed probability value outputted each time is greater than a preset given probability value when the probability values ​​to be verified are superimposed in the output order.

[0079] For example, the probability value to be verified between the question to be answered and the a text data is 0.25, the probability value to be verified between the question to be answered and the b text data is 0.20, the probability value to be verified between the question to be answered and the c text data is 0.15, the probability value to be verified between the question to be answered and the d text data is 0.1, the probability value to be verified between the question to be answered and the e text data is 0.07, the probability value to be verified between the question to be answered and the f text data is 0.06, the probability value to be verified between the question to be answered and the g text data is 0.05, and the probability value to be verified between the question to be answered and the h text data is 0.04. At this time, it is judged whether the superimposed probability value of the a text data + the b text data is greater than the preset given probability value. If it is less than, then it is judged whether the superimposed probability value of the a text data + the b text data + the c text data is greater than the preset given probability value. If it is less than, then after superimposing the next text data, it is judged whether the next superimposed probability value is greater than the preset given probability value, and so on, until a superimposed probability value greater than or equal to the preset given probability value is obtained.

[0080] Step S14: if it is determined that the superposition probability value after any superposition is greater than the preset given probability value, the text segment data to which the several probability values ​​to be verified included in the superposition probability value greater than the preset given probability value belong are determined as the target text segment data.

[0081] Assuming that the preset given probability value is 0.8, according to the superposition calculation, when a segment data + b segment data + c segment data + d segment data + e segment data + f segment data obtains a superposition probability value of 0.83, it can be determined that the superposition probability value is greater than the preset given probability value. At this time, a segment data, b segment data, c segment data, d segment data, e segment data and f segment data are determined as target segment data, or any segment data are selected from a segment data, b segment data, c segment data, d segment data, e segment data and f segment data to be determined as target segment data.

[0082] In a feasible implementation, step S11 includes steps S15 to S18: Step S15, input the question to be answered into the question calculation module, output the question feature vector and several question part vectors, and input the text data into the text calculation module, output the text feature vector and several text part vectors.

[0083] Step S16, inputting several question part vectors into the first convolutional neural network module, outputting low-dimensional question vectors, and inputting several text part vectors into the second convolutional neural network module, outputting low-dimensional text vectors.

[0084] Step S17, performing a pooling operation on the low-dimensional question vector and the question feature vector to output the question vector, and performing a pooling operation on the low-dimensional text vector and the text feature vector to output the text data vector.

[0085] Step S18, calculating the cosine similarity between the question vector and the text data vector.

[0086] The cosine similarity in this embodiment is used to measure the similarity between the question vector of the question to be answered and the text data vector of the text data. When mapped to the vector space, the closer they are in the vector space, the higher the cosine similarity.

[0087] like Figure 5 As shown, in the vector space, the first question vector IS1 is respectively close to the first paragraph data vector text1, the sixth paragraph data vector text6, the seventh paragraph data vector text7, the twelfth paragraph data vector text12 and the sixteenth paragraph data vector text16. Therefore, it can be obtained that the cosine similarity of the first question vector IS1 and the first paragraph data vector text1, the sixth paragraph data vector text6, the seventh paragraph data vector text7, the twelfth paragraph data vector text12 and the sixteenth paragraph data vector text16 is respectively high.

[0088] In the vector space, the second question vector IS2 is respectively close to the third paragraph data vector text3, the fourth paragraph data vector text4, the ninth paragraph data vector text9, the eighteenth paragraph data vector text18, the twentieth paragraph data vector text20 and the twenty-first paragraph data vector text21. Therefore, it can be obtained that the second question vector IS2 has a high cosine similarity with the third paragraph data vector text3, the fourth paragraph data vector text4, the ninth paragraph data vector text9, the eighteenth paragraph data vector text18, the twentieth paragraph data vector text20 and the twenty-first paragraph data vector text21.

[0089] In order to further improve the accuracy of cosine similarity judgment and further improve the accuracy of the output target answer, this embodiment proposes the following Figure 6 The improved model of the text matching model shown in Figure 7 is a regular text matching model diagram. Among them, Figure 6 The text matching model shown and Figure 7 The conventional text matching models shown are all double-tower structures.

[0090] First Figure 7 The conventional text matching model shown is illustrated. After the question to be answered and the text data are respectively input into the question calculation module and the text calculation module, the question feature vector and several question partial vectors corresponding to the question to be answered, as well as the text feature vector and several text partial vectors corresponding to the text data are output. In the conventional text matching model, only the question feature vector and the text feature vector are pooled and then the cosine similarity is calculated, and the question partial vector and the text partial vector are discarded. Although this operation can speed up the running speed of the text matching model, this embodiment is an asymmetric text matching, and this operation is bound to lose some matching information, resulting in a deviation in the calculated cosine similarity.

[0091] Therefore, in order to improve the accuracy of cosine similarity while avoiding the slowdown of the text matching model caused by the increase in calculation amount, this embodiment proposes to add a convolutional neural network module to the text matching model. Specifically, after the question to be answered and the text segment data are respectively input into the question calculation module and the text segment calculation module, the question feature vector and several question part vectors corresponding to the question to be answered are output, and the text segment feature vector and several text segment part vectors corresponding to the text segment data are output. At this time, the question part vector is input into the first convolutional neural network module (i.e. Figure 7 CNN1 in ), outputs a low-dimensional question vector, and inputs the text segment vector into the second convolutional neural network module (i.e. Figure 7In CNN2 in , a low-dimensional text vector is output, and then the low-dimensional question vector and the question feature vector are pooled to output the question vector, and the low-dimensional text vector and the text feature vector are pooled to output the text data vector, and then the cosine similarity between the question vector and the text data vector is calculated.

[0092] That is, by adding a convolutional neural network module, not only the question part vector and the text part vector are fully utilized, but also more information is retained when vectorizing the question and text data to be answered, thereby improving the accuracy of the calculated cosine similarity, ensuring the retrieval accuracy, and further ensuring the accuracy of the output target answer.

[0093] At the same time, based on the characteristics of the convolutional neural network module, the high-dimensional question vector and text vector are compressed to output low-dimensional question vector and low-dimensional text vector, which reduces the vector calculation amount of the text matching model and avoids the slowdown of the running speed of the text matching model.

[0094] In this embodiment, by calculating the probability values ​​of the question to be answered and each text data, a plurality of probability values ​​are obtained. When the probability value is the cosine similarity, the text data to which the cosine similarity greater than the preset cosine similarity belongs is determined as the target text data; when the probability value is the probability value to be verified, the probability values ​​to be verified are superimposed in sequence according to the output order, and it is determined whether the superimposed probability value after each superposition is greater than the preset given probability value; if it is determined that the superimposed probability value after any superposition is greater than the preset given probability value, the text data to which the several probability values ​​to be verified included in the superimposed probability value greater than the preset given probability value belong are determined as the target text data, so as to ensure the accuracy of the output target answer.

[0095] For example, to help understand the implementation process of the question-answering method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 8 , Figure 8 A brief flowchart of a question-answering method is provided, specifically: The user enters the question to be answered in the user interface module (i.e. Figure 8 After step S1 in the above, the knowledge base retrieval module retrieves the target text segment data (i.e. Figure 8 In step S2, the process planning module formulates a process planning command (i.e., Figure 8 In step S3, the question-answering system calls the execution submodule (i.e. Figure 8 In step S4 in the above example, the execution submodule solves the question to be answered step by step, and finally the answer generation module summarizes and generates the target answer (i.e. Figure 8After step S5 in the above, the target answer is input into the decision solution generation module, and the user chooses whether to run the decision solution generation module to generate the target answer in a special format (i.e. Figure 8 , step S6 in the above process).

[0096] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the question-and-answer method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0097] The present application provides a question-and-answer system, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the question-and-answer method in the above-mentioned embodiment one.

[0098] Reference below Fig. 9 , which shows a schematic diagram of the structure of the question-answering system suitable for implementing the embodiment of the present application. The question-answering system in the embodiment of the present application may include but is not limited to mobile terminals such as laptop computers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The question-and-answer system shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0099] like Fig. 9As shown, the question-answering system may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the question-answering system are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the question-answering system to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a question-answering system with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0100] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0101] The question-and-answer system provided by the present application adopts the question-and-answer method in the above embodiment, which can solve the technical problem that conventional question-and-answer systems are difficult to achieve transparent and traceable question-and-answer processing procedures. Compared with the prior art, the beneficial effects of the question-and-answer system provided by the present application are the same as the beneficial effects of the question-and-answer method provided by the above embodiment, and other technical features of the question-and-answer system are the same as those disclosed in the method of the previous embodiment, which will not be repeated here.

[0102] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0103] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0104] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the question-answering method in the above-mentioned embodiment.

[0105] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0106] The computer-readable storage medium may be included in the question-answering system; or may exist independently without being incorporated into the question-answering system.

[0107] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the question-answering system, the question-answering system: retrieves the target text segment data of the question to be answered in the preset vector database; calls the process planning command corresponding to the question to be answered and / or the target text segment data, and selects an execution submodule for executing the process planning command from the preset tool module, wherein the preset tool module includes multiple execution submodules, and one execution submodule corresponds to one process planning command; inputs the question to be answered and / or each target text segment data into the corresponding execution submodule, and outputs the target answer.

[0108] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0109] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a 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. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0110] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0111] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned question-and-answer method, and can solve the technical problem that conventional question-and-answer systems are difficult to achieve transparent and traceable question-and-answer processing procedures. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the question-and-answer method provided in the above-mentioned embodiment, and will not be elaborated here.

[0112] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A question-answering method, characterized in that: The question-answering method comprises: Retrieving the target text segment data of the question to be answered in the preset vector database; Calling a process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from a preset tool module, wherein the preset tool module includes a plurality of execution submodules, and one execution submodule corresponds to one process planning command; The question to be answered and / or each target text segment data are input into a corresponding execution submodule, and a target answer is output, wherein the target answer is used to answer the question to be answered and / or the target text segment data.

2. The question-answering method according to claim 1, wherein: The preset vector database includes a plurality of text segment data, and the step of retrieving the target text segment data of the question to be answered from the preset vector database includes: By calculating the probability values ​​of the question to be answered and each of the text segment data, a plurality of probability values ​​are obtained; In the case where the probability value is cosine similarity, the text segment data to which the cosine similarity greater than a preset cosine similarity belongs is determined as the target text segment data; or, In the case where the probability value is a probability value to be verified, the probability values ​​to be verified are sequentially superimposed in the output order, and it is determined whether the superimposed probability value after each superposition is greater than a preset given probability value; If it is determined that the superposition probability value after any superposition is greater than the preset given probability value, the text segment data to which the several probability values ​​to be verified included in the superposition probability value greater than the preset given probability value belong are determined as the target text segment data.

3. The question-answering method according to claim 2, wherein: The cosine similarity is calculated in a text matching model, and the text matching model includes a question calculation module and a text segment calculation module; The step of calculating the probability value of the question to be answered and each of the text segment data comprises: Inputting the question to be answered into the question calculation module, outputting a question feature vector and a plurality of question part vectors, and inputting the text data into the text calculation module, outputting a text feature vector and a plurality of text part vectors; Inputting a plurality of the question part vectors into a first convolutional neural network module to output a low-dimensional question vector, and inputting a plurality of the text part vectors into a second convolutional neural network module to output a low-dimensional text vector; Performing a pooling operation on the low-dimensional question vector and the question feature vector to output a question vector, and performing a pooling operation on the low-dimensional text vector and the text feature vector to output a text data vector; The cosine similarity between the question vector and the text data vector is calculated.

4. The question-answering method according to claim 1, wherein: The step of calling the process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from a preset tool module comprises: In the case where the target text segment data is table data, calling a first process planning command for filtering question and answer information associated with the question to be answered from the table data; A table analysis submodule for executing the first process planning command is selected from the preset tool module, wherein the table analysis submodule is one of the execution submodules.

5. The question-answering method according to claim 1, wherein: The step of calling the process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from a preset tool module comprises: In the case where the question to be answered includes a query instruction and / or the target text segment data is query data, calling a second process planning command for executing a query task according to the query instruction and / or the query data; A search engine calling submodule for executing the second process planning command is selected from the preset tool module, wherein the search engine calling submodule is one of the execution submodules.

6. The question-answering method according to claim 1, wherein: The step of calling the process planning command corresponding to the question to be answered and / or the target text segment data, and selecting an execution submodule for executing the process planning command from a preset tool module comprises: In the case where the target text segment data is program data, calling a third process planning command for generating an execution program according to the question to be answered and the program data, and calling a fourth process planning command for running the execution program; A program generation submodule for executing the third process planning command and a program running submodule for executing the fourth process planning command are selected from the preset tool module, wherein the program generation submodule and the program running submodule are each an execution submodule.

7. The question-answering method according to claim 1, wherein: The step of inputting the question to be answered and / or each target text segment data into the corresponding execution submodule and outputting the target answer comprises: Inputting the question to be answered and / or each target text segment data into the corresponding execution submodule to obtain an execution result; If the execution result includes table data, query data and / or program data, calling the process planning command corresponding to the question to be answered and the execution result, and executing the step of selecting an execution submodule for executing the process planning command from the preset tool module; If the execution result is answer data associated with the question to be answered, the target answer is generated and output according to the question to be answered, the target text data and the answer data.

8. The question-answering method according to claim 1, wherein: After the step of outputting the target answer, the method further comprises: Receiving a decision instruction returned according to the target answer; Based on the decision instruction, a decision command is generated and executed.

9. A question-answering system, characterized in that: The question-answering system comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the question-answering method according to any one of claims 1 to 8.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the question-answering method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • An artificial intelligence teaching assisting sound box based on a classroom teaching scene

    CN109862473A

  • Document question-answering method, document question-answering device and readable storage medium

    CN117668180A