Intelligent question answering method, intelligent question answering device, electronic equipment and storage medium
By combining entity recognition and multiple matching methods, the problem of low accuracy in existing intelligent question answering methods has been solved, enabling more accurate and flexible answer generation and improving user experience.
Patent Information
- Application Number
- CN202211441258.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-17
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-11-17
AI Technical Summary
Most existing intelligent question-answering methods respond to user requests through fixed question-answer templates, which cannot effectively solve users' actual needs and result in low accuracy.
By acquiring questions from target users, entity recognition is performed using a pre-set entity recognition model, question matching values are calculated, candidate matching methods are filtered, and answers are generated based on the matching methods. This includes various methods such as calling historical question trees, question confirmation templates, fallback corpora, and casual conversation corpora to improve the accuracy of answer generation.
It improves the accuracy and applicability of Q&A, reduces redundant information interference, and can generate targeted answers for different questions, thus improving the user experience.
Smart Images

Figure CN115795007B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to an intelligent question-answering method, an intelligent question-answering device, an electronic device, and a storage medium. Background Technology
[0002] In the field of intelligent question answering, the business scenarios for intelligent question answering are numerous and complex. Most current intelligent question answering methods respond to user requests through fixed question and answer templates. This approach often fails to effectively address users' actual needs and suffers from low accuracy in question answering. Therefore, how to improve the accuracy of question answering has become an urgent technical problem to be solved. Summary of the Invention
[0003] The main objective of this application is to provide an intelligent question-answering method, intelligent question-answering device, electronic device, and storage medium, which aims to improve the accuracy of question-answering.
[0004] To achieve the above objectives, a first aspect of this application proposes an intelligent question-answering method, the method comprising:
[0005] The target question for acquiring target users;
[0006] The target problem is identified based on a preset entity recognition model to obtain the target problem features;
[0007] The matching degree is calculated for the target question features and multiple reference questions in the preset question-answer corpus to obtain multiple question matching values, and the question matching value with the largest value is taken as the target matching value;
[0008] Based on the target matching value and the preset question matching threshold, multiple preset candidate matching methods are filtered to obtain the target matching method;
[0009] The target answer is generated based on the target matching method.
[0010] In some embodiments, the entity recognition of the target problem based on a preset entity recognition model to obtain target problem features includes:
[0011] The target question is segmented using a preset word segmenter based on the entity recognition model to obtain the question segment;
[0012] The entity recognition layer based on the entity recognition model performs entity recognition on the question segment to obtain the target question features.
[0013] In some embodiments, the step of calculating the matching degree between the target question features and multiple reference questions in a preset question-answering corpus to obtain multiple question matching values, and taking the question matching value with the largest value as the target matching value, includes:
[0014] The target problem features are vectorized to obtain target problem feature vectors, and each reference problem is vectorized to obtain multiple reference problem feature vectors;
[0015] Based on a preset algorithm, the matching degree of the target problem feature vector and each of the reference problem feature vectors is calculated to obtain multiple problem matching values;
[0016] The question matching value with the largest numerical value is taken as the target matching value.
[0017] In some embodiments, the question matching threshold includes a first threshold and a second threshold, wherein the first threshold is greater than the second threshold; the candidate matching methods include a first method, a second method, and a third method; and the step of filtering multiple preset candidate matching methods based on the target matching value and the preset question matching threshold to obtain the target matching method includes:
[0018] If the target matching value is greater than or equal to the first threshold and the target matching value is less than or equal to 1, then the first method is used as the target matching method;
[0019] If the target matching value is greater than the second threshold and the target matching value is less than the first threshold, then the second method is used as the target matching method;
[0020] If the target matching value is greater than or equal to 0, and the target matching value is less than or equal to the second threshold, then the third method is used as the target matching method.
[0021] In some embodiments, generating an answer to the target question based on the target matching method to obtain the target answer includes:
[0022] If the target matching method is the first method, then the preset historical problem tree is invoked, and the reference problem corresponding to the target matching value is recorded as an intermediate problem;
[0023] Traverse the historical problem tree, and filter the problem nodes in the historical problem tree based on the intermediate problems to obtain the filtering results;
[0024] Based on the filtering results, the historical answers corresponding to the filtered question nodes are used as the target answer, or the reference answers corresponding to the intermediate questions are extracted from the question-and-answer corpus and used as the target answer.
[0025] In some embodiments, generating an answer to the target question based on the target matching method to obtain the target answer includes:
[0026] If the target matching method is the second method, then a question confirmation template is obtained based on the reference question corresponding to the target matching value;
[0027] The question confirmation template is sent to the target user, and the response information from the target user based on the question confirmation template is obtained;
[0028] If the response information indicates that the reference question corresponding to the target matching value is consistent with the target question, then an answer is generated for the target question based on the first method to obtain the target answer;
[0029] If the response information is inconsistent with the target question corresponding to the target matching value, then the preset default response data is extracted and the default response data is used as the target answer.
[0030] In some embodiments, generating an answer to the target question based on the target matching method to obtain the target answer includes:
[0031] If the target matching method is the third method, then the preset fallback corpus and chat corpus are obtained, and the reference question corresponding to the target matching value is recorded as the intermediate question;
[0032] The intermediate question and multiple candidate catch-all questions in the catch-all corpus are matched to obtain the first matching result;
[0033] If the first matching result is that the candidate fallback question matches the intermediate question in the fallback corpus, then the target answer is determined based on the fallback corpus;
[0034] If the first matching result is that there is no candidate catch-all question in the catch-all corpus that matches the intermediate question, then the intermediate question and multiple candidate chat questions in the chat corpus are matched to obtain a second matching result;
[0035] Based on the second matching result, the target answer is determined based on the casual conversation corpus, or preset default reply data is extracted and used as the target answer.
[0036] To achieve the above objectives, a second aspect of this application provides an intelligent question-answering device, the device comprising:
[0037] The issue retrieval module is used to retrieve the target issues of the target users.
[0038] An entity recognition module is used to perform entity recognition on the target problem based on a preset entity recognition model to obtain the target problem features;
[0039] The matching calculation module is used to calculate the matching degree between the target question features and multiple reference questions in a preset question-answer corpus, obtain multiple question matching values, and take the question matching value with the largest value as the target matching value;
[0040] The filtering module is used to filter multiple preset candidate matching methods based on the question matching data and a preset question matching threshold to obtain the target matching method;
[0041] The answer generation module is used to generate an answer to the target question based on the target matching method, thereby obtaining the target answer.
[0042] To achieve the above objectives, a third aspect of the present application provides an electronic device, the electronic device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method described in the first aspect.
[0043] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.
[0044] The intelligent question-answering method, intelligent question-answering device, electronic device, and storage medium proposed in this application acquire the target user's target question; perform entity recognition on the target question based on a preset entity recognition model to obtain target question features, which can accurately identify the target question features and reduce interference from other redundant information on question-answering matching, thus improving the accuracy of question-answering matching. Furthermore, the matching degree between the target question features and multiple reference questions in a preset question-answering corpus is calculated to obtain multiple question matching values, and the question matching value with the largest value is taken as the target matching value. This method can conveniently determine the matching degree between multiple reference questions in the preset question corpus and the target question, and determine the target matching value between the reference question with the best matching degree and the target question. Furthermore, based on the target matching value and a preset question matching threshold, multiple preset candidate matching methods are filtered to obtain the target matching method, which can select different candidate matching methods as the target matching method according to different target matching values. Finally, the target answer is generated based on the target matching method. By setting multiple different candidate matching methods in the question-and-answer matching process, the answer can be generated in a targeted manner for different target questions, which can improve the accuracy of the obtained target answer and thus improve the accuracy of question-and-answer. Attached Figure Description
[0045] Figure 1 This is a flowchart of the intelligent question-answering method provided in the embodiments of this application;
[0046] Figure 2 yes Figure 1 The flowchart of step S102 in the document;
[0047] Figure 3 yes Figure 1 The flowchart of step S103 in the process;
[0048] Figure 4 yes Figure 1 The flowchart of step S104 in the process;
[0049] Figure 5 yes Figure 1 The flowchart of step S105 in the process;
[0050] Figure 6 yes Figure 1 Another flowchart of step S105 in the process;
[0051] Figure 7 yes Figure 1 Another flowchart of step S105 in the process;
[0052] Figure 8 This is a schematic diagram of the structure of the intelligent question-answering device provided in the embodiments of this application;
[0053] Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0055] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0057] First, let's analyze some of the terms used in this application:
[0058] Artificial intelligence (AI) is a new branch of computer science that studies, develops, and applies theories, methods, technologies, and systems to simulate, extend, and expand human intelligence. It aims to understand the essence of intelligence and produce intelligent machines that can react in a way similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thought. Furthermore, AI utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to achieve optimal results.
[0059] Natural Language Processing (NLP): NLP uses computers to process, understand, and utilize human language (such as Chinese and English). NLP is a branch of artificial intelligence and an interdisciplinary field of computer science and linguistics, often referred to as computational linguistics. NLP includes syntactic analysis, semantic analysis, and discourse understanding. It is commonly used in machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, intent recognition, information extraction and filtering, text classification and clustering, sentiment analysis, and opinion mining. It involves data mining, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computation.
[0060] Information Extraction (NER) is a text processing technique that extracts factual information such as entities, relationships, and events from natural language text and outputs it as structured data. Information extraction is a technique for extracting specific information from text data. Text data is composed of specific units, such as sentences, paragraphs, and chapters. Text information is composed of smaller, specific units, such as characters, words, phrases, sentences, paragraphs, or combinations of these units. Extracting noun phrases, names of people, and place names from text data is an example of text information extraction. Of course, text information extraction techniques can extract information of various types.
[0061] In the field of intelligent question answering, the business scenarios for intelligent question answering are numerous and complex. Most current intelligent question answering methods respond to user requests through fixed question and answer templates. This approach often fails to effectively address users' actual needs and suffers from low accuracy in question answering. Therefore, how to improve the accuracy of question answering has become an urgent technical problem to be solved.
[0062] Based on this, embodiments of this application provide an intelligent question-answering method, an intelligent question-answering device, an electronic device, and a storage medium, aiming to improve the accuracy of question-answering.
[0063] The intelligent question-answering method, intelligent question-answering device, electronic device, and storage medium provided in this application are specifically described through the following embodiments. First, the intelligent question-answering method in this application embodiment is described.
[0064] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0065] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0066] The intelligent question-answering method provided in this application relates to the field of artificial intelligence technology. The intelligent question-answering method provided in this application can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the intelligent question-answering method, but is not limited to the above forms.
[0067] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0068] Figure 1 This is an optional flowchart of the intelligent question-answering method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S105.
[0069] Step S101: Obtain the target user's target question;
[0070] Step S102: Based on the preset entity recognition model, perform entity recognition on the target problem to obtain the target problem features;
[0071] Step S103: Calculate the matching degree between the target question features and multiple reference questions in the preset question-answer corpus to obtain multiple question matching values, and take the question matching value with the largest value as the target matching value;
[0072] Step S104: Based on the target matching value and the preset question matching threshold, filter multiple preset candidate matching methods to obtain the target matching method;
[0073] Step S105: Generate an answer to the target question based on the target matching method to obtain the target answer.
[0074] Steps S101 to S105 of this embodiment involve acquiring the target user's target question; performing entity recognition on the target question based on a preset entity recognition model to obtain target question features. This approach can accurately identify the target question features within the target question, reducing interference from other redundant information in question-answer matching and improving the accuracy of question-answer matching. Furthermore, the matching degree between the target question features and multiple reference questions in a preset question-answer corpus is calculated to obtain multiple question matching values. The question matching value with the largest value is taken as the target matching value. This method can conveniently determine the matching degree between multiple reference questions in the preset question corpus and the target question, identifying the target matching value between the reference question with the best matching degree and the target question. Further, multiple preset candidate matching methods are filtered based on the target matching value and a preset question matching threshold to obtain the target matching method. This allows different candidate matching methods to be selected as the target matching method based on different target matching values. Finally, the target answer is generated based on the target matching method. By setting multiple different candidate matching methods in the question-and-answer matching process, the answer can be generated in a targeted manner for different target questions, which can improve the accuracy of the obtained target answer and thus improve the accuracy of question-and-answer.
[0075] In step S101 of some embodiments, a web crawler can be written, and after setting up the data source, data can be crawled in a targeted manner to obtain the target user's target question. Alternatively, the target user's target question can be obtained through other means. The target question includes various questions raised by the target user, such as popular science questions, daily life questions, medical and disease questions, etc., without limitation.
[0076] Before step S102 in some embodiments, the intelligent question answering method further includes a pre-trained entity recognition model, which can be constructed based on a named entity algorithm. The entity recognition model includes a word segmenter and an entity recognition layer. The training process of the entity recognition model may specifically include: obtaining sample questions with entity feature labels, which indicate the question type of the sample questions; segmenting the sample questions using the word segmenter to obtain multiple sample question segments; performing entity recognition on each sample question segment using the entity recognition layer to obtain sample question features; updating the loss function of the entity recognition model according to the similarity between the sample question features and the entity feature labels, until the number of iterations meets a preset iteration condition, stopping the updating of the loss function of the entity recognition model, and obtaining the final entity recognition model.
[0077] Please see Figure 2 In some embodiments, step S102 may include, but is not limited to, steps S201 to S202:
[0078] Step S201: The target question is segmented by a preset word segmenter based on the entity recognition model to obtain the question word segment;
[0079] Step S202: The entity recognition layer based on the entity recognition model performs entity recognition on the question segment to obtain the target question features.
[0080] In step S201 of some embodiments, the preset word segmenter can be the Jieba word segmenter. The required field length, sentence category, etc. can be preset in the Jieba word segmenter in the entity recognition model, so that the target question can be segmented by the Jieba word segmenter to obtain multiple question segments.
[0081] In step S202 of some embodiments, the question segment is feature-classified according to a preset part-of-speech category in the entity recognition layer to obtain question segments with different part-of-speech tags. The segment features corresponding to the question segments are extracted from a preset dictionary to obtain multiple candidate question features. The candidate question features that meet the current business requirements are selected as the target question features. The part-of-speech categories include nouns, verbs, adjectives, etc., and the preset dictionary contains multiple reference segments and the part-of-speech category and segment features of each reference segment. For example, if the target question is "What is the temperature in City A today?", then the target question features identified through the above process are City A (place name feature), today (date feature), and temperature (key feature).
[0082] By using the steps S201 to S202 described above, the characteristics of the target question can be identified more accurately, the interference of other redundant information on question-answer matching can be reduced, and the accuracy of question-answer matching can be improved.
[0083] Please see Figure 3 In some embodiments, step S103 may include, but is not limited to, steps S301 to S303:
[0084] Step S301: Vectorize the features of the target problem to obtain the target problem feature vector, and vectorize each reference problem to obtain multiple reference problem feature vectors;
[0085] Step S302: Based on a preset algorithm, calculate the matching degree between the target problem feature vector and each reference problem feature vector to obtain multiple problem matching values;
[0086] Step S303: The problem matching value with the largest value is taken as the target matching value.
[0087] In step S301 of some embodiments, the target problem features can be vectorized by means of BERT model or the like, and the target problem features can be mapped to a vector space of preset dimension to obtain target problem feature vector. Similarly, each reference problem can be vectorized by means of BERT model or the like, and each reference problem can be mapped to a vector space of preset dimension to obtain multiple reference problem feature vectors.
[0088] In step S302 of some embodiments, the preset algorithm can be a cosine similarity algorithm, a coordinated filtering algorithm, or Euclidean distance, etc., without limitation. Taking the cosine similarity algorithm as an example, when calculating the matching degree between the target problem feature vector and a certain reference problem feature vector, assuming the target problem feature vector is u and the reference problem feature vector is v, the process of calculating the matching degree between the target problem feature vector and this reference problem feature vector according to the formula of the cosine similarity algorithm to obtain the problem matching value can be represented as follows:
[0089]
[0090] In step S303 of some embodiments, the question matching values of all reference questions are compared, the question matching value with the largest value is selected as the target matching value, and the reference question with the largest question matching value is selected as the intermediate question. The intermediate question is the question whose semantic content is closest to the target question, that is, the intermediate question is the standard question of the target question in the preset question-answer corpus.
[0091] For example, if a target user inputs the target question into the customer service robot as "Check today's temperature", and the preset question-and-answer corpus includes reference questions such as "What is today's temperature?", "What is today's date?", and "What is the current time?", then the question that is semantically closest to the target question is "What is today's temperature?".
[0092] Through the above steps S301 to S303, the semantic similarity between multiple reference questions and the target question in the preset question corpus can be determined relatively easily. The reference questions that are most similar to the target question in semantic content are selected from the preset question corpus, and the semantic similarity between the reference questions with the closest semantic content and the target question (i.e., the target matching value) is determined. This enables the question matching method used to obtain the target answer to be determined based on the target matching value, thereby improving the accuracy of the question-answering matching method selection.
[0093] Please see Figure 4 In some embodiments, the problem matching threshold includes a first threshold and a second threshold, wherein the first threshold is greater than the second threshold; the candidate matching methods include a first method, a second method, and a third method; and step S104 may include, but is not limited to, steps S401 to S403:
[0094] Step S401: If the target matching value is greater than or equal to the first threshold and the target matching value is less than or equal to 1, then the first method is used as the target matching method.
[0095] Step S402: If the target matching value is greater than the second threshold and the target matching value is less than the first threshold, then the second method is used as the target matching method.
[0096] Step S403: If the target matching value is greater than or equal to 0 and the target matching value is less than or equal to the second threshold, then the third method is used as the target matching method.
[0097] In step S401 of some embodiments, the specific value of the question matching threshold can be set according to actual business needs and is not limited. For example, the first threshold is a, the second threshold is b, and 0 < b < a < 1. If the target matching value m is greater than or equal to the first threshold and the target matching value is less than or equal to 1, that is, a ≤ m ≤ 1, it indicates that the intermediate questions in the preset question-answering corpus are semantically close to the target question and can be used to replace the target question. Then, the first method is used as the target matching method. The first method is to generate an answer to the target question based on the reference questions and the reference answers corresponding to the reference questions in the preset question corpus.
[0098] In step S402 of some embodiments, if the target matching value m is greater than the second threshold and the target matching value is less than the first threshold, i.e. b < m < a, it indicates that the semantic similarity between the intermediate question in the preset question-and-answer corpus and the target question is generally not clear, and it is uncertain whether the intermediate question is suitable to replace the target question. It is necessary to further determine the intention of the target user. In this case, the second method is used as the target matching method. In the second method, a question confirmation template containing the intermediate question is introduced. This question confirmation template can be understood as a clarification script template. The question confirmation template containing the intermediate question is sent to the target user for confirmation. If the target user confirms that the target question and the intermediate question are consistent, the answer to the target question is generated according to the reference question and the reference answer corresponding to the reference question in the preset question corpus. If the target user confirms that the target question and the intermediate question are inconsistent, the preset default reply data is sent to the target user. This default reply data can be understood as a series of pre-set fallback answers.
[0099] In step S403 of some embodiments, if the target matching value m is greater than or equal to 0 and the target matching value is less than or equal to the second threshold, i.e. 0≤m≤b, the third method is used as the target matching method, indicating that the semantic similarity between the intermediate question in the preset question-and-answer corpus and the target question is poor, and it is not suitable to use the intermediate question to replace the target question. The third method is to generate an answer to the target question based on the question-and-answer data in the preset catch-all corpus and the chat corpus.
[0100] Through the above steps S401 to S403, the semantic proximity between the intermediate question and the target question can be determined relatively easily based on the relationship between the target matching value and the preset question matching threshold. Thus, different candidate matching methods are selected as the target matching methods according to the different semantic proximity. In the question-answering matching process, multiple different candidate matching methods are set, which can generate answers in a targeted manner for different target questions and improve the accuracy of the obtained target answers.
[0101] Please see Figure 5 In some embodiments, step S105 may include, but is not limited to, steps S501 to S503:
[0102] Step S501: If the target matching method is the first method, then call the preset historical problem tree and record the reference problem corresponding to the target matching value as the intermediate problem;
[0103] Step S502: Traverse the historical problem tree and filter the problem nodes in the historical problem tree based on intermediate problems to obtain the filtering results;
[0104] Step S503: Based on the filtering results, the historical answers corresponding to the filtered question nodes are used as the target answers, or the reference answers corresponding to intermediate questions are extracted from the question-and-answer corpus and used as the target answers.
[0105] In step S501 of some embodiments, if the target matching method is the first method, the target matching value m is greater than or equal to the first threshold, and the target matching value is less than or equal to 1, that is, a≤m≤1, it indicates that the intermediate questions in the preset question-answering corpus are semantically close to the target question. Then, the preset historical question tree is invoked, and the reference question corresponding to the target matching value is recorded as the intermediate question. The historical question tree includes multiple historical question nodes, and each historical question node includes at least one historical question and the historical answer corresponding to the historical question.
[0106] In step S502 of some embodiments, the historical question tree is traversed to find historical question nodes that contain the intermediate question. For example, one or more rounds of backtracking are performed to search for node numbers in the historical question tree. To improve question-answering efficiency, only the node numbers of historical question nodes from the previous session can be searched. If multiple rounds of backtracking are performed, and only one historical question node contains the intermediate question in the past multiple sessions, then that historical question node is extracted as the target node. If multiple historical question nodes contain the intermediate question in the past multiple sessions, it is determined whether any of these historical question nodes containing the intermediate question are from the previous session. If so, the historical question node containing the intermediate question from the previous session is taken as the target node; otherwise, the first matched historical question node containing the intermediate question is taken as the target node. If no historical question node contains the intermediate question in the past multiple sessions, the filtering result is empty.
[0107] In step S503 of some embodiments, when the filtering result indicates that a target node exists, the historical answer corresponding to the target node is used as the target answer; if the filtering result indicates that no target node exists, the reference answer corresponding to the intermediate question is extracted from the question-and-answer corpus and used as the target answer.
[0108] By using steps S501 to S503 above, when the target matching value is high, intermediate questions and historical question-and-answer records can be directly used to generate answers, which can effectively improve the efficiency of target answer generation.
[0109] Please see Figure 6 In some embodiments, step S105 may include, but is not limited to, steps S601 to S604:
[0110] Step S601: If the target matching method is the second method, then obtain the question confirmation template based on the reference question corresponding to the target matching value;
[0111] Step S602: Send the question confirmation template to the target user and obtain the response information from the target user based on the question confirmation template;
[0112] Step S603: If the response information indicates that the reference question corresponding to the target matching value is consistent with the target question, then the answer to the target question is generated based on the first method to obtain the target answer;
[0113] Step S604: If the response information is inconsistent with the target question corresponding to the target matching value, then extract the preset default response data and use the default response data as the target answer.
[0114] In step S601 of some embodiments, if the target matching method is the second method, it indicates that the target matching value m is greater than the second threshold and the target matching value is less than the first threshold, that is, when b < m < a, the semantic similarity between the intermediate questions in the preset question-and-answer corpus and the target questions is generally not clear, and it is uncertain whether it is suitable to use the intermediate questions to replace the target questions. It is necessary to further judge the intention of the target user. Therefore, based on the reference questions corresponding to the target matching value, a question confirmation template is obtained. Specifically, the intermediate questions corresponding to the target matching value are extracted and added to the preset clarification script template to obtain the question confirmation template.
[0115] For example, if the intermediate question is "What is the temperature today?", the generated question confirmation template will be "Is the question you want to ask: What is the temperature today?"
[0116] In step S602 of some embodiments, a question confirmation template is sent to the target user, and the response information from the target user based on the question confirmation template is obtained. This response information includes the target user's confirmation of the intermediate question. For example, based on the question confirmation template "Is the question you want to ask: What is today's temperature?", if the target user's response is a confirmation (e.g., yes, correct), then the response information is considered to be consistent with the target question corresponding to the target matching value; if the target user's response is a negative response (e.g., no, no, etc.), then the response information is considered to be inconsistent with the target question corresponding to the target matching value.
[0117] In step S603 of some embodiments, if the response information indicates that the reference question corresponding to the target matching value is consistent with the target question, it indicates that an intermediate question is used to replace the target question, and the first method is used as the target matching method. The first method is to generate an answer to the target question based on the reference questions and corresponding reference answers in a preset question corpus. The specific process of generating an answer using the first method is basically the same as steps S501 to S503 described above, and will not be repeated here.
[0118] In step S604 of some embodiments, if the response information is that the reference question corresponding to the target matching value is inconsistent with the target question, it indicates that there is no reference question in the preset question corpus that can replace the target user's target question. That is, there is currently no suitable reference question and reference answer to reply. Therefore, the preset default reply data is extracted and the default reply data is used as the target answer.
[0119] It's important to understand that the default response data mentioned above can be interpreted as a pre-set series of fallback answers. For example, the default response data for a customer service chatbot could include phrases like "I don't know the answer to this question" or "Let's ask another question," without any specific restrictions.
[0120] Through the above steps S601 to S604, when the target matching value is not high, the intermediate question can be reconfirmed. Based on the response information from the target user, the intermediate question can be used to generate an answer or the default response data can be used as a fallback answer. This can further improve the accuracy and applicability of the question and answer, effectively avoid the lack of a reasonable way to respond when the intermediate question cannot be used to generate an answer, and can better improve the user experience.
[0121] Please see Figure 7 In some embodiments, step S105 may also include, but is not limited to, steps S701 to S705:
[0122] Step S701: If the target matching method is the third method, then obtain the preset fallback corpus and chat corpus, and record the reference question corresponding to the target matching value as the intermediate question;
[0123] Step S702: Match the intermediate question with multiple candidate catch-all questions in the catch-all corpus to obtain the first matching result;
[0124] Step S703: If the first matching result is that there is a candidate catch-all question in the catch-all corpus that matches the intermediate question, then the target answer is determined based on the catch-all corpus;
[0125] Step S704: If the first matching result is that there is no candidate catch question in the catch question corpus that matches the middle question, then the middle question and multiple candidate chat questions in the chat corpus are matched to obtain the second matching result.
[0126] Step S705: Based on the second matching result, determine the target answer based on the casual conversation corpus, or extract the preset default reply data and use the default reply data as the target answer.
[0127] In step S701 of some embodiments, if the target matching method is the third method, then the target matching value m is greater than or equal to 0, and the target matching value is less than or equal to the second threshold, i.e., 0≤m≤b. This indicates that the semantic similarity between the intermediate question in the preset question-and-answer corpus and the target question is poor, and it is not suitable to use the intermediate question to replace the target question. Then, a preset fallback corpus and a chat corpus are obtained, and the reference question corresponding to the target matching value is the intermediate question. The fallback corpus includes multiple preset candidate fallback questions and candidate fallback answers corresponding to the candidate fallback questions. The chat corpus includes multiple preset candidate chat questions and candidate chat answers corresponding to the candidate fallback questions. The fallback corpus is used to guide the target user to select other candidate fallback questions to form an answer when the semantic similarity between the intermediate question and the target question is poor. The chat corpus is used to send some chat questions and answers to the target user when the semantic similarity between the intermediate question and the target question is poor.
[0128] In step S702 of some embodiments, when matching the intermediate question with multiple candidate catch-all questions in the catch-all corpus, the similarity between the intermediate question and each candidate catch-all question can be calculated to obtain a catch-all question similarity value. The similarity calculation process can refer to the matching degree calculation process in step S302, and will not be repeated here. After obtaining the catch-all question similarity value for each candidate catch-all question, the catch-all question similarity value is compared with a preset third threshold. Based on the relationship between the catch-all question similarity value and the third threshold, a first matching result is obtained. When the catch-all question similarity value is greater than or equal to the third threshold, the first matching result indicates that a candidate catch-all question in the catch-all corpus matches the intermediate question; when the catch-all question similarity value is less than the third threshold, the first matching result indicates that no candidate catch-all question in the catch-all corpus matches the intermediate question.
[0129] In step S703 of some embodiments, if the first matching result is that there is a candidate catch-all question in the catch-all corpus that matches the intermediate question, then the candidate catch-all answer corresponding to the candidate catch-all question with the largest catch-all question similarity value is selected as the target answer based on the catch-all question similarity value of each candidate catch-all question.
[0130] In step S704 of some embodiments, if the first matching result is that no candidate catch-all question matches the middle question in the catch-all corpus, then the middle question and multiple candidate chatter questions in the chatter corpus are matched. The similarity between the middle question and each candidate chatter question can be calculated to obtain a chatter question similarity value. The similarity calculation process can refer to the matching degree calculation process in step S302, which will not be repeated here. After obtaining the chatter question similarity value of each candidate chatter question, the chatter question similarity value is compared with a preset fourth threshold. According to the relationship between the chatter question similarity value and the fourth threshold, a second matching result is obtained. When the chatter question similarity value is greater than or equal to the fourth threshold, the second matching result is that there is a chatter catch-all question that matches the middle question in the chatter corpus; when the chatter question similarity value is less than the fourth threshold, the second matching result is that there is no candidate chatter question that matches the middle question in the chatter corpus.
[0131] In step S705 of some embodiments, when the second matching result indicates that a fallback question matches the middle question in the chat corpus, the candidate answer corresponding to the fallback question with the highest similarity value is selected as the target answer based on the chat corpus similarity value of each candidate chat corpus. When the second matching result indicates that no candidate chat corpus matches the middle question, it means that there is no candidate chat corpus in the preset chat corpus that can replace the target user's target question, that is, there is currently no suitable candidate chat corpus and candidate chat corpus answer to reply to. Therefore, preset default reply data is extracted and used as the target answer.
[0132] Through the above steps S701 to S705, when the target matching value is not high, the intermediate question can be reconfirmed. Based on the response information from the target user, the answer can be generated using the candidate fallback answer from the fallback corpus, the candidate casual conversation answer from the casual conversation corpus, or the default response data. This method further improves the accuracy and applicability of question and answer, and can effectively avoid the lack of a reasonable way to respond when the intermediate question cannot be used to generate an answer, thus improving the user experience.
[0133] The intelligent question-answering method of this application obtains the target user's target question; performs entity recognition on the target question based on a preset entity recognition model to obtain target question features, which can more accurately identify the target question features in the target question, reduce the interference of other redundant information on question-answer matching, and help improve the accuracy of question-answer matching. Further, the matching degree of the target question features and multiple reference questions in a preset question-answer corpus is calculated to obtain multiple question matching values, and the question matching value with the largest value is taken as the target matching value. This method can conveniently determine the matching degree between multiple reference questions in the preset question corpus and the target question, and determine the target matching value between the reference question with the best matching degree and the target question. Further, multiple preset candidate matching methods are filtered based on the target matching value and a preset question matching threshold to obtain the target matching method, which can select different candidate matching methods as the target matching method according to different target matching values. Finally, the answer to the target question is generated based on the target matching method to obtain the target answer. By setting multiple different candidate matching methods in the question-answer matching process, the answer can be generated in a targeted manner for different target questions, which can improve the accuracy of the obtained target answer, thereby improving the accuracy of question-answering. This approach enables intelligent question-and-answer services from customer service robots, allowing them to quickly identify the needs of target users and provide corresponding intelligent responses based on those needs. It can achieve functions such as intelligent consultation and intelligent chat, effectively improving service efficiency and user satisfaction.
[0134] Please see Figure 8 This application also provides an intelligent question-answering device that can implement the above-described intelligent question-answering method. The device includes:
[0135] Problem acquisition module 801 is used to acquire the target problem of the target user;
[0136] The entity recognition module 802 is used to perform entity recognition on the target problem based on a preset entity recognition model to obtain the characteristics of the target problem;
[0137] The matching calculation module 803 is used to calculate the matching degree between the target question features and multiple reference questions in the preset question-answer corpus, obtain multiple question matching values, and take the question matching value with the largest value as the target matching value;
[0138] The filtering module 804 is used to filter multiple preset candidate matching methods based on the problem matching data and the preset problem matching threshold to obtain the target matching method;
[0139] The answer generation module 805 is used to generate answers to target questions based on target matching methods, thereby obtaining the target answer.
[0140] The specific implementation of this intelligent question-answering device is basically the same as the specific embodiment of the intelligent question-answering method described above, and will not be repeated here.
[0141] This application also provides an electronic device, which includes: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for communication between the processor and the memory. When the program is executed by the processor, it implements the aforementioned intelligent question-answering method. This electronic device can be any intelligent terminal, including tablet computers, in-vehicle computers, etc.
[0142] Please see Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0143] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0144] The memory 902 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 using the intelligent question-answering method of the embodiments of this application.
[0145] The input / output interface 903 is used to implement information input and output;
[0146] The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0147] Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904);
[0148] The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.
[0149] This application also provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the above-described intelligent question-answering method.
[0150] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0151] The intelligent question-answering method, intelligent question-answering device, electronic device, and computer-readable storage medium provided in this application obtain the target user's target question; perform entity recognition on the target question based on a preset entity recognition model to obtain target question features, which can more accurately identify the target question features in the target question, reduce the interference of other redundant information on question-answering matching, and help improve the accuracy of question-answering matching. Furthermore, the matching degree of the target question features and multiple reference questions in a preset question-answering corpus is calculated to obtain multiple question matching values, and the question matching value with the largest value is taken as the target matching value. This method can conveniently determine the matching degree between multiple reference questions in the preset question corpus and the target question, and determine the target matching value between the reference question with the best matching degree and the target question. Furthermore, based on the target matching value and a preset question matching threshold, multiple preset candidate matching methods are filtered to obtain the target matching method, which can select different candidate matching methods as the target matching method according to different target matching values. Finally, based on the target matching method, answers are generated for the target questions, yielding the target answers. By setting multiple different candidate matching methods during the question-and-answer matching process, targeted answers can be generated for different target questions, improving the accuracy of the obtained target answers and thus enhancing the accuracy of question-and-answer communication. This method enables intelligent question-and-answer services for customer service robots, allowing for rapid identification of target user needs and intelligent provision of corresponding responses based on those needs. It enables functions such as intelligent consultation and intelligent chat, effectively improving service efficiency and user satisfaction.
[0152] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0153] It will be understood by those skilled in the art that Figure 1-7 The technical solutions shown do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0154] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0155] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0156] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0157] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0158] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0159] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0160] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0161] If the integrated unit is implemented as 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 this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0162] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. An intelligent question-answering method, characterized in that, The method includes: The target question for acquiring target users; The target problem is identified based on a preset entity recognition model to obtain the target problem features; The matching degree is calculated for the target question features and multiple reference questions in the preset question-answer corpus to obtain multiple question matching values, and the question matching value with the largest value is taken as the target matching value; Based on the target matching value and a preset question matching threshold, multiple preset candidate matching methods are filtered to obtain the target matching method; based on the target matching method, an answer is generated for the target question to obtain the target answer; The question matching threshold includes a first threshold and a second threshold, wherein the first threshold is greater than the second threshold; the candidate matching methods include a first method, a second method, and a third method; the step of filtering multiple preset candidate matching methods based on the target matching value and the preset question matching threshold to obtain the target matching method includes: If the target matching value is greater than or equal to the first threshold and the target matching value is less than or equal to 1, then the first method is used as the target matching method; if the target matching value is greater than the second threshold and the target matching value is less than the first threshold, then the second method is used as the target matching method; if the target matching value is greater than or equal to 0 and the target matching value is less than or equal to the second threshold, then the third method is used as the target matching method. The step of generating an answer to the target question based on the target matching method to obtain the target answer includes: If the target matching method is the first method, then a preset historical question tree is invoked, and the reference question corresponding to the target matching value is recorded as an intermediate question; the historical question tree is traversed, and the question nodes in the historical question tree are filtered based on the intermediate question to obtain a filtering result; according to the filtering result, the historical answer corresponding to the filtered question node is used as the target answer, or the reference answer corresponding to the intermediate question is extracted from the question-and-answer corpus as the target answer.
2. The intelligent question-answering method according to claim 1, characterized in that, The entity recognition based on the preset entity recognition model is used to perform entity recognition on the target problem to obtain target problem features, including: The target question is segmented using a preset word segmenter based on the entity recognition model to obtain the question segment; The entity recognition layer based on the entity recognition model performs entity recognition on the question segment to obtain the target question features.
3. The intelligent question-answering method according to claim 1, characterized in that, The process of calculating the matching degree between the target question features and multiple reference questions in a preset question-answer corpus to obtain multiple question matching values, and taking the question matching value with the largest value as the target matching value, includes: The target problem features are vectorized to obtain target problem feature vectors, and each reference problem is vectorized to obtain multiple reference problem feature vectors; Based on a preset algorithm, the matching degree of the target problem feature vector and each of the reference problem feature vectors is calculated to obtain multiple problem matching values; The question matching value with the largest numerical value is taken as the target matching value.
4. The intelligent question-answering method according to claim 1, characterized in that, The step of generating an answer to the target question based on the target matching method to obtain the target answer includes: If the target matching method is the second method, then a question confirmation template is obtained based on the reference question corresponding to the target matching value; The question confirmation template is sent to the target user, and the response information from the target user based on the question confirmation template is obtained. If the response information indicates that the reference question corresponding to the target matching value is consistent with the target question, then an answer is generated for the target question based on the first method to obtain the target answer; If the response information is inconsistent with the target question corresponding to the target matching value, then the preset default response data is extracted and the default response data is used as the target answer.
5. The intelligent question-answering method according to any one of claims 1 to 4, characterized in that, The step of generating an answer to the target question based on the target matching method to obtain the target answer includes: If the target matching method is the third method, then the preset fallback corpus and chat corpus are obtained, and the reference question corresponding to the target matching value is recorded as the intermediate question; The intermediate question and multiple candidate catch-all questions in the catch-all corpus are matched to obtain the first matching result; If the first matching result is that there exists a candidate fallback question in the fallback corpus that matches the intermediate question, then the target answer is determined based on the fallback corpus; If the first matching result is that there is no candidate catch-all question in the catch-all corpus that matches the intermediate question, then the intermediate question and multiple candidate chat questions in the chat corpus are matched to obtain a second matching result; Based on the second matching result, the target answer is determined based on the casual conversation corpus, or preset default reply data is extracted and used as the target answer.
6. An intelligent question-and-answer device, characterized in that, The device includes: The issue retrieval module is used to retrieve the target issues of the target users. An entity recognition module is used to perform entity recognition on the target problem based on a preset entity recognition model to obtain the target problem features; The matching calculation module is used to calculate the matching degree between the target question features and multiple reference questions in a preset question-answer corpus, obtain multiple question matching values, and take the question matching value with the largest value as the target matching value; The filtering module is used to filter multiple preset candidate matching methods based on the target matching value and a preset question matching threshold to obtain the target matching method; The answer generation module is used to generate an answer to the target question based on the target matching method, thereby obtaining the target answer; The question matching threshold includes a first threshold and a second threshold, wherein the first threshold is greater than the second threshold; the candidate matching methods include a first method, a second method, and a third method; the step of filtering multiple preset candidate matching methods based on the target matching value and the preset question matching threshold to obtain the target matching method includes: If the target matching value is greater than or equal to the first threshold and the target matching value is less than or equal to 1, then the first method is used as the target matching method; if the target matching value is greater than the second threshold and the target matching value is less than the first threshold, then the second method is used as the target matching method; if the target matching value is greater than or equal to 0 and the target matching value is less than or equal to the second threshold, then the third method is used as the target matching method. The step of generating an answer to the target question based on the target matching method to obtain the target answer includes: If the target matching method is the first method, then a preset historical question tree is invoked, and the reference question corresponding to the target matching value is recorded as an intermediate question; the historical question tree is traversed, and the question nodes in the historical question tree are filtered based on the intermediate question to obtain a filtering result; according to the filtering result, the historical answer corresponding to the filtered question node is used as the target answer, or the reference answer corresponding to the intermediate question is extracted from the question-and-answer corpus as the target answer.
7. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the intelligent question-answering method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the intelligent question-answering method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Automatic question answering method and device, electronic equipment and storage medium
CN113946669A
Answer selection method and device based on artificial intelligence, electronic equipment and medium
CN114020892A