A dialogue generation method and related equipment
By constructing a state based on users' historical dialogue information, the problem of inaccurate emotional responses in emotion-supported dialogues using large language models is solved. This enables continuous tracking of users' emotions and accuracy of emotional responses, ensuring the consistency of strategies in multi-turn dialogues.
Patent Information
- Application Number
- CN202611397158.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-11-17
AI Technical Summary
Large language models struggle to continuously track user emotional changes in emotionally supportive dialogues, leading to inaccurate emotional responses.
By constructing a state based on the user's historical dialogue information, including the user's historical question information, emotional state, and response information, the current emotional state is determined, and response information matching the current question information is generated. A finite state machine is used for strategy selection and style adjustment.
It enables continuous tracking of user emotions and accurate emotional responses, ensuring strategic coherence and emotional consistency in multi-turn dialogues.
Smart Images

Figure CN123115343A_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] Emotional Support Conversation (ESC) aims to alleviate users' emotional distress and assist them in coping with real-life problems through effective natural language interaction.
[0003] In the exemplary technology, large language models have made significant progress in natural language generation tasks and have been widely used in emotion-supported dialogue scenarios, significantly improving the fluency and diversity of generated responses.
[0004] However, the method of generating responses using large language models adopts a round-by-round generation mechanism, which makes it difficult to continuously track the dynamic changes in the emotions of users who need a response. As a result, although the generated responses answer the user's questions to some extent, they do not take into account the user's emotions, resulting in inaccurate emotional responses. 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 inaccurate emotional responses from models to users.
[0006] To achieve the above-mentioned technical objectives, this application proposes the following technical solution: Firstly, this application provides a dialogue generation method applied to an electronic device, the dialogue generation method comprising: A first state is constructed based on the user's current question information and the user's historical dialogue information, wherein the historical dialogue information includes the user's historical question information, historical emotional state, and the electronic device's historical response information to the historical question information; The user's current emotional state is determined based on the first state, and the current emotional state is added to the first state to obtain the second state; Based on the second state, generate current response information that matches the current problem information, and output the current response information.
[0007] In some implementations, generating current response information matching the current question information based on the second state includes: Determine the current dialogue generation strategy based on the second state; Add the current dialogue generation strategy to the second state to obtain the third state; Based on the third state, generate current response information that matches the current question information.
[0008] In some implementations, the second state further includes a historical dialogue generation strategy, and determining the current dialogue generation strategy based on the second state includes: Determine the initial dialogue generation strategy based on the current emotional state in the second state; Based on the historical dialogue generation strategy in the second state, the initial dialogue generation strategy is modified to obtain the current dialogue generation strategy.
[0009] In some implementations, generating current response information that matches the current question information based on the third state includes: Based on the historical response information in the third state, determine the response style of the response information to be generated; Based on the current dialogue generation strategy in the third state, determine the emotional style of the response information to be generated; Based on the response style and the emotional style, generate current response information that matches the current question information.
[0010] In some implementations, the historical dialogue information further includes a historical dialogue generation strategy. After generating the current response information matching the current question information based on the third state, the process further includes: The current response information is added to the third state to update the user's historical dialogue information. The updated historical dialogue information is used to generate the response information corresponding to the user's next question.
[0011] In some implementations, generating current response information matching the current question information based on the second state includes: The second state is input into the response generation model to obtain the current response information output by the response generation model.
[0012] In some embodiments, the electronic device includes a finite state machine for constructing a first state and a second state.
[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 used 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 equipment. A first state is constructed using the user's current question information and historical dialogue information. The user's current emotional state is determined based on the first state, and this emotional state is added to the first state to obtain a second state. Based on the second state, current response information matching the current question information is generated, and then the current response information is output. In this application, historical dialogue information includes the user's historical question information, historical emotional states, and historical response information to historical questions. This allows for continuous tracking of changes in the user's emotional state based on historical dialogue information, and subsequently, based on these changes and the current question information, a response information that responds to the user's current emotion is generated. Furthermore, by constructing information as states, the loose dialogue representation is transformed into a structured state representation, facilitating subsequent dialogue tracing based on this structured representation. 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 6This 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] Emotional Support Conversation (ESC) aims to alleviate users' emotional distress and assist them in coping with real-life problems through effective natural language interaction. Based on psychology and social support theories, this task emphasizes the gradual establishment of understanding, empathy, and guidance during the dialogue process, thus exhibiting distinct phased and strategic characteristics. In recent years, large language models have made significant progress in natural language generation tasks and have been widely applied in emotional support dialogue scenarios, significantly improving the fluency and diversity of generated responses.
[0027] Existing research has explored the ESC task from multiple perspectives. For example, some works introduce policy planning mechanisms, emphasizing the selection of support strategies at different stages of the dialogue; others focus on prospective modeling in multi-turn dialogues, enhancing the long-term consistency of the model through heuristic methods; still others model each round of interaction from the perspective of dialogue state transitions to improve the coherence of emotional support. In addition, some studies attempt to further improve the model's performance in the emotional support task through data augmentation, the introduction of expert knowledge, or multi-model collaborative training.
[0028] While the aforementioned methods improve the quality of emotional dialogue to some extent, existing methods based on large language models still primarily employ a turn-by-turn generation mechanism, lacking explicit, structured modeling of the dialogue process. Particularly when multi-turn interactions are involved, models often struggle to continuously track the dynamic changes in user emotions and lack a unified representation of the supporting strategy evolution process, resulting in issues such as inconsistent strategies and unstable emotional responses in the generated results. Furthermore, existing methods typically fail to provide a unified abstraction of the dialogue process from a "state modeling" perspective, limiting the model's planning capabilities in long-range dialogues.
[0029] To address the above problems, this application provides a dialogue generation method. 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: Construct a first state based on the user's current question information and the user's historical dialogue information, wherein the historical dialogue information includes the user's historical question information, historical emotional state, and historical response information of electronic devices to historical question information.
[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 that information. The device can collect the current problem information via a voice capture module, or the user can input the current problem information directly into the device.
[0033] After collecting the user's current 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. This historical dialogue information includes the user's past questions to the device, the user's past emotional states when asking those questions, and past responses to those questions. The number of past questions is determined by the number of rounds of dialogue 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 past questions and their corresponding past emotional states and responses. After extracting the historical dialogue information, the device adds the current question information to the historical dialogue information, thus constructing a new state, which is defined as the first state. For example, the current question information is... Historical dialogue information is Then the first state Where t refers to the current time and k refers to the current dialogue round.
[0034] Step S102: Determine the user's current emotional state based on the first state, and add the current emotional state to the first state to obtain the second state.
[0035] After obtaining the first state, the device determines the user's current emotional state based on the first state. For example, it analyzes each historical question in chronological order; for instance, it determines the trend in the number of questions asked by the user from each historical question in chronological order, such as from fewer questions to more, from general questions to more specific questions, or from more questions to fewer. The device can also analyze changes in the user's emotional state from chronological order, such as gradually becoming excited, gradually becoming indifferent, or sometimes happy and sometimes distressed. Furthermore, the device can determine the reasons for historical emotional states from historical response information. For example, historical question a is "What is the model of this car?", and historical response a is "The model of this car is xx". If the user's next historical question (after historical question a) is "What are the advantages of this model of car?", it can be determined that although historical response a solved the user's question, it did not extend the discussion, leading the user to ask another question. This is one of the factors that caused the user's indifferent mood when issuing historical question b. To address this, the device first determines the user's current emotional state based on the current question information. For example, based on the wording of the question and the user's tone of voice, a preliminary emotional state is determined. For instance, if the current question contains numerous accusatory phrases, the user's preliminary emotional state can be determined to be anger. Then, the device refines the preliminary emotional state based on the analysis of historical dialogue information to arrive at the current emotional state. For example, if the analysis of historical dialogue information indicates that the user's emotional state is gradually calming down and the number of questions is decreasing, then the user's current emotional state can be determined to be calm, not angry. In essence, the device refines the preliminary emotional state based on the analysis of historical dialogue information to accurately determine the user's current emotional state. .
[0036] After obtaining the current emotional state, the device adds the current emotional state to the first state to obtain the second state. .
[0037] Step S103: Based on the second state, generate current response information that matches the current question information, and output the current response information.
[0038] After obtaining the second state, the device generates and outputs a current response that matches the current question information. For example, the device includes a response generation model, which can be trained using a large language model. The device inputs the second state into the response generation model to obtain the current response information output by the model. During the response generation process, the following requirements must be met: the response content must be consistent with the user's current emotion, and the response method must maintain semantic coherence across multiple rounds of dialogue. The response generation model is fine-tuned based on a pre-trained large language model; that is, after the large language model is trained, it is retrained using training samples collected by the device to obtain the response generation model.
[0039] In this embodiment, a first state is constructed using the user's current question information and historical dialogue information. The user's current emotional state is determined based on this first state, and then added to the first state to obtain a second state. Based on the second state, a current response matching the current question information is generated and output. In this embodiment, historical dialogue information includes the user's historical question information, historical emotional states, and historical responses to historical questions. This allows for continuous tracking of changes in the user's emotional state based on historical dialogue information, and subsequently, based on these changes and the current question information, a response that addresses the user's current emotion is generated. Furthermore, by constructing information as states, the loose dialogue representation is transformed into a structured state representation, facilitating subsequent dialogue tracing based on this structured representation.
[0040] 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 S102 includes: Step S201: Determine the current dialogue generation strategy based on the second state.
[0041] In this embodiment, the device stores a set of predefined strategies, which contains a variety of strategies. Based on the second state, the device determines the optimal strategy from among the strategies in the set of predefined strategies as the current dialogue generation strategy.
[0042] For example, the predefined strategy set includes strategies such as exploration, empathy, soothing, suggestion, and encouragement. The device determines the dialogue generation strategy based on the current problem information in the second state. For instance, if the current emotional state in the second state is anger, the dialogue generation strategy is soothing; if the current emotional state is sadness, the dialogue generation strategy is empathy; if the current emotional state is disappointment, the dialogue generation strategy is encouragement; if the current emotional state is confusion, the dialogue generation strategy is suggestion; and if the current emotional state is novelty, the dialogue generation strategy is exploration.
[0043] Step S202: Add the current dialogue generation strategy to the second state to obtain the third state.
[0044] After obtaining the current dialogue generation strategy, the current dialogue generation strategy is added to the second state to obtain the third state. For example, the second state is... The current dialogue generation strategy is Then the third state .
[0045] Step S203: Based on the third state, generate current response information that matches the current question information.
[0046] After obtaining the third state, a response matching the current question information is generated based on the third state as the current response information. That is, the current response information includes the response content of the current dialogue generation strategy. For example, if the current dialogue generation strategy is suggestion, the response content in the current response information includes both a response to the current question information and a suggestion.
[0047] Furthermore, after receiving the current response information, it is added to the third state, thereby updating the user's historical dialogue information. This updated historical dialogue information is used to generate the response information for the user's next question. In essence, adding the current response information to the third state provides the user's latest historical dialogue information, allowing the device to respond to the user's next question based on this updated information.
[0048] In addition, the device includes a finite state machine (FSM), which is used to construct the first and second states, and can also construct the third and fourth states (updated historical dialogue information). The FSM includes transition functions. State transitions are performed using transition functions, for example, ; , By using a finite state machine, the state path (emotion recognition → policy selection → response generation) can be clearly defined, and the policy space can be structurally constrained, so that policy selection is no longer an unconstrained free generation, but an orderly evolution within reasonable stages. Compared with existing methods that are prone to policy jumps or inconsistencies, this embodiment can maintain policy continuity in multiple rounds of interaction, making the dialogue more natural, stable, and consistent with the logic of emotion support.
[0049] In this embodiment, the current dialogue generation strategy is determined by the second state, thereby accurately generating the current response information that matches the current question information based on the current dialogue generation strategy and the second state.
[0050] Figure 3 A flowchart of a dialogue generation method provided in this application embodiment Figure 3 ,based on Figure 2 In the embodiment shown, step S201 includes: Step S301: Determine the initial dialogue generation strategy based on the current emotional state in the second state.
[0051] In this embodiment, the device first generates an initial dialogue generation strategy based on the current emotional state in the second state. For example, if the current emotional state in the second state is anger, the initial dialogue generation strategy is to soothe; if the current emotional state is sadness, the initial dialogue generation strategy is to empathize; if the current emotional state is disappointment, the initial dialogue generation strategy is to encourage; if the current emotional state is confusion, the initial dialogue generation strategy is to offer advice; and if the current emotional state is novelty, the initial dialogue generation strategy is to explore.
[0052] Step S302: Based on the historical dialogue generation strategy in the second state, modify the initial dialogue generation strategy to obtain the current dialogue generation strategy.
[0053] In this embodiment, the historical dialogue information also includes a historical dialogue generation strategy, which is the dialogue generation strategy generated in the round in which the historical response information is located.
[0054] After obtaining the initial dialogue generation strategy, the device modifies the initial dialogue generation strategy based on the historical dialogue generation strategies in the second state to obtain the current dialogue generation strategy.
[0055] For example, based on historical dialogue generation strategies, the trend of strategy changes can be determined, and the initial dialogue generation strategy can be modified based on this trend. For instance, according to the chronological order of the various historical dialogue generation strategies, the trend of strategy change can be determined to be from appeasement to suggestion, which means that the user's emotional state can be determined to be from anger to rationality. If the initial dialogue generation strategy is suggestion, then suggestion will be used as the current dialogue generation strategy; if the initial dialogue generation strategy is appeasement, since the user has already entered a rational state, there is no need to appease, and appeasement can be replaced with suggestion as the current dialogue generation strategy.
[0056] In this embodiment, the device generates an initial dialogue generation strategy based on the current emotional state, and then accurately corrects the initial dialogue generation strategy based on the historical dialogue generation strategy in the second state.
[0057] Figure 4 A flowchart of a dialogue generation method provided in this application embodiment Figure 4 .based on Figure 2 or Figure 3 In the embodiment shown, step S202 includes: Step S401: Determine the response style of the response information to be generated based on the historical response information in the third state.
[0058] In this embodiment, the device determines the response style of the response to be generated based on historical response information in the third state. For example, based on the various historical response information, it can be determined that the user prefers a lighthearted and humorous style, and therefore a lighthearted and humorous style can be used as the response style.
[0059] Step S402: Determine the emotional style of the response information to be generated based on the current dialogue generation strategy in the third state.
[0060] After obtaining the current dialogue generation strategy, the device determines the emotional style of the response message to be generated based on the current dialogue generation strategy. For example, if the current dialogue generation strategy is reassuring, the emotional style of the response message to be generated is lighthearted; if the current dialogue generation strategy is empathy, the emotional style of the response message to be generated is emotionally charged.
[0061] Step S403: Generate current response information that matches the current question information based on the response style and emotional style.
[0062] After determining the emotional style, the current reply information is generated based on the reply style and emotional style. That is, the format and reply style of the text content of the current reply information, and the semantic context in the text content expresses the emotion corresponding to the emotional style.
[0063] In this embodiment, the response style and emotional style are determined through a third state, thereby accurately generating response information that matches the current question information based on the response style and emotional style.
[0064] 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 construction module 510 is used to construct a first state based on the user's current question information and the user's historical dialogue information. The historical dialogue information includes the user's historical question information, historical emotional state, and historical response information of electronic devices to historical question information. The determination module 520 is used to determine the user's current emotional state based on the first state, and add the current emotional state to the first state to obtain the second state; The generation module 530 is used to generate current response information that matches the current question information based on the second state, and output the current response information.
[0065] In some implementations, electronic device 500 is also used for: Determine the current dialogue generation strategy based on the second state; Add the current dialogue generation strategy to the second state to obtain the third state; Based on the third state, generate the current response information that matches the current question information.
[0066] In some implementations, electronic device 500 is also used for: Determine the initial dialogue generation strategy based on the current emotional state in the second state; Based on the historical dialogue generation strategy in the second state, the initial dialogue generation strategy is modified to obtain the current dialogue generation strategy.
[0067] In some implementations, electronic device 500 is also used for: Based on the historical response information in the third state, determine the response style of the response information to be generated; Based on the current dialogue generation strategy in the third state, determine the emotional style of the response information to be generated; Based on the response style and emotional tone, generate the current response information that matches the current question information.
[0068] In some implementations, electronic device 500 is also used for: The current response is added to the third state to update the user's history conversation information. The updated history conversation information is used to generate the response information for the user's next question.
[0069] In some implementations, electronic device 500 is also used for: The second state is input into the response generation model to obtain the current response information output by the response generation model.
[0070] In some implementations, a finite state machine is set up in the electronic device to construct the first state and the second state.
[0071] 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.
[0072] 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.
[0073] 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.
[0074] 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.
[0075] 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.
[0076] 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.
[0077] 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.
[0078] 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.
[0079] 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.
[0080] 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.
[0081] The processor 610 may include a main processor, as well as a baseband chip, modem, etc.
[0082] 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.
[0083] 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.
[0084] Output device 640 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.
[0085] 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.
[0086] 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.
[0087] 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.
[0088] 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.
[0089] 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.
[0090] 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.
[0091] 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.
[0092] 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.
[0093] 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.
[0094] 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.
[0095] The units of the apparatus in the various embodiments of this application can be merged, divided, and deleted according to actual needs.
[0096] 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.
[0097] 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.
[0098] 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.
[0099] 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.
[0100] 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.
[0101] 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.
[0102] 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, The dialogue generation method, applied to electronic devices, includes: A first state is constructed based on the user's current question information and the user's historical dialogue information, wherein the historical dialogue information includes the user's historical question information, historical emotional state, and the electronic device's historical response information to the historical question information; The user's current emotional state is determined based on the first state, and the current emotional state is added to the first state to obtain the second state; Based on the second state, generate current response information that matches the current problem information, and output the current response information.
2. The dialogue generation method according to claim 1, characterized in that, The step of generating current response information that matches the current question information based on the second state includes: Determine the current dialogue generation strategy based on the second state; Add the current dialogue generation strategy to the second state to obtain the third state; Based on the third state, generate current response information that matches the current question information.
3. The dialogue generation method according to claim 2, characterized in that, The second state also includes a historical dialogue generation strategy, and determining the current dialogue generation strategy based on the second state includes: Determine the initial dialogue generation strategy based on the current emotional state in the second state; Based on the historical dialogue generation strategy in the second state, the initial dialogue generation strategy is modified to obtain the current dialogue generation strategy.
4. The dialogue generation method according to claim 2, characterized in that, The step of generating current response information that matches the current question information based on the third state includes: Based on the historical response information in the third state, determine the response style of the response information to be generated; Based on the current dialogue generation strategy in the third state, determine the emotional style of the response information to be generated; Based on the response style and the emotional style, generate current response information that matches the current question information.
5. The dialogue generation method according to claim 2, characterized in that, The historical dialogue information also includes a historical dialogue generation strategy. After generating the current response information matching the current question information based on the third state, the process further includes: The current response information is added to the third state to update the user's historical dialogue information. The updated historical dialogue information is used to generate the response information corresponding to the user's next question.
6. The dialogue generation method according to claim 1, characterized in that, The step of generating current response information that matches the current question information based on the second state includes: The second state is input into the response generation model to obtain the current response information output by the response generation model.
7. The dialogue generation method according to any one of claims 1-6, characterized in that, The electronic device is equipped with a finite state machine, which is used to construct a first state and a second state.
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.
