A dialogue generation method and related device
By analyzing the user's current question, historical dialogues, and dialogue context, the system generates emotionally matched response voices, solving the problem of low intelligence in device responses, achieving emotional responses, and improving the user experience.
Patent Information
- Application Number
- CN202611397159.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-11-27
AI Technical Summary
The existing devices have a low level of intelligence in their responses, which fails to meet users' diverse and emotional needs for response content.
By analyzing the user's current question information, historical dialogue information, and dialogue background, the system determines the user's emotional tone in response and generates a response voice that matches the emotional style, including adjustments to acoustic elements such as tone, speed, timbre, and volume.
The device's response intelligence has been improved, enabling responses not only to solve problems but also to address user emotions and enhance the user experience.
Smart Images

Figure CN123180356A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of dialogue technology, and in particular to a dialogue generation method and related equipment. Background Technology
[0002] With the development of technology, devices are becoming increasingly intelligent. Users can ask questions of the device, and the device will respond based on the user's questions.
[0003] In the exemplary technology, the device uses the user's question information to respond to the questions in the question information.
[0004] However, users' demands for device responses are constantly increasing. Simply providing responses that solve problems is no longer sufficient to meet user needs, indicating that the device's response intelligence level is low. Summary of the Invention
[0005] Based on the aforementioned technological status, this application provides a dialogue generation method and related equipment to address the problem of low intelligence in device responses.
[0006] To achieve the above-mentioned technical objectives, this application proposes the following technical solution: Firstly, this application provides a dialogue generation method, including: Based on the first user's current first question information, the first user's historical dialogue information, and the current dialogue background, determine the first response sentiment corresponding to the first user; Generate a first response text based on the sentiment of the first response and the information of the first question; Based on the first reply text, generate a reply voice containing the emotional style matching the first reply, and output the reply voice.
[0007] In some implementations, determining the first response sentiment corresponding to the first user based on the first user's current first question information, the first user's historical dialogue information, and the current dialogue background includes: Based on the first question information, the current dialogue background, and the first user's historical dialogue information, multiple emotions to be determined are identified. The reward parameters for each emotion to be determined are determined based on the emotion decision-making model; The sentiment to be determined corresponding to the reward parameter that is greater than a preset threshold is determined as the first response sentiment corresponding to the first user.
[0008] In some implementations, before determining multiple emotions to be determined based on the first question information, the current dialogue context, and the first user's historical dialogue information, the method further includes: Multiple training samples are obtained, including the question information of the second user to be answered, the response sentiment of the question information to be answered, the historical dialogue background, and the historical dialogue information of the second user. The preset model is trained based on each of the training samples to obtain the emotion decision model.
[0009] In some implementations, training the preset model based on each of the training samples includes: The training samples are input into the preset model to obtain the second user's second response sentiment output by the preset model; Based on the sentiment of the second response and the question information to be answered, determine the text of the second response; The quality parameters were obtained by performing a quality assessment on the second response text; The preset model is updated based on the quality parameters and the second response sentiment.
[0010] In some implementations, determining the first response sentiment corresponding to the first user based on the first user's current first question information, the first user's historical dialogue information, and the current dialogue background includes: The first question information, the current dialogue background, and the first user's historical dialogue information are added to the emotion template to obtain the emotion decision prompt word template; Based on the emotional decision prompt word template, the first response emotion corresponding to the first user is generated.
[0011] In some implementations, generating the first response text based on the first response sentiment and the first question information includes: Add the first question information, the first user's historical dialogue information, and the first response sentiment to the response generation template to obtain the sentiment response prompt word template; Based on the emotional response prompt template, a first response text matching the emotional tone of the first response is generated.
[0012] In some implementations, generating a response voice with an emotional style matching the first response text includes: Based on the sentiment of the first response, the acoustic elements of the phrases in the first response text are determined, and the acoustic elements include at least one of tone, speech rate, timbre and volume; Based on the acoustic elements corresponding to each phrase in the first reply text, the first reply text is converted into speech to obtain a reply speech containing the emotional style of the first reply.
[0013] Secondly, this application provides an electronic device, including a memory and a processor, wherein, The memory is connected to the processor and is used to store programs; The processor is configured to implement the dialogue generation method as described in the first aspect or any implementation thereof by running a program in the memory.
[0014] Thirdly, this application provides a computer program product, including computer instructions, which, when executed by a processor, implement the dialogue generation method as described in the first aspect or any implementation thereof.
[0015] Fourthly, this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the dialogue generation method as described in the first aspect or any implementation thereof.
[0016] This application provides a dialogue generation method and related device. By analyzing the user's current question information, dialogue background, and historical dialogue information, the method determines the user's emotional tone in their response. Based on this emotional tone and the question information, it generates response text, and then generates response speech with a matching emotional style, which is then output as response speech. In this application, the required emotional tone for responding to the user is predicted based on the user's current question, dialogue background, and historical dialogue. This allows for the generation of response speech that responds to the user's emotions, ensuring that the output response speech not only addresses the problem but also responds to the user's emotions, thus improving the intelligence of the electronic device's response capabilities. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0018] Figure 1 A flowchart of a dialogue generation method provided in this application embodiment Figure 1 .
[0019] Figure 2 A flowchart of a dialogue generation method provided in this application embodiment Figure 2 .
[0020] Figure 3 A flowchart of a dialogue generation method provided in this application embodiment Figure 3 .
[0021] Figure 4 A flowchart of a dialogue generation method provided in this application embodiment Figure 4 .
[0022] Figure 5 This is a schematic diagram of the functional modules of an electronic device provided in an embodiment of this application.
[0023] Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0024] 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 application, and 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.
[0025] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0026] With the development of technology, devices are becoming increasingly intelligent. Users can ask questions of the device, and the device will respond based on the user's questions.
[0027] In the exemplary technology, the device uses the user's question information to respond to the questions in the question information.
[0028] However, users' demands for device responses are constantly increasing. Simply providing responses that solve problems is no longer sufficient to meet user needs, indicating that the device's response intelligence level is low.
[0029] Therefore, this application provides a dialogue generation method, and the following detailed description of the dialogue generation method proposed in this application is provided through various embodiments.
[0030] Reference Figure 1 , Figure 1 A flowchart of a dialogue generation method provided in this application embodiment Figure 1 .like Figure 1 As shown, the dialogue generation method provided in this embodiment includes: Step S101: Determine the first response sentiment corresponding to the first user based on the first user's current first question information, the first user's historical dialogue information, and the current dialogue background.
[0031] In this embodiment, the executing entity is an electronic device. For ease of description, the term "device" will be used to refer to the electronic device below. The electronic device can be any device capable of interacting with the user, such as a robot or a self-service device. The electronic device can also be a component within a device capable of interacting with the user.
[0032] After collecting the user's current problem information, the device needs to respond to the user based on this information. The device can collect the current problem information through a voice acquisition module, or the user can input the current problem information directly into the device. The current problem information is defined as the first problem information, and the user is defined as the first user.
[0033] After collecting the user's first question information, the device extracts the user's identity identifier, such as the user's voiceprint characteristics. Based on the identity identifier, the device extracts the user's historical dialogue information, which includes the user's historical questions to the device and historical responses to those questions. The number of historical questions is determined based on the number of historical dialogue rounds between the user and the device. For example, if the user has had 5 rounds of dialogue with the device, the historical dialogue information includes 5 historical questions and their corresponding historical responses.
[0034] After extracting historical dialogue information, the device determines the current dialogue context by combining the first question information and the historical dialogue information. For example, scenario analysis is performed on the first question information and the historical dialogue information to obtain the dialogue context; for instance, based on the first question information and the historical dialogue information, it can be determined that the user is inquiring about the price of a product, and therefore the current dialogue context is "price inquiry".
[0035] The device determines the sentiment of the first response corresponding to the first user based on the first question information, historical dialogue information, and the current dialogue context.
[0036] In one example, the current dialogue context is "price inquiry." In this context, the first user is generally in a state of curiosity. Based on the initial question information and historical dialogue information, it's determined that the first user is asking fewer and fewer questions, indicating a gradual decrease in curiosity and a more neutral mood. Therefore, the user's actual emotion is calm, and curiosity is corrected to calmness. However, responding to the first user with a calm tone would likely cause them to leave; therefore, calmness is changed to a positive emotion such as "lightheartedness." The process involves determining the first user's initial emotion based on the current dialogue context, analyzing the emotional trend based on the initial question information and historical dialogue information, and then correcting the initial emotion to obtain an intermediate emotion. If the probability of the intermediate emotion causing the first user to leave exceeds a set threshold, the intermediate emotion is corrected to a positive emotion as the first response emotion. A positive emotion results in a higher user retention rate than a preset threshold.
[0037] In another example, adding the first question information, the current dialogue context, and the first user's historical dialogue information to the sentiment template yields a sentiment decision prompt template. For example, the sentiment decision prompt template might be: "Based on the current dialogue history {dialogue history}, dialogue context, and user input {user input}, please select the most suitable sentiment from the candidate sentiment {candidate list}." The device inputs the sentiment decision prompt template into its sentiment generation model to obtain the first response sentiment output by the sentiment generation model.
[0038] Step S102: Generate the first response text based on the sentiment of the first response and the information of the first question.
[0039] After obtaining the sentiment of the first response, a response text is generated based on the sentiment of the first response and the information of the first question. The response text is defined as the first response text.
[0040] In one example, the first response sentiment and the first question information are input into the big language generation model. The big language generation model uses the first response sentiment as a prompt word to generate the first response text for the first question information. That is, the content of the first response text not only includes the answer to the question in the first question information, but the style of the first response text also matches the first response sentiment.
[0041] In another example, the device also includes a response generation template. The device adds the first question information, historical dialogue information, and the first response sentiment to the response generation template to obtain a sentiment response prompt template. For example, the sentiment response prompt template might be: "Based on the current dialogue history {dialogue history} and user input {user input}, please use the sentiment {sentiment} to provide an appropriate response." Based on the sentiment response prompt template, the device generates a first response text that matches the first response sentiment. If the sentiment response prompt template is used as a prompt and input into a large language generation model, the first response text output by the large language generation model can be obtained.
[0042] Step S103: Based on the first reply text, generate a reply voice with an emotional style that matches the emotional style of the first reply, and output the reply voice.
[0043] After obtaining the first reply text, a reply voice with an emotional style matching the first reply is generated based on the first reply text, and the reply voice is output. The reply voice can be generated by the speech synthesis module. For example, when the first reply has a light and cheerful emotion and a relaxed and comfortable emotional style, the reply voice will have a faster speaking speed, a medium volume, and a cheerful, girlish tone.
[0044] The first response text can be output in a streaming manner, thereby generating a streaming response voice based on the streaming first response text, thus improving the timeliness of the device's response to the user.
[0045] In this embodiment, the user's current question information, dialogue background, and historical dialogue information are used to determine the user's emotional tone in response. A response text is then generated based on this emotional tone and the question information. Finally, a response voice with a matching emotional style is generated from the response text for output. This embodiment predicts the required emotional tone for the response based on the user's current question, dialogue background, and historical dialogue, thereby generating a response voice that responds to the user's emotions. This ensures that the output response voice not only addresses the problem but also responds to the user's emotions, improving the intelligence of the electronic device's response capabilities.
[0046] Reference Figure 2 , Figure 2 A flowchart of a dialogue generation method provided in this application embodiment Figure 2 ,based on Figure 1 In the embodiment shown, step S101 includes: Step S201: Based on the first question information, the current dialogue background, and the first user's historical dialogue information, determine multiple emotions to be determined.
[0047] In this embodiment, the device determines multiple emotions based on the current dialogue context, the first question information, and historical dialogue information. Each emotion is defined as an emotion to be determined.
[0048] In one example, the current dialogue context is "inquiry," in which the first user is generally in a state of curiosity. Based on the first question information and historical dialogue information, it is determined that the first user is asking fewer and fewer questions, indicating that the user's curiosity is gradually decreasing and the user's emotions are becoming more neutral. Therefore, it can be determined that the first user's actual emotion is calm, that is, curiosity is corrected to calmness. However, if the first user is responded to with a calm tone, the first user is more likely to withdraw. Therefore, calmness is changed to positive emotions such as "lighthearted," "happy," and "positive" as the emotion to be determined.
[0049] In another example, "curiosity" and "calmness" can both be considered as emotions to be determined.
[0050] In another example, the first question information, the current dialogue context, and the first user's historical dialogue information are input into the sentiment decision model, which outputs multiple emotions to be determined.
[0051] Step S202: Determine the reward parameters for each emotion to be determined based on the emotion decision model.
[0052] The device is equipped with an emotion decision-making model. The device inputs each emotion to be determined into the emotion decision-making model, and the emotion decision-making model outputs the reward parameter of the emotion to be determined. The reward parameter can be its value. That is, the emotion decision-making model is a model used to determine the value of the parameter. The emotion decision-making model is trained by a deep learning model.
[0053] Step S203: The sentiment to be determined corresponding to the reward parameter that is greater than the preset threshold is determined as the first response sentiment corresponding to the first user.
[0054] After determining the reward parameters for each emotion to be determined, a first response emotion is determined among the emotions to be determined based on the reward parameters. For example, the emotion to be determined corresponding to the reward parameter greater than a preset threshold is taken as the first response emotion. If there are multiple reward parameters greater than the preset threshold, the emotion to be determined corresponding to the largest reward parameter is determined as the first response emotion.
[0055] In this embodiment, the device determines the emotion to be determined based on the first question information, the current dialogue background, and the historical dialogue information, and determines the reward parameter for each emotion to be determined based on the emotion decision model, thereby accurately determining the first response emotion based on the reward parameter.
[0056] Figure 3 A flowchart of a dialogue generation method provided in this application embodiment Figure 3 ,based on Figure 2In the embodiment shown, prior to step S201, the method further includes: Step S301: Obtain multiple training samples, including the second user's question information to be replied to, the sentiment of the reply to the question information to be replied to, the historical dialogue background, and the second user's historical dialogue information.
[0057] In this embodiment, the device acquires multiple training samples, including the second user's question information to be answered, the second user's historical dialogue information before the question information to be answered, and the historical dialogue background.
[0058] Step S302: Train the preset model based on each training sample to obtain the emotion decision model.
[0059] After obtaining multiple training samples, the device trains the preset model using each training sample to obtain the emotion decision model.
[0060] In one example, the training samples are labeled with the sentiment of the responses to the questions to be answered. The preset model determines the second sentiment of the responses through the training samples. Based on the error between the second sentiment of the responses and the labeled sentiment of the responses, the parameters of the preset model are updated.
[0061] In another example, the device inputs training samples into a preset model to obtain the second user's second response sentiment output by the preset model. Based on the second response sentiment and the question information to be answered, the device determines the second response text, that is, the second response text contains text that matches the sentiment of the second response. The device evaluates the second response text to obtain quality parameters, and performs evaluations on dimensions, such as sentiment consistency evaluation, sentiment attention rationality evaluation, and sentiment and behavioral function consistency evaluation, to obtain multiple parameters. Each parameter is converted into a corresponding score, and a weighted sum is performed based on each score and its corresponding weight to obtain the quality parameter. The larger the quality parameter, the higher the quality of the second response text. Based on the quality parameter and the second response sentiment, the device updates the parameters of the preset model.
[0062] For example, a reward function is first constructed using the sentiment of the second response, quality parameters, and labeled response sentiment (the true labels of the training samples). The reward function is as follows: ;in, For quality parameters, when the second response is emotional... The same applies, with a reward coefficient of 1, which is... If they are different, the reward coefficient is 0.
[0063] The preset model determines the loss function based on the reward function. The loss function is: ;in, For the reward function, For value function, This includes unanswered questions, historical dialogue information, and the background of those dialogues. For the second response of emotion, in Add a second reply text to get , Respond with emotions for tags.
[0064] Once the loss function is obtained, the parameters of the preset model can be updated based on the loss function.
[0065] In this embodiment, the device trains a preset model based on multiple training samples to obtain a high-performance emotion decision-making model. Figure 4 A flowchart of a dialogue generation method provided in this application embodiment Figure 4 .based on Figures 1 to 3 In any of the embodiments shown, step S103 includes: Step S401: Based on the sentiment of the first response, determine the acoustic elements of the phrases in the first response text. The acoustic elements include at least one of tone, speech rate, timbre, and volume.
[0066] In this embodiment, the device determines the acoustic elements of phrases in the first response text based on the first response sentiment. The acoustic elements include at least one of tone, speech rate, timbre, and volume.
[0067] For example, the device can select modal particles, such as "ya" or "ah," in the first response text. Modal particles can best reflect the emotion of the speech to be generated. For instance, if the emotion of the first response is neutral, the tone of the modal particles will be in the first tone; if the emotion of the first response is curiosity, the tone of the modal particles will be in the second tone, and the volume will be greater than a preset decibel. For non-modal particles, the default acoustic elements are selected.
[0068] Step S402: Based on the acoustic elements corresponding to each phrase in the first reply text, convert the first reply text into speech to obtain a reply speech containing the emotional style of the first reply.
[0069] In this way, the device can determine the acoustic elements corresponding to each phrase in the first reply text, and then convert the phrases into speech based on the acoustic elements of each phrase to obtain a reply speech containing the emotional style of the first reply.
[0070] In this embodiment, the acoustic elements of phrases in the response text are determined by the response sentiment, thereby accurately generating response speech with an emotional style that matches the response sentiment.
[0071] Corresponding to the dialogue generation method described above, this application also provides an electronic device. Figure 5 This is a schematic diagram of a module of an electronic device provided in an embodiment of this application. The electronic device 500 provided in this embodiment includes: The determination module 510 is used to determine the first response sentiment of the first user based on the first user's current first question information, the first user's historical dialogue information, and the current dialogue background. The first generation module 520 is used to generate the first reply text based on the sentiment of the first reply and the information of the first question; The second generation module 530 is used to generate a reply voice containing the emotional style of the first reply text based on the first reply text, and output the reply voice.
[0072] In some implementations, electronic device 500 is also used for: Based on the information from the first question, the current dialogue context, and the first user's historical dialogue information, multiple emotions to be determined are identified. The reward parameters for each emotion to be determined are determined based on the emotion decision-making model; The sentiment to be determined corresponding to the reward parameter that exceeds the preset threshold is determined as the first response sentiment corresponding to the first user.
[0073] In some implementations, electronic device 500 is also used for: Multiple training samples were obtained, including the second user's question information to be answered, the sentiment of the response to the question information to be answered, the historical dialogue background, and the second user's historical dialogue information. The preset model is trained based on each training sample to obtain the emotion decision model.
[0074] In some implementations, electronic device 500 is also used for: The training samples are input into the preset model to obtain the second user's second response sentiment output by the preset model; Based on the sentiment of the second response and the information of the question to be answered, determine the text of the second response; Quality parameters were obtained by performing a quality assessment on the second response text. The parameters of the preset model are updated based on the quality parameters and the sentiment of the second response.
[0075] In some implementations, electronic device 500 is also used for: Add the first question information, the current dialogue background, and the first user's historical dialogue information to the sentiment template to obtain the sentiment decision prompt word template; Based on the sentiment decision prompt template, generate the first response sentiment for the first user.
[0076] In some implementations, electronic device 500 is also used for: Add the first question information, the first user's historical dialogue information, and the first response sentiment to the response generation template to obtain the sentiment response prompt word template; Based on the emotional response prompt template, generate a first response text that matches the emotional tone of the first response.
[0077] In some implementations, electronic device 500 is also used for: Based on the sentiment of the first response, determine the acoustic elements of the phrases in the first response text. The acoustic elements include at least one of tone, speech rate, timbre, and volume. Based on the acoustic elements corresponding to each phrase in the first reply text, the first reply text is converted into speech to obtain a reply speech containing the emotional style matching the first reply.
[0078] The electronic device provided in the above embodiments of this application and the above dialogue generation method belong to the same application concept, and can execute the dialogue generation method provided in any of the above embodiments of this application, possessing the corresponding functional modules and beneficial effects for executing the dialogue generation method. Technical details not described in detail in this embodiment can be found in the specific processing content of the dialogue generation method provided in the above embodiments of this application, and will not be repeated here.
[0079] The functions implemented by the various modules in an electronic device can be implemented by the same or different processors, and this application does not limit this.
[0080] It should be understood that the modules in the above electronic devices can be implemented by a processor calling firmware. For example, the system includes a processor connected to a memory containing instructions. The processor calls the instructions stored in the memory to implement any of the above methods or to implement the functions of each module of the device. The processor can be a general-purpose processor, such as a CPU or microprocessor, and the memory can be internal to the device or external to the system. Alternatively, the modules in the system can be implemented as hardware circuits. By designing the hardware circuits, some or all of the module functions can be implemented. The hardware circuit can be understood as one or more processors. For example, in one implementation, the hardware circuit is an ASIC, and the functions of some or all of the above modules are implemented by designing the logical relationships between the components within the circuit. In another implementation, the hardware circuit can be implemented by a PLD, such as an FPGA, which can include a large number of logic gates. The connection relationships between the logic gates are configured through configuration files to implement the functions of some or all of the above modules. All modules of the above electronic devices can be implemented entirely by a processor calling firmware, entirely by hardware circuits, or partially by a processor calling firmware with the remaining parts implemented by hardware circuits.
[0081] In this application embodiment, a processor is a circuit with signal processing capabilities. In one implementation, the processor can be a circuit with instruction reading and execution capabilities, such as a CPU, microprocessor, GPU, or DSP. In another implementation, the processor can implement certain functions through the logical relationships of hardware circuits. These logical relationships are fixed or reconfigurable. For example, the processor may be a hardware circuit implemented as an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document and configuring the hardware circuit can be understood as the processor loading instructions to implement the functions of some or all of the above modules. Furthermore, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as an NPU, TPU, or DPU.
[0082] As can be seen, each module in the above electronic device can be one or more processors (or processing circuits) configured to implement the above methods, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor types.
[0083] Furthermore, the modules in the above-mentioned electronic devices can be integrated in whole or in part, or they can be implemented independently. In one implementation, these modules are integrated together and implemented in the form of a System-on-Chip (SoC). The SoC may include at least one processor for implementing any of the above methods or implementing the functions of the modules of the device. The at least one processor may be of different types, such as CPU and FPGA, CPU and artificial intelligence processor, CPU and GPU, etc.
[0084] This application provides a hardware structure diagram of an electronic device, see [link / reference]. Figure 6 As shown, the electronic device includes a memory 600 and a processor 610; wherein the memory 600 is connected to the processor 610 and is used to store programs; the processor 610 is used to implement the dialogue generation method disclosed in any of the above embodiments by running the programs stored in the memory 600.
[0085] Specifically, the aforementioned electronic device may further include: a bus, a communication interface 620, an input device 630, and an output device 640. The electronic device may also include a data transceiver module, an image monitoring module, and a signal monitoring module.
[0086] The processor 610, memory 600, communication interface 620, input device 630, and output device 640 are interconnected via a bus. Among them: A bus can include a pathway for transmitting information between various components in an electronic device.
[0087] The processor 610 can be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present invention. It can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0088] The processor 610 may include a main processor, as well as a baseband chip, modem, etc.
[0089] The memory 600 stores a program that executes the technical solution of this invention, and may also store an operating system and other key business functions. Specifically, the program may include program code, which includes computer operation instructions. More specifically, the memory 600 may include read-only memory (ROM), other types of static storage devices capable of storing static information and instructions, random access memory (RAM), other types of dynamic storage devices capable of storing information and instructions, disk storage, flash memory, etc.
[0090] Input device 630 may include a device for receiving user input data and information, such as a keyboard, mouse, camera, scanner, light pen, voice input device, touch screen, pedometer, or gravity sensor.
[0091] Output device 640 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.
[0092] The communication interface 620 may include a device that uses any transceiver to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
[0093] The processor 610 executes the program stored in the memory 600 and calls other devices, which can be used to implement the various steps of any of the dialogue generation methods provided in the above embodiments of this application.
[0094] It should be noted that the electronic device can be an in-vehicle terminal, a mobile phone, a wearable device, or a server, etc.; or it can be a vehicle that includes an in-vehicle terminal, etc.
[0095] This application also proposes a chip, which includes a processor and a data interface. The processor reads and runs a program stored in the memory through the data interface to execute the dialogue generation method described in any of the above embodiments. For details of the processing and its beneficial effects, please refer to the embodiments of the dialogue generation method described above.
[0096] In addition to the methods and apparatus described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the dialogue generation methods according to various embodiments of this application as described in any of the above embodiments of this specification.
[0097] Computer program products can be written in any combination of one or more programming languages to perform the operations of the embodiments of this application. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone firmware package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0098] Furthermore, embodiments of this application may also be storage media storing a computer program, which is executed by a processor to perform the steps of the dialogue generation method according to various embodiments of this application described in any of the above embodiments of this specification, specifically implementing the steps of the dialogue generation method as described above.
[0099] For the foregoing method embodiments, in order to simplify the description, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0100] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0101] The steps in the methods of the various embodiments of this application can be adjusted, merged, or deleted in order according to actual needs, and the technical features described in each embodiment can be replaced or combined.
[0102] The units of the apparatus in the various embodiments of this application can be merged, divided, and deleted according to actual needs.
[0103] It should be understood that the disclosed terminals, devices, and methods can be implemented in other ways, given the several embodiments provided in this application. For example, the terminal embodiments described above are merely illustrative. For instance, the division of modules or sub-modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple sub-modules or modules may be combined or integrated into another module, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.
[0104] The modules or submodules described as separate components may or may not be physically separate. The components that constitute a module or submodule may or may not be physical modules or submodules; that is, they may be located in one place or distributed across multiple network modules or submodules. Some or all of the modules or submodules can be selected to achieve the purpose of this embodiment's solution, depending on actual needs.
[0105] Furthermore, the functional modules or sub-modules in the various embodiments of this application can be integrated into one processing module, or each module or sub-module can exist physically separately, or two or more modules or sub-modules can be integrated into one module. The integrated modules or sub-modules described above can be implemented in hardware or as firmware functional modules or sub-modules.
[0106] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer firmware, or a combination of both. To clearly illustrate the interchangeability of hardware and firmware, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or firmware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0107] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, firmware units executed by a processor, or a combination of both. The firmware unit can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0108] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0109] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A dialogue generation method, characterized in that, include: Based on the first user's current first question information, the first user's historical dialogue information, and the current dialogue background, determine the first response sentiment corresponding to the first user; Generate a first response text based on the sentiment of the first response and the information of the first question; Based on the first reply text, generate a reply voice containing the emotional style matching the first reply, and output the reply voice.
2. The dialogue generation method according to claim 1, characterized in that, The step of determining the first response sentiment corresponding to the first user based on the first user's current first question information, the first user's historical dialogue information, and the current dialogue background includes: Based on the first question information, the current dialogue background, and the first user's historical dialogue information, multiple emotions to be determined are identified. The reward parameters for each emotion to be determined are determined based on the emotion decision-making model; The sentiment to be determined corresponding to the reward parameter that is greater than a preset threshold is determined as the first response sentiment corresponding to the first user.
3. The dialogue generation method according to claim 2, characterized in that, Before determining multiple emotions to be determined based on the first question information, the current dialogue background, and the first user's historical dialogue information, the method further includes: Multiple training samples are obtained, including the question information of the second user to be answered, the response sentiment of the question information to be answered, the historical dialogue background, and the historical dialogue information of the second user. The preset model is trained based on each of the training samples to obtain the emotion decision model.
4. The dialogue generation method according to claim 3, characterized in that, The step of training the preset model based on each of the training samples includes: The training samples are input into the preset model to obtain the second user's second response sentiment output by the preset model; Based on the sentiment of the second response and the question information to be answered, determine the text of the second response; The quality parameters were obtained by performing a quality assessment on the second response text; The preset model is updated based on the quality parameters and the second response sentiment.
5. The dialogue generation method according to claim 1, characterized in that, The step of determining the first response sentiment corresponding to the first user based on the first user's current first question information, the first user's historical dialogue information, and the current dialogue background includes: The first question information, the current dialogue background, and the first user's historical dialogue information are added to the emotion template to obtain the emotion decision prompt word template; Based on the emotional decision prompt word template, the first response emotion corresponding to the first user is generated.
6. The dialogue generation method according to claim 1, characterized in that, The step of generating the first response text based on the first response sentiment and the first question information includes: Add the first question information, the first user's historical dialogue information, and the first response sentiment to the response generation template to obtain the sentiment response prompt word template; Based on the emotional response prompt template, a first response text matching the emotional tone of the first response is generated.
7. The dialogue generation method according to any one of claims 1-6, characterized in that, The step of generating a reply voice containing an emotional style matching the first reply text includes: Based on the sentiment of the first response, the acoustic elements of the phrases in the first response text are determined, and the acoustic elements include at least one of tone, speech rate, timbre and volume; Based on the acoustic elements corresponding to each phrase in the first reply text, the first reply text is converted into speech to obtain a reply speech containing the emotional style of the first reply.
8. An electronic device, characterized in that, Including memory and processor, among which, The memory is connected to the processor and is used to store programs; The processor is used to implement the dialogue generation method as described in any one of claims 1-7 by running the program in the memory.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the dialogue generation method as described in any one of claims 1-7.
10. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the dialogue generation method as described in any one of claims 1-7.
