Conversational question-answering method, device, equipment and storage medium combining RPA and AI
By combining RPA and AI technologies, the system receives user questions, extracts and verifies target concepts, and utilizes a convergent classification model and semantic relevance algorithm to solve the problem of unclear concept extraction from user questions. This improves the accuracy of answer recommendations and enhances the user experience of the dialogue question-answering system.
Patent Information
- Application Number
- CN202010840306.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-12-31
- Filing Date
- 2020-08-19
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2040-08-19
AI Technical Summary
In existing technologies, the extraction of user questions lacks clear semantics, which makes it difficult for dialogue question-answering systems to accurately interpret user intent, thus reducing the accuracy of answer recommendations and user experience.
By combining RPA and AI technologies, the system receives user questions, extracts and verifies target concepts, and uses a classification model trained to convergence and a semantic relevance algorithm to determine standard questions and output answers, ensuring the clear semantics of concepts and the accuracy of answers.
It improves the accuracy of answer recommendations in the dialogue question-and-answer system, enhances the user experience, and ensures that the extracted concepts have clear semantics, enabling more accurate parsing of user questions.
Smart Images

Figure CN112035631B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of natural speech processing technology, and in particular to a conversational question-and-answer method, apparatus, device, and storage medium that combines RPA (Robotic Process Automation) and AI (Artificial Intelligence). Background Art
[0002] Robotic Process Automation (RPA) simulates human operations on computers through specific "robot software" and automatically executes process tasks according to rules. Artificial Intelligence (AI) is a technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. With the maturity of artificial intelligence technology, natural language processing technology has also developed rapidly. Natural speech processing technology is an important direction in the field of artificial intelligence. It enables effective communication between people and computers using natural language. The dialogue question-answering system is a system that uses natural language understanding technology as its core to analyze and process user questions and generate correct answers.
[0003] When a conversational question-answering system analyzes user questions, it is necessary to extract concepts from the user questions. In the prior art, after extracting concepts from user questions, the extracted concepts do not have clear semantics in the field to which the user questions belong, resulting in an inability to accurately parse the user questions. The answers recommended to users are less accurate, which reduces the user's experience of using the question system. Summary of the invention
[0004] The embodiments of the present application provide a conversational question-and-answer method, apparatus, device, and storage medium that combine RPA and AI, which solves the problem in the prior art that after extracting concepts from user questions, the extracted concepts do not have clear semantics in the field to which the user questions belong, resulting in the inability to accurately extract the concepts from the user questions, and thus inaccurate analysis of the user questions, poor accuracy of the answers recommended to the user, and reduced user experience of the question system.
[0005] In a first aspect, an embodiment of the present application provides a conversational question-answering method combining RPA and AI, including: the method is applied to an electronic device, and the method includes:
[0006] Receive a target question input by a user; determine at least one candidate question corresponding to the target question; extract a target concept in the target question; verify the target concept; if the target concept passes the verification, determine a standard question based on the semantic relevance between the target question and each of the candidate questions; determine a target answer corresponding to the target question based on the standard question; and output the target answer.
[0007] Furthermore, in the above method, extracting the target concept in the target question includes:
[0008] The target question is canonically matched with each question template in a preset target domain question template set; a question template matching the target question is obtained; an additional text between the target question and the matching question template is determined; and the additional text is determined as a target concept.
[0009] Furthermore, the method as described above, if there is no question template matching the target question in the target domain question template set, further includes:
[0010] Perform keyword matching on the target problem and each candidate concept in the pre-constructed target domain concept set; obtain the candidate concept with the highest matching degree with the target problem; and determine the candidate concept with the highest matching degree as the target concept of the target problem.
[0011] Furthermore, in the above method, the verifying the target concept includes:
[0012] The target classification model trained to convergence is used to identify the type of the target concept; if the target concept is of a clear semantic type, it is determined that the target concept has passed the verification; if the target concept has no clear semantic type, it is determined that the target concept has not passed the verification.
[0013] Furthermore, in the above method, the step of using the target classification model trained to convergence to perform type recognition on the target concept includes:
[0014] Extracting semantically relevant features of the target concept; inputting each of the semantically relevant features into a target classification model trained to convergence, so as to identify the type of the target concept according to each of the semantically relevant features; and outputting the category of the target concept through the target classification model trained to convergence.
[0015] Furthermore, in the above method, the semantically relevant features of the target concept include any one or more of the following:
[0016] The average word frequency, the average bi-word frequency, the average IDF of words in the target domain, whether it is a single word, the average IDF of words in the general domain, and the average cohesion of adjacent words.
[0017] Furthermore, in the method as described above, the target classification model trained to convergence is a target GBDT decision tree model trained to convergence.
[0018] Furthermore, the method as described above, before using the classification model trained to convergence to perform type recognition on the target concept, further comprises:
[0019] A multi-fold cross-validation algorithm is used to select multiple candidate GBDT decision tree models trained to convergence to obtain a selected candidate GBDT decision tree model trained to convergence;
[0020] The selected candidate GBDT decision tree model trained to convergence is determined as the target GBDT decision tree model trained to convergence.
[0021] Furthermore, the method as described above, before selecting a plurality of candidate GBDT decision tree models trained to convergence using a multi-fold cross-validation algorithm, further comprises:
[0022] Determine each group of first training samples and test samples corresponding to the multi-fold cross-validation algorithm; use each group of first training samples to train the corresponding initial candidate GBDT decision tree model; determine whether the trained candidate GBDT decision tree model satisfies the first preset model convergence condition; if it is determined that the first preset model convergence condition is met, then determine the candidate GBDT decision tree model that meets the first preset model convergence condition as the candidate GBDT decision tree model trained to convergence.
[0023] Further, in the method as described above, the multi-fold cross-validation algorithm is used to select multiple candidate GBDT decision tree models trained to convergence to obtain the selected candidate GBDT decision tree model trained to convergence, including:
[0024] Each group of test samples is used to test the corresponding candidate GBDT decision tree model trained to convergence; the candidate GBDT decision tree model trained to convergence with the highest accuracy is determined as the selected candidate GBDT decision tree model trained to convergence.
[0025] Furthermore, the method as described above, before determining the standard question according to the semantic relevance between the target question and each of the candidate questions, further comprises:
[0026] Extract candidate concepts from each of the candidate questions; and calculate the semantic relevance between the target question and each of the candidate questions based on the verified target concept and the candidate concepts in each of the candidate questions.
[0027] Furthermore, in the above method, the step of calculating the semantic relevance between the target question and each of the candidate questions based on the verified target concept and the candidate concepts in each of the candidate questions includes:
[0028] Determine the semantic feature data corresponding to the target concept after the verification and the candidate concepts in each of the candidate questions; input the semantic feature data corresponding to the target concept after the verification and the semantic feature data corresponding to the candidate concepts in each of the candidate questions into a preset WMD algorithm model to output the semantic relevance between the target question and each of the candidate questions.
[0029] Furthermore, in the above method, the step of determining the semantic feature data corresponding to the target concept after verification and the candidate concepts in each of the candidate questions includes:
[0030] Determine the word vectors corresponding to the target concept after the verification and the candidate concepts in each of the candidate questions; determine the IDF values of the target concept after the verification and the candidate concepts in each of the candidate questions in the target field common word set; determine the product of the word vector corresponding to the target concept after the verification and the corresponding IDF value as the semantic feature data corresponding to the target concept after the verification; determine the product of the word vector corresponding to the candidate concept in each of the candidate questions and the corresponding IDF value as the semantic feature data corresponding to the candidate concept in each of the candidate questions.
[0031] Furthermore, the method as described above, before determining the target concept after verification and the word vectors corresponding to the candidate concepts in each of the candidate questions, further includes:
[0032] Construct a target domain concept set; cluster each candidate concept in the target domain concept set to obtain a representative concept; calculate the word vector corresponding to each representative concept to form a representative concept word vector set.
[0033] Furthermore, in the above method, the determining of the target concept after the verification and the word vectors corresponding to the candidate concepts in each of the candidate questions includes:
[0034] The target concept after verification and the word vector corresponding to the candidate concept in each of the candidate questions are obtained from the representative concept word vector set.
[0035] Furthermore, in the above method, constructing the target domain concept set includes:
[0036] Obtain a preset target domain question set; extract the candidate concepts in each candidate question in the target domain question set; if the preset concept set convergence condition is not met, expand each question template in the preset target domain question template set, and execute the extraction of the candidate concepts in each candidate question in the target domain question set; if the preset concept set convergence condition is met, construct the target domain concept set according to each candidate concept.
[0037] Furthermore, the method as described above, after extracting the candidate concepts in each candidate question in the target domain question set, further comprises:
[0038] The concepts to be selected are verified to delete the concepts that fail the verification.
[0039] Furthermore, in the above method, clustering the candidate concepts in the target domain concept set to obtain representative concepts includes:
[0040] The candidate concepts that meet the alignment conditions in the target domain concept set are determined as the same candidate concept; the same candidate concepts and other candidate concepts in the target domain concept set are determined as candidate concepts; and the candidate concepts are clustered to obtain representative concepts.
[0041] Furthermore, in the above method, clustering the candidate concepts to obtain representative concepts includes:
[0042] The candidate concepts are clustered using the HDBSCAN clustering algorithm to obtain a candidate concept at each cluster center; and the candidate concept at each cluster center is determined as a representative concept.
[0043] Furthermore, in the above method, the step of calculating the word vectors corresponding to the representative concepts to form a representative concept word vector set includes:
[0044] Obtain at least one representative knowledge point question, each representative knowledge point question includes a corresponding representative concept; use a Fasttext model trained to convergence to encode each concept in each of the representative knowledge point questions to obtain a word vector for each concept; obtain the corresponding representative concept word vector from the word vector of each concept in each representative knowledge point question to form a representative concept word vector set.
[0045] Furthermore, in the above method, before encoding each concept in each of the representative knowledge point questions using the Fasttext model trained to convergence to obtain the word vector of each concept, the method further includes:
[0046] A second training sample is obtained, where the second training sample is a training knowledge point problem in a target domain knowledge base; an initial Fasttext model is trained using the second training sample; and it is determined whether the trained Fasttext model satisfies a second preset model convergence condition; if it is determined that the second preset model convergence condition is satisfied, the Fasttext model that satisfies the second preset model convergence condition is determined as the Fasttext model trained to convergence.
[0047] Furthermore, the method as described above, after obtaining the corresponding word vector representing the concept from the word vector of each concept representing the knowledge point question to form a representative concept word vector set, further includes:
[0048] The inner product values between the word vectors of each representative concept are calculated respectively; the inner product values of the word vectors of each representative concept are determined as the corresponding semantic relevance; and the target domain concept relationship network is constructed according to each representative concept and the corresponding semantic relevance.
[0049] Furthermore, in the above method, constructing the target domain concept relationship network according to each of the representative concepts and the corresponding semantic relevance includes:
[0050] Each of the representative concepts is determined as a node of a graph structure in the target domain concept relationship network; and the semantic relevance between each of the representative concepts is determined as a relationship value of an edge between nodes of the corresponding graph structure.
[0051] In a second aspect, an embodiment of the present application provides a conversation question-and-answer device combining RPA and AI, including: the device is located in an electronic device, and the device includes:
[0052] A target question receiving module is used to receive a target question input by a user; a candidate question determining module is used to determine at least one candidate question corresponding to the target question; a concept extraction module is used to extract a target concept in the target question; a concept verification module is used to verify the target concept; a standard question determining module is used to determine a standard question based on the semantic relevance between the target question and each of the candidate questions if the target concept passes the verification; a target answer determining module is used to determine a target answer corresponding to the target question based on the standard question; and a target answer output module is used to output the target answer.
[0053] Furthermore, in the above-mentioned device, the concept extraction module is specifically used for:
[0054] The target question is canonically matched with each question template in a preset target domain question template set; a question template matching the target question is obtained; an additional text between the target question and the matching question template is determined; and the additional text is determined as a target concept.
[0055] Furthermore, in the device as described above, the concept extraction module is also used to perform keyword matching on the target question with each candidate concept in a pre-constructed target domain concept set if there is no question template matching the target question in the target domain question template set; obtain the candidate concept with the highest matching degree with the target question; and determine the candidate concept with the highest matching degree as the target concept of the target question.
[0056] Furthermore, in the above-mentioned device, the concept verification module is specifically used for:
[0057] The target classification model trained to convergence is used to identify the type of the target concept; if the target concept is of a clear semantic type, it is determined that the target concept has passed the verification; if the target concept has no clear semantic type, it is determined that the target concept has not passed the verification.
[0058] Furthermore, in the above-mentioned device, the concept verification module, when using the target classification model trained to convergence to perform type recognition on the target concept, is specifically used to:
[0059] Extracting semantically relevant features of the target concept; inputting each of the semantically relevant features into a target classification model trained to convergence, so as to identify the type of the target concept according to each of the semantically relevant features; and outputting the category of the target concept through the target classification model trained to convergence.
[0060] Furthermore, in the above device, the semantically relevant features of the target concept include any one or more of the following:
[0061] The average word frequency, the average bi-word frequency, the average IDF of words in the target domain, whether it is a single word, the average IDF of words in the general domain, and the average cohesion of adjacent words.
[0062] Furthermore, in the device as described above, the target classification model trained to convergence is a target GBDT decision tree model trained to convergence.
[0063] Furthermore, in the above-mentioned device, the concept verification module is also used for:
[0064] A multi-fold cross-validation algorithm is used to select multiple candidate GBDT decision tree models trained to convergence to obtain a selected candidate GBDT decision tree model trained to convergence; the selected candidate GBDT decision tree model trained to convergence is determined as the target GBDT decision tree model trained to convergence.
[0065] Furthermore, in the above-mentioned device, the concept verification module, before selecting multiple candidate GBDT decision tree models trained to convergence using a multi-fold cross-validation algorithm, is also used to:
[0066] Determine each group of first training samples and test samples corresponding to the multi-fold cross-validation algorithm; use each group of first training samples to train the corresponding initial candidate GBDT decision tree model; determine whether the trained candidate GBDT decision tree model satisfies the first preset model convergence condition; if it is determined that the first preset model convergence condition is met, then determine the candidate GBDT decision tree model that meets the first preset model convergence condition as the candidate GBDT decision tree model trained to convergence.
[0067] Further, in the above-mentioned device, the concept verification module, when adopting a multi-fold cross-validation algorithm to select multiple candidate GBDT decision tree models trained to convergence to obtain the selected candidate GBDT decision tree model trained to convergence, is specifically used to:
[0068] Each group of test samples is used to test the corresponding candidate GBDT decision tree model trained to convergence; the candidate GBDT decision tree model trained to convergence with the highest accuracy is determined as the selected candidate GBDT decision tree model trained to convergence.
[0069] Furthermore, in the above-mentioned device, the concept extraction module is further used to: extract candidate concepts from each of the candidate questions. The semantic relevance calculation module is used to calculate the semantic relevance between the target question and each of the candidate questions based on the verified target concept and the candidate concepts in each of the candidate questions.
[0070] Furthermore, in the above-mentioned device, the semantic relevance calculation module is specifically used for:
[0071] Determine the semantic feature data corresponding to the target concept after the verification and the candidate concepts in each of the candidate questions; input the semantic feature data corresponding to the target concept after the verification and the semantic feature data corresponding to the candidate concepts in each of the candidate questions into a preset WMD algorithm model to output the semantic relevance between the target question and each of the candidate questions.
[0072] Furthermore, in the above-mentioned device, the semantic relevance calculation module, when determining the semantic feature data corresponding to the target concept after the verification and the candidate concept in each of the candidate questions, is specifically used to:
[0073] Determine the word vectors corresponding to the target concept after the verification and the candidate concepts in each of the candidate questions; determine the IDF values of the target concept after the verification and the candidate concepts in each of the candidate questions in the target field common word set; determine the product of the word vector corresponding to the target concept after the verification and the corresponding IDF value as the semantic feature data corresponding to the target concept after the verification; determine the product of the word vector corresponding to the candidate concept in each of the candidate questions and the corresponding IDF value as the semantic feature data corresponding to the candidate concept in each of the candidate questions.
[0074] Furthermore, the device as described above also includes: a word vector set construction module, which is used to construct a target domain concept set; clustering each candidate concept in the target domain concept set to obtain a representative concept; calculating the word vector corresponding to each representative concept to form a representative concept word vector set.
[0075] Furthermore, in the above-mentioned device, the semantic relevance calculation module, when determining the target concept after the verification and the word vector corresponding to the candidate concept in each of the candidate questions, is specifically used to:
[0076] The target concept after verification and the word vector corresponding to the candidate concept in each of the candidate questions are obtained from the representative concept word vector set.
[0077] Furthermore, in the above-mentioned device, the word vector set construction module is specifically used to:
[0078] Obtain a preset target domain question set; extract the candidate concepts in each candidate question in the target domain question set; if the preset concept set convergence condition is not met, expand each question template in the preset target domain question template set, and execute the extraction of the candidate concepts in each candidate question in the target domain question set; if the preset concept set convergence condition is met, construct the target domain concept set according to each candidate concept.
[0079] Furthermore, in the above-mentioned device, the concept verification module is also used for:
[0080] The concepts to be selected are verified to delete the concepts that fail the verification.
[0081] Furthermore, in the above-mentioned device, the word vector set construction module, when clustering the candidate concepts in the target domain concept set to obtain the representative concept, is specifically used to:
[0082] The candidate concepts that meet the alignment conditions in the target domain concept set are determined as the same candidate concept; the same candidate concepts and other candidate concepts in the target domain concept set are determined as candidate concepts; and the candidate concepts are clustered to obtain representative concepts.
[0083] Furthermore, in the above-mentioned device, the word vector set construction module, when clustering the candidate concepts to obtain the representative concepts, is specifically used to:
[0084] The candidate concepts are clustered using the HDBSCAN clustering algorithm to obtain a candidate concept at each cluster center; and the candidate concept at each cluster center is determined as a representative concept.
[0085] Furthermore, in the above-mentioned device, the word vector set construction module, when calculating the word vector corresponding to each representative concept to form the representative concept word vector set, is specifically used to:
[0086] Obtain at least one representative knowledge point question, each representative knowledge point question includes a corresponding representative concept; use a Fasttext model trained to convergence to encode each concept in each of the representative knowledge point questions to obtain a word vector for each concept; obtain the corresponding representative concept word vector from the word vector of each concept in each representative knowledge point question to form a representative concept word vector set.
[0087] Furthermore, in the above-mentioned device, the word vector set construction module is further used for encoding each concept in each of the representative knowledge point questions by using the Fasttext model trained to convergence to obtain the word vector of each concept:
[0088] A second training sample is obtained, where the second training sample is a training knowledge point problem in a target domain knowledge base; an initial Fasttext model is trained using the second training sample; and it is determined whether the trained Fasttext model satisfies a second preset model convergence condition; if it is determined that the second preset model convergence condition is satisfied, the Fasttext model that satisfies the second preset model convergence condition is determined as the Fasttext model trained to convergence.
[0089] Furthermore, the above device further includes: a concept relationship network construction module, which is used to:
[0090] The inner product values between the word vectors of each representative concept are calculated respectively; the inner product values of the word vectors of each representative concept are determined as the corresponding semantic relevance; and the target domain concept relationship network is constructed according to each representative concept and the corresponding semantic relevance.
[0091] Furthermore, in the above-mentioned device, the concept relationship network construction module, when constructing the target domain concept relationship network according to each of the representative concepts and the corresponding semantic relevance, is specifically used to:
[0092] Each of the representative concepts is determined as a node of a graph structure in the target domain concept relationship network; and the semantic relevance between each of the representative concepts is determined as a relationship value of an edge between nodes of the corresponding graph structure.
[0093] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0094] Memory, processor and computer program;
[0095] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in any one of the first aspects.
[0096] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement a method as described in any one of the first aspects.
[0097] It should be understood that the contents described in the above summary of the invention are not intended to limit the key or important features of the embodiments of the present application, nor are they intended to limit the scope of the present application. Other features of the present application will become easy to understand through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0099] Figure 1 This is an application scenario diagram of the conversational question-answering method combining RPA and AI that can implement the embodiment of the present application;
[0100] Figure 2 A flowchart of a conversational question-and-answer method combining RPA and AI provided in Example 1 of the present application;
[0101] Figure 3 A flowchart of a conversational question-and-answer method combining RPA and AI provided in Example 2 of the present application;
[0102] Figure 4 A flowchart of step 201 in the conversational question-answering method combining RPA and AI provided in Embodiment 2 of the present application;
[0103] Figure 5 A flowchart of step 202 in the conversational question-answering method combining RPA and AI provided in Example 2 of the present application;
[0104] Figure 6 A flowchart of step 223 in the conversational question-and-answer method combining RPA and AI provided in Embodiment 2 of the present application;
[0105] Figure 7 A flowchart of step 203 in the conversational question-answering method combining RPA and AI provided in Example 2 of the present application;
[0106] Figure 8 A flowchart of step 205 in the conversational question-answering method combining RPA and AI provided in Example 2 of the present application;
[0107] Fig. 9 A flowchart of extracting a target concept from a target question in step 206 in a conversational question-answering method combining RPA and AI provided in Example 2 of the present application;
[0108] Fig.10 A flowchart of step 207 in the conversational question-answering method combining RPA and AI provided in Embodiment 2 of the present application;
[0109] Fig.11 A flowchart of step 2071 in the conversational question-answering method combining RPA and AI provided in Embodiment 2 of the present application;
[0110] Fig.12 This is a flowchart of step 2070 in the conversational question-and-answer method combining RPA and AI provided in Example 3 of the present application;
[0111] Fig.13 This is a flowchart of step 2070e in the conversational question-and-answer method combining RPA and AI provided in Example 3 of the present application;
[0112] Fig.14 This is a flowchart of step 208 in the conversational question-and-answer method combining RPA and AI provided in Example 3 of the present application;
[0113] Fig.15 This is a flowchart of step 2081 in the conversational question-and-answer method combining RPA and AI provided in Example 3 of the present application;
[0114] Fig.16 A flowchart of the conversation question-and-answer method provided in Example 3 of the present application;
[0115] Fig.17 This is a flowchart of step 306 in the conversational question-and-answer method combining RPA and AI provided in Example 3 of the present application;
[0116] Fig.18 This is a schematic diagram of the target domain concept relationship network in Example 3 of the present application;
[0117] Fig.19 This is a schematic diagram of the structure of a conversational question-and-answer device combining RPA and AI provided in Example 4 of the present application;
[0118] Fig. 20 This is a schematic diagram of the structure of a conversational question-and-answer device combining RPA and AI provided in Example 5 of the present application;
[0119] Fig.21 It is a block diagram of an electronic device used to implement the conversational question-and-answer method combining RPA and AI in an embodiment of the present application. DETAILED DESCRIPTION
[0120] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.
[0121] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the embodiments 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 implementation of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. 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.
[0122] First of all, it is necessary to explain the terms in the description of this application. Among them, in the description of this application, the term "target question" refers to the question that the user needs to ask. For example, an electronic device is equipped with an application with a dialogue question and answer function that combines RPA and AI. When the user needs to ask questions, open the corresponding application and enter the operation interface of the application. Send the questions to be asked to the electronic device by voice, text or other means. The question that needs to be asked can be understood as the target question.
[0123] In the description of this application, the term "candidate question" refers to a question obtained from a question set in a certain field, which matches the question that the user needs to ask. The matching question is the candidate question, where the field of the question set is the same as the field of the question that the user needs to ask.
[0124] In the description of this application, the term "concept" refers to the text that distinguishes a question from its matching question template. The term "target concept" refers to the text that distinguishes a target question from its matching question template. The term "candidate concept" refers to the text that distinguishes a candidate question from its matching question template.
[0125] In the description of this application, the term "standard question" refers to the candidate question that is most semantically similar to the question the user wants to ask among the candidate questions. The term "target answer" refers to the answer corresponding to the standard question. For example, a certain domain problem set has multiple questions to be selected and the answers corresponding to each question to be selected. After the standard question is known, the answer corresponding to the standard question can be searched from the answers corresponding to each question to be selected in the domain problem set, and the answer corresponding to the standard question can be determined as the answer corresponding to the target question, and the answer corresponding to the target question is the target answer.
[0126] In the description of this application, the term "verification" refers to verifying whether the concept extracted from the problem has clear semantics. For example, when the concept has clear semantics, it can be considered that the concept has passed the verification, which can ensure that the extracted concept is a concept with clear semantics; when the concept does not have clear semantics, it can be considered that the concept has failed the verification.
[0127] It is necessary to introduce the application scenarios of the dialogue question-answering method combining RPA and AI provided in the embodiment of the present application. Figure 1As shown, in the application scenario corresponding to the conversational question-and-answer method combining RPA and AI provided in the embodiment of the present application, an application program that combines the conversational question-and-answer function of RPA and AI is installed in the electronic device. The type of such application program equipped with the conversational question-and-answer function combining RPA and AI is not limited, such as a maternal and child type application program, an early childhood education type application program, and the like. Specifically, the user opens the application program of this function in the electronic device, and inputs the target question in the form of text, voice, etc. through the operation interface of the application program of this function. The electronic device receives the target question input by the user, parses the target question, extracts the target concept in the target question; verifies the target concept; if the target concept passes the verification, determines the standard question according to the semantic relevance between the target question and each candidate question. After determining the standard question, the target answer corresponding to the target question is determined according to the standard question, and the target answer is output. When outputting the target answer, it can be output in the form of text and / or pictures on the operation interface, and the text and / or pictures can also be output in the form of voice, etc. As Figure 1 In the example, assuming that the application is a maternal and child type application, and the target question input by the user through voice is "What should I do if I have a puerperal infection?", the target question "What should I do if I have a puerperal infection?" can be displayed in the operation interface of the application of this function of the electronic device. The user clicks the "Search" button on the operation interface, and the electronic device executes the dialogue question-and-answer method combining RPA and AI provided in this application, and after determining the target answer to the target question, outputs the target answer and displays it in the operation interface. The target answer is "Drug treatment, surgical treatment, other treatments, etc." The dialogue question-and-answer method combining RPA and AI provided in the embodiment of the present application verifies the target concept in the target question after obtaining the target question, and determines the target answer according to the target question only after the target concept is verified. This ensures that the extracted target concept is a target concept with clear semantics, and thus can accurately parse the target question. And because the semantic relevance between the target question and at least one candidate question is used to determine the standard question corresponding to the target question, the target question and the standard question can be more closely matched, and the standard question matching the target question can be accurately determined, and then the answer corresponding to the standard question can be determined as the answer to the target question, which can make the determined target answer more accurate, improve the accuracy of the answers recommended to users, and greatly improve the user experience of the question-and-answer system.
[0128] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0129] Embodiment 1
[0130] Figure 2 This is a flowchart of a conversational question-and-answer method combining RPA and AI provided in Example 1 of the present application, as shown in FIG. Figure 2 As shown, the execution subject of the embodiment of the present application is a dialogue question-answering device combining RPA and AI, and the dialogue question-answering device can be integrated in an electronic device. Then the dialogue question-answering method combining RPA and AI provided in this embodiment includes the following steps.
[0131] Step 101: receiving a target question input by a user.
[0132] In this embodiment, an application program that combines RPA and AI with a dialogue question-and-answer function is installed in the electronic device. For example, it can be a maternal and child type application program, an early childhood education type application program, etc. When the user needs to ask a question, he / she opens the corresponding application program and enters the operation interface of the application program. The question to be asked is sent to the electronic device through voice, text or other means. The question to be asked is the target question.
[0133] If the user asks the target question in voice form, the user clicks the button for recording voice on the operation interface, and the corresponding sound receiving component in the electronic device records the voice. The electronic device receives the target question in voice form, performs semantic analysis on the target question in voice form, obtains the target question in text form, and displays the target question in text form on the operation interface.
[0134] If the user asks the target question in text form, the user inputs the target question in the text input box of the operation interface, so that the electronic device receives the target question in text form.
[0135] It is understandable that the operation interface may also include a button for triggering the dialogue question-and-answer method combining RPA and AI in this embodiment, such as a "search" button on the operation interface.
[0136] Step 102: Determine at least one candidate question corresponding to the target question.
[0137] In this embodiment, the corresponding target domain question set may be stored in the backend server of each application equipped with the dialogue question-and-answer function combining RPA and AI. Alternatively, the target domain question set may be downloaded to an electronic device, and all the questions in the target domain that have been successfully searched for answers are stored in the target domain question set. The questions stored in the target domain question set may be referred to as questions to be selected.
[0138] As an optional implementation, in this embodiment, after the electronic device obtains the target question, each candidate question in the corresponding target field question set is obtained, and the target question can be matched with each candidate question according to preset sentence rules, and the candidate question that meets the preset sentence rules is determined as a candidate question for the target question.
[0139] Or as another implementation, in this embodiment, after the electronic device obtains the target problem, each candidate problem in the corresponding target field problem set is obtained, and the target problem and each candidate problem can be similarly matched using a preset matching algorithm, and the candidate problems that meet the similarity requirements are determined as candidate problems.
[0140] In this implementation, the preset matching algorithm is not limited in this embodiment. Determining whether the similarity requirement is met can be determining whether the matching degree between the target question and each candidate question is greater than a preset matching degree threshold. If it is greater than the preset matching degree threshold, it is determined that the target question and the candidate question meet the similarity requirement, otherwise it is determined that the similarity requirement is not met. It can be understood that determining whether the similarity requirement is met can also be other ways, which are not limited in this embodiment.
[0141] Step 103: extract the target concept in the target question.
[0142] As an optional implementation, in this embodiment, the method of extracting the target concept in the target question can be to first set a target domain question template set according to the problem characteristics of the target domain, and the target domain question template set includes multiple question templates. Then, the target question is matched with each question template in the preset target domain question template set. After the regular matching, the question template matching the target question is obtained. The text that is distinguished between the target question and the matching question template is determined, and the distinguished text is the additional text between the target question and the matching question template. Finally, the additional text is determined as the target concept corresponding to the target question.
[0143] As another optional implementation, in this embodiment, the method for extracting the target concept in the target question can also be: extracting the target concept in the target question by performing keyword matching between the target question and each candidate concept in a pre-constructed target domain concept set. Specifically, first obtain the target domain concept set. The target domain concept set includes multiple candidate concepts. Then perform keyword matching between the target question and each candidate concept in the pre-constructed target domain concept set. After keyword matching, obtain the candidate concept with the highest matching degree with the target question, and determine the candidate concept with the highest matching degree as the target concept of the target question.
[0144] It can be understood that the two optional implementations can be combined to extract the target concept in the target question.
[0145] Step 104, verifying the target concept.
[0146] It is worth noting that after extracting the target concept in the target question using each optional implementation in step 103 , the extracted target concept may not have clear semantics.
[0147] The target concepts extracted from the target questions in maternal and child care applications are used as an example. The target concepts extracted from the target questions using the above two optional implementations include, for example: "Please advise", "Now", "Almost", "Confinement", "Early Pregnancy", "Cold and Fever", etc. In the field of maternal and child care, "Please advise", "Now", and "Almost" are concepts without clear semantics. However, "Confinement", "Early Pregnancy", and "Cold and Fever" are concepts with clear semantics. Therefore, the extracted target concepts need to be verified to determine whether the target concepts have clear semantics.
[0148] The verification method for the target concept is not limited in this embodiment.
[0149] Step 105: If the target concept passes the verification, a standard question is determined based on the semantic relevance between the target question and each candidate question.
[0150] In this embodiment, after determining that the target concept has clear semantics and passes verification, the semantic relevance between the target question and each candidate question is calculated, and the standard question is determined from at least one candidate question based on the semantic relevance between the target question and each candidate question.
[0151] As an optional implementation, in this embodiment, the method for calculating the semantic relevance between the target question and each candidate question can be: the target question and each candidate question are respectively formed into corresponding question pairs, which are input into a preset semantic matching model, and the preset semantic matching model calculates the semantic relevance between each question pair, and outputs the semantic relevance between each question pair. The preset semantic matching model is not limited in this embodiment.
[0152] Alternatively, as another optional implementation, in this embodiment, the target concept in the target question can be extracted and the candidate concepts in each candidate question can be extracted; the semantic relevance between the target concept and the candidate concepts in each candidate question can be determined; and the standard question can be determined from the candidate questions based on the semantic relevance between the target concept and the candidate concepts in each candidate question.
[0153] It is understandable that the method for calculating the semantic relevance between the target question and each candidate question may also be other methods, which are not limited in this embodiment.
[0154] Step 106, determining a target answer corresponding to the target question based on the standard question.
[0155] In this embodiment, the answer corresponding to each candidate question in the target domain question set can be stored in the background server of each application equipped with the dialogue question-and-answer function combining RPA and AI. Alternatively, the answer corresponding to each candidate question in the target domain question set can be downloaded to an electronic device. After the standard question is determined, the answer corresponding to the standard question is searched from the answers corresponding to each candidate question in the target domain question set, and the answer corresponding to the standard question is determined as the answer corresponding to the target question. The answer corresponding to the target question is the target answer.
[0156] Step 107, output the target answer.
[0157] In this embodiment, the target answer may be output in the form of text, picture or voice, or the target answer may be output in the form of at least two of the text, picture or voice in combination, which is not limited in this embodiment.
[0158] The dialogue question-and-answer method combining RPA and AI provided in this embodiment receives the target question input by the user; determines at least one candidate question corresponding to the target question; extracts the target concept in the target question; verifies the target concept; if the target concept passes the verification, determines the standard question according to the semantic relevance between the target question and each candidate question; determines the target answer corresponding to the target question according to the standard question; and outputs the target answer. Since the target concept in the target question is verified after the target question is obtained, and the target answer is determined according to the target question only after the target concept verification passes, it can ensure that the extracted target concept is a target concept with clear semantics, and then the target question can be accurately parsed. And since the semantic relevance between the target question and at least one candidate question is used to determine the standard question corresponding to the target question, the target question and the standard question can be more closely matched, and the standard question matching the target question is accurately determined, and then the answer corresponding to the standard question is determined as the answer to the target question, which can make the determined target answer more accurate, improve the accuracy of the answer recommended to the user, and greatly improve the user's experience of the question-and-answer system.
[0159] Embodiment 2
[0160] Figure 3 This is a flowchart of a conversational question-and-answer method combining RPA and AI provided in Example 2 of this application, such as Figure 3 As shown, the conversational question-answering method combining RPA and AI provided in this embodiment is a further refinement of steps 102 to 105 based on the conversational question-answering method combining RPA and AI provided in Example 1 of the present application. The conversational question-answering method combining RPA and AI provided in this embodiment includes the following steps.
[0161] Step 201: construct a target domain concept set.
[0162] As an optional implementation, in this embodiment, constructing the target domain concept set in step 201 is an iterative process. The specific iterative process includes the following steps:
[0163] As an optional implementation, Figure 4 As shown, step 201 includes the following steps:
[0164] Step 2011, obtaining a preset target domain problem set.
[0165] The target domain question set is consistent with the type of application equipped with the dialogue question-answering function combining RPA and AI. For example, if the type of application is maternal and child type, the target domain question set is the maternal and child field question set. For another example, if the type of application is early childhood education field, the target domain question set is the early childhood education field question set.
[0166] In this embodiment, if it is determined that the user has successfully searched for an answer to a question in the target domain, the candidate questions for which the answers have been successfully searched are stored, and a target domain question set is constructed from the candidate questions. The target domain question set can also be stored in the background server or electronic device of the corresponding application so that the electronic device can obtain the preset target domain question set.
[0167] Step 2012: extract the concepts to be selected from each of the questions to be selected in the problem set in the target domain.
[0168] As an optional implementation, in this embodiment, step 2012 includes the following steps:
[0169] Step 2012a, performing canonical matching on each candidate question and each question template in the preset target domain question template set.
[0170] Step 2012b, obtaining a question template that matches each question to be selected.
[0171] Step 2012c, determining the additional text between each candidate question and the matching question template.
[0172] Step 2012d, determining the added text as the corresponding concept to be selected.
[0173] This is explained in conjunction with step 2012a to step 2012d. In this embodiment, a target domain question template set is first set according to the problem characteristics of the target domain, and the target domain question template set includes multiple question templates. Each question to be selected is then canonically matched with each question template in the preset target domain question template set. After the canonically matched, a question template matching each question to be selected is obtained. The text that is distinguished between each question to be selected and the matching question template is determined. The distinguished text is the added text between the question to be selected and the matching question template. Finally, the added text is determined as the concept to be selected corresponding to the question to be selected.
[0174] Among them, the regular matching is regular expression matching, and the specific regular matching method will not be repeated in this embodiment.
[0175] In this embodiment, the target domain is the maternal and infant domain, and the selected question is "symptoms of oligohydramnios" as an example, and steps 2012a to 2012d are exemplarily described:
[0176] First, the question templates in the target domain question template set are illustrated with three examples, and the three question templates are: (1) (.*?) symptoms; (2) (.*?) Can I take medicine; (3) (.*?) How to treat. Then, for the candidate question, the candidate question is matched with each question template in the preset target domain question template set, and the matching question template is determined to be "(.*?) symptoms", and the candidate question "symptoms of oligohydramnios" and the matching question template are determined to be "(.*?) symptoms". The added text is "oligohydramnios", and "oligohydramnios" is determined as the candidate concept of the candidate question.
[0177] Step 2012e: if there is no question template matching each candidate question in the target domain question template set, keyword matching is performed between each candidate question and each key concept in the pre-constructed target domain key concept set.
[0178] It is understandable that since the question templates in the preset target domain question template set are limited and cannot cover the question-asking habits of all users, there is a situation where there is no question template matching each candidate question in the target domain question template set. Therefore, if there is no question template matching each candidate question in the target domain question template set, a keyword matching method is used to determine the candidate concepts in each candidate question.
[0179] Step 2012f, obtaining the key concept with the highest matching degree with each candidate question.
[0180] Step 2012g, determining the key concept with the highest matching degree as the candidate concept for each candidate question.
[0181] In conjunction with step 2012e to step 2012g, the method of using keyword matching to determine the candidate concepts in each candidate question is described. First, a target domain key concept set can be constructed based on common concepts in the target domain. The target domain key concept set includes multiple target domain key concepts. Then, keyword matching is performed on each candidate question with each key concept in the pre-constructed target domain key concept set. After keyword matching, the key concept with the highest matching degree with each candidate question is obtained, and the key concept with the highest matching degree is determined as the candidate concept corresponding to the candidate question.
[0182] Among them, the keyword matching method can be broad matching, precise matching, etc., and the keyword matching method is not limited in this embodiment.
[0183] In this embodiment, the target domain is the maternal and infant domain, and the selected question is "what to do if the baby spits up milk" as an example, and steps 2012e to 2012g are exemplarily described:
[0184] First, the key concepts included in the key concept set in the maternal and infant field are exemplified, including "baby", "mom", "baby spitting up milk", "baby coughing", "baby drooling", etc. Then, for the candidate question, the candidate question is matched with the key concepts in the key concept set of the target field. The matching degree with "baby" is 30%, the matching degree with "mom" is 1%, the matching degree with "baby spitting up milk" is 80%, and the matching degree with "baby coughing" is 31%. Finally, the key concept with the highest matching degree with the candidate question is "baby spitting up milk", and "baby spitting up milk" is determined as the candidate concept corresponding to the candidate question "what to do if the baby spit up milk".
[0185] Step 2013, verify the concepts to be selected, and delete the concepts to be selected that fail the verification.
[0186] In this embodiment, the method of verifying the selected concept is the same as the method of verifying the target concept in step 207 of the present application, which will not be described in detail here. Please refer to the detailed description of verifying the target concept in step 207.
[0187] After the candidate concepts are verified, if a candidate concept fails the verification, the candidate concept that fails the verification is deleted.
[0188] Step 2014, determining whether the preset concept set convergence condition is met, if the preset concept set convergence condition is not met, executing step 2015, otherwise executing step 2016.
[0189] Step 2015: Expand each question template in the preset target domain question template set.
[0190] It should be noted that after executing step 2015, continue to execute step 2012.
[0191] Specifically, in this embodiment, in order to make the selected concepts in the constructed target domain concept set richer and more accurate, the concept set convergence condition is pre-set. After the selected concepts in each selected problem are extracted according to step 2012, it is determined whether the preset concept set convergence condition is met. If the preset concept set convergence condition is not met, step 2015 is performed, the number of iterations is increased by 1, and step 2012 is continued. After the preset concept set convergence condition is met, step 2016 is performed.
[0192] The preset concept set convergence condition may be that the number of iterations reaches a preset number of iterations, or may be other concept set convergence conditions, which are not limited in this embodiment.
[0193] Step 2016: construct a target domain concept set based on each candidate concept.
[0194] In this embodiment, the candidate concepts extracted from each candidate question in the target domain question set are verified, and after the candidate concepts that fail the verification are deleted, the target domain concept set is formed by the candidate concepts that pass the verification.
[0195] Step 202: cluster the candidate concepts in the target domain concept set to obtain representative concepts.
[0196] In this embodiment, since there are many candidate concepts in the target domain concept set, it is necessary to cluster the candidate concepts to obtain representative concepts.
[0197] As an optional implementation, Figure 5 As shown, step 202 includes the following steps:
[0198] Step 2021, determine the candidate concepts that meet the alignment conditions in the target domain concept set as the same candidate concept.
[0199] In this embodiment, each candidate concept in the target domain concept set is aligned head to tail according to the number of words, and it can be determined whether the alignment condition is met between the two candidate concepts. If the percentage of the aligned words between the two candidate concepts in the total number of words in the corresponding candidate concepts is greater than the preset alignment percentage threshold, it is determined that the alignment condition is met between the two candidate concepts, otherwise it is determined that the alignment condition is not met.
[0200] For example, the preset percentage threshold is 70%. The candidate concepts are: "polyhydramnios" and "excessive amniotic fluid". After the head-to-tail alignment, the percentage of the aligned words in the total number of words in the candidate concepts is 75%. If it is greater than 70%, the two candidate concepts are determined to be the same category of candidate concepts, and any one of them can be used to represent them. For example, "polyhydramnios" can be used to represent it.
[0201] Step 2022: determine each of the same candidate concepts and other candidate concepts in the target domain concept set as candidate concepts.
[0202] Step 2023: cluster the candidate concepts to obtain representative concepts.
[0203] In this embodiment, the same candidate concept and other candidate concepts are uniformly determined as candidate concepts. The candidate concepts are clustered using a preset clustering algorithm to form cluster centers, and the candidate concepts at each cluster center are determined as representative concepts.
[0204] As an optional implementation, Figure 6 As shown, step 2023 includes the following steps:
[0205] Step 2023a, clustering the candidate concepts using the HDBSCAN clustering algorithm to obtain the candidate concepts of each cluster center.
[0206] Step 2023b, determining the candidate concept of each cluster center as the representative concept.
[0207] Furthermore, in this embodiment, each candidate concept is input into the HDBSCAN clustering algorithm, the parameters in the HDBSCAN clustering algorithm are set, and the HDBSCAN clustering algorithm is used to perform semantic relevance clustering on the candidate concepts to form each type of candidate concept set, and the candidate concept at the cluster center corresponding to each candidate concept set is obtained. The candidate concept at the cluster center can best represent the candidate concept set of this type, so the candidate concept at the cluster center is determined as the representative concept of this type of candidate concept. When the HDBSCAN clustering algorithm is used for clustering, the number of categories finally clustered is the number of representative concepts.
[0208] In this embodiment, the biggest advantage of the HDBSCAN clustering algorithm over the DBSCAN clustering algorithm is that it does not require the user to select the radius R of the clustering circle and the minimum number of core point coverage points MinPts, but only needs to set the size of the minimum generated cluster, and the HDBSCAN clustering algorithm can automatically recommend the optimal clustering result. Therefore, using the HDBSCAN clustering algorithm to cluster candidate concepts can cluster candidate concepts more quickly and accurately to obtain representative concepts.
[0209] Step 203, calculating the word vector corresponding to each representative concept to form a representative concept word vector set.
[0210] As an optional implementation, Figure 7 As shown, step 203 includes the following steps:
[0211] Step 2031, obtaining at least one representative knowledge point question, each representative knowledge point question including a corresponding representative concept.
[0212] In this embodiment, the target domain knowledge base is a structured knowledge base that organizes the selected questions in the target domain problem set according to the knowledge points. The knowledge point questions in the target domain knowledge base are divided into a training set and a test set. The knowledge point questions in the training set are used to train the initial Fasttext model to obtain a Fasttext model trained to convergence. Representative knowledge point questions are obtained in the test set. Among them, the representative knowledge point questions include representative concepts.
[0213] Step 2032, using the Fasttext model trained to convergence to encode each concept in each representative knowledge point question to obtain a word vector for each concept.
[0214] In this embodiment, the representative concepts in each representative knowledge point question can be marked, and each representative knowledge point question can be input into a Fasttext model trained to convergence. Before classifying each representative knowledge point question, the Fasttext model trained to convergence performs word segmentation on each representative knowledge point question and encodes each concept after the word segmentation to obtain a word vector for each concept.
[0215] Step 2033, obtaining the corresponding word vector representing the concept from the word vector of each concept representing the knowledge point question to form a representative concept word vector set.
[0216] In this embodiment, the corresponding word vector of the representative concept is obtained from the word vector of each corresponding concept according to the tag of the representative concept in each representative knowledge point question. The word vector of each representative concept forms a representative concept word vector set. And the word vector set of the representative concept is stored.
[0217] In this embodiment, when calculating the word vector corresponding to each representative concept to form a representative concept word vector set, since the representative concept word vector is obtained by encoding the representative concept using the Fasttext model trained to convergence, the Fasttext model trained to convergence can accurately classify the representative knowledge point questions, so it is also possible to accurately encode the representative concepts before classifying the representative knowledge point questions, thereby improving the accuracy of the representative concept word vector.
[0218] It is worth noting that if there is no Fasttext model trained to convergence, before step 2032, a step of training the initial Fasttext model is also included. The step of training the initial Fasttext model is defined as step 2030, and step 2030 includes the following steps:
[0219] Step 2030a: obtaining a second training sample, where the second training sample is a training knowledge point question in the target domain knowledge base.
[0220] The target domain knowledge base is a structured knowledge base that organizes the selected questions in the target domain problem set according to the knowledge points. The training set of the target domain knowledge base includes a set of similar knowledge point questions and knowledge point category labels for each type of knowledge point. The training samples in the training set of the target domain knowledge base are the second training samples.
[0221] For example, "What to do if there is too much amniotic fluid", "How to deal with too much amniotic fluid", "Should I see a doctor if there is too much amniotic fluid" are a set of similar knowledge point questions, and the knowledge point category label of this set of similar knowledge point questions is "How to deal with too much amniotic fluid". Another example is "The cause of too much amniotic fluid", "Why is there too much amniotic fluid" is another set of similar knowledge point questions, and the knowledge point category label of this set of similar knowledge point questions is "The cause of too much amniotic fluid".
[0222] Therefore, in this embodiment, knowledge point questions can be extracted from the target domain knowledge base as second training samples, and each second training sample includes a corresponding knowledge point question and a corresponding knowledge point category label.
[0223] Step 2030b: Use the second training sample to train the initial Fasttext model.
[0224] Step 2030c, determining whether the trained Fasttext model satisfies the second preset model convergence condition, if so, executing step 2030d, otherwise continuing to execute step 2030b.
[0225] Step 2030d: determine the Fasttext model that meets the second preset model convergence condition as the Fasttext model trained to convergence.
[0226] The description is given in conjunction with step 2030b-step 2030d. Specifically, in the present embodiment, the Fasttext model is a text classification model. The initial Fasttext model is a Fasttext model after the parameters in the Fasttext model are initialized. The second training sample is input into the initial Fasttext model, the initial Fasttext model is trained, and the parameters in the initial Fasttext model are adjusted. In each iteration process, it is determined whether the trained Fasttext model satisfies the second preset model convergence condition. If the second preset model convergence condition is met, the Fasttext model that satisfies the second preset model convergence condition is determined as the Fasttext model trained to convergence. If it is determined that the second preset model convergence condition is not met, the next iteration is entered, and step 2030b is continued to be executed to continue training the Fasttext model until the second preset model convergence condition is met.
[0227] Among them, the second preset model convergence condition may be that the number of iterations reaches the second preset number of iterations, or may be that the corresponding loss function reaches the minimum. In this embodiment, the second preset model convergence condition is not limited.
[0228] Step 204: receiving a target question input by a user.
[0229] In this embodiment, the implementation of step 204 is similar to the implementation of step 101 in the first embodiment of the present application, and will not be described in detail here.
[0230] Step 205: Determine at least one candidate question corresponding to the target question.
[0231] As an optional implementation, Figure 8 As shown, in this embodiment, step 205 includes the following steps:
[0232] Step 2051 , performing similarity matching between the target question and each candidate question in the preset target domain question set.
[0233] Step 2052: determine the unselected questions that meet the similarity requirement as candidate questions.
[0234] Furthermore, in this embodiment, the target question and each candidate question are formed into a question pair and input into a preset matching algorithm, and each question pair is matched for similarity using the preset matching algorithm, and the matching degree corresponding to each question pair is output. If the matching degree of a certain question pair is greater than the preset matching degree threshold, it is determined that the similarity requirement is met, and the candidate question in the question pair is the candidate question corresponding to the target question. If the matching degree of a certain question pair is less than or equal to the preset matching degree threshold, it is determined that the similarity requirement is not met, and the candidate question in the question pair is not the candidate question corresponding to the target question. In this way, at least one candidate question for the target question is determined.
[0235] In this embodiment, the determination of at least one candidate question corresponding to the target question is exemplified: if the target question is "what to do if the baby spits up milk", then through steps 2051 to 2052, at least one candidate question corresponding to the target question is determined to be "what to do if the baby chokes on milk", "what to do if the baby spits up milk", and "what to do if the baby has milk curds". And the matching degrees of these three candidate questions become smaller in sequence.
[0236] In this embodiment, the target question is matched with each candidate question in the preset target domain question set for similarity, and the candidate questions that meet the similarity requirements are determined as candidate questions, so that candidate questions with a high similarity to the target question can be pre-screened.
[0237] Step 206: extract the target concept in the target question and extract the candidate concepts in each candidate question.
[0238] In this embodiment, the method of extracting the target concept in the target question is similar to the method of extracting the candidate concepts in each candidate question, so step 206 is described by taking the method of extracting the target concept in the target question as an example.
[0239] As an optional implementation, Fig. 9 As shown, in this embodiment, extracting the target concept in the target question in step 206 includes the following steps:
[0240] Step 2061 , performing canonical matching on the target question and each question template in the preset target domain question template set.
[0241] Step 2062: Obtain a question template that matches the target question.
[0242] Step 2063: determine the additional text between the target question and the matching question template.
[0243] Step 2064, determine the added text as the target concept.
[0244] This is explained in conjunction with step 2061 to step 2064. In this embodiment, a target domain question template set is first set according to the problem characteristics of the target domain, and the target domain question template set includes multiple question templates. Then, the target question is matched with each question template in the preset target domain question template set. After the regular matching, a question template matching the target question is obtained. The text that is distinguished between the target question and the matching question template is determined. The distinguished text is the added text between the target question and the matching question template. Finally, the added text is determined as the target concept corresponding to the target question.
[0245] Step 2065: If there is no question template matching the target question in the target domain question template set, keyword matching is performed between the target question and each candidate concept in the pre-constructed target domain concept set.
[0246] It is understandable that since the question templates in the preset target domain question template set are limited and cannot cover the question-asking habits of all users, there is a situation where there is no question template matching the target question in the target domain question template set. Therefore, if there is no question template matching the target question in the target domain question template set, the target concept in the target question is determined by keyword matching.
[0247] Step 2066, obtaining the candidate concept with the highest matching degree with the target question.
[0248] Step 2067, determining the candidate concept with the highest matching degree as the target concept of the target problem.
[0249] In conjunction with steps 2065 to 2067, the method of determining the target concept in the target question by keyword matching is described. First, a target domain concept set is obtained. The target domain concept set includes multiple candidate concepts. Then, keyword matching is performed between the target question and each candidate concept in the pre-constructed target domain concept set. After keyword matching, the candidate concept with the highest matching degree with the target question is obtained, and the candidate concept with the highest matching degree is determined as the target concept of the target question.
[0250] Step 207, verifying the target concept.
[0251] It is worth noting that the candidate concepts in each candidate question can also be verified in the same verification method as the target concept.
[0252] As an optional implementation, in this embodiment, if Fig.10 As shown, step 207 includes the following steps:
[0253] Step 2071, using the target classification model trained to convergence to perform type recognition on the target concept.
[0254] Optionally, since the target GBDT decision tree model has a good effect on text classification, in this embodiment, the target classification model trained to convergence is a target GBDT decision tree model trained to convergence.
[0255] Alternatively, if Fig.11 As shown, step 2071 includes the following steps:
[0256] Step 2071a, extracting semantically relevant features of the target concept.
[0257] Optionally, the semantically relevant features of the target concept include any one or more of the following:
[0258] The average word frequency, the average bi-word frequency, the average IDF of words in the target domain, whether it is a single word, the average IDF of words in the general domain, and the average cohesion of adjacent words.
[0259] The specific steps of extracting the average word frequency of the target concept are as follows: first, the target concept is segmented to form at least one target word, the frequency of each target word in a pre-constructed word set is determined, and the average frequency of all target words in the target concept is calculated to obtain the average word frequency of the target concept.
[0260] In this embodiment, the pre-constructed word set is constructed by segmenting a large amount of text and then using a frequent item mining algorithm to count the frequency of frequent words in the large amount of text. The pre-constructed word set includes the frequency of each word. The greater the frequency of a word in the word set, the greater the probability that the word is a frequent item.
[0261] The specific method of extracting the average frequency of the two words of the target concept is as follows: first, the target concept is segmented, and each two consecutive target words are determined as a corresponding target two words. The frequency of each target two word in the pre-constructed two-word set is determined, and the average frequency of all target two words in the target concept is calculated to obtain the average frequency of the two words of the target concept.
[0262] In this embodiment, the pre-constructed bigram set is constructed by segmenting a large amount of text and then using a frequent term mining algorithm to count the frequency of frequent bigrams in the large amount of text. The pre-constructed bigram set includes the frequency of each bigram. The greater the frequency of a bigram in the bigram set, the greater the probability that the bigram is a frequent term.
[0263] The specific steps of extracting the average IDF value of words in the target domain of the target concept are as follows: first, the target concept is segmented to form at least one target word, the IDF value of each target word in a pre-constructed target domain common word set is determined, and the average IDF value of all target words in the target concept is calculated, so as to obtain the average IDF value of words in the target domain of the target concept.
[0264] In this embodiment, in the target domain common word set, there is an IDF value of each common word. Among them, IDF is the inverse document frequency of word frequency. If the IDF value of a common word in the target domain is larger, it means that the importance of the common word is higher. On the contrary, if the IDF value of a common word is smaller, it means that the importance of the common word is lower.
[0265] Among them, whether it is a single word means whether the target concept is a word. If it is a single word, the value of this semantic-related feature is 1, otherwise it is 0.
[0266] The method of extracting the average IDF value of words in the general domain of the target concept is as follows: first, the target concept is segmented to form at least one target word, the IDF value of each target word in a pre-constructed general domain common word set is determined, and the average IDF value of all target words in the target concept is calculated, so as to obtain the average IDF value of words in the general domain of the target concept.
[0267] In this embodiment, the general domain is a domain with a larger scope than the target domain. Similarly, the general domain common word set has an IDF value of each common word in the general domain. If the IDF value of a common word in the general domain is larger, it means that the importance of the common word in the general domain is higher. On the contrary, if the IDF value of a common word is smaller, it means that the importance of the common word in the general domain is lower.
[0268] The specific method of extracting the average cohesion of adjacent words of the target concept is as follows: first, a mutual information dictionary is constructed based on the words in the target field, and the mutual information cohesion of two words is included in the mutual information dictionary. Then, the target concept is segmented to form at least one target word. If there are multiple target words, the values of the mutual information cohesion of two adjacent target words are obtained from the mutual information dictionary, and the average values of the multiple mutual information cohesions are calculated to obtain the average cohesion of adjacent words of the target concept. It is understandable that if there are no two adjacent target words in the mutual information dictionary, the value of the mutual information cohesion of the two adjacent target words is 0.
[0269] Step 2071b, input each semantically relevant feature into the target classification model trained to convergence, so as to perform type recognition on the target concept according to each semantically relevant feature.
[0270] In this embodiment, the semantically relevant features of the target concept are input into the target GBDT decision tree model trained to convergence, and the target GBDT decision tree model trained to convergence classifies the target concept to determine whether the type of the target concept is a type with clear semantics or a type without clear semantics.
[0271] Step 2071c, output the category of the target concept by training the target classification model to convergence.
[0272] In this embodiment, the target classification model trained to convergence outputs the target concept as a type with clear semantics or a type without clear semantics.
[0273] Step 2072: If the target concept is of a clear semantic type, it is determined that the target concept passes verification.
[0274] Step 2073: If the target concept has no clear semantic type, it is determined that the target concept has not passed the verification.
[0275] In this embodiment, if the type of the target concept is a clear semantic type, it means that the target concept has clear semantics in the target field, and the target concept passes the verification, and the target problem can be accurately resolved through the target concept. If the type of the target concept is a type without clear semantics, it means that the target concept has no clear semantics in the target field, and the target concept fails the verification, and the target problem cannot be accurately resolved through the target concept.
[0276] It is worth noting that if there is no target GBDT decision tree model trained to convergence, before step 2071, a step of determining a target GBDT decision tree model trained to convergence is also included. Determining a target GBDT decision tree model trained to convergence is defined as step 2070, such as Fig.12 As shown, step 2070 includes the following steps:
[0277] Step 2070a, determining each group of first training samples and test samples corresponding to the multi-fold cross-validation algorithm.
[0278] The multi-fold cross validation algorithm is an algorithm used when building a model and verifying model parameters in machine learning. In this embodiment, it is used to select the target GBDT decision tree model.
[0279] In this embodiment, the multi-fold cross-validation algorithm first randomly divides the concept sample set into multiple mutually exclusive subsets of the same size. If the number of randomly divided mutually exclusive subsets of the same size is N, then N-1 parts can be randomly selected as training sets, and the remaining 1 part can be used as a test set. The randomly selected N-1 training sets and the remaining 1 test set are used as a set of first training samples and test samples. Then, N-1 parts are randomly selected again as training sets, and the remaining 1 part is used as a test set to form another set of first training samples and test samples.
[0280] The number of folds of the multi-fold cross-validation algorithm is the same as the number of random divisions into multiple mutually exclusive subsets of the same size, both of which are N.
[0281] Step 2070b: Use each group of first training samples to train the corresponding initial candidate GBDT decision tree model.
[0282] Step 2070c, determine whether the trained candidate GBDT decision tree model meets the first preset model convergence condition, if so, execute step 2070d, otherwise continue to execute step 2070b.
[0283] Step 2070d: determine the candidate GBDT decision tree model that meets the first preset model convergence condition as the candidate GBDT decision tree model trained to convergence.
[0284] Each group of first training samples includes training samples of clear semantic types and training samples without clear semantic types.
[0285] For example, for a group of first training samples, the following is an example:
[0286] Training samples with clear semantic types can be: "constipation before delivery", "easy to get angry", "newbie", "frequent hair loss", "sweaty palms", "milk curds in stool", etc.
[0287] Training samples without clear semantic types can be: "now", "almost", "deep suspicion", "want to know", "everyone", "don't know why", etc.
[0288] Further, in this embodiment, the corresponding initial candidate GBDT decision tree model is trained for each group of first training samples. The initial candidate GBDT decision tree models corresponding to each group of first training samples may be the same or different, and this is not limited in this embodiment. The initial candidate GBDT decision tree model is a candidate GBDT decision tree model after the parameters in the candidate GBDT decision tree model are initialized. Each group of first training samples is input into the corresponding initial candidate GBDT decision tree model, the initial candidate GBDT decision tree model is trained, and the parameters in the initial candidate GBDT decision tree model are adjusted. In each iteration process, it is determined whether the trained candidate GBDT decision tree model meets the first preset model convergence condition. If the first preset model convergence condition is met, the candidate GBDT decision tree model that meets the first preset model convergence condition is determined as the candidate GBDT decision tree model trained to convergence. If it is determined that the first preset model convergence condition is not met, the next iteration is entered, and step 2070b is continued to be executed to continue training the candidate GBDT decision tree model until the first preset model convergence condition is reached.
[0289] Among them, the first preset model convergence condition may be that the number of iterations reaches the first preset number of iterations, or may be that the corresponding loss function reaches the minimum. In this embodiment, the first preset model convergence condition is not limited.
[0290] Step 2070e, using a multi-fold cross-validation algorithm to select multiple candidate GBDT decision tree models trained to convergence to obtain selected candidate GBDT decision tree models trained to convergence.
[0291] As an optional implementation, Fig.13 As shown, step 2070e includes the following steps:
[0292] Step 2070e1, using each group of test samples to test the corresponding candidate GBDT decision tree model trained to convergence.
[0293] Step 2070e2, determining the candidate GBDT decision tree model trained to convergence with the highest accuracy as the selected candidate GBDT decision tree model trained to convergence.
[0294] Furthermore, in this embodiment, each group of test samples is input into the corresponding candidate GBDT decision tree model trained to convergence, and the corresponding candidate GBDT decision tree model trained to convergence classifies the corresponding test samples and outputs the classification results. The classification accuracy corresponding to each candidate GBDT decision tree model trained to convergence is calculated based on the classification results. The candidate GBDT decision tree model trained to convergence with the highest accuracy is determined as the selected candidate GBDT decision tree model trained to convergence.
[0295] Step 2070f, determining the selected candidate GBDT decision tree model trained to convergence as the target GBDT decision tree model trained to convergence.
[0296] Step 208: If the target concept passes the verification, the semantic relevance between the target question and each candidate question is calculated based on the verified target concept and the candidate concepts in each candidate question.
[0297] It is understandable that there may be at least one target concept in the target question, and similarly, there may be at least one candidate concept in each candidate question.
[0298] As an optional implementation, Fig.14 As shown, in this embodiment, step 208 includes the following steps:
[0299] Step 2081, determining the semantic feature data corresponding to the target concept after verification and the candidate concepts in each candidate question.
[0300] As an optional implementation, Fig.15 As shown, step 2081 includes the following steps:
[0301] Step 2081a, determine the target concept after verification and the word vector corresponding to the candidate concept in each candidate question.
[0302] As an optional implementation, in this embodiment, step 2081a specifically includes:
[0303] The word vectors corresponding to the target concepts and candidate concepts in each candidate question after verification are obtained from the representative concept word vector set.
[0304] Specifically, in this embodiment, the target concept that has passed the verification and the candidate concepts in each candidate question are queried from the representative concept word vector set. After the target concept that has passed the verification and each candidate concept are queried, the corresponding word vector is obtained.
[0305] Step 2081b, determining the IDF values of the target concepts and candidate concepts in each candidate question in the target domain common word set after verification.
[0306] In this embodiment, a target domain common word set is pre-constructed, and in the target domain common word set, there is an IDF value of each common word. Among them, IDF is the inverse document frequency of word frequency. If the IDF value of a common word in the target domain is larger, it means that the importance of the common word is higher. On the contrary, if the IDF value of a common word is smaller, it means that the importance of the common word is lower.
[0307] Step 2081c, the product of the word vector corresponding to the target concept after verification and the corresponding IDF value is determined as the semantic feature data corresponding to the target concept after verification.
[0308] Step 2081d: Determine the product of the word vector corresponding to the candidate concept in each candidate question and the corresponding IDF value as the semantic feature data corresponding to the candidate concept in each candidate question.
[0309] In this embodiment, the product of the word vector corresponding to the target concept after verification and the corresponding IDF value is determined as the semantic feature data corresponding to the target concept after verification, and the product of the word vector corresponding to the candidate concept in each candidate question and the corresponding IDF value is determined as the semantic feature data corresponding to the candidate concept in each candidate question. If the word vector of the target concept after verification is closer to the word vector of a candidate concept, and the IDF value of the target concept after verification is closer to the IDF value of the candidate concept, it means that the semantic correlation between the target concept after verification and the candidate concept is greater. On the contrary, if the word vector of the target concept after verification is farther away from the word vector of a candidate concept, or the IDF value of the target concept after verification is farther away from the IDF value of a candidate concept, it means that the semantic correlation between the target concept after verification and the candidate concept is smaller.
[0310] Step 2082, input the semantic feature data corresponding to the verified target concept and the semantic feature data corresponding to the candidate concepts in each candidate question into a preset WMD algorithm model to output the semantic relevance between the target question and each candidate question.
[0311] Furthermore, in this embodiment, the product of the word vector corresponding to the verified target concept and the corresponding IDF value, and the product of the word vector corresponding to the candidate concept in each candidate question and the corresponding IDF value are input into the preset WMD algorithm model. The preset WMD algorithm model first determines the correspondence between at least one verified target concept and at least one candidate concept in each candidate question, and then calculates the semantic relevance between each verified target concept and the corresponding candidate concept. Then, the semantic relevance between the target question and the candidate question is determined based on the semantic relevance between at least one verified target concept and the corresponding candidate concept in the candidate question. The semantic relevance between the target question and each candidate question is output from the preset WMD algorithm model.
[0312] Among them, the preset WMD algorithm model calculates the inner product value of the semantic feature data of each target concept after passing the verification and the semantic feature data of the corresponding candidate concept when determining the semantic relevance between each target concept after passing the verification and the corresponding candidate concept, and determines the inner product value as the semantic relevance between the target concept after passing the verification and the corresponding candidate concept.
[0313] It is worth noting that the candidate concepts in each candidate question in step 208 may also be candidate concepts that have passed verification.
[0314] Step 209: determining a standard question based on the semantic relevance between the target question and each candidate question.
[0315] As an optional implementation, in this embodiment, step 209 specifically includes:
[0316] The candidate questions with the greatest semantic relevance are determined as standard questions.
[0317] Furthermore, in this embodiment, since the candidate question with the greatest semantic relevance is the candidate question that is most semantically consistent with the target question, the candidate question with the greatest semantic relevance is determined as the standard question corresponding to the target question.
[0318] Following the example in step 205 above, after steps 207 to 209, the target question "What should I do if my baby spits up milk" and the three candidate questions "What should I do if my baby chokes on milk", "What should I do if my baby spits up milk", and "What should I do if my baby has milk curds" are arranged in descending order according to the semantic relevance, and the candidate questions are "What should I do if my baby spits up milk", "What should I do if my baby chokes on milk", and "What should I do if my baby has milk curds". "What should I do if my baby spits up milk" is determined as the standard question of the target question "What should I do if my baby spits up milk".
[0319] Step 210, determining a target answer corresponding to the target question based on the standard question.
[0320] Step 211, output the target answer.
[0321] In this embodiment, the implementation of step 210 - step 211 is similar to the implementation of step 106 - step 107 in the first embodiment of the present application, and will not be described in detail here.
[0322] In this embodiment, when determining the standard question according to the semantic relevance between the target question and each candidate question, the target concept in the target question and the candidate concepts in each candidate question are extracted, and the target concept is verified. The semantic feature data corresponding to the target concept after verification and the candidate concepts in each candidate question are determined; the semantic feature data corresponding to the target concept after verification and the semantic feature data corresponding to the candidate concepts in each candidate question are input into the preset WMD algorithm model to output the semantic relevance between the target question and each candidate question. The preset WMD algorithm model can be used to first determine the correspondence between at least one target concept after verification and at least one candidate concept in each candidate question, and then calculate the semantic relevance between each target concept after verification and the corresponding candidate concept. Then, the semantic relevance between the target question and the candidate question is determined according to the semantic relevance between at least one target concept after verification and the corresponding candidate concept in the candidate question. There is no need to calculate the semantic relevance between the target concept after verification and each candidate concept in the candidate question in turn, which improves the efficiency of determining the semantic relevance between the target question and each candidate question. And when calculating the semantic relevance between the target question and each candidate question based on the verified target concept and the candidate concepts in each candidate question, the semantic feature data of the verified target concept and the candidate concept not only include the corresponding word vectors, but also add the IDF value as the weight of the word vector, so that the semantic relevance between the determined target question and each candidate question is more accurate.
[0323] In this embodiment, a multi-fold cross-validation algorithm is used to select multiple candidate GBDT decision tree models trained to convergence to obtain a selected candidate GBDT decision tree model trained to convergence; the selected candidate GBDT decision tree model trained to convergence is determined as the target GBDT decision tree model trained to convergence. The target GBDT decision tree model trained to convergence can be made more suitable for verification with the target concept, making the type of the determined target concept more accurate.
[0324] Embodiment 3
[0325] Fig.16 This is a flowchart of a conversational question-and-answer method combining RPA and AI provided in Example 3 of this application, such as Fig.16 As shown, the conversational question-answering method combining RPA and AI provided in this embodiment is based on the conversational question-answering method combining RPA and AI provided in Example 2 of the present application, and also includes the step of constructing a concept relationship network of the target domain. The conversational question-answering method combining RPA and AI provided in this embodiment includes the following steps.
[0326] Step 301: construct a target domain concept set.
[0327] Step 302: cluster the candidate concepts in the target domain concept set to obtain representative concepts.
[0328] Step 303, calculating the word vector corresponding to each representative concept to form a representative concept word vector set.
[0329] In this embodiment, the implementation of steps 301 to 303 is similar to the implementation of steps 201 to 203 in the second embodiment of the present application, and will not be described in detail here.
[0330] Step 304, respectively calculate the inner product value between the word vectors representing each concept.
[0331] Step 305: determine the inner product value of each word vector representing the concept as the corresponding semantic relevance.
[0332] Furthermore, in this embodiment, the inner product value between the word vectors representing the concepts is calculated. If the inner product value between the word vectors representing the concepts is larger, it means that the semantics of the two concepts are more related. On the contrary, if the inner product value between the word vectors representing the concepts is smaller, it means that the semantics of the two concepts are less related. Therefore, the inner product value of the word vectors representing each concept is determined as the corresponding semantic relevance.
[0333] Step 306: construct a target domain concept relationship network based on each representative concept and its corresponding semantic relevance.
[0334] As an optional implementation, Fig.17 As shown, in this embodiment, step 306 includes the following steps:
[0335] Step 3061: determine each representative concept as a node of the graph structure in the target domain concept relationship network.
[0336] Step 3062: Determine the semantic relevance between the representative concepts as the relationship value of the edges between the nodes of the corresponding graph structure.
[0337] exist Fig.18 The figure below shows the concept relationship network of some maternal and child fields. Fig.18 As shown in , each representative concept is determined as a node of the graph structure in the target domain concept relationship network, and the semantic relevance between each representative concept is determined as the relationship value of the edge between the nodes of the corresponding graph structure. Fig.18 Each circle in the graph is a node of the graph structure, and the text in each circle is a representative concept. The line between two representative concepts is the edge between nodes, and the number on the line between two representative concepts is the semantic relevance between the representative concepts, that is, the relationship value of the edge between nodes. It can be understood that in order to clearly see the relationship between the two representative concepts, Fig.18 Only a part of the graph structure representing concepts is shown.
[0338] In order to associate the target domain concept relationship network with the entities in the target domain, an entity library is established in advance according to the target domain. The entity types in the entity library can be determined according to the target domain. For example, in the maternal and child domain, the entities in the entity library are various parts of the body. Fig.18 In the example, the concepts associated with body parts are associated with the corresponding entities.
[0339] Step 307: receiving a target question input by a user.
[0340] Step 308: Determine at least one candidate question corresponding to the target question.
[0341] Step 309: extract the target concept in the target question and extract the candidate concepts in each candidate question.
[0342] In this embodiment, the implementation of steps 307 to 309 is similar to the implementation of steps 204 to 206 in the second embodiment of the present application, and will not be described in detail here.
[0343] Step 310, verifying the target concept.
[0344] Step 311: If the target concept passes the verification, the semantic relevance between the target question and each candidate question is calculated based on the verified target concept and the candidate concepts in each candidate question.
[0345] Step 312: determine the standard question based on the semantic relevance between the target question and each candidate question.
[0346] Step 313, determining a target answer corresponding to the target question based on the standard question.
[0347] Step 314, output the target answer.
[0348] In this embodiment, the implementation of steps 310 to 314 is similar to the implementation of steps 207 to 211 in the second embodiment of the present application, and will not be described in detail here.
[0349] In this embodiment, after calculating the word vector corresponding to each representative concept to form a representative concept word vector set, the inner product value between the word vectors of each representative concept is calculated respectively; the inner product value of the word vector of each representative concept is determined as the corresponding semantic relevance; a target domain concept relationship network is constructed according to each representative concept and the corresponding semantic relevance, and the constructed target domain concept relationship network can be applied to a dialogue question-and-answer system combining RPA and AI. Provide a basis for the application of a dialogue question-and-answer system combining RPA and AI. And through the target domain concept relationship network, the question-and-answer ability, knowledge recommendation ability, and information guidance ability of the dialogue question-and-answer system can be improved.
[0350] In this embodiment, since the concepts to be selected are also verified when constructing the target domain concept set, after the representative concepts are determined by the concepts to be selected to construct the target domain concept relationship network, the representative concepts in the target domain concept relationship network are also verified, so the target domain concept relationship network can be constructed more accurately.
[0351] Embodiment 4
[0352] Fig.19 This is a structural diagram of a conversational question-and-answer device combining RPA and AI provided in Example 4 of the present application, such as Fig.19 As shown, the dialogue question-and-answer device 400 combining RPA and AI provided in this embodiment includes: a target question receiving module 401, a candidate question determination module 402, a concept extraction module 403, a concept verification module 404, a standard question determination module 405, a target answer determination module 406 and a target answer output module 407.
[0353] Among them, the target question receiving module 401 is used to receive the target question input by the user. The candidate question determining module 402 is used to determine at least one candidate question corresponding to the target question. The concept extraction module 403 is used to extract the target concept in the target question. The concept verification module 404 is used to verify the target concept. The standard question determining module 405 is used to determine the standard question according to the semantic relevance between the target question and each candidate question if the target concept passes the verification. The target answer determining module 406 is used to determine the target answer corresponding to the target question according to the standard question. The target answer output module 407 is used to output the target answer.
[0354] The dialogue question-answering device combining RPA and AI provided in this embodiment can perform Figure 2 The technical solution of the method embodiment shown has similar implementation principles and technical effects, which will not be repeated here.
[0355] Embodiment 5
[0356] Fig. 20 This is a structural diagram of a dialogue question-and-answer device combining RPA and AI provided in Example 5 of the present application, such as Fig. 20 As shown, the conversational question-answering device 500 combining RPA and AI provided in this embodiment is based on the conversational question-answering device 400 combining RPA and AI provided in Example 4 of the present application, and further includes: a semantic relevance calculation module 501, a word vector set construction module 502 and a concept relationship network construction module 503.
[0357] Furthermore, the concept extraction module 403 is specifically used for:
[0358] Regular matching is performed on the target question with each question template in the preset target domain question template set; the question template matching the target question is obtained; the additional text between the target question and the matching question template is determined; and the additional text is determined as the target concept.
[0359] Furthermore, the concept extraction module 403 is also used to perform keyword matching on the target question with each candidate concept in the pre-constructed target domain concept set if there is no question template matching the target question in the target domain question template set; obtain the candidate concept with the highest matching degree with the target question; and determine the candidate concept with the highest matching degree as the target concept of the target question.
[0360] Furthermore, the concept verification module 404 is specifically used for:
[0361] The target classification model trained to convergence is used to identify the type of the target concept; if the target concept is of a clear semantic type, it is determined that the target concept has passed the verification; if the target concept has no clear semantic type, it is determined that the target concept has not passed the verification.
[0362] Furthermore, the concept verification module 404, when using the target classification model trained to convergence to perform type recognition on the target concept, is specifically used to:
[0363] Extract semantically relevant features of the target concept; input each semantically relevant feature into a target classification model trained to convergence, so as to identify the type of the target concept according to each semantically relevant feature; output the category of the target concept through the target classification model trained to convergence.
[0364] Furthermore, the semantically relevant features of the target concept include any one or more of the following:
[0365] The average word frequency, the average bi-word frequency, the average IDF of words in the target domain, whether it is a single word, the average IDF of words in the general domain, and the average cohesion of adjacent words.
[0366] Furthermore, the target classification model trained to convergence is a target GBDT decision tree model trained to convergence.
[0367] Furthermore, the concept verification module 404 is also used to:
[0368] A multi-fold cross-validation algorithm is used to select multiple candidate GBDT decision tree models trained to convergence to obtain a selected candidate GBDT decision tree model trained to convergence; the selected candidate GBDT decision tree model trained to convergence is determined as the target GBDT decision tree model trained to convergence.
[0369] Furthermore, the concept verification module 404, before selecting multiple candidate GBDT decision tree models trained to convergence using a multi-fold cross-validation algorithm, is also used to:
[0370] Determine each group of first training samples and test samples corresponding to the multi-fold cross-validation algorithm; use each group of first training samples to train the corresponding initial candidate GBDT decision tree model; determine whether the trained candidate GBDT decision tree model satisfies the first preset model convergence condition; if it is determined that the first preset model convergence condition is met, then determine the candidate GBDT decision tree model that meets the first preset model convergence condition as the candidate GBDT decision tree model trained to convergence.
[0371] Further, the concept verification module 404, when selecting a plurality of candidate GBDT decision tree models trained to convergence using a multi-fold cross-validation algorithm to obtain a selected candidate GBDT decision tree model trained to convergence, is specifically used to:
[0372] Each group of test samples is used to test the corresponding candidate GBDT decision tree model trained to convergence; the candidate GBDT decision tree model trained to convergence with the highest accuracy is determined as the selected candidate GBDT decision tree model trained to convergence.
[0373] Furthermore, the concept extraction module 403 is further used to extract candidate concepts from each candidate question. The semantic relevance calculation module is used to calculate the semantic relevance between the target question and each candidate question based on the verified target concept and the candidate concepts in each candidate question.
[0374] Furthermore, the semantic relevance calculation module 501 is specifically used for:
[0375] Determine the semantic feature data corresponding to the target concept after verification and the candidate concepts in each candidate question; input the semantic feature data corresponding to the target concept after verification and the semantic feature data corresponding to the candidate concepts in each candidate question into a preset WMD algorithm model to output the semantic relevance between the target question and each candidate question.
[0376] Furthermore, the semantic relevance calculation module 501, when determining the semantic feature data corresponding to the target concept and the candidate concepts in each candidate question after verification, is specifically used to:
[0377] Determine the word vectors corresponding to the target concept after verification and the candidate concepts in each candidate question; determine the IDF value of the target concept after verification and the candidate concepts in each candidate question in the common word set of the target field; determine the product of the word vector corresponding to the target concept after verification and the corresponding IDF value as the semantic feature data corresponding to the target concept after verification; determine the product of the word vector corresponding to the candidate concept in each candidate question and the corresponding IDF value as the semantic feature data corresponding to the candidate concept in each candidate question.
[0378] Furthermore, the word vector set construction module 502 is used to construct a target domain concept set; cluster each candidate concept in the target domain concept set to obtain a representative concept; and calculate the word vector corresponding to each representative concept to form a representative concept word vector set.
[0379] Furthermore, the semantic relevance calculation module 501, when determining the word vectors corresponding to the target concept and the candidate concepts in each candidate question after verification, is specifically used to:
[0380] The word vectors corresponding to the target concepts and candidate concepts in each candidate question after verification are obtained from the representative concept word vector set.
[0381] Furthermore, the word vector set construction module 502, when constructing the target domain concept set, is specifically used to:
[0382] Obtain a preset target domain question set; extract the candidate concepts in each candidate question in the target domain question set; if the preset concept set convergence condition is not met, expand each question template in the preset target domain question template set, and execute the extraction of the candidate concepts in each candidate question in the target domain question set; if the preset concept set convergence condition is met, construct the target domain concept set according to each candidate concept.
[0383] Furthermore, the concept verification module 404 is also used to:
[0384] The concepts to be selected are verified to delete the concepts that fail the verification.
[0385] Furthermore, the word vector set construction module 502, when clustering the candidate concepts in the target domain concept set to obtain representative concepts, is specifically used to:
[0386] The candidate concepts that meet the alignment conditions in the target domain concept set are determined as the same candidate concept; each same candidate concept and other candidate concepts in the target domain concept set are determined as candidate concepts; and each candidate concept is clustered to obtain a representative concept.
[0387] Furthermore, the word vector set building module 502, when clustering the candidate concepts to obtain representative concepts, is specifically used to:
[0388] The HDBSCAN clustering algorithm is used to cluster the candidate concepts to obtain the candidate concepts of each cluster center; the candidate concepts of each cluster center are determined as representative concepts.
[0389] Furthermore, the word vector set building module 502, when calculating the word vectors corresponding to each representative concept to form a representative concept word vector set, is specifically used to:
[0390] Obtain at least one representative knowledge point question, each representative knowledge point question includes a corresponding representative concept; use the Fasttext model trained to convergence to encode each concept in each representative knowledge point question to obtain a word vector for each concept; obtain the corresponding representative concept word vector from the word vector of each concept in each representative knowledge point question to form a representative concept word vector set.
[0391] Furthermore, the word vector set building module 502, before using the Fasttext model trained to convergence to encode each concept in each representative knowledge point question to obtain the word vector of each concept, is also used to:
[0392] A second training sample is obtained, where the second training sample is a training knowledge point problem in a target domain knowledge base; the second training sample is used to train an initial Fasttext model; and it is determined whether the trained Fasttext model satisfies a second preset model convergence condition; if it is determined that the second preset model convergence condition is satisfied, the Fasttext model that satisfies the second preset model convergence condition is determined as the Fasttext model trained to convergence.
[0393] Furthermore, the concept relationship network construction module 503 is used to respectively calculate the inner product value between the word vectors of each representative concept; determine the inner product value of the word vector of each representative concept as the corresponding semantic relevance; and construct the target domain concept relationship network according to each representative concept and the corresponding semantic relevance.
[0394] Furthermore, the concept relationship network construction module 503, when constructing the target domain concept relationship network according to each representative concept and the corresponding semantic relevance, is specifically used to:
[0395] Each representative concept is determined as a node of a graph structure in a target domain concept relationship network; the semantic relevance between each representative concept is determined as the relationship value of the edges between the nodes of the corresponding graph structure.
[0396] The dialogue question-answering device combining RPA and AI provided in this embodiment can perform Figure 3 - Fig.17 The technical solution of the method embodiment shown has similar implementation principles and technical effects, which will not be repeated here.
[0397] Embodiment 6
[0398] Fig.21 It is a block diagram of an electronic device used to implement the dialogue question-and-answer method combining RPA and AI in an embodiment of the present application, as shown in Tutu 21. The electronic device provided in Embodiment 6 of the present application includes: a memory 601, a processor 602 and a computer program.
[0399] The computer program is stored in the memory 601 and is configured to be executed by the processor 602 to implement the conversational question-and-answer method combining RPA and AI provided in any one of the first to third embodiments.
[0400] For related instructions, please refer to Figures 2 to 17 The relevant descriptions and effects corresponding to the steps are understood, and no further elaboration is given here.
[0401] Electronic devices are intended to be various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.
[0402] In this embodiment, the memory 601 and the processor 602 are connected via a bus 603 .
[0403] Embodiment 7 of the present application provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the conversational question-and-answer method combining RPA and AI provided in any one of Embodiments 1 to 3.
[0404] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules 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 devices or modules, which can be electrical, mechanical or other forms.
[0405] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0406] In addition, each functional module in each embodiment of the present application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0407] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0408] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0409] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.
[0410] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A conversational question-answering method combining RPA and AI, characterized in that: The method is applied to an electronic device, and the method comprises: Receive target questions input by users; Determine at least one candidate question corresponding to the target question; Extracting the target concept in the target problem includes: Performing regular matching on the target question and each question template in a preset target domain question template set, obtaining a question template matching the target question after regular matching, and determining the text that is distinguished between the target question and the matching question template, and determining the distinguished text as a target concept in the target question; or performing keyword matching between the target question and each candidate concept in the pre-constructed target domain concept set, and determining the candidate concept with the highest matching degree with the target question as the target concept in the target question; Verifying the target concept; If the target concept passes the verification, then: Extracting candidate concepts from each of the candidate questions; Clustering each candidate concept in the target domain concept set to obtain a representative concept; Obtaining at least one representative knowledge point question, each representative knowledge point question including a corresponding representative concept; Using the Fasttext model trained to convergence, each concept in each of the representative knowledge point questions is encoded to obtain a word vector for each concept; Obtain the corresponding word vector representing the concept from the word vector of each concept representing the knowledge point question to form a representative concept word vector set; Calculate the inner product value between the word vectors representing each concept respectively; The inner product value between the word vectors representing each concept is determined as the corresponding semantic relevance; Constructing a target domain concept relationship network according to each of the representative concepts and the corresponding semantic relevance; Acquire the target concept after verification and the word vector corresponding to the candidate concept in each of the candidate questions from the representative concept word vector set; Determine the IDF value of the target concept after the verification and the candidate concept in each of the candidate questions in the target field common word set; Determine the product of the word vector corresponding to the target concept after the verification and the corresponding IDF value as the semantic feature data corresponding to the target concept after the verification; Determine the product of the word vector corresponding to the candidate concept in each of the candidate questions and the corresponding IDF value as the semantic feature data corresponding to the candidate concept in each of the candidate questions; Inputting the semantic feature data corresponding to the verified target concept and the semantic feature data corresponding to the candidate concepts in each of the candidate questions into a preset WMD algorithm model to output the semantic relevance between the target question and each of the candidate questions; Determine a standard question according to the semantic relevance between the target question and each of the candidate questions; Determine a target answer corresponding to the target question according to the standard question; The target answer is output.
2. The method according to claim 1, characterized in that The verifying the target concept includes: The target classification model trained to convergence is used to identify the type of the target concept; If the target concept is of a clear semantic type, it is determined that the target concept passes the verification; If the target concept has no clear semantic type, it is determined that the target concept has failed the verification.
3. The method according to claim 2, characterized in that The method of using the target classification model trained to convergence to perform type recognition on the target concept includes: Extract semantically relevant features of the target concept; Inputting each of the semantically relevant features into a target classification model trained to convergence, so as to perform type recognition on the target concept according to each of the semantically relevant features; The target classification model trained to convergence outputs the category of the target concept.
4. The method according to claim 2 or 3, characterized in that: The target classification model trained to convergence is a target GBDT decision tree model trained to convergence.
5. The method according to claim 4, characterized in that Before the classification model trained to convergence is used to identify the type of the target concept, the method further includes: A multi-fold cross-validation algorithm is used to select multiple candidate GBDT decision tree models trained to convergence to obtain a selected candidate GBDT decision tree model trained to convergence; The selected candidate GBDT decision tree model trained to convergence is determined as the target GBDT decision tree model trained to convergence.
6. The method according to claim 1, characterized in that The step of constructing the target domain concept relationship network according to the representative concepts and the corresponding semantic relevances includes: Each of the representative concepts is determined as a node of a graph structure in the target domain concept relationship network; and the semantic relevance between each of the representative concepts is determined as a relationship value of an edge between nodes of the corresponding graph structure.
7. A conversational question-answering device combining RPA and AI, characterized in that: The device is located in an electronic device, and comprises: A target question receiving module is used to receive a target question input by a user; A candidate question determination module, used to determine at least one candidate question corresponding to the target question; Concept extraction module for: Performing regular matching on the target question and each question template in a preset target domain question template set, obtaining a question template matching the target question after regular matching, and determining the text that is distinguished between the target question and the matching question template, and determining the distinguished text as a target concept in the target question; or performing keyword matching between the target question and each candidate concept in the pre-constructed target domain concept set, and determining the candidate concept with the highest matching degree with the target question as the target concept in the target question; A concept verification module, used to verify the target concept; A standard question determination module is used for, if the target concept passes the verification, then: Extracting candidate concepts from each of the candidate questions; Clustering each candidate concept in the target domain concept set to obtain a representative concept; Obtaining at least one representative knowledge point question, each representative knowledge point question including a corresponding representative concept; Using the Fasttext model trained to convergence, each concept in each of the representative knowledge point questions is encoded to obtain a word vector for each concept; Obtain the corresponding word vector representing the concept from the word vector of each concept representing the knowledge point question to form a representative concept word vector set; Calculate the inner product value between the word vectors representing each concept respectively; The inner product value between the word vectors representing each concept is determined as the corresponding semantic relevance; Constructing a target domain concept relationship network according to each of the representative concepts and the corresponding semantic relevance; Acquire the target concept after verification and the word vector corresponding to the candidate concept in each of the candidate questions from the representative concept word vector set; Determine the IDF value of the target concept after the verification and the candidate concept in each of the candidate questions in the target field common word set; Determine the product of the word vector corresponding to the target concept after the verification and the corresponding IDF value as the semantic feature data corresponding to the target concept after the verification; Determine the product of the word vector corresponding to the candidate concept in each of the candidate questions and the corresponding IDF value as the semantic feature data corresponding to the candidate concept in each of the candidate questions; Inputting the semantic feature data corresponding to the verified target concept and the semantic feature data corresponding to the candidate concepts in each of the candidate questions into a preset WMD algorithm model to output the semantic relevance between the target question and each of the candidate questions; Determine a standard question according to the semantic relevance between the target question and each of the candidate questions; A target answer determination module, used to determine a target answer corresponding to the target question according to the standard question; The target answer output module is used to output the target answer.
8. An electronic device, characterized in that: include: Memory, processor and computer program; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Question answering method and device
CN108595619A