Role dialogue generation method and device, equipment, storage medium and program product
By predicting group chat characters participating in dialogue in group chat scenarios and generating dialogue content, the problem of inaccurate matching of dialogue roles in group chat scenarios in the existing technology is solved, improving the accuracy and flexibility of dialogue content generation, and improving user experience.
Patent Information
- Application Number
- CN202411876530.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-18
AI Technical Summary
It is difficult for existing group chat scenarios to accurately match the dialogue roles corresponding to user dialogue requests, resulting in inflexible generation of dialogue content, which affects the generation accuracy and user experience.
By obtaining the dialogue context data and group chat role information of the current group chat scene, predict the group chat roles participating in the next round of dialogue based on the dialogue characteristics and character characteristics, and generate corresponding dialogue content.
It realizes accurate matching of group chat roles and flexible generation of dialogue content, improves the accuracy and flexibility of dialogue content generation in group chat scenarios, and improves the user's group chat experience.
Smart Images

Figure CN119808945A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, equipment, storage medium and program product for generating role dialogues. Background Art
[0002] With the widespread application of large language models, many current applications can build group chat scenarios based on large models to provide users with group chat experiences with virtual objects. However, it is difficult for current group chat scenarios to accurately match the dialogue roles corresponding to user dialogue requests, resulting in inflexible generation of dialogue content, affecting the accuracy of dialogue content generation and the user's group chat experience. Summary of the invention
[0003] In view of this, the present disclosure provides a method, apparatus, device, storage medium and program product for generating character dialogues to solve the problem that it is difficult to accurately predict dialogue roles, resulting in poor dialogue content generation effects.
[0004] In a first aspect, the present disclosure provides a method for generating a role conversation, comprising: obtaining conversation context data and group chat role information of a current group chat scene; determining a group chat role participating in a next round of group chat conversation in the current group chat scene based on conversation features of the conversation context data and role features of the group chat role information; and generating conversation content of the group chat role in the current group chat scene based on the conversation context data.
[0005] In a second aspect, the present disclosure provides a device for generating a role conversation, comprising: an acquisition module for acquiring conversation context data and group chat role information of a current group chat scene; a group chat role determination module for determining a group chat role participating in a next round of group chat conversation in the current group chat scene based on conversation features of the conversation context data and role features of the group chat role information; and a conversation content generation module for generating conversation content of the group chat role in the current group chat scene based on the conversation context data.
[0006] In a third aspect, the present disclosure provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for generating a character dialogue according to the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0007] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for generating a character dialogue according to the first aspect or any corresponding embodiment thereof.
[0008] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, which are used to enable a computer to execute the method for generating a character dialogue according to the first aspect or any corresponding embodiment thereof.
[0009] The method, device, equipment, storage medium and program product for generating role dialogue provided by the present disclosure combine the dialogue context data obtained from the current group chat scene and the group chat role information participating in the current group chat scene to predict the group chat role participating in the next round of group chat dialogue according to the dialogue characteristics of the dialogue context data and the role characteristics of the group chat role information, thereby accurately matching the corresponding group chat role for the dialogue request in the current group chat scene, and generating corresponding dialogue content for the group chat role in combination with the dialogue context data. As a result, the determination of the group chat role and the generation of the dialogue content can accurately simulate the actual group chat scene, improve the generation accuracy of the dialogue content in the group chat scene and the generation flexibility of the dialogue content, and ensure the group chat experience of the user. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1 is a flowchart of a method for generating a character dialogue according to an embodiment of the present disclosure;
[0012] Figure 2 is a flowchart of another method for generating a role dialogue according to an embodiment of the present disclosure;
[0013] Figure 3 is a schematic diagram of generating group chat roles and their conversation contents according to an embodiment of the present disclosure;
[0014] Figure 4 is a flowchart of a model training method according to an embodiment of the present disclosure;
[0015] Figure 5 is a schematic diagram of a specific implementation of model training according to an embodiment of the present disclosure;
[0016] Figure 6 is a structural block diagram of a device for generating character dialogues according to an embodiment of the present disclosure;
[0017] Figure 7 It is a schematic diagram of the hardware structure of the computer device of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0019] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0020] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0021] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0022] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0023] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0024] Currently, many applications can build group chat scenes based on large models to provide users with a group chat experience with virtual objects. When a user initiates a conversation request, the group chat scene can determine the conversation role that needs to be answered based on the conversation request. However, due to the large number of virtual objects in the group chat scene, it is difficult to accurately match the conversation role corresponding to the user's conversation request, resulting in inflexible generation of conversation content, affecting the accuracy of conversation content generation and the user's group chat experience.
[0025] Based on this, the technical solution disclosed in the present invention can combine context data and pre-set group chat role information to predict the group chat roles participating in the next round of group chat conversations, and generate conversation content that matches them, ensuring that the determination of group chat roles and the generation of conversation content can accurately simulate actual group chat scenarios and enhance users' group chat experience.
[0026] According to an embodiment of the present disclosure, an embodiment of a method for generating character dialogues is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0027] In this embodiment, a method for generating character dialogue is provided, which can be used in computer devices, such as computers, mobile phones, tablet computers, etc. Figure 1 is a flow chart of a method for generating a role dialogue according to an embodiment of the present disclosure, such as Figure 1 As shown, the process includes the following steps:
[0028] Step S101, obtaining the conversation context data and group chat role information of the current group chat scene.
[0029] The current group chat scene is a conversation scene composed of multiple conversation objects. Specifically, the multiple conversation objects include multiple virtual objects and at least one real object, and each conversation object has a corresponding role setting. The group chat scene is constructed by the user through an application deployed in a computer device. The conversation information generated by each conversation object in the group chat scene is collected in the conversation order to obtain the conversation context data generated in the current group chat scene.
[0030] The group chat role information is the role information of each dialogue object in the group chat scene, including the dialogue object's character, background, ability, etc. The group chat role information is pre-set by the user according to the group chat needs, and can be determined by analyzing the attribute information of each dialogue object.
[0031] Step S102, based on the conversation features of the conversation context data and the role features of the group chat role information, determine the group chat role that will participate in the next round of group chat conversation in the current group chat scene.
[0032] The conversation features are the features of the conversation information of each conversation partner in the group chat scenario, and the conversation features may include conversation participation, value information contribution, etc. Specifically, by analyzing the conversation context data, the conversation partner who speaks most actively in the conversation can be determined, and whether his speech is responded to and interacted with by other conversation partners can be detected to determine the participation and contribution of each conversation partner in the conversation context data, and the conversation features possessed by each conversation partner can be determined in combination with the participation and contribution of each conversation partner in the conversation context data.
[0033] Role features are attribute features of group chat roles, which may include the activity, role background, social knowledge, etc. of each group chat role in the conversation context. Specifically, by analyzing the conversation context data and group chat role information, it is possible to determine the more active group chat roles in the group chat scene, and identify the group chat roles that have social knowledge or social skills on specific topics.
[0034] By combining conversation features and role features, the participation and contribution in the conversation context data are matched with the social knowledge, activity, and role background of the group chat roles, so as to predict the group chat roles that will continue to participate in the next round of conversation based on the role's historical performance and its performance in the conversation. Through matching analysis, the group chat roles that are more likely to participate in the next round of conversation can be determined more accurately.
[0035] In some specific examples, if a character provides key information during a chat and other conversation partners show interest in the key information, then the character can be used as a group chat role to continue participating in the next round of conversation. If a character raises a question in a group chat that triggers a discussion, the character can be used as a group chat role to guide the conversation in the next round of conversation. If a character shows a strong willingness to participate in the conversation and is able to actively respond to the speeches of other conversation partners, then the character can be used as a group chat role to actively participate in the next round of conversation.
[0036] Step S103: Generate the conversation content of the group chat role in the current group chat scene based on the conversation context data.
[0037] The conversation context data generated in the current group chat scene is analyzed to determine the conversation logic of the group chat role in the conversation context data. Then, according to the conversation logic and historical conversation information, the conversation content that the group chat role needs to reply in the current group chat scene is generated.
[0038] The method for generating role dialogues provided in this embodiment combines the dialogue context data obtained from the current group chat scene and the group chat role information participating in the current group chat scene to predict the group chat roles participating in the next round of group chat dialogues according to the dialogue features of the dialogue context data and the role features of the group chat role information, thereby accurately matching the corresponding group chat roles for the dialogue requests in the current group chat scene, and generating corresponding dialogue content for the group chat roles in combination with the dialogue context data. As a result, the determination of the group chat roles and the generation of dialogue content can accurately simulate the actual group chat scene, improve the accuracy of the generation of dialogue content in the group chat scene and the flexibility of the generation of dialogue content, and ensure the group chat experience of users.
[0039] In this embodiment, a method for generating character dialogue is provided, which can be used in computer devices, such as computers, mobile phones, tablet computers, etc. Figure 2 is a flow chart of a method for generating a role dialogue according to an embodiment of the present disclosure, such as Figure 2 As shown, the process includes the following steps:
[0040] Step S201, obtaining the conversation context data and group chat role information of the current group chat scene. For details, please refer to the relevant description of the corresponding steps in the above embodiment, which will not be repeated here.
[0041] Step S202: determining the group chat roles that will participate in the next round of group chat dialogue in the current group chat scenario based on the dialogue features of the dialogue context data and the role features of the group chat role information.
[0042] Specifically, the above step S202 includes: based on the conversation features of the conversation context data and the role features of the group chat role information, determining the group chat role participating in the next round of group chat conversation in the current group chat scene through the trained role speech prediction model.
[0043] The role speech prediction model is used to predict the group chat role in the next round of group chat dialogue, and the role speech prediction model is deployed in a computer device. Figure 3 As shown, the conversation context data and group chat role information of the current group chat scene are input into the role speech prediction model, so that the role speech prediction model can extract the conversation features possessed by the conversation context data and the role features possessed by the group chat role information, so that the role speech prediction model can combine the conversation features and the role features to output the group chat roles participating in the next round of group chat conversation in the current group chat scene.
[0044] Among them, the role speech prediction model can be obtained by training based on the model architecture of a large language model, or by training based on the model architecture of a neural network. Of course, it can also be trained based on other model architectures. There is no specific limitation here, as long as it can complete the prediction of group chat roles.
[0045] In some optional implementations, the method further includes: in response to a role selection operation for the current group chat scenario, determining a group chat role to participate in the next round of group chat dialogue based on the role selection operation.
[0046] The role selection operation is the selection operation of the real dialogue object in the current group chat scene for the next round of group chat roles. Figure 3 As shown, when the real dialogue object (ie, user) participating in the group chat triggers a role selection operation, the current group chat scene can respond to the role selection operation and select a group chat role to participate in the next round of group chat dialogue from multiple dialogue roles in the current group chat scene.
[0047] In the above implementation, it is supported to determine the group chat role participating in the next round of group chat dialogue through the role selection operation, thereby improving the flexibility of selecting the group chat role.
[0048] Step S203: Generate the conversation content of the group chat role in the current group chat scene based on the conversation context data.
[0049] Specifically, the above step S203 includes: based on the conversation context data, generating the conversation content of the group chat role in the current group chat scene through the trained group chat conversation model.
[0050] The group chat dialogue model is used to generate dialogue content that matches the group chat role, and the group chat dialogue model is deployed in a computer device. Figure 3 As shown, the conversation context data of the current group chat scenario is input into the group chat conversation model, so that the group chat conversation model can extract conversation attribute information such as conversation information, conversation order, and conversation logic in the conversation context data, so that the group chat conversation model can output the conversation content of the group chat roles in the next round of group chat conversation in combination with the extracted conversation attribute information.
[0051] Among them, the group chat dialogue model can be obtained by training based on the model architecture of a large language model, can be obtained by training based on the model architecture of deep learning, can be obtained by training based on the model architecture of a neural network, and of course can also be trained based on other model architectures. There is no specific limitation here, as long as it can complete the generation of dialogue content matching the group chat role.
[0052] The method for generating role dialogues provided in this embodiment determines the group chat roles participating in the next round of group chat dialogue in the current group chat scenario through a trained role speech prediction model, and generates the dialogue content of the group chat roles in the current group chat scenario through a trained group chat dialogue model. Thus, the prediction of the group chat roles and the generation of dialogue content are controlled respectively by two models, thereby achieving the independence of the determination of the group chat roles and the generation of the dialogue content, facilitating the flexible adjustment of the role speech prediction model and the group chat dialogue model, and being beneficial to improving the accuracy of determining the group chat roles and the accuracy of generating the dialogue content.
[0053] In some optional embodiments, such as Figure 4 As shown, the training methods of the role speech prediction model and the group chat dialogue model include:
[0054] Step S301, collecting dialogue data between characters, and extracting information of characters participating in the dialogue from the dialogue data.
[0055] The dialogue data is the data generated by the dialogue between different roles, and the role information is the role attributes, personality, background, language style, etc. of the dialogue objects participating in the dialogue. Specifically, the dialogue data between the roles is extracted from the authorized access data source, and the role-related content carried in the dialogue data is parsed. The role information for each role is reversely generated based on the role-related content through the big model, including the personality of each role, the relationship between different roles, the background knowledge of each role, the ability of each role, etc.
[0056] In some optional implementations, the above step S301 includes:
[0057] Step a1, obtaining a first dialogue data source of a literary genre, and extracting dialogue data between characters from the first dialogue data source.
[0058] The first dialogue data source is a data source of literary genres, that is, dialogue data included in literary works. The first dialogue data source can be novels, fairy tales, short stories, poems, dramas, etc., and the type of literary genre is not specifically limited here.
[0059] The text content in the first dialogue data source is parsed, text content irrelevant to the dialogue data is filtered out, and relevant content corresponding to each role contained in the text content is extracted, and dialogue data between each role is extracted from the relevant content.
[0060] Step a2, obtaining a second dialogue data source of a social genre, and extracting dialogue data between characters from the second dialogue data source.
[0061] The second conversation data source is a data source of social genre, that is, the conversation data included in the social application. The second conversation data source includes multiple different roles. By parsing different roles in the social application, the conversation data generated by different roles in the social application is determined. Then, the conversation data is directly pulled, such as Figure 5 shown.
[0062] In the above implementation, by extracting the conversation data between characters from different conversation data sources, the conversation data is made richer, which is beneficial to improving the model training effect.
[0063] In some optional implementations, the above step a1 includes:
[0064] Step a11, extracting conversation slices from the first conversation data source according to a preset length.
[0065] Step a12, extracting the dialogue data between the characters from the dialogue slices according to the dialogue order between the characters.
[0066] The preset length is a preset slice length, for example, slicing according to the length of a page, slicing according to the length of a chapter, etc. The preset length is not specifically limited here.
[0067] like Figure 5 As shown, the conversation text content in the first conversation data source is sliced according to a preset length to obtain multiple conversation slices, and the conversation content in each conversation slice is parsed respectively to determine the various roles existing in the conversation slice and the conversation order of each role in the conversation content, thereby extracting the conversation data generated between different roles from the conversation content of the conversation slice according to the conversation order.
[0068] In the above implementation, by slicing the first dialogue data source of the literary genre according to a preset length, and extracting the dialogue data between the characters from the slices according to the dialogue order, the difficulty of processing long text content is reduced and the processing efficiency of long text content is improved, thereby avoiding errors in extracting dialogue data and improving the accuracy of extracting dialogue data.
[0069] In some optional implementations, after collecting the conversation data between the characters, the method further includes:
[0070] Filter irrelevant content in the conversation data to obtain filtered conversation data; and / or convert the data format of the conversation data according to a preset format.
[0071] Irrelevant content is content that is irrelevant to the conversation data, and specifically may include meaningless conversation content (e.g., introductions to literary works, etc.), non-compliant conversation content (e.g., insults, immoral text content, etc.), and repeated conversation content. The conversation content in the conversation data is parsed to detect whether it contains irrelevant content. If the conversation data contains irrelevant content such as meaningless conversation content, non-compliant conversation content, and repeated conversation content, the meaningless conversation content, non-compliant conversation content, and repeated conversation content in the conversation data are filtered to obtain filtered conversation data.
[0072] The preset format is a pre-set data format. In order to unify the dialogue data extracted from the first dialogue data source, after the dialogue data is collected, if the data format of the dialogue data does not match the preset format, the data format of the dialogue data is converted according to the preset format to obtain a dialogue data format that matches the preset format. For example, pairs of brackets are added to the dialogue data generated by each character.
[0073] like Figure 5 As shown, after collecting the conversation data between the characters, irrelevant content in the conversation data is filtered, and the data format of the filtered conversation data is converted according to a preset format to complete data cleaning for the conversation data.
[0074] In the above implementation, the collected conversation data is filtered and / or the data format is converted to improve the quality of the conversation data, thereby further improving the model training effect.
[0075] Step a3, analyzing the role dialogue features of each role participating in the dialogue in the dialogue data.
[0076] Step a4, based on the character dialogue features, determine the character information participating in the dialogue.
[0077] The character dialogue features are the features that the characters have in the dialogue generation, such as language style, dialogue words, attitude, etc. The dialogue content corresponding to each character in the dialogue data is analyzed to determine the character dialogue features such as language style, words, tone, attitude and dialogue purpose used by each character in the dialogue. Then, the character dialogue features of each character in the dialogue are analyzed, and the character information such as the character personality, role relationship, and knowledge possessed by each character participating in the dialogue is extracted from the character dialogue features.
[0078] In the above implementation, the role dialogue features of each role are analyzed to determine the role information participating in the dialogue, so that the role information can accurately match each role, ensuring that the predicted group chat role can meet the role setting, and at the same time ensuring that the dialogue content corresponding to the group chat role can meet the dialogue logic.
[0079] Step S302: construct multiple rounds of role dialogues in a group chat scenario based on the role information and dialogue data.
[0080] Multi-round role dialogue is a multi-round dialogue constructed for each role. Figure 5 As shown, according to the role information corresponding to each role, for any one of the roles, according to the dialogue data collected from various data sources, multiple rounds of dialogues between the role and the remaining roles are constructed.
[0081] In some optional implementations, the above step S302 includes:
[0082] Step b1, parse the dialogue data to determine the number of times each character speaks.
[0083] Step b2, determining the main role of the conversation based on the number of speeches.
[0084] Step b3, using the role information and dialogue data of the dialogue main role, construct multiple rounds of role dialogues for the dialogue main role in the group chat scenario.
[0085] The number of speeches is the number of times each character speaks in the dialogue data. Each character has a unique character ID in the dialogue data. By parsing the dialogue data, the number of times each character ID appears in the dialogue data can be counted, and this number is the number of speeches.
[0086] The main dialogue role is the main speaking role in the current dialogue data. For example, there are four roles A, B, C, and D in the current dialogue data. By comparing the number of speeches of these four roles in the dialogue data, it can be determined that the main dialogue roles with more speeches are roles A and D. Then, the dialogue data can be used to construct multiple rounds of role dialogues for role A; at the same time, the dialogue data can also be used to construct multiple rounds of role dialogues for role D. In this way, dialogue training samples corresponding to multiple roles can be constructed simultaneously through the same dialogue data.
[0087] In the above implementation, the number of speeches of each character is determined by parsing the dialogue data, and the main character of the dialogue is determined according to the number of speeches, so that multiple rounds of character dialogues can be constructed for the main character of the dialogue, and dialogue training samples corresponding to multiple main characters of the dialogue can be constructed simultaneously through the same dialogue data, thereby improving the utilization rate of the dialogue data, increasing the number of dialogue training samples constructed, and thus achieving the enhancement of dialogue training samples. Furthermore, on the basis of ensuring that the constructed multi-round character dialogues can conform to the dialogue logic of the main character of the dialogue, the accuracy of the generation of subsequent dialogue content is improved.
[0088] Specifically, the above step b2 includes:
[0089] Step b21, compare the number of speeches of each role, and determine the target role with the most speeches.
[0090] Step b22, determining the target character as the main character of the dialogue.
[0091] The number of speeches of each character in the dialogue data is compared to determine the size relationship of the number of speeches. Based on the size relationship of the number of speeches, the target character with the most speeches is extracted from the characters participating in the dialogue, and the target character is determined as the main character participating in the dialogue.
[0092] In the above implementation, the number of speeches of each character is combined, and the character with more speeches is determined as the main character of the dialogue, thereby ensuring the accuracy of extracting the main character of the dialogue.
[0093] Step S303, using the dialogue sequence and role information of multiple rounds of dialogue to train a role speech prediction model, so that the role speech prediction model can infer the dialogue role of the next round.
[0094] The dialogue order is the order in which different characters talk to each other. Figure 5 As shown, the multiple rounds of dialogues constructed for each role have a corresponding dialogue order. The role speech prediction model is trained according to the dialogue order generated by each role during the dialogue and the role information possessed by each role, so that the role speech prediction model has the ability to predict the dialogue roles. Therefore, the role speech prediction model can infer the dialogue roles participating in the next round of dialogue based on the dialogue context data and group chat role information in the group chat scenario.
[0095] Step S304: training the group chat dialogue model using multiple rounds of dialogue, so that the group chat dialogue model generates the dialogue content of the next round of dialogue roles.
[0096] like Figure 5 As shown, the group chat dialogue model is trained for multiple rounds of dialogues constructed for each role, so that the group chat dialogue model has the ability to generate dialogue content matching each role. Therefore, the group chat dialogue model can infer the dialogue content of the dialogue roles participating in the next round of dialogue based on the dialogue context data in the group chat scene.
[0097] The model training method provided in this embodiment uses the conversation order and role information of multiple rounds of conversations to train the role speech prediction model, and uses the multiple rounds of conversations to train the group chat conversation model. Thus, the role speech prediction model and the group chat conversation model are simultaneously trained through the same set of training data, thereby improving the utilization rate of the training data, facilitating the improvement of the matching degree between the role speech prediction model and the group chat conversation model, ensuring the fit between the group chat role prediction and the conversation content generation in the group chat scenario, and being conducive to improving the user's group chat experience.
[0098] In this embodiment, a device for generating character dialogue is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0099] This embodiment provides a device for generating role dialogues, such as Figure 6 As shown, including:
[0100] The acquisition module 401 is used to acquire the conversation context data and group chat role information of the current group chat scene.
[0101] The group chat role determination module 402 is used to determine the group chat role participating in the next round of group chat dialogue in the current group chat scene based on the dialogue features of the dialogue context data and the role features of the group chat role information.
[0102] The conversation content generating module 403 is used to generate the conversation content of the group chat role in the current group chat scene based on the conversation context data.
[0103] In some optional embodiments, the above device further includes:
[0104] The role selection module is used to respond to the role selection operation for the current group chat scenario and determine the group chat role participating in the next round of group chat dialogue based on the role selection operation.
[0105] In some optional embodiments, the above device further includes:
[0106] The model training module is used to train the role speech prediction model and the group chat dialogue model. The role speech prediction model is used to determine the group chat role that will participate in the next round of group chat dialogue in the current group chat scenario; the group chat dialogue model is used to generate the dialogue content of the group chat role in the current group chat scenario.
[0107] In some optional implementations, the model training module includes:
[0108] The data collection unit is used to collect the dialogue data between the characters and extract the information of the characters participating in the dialogue from the dialogue data.
[0109] The dialogue construction unit is used to construct multi-round role dialogues in group chat scenarios based on role information and dialogue data.
[0110] The first model training unit is used to train a role speech prediction model using the dialogue sequence and role information of multiple rounds of dialogue, so that the role speech prediction model can infer the dialogue role of the next round.
[0111] The second model training unit is used to train the group chat dialogue model using multiple rounds of dialogue, so that the group chat dialogue model generates the dialogue content of the next round of dialogue roles.
[0112] In some optional embodiments, the data acquisition unit includes:
[0113] The first data collection subunit is used to obtain a first dialogue data source of a literary genre and extract dialogue data between characters from the first dialogue data source.
[0114] The second data collection subunit is used to obtain a second dialogue data source of a social genre, and extract dialogue data between characters from the second dialogue data source.
[0115] The feature parsing subunit is used to parse the role dialogue features of each role participating in the dialogue in the dialogue data.
[0116] The role information determination subunit is used to determine the role information participating in the dialogue based on the role dialogue characteristics.
[0117] In some optional implementations, the first data collection subunit is specifically used to extract dialogue slices from the first dialogue data source according to a preset length; and extract dialogue data between characters from the dialogue slices according to the dialogue sequence between the characters.
[0118] In some optional implementations, the data acquisition unit further includes:
[0119] The filtering subunit is used to filter irrelevant content in the conversation data to obtain filtered conversation data.
[0120] The format conversion subunit is used to convert the data format of the dialogue data according to a preset format.
[0121] In some optional implementations, the dialogue construction unit includes:
[0122] The speech count determination subunit is used to parse the dialogue data and determine the speech count of each character.
[0123] The main role determination subunit is used to determine the main role of the dialogue based on the number of speeches.
[0124] The construction subunit is used to construct multiple rounds of role dialogues for the dialogue main role in the group chat scenario by using the role information and dialogue data of the dialogue main role.
[0125] In some optional implementations, the main role determination subunit is specifically used to compare the number of speeches of each role, determine the target role with the largest number of speeches; and determine the target role as the main role of the dialogue.
[0126] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0127] The device for generating role dialogues in this embodiment is presented in the form of functional units, where the units refer to ASIC (Application Specific Integrated Circuit) circuits, processors and memories that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0128] The device for generating role dialogues provided in this embodiment combines the dialogue context data obtained from the current group chat scene and the group chat role information participating in the current group chat scene to predict the group chat roles participating in the next round of group chat dialogues according to the dialogue features of the dialogue context data and the role features of the group chat role information, thereby accurately matching the corresponding group chat roles for the dialogue requests in the current group chat scene, and generating corresponding dialogue content for the group chat roles in combination with the dialogue context data. As a result, the determination of the group chat roles and the generation of dialogue content can accurately simulate the actual group chat scene, improve the accuracy of the generation of dialogue content in the group chat scene and the flexibility of the generation of dialogue content, and ensure the group chat experience of users.
[0129] The present disclosure also provides a computer device having the above Figure 6 A device for generating character dialogues as shown.
[0130] See also Figure 7 , Figure 7 is a schematic diagram of a computer device provided by an optional embodiment of the present disclosure, such as Figure 7 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 10 is taken as an example.
[0131] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0132] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0133] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0134] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0135] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0136] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0137] The computer device also includes a communication interface, which is used for the computer device to communicate with other devices or a communication network.
[0138] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0139] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0140] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for generating character dialogues, characterized in that: The method comprises: Get the conversation context data and group chat role information of the current group chat scene; Determining a group chat role that participates in the next round of group chat dialogue in the current group chat scenario based on the dialogue features of the dialogue context data and the role features of the group chat role information; Based on the conversation context data, the conversation content of the group chat role in the current group chat scene is generated.
2. The method according to claim 1, characterized in that Also includes: In response to a role selection operation for the current group chat scenario, the group chat role participating in the next round of group chat dialogue is determined based on the role selection operation.
3. The method according to claim 1, characterized in that Determine the group chat role participating in the next round of group chat dialogue in the current group chat scenario through the trained role speech prediction model, and generate the dialogue content of the group chat role in the current group chat scenario through the trained group chat dialogue model; The training method of the role speech prediction model and the group chat dialogue model includes: Collecting conversation data between characters, and extracting information about characters participating in the conversation from the conversation data; Constructing multiple rounds of role dialogues in a group chat scenario based on the role information and the dialogue data; Using the dialogue sequence of the multiple rounds of dialogue and the role information to train a role speech prediction model, so that the role speech prediction model can infer the dialogue role of the next round; The group chat dialogue model is trained using the multiple rounds of dialogue, so that the group chat dialogue model generates the dialogue content of the dialogue roles in the next round.
4. The method according to claim 3, characterized in that The collecting of conversation data between roles includes: Acquire a first dialogue data source of a literary genre, and extract the dialogue data between characters from the first dialogue data source; and / or, A second dialogue data source of a social genre is obtained, and the dialogue data between the characters is extracted from the second dialogue data source.
5. The method according to claim 4, characterized in that The extracting the conversation data between the characters from the first conversation data source includes: Extracting a conversation slice from the first conversation data source according to a preset length; The dialogue data between the characters are extracted from the dialogue slices according to the dialogue order between the characters.
6. The method according to any one of claims 3 to 5, characterized in that: After collecting the conversation data between the roles, the method further includes: Filtering irrelevant content in the conversation data to obtain filtered conversation data; and / or, The data format of the conversation data is converted according to a preset format.
7. The method according to claim 3, characterized in that The extracting the role information participating in the conversation from the conversation data includes: Analyzing the role dialogue features of each role participating in the dialogue in the dialogue data; Based on the character dialogue characteristics, information of the characters participating in the dialogue is determined.
8. The method according to claim 3, characterized in that The constructing a multi-round role dialogue in a group chat scenario based on the role information and the dialogue data includes: Parsing the dialogue data to determine the number of times each character speaks; Determine the main role of the dialogue based on the number of speeches; Using the role information of the dialogue main role and the dialogue data, multiple rounds of role dialogues for the dialogue main role in the group chat scenario are constructed.
9. The method according to claim 8, characterized in that The determining the dialogue main role from the role information based on the number of speeches includes: Compare the number of speeches of each role, and determine the target role with the most speeches; The target role is determined as the dialogue main role.
10. A device for generating character dialogues, characterized in that: The device comprises: The acquisition module is used to obtain the conversation context data and group chat role information of the current group chat scene; A group chat role determination module, configured to determine a group chat role to participate in the next round of group chat dialogue in the current group chat scenario based on the dialogue features of the dialogue context data and the role features of the group chat role information; A conversation content generation module is used to generate the conversation content of the group chat role in the current group chat scene based on the conversation context data.
11. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for generating character dialogues according to any one of claims 1 to 9 by executing the computer instructions.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for generating a character dialogue according to any one of claims 1 to 9.
13. A computer program product, characterized in that The invention comprises computer instructions for causing a computer to execute the method for generating character dialogue according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for recognizing character in text, readable medium and electronic equipment
CN112906380A
Audio information extraction method and device, electronic equipment and readable storage medium
CN114255751A
Conversation processing method and device for virtual scene, electronic equipment and storage medium
CN115293132A
Speaking responsiveness confirmation method and device, medium and computing equipment
CN115906808A
Multi-role dialogue implementation method and device, electronic equipment and readable storage medium
CN118551007A