A conversation processing method and device

By integrating the target personality traits and selecting suitable candidate characters in the human-computer dialogue system, the problem of low practicality in imitating specific characters in the existing technology of human-computer dialogue system is solved, and more efficient and widespread application is achieved.

CN113377938BActive Publication Date: 2025-04-11BEIJING XIAOMI MOBILE SOFTWARE CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110706487.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-24
Publication Date
2025-04-11
Estimated Expiration
2041-06-24

AI Technical Summary

Technical Problem

When the existing human-computer dialogue system imitates the speaking style of a specific character, it is not practical and has a high training complexity, making it difficult to implement in industrial scenarios.

Method used

By obtaining dialogue query data, a candidate character set is determined based on the query character sequence and the previously generated reply character sequence, and the target character selection is selected based on the predetermined target personality traits, and the reply character sequence is updated until completion.

Benefits of technology

It improves the performance of human-computer dialogue, reduces the training complexity of the dialogue system, makes the system more practical and widely used, and the calculation amount of generating target reply data is smaller, improving efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113377938B_ABST
    Figure CN113377938B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of human-computer dialogue, and specifically to a dialogue processing method and device. The dialogue processing method includes: obtaining dialogue inquiry data, the dialogue inquiry data including an inquiry character sequence; determining a candidate character set of the current character to be generated based on the inquiry character sequence and a reply character sequence generated before the current character to be generated; using the target character determined in the candidate character set as the current character to be generated according to a predetermined target personality feature; updating the reply character sequence based on the target character until all characters in the reply character sequence are generated, and obtaining target reply data. The disclosed method improves the performance of human-computer dialogue.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of human-computer dialogue, and in particular to a dialogue processing method and device. Background Art

[0002] With the development of smart terminals and AI (Artificial Intelligence) technology, conversational systems have become a new generation of human-computer interaction. At present, various human-computer conversational systems have been widely used in the industry for various types of products and services.

[0003] At the same time, with the continuous development of AI technology, people have also put forward higher requirements on the performance of human-computer dialogue systems. Summary of the invention

[0004] In order to improve the performance of a human-computer dialogue system, the embodiments of the present disclosure provide a dialogue processing method, device, electronic device and storage medium.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for processing a conversation, including:

[0006] Acquiring dialogue inquiry data, wherein the dialogue inquiry data includes an inquiry character sequence;

[0007] Determine a candidate character set for the current character to be generated based on the query character sequence and a reply character sequence generated before the current character to be generated;

[0008] According to a predetermined target personality feature, taking a target character determined in the candidate character set as the current character to be generated;

[0009] The reply character sequence is updated based on the target character until all characters in the reply character sequence are generated, thereby obtaining target reply data.

[0010] In some implementations, determining a candidate character set for the current character to be generated based on the query character sequence and a reply character sequence generated before the current character to be generated includes:

[0011] Inputting the query character sequence into a pre-trained dialogue generation network, obtaining candidate characters of the current character to be generated output by the dialogue generation network and first weights corresponding to the candidate characters;

[0012] The first weights are sorted from high to low to determine the candidate character set consisting of candidate characters corresponding to a preset number of the first weights.

[0013] In some implementations, the step of using the target character determined in the candidate character set as the current character to be generated according to the predetermined target personality feature includes:

[0014] For each candidate character in the candidate character set, combine the candidate character with the reply character sequence generated before the current character to be generated to obtain a candidate sequence;

[0015] Input each of the candidate sequences into a pre-trained target personality discrimination network to obtain a second weight corresponding to each of the candidate sequences output by the target personality discrimination network; wherein the target personality discrimination network is a network pre-determined from a plurality of personality discrimination networks;

[0016] The first weight corresponding to each candidate character is merged with the second weight to obtain a third weight corresponding to each candidate character;

[0017] According to the third weight, the target character determined in the candidate character set is used as the current character to be generated.

[0018] In some implementations, the step of generating all characters in the reply character sequence to obtain target reply data includes:

[0019] In response to detecting that the current character to be generated includes a terminator, it is determined that all characters in the reply character sequence are generated, and target reply data is obtained.

[0020] In some implementations, the training process of each personality discrimination network is as follows:

[0021] Acquire first dialogue data, the first dialogue data including dialogue inquiry data, dialogue reply data, and personality data corresponding to the dialogue reply data;

[0022] Inputting the dialogue response data of the first dialogue data into the personality discrimination network to obtain the predicted personality output by the personality discrimination network;

[0023] According to the difference between the predicted personality and the personality data, the network parameters of the personality discrimination network are adjusted until a convergence condition is met.

[0024] In some implementations, the training process of each personality discrimination network further includes:

[0025] Sampling the dialogue reply data of the first dialogue data to obtain incomplete dialogue data including incomplete dialogue reply data;

[0026] Inputting the incomplete dialogue reply data contained in the incomplete dialogue data into the personality discrimination network to obtain the predicted personality output by the personality judgment network;

[0027] According to the difference between the predicted personality and the personality data of the incomplete dialogue data, the network parameters of the personality discrimination network are adjusted until a convergence condition is met.

[0028] In some implementations, the training dialogue data for training the dialogue generation network and / or the personality discrimination network is obtained by the following steps:

[0029] For each personality discrimination network, the target response data obtained in the current round is used as the dialogue query data for the next round, and the process of obtaining the target response data is iterated until the convergence condition is met;

[0030] Obtaining first training dialogue data according to each group of the dialogue inquiry data and the target response data generated in the loop iteration process;

[0031] The second training dialogue data is obtained according to each group of the dialogue inquiry data, the target response data and the personality data corresponding to the personality discrimination network generated in the loop iteration process.

[0032] In a second aspect, an embodiment of the present disclosure provides a dialog processing device, including:

[0033] An acquisition module is configured to acquire dialogue inquiry data, wherein the dialogue inquiry data includes an inquiry character sequence;

[0034] A first determination module is configured to determine a candidate character set of the current character to be generated based on the query character sequence and a reply character sequence generated before the current character to be generated;

[0035] A second determination module is configured to use the target character determined in the candidate character set as the current character to be generated according to a predetermined target personality feature;

[0036] The updating module is configured to update the reply character sequence based on the target character until all characters in the reply character sequence are generated to obtain target reply data.

[0037] In some implementations, the first determining module is specifically configured to:

[0038] Inputting the query character sequence into a pre-trained dialogue generation network, obtaining candidate characters of the current character to be generated output by the dialogue generation network and first weights corresponding to the candidate characters;

[0039] The first weights are sorted from high to low to determine the candidate character set consisting of candidate characters corresponding to a preset number of the first weights.

[0040] In some implementations, the second determining module is specifically configured to:

[0041] For each candidate character in the candidate character set, combine the candidate character with the reply character sequence generated before the current character to be generated to obtain a candidate sequence;

[0042] Input each of the candidate sequences into a pre-trained target personality discrimination network to obtain a second weight corresponding to each of the candidate sequences output by the target personality discrimination network; wherein the target personality discrimination network is a network pre-determined from a plurality of personality discrimination networks;

[0043] The first weight corresponding to each candidate character is merged with the second weight to obtain a third weight corresponding to each candidate character;

[0044] According to the third weight, the target character determined in the candidate character set is used as the current character to be generated.

[0045] In some embodiments, the apparatus described in the present disclosure further includes a network training module, wherein the network training module is configured to:

[0046] Acquire first dialogue data, the first dialogue data including dialogue inquiry data, dialogue reply data, and personality data corresponding to the dialogue reply data;

[0047] Inputting the dialogue response data of the first dialogue data into the personality discrimination network to obtain the predicted personality output by the personality discrimination network;

[0048] According to the difference between the predicted personality and the personality data, the network parameters of the personality discrimination network are adjusted until a convergence condition is met.

[0049] In some implementations, the network training module is configured to:

[0050] Sampling the dialogue reply data of the first dialogue data to obtain incomplete dialogue data including incomplete dialogue reply data;

[0051] Inputting the incomplete dialogue reply data contained in the incomplete dialogue data into the personality discrimination network to obtain the predicted personality output by the personality judgment network;

[0052] According to the difference between the predicted personality and the personality data of the incomplete dialogue data, the network parameters of the personality discrimination network are adjusted until a convergence condition is met.

[0053] In some embodiments, the apparatus described in the present disclosure further includes a training data acquisition module, wherein the training data acquisition module is configured to:

[0054] For each personality discrimination network, the target response data obtained in the current round is used as the dialogue query data for the next round, and the process of obtaining the target response data is iterated until the convergence condition is met;

[0055] Obtaining first training dialogue data according to each group of the dialogue inquiry data and the target response data generated in the loop iteration process;

[0056] The second training dialogue data is obtained according to each group of the dialogue inquiry data, the target response data and the personality data corresponding to the personality discrimination network generated in the loop iteration process.

[0057] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:

[0058] Processor; and

[0059] A memory stores computer instructions that can be read by the processor, and when the computer instructions are read, the processor executes the method according to any implementation of the first aspect.

[0060] In a fourth aspect, an embodiment of the present disclosure provides a storage medium for storing computer-readable instructions, wherein the computer-readable instructions are used to enable a computer to execute the method according to any embodiment of the first aspect.

[0061] The dialogue processing method of the embodiment of the present disclosure includes obtaining dialogue inquiry data, the dialogue inquiry data includes an inquiry character sequence, determining a candidate character set of the current character to be generated based on the inquiry character sequence and a reply character sequence generated before the current character to be generated, using the target character determined in the candidate character set as the current character to be generated according to a predetermined target personality feature, updating the reply character sequence based on the target character until all characters in the reply character sequence are generated, and obtaining target reply data. In the embodiment of the present disclosure, the target personality feature can be integrated to output reply data corresponding to the target personality, improve the performance of human-computer dialogue, and adopt the universal attributes of personality. Compared with the role attributes such as personality setting, the application scenario of the human-computer dialogue of the present disclosure is more extensive and more practical. At the same time, when generating the reply character sequence of the target reply data, each reply character is generated one by one based on the target personality feature, and the calculation amount of the target reply data is smaller, which can improve the efficiency and performance of the human-computer dialogue. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art 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.

[0063] Figure 1 It is a flowchart of a conversation processing method according to some implementations of the present disclosure.

[0064] Figure 2 It is a structural block diagram of a human-computer dialogue system in some implementations of the present disclosure.

[0065] Figure 3 It is a flowchart of a conversation processing method according to some implementations of the present disclosure.

[0066] Figure 4 It is a schematic diagram of a dialog processing method according to some implementation modes of the present disclosure.

[0067] Figure 5 It is a flowchart of a conversation processing method according to some implementations of the present disclosure.

[0068] Figure 6 It is a flowchart of a conversation processing method according to some implementations of the present disclosure.

[0069] Figure 7 It is a flowchart of a conversation processing method according to some implementations of the present disclosure.

[0070] Figure 8 It is a flowchart of a conversation processing method according to some implementations of the present disclosure.

[0071] Fig. 9 It is a flowchart of a conversation processing method according to some implementations of the present disclosure.

[0072] Fig.10 It is a structural block diagram of a dialogue processing device in some implementation modes of the present disclosure.

[0073] Fig.11 It is a structural block diagram of an electronic device suitable for implementing the method disclosed in the present invention. DETAILED DESCRIPTION

[0074] The technical solution of the present disclosure will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described implementation is a part of the implementation of the present disclosure, rather than all the implementations. Based on the implementation in the present disclosure, all other implementations obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure. In addition, the technical features involved in the different implementations of the present disclosure described below can be combined with each other as long as they do not conflict with each other.

[0075] Nowadays, conversational systems have been widely used in people's lives, such as intelligent customer service, mobile phone voice assistants, etc. Users can use conversational systems to handle business and control IoT devices. Conversational systems have become a new generation of human-computer interaction.

[0076] With the continuous development of AI technology, people are no longer limited to using human-computer dialogue systems to realize business functions, but hope that human-computer dialogue systems can communicate like real people. For example, Xiaomi's smart voice assistant "Xiao Ai" is increasingly expected by users to have natural conversations with "Xiao Ai" like a real person, which can not only increase the fun, but also make users feel truly accompanied.

[0077] In order to improve the personalization of system responses, the human-computer dialogue system of the related technology often pre-trains multiple different dialogue generation networks based on the character dialogue styles. For example, a dialogue generation network containing character styles can be pre-trained based on dialogue materials such as Sun Wukong and Guo Degang. When the user chooses the dialogue style of Sun Wukong, the human-computer dialogue system can output a response like "My little love is here!", making the conversation more interesting.

[0078] However, in actual dialogue scenarios, the system only imitates the speaking style of a fixed character based on the user's choice, which is not very practical and has great limitations. More importantly, since the system needs to have a variety of character styles for users to choose from, it is necessary to pre-train multiple dialogue generation networks. The number of parameters of each generation network is very large (for example, hundreds of millions of parameters), so the difficulty and magnitude of training are also very large, which is not suitable for implementation in industrial scenarios.

[0079] Based on the defects existing in the above-mentioned related technologies, the embodiments of the present disclosure provide a dialogue processing method, device, electronic device and storage medium to enhance the performance of human-computer dialogue, while reducing the training complexity of the dialogue system to facilitate on-site deployment.

[0080] In a first aspect, the embodiments of the present disclosure provide a method for processing a dialogue, which can be applied to a terminal device including a human-computer dialogue system to realize a dialogue between a user and the terminal. The terminal device can be, for example, a smart phone, a tablet computer, a smart wearable device, a personal computer, a handheld terminal, etc. The present disclosure does not limit this.

[0081] like Figure 1 As shown, in some implementations, the dialog processing method of the example disclosed herein includes:

[0082] S110: Acquire dialogue inquiry data.

[0083] Specifically, a complete conversation data may include conversation query data (query) and conversation response data (response). For example, a conversation data may be <What are you doing? Thinking about you.>, where "What are you doing?" is the conversation query data, and "Thinking about you." is the conversation response data.

[0084] It is understandable that the dialogue query data is not necessarily a grammatical question, and data of any sentence pattern can be used as dialogue query data. The dialogue response data is not necessarily a grammatical declarative sentence, as long as it can form a coherent dialogue with the dialogue query data in terms of semantics.

[0085] In the embodiments of the present disclosure, the acquired dialogue inquiry data may be voice information, such as the voice of the user picked up by the dialogue system through a microphone; the dialogue inquiry data may also be text information, such as the text information input by the user acquired by the dialogue system through a text box, and the present disclosure does not limit this. When the dialogue inquiry data is voice information, the system may perform semantic recognition on the voice information and convert it into text characters, which can be understood by those skilled in the art and will not be elaborated in the present disclosure.

[0086] The dialogue inquiry data includes an inquiry character sequence, which refers to a data sequence formed by multiple characters in a semantic order. In an example, a dialogue inquiry data is "Do you prefer tea", wherein the dialogue inquiry data includes four characters "Do", "you", "prefer", and "tea", and the four characters form the inquiry character sequence in a semantic order.

[0087] It can be understood that the characters described in the embodiments of the present disclosure may be any type of characters, such as one or more of Chinese characters, letters, numbers, punctuation marks, and operation symbols, and the present disclosure does not impose any limitation on this.

[0088] S120: Determine a candidate character set for the current character to be generated based on the query character sequence and the reply character sequence generated before the current character to be generated.

[0089] In the embodiment of the present disclosure, after obtaining the dialogue query data, instead of generating a whole character sequence of the target reply data at one time according to the dialogue query data, each character in the reply sequence is generated one by one. The advantage of this is that the personality characteristic information can be better used to guide the target reply data, and it is also conducive to the decoupling between the dialogue generation network and the personality discrimination network, which is convenient for network training. This is specifically explained in the following embodiment of the present disclosure, and will not be expanded in detail in this step.

[0090] Specifically, in some implementations, the query character sequence of the acquired dialogue query data is represented as: X={x 1 , x 2 ,......,x n}, where n represents the length of the query character sequence, that is, the number of characters. Assume that the generated target reply data reply character sequence is Y = {y 1 ,y 2 ,......,y m}, where m represents the length of the reply character sequence, that is, the number of characters.

[0091] The current character to be generated in the generated reply character sequence Y is y i When, according to the query character sequence X and the current character to be generated y i The previously generated reply character sequence {y 1 ,y 2 ,......,y i-1}, determine the current character y to be generated i The candidate character set.

[0092] In an example, suppose the character y to be generated is i The previously generated reply character sequence is {Do, you}, which includes two generated characters. Therefore, based on the generated reply character sequence and the query character sequence X, the character y to be generated can be determined. i The candidate character set is Z = (want, prefer, ..., thus), and the characters represented by each element in the set can be semantically combined with "Do you" to form a coherent sentence.

[0093] In some embodiments, a dialog generation network can be used to obtain a candidate character set, the input of which is the query character sequence, and the output is the candidate character set of the current character to be generated. The following embodiments of the present disclosure specifically describe the network structure, principle, and training process, which will not be described in detail here.

[0094] S130. According to a predetermined target personality feature, a target character determined in the candidate character set is used as a current character to be generated.

[0095] It is worth noting that in the embodiments of the present disclosure, personality characteristics are integrated when generating dialogue response data. Different from the speaking style (personality) and role attributes of a character, the personality characteristics of the embodiments of the present disclosure refer to: attribute information that is not dependent on an individual, but is general attribute information.

[0096] For example, the character's speaking style (i.e., personality) only cares about the way a specific character speaks. Based on the dialogue data of the fixed character, a dialogue network that matches the character's personality is trained, so that the dialogue system can imitate the character's speaking style. Similarly, the character attributes also only care about the hobbies, personality, and other attribute information of a specific character. Based on the dialogue data of the character, a dialogue network that matches the character's attributes is trained, so that the dialogue system can cater to the character's speaking style.

[0097] However, the character traits of the embodiments of the present disclosure are different from those described above. The embodiments of the present disclosure focus on general character attributes, such as optimism, pessimism, and thoughtfulness. It does not focus on a specific role, but considers a wide range of character traits.

[0098] In some embodiments, multiple personality discrimination networks of different personalities can be pre-trained through conversation data containing personality characteristic information, and each personality discrimination network can represent a personality, such as optimism, pessimism, thoughtfulness, etc. The following embodiments of the present disclosure are specifically described and will not be described in detail here.

[0099] The predetermined target personality characteristics may be a target personality discrimination network selected by the user from a plurality of personality discrimination networks in advance. For example, if the user prefers the dialogue system to have a "considerate" personality, the user may select the "considerate" personality, so that the system sets the personality discrimination network corresponding to "considerate" as the target personality discrimination network. The present disclosure does not limit the method by which the user selects the target personality of the dialogue system in advance, and the method may be set as needed, for example, by sending the target personality selection of the dialogue system through voice or APP interaction.

[0100] Still using the above example to illustrate, assume that the character y to be generated is i The candidate character set is Z = (want, prefer, ..., thus), where each candidate character in the candidate character set can be combined with the previously generated reply character sequence {Do, you} to form a new reply character sequence. For example, the new reply character sequence may include: {Do, you, want}, {Do, you, prefer}, ..., {Do, you, thus}.

[0101] By integrating the target personality characteristics, it is possible to determine which of these new reply character sequences meets the target personality characteristics. The candidate character corresponding to the reply character sequence is the target character that meets the target personality characteristics, and the target character can be determined as the current character y to be generated. i .

[0102] For example, each new reply character sequence in the above can be input into the target personality discrimination network, and the target personality discrimination network outputs {Do, you, prefer}, indicating that the reply character sequence best matches the personality the user wants, that is, the target character "prefer" in the candidate character set Z = (want, prefer, ..., thus) is the current character y to be generated. i .

[0103] S140, updating the reply character sequence based on the target character until all characters in the reply character sequence are generated, thereby obtaining target reply data.

[0104] In S130, the character y to be generated is determined i After the corresponding character, you can use y i Update the reply character sequence, that is, replace the previously generated reply character sequence {y 1 ,y 2 ,......,y i-1} is updated to {y 1 ,y 2 ,......,y i-1 ,y i}.

[0105] In generating y i After the corresponding characters, S120 and S130 can be executed repeatedly, based on the updated reply character sequence {y 1 ,y 2 ,......,y i-1 ,y i} and the query character sequence, continue to generate y i+1 Those skilled in the art can understand and implement the above steps with reference to the above steps, and the present disclosure will not elaborate on them.

[0106] For each character in the reply character sequence, the above steps are executed in a loop until the reply character sequence Y={y 1 ,y 2 ,......,y m} is generated, and the target character sequence Y obtained is the target reply data.

[0107] In some implementations, it is possible to detect whether the current character to be generated includes a terminator. If the current character to be generated includes a terminator, it is determined that all characters in the reply character sequence have been generated, thereby obtaining target reply data.

[0108] It can be understood that in the dialogue processing method of the embodiment of the present disclosure, the generated target response data incorporates the target personality characteristics predetermined by the user, such as optimism, thoughtfulness, etc., so that response data corresponding to the target personality can be output, improving the performance of human-computer dialogue, and adopting universal personality attributes. Compared with role attributes such as personality settings, the application scenarios of the human-computer dialogue disclosed in the present disclosure are more extensive and more practical.

[0109] At the same time, when generating the response character sequence of the target response data, each response character is generated one by one based on the target personality characteristics, and the calculation amount of the target response data is smaller, which improves the efficiency and performance of human-computer dialogue. In addition, the personality discrimination network guides the dialogue generation network to generate the target response data. The two networks are independent of each other, which reduces the difficulty of network training. The following is a specific explanation.

[0110] Figure 2 The network structure of the human-computer dialogue system in the example of the present disclosure is shown below. Figure 2 The dialog processing method of the disclosed example is described in detail.

[0111] like Figure 2 As shown, in some implementations, the human-computer dialogue system 100 of the present disclosure example adopts a Constrained generation structure. Specifically, the human-computer dialogue system 100 includes a dialogue generation network 110 and a plurality of personality discrimination networks 120.

[0112] The dialogue generation network 110 may adopt a base-generator, whose input is dialogue query data and whose output is a candidate character set of the current character to be generated.

[0113] The multiple personality discrimination networks 120 are pre-trained discriminator networks, wherein each personality discrimination network 120 may correspond to a personality, for example, the multiple personality discrimination networks may correspond to personalities such as "optimistic", "negative", "considerate", etc. The input of the personality discrimination network is a response character sequence composed of each candidate character in the candidate character set, and the output is the probability of each candidate character sequence.

[0114] exist Figure 2 Based on the system structure shown, Figure 3 and Figure 4 Some embodiments of the disclosed dialogue processing method are shown below. Figure 3 and Figure 4 Provide specific instructions.

[0115] like Figure 3 As shown, in some implementations, the dialog processing method of the example disclosed herein includes:

[0116] S310: Input the query character sequence into a pre-trained dialog generation network, and obtain candidate characters of the current character to be generated output by the dialog generation network and first weights corresponding to the candidate characters.

[0117] S320: Sort the first weights from high to low to determine a candidate character set consisting of candidate characters corresponding to a preset number of first weights.

[0118] Specifically, in some implementations, the dialogue generation network can be a basic dialogue generator that is pre-trained using dialogue data. The training process of the dialogue generation network is specifically described in the following implementations of the present disclosure and will not be described in detail here.

[0119] In the embodiment of the present disclosure, the input of the dialogue generation network 110 is the query character sequence and the reply character sequence generated before the current character to be generated. In one example, the query character sequence is X, and the current character to be generated is y. 3 , the character to be generated is y 3 The reply character sequence generated before is Y'={y 1 ,y 2}, the input of the dialogue input network 100 is X and Y'.

[0120] like Figure 4 In this example, assume that the reply character sequence is Y'={y 1 ,y 2 The specific character sequence corresponding to} is Y'={Do, you}, that is, y 1 The characters represented are "Do", y 2 The characters represented are "you".

[0121] In this example, the dialogue generation network 110 predicts and outputs candidate characters of the current character to be generated and the first weight corresponding to each candidate character according to the query character sequence X and the reply character sequence Y'.

[0122] For example Figure 4 In the example, the candidate characters output by the dialogue generation network 110 include: want, prefer, thus, etc., and the first weight corresponding to each candidate character is expressed as:<want,0.3> ,<prefer,0.3> ,<thus,0.1> …….in,<want,0.3> Indicates the character y to be generated 3The probability of want is 0.3, that is, the first weight corresponding to want is 0.3. The rest is similar, and the disclosure will not elaborate on it.

[0123] In the disclosed embodiment, the candidate characters are sorted in descending order according to the first weights, and a preset number of candidate characters corresponding to the first weights are determined to form a candidate character set.

[0124] For example Figure 4 In the example, the candidate characters are sorted from high to low according to the first weight. It can be understood that the candidate characters that are ranked higher have a higher probability of being the character to be generated. Therefore, the candidate characters corresponding to the preset number of first weights that are ranked higher are selected, for example Figure 3 Only the top-3 candidate characters want, prefer and thus are combined into a candidate character set, that is, the candidate character set Z = (want, prefer, thus).

[0125] Those skilled in the art will appreciate that the preset number may be selected according to specific scenario requirements and is not limited to the top 3 candidate characters, but may also be any other number of candidate characters, and the present disclosure does not impose any limitation on this.

[0126] It can be seen from the above that in the embodiment of the present disclosure, a preset number of candidate characters are determined according to the first weight of each candidate character to form a candidate character set, thereby reducing the amount of calculated data and improving the system operation speed.

[0127] like Figure 5 As shown, in some implementations, the dialog processing method of the example of the present disclosure further includes:

[0128] S510: For each candidate character in the candidate character set, combine the candidate character with a reply character sequence generated before the current character to be generated to obtain a candidate sequence.

[0129] S520, input each candidate sequence into a pre-trained target personality discrimination network to obtain a second weight corresponding to each candidate sequence output by the target personality discrimination network.

[0130] Specifically, the target personality discrimination network 120 is a network predetermined from a plurality of personality discrimination networks. Figure 2 In the system architecture shown, multiple personality discrimination networks can be pre-trained, each of which corresponds to a personality. When a user needs a dialogue system with a certain personality, the corresponding personality can be pre-selected, so that the system can determine the personality discrimination network corresponding to the user's selected personality from multiple personality discrimination networks, that is, the target personality discrimination network.

[0131] The specific training process of the personality discrimination network is described in detail in the following embodiments of the present disclosure and will not be described in detail here.

[0132] For example Figure 4 In this example, the current character to be generated is y 3 The candidate character set Z = (want, prefer, thus). Each element in the candidate character set Z can be combined with the reply character sequence Y' to form a new character sequence, that is, a candidate sequence. For example, the element "want" in the candidate character set Z can be combined with the reply character sequence Y' to form a new character sequence "Do you want"; the element "prefer" in the candidate character set Z can be combined with the reply character sequence Y' to form a new character sequence "Do you prefer"; the element "thus" in the candidate character set Z can be combined with the reply character sequence Y' to form a new character sequence "Do you thus". Thus, the obtained candidate sequence can include (Do you want, Doyou prefer, Do you thus).

[0133] It can be understood that the target personality discrimination network can be a binary classifier, the purpose of which is to determine whether the input dialogue data is data of the target personality. Therefore, in the embodiment of the present disclosure, each candidate sequence is input into the target personality discrimination network to obtain a second weight value of each candidate sequence. The second weight value can represent the probability that the candidate sequence is the target personality.

[0134] For example Figure 4 As shown in , the second weight corresponding to the candidate sequence "Do you want" output by the target personality discrimination network 120 is 0.4, the second weight corresponding to the candidate sequence "Do you prefer" is 0.8, and the second weight corresponding to the candidate sequence "Do you thus" is 0.9. It can be understood that the higher the second weight, the higher the probability that the candidate sequence corresponding to the second weight is the target personality.

[0135] S530: The first weight corresponding to each candidate character is merged with the second weight to obtain a third weight corresponding to each candidate character.

[0136] S540: According to the third weight, the target character determined in the candidate character set is used as the current character to be generated.

[0137] In the disclosed embodiment, after obtaining the first weight and the second weight of each candidate character, it can be understood that the first weight represents the probability that the candidate character is the current character to be generated, and the second weight represents the probability that the candidate character is the target character, thereby merging the first weight and the second weight to obtain the third weight corresponding to each candidate character, wherein the third weight represents the probability that the candidate character is the current character to be generated based on the fusion of the target character characteristics.

[0138] The specific processing process of the fusion process can be, for example, Figure 4 In the example, the first weight corresponding to each candidate character is multiplied by the second weight to obtain a third weight. For example, the first weight of the candidate character "want" is 0.3 and the second weight is 0.4, and the third weight is 0.12; for another example, the first weight of the candidate character "prefer" is 0.3 and the second weight is 0.8, and the third weight is 0.24; for another example, the first weight of the candidate character "thus" is 0.1 and the second weight is 0.9, and the third weight is 0.09.

[0139] It is worth mentioning that Figure 4 This is merely an exemplary implementation of the method disclosed herein. In other implementations, the first weight and the second weight may be fused in other ways, and the disclosure does not limit this.

[0140] After obtaining the third weights of the candidate characters, the candidate character corresponding to the largest third weight can be determined as the target character, that is, the character to be generated. Figure 4 In this example, the third weight corresponding to the candidate character "prefer" is the largest, so the candidate character "prefer" is determined as the target character, that is, the current character y to be generated. 3 .

[0141] It is worth noting that through Figure 4 As can be seen from the principle shown, in the embodiment of the present disclosure, in the process of generating the reply character sequence of the target reply data, the target personality characteristics are integrated to assist in the generation of the reply characters. The dialogue generation network 110 and the target personality discrimination network 120 are independent network structures. For example, Figure 4 In the structure shown, even if the target personality discrimination network 120 is removed, the dialogue generation network 110 can also be used as the basic dialogue generation. Therefore, the two do not need to be trained jointly, but can be trained independently. The system is more robust, and when more personalities are added for training later, only the personality discrimination network needs to be trained, which reduces the amount of training tasks.

[0142] Continue to refer to Figure 4 For example, when determining the current character y to be generated 3After "perfer", the character y to be generated can be 3 For the reply character sequence Y'={y 1 ,y 2} is updated, and the updated reply character sequence can be expressed as Y" = {y 1 ,y 2 ,y 3}, the corresponding specific character sequence is Y" = {Do, you, prefer}. Then, the updated reply character sequence is returned to the next character (y 4 ) in the dialogue generation network 110 during the determination process, thereby assisting y 4 The specific process is similar to the above. Those skilled in the art can refer to the above steps and execute them in a loop, which will not be described in detail. 1 ,y 2 ,......,y m}, all characters in the string are generated, and the resulting reply character sequence Y is the target reply data.

[0143] Specifically, in some implementations, the process of determining that all characters in the reply character sequence have been generated may include:

[0144] In response to detecting that the current character to be generated includes a terminator, it is determined that all characters in the reply character sequence are completely generated, and target reply data is obtained.

[0145] Specifically, a terminator can be set at the end of the conversation reply data, so that each generated character is detected during the character generation process in the reply character sequence. When the terminator is detected, it means that all the characters in the reply character sequence are generated completely, and the complete target reply data is obtained.

[0146] The above describes the system structure and working principle of the dialogue processing method in the embodiment of the present disclosure. Figure 2 Based on the system structure shown, the dialogue processing method disclosed in the present invention also includes a process of network training, which is described in detail below.

[0147] based on Figure 2 In the system structure shown, the network training process of the dialogue system can be divided into two parts: the training process of the dialogue generation network 110, and the training process of each personality discrimination network 120. The two processes are described in detail below.

[0148] like Figure 6 As shown, in some implementations, the training process of the dialogue generation network includes:

[0149] S610: Acquire second conversation data.

[0150] Specifically, the second dialogue data may be a general dialogue corpus, that is, any corpus pair including dialogue query data (query) and dialogue reply data (response).

[0151] In some implementations, the source of the second dialogue data may be various open source dialogue corpora on the Internet.

[0152] In other implementations, the second dialogue data may be obtained by using network self-learning based on network enhanced learning. This disclosure will be described below and will not be described in detail here.

[0153] S620: Input the dialogue query data of the second dialogue data into the dialogue generation network to obtain the predicted response data output by the dialogue generation network.

[0154] Specifically, the dialogue generation network can be a base-generator. In the disclosed embodiment, for example, an autoregressive generator network can be used, that is, the reply character sequence is generated step by step, rather than the entire reply character sequence at once, so as to facilitate the integration of the target personality features in the reply characters.

[0155] In one example, the dialogue generation network of the embodiment of the present disclosure adopts a GPT (Generative Pre-Training) network, wherein the principle of the GPT network is as follows:

[0156] The network input is a query character sequence: X = {x 1 , x 2 ,......,x n};

[0157] The network output is a reply character sequence: Y = {y 1 ,y 2 ,......,y m};

[0158] Among them, n and m represent the length of the character sequence, that is, the number of characters.

[0159] The probability P(Y) of the dialogue generation network outputting Y given a query character sequence X is expressed as:

[0160]

[0161] Among them, y i Indicates the current character to be generated, y 1:i-1 It represents the reply character sequence generated before the current character to be generated. The specific principle is the same as the aforementioned generation of reply characters one by one. Those skilled in the art can understand and fully implement it by referring to the aforementioned implementation, and the present disclosure will not elaborate on it.

[0162] Therefore, when the dialogue generation network is trained, the dialogue query data (query) in the second dialogue data is input into the dialogue generation network to be trained, so that the predicted response data output by the dialogue generation network can be obtained through the above process.

[0163] S630: According to the difference between the predicted reply data and the dialogue reply data, adjust the network parameters of the dialogue generation network until the convergence condition is met.

[0164] Specifically, the predicted response data represents the predicted data output by the dialogue generation network to be trained, and the dialogue response data (response) represents the real data corresponding to the dialogue query data (query) in the second dialogue data. Therefore, according to the difference between the predicted response data and the dialogue response data, that is, the loss, the network parameters of the dialogue generation network can be adjusted and optimized until the convergence condition of the network training is met, and a trained dialogue generation network is obtained.

[0165] like Figure 7 As shown, in some embodiments, the training process of each personality discrimination network includes:

[0166] S710: Obtain first conversation data.

[0167] Specifically, compared with the second conversation data, the first conversation data includes conversation query data (query), conversation response data (response) and personality data (personality) corresponding to the conversation response data, that is, the behavior of each first conversation data is expressed as (query, response, personality).

[0168] In an example, the first dialogue data may be (query: What should I do if I am unhappy?, response: Aha! Life is often not as I wish, but there will be a rainbow after the storm!, personality: optimistic / optimistic)

[0169] In another example, the first conversation data may be (query: what should I do if I am unhappy?, response: what's wrong? You can talk to me. I am a good listener!, personality: caring / caring for others)

[0170] From the above examples, we can see that for the same dialogue query data, the dialogue response data generated under different personalities is also different. This also shows that changes to the general personality can not only increase the fun of the dialogue, but also make the human-computer dialogue closer to the scene of real-life dialogue. Compared with simply imitating a certain character's speaking style, it has a wider range of usage scenarios.

[0171] S720: Input the dialogue response data of the first dialogue data into a personality discrimination network to obtain a predicted personality output by the personality discrimination network.

[0172] Specifically, in each first dialogue data, the dialogue response data (response) has corresponding personality data (personality), and the personality data is also the real data of the dialogue response data.

[0173] In some embodiments, the personality discrimination network, i.e., a personality classifier (e.g., a binary classifier), outputs whether the dialogue response data matches a certain personality given the input dialogue response data. Thus, the dialogue response data of the first dialogue data is input into the personality discrimination network to be trained, and the predicted personality output by the personality discrimination network can be output, and the predicted personality is the predicted data output by the personality discrimination network.

[0174] S730: According to the difference between the predicted personality and the personality data, the network parameters of the personality discrimination network are adjusted until the convergence condition is met.

[0175] Specifically, the predicted personality represents the predicted data output by the personality discrimination network to be trained, and the personality data (personality) represents the real data corresponding to the dialogue response data (response) in the first dialogue data. Therefore, according to the difference between the predicted personality and the personality data, that is, the loss, the network parameters of the personality discrimination network can be adjusted and optimized until the convergence condition of the network training is met, and a trained personality discrimination network is obtained.

[0176] It can be understood that the above is an explanation of the training process of one personality discrimination network. The training process of multiple personality discrimination networks included in the human-computer dialogue system can be performed with reference to the above, so that multiple personality discrimination networks corresponding to different personalities can be obtained, such as personality discrimination networks corresponding to optimistic, negative, considerate, etc. As many personality discrimination networks as needed can be trained.

[0177] From the above, it can be seen that in the disclosed embodiment, the human-computer dialogue system adopts a distributed system structure of 1+N (1 dialogue generation network + N personality discrimination networks), and the dialogue generation network and the personality discrimination network can be decoupled and trained independently. Therefore, when a new personality discrimination network is added later, the new personality discrimination network can be trained separately and connected to the dialogue generation network. There is no need to train in conjunction with the dialogue generation network, which reduces the difficulty of training and is also conducive to the seamless expansion of the network structure.

[0178] In addition, compared to training multiple dialogue generation networks with different personality characteristics, this distributed network structure also greatly reduces the workload of network training. This is because dialogue generation networks are generally networks with extremely large parameters, and the network parameters can even reach hundreds of millions. If multiple dialogue generation networks with personality characteristics are trained, the training workload is very large, which is not conducive to industrial deployment. However, in the disclosed embodiment, only one dialogue generation network needs to be trained, and the personality discrimination network is a discriminator structure. Its network parameters are greatly reduced compared to the dialogue generation network, generally only in the tens of thousands or millions. Therefore, the workload of network training can be greatly reduced, which is more conducive to industrial deployment.

[0179] Combination Figure 4 From the principle shown, it can be seen that for the personality discrimination network, it needs to judge whether it belongs to the target personality based on incomplete dialogue response data. Therefore, if the personality discrimination network is trained only based on complete conversation response data, there may be a problem of weak network generalization ability, resulting in poor performance of the dialogue system.

[0180] Therefore, in some embodiments, Figure 8 As shown, the training process of the personality discrimination network disclosed in the present invention also includes:

[0181] S810: Sampling the dialogue reply data of the first dialogue data to obtain incomplete dialogue data including incomplete dialogue reply data.

[0182] Specifically, incomplete dialogue response data refers to a semantically incomplete dialogue response sequence. The purpose of sampling the dialogue response data (response) of the first dialogue data is: when generating a response character sequence, it is necessary to determine the personality characteristics based on the previously generated incomplete sequence, that is, to enable the personality discrimination network to have the potential to discriminate whether an incomplete response sequence has a certain personality. Therefore, by sampling the dialogue response data in the first dialogue data, an incomplete sequence can be obtained as training data, that is, incomplete dialogue data.

[0183] For example, a complete first conversation data includes: (query: {x 1 , x 2,......,x n}, response: {y 1 ,y 2 ,......,y m}, personality: P). Therefore, the incomplete conversation data obtained after sampling processing may include:

[0184] (query: {x 1 , x 2 ,......,x n}, response: {y 1 ,y 2}, personality: P)

[0185] (query: {x 1 , x 2 ,......,x n}, response: {y 1 ,y 2 ,y 3}, personality: P)

[0186] (query: {x 1 , x 2 ,......,x n}, response: {y 1 ,y 2 ,y 3 ,y 4}, personality: P)

[0187] …

[0188] (query: {x 1 , x 2 ,......,x n}, response: {y 1 ,y 2 ,y 3 ,y 4 , ..., y m}, personality: P)

[0189] It can be seen that the dialogue reply data (response) included in the incomplete dialogue data is a plurality of incomplete dialogue reply data.

[0190] S820, inputting the incomplete dialogue reply data included in the incomplete dialogue data into the personality discrimination network to obtain the predicted personality output by the personality discrimination network.

[0191] S830. According to the difference between the predicted personality and the personality data of the incomplete dialogue data, the network parameters of the personality discrimination network are adjusted until the convergence condition is met.

[0192] Specifically, the process of S820 to S830 is similar to the above-mentioned S720 to S730. Those skilled in the art can understand and fully implement it by referring to the above, and the present disclosure will not elaborate on it.

[0193] From the above, it can be seen that in the embodiment of the present disclosure, the incomplete dialogue response data is used to train the personality discrimination network, so that the personality discrimination network can better identify the target personality when assisting in generating each response character, thereby improving the performance of the human-computer dialogue system.

[0194] In some embodiments, the disclosed embodiments adopt a reinforcement learning training method for the human-computer dialogue system, so that the training data can be expanded based on the system itself, and then the training data can be used to further train the dialogue system and enhance the system performance. Fig. 9 Provide explanation.

[0195] like Fig. 9 As shown, in some embodiments, the dialogue data for training the dialogue generation network and the personality discrimination network is obtained by the following steps:

[0196] S910: For each personality discrimination network, the target response data obtained in the current round is used as the dialogue query data for the next round, and the process of obtaining the target response data is iteratively executed until the convergence condition is met.

[0197] It is understandable that, for example Figure 2 The human-computer dialogue system shown includes multiple personality discrimination networks. To obtain more comprehensive training data, the personality discrimination networks of the human-computer dialogue system can be set as target personality discrimination networks in turn, thereby obtaining training data under each personality discrimination network.

[0198] Taking the personality discrimination network corresponding to "considerateness" as an example, we can first set the target personality of the human-computer dialogue system to "considerateness", and then use the target response data obtained in the current round as the dialogue query data for the next round, and iterate the dialogue process in a loop to obtain dialogue data under the "considerateness" personality.

[0199] In one example, the dialogue data generated by the human-computer dialogue system is shown in Table 1 below:

[0200] Table 1

[0201]

[0202] As shown in Table 1 above, the dialogue response data of each dialogue data is used as the dialogue query data of the next dialogue, so that the process is iterated repeatedly until the convergence condition is met, and multiple dialogue data generated by the system can be obtained.

[0203] It can be understood that the above example is dialogue data generated for the "considerate" personality. By switching the target personality discrimination network to other personality discrimination networks and repeating the above process, dialogue data generated for other personalities can be obtained. These dialogue data can be saved and used for subsequent network training.

[0204] In some implementations, the above-mentioned reinforcement learning process can be executed by a system loop iteration, and complete training data is obtained by switching the target personality determination network of the system.

[0205] In other implementations, the above-mentioned reinforcement learning process can also be achieved by two dialogue systems communicating with each other. Specifically, the dialogue response data generated by system 1 can be used as the dialogue query data of system 2, and the dialogue response data generated by system 2 can be used as the dialogue query data of system 1, and so on and so forth until the convergence condition is met. At the same time, the target personality discrimination networks of the two dialogue systems can also be switched to obtain the full amount of dialogue data.

[0206] It can be understood that both of the above two implementations can achieve the purpose of enhancing learning in the implementation of the present disclosure, and the dialogue between the two dialogue systems is closer to a real-life dialogue scene, which can also relatively improve the reliability of the dialogue data.

[0207] S920: Obtain first training dialogue data according to each set of dialogue inquiry data and target response data generated during the loop iteration process.

[0208] Specifically, the first training dialogue data is training data for training the dialogue generation network. Since the dialogue generation network itself does not focus on personality traits, the dialogue inquiry data and target response data in the aforementioned generated dialogue data can be combined one-to-one to form the first training dialogue data.

[0209] For example, in the example in Table 1, the first training dialogue data that can be generated include: (query: How are you?, response: I am fine, how about you?), (query: I am fine, how about you? response: I am fine.), (query: I am fine. response: What's wrong, can you tell me?)...

[0210] S930, obtaining second training dialogue data according to each group of dialogue inquiry data, target response data, and personality data corresponding to the personality discrimination network generated in the loop iteration process.

[0211] Specifically, the second training dialogue data is the training data for training the personality discrimination network. Since the role of the personality discrimination network is to integrate personality characteristics, the second training dialogue data not only focuses on dialogue inquiry data and target response data, but also needs to pay attention to personality data. Therefore, the dialogue inquiry data, target response data and personality data in the aforementioned dialogue data can be combined one by one to form the second dialogue data.

[0212] For example, in the example in Table 1, the second training dialogue data that can be generated include: (query: How are you?, response: I'm fine, how about you?, personality: considerate), (query: I'm fine, how about you? response: I'm fine., personality: considerate), (query: I'm fine. response: What's wrong, can you tell me?, personality: considerate)...

[0213] From the above, it can be seen that in the embodiments of the present disclosure, the reinforcement learning method is used to enable the system to generate training data by itself, and the training data can be fed back to the current network for training, thereby improving the performance of the human-computer dialogue system and reducing the scale requirements for data collection.

[0214] In a second aspect, the embodiments of the present disclosure provide a dialogue processing device, which can be applied to a terminal device including a human-computer dialogue system to realize a dialogue between a user and a terminal. The terminal device can be, for example, a smart phone, a tablet computer, a smart wearable device, a personal computer, a handheld terminal, etc. The present disclosure does not limit this.

[0215] like Fig.10 As shown, in some implementations, the dialog processing device of the example of the present disclosure includes:

[0216] The acquisition module 101 is configured to acquire dialogue query data, where the dialogue query data includes a query character sequence;

[0217] The first determination module 102 is configured to determine a candidate character set of the current character to be generated based on the query character sequence and the reply character sequence generated before the current character to be generated;

[0218] The second determination module 103 is configured to use the target character determined in the candidate character set as the current character to be generated according to the predetermined target personality characteristics;

[0219] The updating module 104 is configured to update the reply character sequence based on the target character until all characters in the reply character sequence are generated to obtain the target reply data.

[0220] In some implementations, the first determining module 102 is specifically configured to:

[0221] Inputting the query character sequence into a pre-trained dialogue generation network, obtaining candidate characters of the current character to be generated output by the dialogue generation network and a first weight corresponding to each candidate character;

[0222] The first weights are sorted from high to low to determine a candidate character set consisting of candidate characters corresponding to a preset number of first weights.

[0223] In some implementations, the second determining module 103 is specifically configured to:

[0224] For each candidate character in the candidate character set, the candidate character is combined with a reply character sequence generated before the current character to be generated to obtain a candidate sequence;

[0225] Input each candidate sequence into a pre-trained target personality discrimination network to obtain a second weight corresponding to each candidate sequence output by the target personality discrimination network; wherein the target personality discrimination network is a network predetermined by a plurality of personality discrimination networks;

[0226] The first weight corresponding to each candidate character is merged with the second weight to obtain a third weight corresponding to each candidate character;

[0227] According to the third weight, the target character determined in the candidate character set is used as the current character to be generated.

[0228] In some embodiments, the apparatus of the present disclosure further includes a network training module, and the network training module is configured to:

[0229] Acquire first dialogue data, the first dialogue data including dialogue inquiry data, dialogue reply data, and personality data corresponding to the dialogue reply data;

[0230] Inputting the dialogue response data of the first dialogue data into the personality discrimination network to obtain the predicted personality output by the personality discrimination network;

[0231] According to the difference between the predicted personality and the personality data, the network parameters of the personality discrimination network are adjusted until the convergence condition is met.

[0232] In some embodiments, the network training module is configured to:

[0233] Sampling the dialogue reply data of the first dialogue data to obtain incomplete dialogue data including incomplete dialogue reply data;

[0234] Input the incomplete dialogue reply data of the incomplete dialogue data into the personality discrimination network to obtain the predicted personality output by the personality judgment network;

[0235] According to the difference between the predicted personality and the personality data of the incomplete dialogue data, the network parameters of the personality discrimination network are adjusted until the convergence condition is met.

[0236] In some embodiments, the apparatus of the present disclosure further includes a training data acquisition module, and the training data acquisition module is configured to:

[0237] For each personality discrimination network, the target response data obtained in the current round is used as the dialogue query data for the next round, and the process of obtaining the target response data is iterated until the convergence condition is met;

[0238] Obtaining first training dialogue data according to each set of dialogue query data and target response data generated during the loop iteration process;

[0239] The second training dialogue data is obtained according to each set of dialogue inquiry data, target response data and personality data corresponding to the personality discrimination network generated in the loop iteration process.

[0240] From the above, it can be seen that the dialogue processing device of the embodiment of the present disclosure can output reply data corresponding to the target personality by integrating the target personality characteristics, improve the performance of human-computer dialogue, and adopt the universal attributes of personality. Compared with the role attributes such as personality setting, the application scenarios of the human-computer dialogue of the present disclosure are more extensive and more practical. At the same time, when generating the reply character sequence of the target reply data, each reply character is generated one by one based on the target personality characteristics, and the calculation amount of the target reply data is smaller, which improves the efficiency and performance of the human-computer dialogue.

[0241] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:

[0242] Processor; and

[0243] A memory stores computer instructions that can be read by a processor. When the computer instructions are read, the processor executes the method according to any implementation of the first aspect.

[0244] In a fourth aspect, an embodiment of the present disclosure provides a storage medium for storing computer-readable instructions, where the computer-readable instructions are used to enable a computer to execute a method according to any embodiment of the first aspect.

[0245] Fig.11 The structural block diagram of the electronic device in some embodiments of the present disclosure is shown in FIG. Fig.11 The principles related to electronic devices and storage media in some embodiments of the present disclosure are described.

[0246] Reference Fig.11, the electronic device 1800 may include one or more of the following components: a processing component 1802 , a memory 1804 , a power component 1806 , a multimedia component 1808 , an audio component 1810 , an input / output (I / O) interface 1812 , a sensor component 1816 , and a communication component 1818 .

[0247] The processing component 1802 generally controls the overall operation of the electronic device 1800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1802 may include one or more processors 1820 to execute instructions. In addition, the processing component 1802 may include one or more modules to facilitate interaction between the processing component 1802 and other components. For example, the processing component 1802 may include a multimedia module to facilitate interaction between the multimedia component 1808 and the processing component 1802. For another example, the processing component 1802 may read executable instructions from a memory to implement electronic device related functions.

[0248] The memory 1804 is configured to store various types of data to support operations on the electronic device 1800. Examples of such data include instructions for any application or method operating on the electronic device 1800, contact data, phone book data, messages, pictures, videos, etc. The memory 1804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0249] The power supply component 1806 provides power to the various components of the electronic device 1800. The power supply component 1806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1800.

[0250] The multimedia component 1808 includes a display screen that provides an output interface between the electronic device 1800 and the user. In some embodiments, the multimedia component 1808 includes a front camera and / or a rear camera. When the electronic device 1800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0251] The audio component 1810 is configured to output and / or input audio signals. For example, the audio component 1810 includes a microphone (MIC), and when the electronic device 1800 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1804 or sent via the communication component 1818. In some embodiments, the audio component 1810 also includes a speaker for outputting audio signals.

[0252] I / O interface 1812 provides an interface between processing component 1802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0253] The sensor assembly 1816 includes one or more sensors for providing various aspects of status assessment for the electronic device 1800. For example, the sensor assembly 1816 can detect the open / closed state of the electronic device 1800, the relative positioning of components, such as the display and keypad of the electronic device 1800, and the sensor assembly 1816 can also detect the position change of the electronic device 1800 or a component of the electronic device 1800, the presence or absence of user contact with the electronic device 1800, the orientation or acceleration / deceleration of the electronic device 1800, and the temperature change of the electronic device 1800. The sensor assembly 1816 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1816 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1816 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0254] The communication component 1818 is configured to facilitate wired or wireless communication between the electronic device 1800 and other devices. The electronic device 1800 can access a wireless network based on a communication standard, such as Wi-Fi, 2G, 3G, 4G, 5G or 6G, or a combination thereof. In an exemplary embodiment, the communication component 1818 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1818 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0255] In an exemplary embodiment, the electronic device 1800 may be implemented by 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), controllers, microcontrollers, microprocessors, or other electronic components.

[0256] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the embodiments. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.

Claims

1. A method for processing a conversation, characterized in that: include: Acquiring dialogue inquiry data, wherein the dialogue inquiry data includes an inquiry character sequence; Determine a candidate character set of the current character to be generated based on the query character sequence and a reply character sequence generated before the current character to be generated, wherein the candidate character set is generated by the dialogue generation network according to the query character sequence; According to a predetermined target character feature, a target character determined in the candidate character set is used as the current character to be generated, wherein the target character is a response character that meets the target character feature; the target character is determined by inputting each candidate sequence into a pre-trained target character discrimination network and according to a result output by the target character discrimination network, and the candidate sequence is obtained by combining each candidate character in the candidate character set with the response character sequence generated before the current character to be generated; The reply character sequence is updated based on the target character until all characters in the reply character sequence are generated, thereby obtaining target reply data.

2. The method according to claim 1, characterized in that The step of determining a candidate character set of the current character to be generated based on the query character sequence and a reply character sequence generated before the current character to be generated includes: Inputting the query character sequence into a pre-trained dialogue generation network, obtaining candidate characters of the current character to be generated output by the dialogue generation network and first weights corresponding to the candidate characters; The first weights are sorted from high to low to determine the candidate character set consisting of candidate characters corresponding to a preset number of the first weights.

3. The method according to claim 2, characterized in that The step of taking the target character determined in the candidate character set as the current character to be generated according to the predetermined target personality feature includes: For each candidate character in the candidate character set, combine the candidate character with the reply character sequence generated before the current character to be generated to obtain a candidate sequence; Input each of the candidate sequences into a pre-trained target personality discrimination network to obtain a second weight corresponding to each of the candidate sequences output by the target personality discrimination network; wherein the target personality discrimination network is a network pre-determined from a plurality of personality discrimination networks; The first weight corresponding to each candidate character is merged with the second weight to obtain a third weight corresponding to each candidate character; According to the third weight, the target character determined in the candidate character set is used as the current character to be generated.

4. The method according to any one of claims 1 to 3, characterized in that: The step of generating all characters in the reply character sequence to obtain target reply data includes: In response to detecting that the current character to be generated includes a terminator, it is determined that all characters in the reply character sequence are generated, and target reply data is obtained.

5. The method according to claim 3, characterized in that: The training process of each personality discrimination network is as follows: Acquire first dialogue data, the first dialogue data including dialogue inquiry data, dialogue reply data, and personality data corresponding to the dialogue reply data; Inputting the dialogue response data of the first dialogue data into the personality discrimination network to obtain the predicted personality output by the personality discrimination network; According to the difference between the predicted personality and the personality data, the network parameters of the personality discrimination network are adjusted until a convergence condition is met.

6. The method according to claim 5, characterized in that The training process of each personality discrimination network further includes: Sampling the dialogue reply data of the first dialogue data to obtain incomplete dialogue data including incomplete dialogue reply data; Inputting the incomplete dialogue reply data contained in the incomplete dialogue data into the personality discrimination network to obtain the predicted personality output by the personality judgment network; According to the difference between the predicted personality and the personality data of the incomplete dialogue data, the network parameters of the personality discrimination network are adjusted until a convergence condition is met.

7. The method according to claim 3, characterized in that The training dialogue data for training the dialogue generation network and / or the personality discrimination network is obtained by the following steps: For each personality discrimination network, the target response data obtained in the current round is used as the dialogue query data for the next round, and the process of obtaining the target response data is iterated until the convergence condition is met; Obtaining first training dialogue data according to each group of the dialogue inquiry data and the target response data generated in the loop iteration process; The second training dialogue data is obtained according to each group of the dialogue inquiry data, the target response data and the personality data corresponding to the personality discrimination network generated in the loop iteration process.

8. A dialogue processing device, characterized in that: include: An acquisition module is configured to acquire dialogue inquiry data, wherein the dialogue inquiry data includes an inquiry character sequence; A first determination module is configured to determine a candidate character set of the current character to be generated based on the query character sequence and a reply character sequence generated before the current character to be generated, wherein the candidate character set is generated by the dialogue generation network according to the query character sequence; The second determination module is configured to use a target character determined in the candidate character set as the current character to be generated according to a predetermined target character feature, wherein the target character is a response character that meets the target character feature; the target character is determined by inputting each candidate sequence into a pre-trained target character discrimination network and according to a result output by the target character discrimination network, and the candidate sequence is obtained by combining each candidate character in the candidate character set with the response character sequence generated before the current character to be generated; The updating module is configured to update the reply character sequence based on the target character until all characters in the reply character sequence are generated to obtain target reply data.

9. The device according to claim 8, characterized in that The first determining module is specifically configured as follows: Inputting the query character sequence into a pre-trained dialogue generation network, obtaining candidate characters of the current character to be generated output by the dialogue generation network and first weights corresponding to the candidate characters; The first weights are sorted from high to low to determine the candidate character set consisting of candidate characters corresponding to a preset number of the first weights.

10. The device according to claim 9, characterized in that The second determining module is specifically configured as follows: For each candidate character in the candidate character set, combine the candidate character with the reply character sequence generated before the current character to be generated to obtain a candidate sequence; Input each of the candidate sequences into a pre-trained target personality discrimination network to obtain a second weight corresponding to each of the candidate sequences output by the target personality discrimination network; wherein the target personality discrimination network is a network pre-determined from a plurality of personality discrimination networks; The first weight corresponding to each candidate character is merged with the second weight to obtain a third weight corresponding to each candidate character; According to the third weight, the target character determined in the candidate character set is used as the current character to be generated.

11. The device according to claim 10, characterized in that It also includes a network training module, wherein the network training module is configured to: Acquire first dialogue data, the first dialogue data including dialogue inquiry data, dialogue reply data, and personality data corresponding to the dialogue reply data; Inputting the dialogue response data of the first dialogue data into the personality discrimination network to obtain the predicted personality output by the personality discrimination network; According to the difference between the predicted personality and the personality data, the network parameters of the personality discrimination network are adjusted until a convergence condition is met.

12. The device according to claim 11, characterized in that The network training module is configured as follows: Sampling the dialogue reply data of the first dialogue data to obtain incomplete dialogue data including incomplete dialogue reply data; Inputting the incomplete dialogue reply data contained in the incomplete dialogue data into the personality discrimination network to obtain the predicted personality output by the personality judgment network; According to the difference between the predicted personality and the personality data of the incomplete dialogue data, the network parameters of the personality discrimination network are adjusted until a convergence condition is met.

13. The device according to claim 10, characterized in that It also includes a training data acquisition module, which is configured to: For each personality discrimination network, the target response data obtained in the current round is used as the dialogue query data for the next round, and the process of obtaining the target response data is iterated until the convergence condition is met; Obtaining first training dialogue data according to each group of the dialogue inquiry data and the target response data generated in the loop iteration process; The second training dialogue data is obtained according to each group of the dialogue inquiry data, the target response data and the personality data corresponding to the personality discrimination network generated in the loop iteration process.

14. An electronic device, characterized in that: include: processor; and A memory storing computer instructions that can be read by the processor, and when the computer instructions are read, the processor executes the method according to any one of claims 1 to 7.

15. A storage medium, characterized in that: Used to store computer-readable instructions, wherein the computer-readable instructions are used to make a computer execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Intelligent interaction method and device

    CN110187760A

  • Automatic dialogue generation method and system based on combination of emotion and cue word

    CN112765333A