Question and answer method, device, equipment and storage medium
By combining the two vector models, using similar question databases and question-answer databases, the problems of insufficient coverage of customer service Q&A, model illusion and slow response time in the existing technology are solved, and more efficient and accurate Q&A services are achieved.
Patent Information
- Application Number
- CN202411782587.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-04-04
AI Technical Summary
In the customer service Q&A, the existing technology has problems such as insufficient coverage of the question template library and answer library, slow update and iteration, large model parameters, high deployment environment requirements and slow response time.
Using a question-and-answer method combining two vector models, the first model matches similar questions in the similar question database, and the second model retrieves answers in the question-and-answer database and determines the accuracy of the answers through the similarity threshold.
It improves the accuracy and efficiency of customer service Q&A, can better handle complex and unexplained user questions, reduces the risk of wrong answers, and optimizes the system's response time.
Smart Images

Figure CN119760064A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data processing technology, and more specifically, to a question-answering method, apparatus, device, and storage medium. Background Art
[0002] The application of artificial intelligence technology in the field of customer service is a current research hotspot. By analyzing data through data-driven intelligent customer service, customer service efficiency can be improved, human resource investment can be reduced, and customer satisfaction can be improved. In the existing technology, customer service Q&A is mainly based on template question matching or large language models.
[0003] In the prior art, template-based question matching is highly dependent on the set question template library and answer library. If the template library and answer library do not cover the questions raised by the user, it is easy to give wrong answers. Large language models are prone to model hallucinations and have slow updates and iterations. They are prone to giving wrong answers when facing customers' ever-changing needs and some questions with unclear intentions. In addition, due to the large number of parameters, large language models have high requirements for the deployment environment and slow response time, which affects the user experience. Summary of the invention
[0004] The embodiments of the present application provide a question-and-answer method, apparatus, device, and storage medium, which are intended to provide accurate and efficient intelligent customer service question-and-answer services.
[0005] A first aspect of an embodiment of the present application provides a question-answering method, the method comprising: Receive a first question from a user; Matching a second question corresponding to the first question in a similar question database using a first model; When the similarity between the second question and the first question does not exceed a preset first similarity threshold, inputting the first question into a second model; Retrieving a first answer corresponding to the first question in a question-and-answer database by using the second model; When the similarity between the first question and the first answer exceeds a preset second similarity threshold, the first answer and the standard question corresponding to the first question are returned to the user.
[0006] Optionally, the method further comprises: When the similarity between the second question and the first question exceeds the first similarity threshold, a second answer corresponding to the second question and a standard question corresponding to the second question are returned to the user.
[0007] Optionally, the method further comprises: When the similarity between the first question and the first answer does not exceed the second similarity threshold, obtaining at least one second question corresponding to the first question through the first model; determining at least one standard question corresponding to the second question; returning at least one standard question corresponding to the second question to the customer to determine whether the standard question corresponding to the second question meets the user's requirements; marking the first question as a standard question corresponding to the second question; Collecting the first question and the answer corresponding to the first question into a question-and-answer database; Adding a plurality of the second questions to a similar question database; A mapping relationship between a plurality of the second questions and the first questions is established.
[0008] Optionally, the training step of the first model includes: Collecting a plurality of standard questions and corresponding standard answers to establish the question-answer database; Expanding the standard question in the question-answer database to obtain multiple similar questions; Collecting multiple similar questions into the same database to obtain the similar question database Establishing a mapping relationship between a plurality of the similar questions and the standard question; The similar questions in the similar question database and the standard questions corresponding to the similar questions are used as training materials to train the untrained first model to obtain the trained first model.
[0009] Optionally, the standard question in the question-answer database is expanded to obtain a plurality of similar questions, including: Inputting the standard question into a large language model; Sending an expansion command to the large language model to instruct the large language model to expand the standard question to obtain a plurality of similar questions; Alternatively, the standard question is mapped to a plurality of similar questions by using a clustering algorithm.
[0010] Optionally, the training step of the second model includes: The plurality of standard questions and the standard answers in the question-and-answer database are used as training materials to train the untrained second model to obtain a trained second model.
[0011] Optionally, the method further comprises: If the first question cannot be found in the question-and-answer database, searching for a standard answer corresponding to the first question; Collecting the first question and the standard answer corresponding to the first question into a question-and-answer database; When the similarity between the first question and the standard question in the question-answering database exceeds a preset third similarity threshold, and the similarity between the first question and the second question does not exceed the first similarity threshold, expanding the first question to obtain multiple similar questions to the first question; Adding the first question and a plurality of similar questions to similar question data; A mapping relationship between the first question and the plurality of similar questions and the standard question is established.
[0012] A second aspect of an embodiment of the present application provides a question-answering device, the device comprising: A question receiving module, used for receiving a first question input by a user; A similar question matching module, used to match a second question corresponding to the first question in a similar question database using a first model; A similarity determination module, configured to input the first question into a second model if the similarity between the second question and the first question does not exceed a preset first similarity threshold; An answer retrieval module, configured to retrieve a first answer corresponding to the first question in a question-and-answer database using the second model; The first answer returning module is used to return the first answer and the standard question corresponding to the first question to the user when the similarity between the first question and the first answer exceeds a preset second similarity threshold.
[0013] Optionally, the device further comprises: The second answer returning module is used to return a second answer corresponding to the second question and a standard question corresponding to the second question to the user when the similarity between the second question and the first question exceeds the first similarity threshold.
[0014] Optionally, the method further comprises: A second question determination module, configured to obtain, by using the first model, at least one second question corresponding to the first question if the similarity between the first question and the first answer does not exceed the second similarity threshold; A standard question determination module, used to determine at least one standard question corresponding to the second question; a question inquiry module, configured to return at least one standard question corresponding to the second question to the customer to determine whether the standard question corresponding to the second question meets the user's requirements; A question marking module, used for marking the first question as a standard question corresponding to the second question; A first collecting module, used for collecting the first question and the answer corresponding to the first question into a question and answer database; A second collection module, used for collecting a plurality of said second questions into a similar question database; The first mapping establishment module is used to establish a mapping relationship between a plurality of the second questions and the first questions.
[0015] Optionally, the training step of the first model includes: Collecting a plurality of standard questions and corresponding standard answers to establish the question-answer database; Expanding the standard question in the question-answer database to obtain multiple similar questions; Collecting multiple similar questions into the same database to obtain the similar question database Establishing a mapping relationship between a plurality of the similar questions and the standard question; The similar questions in the similar question database and the standard questions corresponding to the similar questions are used as training materials to train the untrained first model to obtain the trained first model.
[0016] Optionally, the standard question in the question-answer database is expanded to obtain a plurality of similar questions, including: Inputting the standard question into a large language model; Sending an expansion command to the large language model to instruct the large language model to expand the standard question to obtain a plurality of similar questions; Alternatively, the standard question is mapped to a plurality of similar questions by using a clustering algorithm.
[0017] Optionally, the training step of the second model includes: The plurality of standard questions and the standard answers in the question-and-answer database are used as training materials to train the untrained second model to obtain a trained second model.
[0018] Optionally, the device further comprises: A standard answer search module, used to search for a standard answer corresponding to the first question when the first question cannot be found in the question-and-answer database; A third collection module, used to collect the first question and the standard answer corresponding to the first question into a question and answer database; a question expansion module, configured to expand the first question to obtain a plurality of similar questions to the first question when the similarity between the first question and a standard question in the question-answering database exceeds a preset third similarity threshold and the similarity between the first question and the second question does not exceed the first similarity threshold; A fourth collecting module, used for adding the first question and a plurality of similar questions into similar question data; The second mapping establishment module is used to establish a mapping relationship between the first question and a plurality of similar questions and the standard question.
[0019] A third aspect of an embodiment of the present application provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps in the method described in the first aspect of the present application are implemented.
[0020] A fourth aspect of an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method described in the first aspect of the present application are implemented.
[0021] Using the question-and-answer method provided in the present application, a first question input by a user is received; a second question corresponding to the first question is matched in a similar question database through a first model; when the similarity between the second question and the first question does not exceed a preset first similarity threshold, the first question is input into a second model; a first answer corresponding to the first question is retrieved in a question-and-answer database through the second model; when the similarity between the first question and the first answer exceeds a preset second similarity threshold, the first answer and the standard question corresponding to the first question are returned to the user.
[0022] In this method, when a question input by a user is received, similar questions of the user's question are matched through the first model. When the similarity does not exceed the preset first similarity threshold, it means that the first model cannot match the corresponding similar question. At this time, the corresponding answer is directly matched for the similar question through the second model. When the first question and the first answer exceed the preset second similarity threshold, it means that the answer is the answer that matches the first question. At this time, the first answer and the standard question corresponding to the first question are returned to the user to complete the answer to the first question. By combining the first model with the second model, similar questions of the question raised by the user are first calculated. If no similar question is matched, the answer corresponding to the question raised by the user is queried, thereby improving the accuracy and efficiency of customer service questions and answers. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0024] Figure 1 is a flow chart of a question-and-answer method proposed in one embodiment of the present application; Figure 2 This is a flow chart of the intelligent customer service question and answer system proposed in one embodiment of the present application; Figure 3 It is a flowchart of a question-and-answer method proposed in one embodiment of the present application; Figure 4 is a schematic diagram of a question-and-answer device proposed in an embodiment of the present application; Figure 5 It is a schematic diagram of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] refer to Figure 1 , Figure 1 : is a flow chart of the question-answering method proposed in one embodiment of the present application. Figure 1 As shown, the method comprises the following steps: S11: Receive a first question input by a user.
[0027] In this embodiment, an intelligent customer service system is constructed mainly based on two vector models, and the intelligent customer service system can give corresponding answers according to the questions raised by the users.
[0028] In this embodiment, the first question is a question asked by the user to the intelligent customer service system.
[0029] In this embodiment, reference Figure 2 , Figure 2 is a flow chart of the intelligent customer service question and answer system proposed in one embodiment of the present application, such as Figure 2 As shown, the intelligent customer service system first receives the first question input by the user.
[0030] S12: Matching a second question corresponding to the first question in a similar question database using the first model; In this embodiment, the first model is a vector model trained by constructing a knowledge base of similar questions expanded from standard questions. The input questions can be analyzed and similar questions of the input questions can be determined by similarity. In the fields of language processing and information retrieval, the vector model is a universal model for quantifying and presenting text data. In this model, each document is represented as a vector, each dimension represents a word that appears in the document, and the corresponding value often represents the weight or frequency of occurrence of the word. This method can compare and associate different documents based on the frequency and distribution of word usage. In machine learning and deep learning, vector models have also been widely used in data representation, feature extraction and other links. The second question is the similar questions output by the first model based on the first question. The similar question database is a question database generated after expanding or rewriting multiple standard questions.
[0031] In this embodiment, Figure 2 After receiving the first question, the intelligent customer service system shown inputs the first question into the first model (vector model 1). The first model extracts features of the question to obtain a vector corresponding to the first question, and then searches for similar vectors in a similar question database based on the vector, that is, vectors with a closer distance. The vector with the closest distance is taken as the most similar vector, and the question corresponding to the vector most similar to the vector of the first question is taken as the second question.
[0032] For example, the first question input by the user is "What was the temperature last week?" The second question matched by the first model based on the first question is "What was the average temperature last week?"
[0033] S13: When the similarity between the second question and the first question does not exceed a preset first similarity threshold, input the first question into a second model.
[0034] In this embodiment, the first similarity threshold is a pre-set critical value. When the similarity between the first question and the second question is greater than the threshold, it means that the two questions express the same meaning. When the similarity between the first question and the second question is less than the threshold, it means that the two questions do not express the same meaning. The second model is a model trained by the question-answering database, and can match answers with higher similarity according to the input question.
[0035] In this embodiment, Figure 2As shown, after obtaining the second question, the similarity between the vector corresponding to the second question and the vector corresponding to the first question is calculated. When the similarity between the second question and the first question does not exceed the preset first similarity threshold (threshold 1), it means that the similarity between the second question and the first question is not high. At this time, the first question is input into the second model.
[0036] S14: Retrieve a first answer corresponding to the first question in a question-and-answer database using the second model.
[0037] In this embodiment, the question-answer database is a database composed of multiple user questions and corresponding answers. The first answer is a standard answer retrieved by the second model from the answer database according to the first question.
[0038] In this embodiment, after the second model receives the first question, it extracts features of the first question to obtain a corresponding vector, matches the vector with the highest similarity in the question-and-answer database through the corresponding vector, and uses the answer corresponding to the vector as the first answer.
[0039] S15: When the similarity between the first question and the first answer exceeds a preset second similarity threshold, the first answer and the standard question corresponding to the first question are returned to the user.
[0040] In this embodiment, the second similarity threshold is the critical value of the similarity between the first answer and the first question. When the similarity is higher than the second similarity threshold, it means that the answer corresponding to the first question is the first answer. When the similarity is lower than the second similarity threshold, it means that the answer corresponding to the first question is most likely not the first answer.
[0041] In this embodiment, Figure 2 As shown, when the similarity between the first question and the first answer exceeds the second similarity threshold (threshold 2), the first answer and the standard question corresponding to the first question are sent to the user end. At this time, the user obtains the correct answer corresponding to the first question. The intelligent customer service question and answer system completes a round of dialogue.
[0042] In another embodiment of the present application, the method further includes: S21: When the similarity between the second question and the first question exceeds the first similarity threshold, a second answer corresponding to the second question and a standard question corresponding to the second question are returned to the user.
[0043] In this embodiment, the second question is a similar question in a similar question database that matches the first question, and the second answer is an answer corresponding to the standard question corresponding to the second question.
[0044] In this embodiment, Figure 2As shown, when the similarity between the second question and the first question exceeds the first similarity threshold, it means that the second question is a similar question to the first question. At this time, the standard question corresponding to the second question and the second answer corresponding to the second question are returned to the user.
[0045] In another embodiment of the present application, the method further includes: S31: When the similarity between the first question and the first answer does not exceed the second similarity threshold, obtaining at least one second question corresponding to the first question through the first model.
[0046] In this embodiment, Figure 2 As shown, when the similarity between the first question and the first answer does not exceed the second similarity threshold, it means that the answer corresponding to the first question is not the first answer. At this time, both models cannot answer the first question, triggering the answer process. At this time, the first model matches multiple second questions for the second model, that is, the first model matches multiple similar questions, and can match the first 100 similar questions for the first question.
[0047] S32: Determine at least one standard question corresponding to the second question.
[0048] In this embodiment, Figure 2 As shown, after a plurality of second questions are matched, the standard questions corresponding to the plurality of second questions are calculated.
[0049] S33: Return at least one standard question corresponding to the second question to the customer to determine whether the standard question corresponding to the second question meets the user's requirements.
[0050] In this embodiment, Figure 2 As shown, the standard questions corresponding to the multiple second questions are returned to the customer to determine whether the standard questions corresponding to the second questions meet the user requirements.
[0051] In this embodiment, the calculated first few non-repetitive standard questions are returned to the user, for example, the first 10 standard questions, and a prompt is given to the user: "No relevant questions and answers were found. Are the following questions what you need to consult?"
[0052] S34: Mark the first question as a standard question corresponding to the second question.
[0053] In this embodiment, Figure 2 As shown, after a plurality of second questions are matched for a first question, a label is added to the first question, and the first question is used as a standard question corresponding to the plurality of second questions.
[0054] S35: Add the first question and the answer corresponding to the first question into a question and answer database.
[0055] In this embodiment, Figure 2 As shown, since the correct answer cannot be matched for the first question, it proves that the first question does not appear in the question and answer database. At this time, the first question and the answer corresponding to the first question are included in the question and answer database.
[0056] S36: Adding multiple second questions to a similar question database.
[0057] In this embodiment, a plurality of second questions corresponding to the first question are included in a similar question database.
[0058] S37: Establish a plurality of mapping relationships between the second questions and the first questions.
[0059] In this embodiment, after a plurality of second questions corresponding to a first question are collected, a mapping relationship between the plurality of second questions and the first question is established.
[0060] In another embodiment of the present application, the training step of the first model includes: S41: Collect multiple standard questions and corresponding standard answers to establish the question and answer database.
[0061] In this embodiment, it is first necessary to establish a comprehensive and accurate question-answer database, which stores multiple questions and corresponding answers. This can be achieved by asking real questions from mobile phone users and matching them with manually verified standard answers, or by using the prompt engineering technology of a large language model to write corresponding questions, extract question-answer pairs from text documents of specific products or fields, and manually verify the extracted questions and answers to ensure the accuracy and effectiveness of the question-answer database.
[0062] S42: Expand the standard question in the question and answer database to obtain multiple similar questions.
[0063] In this embodiment, relying solely on the question-answer database may not accurately and comprehensively capture the various changes in user questions. When a user's question arrives, if only the vector model is used to search the answer library, it is easy to return the wrong answer, because the similarity between the user's question and the answer is often low, especially when facing questions with unclear intentions, which increases the risk of retrieving wrong answers. By deforming or expanding the standard questions in the question-answer database, a series of similar questions are generated, and a mapping relationship between similar questions and original questions is established.
[0064] In this embodiment, the specific steps of expanding the standard question in the question-answer database to obtain multiple similar questions include: S42-1: Input the standard question into the large language model.
[0065] In this embodiment, the large language model refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. The large language model can handle a variety of natural language tasks, such as text classification, question answering, dialogue, etc.
[0066] In this embodiment, when expanding the question, the standard question is input into the large language model.
[0067] S42-2: Sending an expansion command to the large language model to instruct the large language model to expand the standard question to obtain a plurality of similar questions.
[0068] In this embodiment, an expansion command is sent to the large language model, instructing the large language model to expand the standard question to obtain multiple similar questions.
[0069] S42-3: Mapping the standard question to multiple similar questions through a clustering algorithm.
[0070] In this embodiment, the standard question can be calculated by a clustering algorithm to achieve the mapping of multiple similar questions to the standard question, and the standard question can be mapped to multiple collected real questions, and the collected real questions can be used as similar questions of the standard question. The constructed similar question library does not require that each similar question must be accurate and semantically clear, but requires that the mapping relationship between the standard question and the similar question must be accurate, and the more similar questions corresponding to each standard question, the better.
[0071] S43: Collecting the plurality of similar questions into the same database to obtain the similar question database.
[0072] In this embodiment, multiple similar questions are collected into the same database to obtain a similar question database.
[0073] S44: Establishing a mapping relationship between the plurality of similar questions and the standard question.
[0074] In this embodiment, each standard question has multiple similar questions, and a mapping relationship is established between multiple similar questions and the standard question. The mapping relationship can be established by marking what the standard question of each similar question is, or marking which similar questions each standard question corresponds to.
[0075] S45: Using the similar questions in the similar question database and the standard questions corresponding to the similar questions as training materials, the untrained first model is trained to obtain the trained first model.
[0076] In this embodiment, similar questions in the similar question database and standard questions corresponding to the similar questions are used as training materials and input into the first model. The first model learns the relationship between each standard question and similar question, and iteratively adjusts the model parameters until a trained first model is obtained.
[0077] In this embodiment, the training step of the second model includes: S46: Using the plurality of standard questions and the standard answers in the question-and-answer database as training materials, the untrained second model is trained to obtain a trained second model.
[0078] In this embodiment, a plurality of standard questions and standard answers in the question-and-answer database are used as training materials to train the untrained second model to obtain a trained second model.
[0079] In this embodiment, merging the two parts of training data together for training may result in lower performance of question-answer retrieval and similar question retrieval, so the two models are trained separately. The trained base model can select models that rank high on the Chinese list, such as bge-large-zh-1.5, Stella, etc. The parameter magnitude of the selected base vector model is recommended to be between 0.1b-0.5b, which can be deployed on both CPU and GPU and has a faster calculation speed. The two models are trained separately through the question and answer database and the similar question database so that semantically similar question pairs and question-answer pairs can be clustered in the vector space.
[0080] In this embodiment, for any new user question, it is necessary to find the standard question that is closest to its semantics. This is achieved by calculating the vector similarity between the user question and the questions in the knowledge base. Therefore, it is necessary to set a similarity threshold. If and only if the similarity between a standard question and the user question exceeds this threshold, the standard question is considered to be the question closest to the user question. Therefore, for the trained vector model, it is necessary to prepare at least one thousand sets of question and answer pairs for testing, and two thresholds need to be calculated during the test: 1. The score threshold that satisfies a probability of more than 99.9% to match the correct similar question in the top 1, i.e., the first similarity threshold; 2. The score threshold that satisfies a probability of more than 99.9% to match the correct answer in the top 1 is the second similarity threshold. Specifically, the similarity scores of the test cases with incorrect top 1 matches can be sorted in descending order, and the threshold score of the first 0.1% can be taken.
[0081] In another embodiment of the present application, the method further includes: S51: When the first question cannot be found in the question-and-answer database, search for a standard answer corresponding to the first question.
[0082] S52: Add the first question and the standard answer corresponding to the first question into a question and answer database.
[0083] In this embodiment, the system needs to be deployed to a production environment and undergo a comprehensive test, including unit testing, performance testing, and user feedback testing, to ensure the stability and accuracy of the system. During the testing process, a special question collection module is added to collect actual user input.
[0084] In this embodiment, Figure 2 As shown, when the first question cannot be found in the question and answer database, it means that the question does not exist in the database. At this time, the standard answer to the question is queried, and the question and the corresponding answer are added to the question and answer database.
[0085] S53: When the similarity between the first question and the standard question in the question-and-answer database exceeds a preset third similarity threshold, and the similarity between the first question and the second question does not exceed the first similarity threshold, the first question is expanded to obtain multiple similar questions of the first question.
[0086] S54: Add the first question and the plurality of similar questions to similar question data.
[0087] In this embodiment, when the similarity between the first question and the standard question is lower than the third threshold, it indicates that there is no association between the two. When the similarity is higher than the third threshold, it indicates that there is a certain similar intention between the two.
[0088] In this embodiment, Figure 2 As shown, when the similarity between the first question and the standard question in the question-answering database exceeds the preset third threshold, and the similarity with the second question does not exceed the first similarity threshold, it means that the extended questions in the similar question database are not complete. At this time, the first question is expanded to obtain multiple similar questions, and then the first question and the multiple expanded similar questions are added to the similar question database.
[0089] S55: Establishing a mapping relationship between the first question and the plurality of similar questions and the standard question.
[0090] In this embodiment, a mapping relationship is established between the first question and multiple similar questions and the standard question, so that similar questions to the standard question can be expanded, so that the matching success rate can be improved when similar questions are encountered next time.
[0091] refer to Figure 3 , Figure 3 is a flowchart of a question-and-answer method proposed in an embodiment of the present application. Figure 3 As shown, first, a question-answer knowledge base (i.e., a question-answer database) is constructed, and then a similar question database is constructed. Then, a similar question vector model (first model) and a question-answer pair vector model (second model) are trained respectively, and the similarity scores between the questions output by the two models and the input questions are calculated respectively to obtain a similarity threshold. Then, the program of the intelligent customer service question-answering system is implemented, the system is deployed and tested, and the real user input that is not matched is manually marked to expand the question-answer library or the similar question library.
[0092] In the above embodiment of the present application, an intelligent customer service question and answer system is designed based on a vector model. The system uses two independent vector models in combination with the construction of a question and answer database and a similar question database, which improves the accuracy of question matching, can provide satisfactory answers and recommended replies for complex questions, optimizes the intelligent customer service answer recommendation algorithm, improves the efficiency of problem handling, and improves customer satisfaction. A collection module is also designed to analyze the actual input of the user. When the answer match fails, the module can automatically classify the user input into the closest multiple standard questions and answers, and save them in the database, further enriching and optimizing the similar question database. During the annotation process, the collected questions can also help discover and repair uncovered question types, thereby continuously improving the probability of users finding the correct answer.
[0093] Based on the same inventive concept, an embodiment of the present application provides a question-answering device. Figure 4 , Figure 4 FIG. 4 is a schematic diagram of a question-answering device 400 proposed in an embodiment of the present application. Figure 4 As shown, the device comprises: The question receiving module 401 is used to receive a first question input by a user; A similar question matching module 402 is used to match a second question corresponding to the first question in a similar question database using a first model; A similarity determination module 403, configured to input the first question into a second model if the similarity between the second question and the first question does not exceed a preset first similarity threshold; An answer retrieval module 404 is used to retrieve a first answer corresponding to the first question in a question and answer database using the second model; The first answer returning module 405 is used to return the first answer and the standard question corresponding to the first question to the user when the similarity between the first question and the first answer exceeds a preset second similarity threshold.
[0094] Optionally, the device further comprises: The second answer returning module is used to return a second answer corresponding to the second question and a standard question corresponding to the second question to the user when the similarity between the second question and the first question exceeds the first similarity threshold.
[0095] Optionally, the method further comprises: A second question determination module, configured to obtain, by using the first model, at least one second question corresponding to the first question if the similarity between the first question and the first answer does not exceed the second similarity threshold; A standard question determination module, used to determine at least one standard question corresponding to the second question; a question inquiry module, configured to return at least one standard question corresponding to the second question to the customer to determine whether the standard question corresponding to the second question meets the user's requirements; A question marking module, used for marking the first question as a standard question corresponding to the second question; A first collecting module, used for collecting the first question and the answer corresponding to the first question into a question and answer database; A second collection module, used for collecting a plurality of said second questions into a similar question database; The first mapping establishment module is used to establish a mapping relationship between a plurality of the second questions and the first questions.
[0096] Optionally, the training step of the first model includes: Collecting a plurality of standard questions and corresponding standard answers to establish the question-answer database; Expanding the standard question in the question-answer database to obtain multiple similar questions; Collecting multiple similar questions into the same database to obtain the similar question database Establishing a mapping relationship between a plurality of the similar questions and the standard question; The similar questions in the similar question database and the standard questions corresponding to the similar questions are used as training materials to train the untrained first model to obtain the trained first model.
[0097] Optionally, the standard question in the question-answer database is expanded to obtain a plurality of similar questions, including: Inputting the standard question into a large language model; Sending an expansion command to the large language model to instruct the large language model to expand the standard question to obtain a plurality of similar questions; Alternatively, the standard question is mapped to a plurality of similar questions by using a clustering algorithm.
[0098] Optionally, the training step of the second model includes: The plurality of standard questions and the standard answers in the question-and-answer database are used as training materials to train the untrained second model to obtain a trained second model.
[0099] Optionally, the device further comprises: A standard answer search module, used to search for a standard answer corresponding to the first question when the first question cannot be found in the question-and-answer database; A third collection module, used to collect the first question and the standard answer corresponding to the first question into a question and answer database; a question expansion module, configured to expand the first question to obtain a plurality of similar questions to the first question when the similarity between the first question and a standard question in the question-answering database exceeds a preset third similarity threshold and the similarity between the first question and the second question does not exceed the first similarity threshold; A fourth collecting module, used for adding the first question and a plurality of similar questions into similar question data; The second mapping establishment module is used to establish a mapping relationship between the first question and a plurality of similar questions and the standard question.
[0100] Based on the same inventive concept, another embodiment of the present application provides a readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the question-and-answer method described in any of the above embodiments of the present application are implemented.
[0101] Based on the same inventive concept, another embodiment of the present application provides an electronic device, Figure 5It is a schematic diagram of an electronic device 500 proposed in one embodiment of the present application, including a memory 502, a processor 501 and a computer program stored in the memory and executable on the processor, and the processor, when executed, implements the steps in the question-and-answer method described in any of the above embodiments of the present application.
[0102] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0103] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0104] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0105] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0106] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0107] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0108] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0109] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0110] The question-and-answer method, device, equipment and storage medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A question-answering method, characterized in that: The method comprises: Receive a first question from a user; Matching a second question corresponding to the first question in a similar question database using a first model; When the similarity between the second question and the first question does not exceed a preset first similarity threshold, inputting the first question into a second model; Retrieving a first answer corresponding to the first question in a question-and-answer database by using the second model; When the similarity between the first question and the first answer exceeds a preset second similarity threshold, the first answer and the standard question corresponding to the first question are returned to the user.
2. The question-answering method according to claim 1, characterized in that: The method further comprises: When the similarity between the second question and the first question exceeds the first similarity threshold, a second answer corresponding to the second question and a standard question corresponding to the second question are returned to the user.
3. The question-answering method according to claim 1, characterized in that: The method further comprises: When the similarity between the first question and the first answer does not exceed the second similarity threshold, obtaining at least one second question corresponding to the first question through the first model; determining at least one standard question corresponding to the second question; returning at least one standard question corresponding to the second question to the customer to determine whether the standard question corresponding to the second question meets the user's requirements; marking the first question as a standard question corresponding to the second question; Collecting the first question and the answer corresponding to the first question into a question-and-answer database; Adding a plurality of the second questions to a similar question database; A mapping relationship between a plurality of the second questions and the first questions is established.
4. The question-answering method according to claim 1, characterized in that: The training steps of the first model include: Collecting a plurality of standard questions and corresponding standard answers to establish the question-answer database; Expanding the standard question in the question-answer database to obtain multiple similar questions; Collecting multiple similar questions into the same database to obtain the similar question database Establishing a mapping relationship between a plurality of the similar questions and the standard question; The similar questions in the similar question database and the standard questions corresponding to the similar questions are used as training materials to train the untrained first model to obtain the trained first model.
5. The question-answering method according to claim 4, characterized in that: The standard question in the question-answer database is expanded to obtain a plurality of similar questions, including: Inputting the standard question into a large language model; Sending an expansion command to the large language model to instruct the large language model to expand the standard question to obtain a plurality of similar questions; Alternatively, the standard question is mapped to a plurality of similar questions by using a clustering algorithm.
6. The question-answering method according to claim 4, characterized in that: The training step of the second model includes: The plurality of standard questions and the standard answers in the question-and-answer database are used as training materials to train the untrained second model to obtain a trained second model.
7. The question-answering method according to claim 1, characterized in that: The method further comprises: If the first question cannot be found in the question-and-answer database, searching for a standard answer corresponding to the first question; Collecting the first question and the standard answer corresponding to the first question into a question-and-answer database; When the similarity between the first question and the standard question in the question-answering database exceeds a preset third similarity threshold, and the similarity between the first question and the second question does not exceed the first similarity threshold, expanding the first question to obtain multiple similar questions to the first question; Adding the first question and a plurality of similar questions to similar question data; A mapping relationship between the first question and the plurality of similar questions and the standard question is established.
8. A question-answering device, characterized in that: The device comprises: A question receiving module, used for receiving a first question input by a user; A similar question matching module, used to match a second question corresponding to the first question in a similar question database using a first model; A similarity determination module, configured to input the first question into a second model if the similarity between the second question and the first question does not exceed a preset first similarity threshold; An answer retrieval module, configured to retrieve a first answer corresponding to the first question in a question-and-answer database using the second model; The answer returning module is used to return the first answer and the standard question corresponding to the first question to the user when the similarity between the first question and the first answer exceeds a preset second similarity threshold.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 7 are implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.