Question answering method, question answering system and storage medium

By retrieving and calling process planning commands in a preset vector database, the problem of insufficient answering ability of conventional question-answering systems is solved, transparent visualization of the question-answering processing flow and strong correlation of answers are achieved, and the answering efficiency and accuracy of the question-answering system are improved.

CN119415639BActive Publication Date: 2025-09-19JIHUA LAB +1
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Conventional question-answering systems cannot effectively handle multi-source and heterogeneous questions to be answered, resulting in low answering capabilities and opaque question-answering processing.

Method used

The target text data is retrieved from the preset vector database, and by calling the process planning command corresponding to the question and text data, the execution sub-module is selected from the preset tool module to output the target answer, thereby achieving transparent visualization of the question-answering processing flow and strong correlation of the answers.

Benefits of technology

It improves the answering ability of the question-answering system, ensures the relevance of answers to questions, and improves the transparency and efficiency of the question-answering process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415639B_ABST
    Figure CN119415639B_ABST
Patent Text Reader

Abstract

The present application discloses a question-answering method, a question-answering system, and a storage medium, and relates to the field of intelligent question-answering technology. The question-answering method comprises: retrieving target text data of a question to be answered from a preset vector database; calling a process planning command corresponding to the question to be answered and / or the target text data, and selecting an execution submodule for executing the process planning command from a preset tool module, wherein the preset tool module includes multiple execution submodules, and one execution submodule corresponds to one process planning command; inputting the question to be answered and / or each target text data into the corresponding execution submodule, and outputting a target answer, thereby solving the technical problems that conventional question-answering systems find it difficult to achieve transparent traceability of the question-answering processing flow and to output an answer that is strongly correlated with the question to be answered, and improving the answering ability 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] To enable the large language model to perform intelligent question-answering in specific fields, a question-answering system (RAG) based on retrieval-augmented generation was developed. In this 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 relevant text are then input into the large language model, which summarizes the information and generates an appropriate 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 objectives, this application proposes a question-answering method, which includes:

[0006] Retrieve target text segment data of the question to be answered from a preset vector database;

[0007] Invoking 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 multiple execution submodules, and each execution submodule corresponds to one process planning command;

[0008] 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.

[0009] 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:

[0010] By calculating the probability values ​​of the question to be answered and the data of each paragraph, multiple probability values ​​are obtained;

[0011] In the case where the probability value is cosine similarity, the text segment data having a cosine similarity greater than a preset cosine similarity is determined as the target text segment data; or,

[0012] 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;

[0013] 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.

[0014] In one embodiment, the cosine similarity is calculated in a text matching model, which includes a question calculation module and a text segment calculation module;

[0015] The steps for calculating the probability value of the question to be answered and the data of each paragraph include:

[0016] Inputting a question to be answered into a question calculation module, outputting a question feature vector and several question part vectors, and inputting text data into a text calculation module, outputting a text feature vector and several text part vectors;

[0017] Inputting several question part vectors into a first convolutional neural network module to output a low-dimensional question vector, and inputting several text part vectors into a second convolutional neural network module to output a low-dimensional text vector;

[0018] 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;

[0019] Calculate the cosine similarity between the question vector and the paragraph data vector.

[0020] In one embodiment, the steps 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 include:

[0021] In the case where the target text segment data is table data, calling a first process planning command for filtering question-answer information associated with the question to be answered from the table data;

[0022] 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.

[0023] In one embodiment, the steps 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 include:

[0024] 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;

[0025] 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.

[0026] In one embodiment, the steps 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 include:

[0027] In the case where the target text segment data is program data, calling a third process planning command for generating an execution program based on the question to be answered and the program data, and calling a fourth process planning command for running the execution program;

[0028] 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.

[0029] 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:

[0030] Input the question to be answered and / or each target text segment data into the corresponding execution submodule to obtain the execution result;

[0031] If the execution result includes table data, query data and / or program data, calling a 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 a preset tool module;

[0032] 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.

[0033] In one embodiment, after the step of outputting the target answer, the method further includes:

[0034] Receive decision instructions returned based on the target answer;

[0035] Generate and execute decision commands based on decision instructions.

[0036] 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.

[0037] 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, and when the computer program is executed by the processor, the steps of the question-and-answer method as described above are implemented.

[0038] One or more technical solutions proposed in this application have at least the following technical effects:

[0039] A question-answering method is proposed, which includes: after retrieving target text data of a question to be answered from a preset vector database, by calling a process planning command corresponding to the question to be answered and / or the target text data, selecting an execution submodule for executing the process planning command from a preset tool module, so that the 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 data is 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 where the processing amount is large and complex 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 target text data output by the corresponding execution module, the execution result with a strong correlation with the question to be answered and / or target text data can be obtained based on the corresponding execution module, avoiding the defect of low answer efficiency caused by the low correlation between the output target answer and the question to be answered, thereby improving the answering ability of the answering system. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] 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.

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

[0042] Figure 1 A flowchart of the first embodiment of the question-and-answer method of this application is provided;

[0043] Figure 2 A schematic diagram of a retrieval enhancement generation process for enhancing the relevance between unanswered questions and answers for this application;

[0044] Figure 3 This is a schematic diagram of the structural modules of the question-answering system for this application;

[0045] Figure 4 A flowchart of Example 2 of the question-and-answer method of this application is provided;

[0046] Figure 5 Schematic diagram of mapping question vectors and text data vectors in vector space;

[0047] Figure 6 This is a schematic diagram of a conventional text matching model;

[0048] Figure 7 This is a schematic diagram of the improved text matching model for this application;

[0049] Figure 8 A brief flowchart of the question-answering method provided for this application;

[0050] Figure 9 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.

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

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

[0053] 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.

[0054] 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 from a preset vector database; to call the process planning command corresponding to the question to be answered and / or the target text data, and to select an execution submodule for executing the process planning command from a 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 to output the target answer, wherein the target answer is used to answer the question to be answered and / or the target text data.

[0055] 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. It is usually difficult to output a clear and visual question-answering processing flow based on multi-source heterogeneous questions to be answered.

[0056] The present application provides a solution that enables users to understand the question-answering processing flow based on the corresponding process planning commands and execution sub-modules, and realize transparent visualization of the question-answering processing flow. At the same time, users can understand the processing method of the question-answering processing flow according to the corresponding execution sub-module, further improving the transparent visualization of the question-answering processing flow. It can also output execution results that match the question to be answered and / or the target text data according to the corresponding execution module, so that the execution results 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, 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.

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

[0058] 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.

[0059] In this embodiment, the question-answering method includes steps S10 to S30:

[0060] Step S10: Retrieve target text segment data of the question to be answered from a preset vector database.

[0061] When answering untrained questions, existing generative large language modules often give fictitious and fabricated answers, which are usually not suitable as answers to unanswered questions. Therefore, based on this situation, this embodiment proposes the following Figure 2 The retrieval enhancement generation process technology shown in the figure enhances the relevance between the question to be answered and the answer, specifically:

[0062] First, local documents are input into the knowledge base retrieval module (i.e. Figure 2In the unstructured loader of 10), after obtaining multiple texts to be processed, the multiple texts to be processed are respectively segmented to obtain multiple paragraphs, and the multiple paragraphs are embedded into corresponding paragraph 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 the question vector is retrieved in the preset vector data, and the cosine similarity between each paragraph data vector and the question vector is calculated. Several paragraph data vectors with higher cosine similarity are selected, and the target paragraph data corresponding to the selected paragraph data vectors are output. After extracting the corresponding prompt module based on the target paragraph data, the target paragraph 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.

[0063] That is, by retrieving target text data with a higher cosine similarity to the question to be answered from a 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, 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.

[0064] It should be noted that step S10 Figure 3 It is implemented in the knowledge base retrieval module. After the user enters the 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.

[0065] Step S20: Call the process planning command corresponding to the question to be answered and / or the target text segment 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.

[0066] 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.

[0067] After the questions to be answered and the retrieved target text data are input into the process planning module, the process planning module calls the process planning commands for executing 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 solve the defect of opaque question and answer processing flow caused by directly outputting answers based on the questions to be answered and the target text data.

[0068] After planning and calling the corresponding process planning command, the execution sub-module for executing the corresponding process planning command is selected in the preset tool module based on the process planning command, avoiding 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, further improving the visualization of the question and answer processing flow.

[0069] In a first feasible implementation, step S20 may include steps S21 and S22:

[0070] Step S21 : When the target text segment data is table data, a first process planning command is called for filtering question and answer information associated with the question to be answered from the table data.

[0071] 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.

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

[0073] Therefore, when there is table data in the retrieved target text 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 sub-module, the specific analysis and screening process of the table data can be known.

[0074] Assume 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. After accessing the question to be answered, the knowledge base retrieval module will retrieve the relevant table data (i.e., target text data) from the preset vector database, and call the first process planning command through the process planning module. The first process planning command, the table data and the question to be answered are input into the preset tool module, and the table analysis submodule is selected 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.

[0075] 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.

[0076] In a second feasible implementation, step S20 may include steps S23 and S24:

[0077] Step S23 : When the question to be answered includes a query instruction and / or the target text data is query data, a second process planning command for executing a query task according to the query instruction and / or query data is called.

[0078] 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.

[0079] See 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 data through the search engine interface.

[0080] Therefore, when it is determined that the question to be answered includes a query instruction and / or that query data exists in the retrieved target text 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 process in the question and answer processing process 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.

[0081] Among them, the query data is determined by the large language model. The large language module will identify the question to be answered entered by the user on the user interface and the target text data output by the knowledge base retrieval module. When it is identified that the question to be answered is a question that needs to be timely, or the target text data cannot be accurately returned to the question to be answered, the second process planning command will be called to obtain accurate question and answer information.

[0082] 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. The second process planning command and the query data are input into the preset tool module, and the search engine call submodule is selected 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.

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

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

[0085] In a third feasible implementation, step S20 may include steps S25-S26:

[0086] Step S25 , when the target text segment data is program data, calling a third process planning command for generating an execution program based on the question to be answered and the program data, and calling a fourth process planning command for running the execution program.

[0087] 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.

[0088] See Figure 3It 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.

[0089] 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 requires obtaining question and answer information through program running. At the same time, according to the called program generation sub-module and program running sub-module, 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.

[0090] Assume that the user inputs a question on the user interface module about how to solve a C fault that occurs on a certain production line. After accessing the question, the knowledge base retrieval module will retrieve the program data (i.e., target text segment data) for solving the C fault on the certain 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. The third process planning command, the fourth process planning command, the program data and the question to be answered are input into the preset tool module. A program generation submodule is selected from the preset tool module to generate a corresponding execution program based on the program data and the question to be answered, and a program execution submodule is called to run the execution program to obtain system instructions that can solve the C fault on the certain production line.

[0091] 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 to perform other question and answer processing, it can ensure its answer effect and thus ensure the accuracy of the target answer output subsequently.

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

[0093] It should be noted that the first feasible implementation method to the third feasible implementation method are selected and implemented in combination based on 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.

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

[0095] 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.

[0096] 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 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.

[0097] In a feasible implementation, step S30 may include steps S31 to S33:

[0098] Step S31: input the question to be answered and / or each target text segment data into the corresponding execution submodule to obtain the execution result.

[0099] Step S32: If the execution result includes table data, query data and / or program data, the process planning command corresponding to the question to be answered and the execution result is called, and the step of selecting an execution submodule for executing the process planning command from the preset tool module is executed.

[0100] 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 sub-module. When the execution result obtained is the relevant program data recorded in the table data for solving the problem of the system receiving an abnormal signal from the production line, 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 at this time, and the steps of selecting the program generation sub-module and the program execution sub-module from the preset tool module are executed, and the loop is repeated until the execution result obtained is the answer data that can answer the question to be answered.

[0101] In step S33, 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.

[0102] 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.

[0103] 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.

[0104] In a feasible implementation manner, steps S41 to S42 may be included after step S30:

[0105] Step S41: receiving a decision instruction returned based on the target answer.

[0106] Step S42: Generate and execute a decision command based on the decision instruction.

[0107] In passing Figure 3 After the answer generation module generates the target answer, it outputs the target answer to the decision solution generation module, and the decision solution generation module displays the target answer to the user for viewing. The user makes relevant decisions based on the displayed target answer.

[0108] Assume that the system instruction displayed on the decision-making solution 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-answering system can generate a decision command for solving the C fault on the certain production line based on the returned decision instruction and execute it, and control and adjust the certain production line; if the decision is not to run, the decision instruction for not running the system instruction is returned, so that the question-answering system can generate a decision command for not executing the system instruction and run it based on the returned decision instruction.

[0109] In this embodiment, after retrieving the target text segment data of the question to be answered 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. This allows the user to understand the question and answer processing flow based on the corresponding process planning command and execution submodule, and realizes 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 based on the corresponding execution submodule, further improving 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, avoiding the situation where the processing volume is large and complex 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 output by the corresponding execution module that matches the question to be answered and / or target text data, the execution result with a strong correlation with the question to be answered and / or target text data can be obtained based on the corresponding execution module, avoiding the defect of low answer 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.

[0110] 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 embodiment 1 can be referred to the above introduction and will not be described in detail later. Figure 4 In step S10, the question-answering method further includes steps S11 to S12:

[0111] In 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.

[0112] 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, this embodiment proposes calculating 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.

[0113] Step S12 : When the probability value is cosine similarity, the text segment data having a cosine similarity greater than a preset cosine similarity is determined as the target text segment data.

[0114] 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.

[0115] 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.

[0116] 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.

[0117] 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.

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

[0119] For example, the probability value to be verified between the question to be answered and the text segment a is 0.25, the probability value to be verified between the question to be answered and the text segment b is 0.20, the probability value to be verified between the question to be answered and the text segment c is 0.15, the probability value to be verified between the question to be answered and the text segment d is 0.1, the probability value to be verified between the question to be answered and the text segment e is 0.07, the probability value to be verified between the question to be answered and the text segment f is 0.06, the probability value to be verified between the question to be answered and the text segment g is 0.05, and the probability value to be verified between the question to be answered and the text segment h is 0.04. At this time, it is judged whether the superimposed probability value of the text segment a + the text segment b is greater than the preset given probability value. If it is less, then it is judged whether the superimposed probability value of the text segment a + the text segment b + the text segment c is greater than the preset given probability value. If it is less, then after superimposing the next text segment 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.

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

[0121] Assuming that the preset given probability value is 0.8, according to the superposition calculation, when the superposition probability value of a segment data + b segment data + c segment data + d segment data + e segment data + f segment data obtains 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.

[0122] In a feasible implementation, step S11 includes steps S15 to S18:

[0123] 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.

[0124] Step S16: Input the several question part vectors into the first convolutional neural network module to output low-dimensional question vectors, and input the several paragraph part vectors into the second convolutional neural network module to output low-dimensional paragraph vectors.

[0125] Step S17: pooling the low-dimensional question vector and the question feature vector to output the question vector, and pooling the low-dimensional text vector and the text feature vector to output the text data vector.

[0126] Step S18: Calculate the cosine similarity between the question vector and the text data vector.

[0127] 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 into the vector space, the closer the two vectors are in the vector space, the higher the cosine similarity.

[0128] like Figure 5 As shown, in the vector space, the first question vector IS1 is closer 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 respectively. Therefore, it can be obtained that the cosine similarity of the first question vector IS1 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 is high.

[0129] In the vector space, the second question vector IS2 is 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, respectively. 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, respectively.

[0130] 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. Figure 6 The text matching model shown and Figure 7 The conventional text matching models shown are all double-tower structures.

[0131] First Figure 7 The conventional text matching model shown is illustrated. 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 partial vectors corresponding to the question to be answered, as well as the text segment feature vector and several text segment partial vectors corresponding to the text segment data are output. In the conventional text matching model, only the question feature vector and the text segment feature vector are pooled and then the cosine similarity is calculated, and the question partial vector and the text segment partial vector are discarded. Although this operation can speed up the running speed of the text matching model, this embodiment is asymmetric text matching, and this operation is bound to lose some matching information, resulting in a deviation in the calculated cosine similarity.

[0132] 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 input into the question calculation module and the text segment calculation module respectively, 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

[15] , 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. 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.

[0133] 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 the answer question and text data are vectorized, which improves the accuracy of the calculated cosine similarity, ensures the retrieval accuracy, and further ensures the accuracy of the output target answer.

[0134] 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.

[0135] In this embodiment, multiple probability values ​​are obtained by calculating the probability values ​​of the question to be answered and each text segment data. 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; when the probability value is a probability value to be verified, the probability values ​​to be verified are superimposed in sequence according to the output order of each probability value to be verified, 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 segment 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 segment data, so as to ensure the accuracy of the output target answer.

[0136] For example, to help understand the implementation process of the question-answering method obtained by combining this embodiment with the above embodiment 1, please refer to Figure 8 , Figure 8 A brief flowchart of the question-answering method is provided, specifically:

[0137] The user enters the question to be answered in the user interface module (i.e. Figure 8 After step S1 in the above example, the knowledge base retrieval module retrieves the target text 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, the question to be answered is solved step by step based on the execution submodule, 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 process).

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

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

[0140] Reference below Figure 9 , which shows a schematic diagram of the structure of a question-answering system suitable for implementing embodiments of the present application. The question-answering system in embodiments 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), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 9 The question-answering system shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0141] like Figure 9As shown, the question-answering system may include a processing device 1001 (e.g., a central processing unit, graphics processing unit, etc.), which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1002 or programs loaded from storage device 1003 into random access memory (RAM) 1004. RAM 1004 also stores various programs and data required for the operation of the question-answering system. Processing device 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage device 1003 including, for example, a magnetic tape or hard disk; and communication device 1009. Communication device 1009 can allow the question-answering system to communicate with other devices wirelessly or wired 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 instead.

[0142] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising 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 via 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.

[0143] The question-and-answer system provided in this application, utilizing the question-and-answer method described in the aforementioned embodiment, can address the technical issue of conventional question-and-answer systems being unable to achieve transparent and traceable question-and-answer processing. Compared to the prior art, the beneficial effects of the question-and-answer system provided in this application are the same as those of the question-and-answer method described in the aforementioned embodiment. Other technical features of this system are the same as those disclosed in the aforementioned embodiment and are not further elaborated upon here.

[0144] It should be understood that the various parts disclosed in this application can be implemented using 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.

[0145] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

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

[0147] The computer-readable storage medium provided herein 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 thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including, but not limited to, wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

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

[0149] 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 from 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.

[0150] 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 stand-alone 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 via 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).

[0151] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of 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 box can also occur in a different order than that marked in the accompanying drawings. For example, two 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 box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0152] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.

[0153] The computer-readable storage medium provided in this application stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned question-and-answer method. This computer-readable storage medium can address the technical issue of conventional question-and-answer systems struggling to achieve transparent and traceable question-and-answer processing. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are similar to those of the question-and-answer method provided in the aforementioned embodiments and are not further elaborated here.

[0154] 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 transformations 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 includes: Retrieve target text segment data of the question to be answered from a preset vector database; Invoking 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 each execution submodule corresponds to one process planning command; Inputting the question to be answered and / or each target text segment data into a corresponding execution submodule, and outputting a target answer, wherein the target answer is used to answer the question to be answered and / or the target text segment data; 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: 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 a 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 a preset tool module; If the execution result is answer data associated with the question to be answered, the target answer is generated and output based on the question to be answered, the target text data, and the answer 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: Calculating the probability values ​​of the question to be answered and each of the text segment data to obtain multiple probability values; In the case where the probability value is cosine similarity, the text segment data to which the cosine similarity is greater than a preset cosine similarity 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, which includes a question calculation module and a text paragraph calculation module; The step of calculating the probability value of the question to be answered and each of the text segment data includes: Inputting the to-be-answered question 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 the plurality of question sentence vectors into a first convolutional neural network module to output a low-dimensional question sentence vector, and inputting the plurality of text segment vectors into a second convolutional neural network module to output a low-dimensional text segment 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; Calculate the cosine similarity between the question vector and the text data vector.

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 includes: In a case where the target text segment data is table data, calling a first process planning command for filtering question-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 includes: In a 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 includes: In a case where the target text segment data is program data, calling a third process planning command for generating an execution program based on 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.

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

8. A question-answering system, characterized in that: The question-answering system 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 according to any one of claims 1 to 7.

9. 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 7 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