Question and answer processing method and equipment
By detecting the relevance of historical dialogue records in the intelligent question-answering system and retrieving answers directly from the knowledge base, the problem of low response efficiency in existing technologies is solved, achieving more efficient and accurate response processing.
Patent Information
- Application Number
- CN202511156846.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-18
- Publication Date
- 2026-03-31
AI Technical Summary
Existing intelligent question-answering systems are inadequate in terms of response efficiency, especially in terms of inefficiency and incorrect responses caused by the need to reconstruct historical dialogue records when handling user questions.
By detecting whether there is content related to the current user's question in the historical dialogue records, if no relevant content is found, the relevant knowledge is directly retrieved from the preset knowledge base, and the answer is generated using a question-and-answer model. This reduces unnecessary reconstruction steps and input of historical dialogue records, and improves response efficiency and accuracy.
It improves the response efficiency of the intelligent question-answering system, reduces computing resources and costs, avoids erroneous responses caused by irrelevant historical dialogue records, and enhances the accuracy and efficiency of responses.
Smart Images

Figure CN121765039A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, and in particular to a question-and-answer processing method and device. Background Technology
[0002] With the rapid development of large language model technology, intelligent question-answering systems based on large language models are also undergoing large-scale deployment. Currently, to improve the accuracy of answers generated by intelligent question-answering systems, the current user question and historical dialogue records are input into the large language model to reconstruct the question, obtaining a reconstructed question with a complete intent expression. Then, based on Retrieval-Augmented Generation (RAG) technology, relevant knowledge is retrieved from the knowledge base using the reconstructed question. This reconstructed question, along with the historical dialogue records, is input into the question-answering model, which then generates an answer and provides feedback to the user. However, this question-answering processing scheme currently used by intelligent question-answering systems suffers from low response efficiency.
[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of this application is to provide a question-and-answer processing method and device, which aims to improve the response efficiency of intelligent question-and-answer systems.
[0005] To achieve the above objectives, this application proposes a question-and-answer processing method, which includes:
[0006] Retrieve current user's questions and historical conversation records;
[0007] Detect whether there is any content related to the current user's question in the historical dialogue records;
[0008] If it is detected that there is no content related to the current user's question in the historical dialogue records, then the relevant knowledge of the first question is retrieved from the preset knowledge base based on the current user's question;
[0009] An answer to the current user's question is generated based on the knowledge related to the first question and the current user's question using a preset question-answering model.
[0010] Optionally, detecting whether there is content related to the current user's question in the historical dialogue records includes:
[0011] The historical dialogue records and the current user's question are input into a preset first model, and the first model outputs a classification result, wherein the classification result is used to characterize whether there is content related to the current user's question in the historical dialogue records, and the first model is a pre-trained text classification model.
[0012] Optionally, after detecting whether there is content related to the current user's question in the historical dialogue record, the method further includes:
[0013] If content related to the current user's question is detected in the historical dialogue records, then the target content related to the current user's question in the historical dialogue records is extracted;
[0014] The reconstructed problem is obtained by reconstructing the current user problem based on the target content;
[0015] Based on the reconstruction question, relevant knowledge about the second question is retrieved from the preset knowledge base;
[0016] The question-answering model is used to generate an answer to the current user's question based on the knowledge related to the second question and the current user's question.
[0017] Optionally, after obtaining the current user's question and historical dialogue records, the method further includes:
[0018] If the historical dialogue record is less than or equal to a preset minimum splitting unit, the historical dialogue record is treated as a single text segment; if the historical dialogue record is greater than the minimum splitting unit, the historical dialogue record is split into at least two text segments.
[0019] Detect whether each of the text fragments is relevant to the current user question, and obtain the detection results;
[0020] The step of extracting target content related to the current user's question from the historical dialogue records includes:
[0021] Based on the detection results, extract the text segments related to the current user's question from each of the text segments to obtain the target content.
[0022] Optionally, the step of detecting whether each of the text fragments is relevant to the current user question, and obtaining the detection result, includes:
[0023] The current user question and each of the text fragments are input into a preset second model, and the second model outputs a labeled text sequence. The labeled text sequence includes annotation information representing whether each of the text fragments is related to the current user question. The second model is a pre-trained text sequence processing model.
[0024] Optionally, the step of extracting text segments related to the current user's question from each of the text segments based on the detection results to obtain the target content includes:
[0025] Based on the detection results, extract the text segments related to the current user's question from each of the text segments;
[0026] The extracted text fragments are pieced together according to the chronological order in which the dialogue occurs to obtain the target content.
[0027] Optionally, generating an answer to the current user's question based on the knowledge related to the second question and the current user's question using the question-answering model includes:
[0028] The relevant knowledge of the second question, the current user question, and the target content are input into the question-answering model to obtain the answer generated by the question-answering model for the current user question.
[0029] Optionally, the step of reconstructing the current user question based on the target content to obtain a reconstructed question includes:
[0030] The target content and the current user question are used as interface input data to call an external application interface and receive the reconstruction question returned by the external application interface. The external application interface is used to reconstruct the question based on the interface output data using a large language model.
[0031] Optionally, after detecting whether there is content related to the current user's question in the historical dialogue record, the method further includes:
[0032] If content related to the current user's question is detected in the historical dialogue records, then the target content related to the current user's question in the historical dialogue records is extracted;
[0033] The question-answering model is used to generate an answer to the current user's question based on the target content, knowledge related to the first question, and the current user's question.
[0034] In addition, to achieve the above objectives, this application also proposes a question-and-answer processing device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the question-and-answer processing method as described above.
[0035] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the question-and-answer processing method described above.
[0036] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the question-and-answer processing method described above.
[0037] In this application, by acquiring the current user question and historical dialogue records, the system first checks whether there is content related to the user question in the historical dialogue records. If no such content is found, meaning the historical dialogue records do not significantly improve the accuracy of question reconstruction and answering, the system directly retrieves relevant knowledge from a pre-defined knowledge base based on the user question, without needing to reconstruct the user question based on irrelevant historical dialogue records. This saves time and costs associated with unnecessary question reconstruction steps, thereby improving response efficiency. It also avoids generating incorrect reconstructed questions based on irrelevant historical dialogue records, which could affect the accuracy of subsequent answer generation. Furthermore, by using a question-answering model to generate answers to the user question based on knowledge relevant to the first question, without introducing irrelevant historical dialogue records, the amount of input data for the question-answering model is reduced, thus improving the efficiency of answer generation. It also avoids generating incorrect answers based on irrelevant historical dialogue records. In addition, since no relevant content exists in the historical dialogue records, there is no need for question reconstruction or inputting historical dialogue records into the question-answering model, reducing the number of input tokens for both the reconstruction and question-answering models, and lowering the cost of using the intelligent question-answering system. Attached Figure Description
[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a flowchart illustrating the first embodiment of the question-and-answer processing method of this application;
[0041] Figure 2This is one of the flowcharts involved in an implementation example of this application;
[0042] Figure 3 This is the second example of a flowchart illustrating an implementation of this application;
[0043] Figure 4 This is the third flowchart illustrating an implementation example of this application;
[0044] Figure 5 This is the fourth flowchart illustrating an implementation example of this application;
[0045] Figure 6 This is the fifth flowchart illustrating an implementation example of this application;
[0046] Figure 7 This is the sixth flowchart illustrating an implementation example of this application;
[0047] Figure 8 This is a schematic diagram of the device structure of the hardware operating environment involved in the question-and-answer processing method in the embodiments of this application.
[0048] 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 Implementation
[0049] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0050] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0051] With the rapid development of large language model technology, intelligent question-answering systems based on large language models are also undergoing large-scale deployment. Currently, to improve the accuracy of answers generated by intelligent question-answering systems, the current user question and historical dialogue records are input into the large language model for question reconstruction, resulting in a reconstructed question with a complete intent expression. Then, based on retrieval enhancement generation technology, relevant knowledge is retrieved from the knowledge base using the reconstructed question, and this knowledge, along with the reconstructed question and historical dialogue records, is input into the question-answering model. The model then generates an answer and provides feedback to the user. However, this current question-answering processing scheme suffers from low response efficiency.
[0052] To address the aforementioned technical problems, this application proposes a solution. By acquiring the current user question and historical dialogue records, it first checks whether there is content related to the user question in the historical dialogue records. If no content related to the user question is detected in the historical dialogue records, that is, if the historical dialogue records do not significantly improve the accuracy of question reconstruction and answering, the relevant knowledge is directly retrieved from a preset knowledge base based on the user question, without needing to reconstruct the user question based on irrelevant historical dialogue records. This saves time costs associated with unnecessary question reconstruction steps, thereby improving response efficiency. It also avoids obtaining incorrect reconstructed questions based on irrelevant historical dialogue records, which could affect the accuracy of subsequent answer generation. Furthermore, by employing a question-answering model to generate answers to the user question based on the knowledge related to the first question, without introducing irrelevant historical dialogue records, the amount of input data for the question-answering model is reduced, thereby improving the efficiency of the question-answering model in generating answers. It also avoids the question-answering model generating incorrect answers based on irrelevant historical dialogue records. Furthermore, since there is no content related to the user's question in the historical dialogue records, there is no need to reconstruct the question or input the historical dialogue records into the question-answering model. This also reduces the number of input tokens for the reconstruction model and the question-answering model, thereby lowering the cost of using the intelligent question-answering system.
[0053] The following presents a first embodiment of the question-and-answer processing method of this application. (Refer to...) Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the question-and-answer processing method of this application. The executing entity of the question-and-answer processing method in this embodiment can be a device with program execution capabilities, specifically a server, personal computer, mobile phone, or other general computing service device. This device can deploy a RAG system, also known as an intelligent question-and-answer system, or the device can call the RAG system to implement the question-and-answer processing method in this embodiment. Therefore, in this embodiment, the device is also referred to as a question-and-answer processing device for distinction. For ease of description, the executing entity is omitted from the description of this embodiment and the following embodiments. In this embodiment, the question-and-answer processing method includes steps S10 to S50:
[0054] Step S10: Obtain the current user's questions and historical dialogue records.
[0055] User questions, also known as user queries, refer to the textual expression of questions, requests, or instructions submitted by users to the RAG system. The current user question refers to the most recently submitted user question in the current round of interaction that has not yet been fully answered by the intelligent question-answering system. Historical dialogue records refer to questions and corresponding responses from multiple rounds of dialogue with the same user that precede the current user question.
[0056] In a specific implementation, the acquired historical dialogue records can be all dialogue records in the current dialogue task of the intelligent question-answering system, or only a portion of the dialogue records. If only a portion of the dialogue records are acquired, this portion can include a preset number of recent question-answer pairs, or it can include any number of question-answer pairs selected based on specific conditions. In this embodiment, there are no specific limitations on the scope and quantity of historical dialogue records acquired.
[0057] Step S20: Detect whether there is any content related to the current user's question in the historical dialogue records.
[0058] In intelligent question-answering systems, the current user's question may be related to previous conversations or may be completely independent. To improve the efficiency and accuracy of question-answering processing, first determining whether there is content in the historical conversation records that is related to the current user's question can avoid the waste of computing resources and low processing efficiency caused by directly processing a large number of irrelevant historical conversation records.
[0059] Conditions for determining whether text content is relevant to a user's question can be set in advance as needed, but this embodiment does not impose any restrictions on this. For example, if the text contains content that helps clarify and supplement the semantics of the user's question, then the text is considered relevant to the user's question. Similarly, if the text contains content omitted from the user's question, then the text is considered relevant to the user's question. Furthermore, if the text contains all or part of the content of the user's question, then the text is considered relevant to the user's question.
[0060] In specific implementations, detecting whether there is content related to the current user's question in historical dialogue records does not necessarily require performing the step of judging according to the above judgment conditions. For example, in one feasible implementation, a training corpus can be constructed according to the above judgment conditions, and a model can be trained based on machine learning or deep learning algorithms using the training corpus to enable the model to detect content related to the user's question in a dialogue. Then, the trained model can be used to detect whether there is content related to the current user's question in historical dialogue records. Obviously, in this implementation, the judgment conditions are only used in the process of constructing the training corpus, which can be constructed manually or by other devices.
[0061] There are many ways to detect whether there is content related to the current user's question in historical dialogue records, and this embodiment does not impose any limitations. For example, in one feasible embodiment, a keyword matching-based detection method can be used. This involves extracting keywords from the current user's question and searching for the occurrence of these keywords in historical dialogue records to determine the relevance between the historical dialogue records and the current user's question. If the keywords appear frequently in the historical dialogue records or appear in key positions (such as recent rounds of dialogue), then it is considered that there is content related to the current user's question in the historical dialogue records. This method is simple and efficient, and suitable for preliminary screening of large amounts of data. The frequency threshold used to determine the frequency of keywords in historical dialogue records, or the range of occurrences used, can be reasonably set according to actual needs. This embodiment does not limit the frequency threshold or the range. As another feasible embodiment, a semantic similarity-based detection method can also be used. This involves using a pre-trained semantic model (such as the Bidirectional Encoder Representations from Transformers (BERT) model) to calculate the semantic similarity between the current user's question and each text segment in the historical dialogue records. By setting a similarity threshold, if a text segment in the historical dialogue record has a semantic similarity higher than the threshold to the current user's question, then the historical dialogue record is considered to contain relevant content. This method allows for a deeper understanding of the text's semantics and is suitable for handling semantically complex situations or where keywords are not obvious. The similarity threshold can also be reasonably set according to actual needs; this embodiment does not impose any limitations on the similarity threshold. It is understood that the above provides two examples of detection methods, but does not impose any limitations on the specific detection method used.
[0062] Step S30: If it is detected that there is no content related to the current user's question in the historical dialogue records, then retrieve the knowledge related to the first question from the preset knowledge base based on the current user's question.
[0063] Question-related knowledge refers to the knowledge most relevant to the question retrieved from a preset knowledge base. The question-related knowledge retrieved from the preset knowledge base based on the current user's question is called "first question-related knowledge," to distinguish it from question-related knowledge retrieved from the preset knowledge base based on other questions in subsequent embodiments. In other words, first question-related knowledge refers to the knowledge retrieved directly from the knowledge base based on the current user's question when no relevant content is detected in the historical dialogue records.
[0064] The pre-set knowledge base is a module in an intelligent question-answering system used to retrieve external knowledge sources, such as databases, document libraries, web pages, knowledge graphs, vector databases, etc.
[0065] For example, the preset knowledge base includes a document library. By matching the current user's question with each document in the document library, the N documents with the highest matching degree are retrieved. The N documents are the knowledge related to the first question.
[0066] Step S40: Using a preset question-answering model, an answer to the current user's question is generated based on the knowledge related to the first question and the current user's question.
[0067] The pre-set question-answering model refers to the model that the intelligent question-answering system pre-sets to answer user questions, such as an open-source large language model.
[0068] There are many specific implementation methods for using a question-answering model to generate an answer to a user's question based on knowledge related to the first question and the current user's question, and this embodiment does not impose any limitations. For example, knowledge related to the first question and the current user's question can be input into the question-answering model to generate an answer, or knowledge related to the first question, the current user's question, and other relevant information can be input into the question-answering model to generate an answer. These are not listed one by one here.
[0069] In this embodiment, by acquiring the current user question and historical dialogue records, the system first checks whether there is content related to the user question in the historical dialogue records. If no content related to the user question is detected in the historical dialogue records, that is, if the historical dialogue records do not significantly improve the accuracy of question reconstruction and answering, the system directly retrieves the relevant knowledge from the preset knowledge base based on the user question, without needing to reconstruct the user question based on irrelevant historical dialogue records. This saves the time cost of unnecessary question reconstruction steps, thereby improving response efficiency. It also avoids obtaining incorrect reconstructed questions based on irrelevant historical dialogue records, which could affect the accuracy of subsequent answer generation. Furthermore, by using a question-answering model to generate answers to the user question based on the knowledge related to the first question, without introducing irrelevant historical dialogue records, the amount of input data for the question-answering model is reduced, thereby improving the efficiency of the question-answering model in generating answers. It also avoids the question-answering model generating incorrect answers based on irrelevant historical dialogue records. Furthermore, since there is no content related to the user's question in the historical dialogue records, there is no need to reconstruct the question or input the historical dialogue records into the question-answering model. This also reduces the number of input tokens (i.e., lexical units, which are the smallest units or basic elements used to represent processed text in natural language processing) in the reconstruction model and the question-answering model, thus lowering the cost of using the intelligent question-answering system.
[0070] Based on the first embodiment described above, a second embodiment of the question-and-answer processing method of this application is proposed. In this embodiment, content that is the same as or similar to that in the first embodiment can be referred to the above description and will not be repeated hereafter. In this embodiment, step S20 includes:
[0071] Step S201: Input the historical dialogue records and the current user question into a preset first model, and output a classification result through the first model. The classification result is used to characterize whether there is content related to the current user question in the historical dialogue records. The first model is a pre-trained text classification model.
[0072] The first model is a pre-trained text classification model, which can be implemented using models such as SVM (Support Vector Machines) and BERT. It can be trained and deployed using consumer-grade graphics cards, which is low-cost and has an extremely fast response speed. Its scale is smaller than that of large language models.
[0073] The first model is specifically designed to quickly determine whether historical dialogue records contain content relevant to the current user's question. By extracting key features and semantic information, it efficiently performs relevance detection, thus deciding whether further processing of historical dialogue records is necessary. The model's design goal is to minimize computational resources and time consumption while maintaining a certain level of accuracy. The training data for the first model can contain a large number of labeled dialogue samples. Each dialogue sample consists of multiple questions and their corresponding answers, labeled with whether the dialogue samples are relevant to a particular question. During training, this labeled data is used to train a machine learning model using supervised learning algorithms (such as binary classification). This allows the machine learning model to learn to distinguish between relevant and irrelevant dialogue content, resulting in the first model.
[0074] It should be noted that, in this embodiment, the classification result refers to the judgment result output by the first model, used to characterize whether there is content related to the current user's question in the historical dialogue records. The classification result can be a binary value (e.g., 1 indicates the existence of relevant content, 0 indicates the absence of relevant content) or other forms of classification labels, etc., and the form of the classification result is not limited here. This result will guide the subsequent processing steps of the intelligent question answering system: if the classification result indicates that there is no relevant content, then the system directly retrieves relevant knowledge from the preset knowledge base based on the current user's question to generate an answer.
[0075] For example, refer to Figure 2The system inputs historical dialogue records and current user questions into a preset first model for classification (or quick review) to obtain the review results, i.e., the classification results output by the first model. For example, 1 indicates that relevant content exists, and 0 indicates that relevant content does not exist. This example does not limit the form of classification results in the specific implementation process.
[0076] Understandably, directly inputting historical dialogue records into a large language model for processing consumes significant computational resources and time, especially when the historical dialogue records are long, leading to excessive token consumption and slow processing speed. However, by using a smaller, first-model approach, the relevance of historical dialogue records can be quickly determined. This avoids the increased costs associated with large language models processing long texts, as well as the slow speed of large language models handling complex tasks, which impacts the response time of the intelligent question-answering system. It also avoids the waste of computational resources from directly processing large amounts of irrelevant historical dialogue data. By using the first-model, the number of tokens consumed in processing historical dialogue records can be significantly reduced, especially when using external API (Application Programming Interface) calls, significantly reducing usage costs and enabling relevance detection to be completed in a shorter time, thus improving the overall response speed of the intelligent question-answering system.
[0077] Based on the first and / or second embodiments of the question-answering processing method described above, a third embodiment of the question-answering processing method of this application is proposed. In this embodiment, content that is the same as or similar to the first and second embodiments described above can be referred to the above description and will not be repeated hereafter. In this embodiment, after step S20, the method further includes:
[0078] Step S50: If content related to the current user's question is detected in the historical dialogue record, then the target content related to the current user's question in the historical dialogue record is extracted.
[0079] Content extracted from historical dialogue records that is relevant to the current user's question is called target content for distinction.
[0080] Understandably, user questions may contain missing or omitted references, making it difficult to accurately understand their complete intent based solely on the question itself. It's necessary to supplement this information with previous dialogue records. However, directly using historical dialogue records containing a large amount of irrelevant information to reconstruct the current user question often results in low accuracy due to the influence of this irrelevant information. Therefore, by filtering historical dialogue records, extracting the relevant target content when it exists, can effectively prevent irrelevant information from interfering with the question reconstruction. This provides an accurate, complete, and high-quality semantic foundation for subsequent question reconstruction.
[0081] Step S60: Reconstruct the current user problem based on the target content to obtain a reconstructed problem.
[0082] Problem reconstruction refers to reconstructing the current user's question to obtain a complete question, in order to solve problems such as missing or omitted references in the current user's question. Questions that fully express the intent can effectively improve the accuracy of knowledge retrieval in the knowledge base, while questions with missing references (such as "What does that penalty regulation say?") will cause the accuracy to plummet to below zero, making the importance of the reconstruction stage self-evident.
[0083] The reconstruction effect varies depending on the reconstruction method used, and there are various specific reconstruction methods, which are not limited in this embodiment. In one feasible implementation, natural language processing technology can be used to analyze the semantic relationship between the target content and the current user question, supplementing parts of the current user question that are unclear or semantically missing. The resulting reconstructed question is a new question with complete semantics and clear intent, obtained by supplementing, improving, and optimizing the current user question based on the target content in the historical dialogue record. For example, if the current user question is "What does that regulation say?" and the target content is "The traffic penalty regulations mentioned earlier", then the current user question can be reconstructed as "What does that traffic penalty regulation say?" In another feasible implementation, some common question templates can be preset, and the current user question can be matched with the template. The variable parts in the template can be replaced according to the specific information in the target content to generate a complete reconstructed question. For example, if the preset template is "What is the [attribute] of [a specific thing]?", and the user question is "How much does this cost?", and the target content is "The price of this mobile phone", then the current user question can be reconstructed as "How much does this mobile phone cost?". In other feasible implementations, a preset reconstruction model can be invoked to reconstruct the user's question based on the target content. This reconstruction model can be a large language model, etc.
[0084] Step S70: Retrieve relevant knowledge about the second problem from the preset knowledge base based on the reconstruction problem.
[0085] The knowledge related to the reconstruction problem retrieved from the preset knowledge base based on the reconstruction problem is referred to as the second problem-related knowledge for distinction. For example, the preset knowledge base includes a document library. By matching the reconstruction problem with each document in the document library, the N documents with the highest matching degree are recalled. These N documents are the first problem-related knowledge.
[0086] For example, suppose the current user question is "How long is the warranty period?", and the reconstructed question is "How long is the warranty period for replacing a mobile phone battery?". The preset knowledge base contains the following knowledge: "The warranty period for the mobile phone main unit is 12 months," "The warranty period for the mobile phone battery is 6 months," and "The warranty period for the mobile phone screen is 9 months." Then, based on the reconstructed question "How long is the warranty period for replacing a mobile phone battery?", the knowledge base retrieves "The warranty period for the mobile phone battery is 6 months," which is directly related to this question. This knowledge can then be retrieved as relevant knowledge for the second question. This data accurately matches the specific content that the current user question concerns and can be directly used to answer the user's question about the warranty period for replacing a mobile phone battery. It should be noted that this embodiment does not limit the specific method for retrieving relevant knowledge for the second question.
[0087] Understandably, since the current user question may contain semantic incompleteness or unclear references, directly using it for knowledge retrieval would reduce retrieval accuracy and thus affect the accuracy of the intelligent question-answering system's response. Therefore, by extracting the concise target content to reconstruct the current user question, a reconstructed question expressing the complete intent is generated, making it more consistent with semantic logic and retrieval requirements. This effectively avoids the problems of inaccurate and irrelevant knowledge base retrieval results caused by semantic incompleteness or unclear references in the current user question, thereby increasing the probability of retrieving knowledge truly relevant to the current user question from the preset knowledge base and improving the accuracy and efficiency of knowledge retrieval.
[0088] Step S80: Using the question-answering model, an answer to the current user question is generated based on the knowledge related to the second question and the current user question.
[0089] It should be noted that by using the current user question instead of the reconstruction question as input to the question-answering model, the recursive effects caused by possible reconstruction errors can be eliminated.
[0090] There are many specific implementation methods for using a question-answering model to generate answers to user questions based on knowledge related to the second question and the current user question, and this embodiment does not impose any limitations. For example, knowledge related to the second question and the current user question can be input into the question-answering model to generate an answer; alternatively, knowledge related to the second question, the current user question, and historical dialogue records can be input into the question-answering model to generate an answer; or, knowledge related to the second question, the current user question, and target content can be input into the question-answering model to generate an answer. These are not all listed here.
[0091] In one feasible implementation, the answer to the current user's question can be generated solely based on knowledge related to the second question and the current user's question. That is, the question-answering model relies only on the knowledge related to the second question retrieved from a pre-defined knowledge base and the current user's question to generate the answer, without considering other information. For example, if the current user's question is "What is the warranty period for replacing a mobile phone battery?", the intelligent question-answering system retrieves the knowledge related to the second question, "The warranty period for replacing a mobile phone battery is 6 months," from the knowledge base. The question-answering model directly generates the answer based on this knowledge: "The warranty period for replacing a mobile phone battery is 6 months." This approach is suitable for situations where the question is relatively simple and a clear answer exists in the pre-defined knowledge base, enabling quick and accurate answers to the current user's question. In another implementation, the answer to the current user's question can also be generated based on knowledge related to the second question, the current user's question, and historical dialogue records. That is, the question-answering model utilizes knowledge related to the second question and also refers to historical dialogue records to generate the answer. For example, in a previous conversation, the user mentioned, "I just bought a new mobile phone and want to know about the warranty policy," and then asked, "What is the warranty period for replacing a mobile phone battery?" In addition to retrieving the knowledge that "the warranty period for both mobile phone batteries and tablet batteries is 6 months," the intelligent question-answering system also incorporates background information from historical conversations, such as the user mentioning "just bought a new mobile phone," to generate a more detailed answer: "The warranty period for battery replacement on your newly purchased mobile phone is 6 months." This approach better meets the needs of users in multi-turn conversations. However, if there is distracting information in the historical conversation, such as the user previously mentioning "I'm considering whether to buy a tablet, but haven't decided yet," this distracting information may affect the accuracy of the answer, potentially resulting in "The warranty period for battery replacement on your newly purchased tablet is 6 months." In another implementation, an answer to the user's question can be generated based on knowledge related to the second question, the current user question, and the target content. That is, the question-answering model utilizes knowledge related to the second question while also incorporating target content extracted from historical conversations to generate the answer. For example, extracting the target content previously mentioned by the user from a large number of historical conversations, such as "I bought a mobile phone on the official website for 3999 yuan," filters out content irrelevant to "mobile phone," and then asks, "What is the warranty period for battery replacement on a mobile phone?" After retrieving the knowledge that "the warranty period for both mobile phone batteries and tablet batteries is 6 months," the intelligent question-answering system will combine this information with the target content to generate the answer: "The warranty period for battery replacement for the mobile phone you purchased from the official website is 6 months." This method fully utilizes key information in the dialogue to provide users with more accurate and practical answers. In this embodiment, there are no specific limitations on whether the question-answering model needs to combine other information with the knowledge related to the second question to generate an answer to the user's question, nor are there any specific limitations on the types and quantities of other information.
[0092] For example, to help understand the implementation flow of the question-and-answer processing method obtained in this embodiment, please refer to... Figure 3 , Figure 3 A flowchart illustrating a question-and-answer processing method is provided, specifically:
[0093] After the reconstruction model reconstructs the user question based on target content related to the current user question in historical dialogue records to obtain a complete question (i.e., the reconstructed question), it retrieves relevant knowledge about the second question from a pre-set knowledge base based on this complete question, such as... Figure 3 The document shown is 1, 2, 3...N. Then, a preset question-and-answer model is used to generate answers to the user's questions based on the knowledge related to the first question.
[0094] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the question-and-answer processing method of this application.
[0095] In one feasible implementation, to further improve the accuracy and consistency of the answers generated by the question-answering model, step S80 may include S801: inputting the knowledge related to the second question, the current user question, and the target content into the question-answering model to obtain the answer generated by the question-answering model for the current user question.
[0096] Understandably, when a question-answering model generates an answer to the current user's question, relying solely on knowledge related to the second question and the current user's question may have limitations. It may fail to fully consider key information from historical dialogue records. In other words, using only knowledge related to the second question and the current user's question to generate an answer may result in an answer that doesn't perfectly match the user's actual needs, especially when the current user's question has missing references or relies on information from historical dialogue records. However, by further integrating relevant target content from historical dialogue records as input to the question-answering model, problems such as inaccurate, incoherent, or irrelevant answers due to incomplete information can be avoided. By fully utilizing multiple information sources, the question-answering model can more comprehensively understand the user's question and its background, generating more accurate and context-appropriate answers, thereby improving the quality of responses from intelligent question-answering systems.
[0097] Meanwhile, since this implementation also only retains the relevant dialogue history (i.e., the target content), it can eliminate the influence of noise and effectively improve the accuracy of the question-answering model. Furthermore, because the target content has fewer tokens compared to a large number of historical dialogue records, only fewer tokens need to be input into the question-answering model to generate an answer to the current user's question, thus effectively saving the running time of the question-answering model. If the question-answering model is externally called using an API interface, the usage cost can be effectively reduced, including but not limited to data transmission costs and computing resource costs.
[0098] In one feasible implementation, step S60 includes S601: taking the target content and the current user question as interface input data, calling an external application interface, and receiving the reconstruction question returned by the external application interface, wherein the external application interface is used to reconstruct the question based on the interface output data using a large language model.
[0099] Understandably, in certain scenarios, especially when facing complex multi-turn dialogues or when user questions are semantically ambiguous, relying solely on the internal reconstruction logic of the intelligent question-answering system may not be sufficient to fully extract and utilize information from historical dialogue records, or may fail to generate sufficiently high-quality reconstruction questions, or the intelligent question-answering system's own computing resources may be insufficient to meet the reconstruction computation requirements. However, by calling external application programming interfaces (APIs), the capabilities of a large language model can be leveraged to optimize the question reconstruction process, thereby better understanding user intent and generating more accurate and complete reconstruction questions. But frequent calls to external APIs lead to high token consumption and costs. Therefore, this implementation introduces external interfaces and a large language model to process the target content extracted from historical dialogue records and the current user question. Utilizing the powerful capabilities of the large language model improves the overall performance of the intelligent question-answering system, making it more intelligent and accurate in handling complex questions and multi-turn dialogues. Simultaneously, simplifying the target content significantly reduces token consumption, thereby optimizing the usage cost of the intelligent question-answering system, improving its data processing efficiency, and reducing its overall cost.
[0100] In practice, when the current user's question needs to be reconstructed, the intelligent question-answering system first extracts target content related to the current user's question from historical dialogue records. Then, it uses this target content and the current user's question as input data to an external application programming interface (API). This API integrates a large language model, enabling deep semantic analysis and question reconstruction based on the input data. The large language model, based on its extensive training corpus and powerful generation capabilities, outputs a complete and accurate reconstruction question, which the intelligent question-answering system then receives and uses for subsequent knowledge retrieval and answer generation. For example, if the current user's question is "What does that regulation say?", and the target content in the historical dialogue records mentions "traffic penalty regulations," the intelligent question-answering system sends this information to the API. The API uses the large language model to generate the reconstruction question "What are the specific contents of the traffic penalty regulations?" The intelligent question-answering system receives this reconstruction question and continues with subsequent steps. To avoid excessive token consumption, the intelligent question-answering system can set call frequency limits or optimize the call logic, only calling the external API when necessary, thereby reducing usage costs while ensuring reconstruction quality.
[0101] Based on the first, second, and / or third embodiments of the question-and-answer processing method described above, a fourth embodiment of the question-and-answer processing method of this application is proposed. In this embodiment, content that is the same as or similar to the first, second, and third embodiments described above can be referred to the above description and will not be repeated hereafter. In this embodiment, after step S10, the method further includes:
[0102] A10, if the historical dialogue record is less than or equal to a preset minimum splitting unit, the historical dialogue record is treated as a single text segment; if the historical dialogue record is greater than the minimum splitting unit, the historical dialogue record is split into at least two text segments.
[0103] The smallest splitting unit is a unit that cannot be further split. The smallest splitting unit can be defined as needed, for example, a single question-and-answer pair. It can also be further subdivided based on the question or answer, such as by paragraph, by title, by semantics, etc. Alternatively, a text segment with a preset word count can be used as the smallest splitting unit. The specific unit can be set as needed and is not limited in this embodiment. If the historical dialogue record is less than or equal to the smallest splitting unit, for example, if the historical dialogue record contains only one question-and-answer pair, or if the word count of the historical dialogue record is less than the preset word count, the historical dialogue record is not split. In subsequent steps, it is detected whether the entire historical dialogue record is related to the current user's question. If the historical dialogue record is greater than the smallest splitting unit, for example, if the historical dialogue record contains multiple question-and-answer pairs, it is split into multiple parts, each part containing one question-and-answer pair; or if the word count of the historical dialogue record is greater than the preset word count, the historical dialogue record is divided every preset number of times.
[0104] It should be noted that the individual results of splitting the historical dialogue record are called text fragments for the purpose of describing subsequent steps. It can be understood that when the historical dialogue record is treated as a whole without being split, the entire historical dialogue record is called a text fragment.
[0105] Understandably, since historical dialogue records may contain multiple rounds of conversation, directly processing the entire historical dialogue record could lead to information overload and difficulty in determining relevance. However, by breaking down historical dialogue records into multiple text segments, each part can be processed and analyzed more precisely. This avoids wasting computational resources and inefficiency caused by processing large amounts of irrelevant information, while also reducing the problem of inaccurate relevance assessment due to the complexity of the dialogue content. By breaking down historical dialogue records, the parts relevant to the current user's question can be identified more efficiently, improving the targeting and efficiency of subsequent processing by the intelligent question-answering system, ensuring that the system can quickly focus on key information.
[0106] A20, detect whether each of the text fragments is related to the current user question, and obtain the detection result.
[0107] The detection result is the judgment obtained by comparing each text segment with the user's question through a relevance detection algorithm or model. The detection result can be a binary value (e.g., 1 indicates relevance, 0 indicates irrelevance) or other forms of classification labels, used to indicate whether each text segment is relevant to the current user question.
[0108] After breaking down historical dialogue records, each text segment needs to undergo relevance testing to determine which segments are relevant to the current user's question. This step ensures that only relevant segments are processed further, avoiding indiscriminate processing of all text segments, reducing unnecessary computation and resource consumption. It also prevents inaccurate answers from the intelligent question-answering system subsequently processing text segments containing irrelevant information. By detecting the relevance of each text segment, the intelligent question-answering system can filter out the most relevant parts to the current user's question, providing more accurate contextual information for subsequent question reconstruction and answer generation, thereby improving the quality and relevance of the answers.
[0109] Step S50 includes S501: If content related to the current user's question is detected in the historical dialogue record, then the text fragments related to the current user's question are extracted from each of the text fragments according to the detection result to obtain the target content.
[0110] If, based on the detection results, at least one text fragment in each text segment is determined to be relevant to the current user's question, it indicates that content related to the current user's question exists in the historical dialogue record. By extracting text fragments relevant to the user's question from each text segment based on the detection results, the intelligent question-answering system can obtain cleaner and more relevant contextual information, providing a solid foundation for question reconstruction and knowledge retrieval, thereby generating answers that better meet the user's needs.
[0111] In one feasible implementation, step A20 includes:
[0112] The current user question and each of the text fragments are input into a preset second model, and the second model outputs a labeled text sequence. The labeled text sequence includes annotation information representing whether each of the text fragments is related to the current user question. The second model is a pre-trained text sequence processing model.
[0113] The second model is a pre-trained text sequence processing model, which can be implemented using models such as LSTM (Long Short-Term Memory) or BERT. It can be trained and deployed using consumer-grade GPUs, resulting in low cost and extremely fast response times. Its scale is smaller than large language models, and it is specifically designed to detect the relevance between text fragments and user questions. It efficiently performs relevance detection by extracting key features and semantic information. The training data for the second model can contain a large number of labeled text fragment samples and their corresponding user questions. The text fragment samples are labeled with whether they are related to the corresponding user question. This labeling can be more granular than that of the first model, focusing on finer-grained relevance annotations, such as including detailed relevance scores or labels between the text fragment and the user question. Through a large amount of labeled data and iterative training, the machine learning model can accurately determine the relevance of each text fragment to the user question, thus obtaining the second model.
[0114] The detection results output by the second model can be a labeled text sequence, which includes annotation information representing whether each text fragment is related to the current user's question, guiding the intelligent question answering system to extract relevant text fragments to form target content. The form of the annotation information is not limited here.
[0115] In one feasible implementation, the current user question and various text fragments are input into a second model. The second model outputs annotation information corresponding to each text fragment, where 1 indicates relevance and 0 indicates irrelevance. The intelligent question-answering system extracts all text fragments marked as 1 (relevance) based on this annotation information and concatenates these fragments to obtain the target content. For example, if there are three text fragments with annotations of 1, 0, and 1 respectively, the first and third fragments are extracted and concatenated to obtain the target content. Alternatively, the annotation information corresponding to each text fragment output by the second model can be a relevance score (e.g., ranging from 0 to 1). The intelligent question-answering system sets a threshold (e.g., 0.5) and extracts text fragments with relevance scores higher than this threshold, concatenating these fragments to obtain the target content. For example, if there are three text fragments with relevance scores of 0.7, 0.3, and 0.6 respectively, and the threshold is set to 0.5, fragment A and fragment C are extracted and concatenated to obtain the target content. In this implementation, the extraction method is not limited.
[0116] For example, refer to Figure 4The current user question is used as the first sequence, and the historical dialogue records are used as the subsequent sequences (each text fragment obtained from the splitting is a sub-sequence) to obtain the complete sequence. The complete sequence is then input into a preset second model for text sequence processing (or fast review) to obtain the review result, which is the labeled sequence output by the second model. The labeled sequence includes the results corresponding to each sub-sequence. The result corresponding to each sub-sequence is 1 or 0, where 1 indicates that the sub-sequence (text fragment) is related to the current user question, and 0 indicates that the sub-sequence (text fragment) is related to the current user question. This example does not limit the form of the detection result in the specific implementation process.
[0117] In this embodiment, a second model is further employed to detect the relevance of each text fragment to the current user question. This is because it is necessary to output detection results quickly while ensuring a certain level of accuracy, thereby reducing the number of tokens input to the reconstruction model, saving the running time of the reconstruction algorithm, and reducing costs when using API calls. It is understandable that since the second model is smaller than the large language model, the number of tokens consumed when processing text fragments is significantly reduced. Using the second model avoids problems such as excessive token consumption, slow processing speed, and resource waste, thus achieving the effects of reducing token input, saving running time, reducing usage costs, and improving detection accuracy, ensuring that the extracted target content better meets the needs of the user question.
[0118] In one feasible implementation, step S501 includes:
[0119] Step S5011: Extract the text segments related to the current user's question from each of the text segments based on the detection results.
[0120] Step S5012: The extracted text fragments are spliced together according to the chronological order of the dialogue to obtain the target content.
[0121] The chronological order of a dialogue is the sequence in which text fragments are arranged according to the actual time of the conversation in a multi-turn dialogue. This order reflects the natural flow of the dialogue and is usually closely related to the logical development and contextual relationships of the conversation.
[0122] Understandably, since dialogue fragments typically have temporal continuity, piecing them together in chronological order can maintain the logical and semantic coherence of the dialogue. This makes the generated target content more consistent with natural language expression habits and easier to understand during the problem reconstruction process. By piecing together in chronological order, problems such as logical incoherence and semantic incompleteness caused by disordered text fragment order can be avoided. It also prevents misunderstandings or ambiguities caused by incorrect order, thereby restoring the natural flow of the dialogue and making the target content more logically coherent and semantically complete, thus improving the quality and usability of the target content.
[0123] It should be noted that, in conjunction with the second embodiment of the question-and-answer processing method described above, steps S201 and A10-A20 can be implemented in parallel. That is, the rapid review corresponding to step S201 and the precise review corresponding to steps A10-A20 can be implemented in parallel. When the rapid review detects that there is no content related to the current user's question in the historical dialogue records, the intelligent question-and-answer system does not need to wait for the precise review's detection result, but directly uses the current user's question to search the knowledge base and conduct subsequent question-and-answer, saving the entire intelligent question-and-answer system's running time. However, when the rapid review detects that there is content related to the current user's question in the historical dialogue records, the subsequent detection result is based on the precise review's detection result.
[0124] Furthermore, to aid in understanding the implementation flow of the question-and-answer processing method obtained in this embodiment in conjunction with the above embodiments, please refer to... Figure 5 , Figure 5 A flowchart illustrating a question-and-answer processing method is provided, specifically:
[0125] After obtaining the current user's question, a rapid and precise review is performed on the current user's question and historical dialogue records. Specifically, the historical dialogue records and the current user's question are input into a preset first model. Simultaneously, after splitting the historical dialogue records into at least one text segment, the current user's question and each text segment are input into a preset second model. Based on the classification results output by the first model and the labeled sequences output by the second model, subsequent execution steps are determined. When the labeled sequences indicate the existence of content related to the current user's question in the historical dialogue records, the current user's question is reconstructed using a reconstruction model based on the target content related to the current user's question in the historical dialogue records to obtain a complete question (reconstructed question). Then, based on this complete question, relevant knowledge for the second question is retrieved from a preset knowledge base, such as... Figure 5 Documents 1, 2, 3...N are shown in the image. Then, the relevant knowledge about the second question, the current user's question, and the reviewed historical dialogue records (i.e., the reviewed target content in the complete historical dialogue records) are input into a preset question-and-answer model to obtain the answer generated by the model for the current user's question. For the precise review process, please refer to... Figure 6 The system precisely reviews the reviewed historical dialogue records (i.e., the target content), combines them with TopN documents (i.e., documents 1, 2, 3...N, which are also related to the second question) and the current user's question, and inputs them into the question-answering model to obtain the output results.
[0126] Based on the first, second, third, and / or fourth embodiments of the question-and-answer processing method described above, a fifth embodiment of the question-and-answer processing method of this application is proposed. In this embodiment, content that is the same as or similar to the first, second, third, and fourth embodiments described above can be referred to the above description and will not be repeated hereafter. In this embodiment, after step S20, the method further includes:
[0127] Step B10: If content related to the current user's question is detected in the historical dialogue records, then the target content related to the current user's question in the historical dialogue records is extracted.
[0128] The specific implementation of step B10 can be referred to step S50, and will not be repeated here.
[0129] Step B20: Using the question-answering model, an answer is generated for the current user's question based on the target content, the knowledge related to the first question, and the current user's question.
[0130] The method for acquiring knowledge related to the first question can be referred to in step S30, and will not be repeated here.
[0131] Retrieving relevant knowledge directly from a pre-defined knowledge base based on the current user's question allows for rapid acquisition of question-related knowledge without requiring question reconstruction. This method is suitable for scenarios where the user's question is already clear and complete, eliminating the need for further reconstruction. It effectively reduces the time and computational resources required for reconstruction steps, enabling rapid retrieval of knowledge directly related to the user's question from the knowledge base. This ensures the timeliness and accuracy of answer generation, especially when the user's question is already clearly defined, thus improving the response speed and data processing efficiency of the intelligent question-answering system.
[0132] The system uses the target content, relevant knowledge of the first question, and the current user's question as input to generate an answer. This is to generate a more comprehensive and accurate answer to the current user's question without reconstructing the question, by combining key information from historical dialogue records (target content) and directly retrieved knowledge (relevant knowledge of the first question). This avoids the problems of incoherent or incomplete answers that may result from relying solely on knowledge base retrieval results. By combining target content and relevant knowledge from the knowledge base, it can generate answers that better meet the user's actual needs, improving the accuracy and relevance of the answer.
[0133] For example, to help understand the implementation flow of the question-and-answer processing method obtained in this embodiment, please refer to... Figure 7 , Figure 7 A flowchart illustrating a question-and-answer processing method is provided, specifically:
[0134] Retrieve the current user's question and historical dialogue records, extract target content related to the current user's question from the historical dialogue records, and retrieve relevant knowledge from a preset knowledge base based on the current user's question, such as... Figure 7 The document is labeled 1, 2, 3...N. Then, a preset question-and-answer model is used to generate an answer to the current user's question based on the target content, knowledge related to the first question, and the current user's question.
[0135] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the question-and-answer processing method of this application.
[0136] This application provides a question-and-answer processing device, 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, which are executed by the at least one processor to enable the at least one processor to perform the question-and-answer processing method in the above embodiment.
[0137] The following is for reference. Figure 8 It shows a schematic diagram of a question-and-answer processing device suitable for implementing the embodiments of this application. Figure 8 The question-and-answer processing device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0138] like Figure 8As shown, the question-and-answer processing device may include a processing unit 1001 (e.g., a DSP processor), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the question-and-answer processing device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: an input device 1007 including, for example, a microphone, an accelerometer, etc.; an output device 1008 including, for example, 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 allows the question-and-answer processing device to communicate wirelessly or wiredly with other devices to exchange data. Although question-and-answer processing devices with various systems are shown in the figures, it should be understood that it is not required to implement or possess all the systems shown. It can be implemented alternatively or with more or fewer systems.
[0139] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0140] Compared with the prior art, the beneficial effects of the question-and-answer processing device provided in this application embodiment are the same as the beneficial effects of the question-and-answer processing method provided in the above embodiments, and will not be repeated here.
[0141] It should be understood that the various parts disclosed in the embodiments of 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 suitable manner in one or more embodiments or examples.
[0142] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the question-and-answer processing method in the above embodiments.
[0143] The computer-readable storage medium provided in this application embodiment may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution 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.
[0144] The aforementioned computer-readable storage medium may be included in the question-and-answer processing device; or it may exist independently and not assembled into the question-and-answer processing device.
[0145] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by a question-and-answer processing device, cause the question-and-answer processing device to perform the functions defined in the methods of the embodiments disclosed in this application.
[0146] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can 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 can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0148] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0149] The readable storage medium provided in this application embodiment is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-described question-and-answer processing method. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application embodiment are the same as the beneficial effects of the question-and-answer processing method provided in the above-described embodiments, and will not be repeated here.
[0150] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the question-and-answer processing method described above.
[0151] Compared with the prior art, the beneficial effects of the computer program product provided in this application embodiment are the same as the beneficial effects of the question-and-answer processing method provided in the above embodiments, and will not be repeated here.
[0152] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A question and answer processing method characterized by, The method comprises the following steps: obtaining a current user question and historical dialogue records; detecting whether the historical dialogue records contain content related to the current user question; if it is detected that the historical dialogue records do not contain content related to the current user question, retrieving first question-related knowledge from a preset knowledge base according to the current user question; generating an answer to the current user question based on the first question-related knowledge and the current user question by using a preset question and answer model.
2. The question and answer processing method of claim 1, wherein, The detection of whether the historical dialogue records contain content related to the current user question comprises: inputting the historical dialogue records and the current user question into a preset first model to output a classification result by the first model, wherein the classification result is used to represent whether the historical dialogue records contain content related to the current user question, and the first model is a pre-trained text classification model.
3. The question and answer processing method of claim 1, wherein, After the detection of whether the historical dialogue records contain content related to the current user question, the method further comprises the following steps: if it is detected that the historical dialogue records contain content related to the current user question, extracting target content related to the current user question from the historical dialogue records; reconstructing the current user question according to the target content to obtain a reconstructed question; retrieving second question-related knowledge from the preset knowledge base according to the reconstructed question; generating an answer to the current user question based on the second question-related knowledge and the current user question by using the question and answer model.
4. The question answering processing method according to claim 3, characterized by, After the obtaining of the current user question and the historical dialogue records, the method further comprises the following steps: if the historical dialogue records are less than or equal to a preset minimum splitting unit, regarding the historical dialogue records as one text segment, and if the historical dialogue records are greater than the minimum splitting unit, splitting the historical dialogue records into at least two text segments; detecting whether each text segment is related to the current user question to obtain a detection result; The step of extracting target content related to the current user question from the historical dialogue records comprises: extracting text segments related to the current user question from each text segment according to the detection result to obtain target content.
5. The question answering processing method of claim 4, wherein, The detection of whether each text segment is related to the current user question to obtain a detection result comprises: inputting the current user question and each text segment into a preset second model to output an annotated text sequence by the second model, wherein the annotated text sequence comprises annotation information representing whether each text segment is related to the current user question, and the second model is a pre-trained text sequence processing model.
6. The question answering processing method of claim 4, wherein, The extraction of text segments related to the current user question from each text segment according to the detection result to obtain target content comprises: extracting text segments related to the current user question from each text segment according to the detection result; splicing the extracted text segments in chronological order of dialogue occurrence to obtain target content.
7. The question answering processing method of claim 3, wherein, The adopting the question and answer model generates an answer to the current user question based on the second question related knowledge and the current user question, and the generating the answer to the current user question comprises: inputting the second question related knowledge, the current user question and the target content into the question and answer model to obtain an answer to the current user question generated by the question and answer model.
8. The question answering processing method according to any one of claims 3 to 7, characterized in that, The reconstructing the current user question according to the target content to obtain a reconstructed question, and the reconstructing the question comprises: inputting the target content and the current user question as interface input data, calling an external application program interface, and receiving a reconstructed question returned by the external application program interface, wherein the external application program interface is used to reconstruct a question based on interface output data by using a large language model.
9. The question answering processing method of claim 1, wherein, The detecting whether there is content related to the current user question in the historical dialogue record further comprises: if it is detected that there is content related to the current user question in the historical dialogue record, extracting target content related to the current user question in the historical dialogue record; adopting the question and answer model to generate an answer to the current user question based on the target content, the first question related knowledge and the current user question.
10. A question and answer processing device characterized by comprising: The device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the question and answer processing method according to any one of claims 1 to 9.