Conversation management method and related device
By constructing Bayesian networks and mapping models, the problems of logic and coherence in intelligent customer service systems were solved, and high-quality output of dialogue content was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU SHIYUAN ELECTRONICS CO LTD
- Filing Date
- 2024-11-11
- Publication Date
- 2026-05-12
AI Technical Summary
Existing intelligent customer service systems often lack logical and coherent responses when faced with dialogue scenarios that require rigorous logic and professional knowledge, resulting in a poor user experience.
A Bayesian network is constructed to map dialogue content to random events through a mapping model. Based on the Bayesian network, standard dialogue is output to achieve the gradual advancement of multi-turn dialogue, thereby ensuring the coherence and logic of the dialogue content.
It improved the logic and professionalism of the dialogue content, thus enhancing the user experience.
Smart Images

Figure CN122019692A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent customer service technology, and in particular to a dialogue management method and related apparatus. Background Technology
[0002] Intelligent customer service systems, as a medium for remote customer service, have become an indispensable tool in daily work.
[0003] Currently, intelligent customer service systems typically generate dialogue content through large-model-based question-and-answer generation schemes. These schemes mainly employ discriminative generation methods to generate responses. However, when encountering dialogues that require comprehension, the responses tend to be rather stiff. Furthermore, this approach lacks dialogue state tracking and dialogue strategies. In scenarios that require rigorous logic and professional knowledge, the responses often lack logic and coherence, resulting in a poor user experience. Summary of the Invention
[0004] To address the aforementioned technical problems, embodiments of this application provide a dialogue management method and related apparatus, which solve the problem of the lack of logicality in the dialogue content output by intelligent dialogue systems, thereby improving the logic and professionalism of the dialogue content and enhancing the quality of the dialogue.
[0005] To address the aforementioned technical problems, the embodiments of this application provide the following technical solutions:
[0006] In a first aspect, embodiments of this application provide a dialogue management method, the method comprising:
[0007] Construct a Bayesian network, in which the Bayesian network is used to construct multiple random variables and a set of standard statements corresponding to each random variable. The set of standard statements includes multiple standard statements, and each random variable corresponds to multiple random events, where the random events are the values of the random variables.
[0008] Obtain the first conversation content, which includes the conversation content entered by the user and the conversation content replied by the virtual agent;
[0009] Based on the pre-trained mapping model, the first dialogue content is mapped to the first random event, where the mapping model is used to map the dialogue content to the random event, and the first random event is one of a plurality of random events.
[0010] According to the Bayesian network, based on the first random event, the first standard dialogue is output, and the second dialogue content is obtained. According to the Bayesian network, based on the second random event, the second dialogue content is mapped to the second random event, and the second standard dialogue is output. Here, the second dialogue content is the next dialogue content of the first dialogue content, and the second random event is one of multiple random events.
[0011] In some embodiments, constructing a Bayesian network includes:
[0012] Construct multiple random variables, including at least one of the following: unplugging / plugging the power cord, resetting the TV, and restoring the system.
[0013] Construct a Bayesian network probability graph and a conditional probability table to obtain a Bayesian network. The Bayesian network consists of a Bayesian network probability graph and a conditional probability table. The nodes of the Bayesian network probability graph are random variables. The Bayesian network probability graph is used to represent the dependencies between random variables. The conditional probability table is used to provide the complete probability distribution of each random variable in a given state of its parent node.
[0014] In some embodiments, the method further includes:
[0015] Training a Bayesian network specifically includes:
[0016] Construct multiple directed graphs, where the nodes of the directed graphs are random events;
[0017] Perform a graph search on the directed graph to generate multiple training data sets;
[0018] The Bayesian network is trained based on the training data to obtain the trained Bayesian network.
[0019] In some embodiments, a standard set of dialogue phrases corresponding to each random variable is constructed, including:
[0020] Obtain the vector set corresponding to the random variable and the vector set corresponding to the historical dialogue data, where the historical dialogue data includes the historical dialogue content of the virtual agent's replies;
[0021] Based on the vector set corresponding to each random variable and the vector set corresponding to the historical dialogue content of the virtual agent's reply, the first set of dialogue scripts corresponding to each random variable is generated.
[0022] Based on the first set of dialogue scripts, the historical dialogue content of the virtual agents' replies is traversed to obtain the second set of dialogue scripts corresponding to each random variable, where the second set of dialogue scripts is the standard set of dialogue scripts.
[0023] In some embodiments, the first set of dialogue scripts includes multiple dialogue scripts. Based on the first set of dialogue scripts, the historical dialogue content of the virtual agent's responses is traversed to obtain the second set of dialogue scripts corresponding to each random variable, including:
[0024] Calculate the Jaccard distance between each dialogue in the first dialogue set corresponding to each random variable and each dialogue in the historical dialogue content of the virtual agent's reply;
[0025] Based on the Jaccard distance, identify dialogues similar to each script and obtain a set of similar dialogues corresponding to each random variable.
[0026] Filter the dialogues that are not associated with the random variables in the similar dialogue set corresponding to each random variable to obtain the second dialogue set corresponding to each random variable.
[0027] In some embodiments, the method further includes:
[0028] The mapping model is trained to obtain a pre-trained mapping model, specifically including:
[0029] Acquire historical dialogue data and divide it into multiple minimum dialogue segments. The historical dialogue data includes the historical dialogue content entered by the user and the historical dialogue content replied by the virtual agent.
[0030] Construct a mapping relationship between each minimum dialogue segment and random events;
[0031] The mapping relationship between all the smallest dialogue segments and random events is used as training data to train the mapping model, resulting in a pre-trained mapping model.
[0032] In some embodiments, constructing a mapping relationship between each minimal dialogue segment and a random event includes:
[0033] Calculate the first cosine similarity between each dialogue in each minimum dialogue segment and each random event;
[0034] Random events with a first cosine similarity greater than a similarity threshold are added to the set of similar random events, where each dialogue in each minimum dialogue segment corresponds to a set of similar random events.
[0035] Merge the sets of similar random events corresponding to each dialogue in the same minimum dialogue segment to obtain the set of similar random events corresponding to the minimum dialogue segment.
[0036] The set of random events with the highest similarity to the smallest dialogue segment is selected as the candidate random event set corresponding to the smallest dialogue segment.
[0037] Select a random event from the set of candidate random events, and use the random event as the label of the smallest dialogue fragment corresponding to the set of candidate random events, so that the smallest dialogue fragment is mapped to a random event.
[0038] In some embodiments, the method further includes:
[0039] When the first cosine similarity is less than or equal to the similarity threshold, the current smallest dialogue segment is merged with the next smallest dialogue segment, and the process of constructing the mapping relationship between each smallest dialogue segment and the random event continues.
[0040] In some embodiments, the random event includes a call to a human; after mapping the dialogue content to the random event, the method further includes:
[0041] Based on the trained Bayesian network, the probability of a random event being converted to manual intervention is determined.
[0042] If the probability of a random event being transferred to a human agent is greater than or equal to the probability threshold, the current conversation will be transferred to a human agent for processing.
[0043] If the probability of a random event being transferred to a human agent is less than the probability threshold, then continue to obtain the next dialogue content and continue the process of mapping the dialogue to random events.
[0044] In some embodiments, based on a first random event and according to a Bayesian network, a first standard script is output, including:
[0045] Based on the random variable corresponding to the first random event, output the next random variable;
[0046] Calculate the second cosine similarity between each standard dialogue in the set of standard dialogues corresponding to the next random variable and the content of the first dialogue;
[0047] The standard phrase with the highest second cosine similarity is taken as the first standard phrase corresponding to the first random event.
[0048] In some embodiments, the second dialogue content is mapped to a second random event, and based on the second random event using a Bayesian network, a second standard script is output, including:
[0049] Based on a pre-trained mapping model, the content of the second dialogue is mapped to a second random event;
[0050] Based on the random variable corresponding to the second random event, output the next random variable;
[0051] Calculate the third cosine similarity between each standard phrase in the set of standard phrases corresponding to the next random variable and the content of the second dialogue;
[0052] The standard phrase with the highest third cosine similarity is used as the second standard phrase corresponding to the second random event.
[0053] Secondly, embodiments of this application provide a dialogue management device, the device comprising:
[0054] The module is used to construct a Bayesian network, in which the Bayesian network is used to construct multiple random variables and a set of standard statements corresponding to each random variable. The set of standard statements includes multiple standard statements, and each random variable corresponds to multiple random events, where the random events are the values of the random variables.
[0055] The acquisition module is used to acquire the first dialogue content, which includes the dialogue content input by the user and the dialogue content replied by the virtual agent.
[0056] The mapping module is used to map the first dialogue content to a first random event based on the first dialogue content according to the pre-trained mapping model. The mapping model is used to map the dialogue content to random events, and the first random event is one of a plurality of random events.
[0057] The dialogue output module is used to output a first standard dialogue based on a first random event using a Bayesian network, and to continue to acquire the second dialogue content and map the second dialogue content to a second random event. Based on the second random event using a Bayesian network, it outputs a second standard dialogue, where the second dialogue content is the next dialogue content after the first dialogue content, and the second random event is one of multiple random events.
[0058] Thirdly, embodiments of this application provide an electronic device, including:
[0059] The processor and memory, the processor is used to execute executable program code in memory, and when the executable program code is executed, the processor executes instructions such as the dialog management method of the first aspect.
[0060] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed, implements the dialogue management method as described in the first aspect.
[0061] The beneficial effects of the embodiments of this application are as follows: Unlike the prior art, the embodiments of this application provide a dialogue management method, which includes: constructing a Bayesian network, wherein the Bayesian network is used to construct multiple random variables and a set of standard dialogues corresponding to each random variable, the set of standard dialogues including multiple standard dialogues, each random variable corresponding to multiple random events, the random events being the values of the random variables; acquiring first dialogue content; mapping the first dialogue content to a first random event based on a pre-trained mapping model, wherein the mapping model is used to map the dialogue content to random events; outputting a first standard dialogue based on the first random event according to the Bayesian network; and continuing to acquire second dialogue content and mapping the second dialogue content to a second random event; and outputting a second standard dialogue based on the second random event according to the Bayesian network.
[0062] This application can map dialogue content to random events to track the current dialogue state, and based on the mapping relationship between Bayesian network, dialogue content and random events, output standard dialogue, realizing the step-by-step advancement of multi-turn dialogue, ensuring the coherence of the output standard dialogue and dialogue content, improving the logicality of dialogue content and enhancing the quality of dialogue. Attached Figure Description
[0063] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0064] Figure 1 This is a flowchart illustrating a dialogue management method provided in an embodiment of this application;
[0065] Figure 2 yes Figure 1 A detailed flowchart of step S101 in the process;
[0066] Figure 3 This is an example schematic diagram of a Bayesian probability graph provided in an embodiment of this application;
[0067] Figure 4 This is an example schematic diagram of training data generated based on a directed graph, provided in an embodiment of this application.
[0068] Figure 5 yes Figure 1 A detailed flowchart of step S101 in the process;
[0069] Figure 6 yes Figure 5 A detailed flowchart of step S1103 in the process;
[0070] Figure 7 This is a schematic diagram of a process for generating training data with random event characteristics provided in an embodiment of this application;
[0071] Figure 8 This is a schematic diagram of a process for training a mapping model provided in an embodiment of this application;
[0072] Figure 9 This is an example diagram illustrating how historical dialogue data is divided into the smallest dialogue segments according to an embodiment of this application;
[0073] Figure 10 yes Figure 8 A detailed flowchart of step S802 in the process;
[0074] Figure 11This is an example diagram illustrating how a minimal dialogue fragment is mapped to a random event, as provided in an embodiment of this application.
[0075] Figure 12 This is a flowchart illustrating a method for determining whether a minimum dialogue segment is mapped to a random event, as provided in an embodiment of this application.
[0076] Figure 13 This is a flowchart illustrating a method for merging dialogue segments, as provided in an embodiment of this application.
[0077] Figure 14 This is an example schematic diagram of merging dialogue fragments provided in an embodiment of this application;
[0078] Figure 15 yes Figure 1 A detailed flowchart of step S104 in the process;
[0079] Figure 16 yes Figure 1 A detailed flowchart of step S104 in the process;
[0080] Figure 17 This is a schematic diagram of a process for determining whether to switch the current dialogue to a human dialogue, provided in an embodiment of this application.
[0081] Figure 18 This is an example schematic diagram illustrating how to infer the next random event according to an embodiment of this application;
[0082] Figure 19 This is a schematic diagram of the overall process of a dialogue management method provided in an embodiment of this application;
[0083] Figure 20 This is a schematic diagram of the overall flow of reasoning dialogue content provided in an embodiment of this application;
[0084] Figure 21 This is a schematic diagram of the structure of the dialogue management device provided in the embodiments of this application;
[0085] Figure 22 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0086] Explanation of icon numbers:
[0087] label name label name 2100 Dialogue Management Device 2104 Script output module 2101 Modules 2200 electronic devices 2102 Get Module 2201 processor 2103 Mapping module 2202 memory Detailed Implementation
[0088] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0089] It should be noted that, unless there is a conflict, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. In addition, the terms "first" and "second" used in this application do not limit the data, but only distinguish the same or similar items with basically the same function and effect.
[0090] Before introducing the embodiments of this application, a brief introduction will be given to the dialogue management methods known to the inventors of this application, so as to facilitate the understanding of the embodiments of this application later.
[0091] Currently, intelligent customer service systems typically generate dialogue content through frequently-asked questions (FAQs), knowledge-based augmented knowledge generation (RAG) schemes, or large-model-based question-and-answer generation schemes. The following sections explain the dialogue content generation process of these three schemes in detail and point out their respective problems.
[0092] (1) The FAQ system mainly relies on the FAQ knowledge base and enhances the semantic matching ability by adding similarity questions in order to return the dialogue content to the user, or let the user select multiple possible questions and then give a unified reply. Because it relies heavily on the FAQ knowledge base, when facing questions not included in the base, it is necessary to manually add similarity questions to adapt to the changes in content. It lacks the flexibility of natural language processing, making the replies feel stiff and unnatural to the user.
[0093] (2) The knowledge base-based augmented knowledge solution mainly obtains the matching results of the dialogue content by retrieving the knowledge base or triple knowledge graph, and then inputs the matching results into the large model for content output. This solution is mainly for single-round question answering. For the questions raised by users, it cannot help users to locate and troubleshoot step by step, so the content of their reply is usually not professional and may go around in circles.
[0094] (3) The question-answering scheme based on large models mainly uses a chatbot to reply to the dialogue content. By using domain historical dialogue data to train the chatbot, the chatbot can learn a human-like chat style. The human-like chat style is mainly achieved through a discriminative generation method. However, the content generated by this discriminative generation method is usually not interpretable and is only trained based on historical dialogue data. This makes the chatbot lack the tracking of dialogue state and the generation of corresponding dialogue strategies based on the dialogue state. When facing dialogue scenarios that require rigorous logic and professional knowledge, the reply content usually lacks logic and coherence, resulting in a poor user experience.
[0095] To address the aforementioned issues, this application provides a dialogue management method. By acquiring dialogue content and mapping a first dialogue content to a first random event based on a pre-trained mapping model, a first standard dialogue is output based on a Bayesian network and the first random event mapped from the first dialogue content. The method then continues by acquiring second dialogue content and mapping it to a second random event to output a second standard dialogue. This application can map dialogue content to random events to track the current dialogue state and output standard dialogue based on the mapping relationship between the Bayesian network, dialogue content, and random events. This achieves the gradual progression of multi-turn dialogues, ensuring the coherence of the output standard dialogue and the dialogue content, improving the logical consistency of the dialogue content, and enhancing the quality of the dialogue.
[0096] Before providing a detailed description of this application, the nouns and terms used in the embodiments of this application are explained, and the nouns and terms used in the embodiments of this application shall be interpreted as follows:
[0097] Virtual agents are a modern customer service function that integrates multiple technologies. Virtual agents are usually based on artificial intelligence platforms and can interact with users in real time using a chat interface.
[0098] The technical solution of this application is described in detail below with reference to the accompanying drawings:
[0099] Please see Figure 1 , Figure 1 This is a flowchart illustrating a dialogue management method provided in an embodiment of this application;
[0100] The dialogue management method is applied to electronic devices. Specifically, the execution subject of the dialogue management method is one or at least two processors of the electronic device.
[0101] like Figure 1 As shown, the dialogue management method includes:
[0102] Step S101: Construct a Bayesian network, wherein the Bayesian network is used to construct multiple random variables and construct a set of standard statements corresponding to each random variable. The set of standard statements includes multiple standard statements. Each random variable corresponds to multiple random events, and the random events are the values of the random variables.
[0103] In the embodiments of this application, a Bayesian network is a probabilistic graphical model used to represent the dependencies between random variables. The probabilistic graph consists of nodes and directed edges. Nodes represent random events, and directed edges represent the probabilistic dependencies between random events. Each node in a Bayesian network has an associated Conditional Probability Table (CPT). The Conditional Probability Table describes the probability distribution of the node's state given a parent node, so that the Bayesian network can calculate the joint probability distribution of the entire network through chain rules.
[0104] It is understood that the application scenarios of Bayesian networks include medical diagnosis, machine learning, risk management, natural language processing, and other fields. Preferably, the Bayesian network of this application is applied to natural language processing scenarios, such as after-sales scenarios. By constructing a Bayesian network related to after-sales scenarios, after-sales services can be further provided to customers.
[0105] Specifically, by defining multiple random variables and multiple random events, each random variable corresponds to multiple random events, and the random events are the values of the random variables, a Bayesian probability graph and a conditional probability table are constructed based on the random events to obtain a Bayesian network, which includes a Bayesian probability graph and a conditional probability table.
[0106] In this embodiment, a Bayesian network is used to construct multiple random variables and a set of standard dialogues corresponding to each random variable. The Bayesian network allows for the identification of dependencies between random variables, and by constructing the standard dialogues for each random variable, it enables the rapid output of standard dialogues to answer user questions. For detailed steps on constructing the Bayesian network, please refer to [link to relevant documentation]. Figure 2 .
[0107] Please see Figure 2 , Figure 2 yes Figure 1 A detailed flowchart of step S101 in the process;
[0108] like Figure 2 As shown, step S101 includes:
[0109] Step S111: Construct multiple random variables, wherein the random variables include at least one of the following: unplugging and plugging in the power cord, TV reset, and system restoration.
[0110] In the embodiments of this application, random variables correspond to multiple types, and multiple random variables can be constructed based on each type. For example, the types include fault phenomena, troubleshooting plans, solutions, and whether to transfer to manual intervention. Fault phenomena and solutions include system restoration and TV reset. Troubleshooting plans include backlight status.
[0111] Understandably, the fault symptoms refer to the actual faults reported by the user, such as a black screen, no touch, or no signal. The troubleshooting plan refers to the steps the user needs to take to resolve the fault symptoms. For example, troubleshooting plans for fault symptoms include checking the status of the large screen power indicator light, troubleshooting display problems in the central control menu, and cross-testing for no signal on the PC. For instance, if a user reports a black screen, the user should be prompted to first check the status of the large screen power indicator light, noting whether it is lit and what color it is. The solution refers to providing the user with a specific and actionable method, such as restoring the system, resetting the TV, or restarting. Whether to transfer to human assistance refers to whether to upgrade to human assistance. For example, if a troubleshooting plan is provided but the user's problem is still not resolved, the current machine handling will be upgraded to human assistance.
[0112] Specifically, based on after-sales scenarios, multiple random variables are constructed, including at least one of the following: unplugging and plugging in the power cord, TV reset, and system restoration.
[0113] In the embodiments of this application, each random variable corresponds to multiple random events, and the random event is the value of the random variable.
[0114] For example, the random variable of fault phenomenon includes two types of random events, that is, there are only two possible values. For example, the random variable of fault phenomenon includes the random event of black screen ∈ {"1", "not mentioned"}, where "1" means black screen and "not mentioned" means that it was not mentioned whether the screen is black.
[0115] For example, the random variable of the investigation plan has at least three possible values. For instance, the random variable of the investigation plan includes random events of backlight status ∈ {"0", "1", "not mentioned"}, where "0" means "no backlight", "1" means "backlight present", and "not mentioned" means that backlight status was not mentioned.
[0116] For example, the solution random variable has only three possible values. For instance, the solution random variable includes random events of the system restoration ∈ {"0", "1", "not mentioned"}, where "0" means "system restoration is invalid" and "1" means "system restoration is successful".
[0117] For example, the random variable for whether to upgrade to manual labor has only two possible values: whether to upgrade to manual labor ∈ {"0", "1"}, where "0" means "do not upgrade to manual labor" and "1" means "upgrade to manual labor".
[0118] Step S112: Construct the Bayesian network probability graph and conditional probability table to obtain the Bayesian network;
[0119] Specifically, based on the constructed random variables and random events, the fault diagnosis process followed by the troubleshooting schemes in the random variables is organized into a mind map. This mind map is then organized into a Bayesian probability graph. Based on domain knowledge and conditional probability formulas, the probability distribution of each node in the Bayesian probability graph is calculated, resulting in a Bayesian network. The Bayesian network includes a Bayesian probability graph and a conditional probability table. The domain knowledge and conditional probability formulas can be found in existing technologies and will not be described in detail here.
[0120] In this embodiment of the application, a Bayesian network probability graph is used to represent the dependencies between random variables, and a conditional probability table is used to represent the complete probability distribution of each random variable in a given state of its parent node, wherein the nodes of the Bayesian network probability graph are random variables.
[0121] In this embodiment of the application, by constructing a Bayesian network based on after-sales scenarios, solutions can be provided to users based on the Bayesian network, reducing user waiting time and communication costs when there is no human service.
[0122] Please refer to the following: Figure 3 , Figure 3 This is an example schematic diagram of a Bayesian probability graph provided in an embodiment of this application;
[0123] like Figure 3 As shown, the probability graph of a black screen failure is used as an example of a Bayesian probability graph to illustrate its construction. This probability graph of a black screen failure represents the troubleshooting process when resolving a black screen failure. When a black screen failure occurs, check the status of the indicator lights on the large screen. Three methods are provided: check the mains power, restart the large screen, and check the backlight status of the large screen. When checking the mains power, first check the status of the large screen's rocker mount, and then check if the power cord has been unplugged. If checking the backlight status of the large screen cannot resolve the black screen problem, restart the large screen. After restarting, continue to check if there are any problems with the display of the central control menu. If there are any problems, restore the system.
[0124] Please refer to Table 1 again. Table 1 is an example schematic diagram of a conditional probability table provided in the embodiments of this application.
[0125]
[0126] Table 1
[0127] As shown in Table 1, this table presents the conditional probability of a black screen failure. It includes the indicator light status (ZSD), the probability of checking the mains power (SD), and the probability (P(SD|ZSD)). When the indicator light is off, the probability that the external power supply is not working is 0.375. When the indicator light is off, the probability that the external power supply is working is 0.624. When the indicator light is off, the probability of not mentioning the external power supply status is 0. This indicates that when the power light is off, checking the mains power supply likely indicates that the external power supply is working, and checking the mains power supply has a low probability that it is not working. For other indicator light statuses, the probability of checking the mains power supply can be found in Table 1, and will not be explained further here.
[0128] It should be noted that, Figure 3 The probability diagram of black screen failure in the figure and the conditional probability table of black screen failure in Table 1 are both exemplary illustrations of this application.
[0129] Please refer to the following: Figure 4 , Figure 4 This is a schematic diagram of a process for training a Bayesian network provided in an embodiment of this application;
[0130] like Figure 4 As shown, the process of training this Bayesian network includes:
[0131] Step S401: Construct multiple directed graphs, where the nodes of the directed graphs are random events;
[0132] In this embodiment, since the initially constructed Bayesian network does not have a specific troubleshooting standard process, it needs to be further trained so that the Bayesian network can follow specific logical rules. The specific logical rules are determined by the fault reported by the user. For example, if the fault is that the whole machine is black, the machine is restarted while the indicator light is on. If restarting the machine cannot solve the black screen problem, manual intervention is directly escalated to map to the random event of escalating manual intervention. It is not necessary to check whether the central control menu can be accessed. However, if the indicator light changes from red to blue and restarting the machine is ineffective, it is necessary to first determine whether the central control menu can be accessed.
[0133] Specifically, based on the mind map of the fault standard troubleshooting process, multiple directed graphs are constructed, where the nodes of the directed graphs are random events, that is, the values of random variables.
[0134] Step S402: Perform a graph search on the directed graph to generate multiple training data sets;
[0135] Specifically, a graph search is performed on the directed graph using a random walk approach. When the last node of the currently selected path is reached, the search stops, and a training data point is obtained. The process continues by randomly selecting a directed graph until multiple training data points are generated, with a minimum of 500,000 training data points.
[0136] In the embodiments of this application, before performing graph search on a directed graph by means of random walk, a batch of probability distributions are initialized for the possible branches of each node in the directed graph. The probability distributions include 2-10 dimensional probability distributions. For example, if a node has 3 child nodes, a three-dimensional probability distribution is used to determine which child node should be visited next.
[0137] In this embodiment of the application, the initial probability distribution is kept unchanged. After a certain amount of training data is constructed, a new batch of probability distributions is re-initialized to maintain the diversity and exploratory nature of the random walk. For example, the probability distribution is re-initialized after every 10,000 training data points are generated.
[0138] In the embodiments of this application, during the graph search process of the directed graph, it is also necessary to follow specific logical rules to filter multiple neighbor nodes in order to select a neighbor node that conforms to the logic, until the leaf node is reached.
[0139] In this embodiment, training data is generated by random walks to effectively explore the local structure of the directed graph, and periodic initialization of the probability distribution can prevent overfitting to a specific walk path.
[0140] Please refer to Table 2, which is a table of training data based on directed graph generation provided in an embodiment of this application.
[0141]
[0142] Table 2
[0143] As shown in Table 2, each element in each training data set in Table 2 is one of the values of a random variable in a Bayesian network, and the last element of each training data set is the value of the random variable indicating whether to upgrade human intervention or not.
[0144] Step S403: Train the Bayesian network based on the training data to obtain the trained Bayesian network;
[0145] Specifically, the Bayesian network is trained using training data constructed from directed graphs to obtain the trained Bayesian network by training the probabilities of the Bayesian network.
[0146] In the embodiments of this application, Figure 2 The Bayesian network constructed in this paper is based on prior knowledge. The trained Bayesian network, obtained by training with training data, can learn the probability transition relationships between random variables, thereby performing reasoning and prediction in actual dialogue and improving the accuracy of context understanding.
[0147] Please refer to the following: Figure 5 , Figure 5 yes Figure 1 A detailed flowchart of step S101 in the process;
[0148] like Figure 5 As shown, step S101 includes:
[0149] Step S1101: Obtain the vector set corresponding to the random variable and the vector set corresponding to the historical dialogue data, wherein the historical dialogue data includes the historical dialogue content replied by the virtual agent;
[0150] In this embodiment of the application, after obtaining the trained Bayesian network, it is necessary to construct the relationship between random variables and the standard dialogue set based on the trained Bayesian network, that is, to make the random variables correspond to the standard dialogue set so that in the actual dialogue process, the random variables corresponding to the user input content can be identified and the standard dialogue can be quickly output based on the random variables.
[0151] In this embodiment of the application, the historical dialogue data includes the historical dialogue content of virtual agent replies and the historical dialogue content of user replies. Since the standard scripts are output based on the historical dialogue content of virtual agent replies, before constructing the standard script set, only the historical dialogue content of virtual agent replies is used. Therefore, it is necessary to filter the historical dialogue content of user input in the historical dialogue data.
[0152] Specifically, each random variable defined in the Bayesian network is represented as a vector, resulting in the vector set Node∈{n1,n2,......} corresponding to the random variables. Historical dialogue data is obtained from electronic devices, and the user-input historical dialogue content in the historical dialogue data is filtered out to obtain the dialogue content of the virtual agent's reply. The dialogue content of the virtual agent's reply is represented as a vector, resulting in the vector set Sentence∈{s1,s2,......} corresponding to the dialogue content of the virtual agent's reply.
[0153] Step S1102: Based on the vector set corresponding to each random variable and the vector set corresponding to the dialogue content replied by the virtual agent, generate the first set of dialogue scripts corresponding to each random variable;
[0154] Specifically, the cosine similarity between each random variable in the vector set Node∈{n1,n2,......} corresponding to the random variable and each dialogue in the vector set Sentence∈{s1,s2,......} corresponding to the dialogue content replied by the virtual agent is calculated. A threshold is set, for example, 0.8. Random variables with a cosine similarity greater than 0.8 are added to the candidate random variable set corresponding to their dialogue. The random variable with the highest cosine similarity in the candidate random variable set is temporarily taken as the random variable of the dialogue corresponding to the current candidate random variable set. That is, the random variable with the highest cosine similarity is used as the label of the dialogue.
[0155] In the embodiments of this application, different dialogue content may have the same meaning. The labels of different dialogues with the same meaning are the same random variable, that is, each random variable corresponds to a dialogue set.
[0156] In this embodiment, the dialogue set corresponding to the random variable obtained by the preliminary screening is based on semantic similarity. Calculating semantic similarity for polysemy and synonymy in natural language may not accurately distinguish the meaning of words in different contexts, leading to misjudgment. Therefore, it is necessary to cluster the dialogue set corresponding to each random variable to group similar dialogues in the same dialogue set into the same cluster, resulting in multiple clusters. Each cluster includes multiple dialogues. Then, the distance between dialogues in different clusters is calculated (using cosine similarity). The two dialogues with the smallest distance (i.e., the higher the similarity) are added to the same set to obtain the first dialogue set corresponding to the current random variable. Based on the above steps, the dialogue set corresponding to each random variable is clustered to obtain the first dialogue set corresponding to each random variable.
[0157] Step S1103: Based on the first set of dialogue scripts, iterate through the historical dialogue content of the virtual agent's replies to obtain the second set of dialogue scripts corresponding to each random variable, wherein the second set of dialogue scripts is the standard set of dialogue scripts;
[0158] In this embodiment of the application, since clustering is based on the similarity of existing data, relying solely on the clustering results may not be able to cover all possible expressions of dialogue corresponding to random variables, thus failing to capture all variations or synonyms. Therefore, it is necessary to further optimize the first set of dialogues corresponding to each random variable.
[0159] Specifically, the similarity between each dialogue in the first dialogue set corresponding to each random variable and each dialogue in the virtual agent's reply in the historical dialogue data is calculated, and a threshold is set. Dialogues with similarity greater than the threshold are added to the dialogue set of their corresponding random variables to obtain the second dialogue set corresponding to each random event. The second dialogue set corresponding to each random event is its corresponding standard dialogue set, which includes multiple standard dialogues.
[0160] In this embodiment of the application, based on the standard script set corresponding to each random variable, the standard script corresponding to the random event can be output from the standard script set.
[0161] Please refer to the following: Figure 6 , Figure 6 yes Figure 5 A detailed flowchart of step S1103 in the process;
[0162] like Figure 6 As shown, step S1103 includes:
[0163] Step S1131: Calculate the Jaccard distance between each dialogue in the first dialogue set corresponding to each random variable and each dialogue in the historical dialogue content of the virtual agent's reply;
[0164] The Jaccard distance is used to determine whether each dialogue in the first dialogue set is similar to each dialogue in the historical dialogue content of the virtual agent's response. The Jaccard distance is the complement of the Jaccard similarity coefficient, and the formula for the Jaccard similarity coefficient is:
[0165]
[0166] Where J(A, B) is the Jaccard similarity coefficient, A and B are both vectors, |A∩B| is the intersection of A and B, and |A∪B| is the union of A and B.
[0167] The formula for Jaccard distance is:
[0168] d J (A, B) = 1 - J(A, B)
[0169] Where, d J (A, B) is the Jaccard distance, and J(A, B) is the Jaccard similarity coefficient.
[0170] Specifically, according to the Jaccard distance formula, the Jaccard distance between each dialogue in the first dialogue set corresponding to each random variable and each dialogue in the historical dialogue content of the virtual agent's reply is calculated. That is, the dialogue in the first dialogue set is represented as a vector, and the dialogue in the historical dialogue content of the virtual agent's reply is represented as a vector. The vectors corresponding to the dialogues in the first dialogue set and the vectors corresponding to the dialogues in the historical dialogue content of the virtual agent's reply are substituted into the Jaccard distance formula to obtain the Jaccard distance between the vectors corresponding to the dialogues in the first dialogue set and the vectors corresponding to the dialogues in the historical dialogue content of the virtual agent's reply.
[0171] Step S1132: Based on the Jaccard distance, determine the dialogues similar to each utterance, and obtain the set of similar dialogues corresponding to each random event;
[0172] In this embodiment, a smaller Jaccard distance indicates that the two sentences are more similar.
[0173] Specifically, a distance threshold is set. Dialogues from the historical conversations of virtual agents whose distance to the Jaccard is less than the distance threshold are added as standard scripts to the set corresponding to the random variable of the current first script set. For example, if the distance threshold is 0.35, dialogues from historical conversations with a distance to the Jaccard is less than 0.35 are added as standard scripts to the set corresponding to the random variable of the current first script set. The set corresponding to the random variable of the current first script set is used as the set of similar dialogues corresponding to its random variable. Based on the above steps, the set of similar dialogues corresponding to each random variable is obtained. The set of similar dialogues includes multiple scripts, and the number of scripts in the set of similar dialogues corresponding to the random variable is greater than the number of scripts in the first script set corresponding to that random variable.
[0174] Step S1133: Filter the dialogues that are not associated with the random variables in the similar dialogue set corresponding to each random variable to obtain the second dialogue set corresponding to each random variable;
[0175] Specifically, the dialogues in the similar dialogue set corresponding to each random event are filtered to obtain the second dialogue set corresponding to each random event. The second dialogue set is the standard dialogue set, which includes multiple standard dialogues corresponding to the random event.
[0176] In this embodiment of the application, the dialogues in the similar dialogue set corresponding to each random event are filtered out to remove dialogues that are not associated with the random variables. For example, it is determined whether the dialogue content describes its corresponding random variable. For example, if the dialogue content is "Try unplugging and plugging in the power cord or changing the power strip to test whether it can be turned on", the random variable described by the dialogue is "plugging and unplugging the power cord", while the random variable corresponding to the similar dialogue set of the dialogue content is "restore the system", then the dialogue content needs to be filtered out, that is, the dialogue needs to be deleted from its corresponding similar dialogue set.
[0177] In this embodiment of the application, it is determined manually whether it is necessary to filter the dialogue in the similar dialogue set.
[0178] In the embodiments of this application, the standard scripts corresponding to each random variable constitute a standard script library.
[0179] In this embodiment of the application, a standard dialogue script library is constructed. When a virtual agent has a conversation with a user, the virtual agent can search for the corresponding standard dialogue script in the standard dialogue script library to respond to the user.
[0180] In this embodiment of the application, in order for the virtual agent to provide professional responses to the user's input, the virtual agent also needs to be trained so that it can quickly output standard scripts based on random events.
[0181] Please refer to the following: Figure 7 , Figure 7 This is a schematic diagram of a process for generating training data with random event characteristics provided in an embodiment of this application;
[0182] like Figure 7 As shown, the process of generating training data with random event characteristics includes: obtaining the vector set corresponding to the historical dialogue content of the virtual agent's replies and the vector set corresponding to the random variables; calculating the similarity between the vector corresponding to each dialogue in the vector set corresponding to the historical dialogue content of the virtual agent's replies and the vector corresponding to each random variable in the vector set corresponding to the random variables, thus obtaining the dialogue set corresponding to each random variable. That is, based on multiple random variables as labels, the historical dialogue content of the virtual agent's replies is divided into multiple dialogue sets, so that each random variable corresponds to one dialogue set. For example... Figure 7 The random variables shown include power cord plugging / unplugging, TV reset, and system restoration. The dialogue set corresponding to power cord plugging / unplugging includes dialogues such as Dialogue 1 and Dialogue 2. The dialogue set corresponding to TV reset includes dialogues such as Dialogue 1 and Dialogue 2. The dialogue set corresponding to system restoration includes dialogues such as Dialogue 1 and Dialogue 2. Then, the dialogues in the dialogue set corresponding to each random variable are clustered to obtain the first dialogue set corresponding to each random variable.
[0183] Furthermore, Jaccard distance is calculated for each dialogue in the first dialogue set corresponding to each random variable and the historical dialogue content of the virtual agent's response. Dialogues in the virtual agent's response content with a Jaccard distance less than the distance threshold are added to the similar dialogue set corresponding to each random variable. Then, the dialogue content in the similar dialogue set corresponding to each random variable is filtered by manual filtering to obtain the second standard dialogue set corresponding to each random variable. For example, the standard dialogue set corresponding to plugging and unplugging the power cord, the standard dialogue set corresponding to TV reset, and the standard dialogue set corresponding to the system restore are all obtained. The second standard dialogue sets corresponding to each random variable are combined to obtain a standard dialogue library.
[0184] Furthermore, the cosine similarity between the standard dialogues in the second set of standard dialogues corresponding to each random variable and each dialogue in the historical dialogue content of the virtual agent's replies in the historical dialogue data is calculated. Standard dialogues with a cosine similarity greater than a threshold are added to a set, resulting in a set corresponding to each dialogue in the historical dialogue content of the virtual agent's replies. In this set, the random variable corresponding to the standard dialogue with the highest cosine similarity is selected as the random variable corresponding to the dialogue in the current historical dialogue content of the virtual agent's replies. That is, based on the standard dialogue library, the random variable corresponding to the standard dialogue that is similar to the dialogue in the historical dialogue content of the virtual agent's replies is used as the random variable for the dialogue in the current historical dialogue content of the virtual agent's replies. In other words, each dialogue in the historical dialogue content of the virtual agent's replies is labeled with a random variable, resulting in the historical dialogue content of the virtual agent's replies labeled with random variables. This historical dialogue content of the virtual agent's replies labeled with random variables is used as the training data for the virtual agent.
[0185] For example, if the dialogue content is "Try unplugging and plugging in the power cord or changing the power strip to test if it can be turned on," when similar standard dialogue is found, the random variable corresponding to the similar standard dialogue is "plugging and unplugging the power cord," then the dialogue content will be represented as "@plugging and unplugging the power cord." <assistant>The message "Try unplugging and plugging in the power cord or changing the power strip to test if it can be turned on" adds a random variable to the dialogue.
[0186] In this embodiment of the application, by calculating the similarity between the standard script and the historical dialogue content of the virtual agent's reply multiple times, the results of multiple calculations can be combined to obtain a more accurate set of standard scripts. Then, based on the set of standard scripts, random variables are labeled for the dialogue content, so that the dialogue content is labeled with the random variable features in the Bayesian network.
[0187] In this embodiment, the virtual agent is trained using the Qianwen Large Model as the base model. Specifically, the Qianwen Large Model is trained based on the historical dialogue content of the virtual agent's replies labeled with random variables as training data to obtain a dialogue generation model. The dialogue generation model is used to reply to the dialogue content input by the user and provide after-sales service to the user, such as locating and troubleshooting the fault phenomena reported by the user.
[0188] Among them, the Qianwen Big Model has the ability to engage in multi-turn dialogues, which is used to interact with humans in multiple rounds to understand the dialogue content input by users and provide accurate answers to users based on the context.
[0189] In this embodiment, the Qianwen Big Model is trained using historical dialogue content with random variable annotations of virtual agent responses as training data. The output of the resulting dialogue generation model has random variable features in the Bayesian network constructed in this application. This allows the Bayesian network and the dialogue generation model to interact, guiding the dialogue generation model to output standard dialogue corresponding to random variables, which can effectively improve the logicality of the dialogue content generated by the dialogue generation model.
[0190] Step S102: Obtain the first dialogue content, wherein the first dialogue content includes the dialogue content entered by the user and the dialogue content replied by the virtual agent;
[0191] Specifically, the system obtains the first dialogue content input by the user. The first dialogue content includes the dialogue content entered by the user, such as the user's input "The large screen is plugged in, but it cannot be turned on". The first dialogue content can also include the dialogue content of the virtual agent's reply. For example, if the user's problem has not been resolved, the obtained dialogue content includes both the dialogue content entered by the user and the dialogue content of the virtual agent's reply, so as to continue to conduct multiple rounds of dialogue.
[0192] Step S103: Based on the first dialogue content, map the first dialogue content to the first random event according to the pre-trained mapping model, wherein the mapping model is used to map the dialogue content to the random event;
[0193] Specifically, based on a pre-trained mapping model, the first dialogue content is mapped to a first random event, where the first random event is the value of a random variable.
[0194] In this embodiment, the mapping model is used to map dialogue content to random events, that is, to provide specific solutions for the dialogue content input by the user. The mapping model is trained before obtaining the actual dialogue content. The specific steps for training the mapping model are as follows: Figure 8 .
[0195] Please refer to the following: Figure 8 , Figure 8 This is a schematic diagram of a process for training a mapping model provided in an embodiment of this application;
[0196] like Figure 8 As shown, the process of training the mapping model includes:
[0197] Step S801: Obtain historical dialogue data and divide the historical dialogue data into multiple minimum dialogue segments;
[0198] Specifically, historical dialogue data is acquired, which includes user input and virtual agent responses. The historical dialogue data is divided into multiple minimum dialogue segments based on a question-and-answer format, and each minimum dialogue segment can be used to infer a random event.
[0199] Please refer to the following: Figure 9 , Figure 9 This is an example diagram illustrating how historical dialogue data is divided into the smallest dialogue segments according to an embodiment of this application;
[0200] like Figure 9 As shown, the historical dialogue data includes conversations between users and virtual agents. Since the user did not mention anything related to random events in the first two sentences, the user's reply "Plug in the power, but it won't turn on" and the first two sentences need to be divided into a minimum dialogue segment, and this minimum dialogue segment can correspond to a random event "can't turn on". The virtual agent's reply "Could you please try changing the socket and unplugging and replugging the power first?" and the user's reply "Still doesn't work" are also divided into a minimum dialogue segment.
[0201] Step S802: Construct the mapping relationship between each minimum dialogue segment and random events;
[0202] Specifically, after dividing the historical dialogue data into multiple minimal dialogue segments, a mapping relationship is constructed between each minimal dialogue segment and a random event. That is, each minimal dialogue segment is labeled with a random event, so that each minimal dialogue segment is mapped to a random event.
[0203] In this embodiment of the application, by constructing a mapping relationship between each minimum dialogue segment and random events, the model can quickly and accurately provide reasonable responses based on the user's input.
[0204] In the embodiments of this application, the mapping relationship between each minimum dialogue segment and random event is used as training data. The training data corresponding to the mapping relationship is used to train the Qianwen Big Model, so that the Qianwen Big Model can learn the mapping relationship between dialogue content and random events, that is, a mapping model is obtained based on the Qianwen Big Model.
[0205] In this application embodiment, since the Qianwen Big Data Model itself has prior knowledge, and the Bayesian network defined by this application based on random events has prior understanding, the literal meaning of many random events is often ambiguous. For example, if a random event is defined as "no touch", in the after-sales scenario, "no touch" means that the screen is completely unresponsive to touch or writing, that is, there is no response to touch or writing, not that a part of the screen is unresponsive. Therefore, based on the previously defined random events, the model may misunderstand the content reported by the user. In order to solve this problem, this application defines the concept of each random event in the after-sales scenario. This concept refers to the specific meaning of the random event. For example, for the random variable black screen, the concept of black screen is defined as "the screen cannot display content". The user may output descriptions such as "the screen is not lit", "the screen is black", or "it cannot be turned on". The concept of each random event defined in the after-sales scenario is used as part of the training data of the mapping model, so that the mapping model can accurately understand the content of each dialogue and accurately map the content of the dialogue to the random event.
[0206] Please refer to the following: Figure 10 , Figure 10 yes Figure 8 A detailed flowchart of step S802 in the process;
[0207] like Figure 10 As shown, step S802 includes:
[0208] Step S821: Calculate the first cosine similarity between each dialogue in each minimum dialogue segment and each random event;
[0209] Specifically, each dialogue in the minimum dialogue segment is represented as a vector. Based on the formula for cosine similarity, the first cosine similarity between each dialogue in each minimum dialogue segment and each random event is calculated. The first cosine similarity is based on the cosine value of the angle between two vectors in the vector space to determine the similarity between the two vectors (i.e., a dialogue vector and a random event vector).
[0210] Step S822: Add random events with a first cosine similarity greater than the similarity threshold to the set of similar random events, where each dialogue in each minimum dialogue segment corresponds to a set of similar random events;
[0211] Specifically, a similarity threshold is set, and random events with a first cosine similarity greater than the similarity threshold are added to the set of similar random events. For example, if the similarity threshold is set to 0.7, then random events with a first cosine similarity greater than 0.7 are added to the set of similar random events. Each dialogue in each smallest dialogue segment corresponds to a set of similar random events.
[0212] Step S823: Merge the sets of similar random events corresponding to each dialogue in the same minimum dialogue segment to obtain the set of similar random events corresponding to the minimum dialogue segment;
[0213] Specifically, the set of similar random events corresponding to each dialogue in the same minimum dialogue segment is added to a single random event set, thereby merging the set of similar random events corresponding to each dialogue in the same minimum dialogue segment to obtain the set of similar random events corresponding to each minimum dialogue segment.
[0214] In this embodiment of the application, by integrating the set of similar random events of all dialogues in the same minimal dialogue segment, the model is provided with more comprehensive information to establish the mapping relationship between the minimal dialogue segment and random events.
[0215] Step S824: Obtain the most similar random events from the set of similar random events corresponding to the smallest dialogue segment as the candidate random event set corresponding to the smallest dialogue segment;
[0216] Specifically, the set of random events with the highest similarity to the smallest dialogue segment is selected as the candidate random event set corresponding to the smallest dialogue segment. For example, 0-2 random events are selected and added to the random event set. This random event set is the candidate random event set corresponding to the smallest dialogue segment. When 0 random events are selected, it means that the smallest dialogue segment cannot map any random variables.
[0217] Step S825: Select a random event from the candidate random event set, and use the random event as the label of the smallest dialogue segment corresponding to the candidate random event set, so that the smallest dialogue segment is mapped to a random event;
[0218] Specifically, the random event with the highest similarity is selected from the set of candidate random events, and this random event is used as the label of the smallest dialogue fragment corresponding to the set of candidate random events, so that the smallest dialogue fragment is mapped to a random event.
[0219] Please refer to the following: Figure 11 , Figure 11 This is an example diagram illustrating how a minimal dialogue fragment is mapped to a random event, as provided in an embodiment of this application.
[0220] like Figure 11 As shown, the historical dialogue data is divided into two minimal dialogue segments, and each minimal dialogue segment is labeled with a random event label. For example, the label corresponding to the first minimal dialogue segment is "cannot be turned on", and the label corresponding to the second minimal dialogue segment is "power supply failure".
[0221] In this embodiment of the application, when there is no random event in the candidate random event set, it means that the smallest dialogue segment corresponding to the candidate random event set cannot be mapped to a random event, and it is necessary to merge the smallest dialogue segment with the next adjacent smallest dialogue segment.
[0222] Please refer to the following: Figure 12 , Figure 12 This is a flowchart illustrating a method for determining whether a minimum dialogue segment is mapped to a random event, provided in an embodiment of this application.
[0223] like Figure 12 As shown, the determination of whether a minimum dialogue fragment maps to a random event includes:
[0224] Step S1201: Determine whether the first cosine similarity is less than or equal to the similarity threshold;
[0225] In this embodiment of the application, when constructing the mapping relationship between the minimum dialogue segment and the random event, there may be a problem that the dialogue content of the minimum dialogue segment cannot be mapped to the random event. Therefore, before constructing the mapping relationship, it is necessary to ensure that the current minimum dialogue segment can be mapped to a random event.
[0226] Specifically, if the first cosine similarity of the dialogue in the smallest dialogue segment is greater than the similarity threshold, then proceed to step S1202; if the first cosine similarity of the dialogue in the first smallest dialogue segment is less than or equal to the similarity threshold, then proceed to step S1203.
[0227] Step S1202: Determine the mapping of the smallest dialogue fragment to a random event;
[0228] Specifically, if the first cosine similarity of the dialogue in the minimum dialogue segment is greater than the similarity threshold, it indicates that the dialogue in the minimum dialogue segment is relatively similar to the random event, and the minimum dialogue segment is determined to be mapped to the random event.
[0229] Step S1203: Determine that the smallest dialogue fragment cannot be mapped to a random event;
[0230] Specifically, if the first cosine similarity of the dialogue in the minimum dialogue segment is less than or equal to the similarity threshold, it indicates that the dialogue in the minimum dialogue segment is significantly different from the random event, and thus the minimum dialogue segment cannot be mapped to the random event.
[0231] Please refer to the following: Figure 13 , Figure 13 This is a flowchart illustrating a method for merging dialogue segments, as provided in an embodiment of this application.
[0232] like Figure 13 As shown, the process of merging dialogue fragments includes:
[0233] Step S1301: Merge the current minimum dialogue segment with the next minimum dialogue segment, and continue to execute the step of constructing the mapping relationship between each minimum dialogue segment and random events;
[0234] Specifically, when it is determined that the smallest dialogue fragment cannot be mapped to a random event, the smallest dialogue fragment is merged with the next adjacent smallest dialogue fragment, and the process of constructing the mapping relationship between each smallest dialogue fragment and the random event continues, i.e., the process is as follows: Figure 10 If merging two minimum dialogue fragments still fails to map them to random events, the merging process continues until the minimum dialogue fragment can be mapped to at least one random event.
[0235] Please refer to the following: Figure 14 , Figure 14 This is an example schematic diagram of merging dialogue fragments provided in an embodiment of this application;
[0236] like Figure 14 As shown, the agent dialogue in the first minimum dialogue segment can be mapped to a random variable, namely "whether the large screen boat-shaped switch is set to 1". The user's reply cannot be mapped to a random event. That is, the first minimum dialogue segment can only be mapped to a random variable, not a random event. Therefore, it is necessary to merge the next minimum dialogue segment adjacent to the first minimum dialogue segment with the first minimum dialogue segment, that is, merge the second minimum dialogue segment with the first minimum dialogue segment to obtain a minimum dialogue segment that can be mapped to the random event "the large screen boat-shaped switch is set to 1".
[0237] Step S803: Use the mapping relationship between all the smallest dialogue segments and random events as training data to train the mapping model and obtain the pre-trained mapping model.
[0238] Specifically, the mapping relationships between all the constructed minimum dialogue fragments and random events, as well as the concept of each random event in the after-sales scenario, are used as training data to train the Qianwen Big Data Model. This allows the Qianwen Big Data Model to learn how to map the minimum dialogue fragments to random events, enabling the model to predict random events defined by the Bayesian network. The loss value between the predicted result and the actual result is calculated and continuously optimized to improve the accuracy of the Qianwen Big Data Model's predictions. This results in a pre-trained mapping model that can predict random events defined by the Bayesian network corresponding to the dialogue content.
[0239] In this embodiment of the application, by constructing a mapping relationship between dialogue content and random events and training the mapping model, the model can understand the dialogue in real time during the dialogue between the user and the virtual agent, and infer the Bayesian random event corresponding to the current dialogue based on the current dialogue, and infer the next random event based on the Bayesian random event.
[0240] Step S104: Based on the Bayesian network and random events, output the first standard dialogue, continue to obtain the second dialogue content, map the second dialogue content to the second random event, and output the second standard dialogue based on the Bayesian network and the second random event.
[0241] Specifically, after obtaining the first dialogue content input by the user, the first dialogue content is mapped to the first random event through a mapping model. Based on the random events defined in the Bayesian network, the Bayesian network infers the random variable corresponding to the next random event based on the first random event. According to the correspondence between the random variable and the standard script, the first standard script corresponding to the current first dialogue content is output. If the output first standard script does not solve the user's problem, the second dialogue content input by the user is obtained, and the second dialogue content is mapped to the second random event through a mapping model. Based on the principle of the output first standard script, the second standard script is output.
[0242] In this embodiment of the application, when the standard dialogue output by the model cannot solve the user's problem and it is inferred that the next random event is to transfer to a human agent, the current human-computer dialogue ends, that is, the dialogue generation model is instructed to close the dialogue state.
[0243] Please refer to the following: Figure 15 , Figure 15 yes Figure 1 A detailed flowchart of step S104 in the process;
[0244] like Figure 15 As shown, step S104 includes:
[0245] Step S141: Based on the random variable corresponding to the first random event, output the next random variable;
[0246] Specifically, a random event is the value of a random variable. If the first random event corresponding to the first dialogue content is known, then the first random event is input into a Bayesian network. Based on the relationship between random variables constructed in the Bayesian network, the next random variable corresponding to the current first random event is output, that is, the next random variable corresponding to the first dialogue content is obtained.
[0247] Step S142: Calculate the second cosine similarity between each standard phrase in the standard phrase set corresponding to the next random variable and the content of the first dialogue;
[0248] The second cosine similarity is used to measure the difference between two vectors. The second cosine similarity is based on the cosine value of the angle between two vectors in the vector space to determine the degree of similarity between the two vectors.
[0249] Specifically, the next random variable corresponding to the first dialogue content is used as the input to the dialogue generation model. The standard dialogue set corresponding to the next random variable is retrieved from the standard dialogue library. Each sentence of the first dialogue content is represented as a vector, resulting in a vector set corresponding to the standard dialogue set corresponding to the next random variable and a vector set corresponding to the first dialogue content. The second cosine similarity between the vector corresponding to each standard dialogue in the standard dialogue set corresponding to the next random variable and the vector corresponding to each dialogue in the first dialogue content is calculated. The specific formula for calculating the cosine similarity refers to the cosine similarity formula in the existing technology.
[0250] Step S143: Use the standard script with the highest second cosine similarity as the first standard script corresponding to the first random event;
[0251] Specifically, the standard phrase with the highest second cosine similarity is used as the first standard phrase corresponding to the first random event, that is, the first standard phrase corresponding to the first dialogue content is output to reply to the user.
[0252] Please refer to the following: Figure 16 , Figure 16 yes Figure 1 A detailed flowchart of step S104 in the process;
[0253] like Figure 16 As shown, step S104 includes:
[0254] Step S144: Map the second dialogue content to the second random event according to the pre-trained mapping model;
[0255] Specifically, if the user's problem remains unresolved, the system continues to acquire second dialogue content and maps it to a second random event based on a pre-trained mapping model.
[0256] Step S145: Based on the random variable corresponding to the second random event, output the next random variable;
[0257] Specifically, the second random event is the value of the random variable. Given the second random event corresponding to the second dialogue content, the second random event is input into a Bayesian network. Based on the relationship between random variables constructed in the Bayesian network, the next random variable corresponding to the current second random event is output, that is, the next random variable corresponding to the second dialogue content is obtained.
[0258] Step S146: Calculate the third cosine similarity between each standard phrase in the standard phrase set corresponding to the next random variable and the content of the second dialogue;
[0259] Specifically, the next random variable corresponding to the second dialogue content is used as the input to the dialogue generation model. The standard dialogue set corresponding to the next random variable is retrieved from the standard dialogue library. Each sentence of the second dialogue content is represented as a vector, resulting in a vector set corresponding to the standard dialogue set corresponding to the next random variable and a vector set corresponding to the second dialogue content. The third cosine similarity between the vector corresponding to each standard dialogue in the standard dialogue set corresponding to the next random variable and the vector corresponding to each dialogue in the second dialogue content is calculated. The specific formula for calculating the cosine similarity refers to the cosine similarity formula in the existing technology.
[0260] Step S147: Use the standard script with the highest third cosine similarity as the second standard script corresponding to the second random event;
[0261] Specifically, the standard phrase with the highest third cosine similarity is used as the second standard phrase corresponding to the second random event, that is, the second standard phrase corresponding to the second dialogue content is output to reply to the user.
[0262] In this embodiment, if the user's problem is not resolved after outputting a standard dialogue based on the second dialogue content, then the next round of dialogue is output or a decision is made on whether to transfer the issue to a human operator. For specific steps on transferring the issue to a human operator, please refer to [link to relevant documentation]. Figure 17 .
[0263] In this embodiment, a mapping model is used to map dialogue content to random events, and a Bayesian network is used to guide the generative model to output standard dialogue. This enables the output of logically consistent standard dialogue based on an understanding of the mapping relationship between dialogue content and random events. Furthermore, as the dialogue progresses, the Bayesian network can dynamically update its internal probability distribution and the dependencies between random events, allowing the generative model to better adapt to changes in the dialogue.
[0264] Please refer to the following: Figure 17 , Figure 17 This is a schematic diagram of a process for determining whether to switch the current dialogue to a human dialogue, provided in an embodiment of this application.
[0265] like Figure 17 As shown, the process for determining whether to switch the current conversation to a human dialogue includes:
[0266] Step S1701: Based on the trained Bayesian network, determine the probability that a random event will be converted to manual intervention;
[0267] Specifically, the dialogue content input by the user is obtained, and the dialogue content is mapped to random events through a mapping model. The trained Bayesian network determines the probability that the next random event of the current random event is to switch to human intervention.
[0268] Step S1702: Determine whether the probability of a random event being transferred to manual intervention is greater than or equal to the probability threshold;
[0269] Specifically, determine whether the probability of a random event being transferred to a human agent is greater than or equal to a probability threshold. If the probability of a random event being transferred to a human agent is greater than or equal to the probability threshold, proceed to step S1703. If the probability of a random event being transferred to a human agent is less than the probability threshold, proceed to step S1704.
[0270] Step S1703: Transfer the current dialogue to human processing;
[0271] Specifically, when the probability of a random event being transferred to a human agent is greater than or equal to a probability threshold, the current conversation will be transferred to human agent processing. For example, if the probability threshold is 0.95, and the probability of a random event being transferred to a human agent is greater than or equal to 0.95, then the current conversation will be transferred to human agent processing.
[0272] Step S1704: Continue to obtain the next dialogue content and continue the steps of mapping the dialogue to random events;
[0273] Specifically, if the probability of a random event being transferred to a human agent is less than a probability threshold, the system continues to acquire the next dialogue content and continue the process of mapping the dialogue to the random event. For example, if the probability threshold is 0.95, and the probability of a random event being transferred to a human agent is less than 0.95, the system continues to acquire the next dialogue content.
[0274] In this embodiment of the application, the decision to continue the dialogue between the dialogue generation model and the user is made by predicting whether the next random event corresponding to the current random event will be a manual response.
[0275] Please refer to the following: Figure 18 , Figure 18 This is an example schematic diagram illustrating how to infer the next random event according to an embodiment of this application;
[0276] like Figure 18 As shown, the random event corresponding to the first dialogue segment is "cannot turn on" based on the mapping model. According to the Bayesian network, the standard dialogue is generated based on the current mapped random event. For example, if the random event is "cannot turn on", the next random variable is inferred to be "plug and unplug the power cord" based on this random event. Based on this random variable, the standard dialogue corresponding to "plug and unplug the power cord" is output, such as "Please try plugging and unplugging the power cord". Based on the user's reply, the current dialogue (the latest dialogue content) is mapped to the random event to continue the inference of the next random variable.
[0277] Please refer to the following: Figure 19 , Figure 19 This is a schematic diagram of the overall process of a dialogue management method provided in an embodiment of this application;
[0278] like Figure 19 As shown, the overall process of this dialogue management method includes:
[0279] Step S1901: Construct a Bayesian network;
[0280] Specifically, based on the after-sales scenario, multiple random variables are constructed, where each random variable corresponds to multiple random events, and the random events are the values of the random variables. Based on the constructed random variables and random events, the fault standard troubleshooting process followed by the troubleshooting plan in the random variables is organized into a mind map, and then the mind map is organized into a Bayesian probability graph. Based on domain knowledge and conditional probability formulas, the probability distribution of each node in the Bayesian probability graph is calculated to obtain a Bayesian network.
[0281] Step S1902: Construct a directed graph and generate training data;
[0282] Specifically, based on the mind map of the fault standard troubleshooting process, multiple directed graphs are constructed. The nodes of the directed graphs are random events, i.e., the values of random variables. Graph search is performed on the directed graphs through random walks to generate multiple training data.
[0283] Step S1903: Train the Bayesian network;
[0284] Specifically, multiple training data generated based on directed graphs are used to train the Bayesian network, resulting in a trained Bayesian network.
[0285] Step S1904: Construct training data with random variable characteristics;
[0286] Specifically, based on the random variables defined by Bayesian networks, the random variables are labeled onto each sentence of the historical dialogue content of the virtual agent's replies in the historical dialogue data, resulting in historical dialogue content of the virtual agent's replies with random variable characteristics. This historical dialogue content of the virtual agent's replies with random variable characteristics is the training data with random variable characteristics.
[0287] Step S1905: Train the dialogue generation model;
[0288] Specifically, the Qianwen Big Model is trained using training data with random variable characteristics, and the trained Qianwen Big Model is the dialogue generation model.
[0289] Step S1906: Dialogue input;
[0290] Specifically, the user inputs dialogue content into the dialogue generation model.
[0291] Step S1907: Map the dialogue content to random events;
[0292] Specifically, the mapping model maps user-input dialogue content to random events.
[0293] Step S1908: Random variable inference;
[0294] Specifically, the random events mapped from the dialogue content are inferred by a Bayesian network to derive the next random variable.
[0295] Step S1909: Generate dialogue content;
[0296] Specifically, the generative model outputs the standard script corresponding to the next random variable obtained from Bayesian network inference.
[0297] Step S1910: Dialogue output;
[0298] Specifically, the standard dialogue generated by the dialogue generation model is output to the user.
[0299] In this embodiment of the application, the dialogue generation model is trained by constructing training data with random variable characteristics, so that the dialogue generation model can output logical dialogue content. Furthermore, by constructing a mapping model, the model can quickly understand the dialogue content input by the user, and further map the dialogue content input by the user to random events, and then infer the next random variable based on the random events, so as to further output standard speech, thereby enhancing the understanding ability of the dialogue generation model.
[0300] Please refer to the following: Figure 20 , Figure 20 This is a schematic diagram of the overall flow of reasoning dialogue content provided in an embodiment of this application;
[0301] like Figure 20 As shown, the overall flow of this reasoning dialogue includes:
[0302] Step S2001: Dialogue Segmentation Management;
[0303] Specifically, the dialogue content is obtained and segmented based on a question-and-answer format.
[0304] Step S2002: Map the dialogue to a random event;
[0305] Specifically, the segmented dialogue content is mapped to random events.
[0306] Step S2003: Whether a random event is mapped;
[0307] Specifically, it is determined whether the segmented dialogue content maps to random events. If the segmented dialogue content can map to random events, the process jumps to step S2004. If the segmented dialogue content cannot map to random events, the process jumps to step S2008.
[0308] Step S2004: Is the probability of transferring to a human agent less than the probability threshold?
[0309] Specifically, when the segmented dialogue content can map to random events, the probability of the random event being transferred to a human agent is calculated, and it is determined whether the probability of transferring to a human agent is less than the probability threshold. If the probability of transferring to a human agent is less than the probability threshold, the process jumps to step S2005. If the probability of transferring to a human agent is greater than or equal to the probability threshold, the process jumps to step S2007.
[0310] Step S2005: Infer the next random variable;
[0311] Specifically, when the probability of switching to human intervention is less than the probability threshold, it means that the dialogue generation model can still provide users with troubleshooting solutions. Based on the random events mapped from the dialogue content after the current segmentation, the next random variable is inferred by a Bayesian network.
[0312] Step S2006: Supplement random event rule information;
[0313] Specifically, this random event rule information is supplemented based on standard screening procedures.
[0314] Step S2007: Return to the dialogue generation model;
[0315] Specifically, once the current dialogue is switched to human processing, the system returns to the dialogue generation model and ends the dialogue generation model.
[0316] Step S2008: Merge dialogues;
[0317] Specifically, when the dialogue content after segmentation cannot map to random events, the dialogue content of the current segment is merged with the dialogue content of the next segment, and the process jumps to step S1907.
[0318] In this embodiment, the current dialogue is tracked through a mapping model to complete the mapping of dialogue content to random events. Then, a Bayesian network is used to infer and predict the next random variable, so that the dialogue generation model generates more logical dialogue content.
[0319] Please refer to the following: Figure 21 , Figure 21 This is a schematic diagram of the structure of the dialogue management device provided in the embodiments of this application;
[0320] like Figure 21 As shown, the dialogue management device 2100 includes a construction module 2101, an acquisition module 2102, a mapping module 2103, and a dialogue output module 2104.
[0321] The construction module 2101 is used to construct a Bayesian network, wherein the Bayesian network is used to construct multiple random variables and construct a set of standard statements corresponding to each random variable. The set of standard statements includes multiple standard statements, and each random variable corresponds to multiple random events, the random events being the values of the random variables.
[0322] The acquisition module 2102 is used to acquire the first dialogue content, wherein the first dialogue content includes the dialogue content input by the user and the dialogue content replied by the virtual agent;
[0323] The mapping module 2103 is used to map the first dialogue content to a first random event based on the first dialogue content according to the pre-trained mapping model, wherein the mapping model is used to map the dialogue content to the random event, and the first random event is one of a plurality of random events.
[0324] The dialogue output module 2104 is used to output a first standard dialogue based on a first random event according to a Bayesian network, and to continue to acquire the second dialogue content and map the second dialogue content to a second random event. Based on the second random event according to the Bayesian network, the second standard dialogue is output. The second dialogue content is the next dialogue content after the first dialogue content, and the second random event is one of multiple random events.
[0325] The dialogue management device 2100 includes a mapping model and a dialogue generation model;
[0326] The mapping model is used to construct a mapping relationship between dialogue fragments and random events based on the random events constructed in the Bayesian network after the Bayesian network is built.
[0327] The dialogue generation model is used to map random events based on user input and output the standard dialogue corresponding to the random events.
[0328] In this embodiment of the application, both the mapping model and the dialogue generation model are trained based on the Qianwen Big Model.
[0329] In this embodiment of the application, training the Qianwen Big Data Model to obtain a mapping model specifically includes: acquiring historical dialogue data, which includes user input and virtual agent responses; dividing the historical dialogue data into multiple minimal dialogue segments based on a question-and-answer format, and ensuring that each minimal dialogue segment can infer a random event; constructing a mapping relationship between each minimal dialogue segment and a random event, i.e., labeling each minimal dialogue segment with a random event, so that each minimal dialogue segment is mapped to a random event; using the mapping relationship between each minimal dialogue segment and the random event as training data; and training the Qianwen Big Data Model based on the training data corresponding to the mapping relationship between the minimal dialogue segments and the random events to obtain the mapping model. The mapping model can map dialogue content to random events to achieve rapid understanding of user-input dialogue content.
[0330] In this embodiment, training the Qianwen Big Data model to obtain a dialogue generation model specifically includes: obtaining the vector set corresponding to random variables and the vector set corresponding to historical dialogue data; filtering the dialogue content input by the user in the historical dialogue data to obtain the dialogue content of the virtual agent's reply; calculating the cosine similarity between each dialogue in the dialogue content of the virtual agent's reply and the random variable; adding dialogues with a cosine similarity greater than a threshold to the dialogue set corresponding to the random variable to obtain the dialogue set corresponding to each random variable; further filtering the dialogues in the dialogue set corresponding to each random variable to obtain the first set of dialogues corresponding to each random variable; and then calculating the Jaccard distance between the standard dialogues in the first set of dialogues corresponding to each random variable and each dialogue in the dialogue content of the virtual agent's reply in the historical dialogue data. For dialogues in virtual agent responses with a distance threshold, add them to a similar dialogue set. Then, manually filter the dialogue content in the similar dialogue sets corresponding to each random variable to obtain a second set of dialogue phrases, which is the standard dialogue set. Add the second set of dialogue phrases corresponding to each random variable to the standard dialogue vector retrieval library. Calculate the cosine similarity between the standard dialogue phrases in the second set and each dialogue in the virtual agent responses from historical dialogue data. Add dialogues with a cosine similarity greater than the threshold to the set corresponding to the random variable of that standard dialogue phrase. Finally, add the random variable corresponding to the standard dialogue phrase with the highest cosine similarity in that set to the dialogue content corresponding to that highest cosine similarity.
[0331] In this embodiment of the application, based on Bayesian networks, random variables are added to the dialogues in the historical dialogue data to obtain multiple dialogues with random variable features, that is, historical dialogue data with random variable features is obtained. The historical dialogue data with random variable features includes multiple dialogues with random variable features. The historical dialogue data with random variable features is used as the training data of the Qianwen Big Model to obtain the dialogue generation model.
[0332] In this embodiment, the dialogue management device 2100 can be a software module. The software module includes several instructions, which are stored in a memory. The processor can access the memory and call the instructions to execute them in order to complete the dialogue management methods of the above embodiments.
[0333] In the embodiments of this application, the dialogue management device can also be constructed from hardware devices. For example, the dialogue management device can be constructed from one or more chips, and the chips can work together to complete the dialogue management method described in the above embodiments. Furthermore, the dialogue management device can also be constructed from various logic devices, such as general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), microcontrollers, ARM (Acorn RISC Machine) or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of these components.
[0334] The dialogue management device in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0335] The dialogue management device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0336] The dialogue management devices provided in the embodiments of this application can all achieve... Figure 1 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0337] It should be noted that the above-described device can execute the dialogue management method provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects of executing the method. Technical details not described in detail in the device embodiments can be found in the dialogue management method provided in the embodiments of this application.
[0338] In this embodiment, by combining the mapping model and dialogue generation model in the dialogue management device, an efficient and intelligent dialogue system is constructed, enabling the system to automatically understand the random events corresponding to the user's input and generate logical dialogue responses based on the random events, thereby improving the accuracy and efficiency of the dialogue content output by the model.
[0339] Please refer to the following: Figure 22 , Figure 22 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0340] like Figure 22 As shown, the electronic device 2200 includes one or more processors 2201 and a memory 2202. Wherein, Figure 22 Take a processor 2201 as an example.
[0341] Processor 2201 and memory 2202 can be connected via a bus or other means. Figure 22 Taking the example of a connection between China and Israel via a bus.
[0342] A processor is configured to execute the dialogue management method in any embodiment of this application, the method comprising:
[0343] Construct a Bayesian network, in which the Bayesian network is used to construct multiple random variables and a set of standard statements corresponding to each random variable. The set of standard statements includes multiple standard statements, and each random variable corresponds to multiple random events, where the random events are the values of the random variables.
[0344] Obtain the first conversation content, which includes the conversation content entered by the user and the conversation content replied by the virtual agent;
[0345] Based on the pre-trained mapping model, the first dialogue content is mapped to the first random event, where the mapping model is used to map the dialogue content to the random event, and the first random event is one of a plurality of random events.
[0346] According to the Bayesian network, based on the first random event, the first standard dialogue is output, and the second dialogue content is obtained. The second dialogue content is then mapped to the second random event. According to the Bayesian network, based on the second random event, the second standard dialogue is output. Here, the second dialogue content is the next dialogue content after the first dialogue content, and the second random event is one of multiple random events.
[0347] The memory 2202, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the dialogue management method in this embodiment of the invention. The processor 2201 executes various functional applications and data processing of the electronic device by running the non-volatile software programs, instructions, and modules stored in the memory 2202, thereby implementing the dialogue management method of the above-described method embodiment.
[0348] Memory 2202 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 2202 may optionally include memory remotely located relative to processor 2301. Examples of the above-described networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0349] One or more modules are stored in memory 2202. When executed by one or more processors 2201, they perform the dialogue management method in any of the above method embodiments, for example, the method described above. Figure 1 The steps shown.
[0350] This application also provides a computer program product, which includes one or more lines of program code stored in a non-volatile computer-readable storage medium. The processor of an electronic device reads the program code from the non-volatile computer-readable storage medium and executes the program code to complete the steps of the dialogue management method provided in the above embodiments.
[0351] Based on the above description of the embodiments, those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program or program code related to hardware. The program can be stored in a non-volatile computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0352] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The non-volatile computer-readable storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0353] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations as described above in different aspects of this application, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.< / assistant>
Claims
1. A dialogue management method, characterized in that, The method includes: Construct a Bayesian network, wherein the Bayesian network is used to construct multiple random variables and construct a set of standard dialogues corresponding to each random variable, the set of standard dialogues includes multiple standard dialogues, each random variable corresponds to multiple random events, and the random events are the values of the random variables; Obtain the first dialogue content, wherein the first dialogue content includes the dialogue content input by the user and the dialogue content replied by the virtual agent; According to a pre-trained mapping model, the first dialogue content is mapped to a first random event based on the first dialogue content, wherein the mapping model is used to map the dialogue content to a random event, and the first random event is one of a plurality of random events; According to the Bayesian network, based on the first random event, a first standard dialogue is output, and a second dialogue content is obtained. The second dialogue content is mapped to a second random event. According to the Bayesian network, based on the second random event, a second standard dialogue is output. The second dialogue content is the next dialogue content after the first dialogue content, and the second random event is one of the multiple random events.
2. The method according to claim 1, characterized in that, The construction of the Bayesian network includes: Construct multiple random variables, wherein the random variables include at least one of the following: unplugging and plugging in the power cord, TV reset, and restoration system; A Bayesian network probability graph and a conditional probability table are constructed to obtain the Bayesian network, wherein the Bayesian network includes a Bayesian network probability graph and a conditional probability table, the nodes of the Bayesian network probability graph are the random variables, the Bayesian network probability graph is used to represent the dependencies between random variables, and the conditional probability table is used to provide the complete probability distribution of each random variable under a given state of its parent node.
3. The method according to claim 2, characterized in that, The method further includes: Training the Bayesian network specifically includes: Construct multiple directed graphs, wherein the nodes of the directed graphs are the random events; A graph search is performed on the directed graph to generate multiple training data sets; Based on the training data, the Bayesian network is trained to obtain the trained Bayesian network.
4. The method according to claim 3, characterized in that, The construction of the standard dialogue set corresponding to each random variable includes: Obtain the vector set corresponding to the random variable and the vector set corresponding to the historical dialogue data, wherein the historical dialogue data includes the historical dialogue content of the virtual agent's replies; Based on the vector set corresponding to each random variable and the vector set corresponding to the historical dialogue content of the virtual agent's reply, the first set of dialogue scripts corresponding to each random variable is generated. Based on the first set of dialogue scripts, the historical dialogue content of the virtual agent's replies is traversed to obtain the second set of dialogue scripts corresponding to each random variable, wherein the second set of dialogue scripts is the standard set of dialogue scripts.
5. The method according to claim 4, characterized in that, The first set of dialogue scripts includes multiple dialogue scripts. Based on the first set of dialogue scripts, the second set of dialogue scripts corresponding to each random variable is obtained by traversing the historical dialogue content of the virtual agent's responses, including: Calculate the Jaccard distance between each dialogue in the first dialogue set corresponding to each random variable and each dialogue in the historical dialogue content of the virtual agent's reply; Based on the Jaccard distance, the dialogues similar to each utterance are determined, and the set of similar dialogues corresponding to each random variable is obtained. Filter the dialogues that are not associated with the random variables in the similar dialogue sets corresponding to each random variable to obtain the second dialogue set corresponding to each random variable.
6. The method according to claim 5, characterized in that, The method further includes: Training the mapping model to obtain the pre-trained mapping model specifically includes: Acquire historical dialogue data and divide the historical dialogue data into multiple minimum dialogue segments, wherein the historical dialogue data includes historical dialogue content input by the user and historical dialogue content replied by the virtual agent; Construct a mapping relationship between each of the minimum dialogue segments and random events; The mapping relationship between all the smallest dialogue segments and random events is used as training data to train the mapping model, resulting in a pre-trained mapping model.
7. The method according to claim 6, characterized in that, The process of constructing the mapping relationship between each of the minimum dialogue segments and random events includes: Calculate the first cosine similarity between each dialogue in each of the minimum dialogue segments and each random event; Random events with a first cosine similarity greater than a similarity threshold are added to the set of similar random events, where each dialogue in each minimum dialogue segment corresponds to a set of similar random events. Merge the sets of similar random events corresponding to each dialogue in the same minimum dialogue segment to obtain the set of similar random events corresponding to the minimum dialogue segment. The set of random events with the highest similarity to the smallest dialogue segment is selected as the candidate random event set corresponding to the smallest dialogue segment. Select a random event from the set of candidate random events, and use the random event as the label of the smallest dialogue segment corresponding to the set of candidate random events, so that the smallest dialogue segment is mapped to a random event.
8. The method according to claim 7, characterized in that, The method further includes: When the first cosine similarity is less than or equal to the similarity threshold, the current minimum dialogue segment is merged with the next minimum dialogue segment, and the step of constructing the mapping relationship between each minimum dialogue segment and the random event continues.
9. The method according to claim 8, characterized in that, The random event includes a call to a human operator. After mapping the dialogue content to the random event, the method further includes: Based on the trained Bayesian network, the probability of the random event being transferred to manual intervention is determined. If the probability of the random event being transferred to a human agent is greater than or equal to the probability threshold, then the current dialogue will be transferred to human agent processing. If the probability of the random event being transferred to a human agent is less than the probability threshold, then the next dialogue content is obtained, and the dialogue mapping to random events continues.
10. The method according to claim 1, characterized in that, The step of outputting a first standard script based on the first random event according to the Bayesian network includes: Based on the random variable corresponding to the first random event, output the next random variable; Calculate the second cosine similarity between each standard dialogue in the set of standard dialogues corresponding to the next random variable and the content of the first dialogue; The standard phrase with the highest second cosine similarity is taken as the first standard phrase corresponding to the first random event.
11. The method according to claim 1, characterized in that, The step of mapping the second dialogue content to a second random event, and outputting a second standard script based on the second random event according to the Bayesian network, includes: Based on a pre-trained mapping model, the second dialogue content is mapped to a second random event; Based on the random variable corresponding to the second random event, output the next random variable; Calculate the third cosine similarity between each standard dialogue in the set of standard dialogues corresponding to the next random variable and the content of the second dialogue; The standard phrase with the highest third cosine similarity is used as the second standard phrase corresponding to the second random event.
12. A dialogue management device, characterized in that, The device includes: A construction module is used to construct a Bayesian network, wherein the Bayesian network is used to construct multiple random variables and construct a set of standard dialogues corresponding to each random variable. The set of standard dialogues includes multiple standard dialogues, and each random variable corresponds to multiple random events, wherein the random events are the values of the random variables. The acquisition module is used to acquire the first dialogue content, wherein the first dialogue content includes the dialogue content input by the user and the dialogue content replied by the virtual agent; A mapping module is used to map the first dialogue content to a first random event based on the first dialogue content according to a pre-trained mapping model, wherein the mapping model is used to map the dialogue content to a random event, and the first random event is one of a plurality of random events; The dialogue output module is used to output a first standard dialogue based on the first random event according to the Bayesian network, and to continue to acquire the second dialogue content, and map the second dialogue content to the second random event. Based on the second random event according to the Bayesian network, the module outputs a second standard dialogue, wherein the second dialogue content is the next dialogue content after the first dialogue content, and the second random event is one of the multiple random events.
13. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute executable program code in the memory, wherein when the executable program code is executed, the processor executes instructions of the dialogue management method as described in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the dialogue management method as described in any one of claims 1 to 11.