Question and answer method and device, storage medium and computer program product
Through pre-trained explanation strategy recommendation model and multi-role collaboration, the intelligent Q&A system analyzes user information and question text, provides personalized Q&A services, solves the problem that the existing system does not consider the degree of user knowledge mastery, and improves the quality and accuracy of Q&A sex.
Patent Information
- Application Number
- CN202411544595.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2024-12-13
AI Technical Summary
The existing intelligent Q&A system does not consider the user's mastery of the knowledge of the field of the question when answering user questions, resulting in poor quality of Q&A results, and lack of diversified roles and collaboration between multiple agents, resulting in the accuracy of answering complex questions and Poor comprehensiveness.
The pre-trained explanation strategy recommendation model is used to analyze user information and question text, determine the most suitable explanation strategy and role, and provide personalized question-and-answer services through multi-role collaboration to ensure that the form, depth and style of the answer meet user needs.
Improve the accuracy and professionalism of Q&A results, reduce misleading answers caused by comprehension bias or incomplete information, ensure that the answers are close to the user's level of understanding, and avoid the spread of inappropriate or harmful information through multi-role collaborative answers.
Smart Images

Figure CN119128113A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent question-answering technology, and more specifically, to a question-answering method and device, a storage medium, and a computer program product. Background Art
[0002] With the rapid development of natural language processing (NLP) technology, large language models, especially generative models based on the Transformer architecture, such as the GPT (Generative Pre-trained Transformer) series, have become the core technology in human-computer interaction systems and have practical significance in many fields.
[0003] Taking the field of education as an example, the intelligent question-answering system based on generative models can answer students' questions instantly, provide personalized learning suggestions, and even simulate the role of teachers for interactive teaching. However, when answering questions input by users, the existing intelligent question-answering system based on large models only directly answers based on massive text data, without considering the individual's mastery ability, resulting in the user's inability to accurately understand the answer result; in addition, the existing intelligent question-answering system based on large models is mostly based on single-agent interaction, lacking role diversity and collaboration between multiple agents, resulting in poor accuracy and comprehensiveness in answering complex questions.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a question-and-answer method and apparatus, a storage medium, and a computer program product to at least solve the technical problem that, when answering user questions, the relevant question-and-answer system does not consider the user's mastery of knowledge in the field to which the question belongs, resulting in poor quality of question-and-answer results output by the question-and-answer system.
[0006] According to one aspect of an embodiment of the present application, a question-answering method is provided, including: obtaining a question text to be explained and first object information input by a first object; using a pre-trained explanation strategy recommendation model to analyze the first object information and the question text to be explained, and obtain a corresponding first explanation strategy, wherein the first explanation strategy at least includes: an explanation method and an explanation detail level; determining the question type of the question text to be explained, and determining a first role corresponding to the question type from a preset role list; determining a question answer text obtained by the first role answering the question text to be explained according to the first explanation strategy, and feeding back the question answer text to the first object.
[0007] Optionally, the training process of the above-mentioned explanation strategy recommendation model includes: obtaining a training sample set and a sample label set, wherein the training sample set includes multiple question texts to be explained and second object information of the second object as training samples, and the sample label set includes the second explanation strategy corresponding to each training sample as a sample label; constructing an initial learning model; and iteratively training the initial learning model using the training sample set and the sample label set to obtain the explanation strategy recommendation model.
[0008] Optionally, the initial learning model is iteratively trained using a training sample set and a sample label set to obtain an explanation strategy recommendation model, including: for each training batch in the iterative training process, each training sample of the training batch is input into the initial learning model to obtain each explanation strategy output by the initial learning model, a target loss function is constructed using the explanation strategy and the corresponding sample labels, and the model parameters of the initial learning model are adjusted according to the target loss function.
[0009] Optionally, determining the question type of the question text to be explained includes: converting the question text to be explained into a vector form to obtain a corresponding first question vector; calculating the first vector similarity between the first question vector and a plurality of second question vectors in a preset question vector library, wherein the question vector library records the question types of a plurality of question texts and the corresponding second question vectors; selecting a second target question vector whose first vector similarity is not less than a preset first similarity threshold from the plurality of second question vectors, and using the question type of the question text corresponding to the second target question vector as the question type of the question text to be explained.
[0010] Optionally, before determining the question answer text obtained by the first character asking and answering the first object the question text to be explained according to the first explanation strategy, the method also includes: extracting multiple words in the question text to be explained, and matching the multiple words with a preset violation database, wherein the violation database includes multiple violation words; if the match is successful, determining that the question text to be explained has passed the compliance check; if the match fails, determining that the question text to be explained has not passed the compliance check, and feeding back a violation prompt message to the first object, wherein the violation prompt message is used to prompt that the question text to be explained contains violation words.
[0011] Optionally, determining the question answer text obtained by the first role answering the explanation question text according to the first explanation strategy includes: at least building a question-and-answer group chat by the first role and the first object; within the question-and-answer group chat, the first role asks and answers the first object questions according to the first explanation strategy to obtain the question answer text.
[0012] Optionally, the question-and-answer group chat also includes: a second role, a third role, and a fourth role, wherein the second role is used to summarize the answer text of the first role during the question-and-answer process between the first role and the first object to obtain the question answer text; the third role is used to match the preset violation database with the answer text of the first role; if the match fails, no message is issued; if the match is successful, a violation prompt message is issued, wherein the violation prompt message is used to prompt that there are violation words in the answer text; the fourth role is used to convert the answer text of the first role into a vector form to obtain the corresponding answer text vector, and calculate the second vector similarity between the answer text vector and the first question vector of the question text to be explained; judge the size relationship between the second vector similarity and a preset second similarity threshold, and when the second vector similarity is less than the second similarity threshold, issue an answer text deviation message, wherein the answer text deviation message is used to prompt that the answer text deviates from the question type.
[0013] According to another aspect of an embodiment of the present application, a question-and-answer device is also provided, including: an acquisition module, used to acquire a text of a question to be explained and first object information input by a first object; a first determination module, used to analyze the first object information and the text of the question to be explained using a pre-trained explanation strategy recommendation model, and obtain a corresponding first explanation strategy, wherein the first explanation strategy at least includes: an explanation method and an explanation detail level; a second determination module, used to determine the question type of the text of the question to be explained, and determine a first role corresponding to the question type from a preset role list; a feedback module, used to determine a question answer text obtained by the first role in answering the text of the question to be explained according to the first explanation strategy, and feed back the question answer text to the first object.
[0014] According to another aspect of an embodiment of the present application, a non-volatile storage medium is further provided, wherein the non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned question-and-answer method by running the computer program.
[0015] According to another aspect of an embodiment of the present application, a computer program product is further provided, the computer program product comprising a stored computer program, wherein the above-mentioned question-and-answer method is implemented when the computer program is executed by a processor.
[0016] In the embodiment of the present application, the intelligent question-answering system takes into account that different users need explanations and knowledge in different forms, depths and styles to help users better understand and absorb knowledge, so it uses the explanation strategy recommendation model to analyze the first object information and the question text to be explained to obtain the corresponding first explanation strategy, and determines the corresponding first role from the preset role list according to the question type of the question text to be explained, so that the first role can answer the question text to be explained according to the first explanation strategy to obtain the question answer text that the first object can understand, and feed the question answer text back to the first object. This solves the technical problem that the relevant question-answering system does not consider the user's mastery of the knowledge in the field to which the question belongs when answering the user's question, resulting in the question and answer results output by the question-answering system having poor quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 It is a hardware structure block diagram of an optional computer terminal (or mobile device) for implementing the question-answering method according to an embodiment of the present application;
[0019] Figure 2 is a flowchart of an optional question-and-answer method according to an embodiment of the present application;
[0020] Figure 3 is a schematic structural diagram of an optional question-and-answer device according to an embodiment of the present application;
[0021] Figure 4 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] In addition, the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0025] Example 1
[0026] According to an embodiment of the present application, an embodiment of a question-and-answer method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0027] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing the question-answering method. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0028] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0029] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the question-and-answer method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the question-and-answer method of the above-mentioned application. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0030] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0031] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0032] In the above operating environment, Figure 2is a flowchart of an optional question-and-answer method according to an embodiment of the present application, such as Figure 2 As shown, the method at least includes steps S202-S206, wherein:
[0033] Step S202, obtaining the question text to be explained and the first object information input by the first object.
[0034] In the technical solution provided in step S202, the first object may be a user with knowledge service needs, such as learners, educators, corporate trainers, scientific researchers, content creators, etc., so the question text to be explained is the question text that the first object needs to provide knowledge services. It should be noted that since the first object can input the question to be explained in the form of voice or text, in particular, if the question to be explained can be in the form of voice, the intelligent question-answering system can use automatic speech recognition (ASR) technology to convert it into text to obtain the corresponding question text to be explained. In addition, the first object information is the background information of the first object.
[0035] Taking the first object as a student as an example, the question text to be explained can be questions about subject knowledge, learning methods, homework answers, concept understanding, etc., such as "What is Newton's second law? Please explain the formula F=ma in detail", "How to understand the subjunctive mood in English? Please give examples", "What is the concept of limit in calculus, and how is it applied in practical problems?", etc. The first object information can be basic data related to the student, including but not limited to student grades, grade, gender, preferred subjects, etc. This information helps the intelligent question-answering system to more accurately understand the student's knowledge level and learning needs, thereby generating more personalized answers. For example: Student A is in the third grade of junior high school; the subject scores in the past semester are: Chinese 90 points, mathematics 85 points, English 70 points, physics 40 points, chemistry 90 points; learning habits: prefer charts and example explanations; subject preference: prefer chemistry, and have difficulty understanding physics.
[0036] Step S204: Analyze the first object information and the question text to be explained using the pre-trained explanation strategy recommendation model to obtain a corresponding first explanation strategy.
[0037] In the technical solution provided in step S204, it is considered that the existing intelligent question-answering system directly answers the questions asked by the user. In this question-answering process, the user's own knowledge of the field to which the question belongs is not considered, so the way of answering the question is not suitable for the user who asked the question. To this end, the embodiment of the present application solves the above problem by designing an explanation strategy recommendation model. The model analyzes the characteristics of the first object information and the question text to be explained to recommend the first explanation strategy that is most suitable for the first object, and the first explanation strategy includes but is not limited to the explanation method and the explanation detail level, wherein the explanation method includes the use of charts, lists, story narration, etc., and the explanation detail level includes basic, advanced, expert level, etc.
[0038] For example, for the above-mentioned student A, if the text of the question to be explained input by student A is "What is Newton's second law? Please explain the formula F=ma in detail", when using the explanation strategy recommendation model to analyze the first object information and the text of the question to be explained, considering that the physics score of student A is low, the first explanation strategy for generating the text of the question to be explained is to focus on the explanation of basic concepts, use simple and easy-to-understand language, and provide examples or charts as much as possible to help students better understand physical concepts and overcome learning obstacles.
[0039] Step S206, determining the question type of the question text to be explained, and determining the first role corresponding to the question type from the preset role list.
[0040] In the technical solution provided in step S206, the types of questions to be explained in the question text include subject questions, such as Chinese, mathematics, English, chemistry, etc., and also include non-subject questions, such as learning methods, mental health, psychological counseling, career planning, life skills and common sense, hobbies, creative inspiration, equipment use, etc. In addition, the preset role list can be understood as a collection of multiple roles, which play different functions in the system, aiming to provide comprehensive, safe and intelligent question-and-answer services. Since each role has its specific responsibilities and capabilities, through collaboration or independent work, the problems raised by the object are solved together. Among them, the role list includes but is not limited to the following roles: Subject Teachers of different majors, these roles are all played by intelligent agents (i.e., professional large models that have been published in specific fields or disciplines and optimized in a targeted manner) that have professional knowledge data (i.e., professional knowledge vector databases constructed based on subject textbooks) in specific fields or disciplines, and there are a large number of knowledge vector data in the form of "chapter-title-knowledge text" in the professional knowledge vector database, and its index is the vectorization result of the "knowledge text" of this data. Therefore, these roles can be driven by large models and can provide accurate, detailed answers based on subject or domain knowledge.
[0041] Step S208, determining the question answer text obtained by the first role answering the question text to be explained according to the first explanation strategy, and feeding back the question answer text to the first object.
[0042] In the technical solution provided in step S208, the first role can conduct a question-and-answer exchange with the first object according to the first explanation strategy for the explanation question text, thereby providing a more accurate question answer text, and finally feeding back the obtained question answer text to the first object to complete the question-and-answer interaction. It should be noted that the intelligent question-and-answer system can directly feed back the obtained question answer text to the first object in text form according to the question-and-answer needs of the first object, or it can convert the question answer text into voice form through text-to-speech (TTS) technology to obtain the corresponding question answer voice and feed it back to the first object.
[0043] The above method of this embodiment is further introduced below.
[0044] As an optional implementation, in the technical solution provided in the above step S204, the training process of the above explanation strategy recommendation model may include:
[0045] Step S1, obtaining a training sample set and a sample label set.
[0046] Specifically, the training sample set and sample label set can be obtained from data sources such as historical education materials, online course feedback, and learning forums. The training sample set includes multiple question texts to be explained and second object information as the second object of the training samples, and the sample label set includes the second explanation strategy corresponding to each training sample as a sample label.
[0047] Step S2, constructing an initial learning model.
[0048] The above-mentioned initial learning model can be a machine learning model such as a random forest, a deep learning network, etc.
[0049] Step S3, iteratively train the initial learning model using the training sample set and the sample label set to obtain an explanation strategy recommendation model.
[0050] Specifically, the above step S3 can be implemented in the following way: for each training batch in the iterative training process, each training sample of the training batch is input into the initial learning model to obtain each explanation strategy output by the initial learning model, and the target loss function is constructed using the explanation strategy and the corresponding sample label, and the model parameters of the initial learning model are adjusted according to the target loss function.
[0051] In this embodiment, for each training sample, the training sample is input into the initial learning model to extract the feature vector of the question text to be explained and the second object information of the second object in the training sample, and the feature vector of the question text to be explained and the second object information of the second object is further analyzed to obtain the corresponding explanation strategy; the sample labels of each training sample and the corresponding explanation strategy are used to construct a target loss function, such as a cross-entropy loss function, a mean squared error loss function, etc.; the back propagation algorithm and the optimization algorithm (such as gradient descent, Adam, etc.) are used to adjust the weights and biases of the initial learning model to minimize the value of the target loss function.
[0052] In addition, the trained explanation strategy recommendation model can be loaded into the memory. For example, the raw data of the explanation strategy recommendation model can be loaded from the non-volatile memory into the volatile memory so that the processor can run the explanation strategy recommendation model. The raw data of the explanation strategy recommendation model refers to unprocessed data, which usually includes parameters and structural data of the first neural network. The structural data can be a calculation relationship based on the parameters, such as the forward propagation calculation relationship between the intermediate layers and the neurons. Specifically, the structural data can include code related to the structure of the explanation strategy recommendation model, such as code for performing related calculations between the intermediate layers and the neurons.
[0053] In one embodiment, an area for loading the explanation strategy recommendation model can be divided in the memory, which can include a structure data storage area and a parameter storage area. The structure data storage area is used to store structure-related codes, and the parameters referenced by it can point to the address of specific parameters in the parameter storage area through a pointer. During the training process of the explanation strategy recommendation model, it may be necessary to frequently update the parameters, and the parameter values in the parameter storage area can be updated.
[0054] As an optional implementation, in the technical solution provided in the above step S206, the intelligent question answering system can determine the question type of the question text to be explained by the following method, including:
[0055] Step S2061, converting the text of the question to be explained into a vector form to obtain a corresponding first question vector.
[0056] Specifically, the question text to be explained can be converted into a vector form through Bag of Words (BoW), Word Embeddings or Doc2Vec, so as to obtain the corresponding first question vector.
[0057] Step S2062: Calculate the first vector similarity between the first question vector and a plurality of second question vectors in a preset question vector library.
[0058] The question vector library records question types of multiple question texts and corresponding second question vectors.
[0059] Step S2063, selecting a second target question vector whose first vector similarity is not less than a preset first similarity threshold from the multiple second question vectors, and taking the question type of the question text corresponding to the second target question vector as the question type of the question text to be explained.
[0060] It should be noted that after determining the question type of the question text to be explained, the question type of the question to be explained and the corresponding first question vector can continue to be stored in the question vector library to increase the richness of the question vector library and improve the accuracy of subsequent question category judgment.
[0061] Furthermore, the intelligent question-answering system may determine the corresponding first role from the preset role list according to the determined question type, and in order to ensure the security, compliance and suitability of the question-answering environment, the compliance check of the question text to be explained may be performed through the following steps, including:
[0062] First, extract multiple words in the question text to be explained, and match the multiple words with a preset violation database, wherein the violation database includes multiple violation words;
[0063] If the match is successful, it is determined that the text of the question to be explained has passed the compliance check;
[0064] If the match fails, it is determined that the question text to be explained has not passed the compliance check, and an error prompt message is fed back to the first object, wherein the error prompt message is used to prompt that the question text to be explained contains illegal words. For example, "Your question cannot be answered, please continue to ask other questions!".
[0065] As an optional implementation, in the technical solution provided in the above step S208, the intelligent question-answering system may obtain the question answer text by the following method, including:
[0066] Step S2081, at least the first role and the first object establish a question-and-answer group chat;
[0067] Step S2082: In the question-and-answer group chat, the first role conducts question-and-answer communication with the first object according to the first explanation strategy regarding the explanation question text, and obtains the question answer text.
[0068] In the above embodiment, the first character asks and answers questions to the first object according to the first explanation strategy for the explanation question text, so that the first character can adjust the explanation method according to the user's learning preference and knowledge level. For example, for students who need basic concept explanations, the strategy recommendation model can recommend simpler and more intuitive explanation strategies; while for students seeking in-depth understanding, strategies containing more details and extended information can be recommended. This helps users absorb and understand knowledge more effectively, avoiding the confusion caused by too shallow or too deep explanations.
[0069] It should be noted that when the first role conducts multiple rounds of questions and answers with the first object according to the first explanation strategy for the question text to be explained, the first explanation strategy can be in the form of a text spliced together with the question text to be explained as the question input text, and the first role answers it. For example, the question text to be explained input by Student A is "What is Newton's second law? Please explain the formula F=ma in detail." The text representation corresponding to the first explanation strategy can be a system prompt in the form of "My physics foundation is weak, please explain step by step when answering this question."
[0070] In addition, in the above Q&A group chat, in addition to the first role and the first object, the following roles may also be included:
[0071] The second role (ie, the host) is used to summarize the answer text of the first role during the question-and-answer process between the first role and the first object to obtain the question answer text.
[0072] The third role (i.e. Safety Officer) is used to match the preset violation database with the answer text of the first role; if the match fails, no message is issued; if the match is successful, a violation prompt message is issued, wherein the violation prompt message is used to prompt the presence of violation words in the answer text.
[0073] The fourth role (i.e., critic) is used to convert the answer text of the first role into a vector form, obtain the corresponding answer text vector, and calculate the second vector similarity between the answer text vector and the first question vector of the question text to be explained; judge the size relationship between the second vector similarity and a preset second similarity threshold, and when the second vector similarity is less than the second similarity threshold, issue an answer text deviation message, wherein the answer text deviation message is used to prompt that the answer text deviates from the question type.
[0074] Specifically, each of the above roles can speak in the Q&A group chat according to the following process:
[0075] The first step is for the second role (host) to introduce the questions to be explained to each role in the Q&A group chat;
[0076] In the second step, the first character answers the question to be explained and obtains the corresponding answer text;
[0077] In the third step, the third role (security officer) performs compliance check on the answer text. If the answer text fails the check, the second step is continued; if the answer text passes the check, the next step is continued;
[0078] Step 4: The fourth role (critic) verifies whether the answer text has deviations. If the answer text fails the verification, the second step is continued; if the answer text passes the verification, the next step is continued;
[0079] Step 5: The second role (moderator) will summarize the answer text and feed it back to the first subject.
[0080] It should be noted that if the answer text of the first role fails to pass the compliance check within the preset number of times, the second role (host) can feedback the question and answer abnormality prompt information to the first object, such as "The system answer failed, please try to ask other questions!", and end the current question and answer interaction process.
[0081] The above process is only described by taking a single round of interaction as an example. However, in actual application scenarios, multiple first roles may be involved in answering the questions to be explained by the first object. Therefore, the question-and-answer interaction process may involve multiple rounds of questions and answers. Therefore, the above steps need to be performed in each round of question-and-answer process to ensure that the final output answer to the question is compliant and there is no content deviation.
[0082] Based on the scheme defined in the above steps S202 to S208, it can be known that in the embodiment, the intelligent question-answering system takes into account that different users need explanations and knowledge in different forms, depths and styles to help users better understand and absorb knowledge, so it uses the explanation strategy recommendation model to analyze the first object information and the question text to be explained to obtain the corresponding first explanation strategy, and determines the corresponding first role from the preset role list according to the question type of the question text to be explained, so that the first role can answer the question text to be explained according to the first explanation strategy to obtain the question answer text that the first object can understand, and feed back the question answer text to the first object. Thereby improving the accuracy, effectiveness and professionalism of the question-answering results, reducing misleading answers caused by misunderstandings or incomplete information, and avoiding providing information that is irrelevant to the question or not very helpful to students' learning, so that the question-answering results are closer to the core of the problem and the user's understanding level. In addition, the intelligent question-and-answer system determines the corresponding professional role (one or more) according to the question type, and introduces system roles such as safety officers and critics to achieve multi-role collaborative answering of user questions, avoiding the spread of inappropriate or harmful information, ensuring the safety and compliance of the explanation of the questions, while also avoiding repeated or irrelevant answers, improving the efficiency and fluency of the system response.
[0083] Example 2
[0084] Based on Embodiment 1 of the present application, an embodiment of a question-answering device is also provided, and the question-answering method of the above embodiment is executed when the device is running. Figure 3 is a schematic diagram of the structure of an optional question-answering device according to an embodiment of the present application, such as Figure 3 As shown, the question-answering device at least includes an acquisition module 32, a first determination module 34, a second determination module 36 and a feedback module 38, wherein:
[0085] An acquisition module 32 is used to acquire the question text to be explained and the first object information input by the first object;
[0086] The first determination module 34 is used to analyze the first object information and the question text to be explained by using the pre-trained explanation strategy recommendation model to obtain a corresponding first explanation strategy, wherein the first explanation strategy at least includes: an explanation method and an explanation detail level;
[0087] A second determination module 36 is used to determine the type of the question text to be explained, and determine a first role corresponding to the question type from a preset role list;
[0088] The feedback module 38 is used to determine the question answer text obtained by the first role in answering the explanation question text according to the first explanation strategy, and feed back the question answer text to the first object.
[0089] It should be noted that the various modules in the above-mentioned question-and-answer device can be program modules (for example, a set of program instructions that implement a certain specific function) or hardware modules. For the latter, it can be expressed in the following forms, but is not limited to this: the expression form of each of the above-mentioned modules is a processor, or the functions of each of the above-mentioned modules are implemented by a processor.
[0090] Example 3
[0091] According to an embodiment of the present application, a non-volatile storage medium is also provided, in which a program is stored, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the question-and-answer method in Example 1.
[0092] Optionally, the device where the non-volatile storage medium is located implements the following steps by running the program: obtaining the text of the question to be explained and the first object information input by the first object; using a pre-trained explanation strategy recommendation model to analyze the first object information and the text of the question to be explained, and obtain a corresponding first explanation strategy, wherein the first explanation strategy at least includes: the explanation method and the explanation detail level; determining the question type of the question text to be explained, and determining the first role corresponding to the question type from a preset role list; determining the question answer text obtained by the first role answering the question text to be explained according to the first explanation strategy, and feeding back the question answer text to the first object.
[0093] According to an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein the question-and-answer method in Embodiment 1 is implemented when the computer program is executed by a processor.
[0094] Optionally, the computer program executes the following steps: obtaining the text of the question to be explained and the first object information input by the first object; using a pre-trained explanation strategy recommendation model to analyze the first object information and the text of the question to be explained, and obtain a corresponding first explanation strategy, wherein the first explanation strategy at least includes: explanation method, explanation detail level; determining the question type of the text of the question to be explained, and determining the first role corresponding to the question type from a preset role list; determining the question answer text obtained by the first role in answering the text of the question to be explained according to the first explanation strategy, and feeding back the question answer text to the first object.
[0095] According to an embodiment of the present application, a processor is also provided, which is used to run a program, wherein the question-and-answer method in Example 1 is executed when the program is running.
[0096] Optionally, when the program is running, the following steps are executed: obtaining the text of the question to be explained and the first object information input by the first object; using the pre-trained explanation strategy recommendation model to analyze the first object information and the text of the question to be explained, and obtain the corresponding first explanation strategy, wherein the first explanation strategy at least includes: the explanation method and the explanation detail level; determining the question type of the text of the question to be explained, and determining the first role corresponding to the question type from the preset role list; determining the question answer text obtained by the first role in answering the text of the question to be explained according to the first explanation strategy, and feeding back the question answer text to the first object.
[0097] According to an embodiment of the present application, an electronic device is also provided, wherein: Figure 4 is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application, such as Figure 4 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the question-and-answer method in the above-mentioned embodiment 1 when running.
[0098] Optionally, the processor is configured to execute the following steps through a computer program: obtaining the text of the question to be explained and the first object information input by the first object; using a pre-trained explanation strategy recommendation model to analyze the first object information and the text of the question to be explained, and obtain a corresponding first explanation strategy, wherein the first explanation strategy at least includes: the explanation method and the explanation detail level; determining the question type of the question text to be explained, and determining the first role corresponding to the question type from a preset role list; determining the question answer text obtained by the first role in answering the question text to be explained according to the first explanation strategy, and feeding back the question answer text to the first object.
[0099] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0100] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0101] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0102] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0103] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0104] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.
[0105] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A question-answering method, characterized in that: include: Obtaining the question text to be explained and the first object information input by the first object; Analyze the first object information and the question text to be explained by using a pre-trained explanation strategy recommendation model to obtain a corresponding first explanation strategy, wherein the first explanation strategy at least includes: an explanation method and an explanation detail level; Determine the type of the question text to be explained, and determine a first role corresponding to the type of question from a preset role list; Determine a question answer text obtained by the first role answering the question text to be explained according to the first explanation strategy, and feed back the question answer text to the first object.
2. The method according to claim 1, characterized in that The training process of the explanation strategy recommendation model includes: Acquire a training sample set and a sample label set, wherein the training sample set includes a plurality of question texts to be explained and second object information of the second object as training samples, and the sample label set includes a second explanation strategy corresponding to each training sample as a sample label; Build an initial learning model; The initial learning model is iteratively trained using the training sample set and the sample label set to obtain the explanation strategy recommendation model.
3. The method according to claim 2, characterized in that Iteratively training the initial learning model using the training sample set and the sample label set to obtain the explanation strategy recommendation model includes: For each training batch in the iterative training process, each training sample of the training batch is input into the initial learning model to obtain each explanation strategy output by the initial learning model, and a target loss function is constructed using the explanation strategy and the corresponding sample label, and the model parameters of the initial learning model are adjusted according to the target loss function.
4. The method according to claim 1, characterized in that: Determine the type of the question text to be explained, including: Convert the question text to be explained into a vector form to obtain a corresponding first question vector; Calculating the first vector similarity between the first question vector and a plurality of second question vectors in a preset question vector library, wherein the question vector library records question types of a plurality of question texts and corresponding second question vectors; A second target question vector whose similarity to the first vector is not less than a preset first similarity threshold is selected from the multiple second question vectors, and the question type of the question text corresponding to the second target question vector is used as the question type of the question text to be explained.
5. The method according to claim 1, characterized in that Before determining the question answer text obtained by the first role asking and answering the question text to be explained and the first object according to the first explanation strategy, the method further includes: Extracting a plurality of words in the question text to be explained, and matching the plurality of words with a preset violation database, wherein the violation database includes a plurality of violation words; If the match is successful, it is determined that the text of the question to be explained has passed the compliance check; If the matching fails, it is determined that the text of the question to be explained has not passed the compliance check, and a violation prompt message is fed back to the first object, wherein the violation prompt message is used to prompt that the text of the question to be explained contains violation words.
6. The method according to claim 1, characterized in that Determining the question answer text obtained by the first role answering the question text to be explained according to the first explanation strategy, including: A question-and-answer group chat is established by at least the first role and the first object; In the question-and-answer group chat, the first role conducts question-and-answer communication with the first object according to the first explanation strategy to obtain the question answer text.
7. The method according to claim 6, characterized in that The question-and-answer group chat also includes: a second role, a third role, and a fourth role, wherein: The second role is used to summarize the answer text of the first role in the question-and-answer process between the first role and the first object to obtain the question answer text; The third role is used to match the answer text of the first role with the preset violation database; if the match fails, no message is issued; if the match succeeds, a violation prompt message is issued, wherein the violation prompt message is used to prompt that there are violation words in the answer text; The fourth role is used to convert the answer text of the first role into a vector form to obtain a corresponding answer text vector, and calculate the second vector similarity between the answer text vector and the first question vector of the question text to be explained; judge the size relationship between the second vector similarity and a preset second similarity threshold, and when the second vector similarity is less than the second similarity threshold, issue an answer text deviation message, wherein the answer text deviation message is used to prompt that the answer text deviates from the question type.
8. A question-answering device, characterized in that: include: An acquisition module, used for acquiring the question text to be explained and the first object information input by the first object; A first determination module is used to analyze the first object information and the question text to be explained by using a pre-trained explanation strategy recommendation model to obtain a corresponding first explanation strategy, wherein the first explanation strategy at least includes: an explanation method and an explanation detail level; A second determination module is used to determine the type of the question text to be explained, and determine a first role corresponding to the type of question from a preset role list; A feedback module is used to determine the question answer text obtained by the first role answering the question text to be explained according to the first explanation strategy, and feed back the question answer text to the first object.
9. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, wherein the device where the non-volatile storage medium is located executes the question-and-answer method described in any one of claims 1 to 7 by running the computer program.
10. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the question-answering method according to any one of claims 1 to 7 is implemented.
