Method, device, electronic device and storage medium for generating a dialogue reply
Patent Information
- Application Number
- CN202411212372.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2044-08-30
AI Technical Summary
由于对话的虚拟角色是预先设定好的,针对每个交流对象(真实的人)的回复均是标准化的,该对话过程往往忽略了人类交流特性,在面对不同的交流对象时,人们会根据关系的不同调整自己的谈话方式,目前虚拟角色在面对多样化的对话情境和对象时,只能提供单一化回复、缺乏创造性的回答,这限制了对话的自然流畅度,进而影响了用户体验
[0038] The present invention provides a method, apparatus, electronic device, and storage medium for generating dialogue responses, comprising: acquiring user information of the target object in response to the target object's current dialogue input information during the dialogue process; acquiring historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is used to characterize the target object's personality traits, and includes relationship information indicating the relationship between the target object and the virtual character; generating monologue information based on the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that conforms to the target object's personality traits; determining a target original dialogue segment from an original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two parties in the dialogue; and generating dialogue response information corresponding to the current dialogue input information based on the monologue information, the relationship information, and the target original dialogue segment. The above technical solution can dynamically select sentences and paragraphs similar to the relationship between the two parties in the dialogue from the original dialogue library based on the relationship information and the monologue information, generating dialogue content that better matches the relationship between the two parties, thereby breaking the monotony of existing virtual character dialogue output and significantly improving the naturalness, fluency, and diversity of the dialogue.
Smart Images

Figure CN119088937B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a method, apparatus, electronic device and storage medium for generating dialogue responses. Background Technology
[0002] With the development of natural language processing technology, natural language processing systems are becoming increasingly important in various application scenarios, such as online customer service, virtual assistants, and virtual character dialogues.
[0003] To extend the lifespan of virtual characters in films and games, current methods involve giving them similar personalities and speaking styles, as well as creating new interactions between familiar virtual characters. However, because the virtual characters in these dialogues are pre-defined, their responses to each real-life counterpart are standardized. This often ignores the unique characteristics of human communication. People adjust their conversational style based on the relationship with different individuals. Currently, virtual characters can only provide simplistic and uncreative responses to diverse dialogue situations and individuals, limiting the natural flow of the conversation and consequently impacting the user experience. Summary of the Invention
[0004] Therefore, in order to ensure that the dialogue between the virtual character and the target object reflects their relationship and improves the naturalness, fluency, and diversity of the dialogue, embodiments of the present invention provide a method, apparatus, electronic device, and storage medium for generating dialogue responses.
[0005] In a first aspect, embodiments of the present invention provide a method for generating dialogue responses, the method being applied to a dialogue system, the method comprising:
[0006] In response to the target object's current dialogue input during the dialogue process, obtain the target object's user information;
[0007] Based on user information, historical dialogue segments and character background information of the target object are obtained; among them, character background information is used to characterize the characteristics of the target object, including relationship information indicating the relationship between the target object and the virtual character;
[0008] Based on historical dialogue segments and character background information, generate monologue information corresponding to the current dialogue input information; wherein, the monologue information is dialogue response information that conforms to the characteristics of the target character;
[0009] The target dialogue segment is determined from the original dialogue database based on relationship information and monologue information; the target dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two characters in the dialogue.
[0010] Based on the monologue information and the target original dialogue segment, generate dialogue response information corresponding to the current dialogue input information.
[0011] In one possible implementation, the target object's historical dialogue segments and background information are obtained based on user information, including:
[0012] Retrieve historical dialogue segments that match the user information from the dialogue database; the dialogue database stores the correspondence between historical dialogue segments and user information.
[0013] Retrieve background information of individuals that matches user information from the background information database; the background information database stores the correspondence between background information of individuals and user information.
[0014] In one possible implementation, monologue information corresponding to the current dialogue input is generated based on historical dialogue segments and character background information, including:
[0015] Input the historical dialogue segments, character background information, and current dialogue input information into the large language model, and the large language model outputs the monologue information.
[0016] In one possible implementation, the original dialogue library stores multiple original dialogue segments, as well as specific relationship information and specific role information corresponding to each original dialogue segment.
[0017] The target dialogue segment is retrieved from the original dialogue database based on relational and monologue information, including:
[0018] Obtain the character information corresponding to the virtual character that is interacting with the target object;
[0019] Search the original dialogue database for multiple first-match original dialogue segments corresponding to specific character information that match the character information;
[0020] Find multiple second-matched original dialogue segments from multiple first-matched original dialogue segments that correspond to specific relationship information that matches the relationship information;
[0021] For each second-matched original dialogue segment, the following processing is performed: the text similarity of the second-matched original dialogue segment is determined based on the monologue information and the second-matched original dialogue segment.
[0022] The second matching original dialogue segment with the highest text similarity is identified as the target original dialogue segment.
[0023] In one possible implementation, based on the monologue information and the target original dialogue segment, dialogue response information corresponding to the current dialogue input information is generated, including:
[0024] The monologue information, the target original dialogue segment, and the current dialogue input information are input into the large language model, and the large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0025] In one possible implementation, the method further includes:
[0026] Store the current dialogue input and response information in the dialogue library.
[0027] In one possible implementation, the method further includes:
[0028] Generate dialogue response information into dialogue response text information or dialogue response voice information;
[0029] The dialogue reply text information can be sent to the text display module of the dialogue system for display, or the dialogue reply voice information can be sent to the voice broadcast module of the dialogue system for broadcast.
[0030] In a second aspect, embodiments of the present invention provide a dialog response generation apparatus, which is applied to a dialog system, and the apparatus includes:
[0031] The first acquisition module is used to acquire the user information of the target object in response to the current dialogue input information of the target object during the dialogue process;
[0032] The second acquisition module is used to acquire the target object's historical dialogue segments and character background information based on user information; wherein, the character background information is used to characterize the target object's personality features, and the character background information includes relationship information indicating the relationship between the target object and the virtual character;
[0033] The first generation module is used to generate monologue information corresponding to the current dialogue input information based on historical dialogue segments and character background information; wherein, the monologue information is dialogue response information that conforms to the characteristics of the target character;
[0034] The determination module is used to determine the target original dialogue segment from the original dialogue library based on relationship information and monologue information; wherein, the target original dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two characters in the dialogue.
[0035] The second generation module is used to generate dialogue response information corresponding to the current dialogue input information based on the monologue information and the target original dialogue segment.
[0036] Thirdly, embodiments of the present invention provide an electronic device, comprising: a processor and a memory, wherein the processor is configured to execute a program for generating dialogue responses stored in the memory, so as to implement the above-described method for generating dialogue responses.
[0037] Fourthly, embodiments of the present invention provide a storage medium, wherein the storage medium stores one or more programs, which can be executed by one or more processors to implement the above-described method for generating dialogue responses.
[0038] The present invention provides a method, apparatus, electronic device, and storage medium for generating dialogue responses, comprising: acquiring user information of the target object in response to the target object's current dialogue input information during the dialogue process; acquiring historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is used to characterize the target object's personality traits, and includes relationship information indicating the relationship between the target object and the virtual character; generating monologue information based on the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that conforms to the target object's personality traits; determining a target original dialogue segment from an original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two parties in the dialogue; and generating dialogue response information corresponding to the current dialogue input information based on the monologue information, the relationship information, and the target original dialogue segment. The above technical solution can dynamically select sentences and paragraphs similar to the relationship between the two parties in the dialogue from the original dialogue library based on the relationship information and the monologue information, generating dialogue content that better matches the relationship between the two parties, thereby breaking the monotony of existing virtual character dialogue output and significantly improving the naturalness, fluency, and diversity of the dialogue. Attached Figure Description
[0039] Figure 1 A flowchart illustrating an embodiment of a method for generating dialogue responses provided by an embodiment of the present invention;
[0040] Figure 2 A flowchart illustrating an embodiment of another method for generating dialogue responses provided by an embodiment of the present invention;
[0041] Figure 3 A block diagram illustrating an embodiment of a dialogue response generation device provided by this invention;
[0042] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] To facilitate understanding of the embodiments of the present invention, further explanations and descriptions will be provided below with reference to the accompanying drawings and specific embodiments. These embodiments do not constitute a limitation on the embodiments of the present invention.
[0045] This invention provides a method for generating dialogue responses. This method is applied to a dialogue system, also known as a conversational proxy, a computer system that simulates human-virtual interaction, aiming to create coherent and fluent dialogues with humans. Communication methods primarily include voice, text, and images, but other methods such as gestures and touch can also be used. See also... Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of a method for generating dialogue responses provided by an embodiment of the present invention. Figure 1 The process shown may include the following steps:
[0046] Step 101: In response to the target object's current dialogue input information during the dialogue process, obtain the target object's user information;
[0047] The target object can be any user engaging in intelligent dialogue. The current dialogue input information is not limited to voice, text, images, or other information formats. In practical applications, the dialogue system provides a dialogue interface, which can be used by the target object to input the current dialogue input information, as well as to display the target object's current dialogue input information and dialogue response information.
[0048] User information can be understood as the unique identification information of the target object, which may be the user's ID card number, user ID (identity), or device ID of the device used, etc. There are no restrictions on user information here.
[0049] Step 102: Obtain the target object's historical dialogue segments and background information based on user information;
[0050] The historical dialogue segment includes dialogue segments between the target object and various virtual characters. In this embodiment, the dialogue segment includes dialogue input information entered by the target object and dialogue response information replied by the virtual characters.
[0051] Among them, the character background information is used to characterize the characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character.
[0052] This relationship information can be understood as information used to represent the social relationship between the target object and the virtual character. This relationship information can be information indicating that the target object and the virtual character are strangers, information indicating that the target object and the virtual character are friends, information indicating that the target object and the virtual character are relatives, or information indicating that the target object and the virtual character are superiors and subordinates. No limit is imposed on the relationship information here.
[0053] In addition to relationship information, the background information of the aforementioned individuals also includes personality information that can characterize the personality traits of the target individual. This personality information can be cheerful, depressed, sad, or happy, etc., and is not limited here.
[0054] Step 103: Generate monologue information corresponding to the current dialogue input information based on historical dialogue segments and character background information;
[0055] The aforementioned monologue information is specifically generated based on personality information from historical dialogue segments and character background information. This monologue information is a dialogue response that matches the characteristics of the target character; it provides an emotional and thematic basis for subsequent dialogue generation. This monologue information is merely information generated by the dialogue system itself, serving as an intermediate product in generating the final dialogue response; therefore, it is not output to the target character.
[0056] To facilitate understanding the monologue information, let's take the historical dialogue segment between the target and virtual character 1 as an example: "XX, I'm going out with my friends at 3 pm today, and I'm really excited. You should remind me! Okay, I'll remind you then. Have fun!" The character's background information indicates a cheerful personality. If the target's current dialogue input is "XX, what time is it?", the dialogue system's monologue would be: "I'm here! I'm here! The current time is 2:50 pm. You should be going out with your friends in 10 minutes." This lighthearted tone ensures the dialogue remains consistent in emotion and theme.
[0057] Step 104: Determine the target original dialogue segment from the original dialogue database based on relational information and monologue information;
[0058] The aforementioned original dialogue database stores multiple original dialogue segments, as well as specific relationship information and specific character information corresponding to each original dialogue segment. It can be understood that each original dialogue segment is the specific dialogue content in the script where the virtual character is located, the specific relationship information is used to mark the relationship between the characters who are talking to the virtual character, and the specific character information is used to mark the virtual character, indicating what kind of role the virtual character is.
[0059] In this embodiment, the target dialogue segment determined from the original dialogue database based on relationship information and monologue information is not only similar to the monologue information in content, but also matches the relationship between the two parties in the dialogue; thus providing a reference for the subsequent generation of dialogue content that fits the relationship between the two parties.
[0060] For ease of understanding, continuing from the previous example, the relationship information in the character's background is that they are family members. Among them, the original dialogue with the highest match between the monologue information "I'm here, I'm here. The current time is 2:50 PM. You should go out to play with your friends in 10 minutes." and the relationship information is family members is: "I made plans to go out with my friends at noon. Is that right? Then you're a bit short on time. You should go out to play with your friends now. Have fun, I'll wait for you at home."
[0061] Step 105: Generate dialogue response information corresponding to the current dialogue input information based on the monologue information and the target original dialogue segment.
[0062] After generating the initial monologue information, this embodiment further optimizes and personalizes the monologue information based on target dialogue segments from the original work that are similar in content to the monologue information and match the relationship between the two characters in the dialogue. This makes the dialogue closer to the characters' real emotions and social needs, and improves the authenticity and appeal of the dialogue.
[0063] For ease of understanding, the dialogue response following the previous example, which combines the monologue information with the target original dialogue segment, is: "I'm here, I'm here. The current time is 2:50 PM. You should go out and play with your friends in 10 minutes. Have fun, I'll be waiting for you at home."
[0064] The method for generating dialogue responses provided in this invention includes: acquiring user information of the target object in response to the target object's current dialogue input information during the dialogue process; acquiring historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is used to characterize the target object's personality traits, and includes relationship information indicating the relationship between the target object and the virtual character; generating monologue information based on the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that conforms to the target object's personality traits; determining a target original dialogue segment from the original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two parties in the dialogue; and generating dialogue response information corresponding to the current dialogue input information based on the monologue information, relationship information, and target original dialogue segment. The above technical solution can dynamically select sentence segments similar to the relationship between the two parties in the dialogue from the original dialogue library based on the relationship information and monologue information, generating dialogue content that better matches the relationship between the two parties, thereby breaking the monotony of existing virtual character dialogue output and significantly improving the natural fluency and diversity of the dialogue.
[0065] exist Figure 1 Based on this, see Figure 2 , Figure 2 A flowchart illustrating an embodiment of another method for generating dialogue responses provided by an embodiment of the present invention. Figure 2 The process shown may include the following steps:
[0066] Step 201: In response to the target object's current dialogue input information during the dialogue process, obtain the target object's user information;
[0067] Step 202: Obtain the target object's historical dialogue segments and background information based on user information;
[0068] Among them, the character background information is used to characterize the characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character.
[0069] The specific process of obtaining historical dialogue segments and character background information can be achieved through steps A1 to A2:
[0070] Step A1: Retrieve historical dialogue segments that match the user information from the dialogue database;
[0071] The dialogue database stores the correspondence between historical dialogue segments and user information. This can be understood as each historical dialogue segment being identified by the user information of the object interacting with the virtual character, so that the historical dialogue segment corresponding to the matching user information can be retrieved from the dialogue database through the user information of the target object.
[0072] Step A2: Query and retrieve background information of individuals that match the user information from the background information database.
[0073] The character background information database stores the correspondence between character background information and user information. It can be understood that each character background information is identified by the user information of the object that has interacted with the virtual character, so that the character background information corresponding to the user information that matches the target object can be obtained from the character background information database.
[0074] The personality information in the character background information is derived from the analysis of the character's historical dialogue segments using a personality model. This personality information is stored in the character background information database. The personality model can be understood as a pre-trained analysis model. The relationship information in the character background information is set by the character and the virtual character in the settings interface of the dialogue system before they interact. Once the relationship information is set, it is stored in the character background information database. The settings interface provides the character with selection controls to choose from various social relationships; or it provides input controls to input social relationships, allowing the character to enter relationship information. No specific limitation is made here.
[0075] Step 203: Input the historical dialogue segments, character background information, and current dialogue input information into the large language model, and the large language model outputs the monologue information;
[0076] Among them, the monologue information is the dialogue response information that matches the characteristics of the target person.
[0077] A large language model (LLM) is a functional module in a dialogue system used to output corresponding responses based on the input. A large language model (LLM) is a computer model capable of processing and generating natural language. LLMs can predict the next word or sentence by learning the statistical patterns and semantic information of language data. As the input dataset and parameter space expand, the capabilities of LLMs also increase. It is used in various application areas such as machine learning, machine translation, speech recognition, and image processing, hence the name "multimodal large language model."
[0078] In this embodiment, the large language model can be GPT (Generative Pre-trained Transformer)-3, GPT-4, PaLM (Scaling Language Modeling with Pathways), LLaMA (Large Language Model Meta AI), etc., and is not limited here.
[0079] By inputting historical dialogue segments, character background information, and current dialogue input information into a large language model, the pre-trained large language model can output monologue information.
[0080] Step 204: Determine the target original dialogue segment from the original dialogue database based on relational information and monologue information;
[0081] Among them, the dialogue segments in the target original work are not only similar to the monologue information in terms of content, but also match the relationship between the two characters in the dialogue.
[0082] Step 204 above can be achieved through steps B1 to B5:
[0083] Step B1: Obtain the character information corresponding to the virtual character that is talking to the target object;
[0084] The character information is a unique identifier used to represent the virtual character. This character information can be a character name, character ID, or character code, etc., and is not limited here.
[0085] Step B2: Search the original dialogue database for multiple first-match original dialogue segments corresponding to specific character information that match the character information;
[0086] Based on the principle of matching character information with specific character information, all original dialogue segments, including the first matching original dialogue segment for the virtual character, are retrieved from the original dialogue database.
[0087] Step B3: Search for multiple second-matching original dialogue segments from multiple first-matching original dialogue segments that correspond to specific relationship information that matches the relationship information;
[0088] Specific relationship information is used to represent the social relationship between two virtual characters in the script. In this embodiment, based on the principle of matching relationship information with specific relationship information, a second matching original dialogue segment with specific relationship information is found from multiple first matching dialogue segments. This is used to ensure that the relationship between the target object and the virtual character matches the social relationship between the two virtual characters in the script, thereby improving the adaptability of the dialogue.
[0089] Step B4: For each second-matched original dialogue segment, perform the following processing: Determine the text similarity of the second-matched original dialogue segment based on the monologue information and the second-matched original dialogue segment.
[0090] The text similarity can be calculated using similarity methods such as cosine similarity or Jaccard similarity, without limitation here. This method of text similarity can ensure that the identified target dialogue segments are similar to the monologue information in terms of text content, thereby improving the relevance of the dialogue.
[0091] Step B5: The second matching original dialogue segment with the highest text similarity is identified as the target original dialogue segment.
[0092] Step 205: Input the monologue information, the target original dialogue segment, and the current dialogue input information into the large language model. The large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0093] The large language model here can be the same language model as the large language model in step 203 above, or it can be another language model. There is no limitation here. The monologue information, the target original dialogue segment and the current dialogue input information are input into the large language model. The pre-trained large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0094] In practical use, the dialogue response information is generated as either text or voice messages. The text response is sent to the dialogue system's text display module for display, or the voice response is sent to the dialogue system's voice broadcast module for playback. This text display module is the aforementioned dialogue interface. Whether the dialogue response is in text or voice format can be selected and determined by the target audience in the settings interface; no specific limitation is made here.
[0095] In practice, the current dialogue input and response information are stored in the dialogue library as historical dialogue segments to facilitate the generation of subsequent monologue information and ensure the emotional consistency and thematic continuity of the dialogue.
[0096] This invention provides a device for generating dialogue responses, which is applied to a dialogue system. See [link to related document]. Figure 3 This is a block diagram of an embodiment of a dialogue response generation device provided by an embodiment of the present invention. Figure 3 As shown, the device includes:
[0097] The first acquisition module 301 is used to acquire user information of the target object in response to the current dialogue input information of the target object during the dialogue process;
[0098] The second acquisition module 302 is used to acquire the target object's historical dialogue segments and character background information based on user information; wherein, the character background information is used to characterize the target object's character features, and the character background information includes relationship information indicating the relationship between the target object and the virtual character.
[0099] The first generation module 303 is used to generate monologue information corresponding to the current dialogue input information based on historical dialogue segments and character background information; wherein, the monologue information is dialogue response information that conforms to the characteristics of the target character;
[0100] The determination module 304 is used to determine the target original dialogue segment from the original dialogue library based on relationship information and monologue information; wherein, the target original dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two parties in the dialogue.
[0101] The second generation module 305 is used to generate dialogue response information corresponding to the current dialogue input information based on the monologue information and the target original dialogue segment.
[0102] The device for generating dialogue responses provided in this invention includes: acquiring user information of the target object in response to the target object's current dialogue input information during the dialogue process; acquiring historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is used to characterize the target object's personality traits, and includes relationship information indicating the relationship between the target object and the virtual character; generating monologue information based on the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that conforms to the target object's personality traits; determining a target original dialogue segment from an original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two parties in the dialogue; and generating dialogue response information corresponding to the current dialogue input information based on the monologue information, the relationship information, and the target original dialogue segment. The above technical solution can dynamically select sentence segments similar to the relationship between the two parties in the dialogue from the original dialogue library based on the relationship information and the monologue information, generating dialogue content that better matches the relationship between the two parties, thereby breaking the monotony of existing virtual character dialogue outputs and significantly improving the naturalness, fluency, and diversity of the dialogue.
[0103] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 4 The illustrated electronic device 500 includes at least one processor 501, a memory 502, at least one network interface 504, and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to implement communication between these components. In addition to a data bus, the bus system 505 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 4 The general designated all buses as Bus System 505.
[0104] The user interface 503 may include a display, keyboard, or clicking device (e.g., mouse, trackball, touchpad, or touchscreen).
[0105] It is understood that the memory 502 in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0106] In some implementations, memory 502 stores elements, executable units or data structures, or subsets thereof, or extended sets thereof: operating system 5021 and application program 5022.
[0107] The operating system 5021 includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 5022 includes various applications, such as a media player and a browser, used to implement various application functions. The program implementing the method of this embodiment can be included in the application program 5022.
[0108] In this embodiment of the invention, by calling the program or instructions stored in memory 502, specifically the program or instructions stored in application program 5022, processor 501 executes the method steps provided in each method embodiment, including, for example:
[0109] In response to the target object's current dialogue input during the dialogue process, obtain the target object's user information;
[0110] Based on user information, historical dialogue segments and character background information of the target object are obtained; among them, character background information is used to characterize the characteristics of the target object, including relationship information indicating the relationship between the target object and the virtual character;
[0111] Based on historical dialogue segments and character background information, generate monologue information corresponding to the current dialogue input information; wherein, the monologue information is dialogue response information that conforms to the characteristics of the target character;
[0112] The target dialogue segment is determined from the original dialogue database based on relationship information and monologue information; the target dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two characters in the dialogue.
[0113] Based on the monologue information and the target original dialogue segment, generate dialogue response information corresponding to the current dialogue input information.
[0114] In one possible implementation, the target object's historical dialogue segments and background information are obtained based on user information, including:
[0115] Retrieve historical dialogue segments that match the user information from the dialogue database; the dialogue database stores the correspondence between historical dialogue segments and user information.
[0116] Retrieve background information of individuals that matches user information from the background information database; the background information database stores the correspondence between background information of individuals and user information.
[0117] In one possible implementation, monologue information corresponding to the current dialogue input is generated based on historical dialogue segments and character background information, including:
[0118] Input the historical dialogue segments, character background information, and current dialogue input information into the large language model, and the large language model outputs the monologue information.
[0119] In one possible implementation, the original dialogue library stores multiple original dialogue segments, as well as specific relationship information and specific role information corresponding to each original dialogue segment.
[0120] The target dialogue segment is retrieved from the original dialogue database based on relational and monologue information, including:
[0121] Obtain the character information corresponding to the virtual character that is interacting with the target object;
[0122] Search the original dialogue database for multiple first-match original dialogue segments corresponding to specific character information that match the character information;
[0123] Find multiple second-matched original dialogue segments from multiple first-matched original dialogue segments that correspond to specific relationship information that matches the relationship information;
[0124] For each second-matched original dialogue segment, the following processing is performed: the text similarity of the second-matched original dialogue segment is determined based on the monologue information and the second-matched original dialogue segment.
[0125] The second matching original dialogue segment with the highest text similarity is identified as the target original dialogue segment.
[0126] In one possible implementation, based on the monologue information and the target original dialogue segment, dialogue response information corresponding to the current dialogue input information is generated, including:
[0127] The monologue information, the target original dialogue segment, and the current dialogue input information are input into the large language model, and the large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0128] In one possible implementation, the method further includes:
[0129] Store the current dialogue input and response information in the dialogue library.
[0130] In one possible implementation, the method further includes:
[0131] Generate dialogue response information into dialogue response text information or dialogue response voice information;
[0132] The dialogue reply text information can be sent to the text display module of the dialogue system for display, or the dialogue reply voice information can be sent to the voice broadcast module of the dialogue system for broadcast.
[0133] The methods disclosed in the above embodiments of the present invention can be applied to or implemented by processor 501. Processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 501 or by instructions in the form of software. The processor 501 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software units in the decoding processor. The software units may be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 502. Processor 501 reads the information in memory 502 and, in conjunction with its hardware, completes the steps of the above method.
[0134] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.
[0135] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0136] The electronic device provided in this embodiment may be as follows: Figure 4 The electronic device shown can perform the following: Figure 1-2 All steps of the method for generating dialogue responses, thereby achieving Figure 1-2 For details on the technical effects of the dialogue response generation method shown, please refer to [link / reference]. Figure 1-2 The relevant descriptions are presented concisely and will not be elaborated upon here.
[0137] This invention also provides a storage medium (computer-readable storage medium). This storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; the memory may also include combinations of the above types of memory.
[0138] When one or more programs in the storage medium can be executed by one or more processors to implement the above-described method for generating dialogue responses.
[0139] The processor is used to execute a program for generating dialogue responses stored in memory to implement the steps of the following dialogue response generation method:
[0140] In response to the target object's current dialogue input during the dialogue process, obtain the target object's user information;
[0141] Based on user information, historical dialogue segments and character background information of the target object are obtained; among them, character background information is used to characterize the characteristics of the target object, including relationship information indicating the relationship between the target object and the virtual character;
[0142] Based on historical dialogue segments and character background information, generate monologue information corresponding to the current dialogue input information; wherein, the monologue information is dialogue response information that conforms to the characteristics of the target character;
[0143] The target dialogue segment is determined from the original dialogue database based on relationship information and monologue information; the target dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two characters in the dialogue.
[0144] Based on the monologue information and the target original dialogue segment, generate dialogue response information corresponding to the current dialogue input information.
[0145] In one possible implementation, the target object's historical dialogue segments and background information are obtained based on user information, including:
[0146] Retrieve historical dialogue segments that match the user information from the dialogue database; the dialogue database stores the correspondence between historical dialogue segments and user information.
[0147] Retrieve background information of individuals that matches user information from the background information database; the background information database stores the correspondence between background information of individuals and user information.
[0148] In one possible implementation, monologue information corresponding to the current dialogue input is generated based on historical dialogue segments and character background information, including:
[0149] Input the historical dialogue segments, character background information, and current dialogue input information into the large language model, and the large language model outputs the monologue information.
[0150] In one possible implementation, the original dialogue library stores multiple original dialogue segments, as well as specific relationship information and specific role information corresponding to each original dialogue segment.
[0151] The target dialogue segment is retrieved from the original dialogue database based on relational and monologue information, including:
[0152] Obtain the character information corresponding to the virtual character that is interacting with the target object;
[0153] Search the original dialogue database for multiple first-match original dialogue segments corresponding to specific character information that match the character information;
[0154] Find multiple second-matched original dialogue segments from multiple first-matched original dialogue segments that correspond to specific relationship information that matches the relationship information;
[0155] For each second-matched original dialogue segment, the following processing is performed: the text similarity of the second-matched original dialogue segment is determined based on the monologue information and the second-matched original dialogue segment.
[0156] The second matching original dialogue segment with the highest text similarity is identified as the target original dialogue segment.
[0157] In one possible implementation, based on the monologue information and the target original dialogue segment, dialogue response information corresponding to the current dialogue input information is generated, including:
[0158] The monologue information, the target original dialogue segment, and the current dialogue input information are input into the large language model, and the large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0159] In one possible implementation, the method further includes:
[0160] Store the current dialogue input and response information in the dialogue library.
[0161] In one possible implementation, the method further includes:
[0162] Generate dialogue response information into dialogue response text information or dialogue response voice information;
[0163] The dialogue reply text information can be sent to the text display module of the dialogue system for display, or the dialogue reply voice information can be sent to the voice broadcast module of the dialogue system for broadcast.
[0164] 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 software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, 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 software 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 implementations should not be considered beyond the scope of this invention.
[0165] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module 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.
[0166] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for generating dialogue responses, characterized in that, The method is applied to a dialogue system, and the method includes: In response to the target object's current dialogue input information during the dialogue process, the user information of the target object is obtained; Based on the user information, the target object's historical dialogue segments and character background information are obtained; wherein, the character background information is used to characterize the target object's personality traits, and the character background information includes relationship information indicating the relationship between the target object and the virtual character; Based on the historical dialogue segments and the character's background information, a monologue information corresponding to the current dialogue input information is generated, including inputting the historical dialogue segments, the character's background information, and the current dialogue input information into a large language model, and the large language model outputting the monologue information; wherein, the monologue information is dialogue response information that conforms to the characteristics of the target character; Determining a target original dialogue segment from the original dialogue library based on the relationship information and the monologue information includes: obtaining character information corresponding to the virtual character who is in dialogue with the target object; searching the original dialogue library for multiple first-matching original dialogue segments corresponding to specific character information that matches the character information; searching the multiple first-matching original dialogue segments for multiple second-matching original dialogue segments corresponding to specific relationship information that matches the relationship information; and performing the following processing on each second-matching original dialogue segment: determining the text similarity of the second-matching original dialogue segment based on the monologue information and the second-matching original dialogue segment; and determining the second-matching original dialogue segment with the highest text similarity as the target original dialogue segment; wherein, the original dialogue library stores multiple original dialogue segments, as well as specific relationship information and specific character information corresponding to each original dialogue segment, and the target original dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two parties in the dialogue; Based on the monologue information and the target original dialogue segment, generate dialogue response information corresponding to the current dialogue input information, including: inputting the monologue information, the target original dialogue segment, and the current dialogue input information into the large language model, and the large language model outputting dialogue response information corresponding to the current dialogue input information.
2. The method of claim 1, wherein, The step of obtaining the target object's historical dialogue segments and background information based on the user information includes: Retrieve historical dialogue segments that match the user information from the dialogue database; wherein, the dialogue database stores the correspondence between historical dialogue segments and user information; The background information of the person is retrieved from the background information database to match the user information; wherein, the background information database stores the correspondence between background information of persons and user information.
3. The method according to claim 2, characterized in that, The method further includes: The current dialogue input information and the dialogue response information are stored in the dialogue database.
4. The method according to claim 1, characterized in that, The method further includes: The dialogue response information is used to generate dialogue response text information or dialogue response voice information; The dialogue reply text information is sent to the text display module of the dialogue system for display, or the dialogue reply voice information is sent to the voice broadcast module of the dialogue system for broadcast.
5. A device for generating dialogue responses, characterized in that, The device is used in a dialogue system, and the device includes: The first acquisition module is used to acquire the user information of the target object in response to the current dialogue input information of the target object during the dialogue process; The second acquisition module is used to acquire the target object's historical dialogue segments and character background information based on the user information; wherein, the character background information is used to characterize the target object's personality features, and the character background information includes relationship information indicating the relationship between the target object and the virtual character; The first generation module is used to generate monologue information corresponding to the current dialogue input information based on the historical dialogue segment and the character background information. This includes inputting the historical dialogue segment, the character background information, and the current dialogue input information into a large language model, and the large language model outputting the monologue information. The monologue information is dialogue response information that conforms to the characteristics of the target character. A determining module is used to determine a target original dialogue segment from the original dialogue library based on the relationship information and the monologue information, including: obtaining character information corresponding to the virtual character who is in dialogue with the target object; searching the original dialogue library for multiple first matching original dialogue segments corresponding to specific character information that matches the character information; searching the multiple first matching original dialogue segments for multiple second matching original dialogue segments corresponding to specific relationship information that matches the relationship information; performing the following processing on each second matching original dialogue segment: determining the text similarity of the second matching original dialogue segment based on the monologue information and the second matching original dialogue segment; determining the second matching original dialogue segment with the highest text similarity as the target original dialogue segment; wherein, the original dialogue library stores multiple original dialogue segments, as well as specific relationship information and specific character information corresponding to each original dialogue segment, and the target original dialogue segment is not only similar to the monologue information in content, but also matches the relationship between the two characters in the dialogue; The second generation module is used to generate dialogue response information corresponding to the current dialogue input information based on the monologue information and the target original dialogue segment. The generation of dialogue response information corresponding to the current dialogue input information includes: inputting the monologue information, the target original dialogue segment and the current dialogue input information into the large language model, and the large language model outputting dialogue response information corresponding to the current dialogue input information.
6. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute a program for generating dialogue responses stored in the memory to implement the method for generating dialogue responses according to any one of claims 1 to 4.
7. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the dialogue response generation method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Dialogue processing method and device based on large language model and electronic equipment
CN117251552A
Dialogue generation method and device, computer readable medium and electronic equipment
CN118214735A