Conversation method and device, storage medium, electronic equipment and program product

By obtaining dialogue text and determining dialogue intention information, obtaining reply templates from the preset template library, and combining the template to generate target reply text, it solves the problem of difficult to improve customer service response efficiency, accuracy and speech standardization, and achieves efficient and accurate replies.

CN119691104APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD

Patent Information

Application Number
CN202411586970.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In complex business scenarios, customer service response efficiency, accuracy and speech standardization are difficult to improve, and the existing technology has high costs, model illusions and data quality problems.

Method used

By obtaining the conversation text, determining the conversation intention information, and obtaining the corresponding reply template from the preset template library, the target reply text is generated by combining the first reply template and the second reply template.

Benefits of technology

It improves the accuracy and standardization of customer service responses, reduces the cost of manual customer service, improves the response efficiency, and avoids the problem of model illusion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691104A_ABST
    Figure CN119691104A_ABST
Patent Text Reader

Abstract

The invention relates to a dialogue method and device, a storage medium, electronic equipment and a program product, and relates to the technical field of electronic information.The method comprises the steps that a first round of dialogue text and a second round of question text are obtained; obtaining a first reply template corresponding to the question text of the second round; determining dialogue intention information of the second round according to the question text of the second round and the dialogue text of the first round; obtaining a second reply template corresponding to the dialogue intention information from a preset template library according to the dialogue intention information; and determining a target reply text corresponding to the second round of question text according to the first reply template and the second reply template. Therefore, the final target reply text is obtained by combining the first reply template and the second reply template corresponding to the question text of the second round, and the accuracy and normalization of reply can be further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of electronic information technology, and in particular, to a conversation method, device, storage medium, electronic device and program product. Background Art

[0002] With the continuous development of electronic information technology, users can consult relevant business through the customer service of online platforms, and the customer service will respond to the questions raised by users. In view of the complex business scenarios and the increasing number of businesses, how to improve the efficiency, accuracy and standardization of customer service response has become a crucial issue in customer service dialogue scenarios. Summary of the invention

[0003] The purpose of the present disclosure is to provide a method, device, storage medium, electronic device and program product for dialogue, so as to improve the efficiency, accuracy and standardization of customer service response.

[0004] According to a first aspect of an embodiment of the present disclosure, a method for dialogue is provided, the method comprising:

[0005] Obtain the conversation text of the first round and the question text of the second round;

[0006] Obtain a first response template corresponding to the question text of the second round;

[0007] Determining the conversation intention information of the second round according to the question text of the second round and the conversation text of the first round;

[0008] According to the conversation intention information, obtaining a second reply template corresponding to the conversation intention information from a preset template library;

[0009] A target response text corresponding to the question text of the second round is determined according to the first response template and the second response template.

[0010] Optionally, the preset template library includes a plurality of dialogue templates and a plurality of template intention information, each of the template intention information corresponds to at least one dialogue template; and obtaining, according to the dialogue intention information, from the preset template library a second reply template corresponding to the dialogue intention information includes:

[0011] Determining first template intention information matching the conversation intention information;

[0012] Determine a first dialogue template corresponding to the first template intention information;

[0013] The second reply template is determined according to the first dialogue template.

[0014] Optionally, the first dialogue template includes a first round dialogue template and a second round dialogue template; the first round dialogue template includes a first question template and a third reply template, and the second round dialogue template includes a second question template and a fourth reply template; the first round dialogue text includes a first round question text and a first round reply text, and determining the second reply template according to the first dialogue template includes:

[0015] Determining a first similarity between the third reply template and the reply text of the first round;

[0016] Determining a target dialogue template from the first dialogue templates according to the first similarity;

[0017] The fourth reply template in the target dialogue template is used as the second reply template.

[0018] Optionally, determining a target dialogue template from the first dialogue templates according to the first similarity includes:

[0019] Using a first similarity greater than or equal to a first preset threshold as a first target similarity; using a third reply template corresponding to the first target similarity as a fifth reply template; and using a first dialogue template to which the fifth reply template belongs as the target dialogue template; or

[0020] When the first similarities are arranged in descending order, the first preset number of similarities are used as the second target similarities; the third reply template corresponding to the second target similarity is used as the sixth reply template; and the first dialogue template to which the sixth reply template belongs is used as the target dialogue template.

[0021] Optionally, determining the target response text corresponding to the question text of the second round according to the first response template and the second response template includes:

[0022] Determining a target reply template from the second reply template according to the first reply template;

[0023] Acquiring target information according to the target response template;

[0024] The target reply text is output according to the target reply template and the target information.

[0025] Optionally, determining a target reply template from the second reply template according to the first reply template includes:

[0026] determining a second similarity between the first reply template and the second reply template;

[0027] The second reply template corresponding to the largest second similarity is used as the seventh reply template;

[0028] In response to the second similarity of the seventh reply template being greater than or equal to a second preset threshold, the seventh reply template is used as the target reply template.

[0029] Optionally, the method further comprises:

[0030] In response to the second similarity of the seventh reply template being less than the second preset threshold, acquiring the remaining dialogue templates except the target dialogue template from the first dialogue templates;

[0031] Using the fourth reply template corresponding to the remaining dialogue templates as the eighth reply template;

[0032] The target reply template is determined according to the first reply template, the seventh reply template and the eighth reply template.

[0033] Optionally, determining the target reply template according to the first reply template, the seventh reply template and the eighth reply template includes:

[0034] determining a third similarity between the first reply template and the eighth reply template;

[0035] Using the eighth reply template corresponding to the largest third similarity as the ninth reply template;

[0036] When the second similarity corresponding to the seventh reply template is greater than the third similarity corresponding to the ninth reply template, the seventh reply template is used as the target reply template.

[0037] Optionally, the dialogue intention information includes a first dialogue intention corresponding to the question text of the second round and a first intention parameter corresponding to the first dialogue intention; the first intention parameter is used to characterize the probability that the question text of the second round belongs to the first dialogue intention; the template intention information includes a template intention and a template intention parameter corresponding to the dialogue template; the method further includes:

[0038] When the second similarity corresponding to the seventh reply template is less than or equal to the third similarity corresponding to the ninth reply template, obtaining the first template intention parameter corresponding to the seventh reply template and the second template intention parameter corresponding to the ninth reply template from the template intention parameter;

[0039] The target reply template is determined from the seventh reply template and the ninth reply template according to the first intention parameter, the first template intention parameter and the second template intention parameter.

[0040] Optionally, determining the target reply template from the seventh reply template and the ninth reply template according to the first intention parameter, the first template intention parameter, and the second template intention parameter comprises:

[0041] Determining a first parameter difference between the first template intention parameter and the first intention parameter, and a second parameter difference between the second template intention parameter and the first intention parameter;

[0042] The minimum value between the first parameter difference and the second parameter difference is taken as the target parameter difference;

[0043] Using the response template corresponding to the target parameter difference as the target response template;

[0044] Wherein, when the target parameter difference includes the first parameter difference, the target response template includes the seventh response template; when the target parameter difference includes the second parameter difference, the target response template includes the ninth response template.

[0045] Optionally, the preset template library is pre-built in the following manner:

[0046] Acquire a plurality of dialogue sample data, each of the dialogue sample data comprising a first round dialogue sample and a second round dialogue sample;

[0047] For each of the conversation sample data, determining sample intent information corresponding to the conversation sample data;

[0048] Determining target dialogue sample data from the plurality of dialogue sample data according to the sample intention information;

[0049] Using the target dialogue sample data as a dialogue template, and using the sample intent information corresponding to the target dialogue sample data as template intent information;

[0050] The preset template library is constructed according to the dialogue template and the template intention information.

[0051] Optionally, determining target dialogue sample data from the plurality of dialogue sample data according to the sample intention information comprises:

[0052] For each sample intention information, clustering the plurality of the conversation sample data corresponding to the sample intention information to obtain a plurality of sample clusters; each sample cluster includes at least one conversation sample data;

[0053] The target conversation sample data is determined from the plurality of conversation sample data according to the plurality of sample clusters.

[0054] Optionally, the determining the target conversation sample data from the plurality of conversation sample data according to the plurality of sample clusters comprises:

[0055] Determine the sample cluster centers corresponding to the multiple sample clusters;

[0056] The conversation sample data corresponding to the sample cluster center is used as the target conversation sample data.

[0057] Optionally, the determining the target conversation sample data from the plurality of conversation sample data according to the plurality of sample clusters comprises:

[0058] Determine the sample cluster centers corresponding to the multiple sample clusters;

[0059] Determine a target distance between each of the sample clusters and the sample cluster center;

[0060] According to the target distance, determining the target ratio corresponding to each sample cluster;

[0061] For each of the sample clusters, corresponding conversation sample data is obtained from the sample cluster according to the target ratio corresponding to the sample cluster, as the target conversation sample data.

[0062] According to a second aspect of an embodiment of the present disclosure, a device for a conversation is provided, the device comprising:

[0063] A first acquisition module is configured to acquire a first round of dialogue text and a second round of question text;

[0064] A second acquisition module is configured to acquire a first reply template corresponding to the question text of the second round;

[0065] A determination module, configured to determine the conversation intention information of the second round according to the question text of the second round and the conversation text of the first round;

[0066] A third acquisition module is configured to acquire, according to the conversation intention information, a second reply template corresponding to the conversation intention information from a preset template library;

[0067] The output module is configured to determine a target response text corresponding to the question text of the second round according to the first response template and the second response template.

[0068] Optionally, the preset template library includes multiple dialogue templates and multiple template intent information, each template intent information corresponds to at least one dialogue template; the third acquisition module is configured to determine the first template intent information that matches the dialogue intention information; determine the first dialogue template corresponding to the first template intent information; and determine the second reply template based on the first dialogue template.

[0069] Optionally, the first dialogue template includes a first-round dialogue template and a second-round dialogue template; the first-round dialogue template includes a first question template and a third reply template, and the second-round dialogue template includes a second question template and a fourth reply template; the first-round dialogue text includes the first-round question text and the first-round reply text, and the third acquisition module is configured to determine a first similarity between the third reply template and the first-round reply text; determine a target dialogue template from the first dialogue template based on the first similarity; and use the fourth reply template in the target dialogue template as the second reply template.

[0070] Optionally, the third acquisition module is configured to take a first similarity greater than or equal to a first preset threshold as a first target similarity; and take a third reply template corresponding to the first target similarity as a fifth reply template; and take the first dialogue template to which the fifth reply template belongs as the target dialogue template; or, when the first similarities are arranged in order from large to small, take the first preset number of similarities as the second target similarity; and take the third reply template corresponding to the second target similarity as a sixth reply template; and take the first dialogue template to which the sixth reply template belongs as the target dialogue template.

[0071] Optionally, the output module is configured to determine a target reply template from the second reply template according to the first reply template; obtain target information according to the target reply template; and output the target reply text according to the target reply template and the target information.

[0072] Optionally, the output module is configured to determine the second similarity between the first reply template and the second reply template; use the second reply template corresponding to the largest second similarity as the seventh reply template; and in response to the second similarity of the seventh reply template being greater than or equal to a second preset threshold, use the seventh reply template as the target reply template.

[0073] Optionally, the output module is also configured to, in response to the second similarity of the seventh reply template being less than the second preset threshold, obtain the remaining dialogue templates except the target dialogue template from the first dialogue template; use the fourth reply template corresponding to the remaining dialogue templates as the eighth reply template; and determine the target reply template based on the first reply template, the seventh reply template and the eighth reply template.

[0074] Optionally, the output module is configured to determine the third similarity between the first reply template and the eighth reply template; use the eighth reply template corresponding to the largest third similarity as the ninth reply template; and use the seventh reply template as the target reply template when the second similarity corresponding to the seventh reply template is greater than the third similarity corresponding to the ninth reply template.

[0075] Optionally, the dialogue intention information includes a first dialogue intention corresponding to the question text of the second round and a first intention parameter corresponding to the first dialogue intention; the first intention parameter is used to characterize the probability that the question text of the second round belongs to the first dialogue intention; the template intention information includes a template intention and a template intention parameter corresponding to the dialogue template; the output module is also configured to obtain, when the second similarity corresponding to the seventh reply template is less than or equal to the third similarity corresponding to the ninth reply template, the first template intention parameter corresponding to the seventh reply template and the second template intention parameter corresponding to the ninth reply template from the template intention parameter; and determine the target reply template from the seventh reply template and the ninth reply template according to the first intention parameter, the first template intention parameter and the second template intention parameter.

[0076] Optionally, the output module is configured to determine a first parameter difference between the first template intention parameter and the first intention parameter, and a second parameter difference between the second template intention parameter and the first intention parameter; take the minimum value of the first parameter difference and the second parameter difference as the target parameter difference; take the reply template corresponding to the target parameter difference as the target reply template; wherein, when the target parameter difference includes the first parameter difference, the target reply template includes the seventh reply template; when the target parameter difference includes the second parameter difference, the target reply template includes the ninth reply template.

[0077] Optionally, the preset template library is pre-built in the following manner:

[0078] Acquire a plurality of dialogue sample data, each of the dialogue sample data comprising a first round dialogue sample and a second round dialogue sample;

[0079] For each of the conversation sample data, determining sample intent information corresponding to the conversation sample data;

[0080] Determining target dialogue sample data from the plurality of dialogue sample data according to the sample intention information;

[0081] Using the target dialogue sample data as a dialogue template, and using the sample intent information corresponding to the target dialogue sample data as template intent information;

[0082] The preset template library is constructed according to the dialogue template and the template intention information.

[0083] Optionally, determining target dialogue sample data from the plurality of dialogue sample data according to the sample intention information comprises:

[0084] For each sample intention information, clustering the plurality of the conversation sample data corresponding to the sample intention information to obtain a plurality of sample clusters; each sample cluster includes at least one conversation sample data;

[0085] The target conversation sample data is determined from the plurality of conversation sample data according to the plurality of sample clusters.

[0086] Optionally, the determining the target conversation sample data from the plurality of conversation sample data according to the plurality of sample clusters comprises:

[0087] Determine the sample cluster centers corresponding to the multiple sample clusters;

[0088] The conversation sample data corresponding to the sample cluster center is used as the target conversation sample data.

[0089] Optionally, the determining the target conversation sample data from the plurality of conversation sample data according to the plurality of sample clusters comprises:

[0090] Determine the sample cluster centers corresponding to the multiple sample clusters;

[0091] Determine a target distance between each of the sample clusters and the sample cluster center;

[0092] According to the target distance, determining the target ratio corresponding to each sample cluster;

[0093] For each of the sample clusters, corresponding conversation sample data is obtained from the sample cluster according to the target ratio corresponding to the sample cluster, as the target conversation sample data.

[0094] According to a third aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the dialogue method provided by the first aspect of the present disclosure are implemented.

[0095] According to a fourth aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0096] a memory having a computer program stored thereon;

[0097] A processor is used to execute the computer program in the memory to implement the steps of the dialogue method provided in the first aspect of the present disclosure.

[0098] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the dialogue method provided in the first aspect of the present disclosure.

[0099] Through the above technical solution, first, the conversation text of the first round and the question text of the second round are obtained, and the first reply template corresponding to the question text of the second round is obtained; secondly, the conversation intention information of the second round is determined according to the question text of the second round and the conversation text of the first round; then, according to the conversation intention information, the second reply template corresponding to the conversation intention information is obtained from the preset template library; finally, according to the first reply template and the second reply template, the target reply text corresponding to the question text of the second round is determined. In this way, on the one hand, by determining the conversation intention information of the second round and screening the second reply template corresponding to the conversation intention information from the preset template library, the accuracy of the subsequent determination of the target reply text is improved, and the reply can be made more accurately for the conversation intention of the second round. On the other hand, by combining the first reply template and the second reply template corresponding to the question text of the second round, the final target reply text is obtained, which can further improve the accuracy and standardization of the reply. At the same time, the target reply text can be quickly generated with only a small amount of data analysis, which improves the efficiency of the reply.

[0100] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0101] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0102] Figure 1 It is a schematic diagram showing an application scenario according to an exemplary embodiment.

[0103] Figure 2 It is a schematic diagram of an application environment according to an exemplary embodiment.

[0104] Figure 3 The present invention is a flowchart of a dialog method according to an exemplary embodiment.

[0105] Figure 4 The figure is a flowchart of another dialog method according to an exemplary embodiment.

[0106] Figure 5 The figure is a flowchart of another dialog method according to an exemplary embodiment.

[0107] Figure 6 It is a flow chart of a method for constructing a preset template library according to an exemplary embodiment.

[0108] Figure 7 The present invention is a flowchart of a dialog method according to an exemplary embodiment.

[0109] Figure 8 The present invention is a flowchart of a dialog method according to an exemplary embodiment.

[0110] Fig. 9 The invention is a block diagram of a conversation device according to an exemplary embodiment.

[0111] Fig.10 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0112] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0113] The terms "first", "second", etc. in the specification and claims of this application and the above drawings are used to distinguish similar objects and do not have to be understood as a specific order or sequence. In addition, in the description with reference to the drawings, the same symbols in different drawings represent the same elements.

[0114] In the description of the present disclosure, unless otherwise specified, "multiple" means two or more than two, and other quantifiers are similar thereto; "at least one item", "one item or multiple items" or similar expressions refer to any combination of these items, including any combination of single items or plural items. For example, at least one item a can represent any number of a; for another example, one item or multiple items among a, b and c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple; "and / or" is a kind of description of the association relationship of associated objects, indicating that there can be three kinds of relationships, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " indicates that the associated objects before and after are in an "or" relationship.

[0115] Although operations or steps are described in a specific order in the drawings in the embodiments of the present disclosure, it should not be understood that it is required to perform these operations or steps in the specific order shown or in a serial order, or to perform all the operations or steps shown to obtain the desired results. In the embodiments of the present disclosure, these operations or steps can be performed in series; these operations or steps can also be performed in parallel; or some of these operations or steps can be performed.

[0116] The present disclosure can be applied in the scenario of dialogue between users and customer service. Users can communicate with customer service online through an online platform to obtain information about related businesses. In the financial field, since the financial field often covers rich and complex business scenarios, business consulting services are currently mostly provided to users through manual customer service. On the one hand, not only does it require customer service to be very familiar with all businesses, but it also needs to be in the best condition at all times to provide the best service, but it is difficult to maintain human energy, resulting in fewer excellent customer service in business services. On the other hand, it takes a lot of time and energy to cultivate excellent customer service. As the business continues to increase, customer service personnel also need to continue to increase. Therefore, relying solely on traditional manual customer service services requires too much cost.

[0117] With the continuous development of large language models, intelligent customer service based on large language models (for example, generative dialogue large models) has achieved good results and can handle some simple business scenarios. Due to the limited number of samples in the model training process, it is impossible to cover all user information, and there is a certain amount of dirty data in the samples, which will cause the model itself to be unable to accurately determine user information (user information such as name, mobile phone number, bank card number, contract information, loan information, etc.). In the application process, when it comes to specific user information or the number of dialogue rounds increases, the content of the reply may be inconsistent. In other words, it is easy to produce model hallucinations, which in turn leads to inaccurate customer service answers, poor user experience, and increased complaint rates.

[0118] In some related technologies, in order to improve the accuracy of the model output sentences, the user information in the customer service sentences generated by the model is extracted and compared and corrected with the preset user information. Alternatively, a certain amount of reply templates are manually set, and then the customer service sentences generated by the model are replaced by simply comparing the similarity between the customer service sentences generated by the model and the sentences in the template. However, the inventors have found in long-term practice that in the first method, the comparison and correction of user information is mainly carried out through keyword + rule matching detection. Since there are many actual business scenarios and each sub-business scenario involves a lot of information, it is difficult to cover all application scenarios even if very complex rules are set. In the second method, on the one hand, manually setting the reply template consumes a lot of manpower costs, and with the continuous increase and change of business scenarios, the maintenance of the reply template is more difficult. On the other hand, only by simply comparing the similarity between the customer service sentences generated by the model and the sentences in the template, if the customer service sentences generated by the model are wrong, the final screened template will also be wrong, which will lead to inaccurate customer service answers.

[0119] In order to solve the above technical problems, the present invention provides a method, device, storage medium, electronic device and program product for dialogue. On the one hand, it can determine the dialogue intention information of the second round and screen the second reply template corresponding to the dialogue intention information from the preset template library, thereby improving the accuracy of the subsequent determination of the target reply text, and can more accurately reply to the dialogue intention of the second round. On the other hand, by combining the first reply template and the second reply template corresponding to the question text of the second round, the final target reply text is obtained, which can further improve the accuracy and standardization of the reply. At the same time, the target reply text can be quickly generated through only less data analysis, which improves the efficiency of the reply.

[0120] The following is a brief description of the application scenarios of the solutions provided in the embodiments of the present application. Figure 1As shown, the conversation method provided in the embodiment of the present disclosure can be applied to the scenario where a user is having a conversation with a customer service representative. In this scenario, the solution provided by the present disclosure mainly includes the following three sections:

[0121] 1. Input

[0122] The user can input the question text. The user can generate the question text by text input or voice input. If the user inputs by voice, the voice can be recognized first and converted into corresponding text, and the text is used as the question text.

[0123] 2. Model Reasoning

[0124] On the one hand, the first target model (for example, an intention recognition model) can be used to perform intention recognition on the question text of the current round and the conversation text of the previous round to obtain the conversation intention information of the current round of users. And obtain the second reply template corresponding to the conversation intention information from the preset template library, where the conversation intention information can correspond to one or more second reply templates. On the other hand, the question text of the current round and the historical conversation text corresponding to the user can be input into the second target model (for example, a generative conversation large model) to obtain the corresponding first reply template. Afterwards, the target reply template is determined by combining the first reply template and the second reply template.

[0125] (III) Output

[0126] According to the target reply template, the target information corresponding to the user is obtained, and the target information is filled into the corresponding position in the target reply template (i.e., the semantic slot of the template), the target reply text is obtained, and output to the user, that is, the user's current question text is replied, and a round of dialogue is completed.

[0127] In order to better understand the conversation method, device, storage medium, electronic device and program product provided in the embodiments of the present application, the application environment applicable to the embodiments of the present application is briefly described below.

[0128] See also Figure 2 , Figure 2 A schematic diagram of an application environment of the method for dialogue provided by an embodiment of the present application is shown. As an implementation mode, the method, device, storage medium, electronic device and program product provided by the embodiment of the present application can be applied to an electronic device. The electronic device can be as follows: Figure 2The server 110 shown in the figure can be connected to the terminal device 120 through a network. The network is used to provide a medium for a communication link between the server 110 and the terminal device 120. The network can include various connection types, such as a wired communication link, a wireless communication link, etc., which are not limited in the embodiments of the present application. Optionally, in other embodiments, the electronic device can also be a smart phone, a laptop computer, etc.

[0129] It should be understood that Figure 2 The server 110, network and terminal device 120 are merely illustrative. Depending on the implementation requirements, there may be any number of servers, networks and terminal devices. For example, the server 110 may be a physical server or a server cluster composed of multiple servers, and the terminal device 120 may be a mobile phone, a tablet, a desktop computer, a laptop computer, and the like. It is understood that the embodiments of the present application may also allow multiple terminal devices 120 to access the server 110 at the same time.

[0130] In some embodiments, the terminal device 120 can record the user's voice, obtain the user's audio data and convert it into a corresponding question text. Further, the terminal device 120 sends the user's question text to the server 110 through the network. After the server 110 receives the user's question text, it can process the question text through the dialogue method described in the embodiment of the present application to output the target reply text corresponding to the question text.

[0131] The specific implementation modes of the present invention are described in detail below with reference to the accompanying drawings.

[0132] Figure 3 is a flow chart of a method for dialogue according to an exemplary embodiment. Figure 3 As shown, the method may include the following steps:

[0133] In step S201, the dialogue text of the first round and the question text of the second round are obtained.

[0134] The question text of the second round can be generated by the user through text input, or can be generated by the user's voice input and converted into corresponding text through voice recognition. The user can input the question text through the terminal device. It should be noted that in this embodiment, the question text of the second round can be understood as the question text input by the user in the current round, and the conversation text of the first round can be understood as the conversation text corresponding to the user in the previous round of conversation before the second round. In other words, the first round in this embodiment does not mean that there is only one round of conversation before the second round, but is to distinguish between two rounds of conversation. The conversation text of the first round can include the question text of the first round and the reply text of the first round.

[0135] In step S202, a first reply template corresponding to the second round of question text is obtained.

[0136] Among them, the first reply template can be generated by the second target model. The second target model can be, for example, a generative dialogue model, which can be pre-trained by a training method in related technologies and is used to generate a reply template corresponding to the input question text.

[0137] Specifically, in one application scenario, the second round of question text and the first round of dialogue text may be input into the second target model, and the second target model may output a first response template corresponding to the second round of question text.

[0138] In another application scenario, in order to improve the accuracy of the model output, the second round of question text and multiple rounds of historical conversation text before the second round of question text can also be input into the second target model to obtain the first response template corresponding to the second round of question text output by the second target model.

[0139] In another application scenario, in order to further improve the accuracy of the model output, the scene label corresponding to the current conversation can also be obtained, and the scene label can be input or selected by the user through the terminal device. It is understandable that in actual scenarios, when a user consults a certain business in a conversation, it often goes through multiple rounds of conversations. When the user initiates a conversation, the user can be asked to enter or select the scene label of the current conversation to more accurately determine the conversation scene of the current user. The historical conversation text before the second round of question text and the scene label corresponding to the current conversation can be obtained first, and the second round of question text, the historical conversation text and the scene label are input into the pre-trained second target model to obtain the first reply template corresponding to the second round of question text output by the second target model.

[0140] According to the above analysis, the incompleteness of the model in the training samples leads to the inability of the model to well identify similar user information, which in turn leads to the model hallucination. Therefore, in this embodiment, in order to ensure the accuracy of the final reply to the user, the first reply template output by the second target model is used as the subsequent reference reply template, rather than directly using the first reply template as the target reply template for replying.

[0141] In step S203, the conversation intention information of the second round is determined according to the question text of the second round and the conversation text of the first round.

[0142] In some embodiments, the conversation intention information corresponding to the user in the second round can be obtained by performing intent recognition on the question text of the second round and the question text of the first round in the conversation text of the first round. Specifically, the question text of the second round and the question text of the first round can be input into a pre-trained first target model to obtain the conversation intention information of the second round output by the first target model. The first target model can be, for example, an intent recognition model in the related art, which can be pre-trained by a training method in the related art.

[0143] The conversation intention information may include the first conversation intention corresponding to the second round of question text and the first intention parameter corresponding to the first conversation intention, as well as the second conversation intention corresponding to the first round of question text and the second intention parameter corresponding to the second conversation intention. The intention parameter is used to characterize the probability that the current question text belongs to the conversation intention. For example, the first intention parameter is used to characterize the probability that the second round of question text belongs to the first conversation intention; the second intention parameter is used to characterize the probability that the first round of question text belongs to the second conversation intention. The larger the value of the intention parameter, the greater the probability of belonging to the conversation intention.

[0144] For example, the question text of the first round and the question text of the second round can be input into the first target model respectively, and the first dialogue intention and the first intention parameter corresponding to the question text of the second round and the second dialogue intention and the second intention parameter corresponding to the question text of the first round output by the first target model are obtained. And according to the first dialogue intention, the first intention parameter, the second dialogue intention and the second intention parameter, the dialogue intention information is combined. For example, it can be combined in the form of "first dialogue intention#second dialogue intention&first intention parameter#second intention parameter", and it can also be combined in the form of "first dialogue intention#first intention parameter&second dialogue intention#second intention parameter". The above examples are only for illustration, and the present disclosure is not limited to this.

[0145] In step S204, according to the conversation intention information, a second reply template corresponding to the conversation intention information is obtained from a preset template library.

[0146] The preset template library includes multiple pre-set dialogue templates and multiple template intent information, and each template intent information corresponds to at least one dialogue template. Each dialogue template may include two rounds of dialogue. For example, the dialogue template includes "user 1#customer service 1#user 2#customer service 2", where user 1 and user 2 represent the question texts of the first and second rounds of users, and customer service 1 and customer service 2 represent the reply texts of the first and second rounds of customer service.

[0147] In this step, the conversation intention information can be matched with the template intention information, and the successfully matched template intention information is used as the first template intention information. Afterwards, according to the first template intention information, the corresponding first conversation template is determined from multiple conversation templates in the preset template library. And according to the first conversation template, the second reply template is determined. Among them, one or more second reply templates may be included.

[0148] In step S205, a target reply text corresponding to the second round of question text is output according to the first reply template and the second reply template.

[0149] In some embodiments, first, a target reply template can be determined from the second reply template according to the first reply template. The target reply template is provided with a target slot related to user information, so it is also necessary to obtain the target information corresponding to the target slot according to the target reply template. And the target reply text is output according to the target reply template and the target information.

[0150] In this way, by identifying the user's conversation intention information, the second reply template can be quickly obtained from the preset template library according to the conversation intention information, and used as the basis for matching with the first reply template generated by the second target model, thereby improving the accuracy of the matching. Moreover, based on the first reply template, the target reply template is determined from the second reply template. In this embodiment, the first reply template output by the second target model is not used as the final target reply template, but as the basis for template matching, which makes full use of the results output by the second target model, avoids the problem of hallucination generated by the second target model, and ensures the accuracy of the customer service reply.

[0151] By adopting the above method, on the one hand, the second round of conversation intention information can be determined, and the second reply template corresponding to the conversation intention information can be screened from the preset template library, thereby improving the accuracy of the subsequent determination of the target reply text, and being able to more accurately reply to the second round of conversation intention. On the other hand, by combining the first reply template and the second reply template corresponding to the second round of question text, the final target reply text is obtained, which can further improve the accuracy and standardization of the reply. At the same time, the target reply text can be quickly generated with only a small amount of data analysis, which improves the efficiency of the reply.

[0152] The above step S204 is described in detail below. Figure 4 As shown, in the above step S204, obtaining the second reply template corresponding to the conversation intention information from the preset template library according to the conversation intention information may include the following steps:

[0153] In step S2041, first template intention information matching the dialogue intention information is determined.

[0154] For example, the template intention information includes template intentions corresponding to two rounds of dialogue, for example, it may include a first template intention and a second template intention, wherein the first template intention and the second template intention respectively represent the template intentions corresponding to the first round of dialogue and the second round of dialogue in the dialogue template. When performing intention matching, the intentions corresponding to the two rounds of dialogue can be regarded as a whole for matching, that is, the first dialogue intention and the second dialogue intention included in the dialogue intention information are matched with the first template intention and the second template intention included in each template intention information. For example, the "first dialogue intention # second dialogue intention" in the dialogue intention information can be matched with the "first template intention # second template intention" in each template intention information. If there is a one-to-one corresponding identical intention, it is determined that the match is successful, that is, if the first dialogue intention is the same as the first template intention, and the second dialogue intention is the same as the second template intention, it is considered that the match is successful. At this time, the template intention information that has been successfully matched can be used as the first template intention information.

[0155] In step S2042, a first dialogue template corresponding to the first template intention information is determined.

[0156] In this step, a dialogue template corresponding to the first template intention information can be obtained from the preset template library as the first dialogue template. Since each template intention information in the preset template library corresponds to at least one dialogue template, the first template intention information corresponds to at least one first dialogue template.

[0157] In step S2043, the second reply template is determined according to the first dialogue template.

[0158] In some embodiments, each first dialogue template includes a first round dialogue template and a second round dialogue template, and the second round dialogue template occurs after the first round dialogue template. The first round dialogue template includes a first question template and a third reply template, and the second round dialogue text includes a second question template and a fourth reply template.

[0159] First, for each of the first dialogue templates, a first similarity between the third reply template and the reply text of the first round may be determined.

[0160] In the two rounds of dialogue, the third reply template and the reply text of the first round are both customer service replies in the first round of dialogue. Therefore, by determining the first similarity between the third reply template and the reply text of the first round, the dialogue template in the first dialogue template that is similar to the dialogue text of the first round can be quickly located.

[0161] Secondly, according to the first similarity, a target dialogue template is determined from the first dialogue templates.

[0162] In one possible implementation, a first similarity greater than or equal to a first preset threshold can be used as a first target similarity; and a third reply template corresponding to the first target similarity can be used as a fifth reply template; and the first dialogue template to which the fifth reply template belongs can be used as the target dialogue template.

[0163] In another possible implementation, when the first similarities are arranged in descending order, the first preset number of similarities can be used as the second target similarity; and the third reply template corresponding to the second target similarity can be used as the sixth reply template; and the first dialogue template to which the sixth reply template belongs can be used as the target dialogue template.

[0164] In this embodiment, one or more target dialogue templates may be included.

[0165] Finally, the fourth reply template in the target dialogue template is used as the second reply template.

[0166] After determining the target dialogue template, the fourth reply template in each target dialogue template can be used as the second reply template. It can be understood that the question text currently input by the user corresponds to the second question template in the target dialogue template. Moreover, in the target dialogue template, the fourth reply template is used to reply to the second question template. Therefore, in this step, in order to determine the target reply text output to the user, the fourth reply template in the target dialogue template can be used as the second reply template, so that the target reply text can be further determined according to the first reply template and the second reply template.

[0167] The above step S205 is described in detail below. Figure 5 As shown, the above step S205, according to the first reply template and the second reply template, determines the target reply text corresponding to the question text of the second round, which may include the following steps:

[0168] In step S2051, a target reply template is determined from the second reply template according to the first reply template.

[0169] In some embodiments, first, a second similarity between the first reply template and the second reply template may be determined.

[0170] Secondly, the second reply template corresponding to the largest second similarity is used as the seventh reply template.

[0171] For example, the seventh reply template may be recorded as a Top-a template.

[0172] In some embodiments, in response to the second similarity of the seventh reply template being greater than or equal to a second preset threshold, the seventh reply template is used as the target reply template.

[0173] That is, when the second similarity corresponding to the seventh reply template is greater than or equal to the second preset threshold, it can be determined that the seventh reply template has a higher similarity to the first reply template. At this time, the seventh reply template can be directly used as the target reply template.

[0174] In other embodiments, in response to the second similarity of the seventh reply template being less than the second preset threshold, the remaining dialogue templates except the target dialogue template are obtained from the first dialogue template; the fourth reply template corresponding to the remaining dialogue templates is used as the eighth reply template; and the target reply template is determined based on the first reply template, the seventh reply template and the eighth reply template.

[0175] That is, when the second similarity corresponding to the seventh reply template is less than the second preset threshold, it can be determined that the seventh reply template has a low similarity to the first reply template. At this time, further screening can be performed from the remaining dialogue templates of the first dialogue template except the target dialogue template, that is, the fourth reply template corresponding to each of the remaining dialogue templates is used as the eighth reply template. Afterwards, the target reply template is determined based on the first reply template, the seventh reply template and the eighth reply template.

[0176] Specifically, according to the first reply template, the seventh reply template and the eighth reply template, determining the target reply template may include the following two implementation methods:

[0177] In one implementation, the third similarity between the first reply template and each of the eighth reply templates may be determined first. The eighth reply template corresponding to the largest third similarity is used as the ninth reply template. For example, the ninth reply template may be recorded as a Top-b template. In the case where the second similarity corresponding to the seventh reply template is greater than the third similarity corresponding to the ninth reply template, the seventh reply template may be used as the target reply template.

[0178] In another implementation, the dialogue intention information includes the first dialogue intention corresponding to the second round of question text and the first intention parameter corresponding to the first dialogue intention; the first intention parameter is used to characterize the probability that the second round of question text belongs to the first dialogue intention; the template intention information includes the template intention and template intention parameter corresponding to the dialogue template; when the second similarity corresponding to the seventh reply template is less than or equal to the third similarity corresponding to the ninth reply template, the template intention parameters corresponding to the seventh reply template and the ninth reply template can be further compared for further screening. Specifically, the first template intention parameter corresponding to the seventh reply template and the second template intention parameter corresponding to the ninth reply template can be obtained from the template intention parameter. Afterwards, the target reply template can be determined from the seventh reply template and the ninth reply template according to the first intention parameter, the first template intention parameter and the second template intention parameter.

[0179] For example, a first parameter difference between the first template intention parameter and the first intention parameter, and a second parameter difference between the second template intention parameter and the first intention parameter can be determined. And the minimum value of the first parameter difference and the second parameter difference is used as the target parameter difference. Afterwards, the reply template corresponding to the target parameter difference can be used as the target reply template. Wherein, in the case where the target parameter difference includes the first parameter difference, the target reply template includes the seventh reply template; in the case where the target parameter difference includes the second parameter difference, the target reply template includes the ninth reply template.

[0180] That is to say, in this step, the template intent parameters corresponding to the seventh reply template and the ninth reply template can be compared respectively, and the reply template with the smallest difference with the first intent parameter of the first round of question text can be selected as the final target reply template.

[0181] In addition, the absolute values ​​of the first parameter difference and the second parameter difference may be taken respectively, and the minimum value of the absolute value of the first parameter difference and the absolute value of the second parameter difference may be taken as the target parameter difference.

[0182] In step S2052, target information is obtained according to the target reply template.

[0183] In some embodiments, first, the corresponding target slot in the target reply template may be determined.

[0184] The target slot is an information slot that corresponds to the preset user information in the preset target reply template.

[0185] Then, according to the target slot, the target information corresponding to the user is obtained.

[0186] Exemplarily, user information sets associated with different users can be set (for example, prompts, and the user information in the prompts can be provided in the form of <label, value>). For each target slot, the corresponding target information is obtained from the user information set corresponding to the user. For example, if the target slot is used to represent the slot corresponding to the mobile phone number, then the mobile phone number corresponding to the user can be obtained from the user information set as the target information.

[0187] In step S2053, according to the target reply template and the target information, the target reply text is output.

[0188] In this step, the target information can be filled into the target slot corresponding to the target reply template to obtain the target reply text, and the target reply text is output to the user.

[0189] In this way, without optimizing the first target model and the second target model, an accurate target reply text can be obtained through multiple rounds of matching, with the lowest resource consumption and strong business scalability.

[0190] Figure 6 is a flowchart of a method for constructing a preset template library shown according to an exemplary embodiment, as Figure 6 shown, the preset template library is pre-constructed in the following manner:

[0191] In step S301, a plurality of dialogue sample data are obtained, and each of the dialogue sample data includes a first-round dialogue sample and a second-round dialogue sample.

[0192] In this step, a plurality of dialogue sample data can be obtained in the following manner:

[0193] First, a plurality of sample data are obtained.

[0194] Among them, the sample data can be multi-round historical dialogue data obtained, or preset multi-round dialogue data.

[0195] Then, for each of the sample data, based on a plurality of preset user information included in a preset keyword library, corresponding information slots are generated in the sample data.

[0196] Among them, the preset keyword library can extract relevant user information fields according to the characteristics of different scenarios and business content to obtain preset user information, and each preset user information corresponds to a label, such as <last four digits of mobile phone number, [a]>. Then, for the sample data of each scenario, the corresponding content is replaced by regular substitution according to the preset user information label corresponding in the sample data (that is, the user information in the sample data is replaced by the corresponding label field) to generate corresponding information slots.

[0197] Furthermore, the information slots may be manually checked and corrected to improve the accuracy of information slot generation.

[0198] Finally, sample data with information slots is generated as the conversation sample data.

[0199] Specifically, two consecutive rounds of dialogue samples can be iteratively extracted from the sample data with information slots generated, and as one dialogue sample data, they can be organized in the same format, such as user 1#customer service 1#user 2#customer service 2, user 2#customer service 2#user 3#customer service 3. In order to correspond to the second round question text input by the user and the first round dialogue text in the subsequent matching, when extracting the dialogue sample data, if the first round dialogue sample of the current sample data does not start with the user, the user default opening words, such as "Hello, hello", can be added to form a complete round of dialogue.

[0200] In this way, using two consecutive rounds of conversation as the conversation sample data avoids the problem of difficulty in storing and retrieving the overall sample data, and also avoids the problem of missing context information and inability to accurately match the sentences in the customer service order. In the application process, you only need to pay attention to the second round of question text and the previous first round of conversation text to accurately output the target reply text corresponding to the current second round, similar to filling in the blanks, you only need to pay attention to the information around the current question to get the answer.

[0201] In some embodiments, considering that the sample data may also contain redundant or low-quality conversations, in order to further improve the sample quality of the conversation sample data, corresponding preset screening rules may be set, and the multiple sample data are screened according to the preset screening rules to obtain candidate sample data. Then, based on each of the candidate sample data, a corresponding information slot is generated. The candidate sample data with the generated information slot is used as the conversation sample data.

[0202] In other embodiments, different preset screening rules may be set for different business scenarios. For example, when screening data, for sample data of different business scenarios (the sample data may be classified by the scenario labels on the sample data, for example, the telemarketing business may be classified according to marketing activities to obtain different types of business scenarios), multiple sample data are screened according to the preset screening rules corresponding to the business scenario to obtain candidate sample data. Then, based on each candidate sample data, a corresponding information slot is generated. The candidate sample data with the generated information slot is used as the conversation sample data.

[0203] In this way, by dividing the business scenarios of sample data, not only can the data interference between different business scenarios in the template library be reduced. And when the template library of the business scenario needs to be updated or added, only the sample data of the conversation to be updated or added of the corresponding business scenario needs to be input to automatically complete the construction of the template library of the corresponding business scenario. The expansion and maintenance of business scenarios are simpler and the cost is lower. Secondly, because everyone's expression methods are different and the same person has his own expression habits, representative high-quality conversations can be screened out by setting preset filtering rules to filter the conversation sample data. While ensuring data quality, it also reduces the cost of manual annotation and data analysis. The entire process can be completed automatically afterwards, with a simple process, short time consumption, good effect, and easier productization.

[0204] In step S302, for each of the conversation sample data, the sample intention information corresponding to the conversation sample data is determined.

[0205] In some embodiments, the first round of dialogue samples include a first question sample and a first reply sample, and the second round of dialogue samples include a second question sample and a second reply sample. In this step, the first question sample and the second question sample can be input into a pre-trained first target model to obtain the sample intent information output by the first target model.

[0206] The sample intent information may include a first dialogue sample intent corresponding to the first question sample and a first sample intent parameter corresponding to the first dialogue sample intent, as well as a second dialogue sample intent corresponding to the second question sample and a second sample intent parameter corresponding to the second dialogue sample intent.

[0207] For example, the first question sample and the second question sample can be respectively input into the first target model obtained by pre-training to obtain the first dialogue sample intent and the first sample intent parameter corresponding to the first dialogue sample intent, as well as the second dialogue sample intent and the second sample intent parameter corresponding to the second dialogue sample intent, output by the first target model. And according to the first dialogue sample intent, the first sample intent parameter, the second dialogue sample intent and the second sample intent parameter, the sample intent information is obtained by combining. For example, it can be combined in the form of "first dialogue sample intent#second dialogue sample intent&first sample intent parameter#second sample intent parameter", or in the form of "first dialogue sample intent#first sample intent parameter&second dialogue sample intent#second sample intent parameter". The above examples are for illustrative purposes only, and the present disclosure is not limited thereto.

[0208] In step S303, target dialogue sample data is determined from the plurality of dialogue sample data according to the sample intention information.

[0209] In some embodiments, first, for each sample intent information, a plurality of conversation sample data corresponding to the sample intent information may be clustered to obtain a plurality of sample clusters.

[0210] Each sample cluster includes at least one conversation sample data.

[0211] When classifying the multiple conversation sample data according to each sample intent information, the multiple conversation sample data can be classified according to the conversation sample intent combination corresponding to each sample intent information, and the conversation sample intent combination can be determined according to the first conversation sample intent and the second conversation sample intent in the sample intent information. For example, "first conversation sample intent#second conversation sample intent" is a conversation sample intent combination, and the conversation sample data that meets the conversation sample intent combination belongs to the same conversation sample intent combination.

[0212] In one implementation, the reply samples in each conversation sample data can be extracted and spliced ​​to obtain sample customer service pairs, such as customer service 1 and customer service 2, to obtain a sample customer service pair set under each sample intent information. Afterwards, for each sample intent information, clustering can be performed based on at least one sample customer service pair in the corresponding sample customer service pair set.

[0213] In another implementation, the question samples in each conversation sample data may be extracted and concatenated to obtain sample user pairs, such as user 1 and user 2, to obtain a sample user pair set under each sample intent information. Afterwards, clustering may be performed based on at least one sample user pair in the corresponding sample user pair set for each sample intent information.

[0214] It should be noted that, when clustering is performed, any one or both of the above two implementation modes may be selected for clustering, and the present disclosure does not make any specific limitation on this.

[0215] For example, in the process of clustering, the size of the sample cluster can be determined by the proportion of the amount of data in each cluster whose distance from the sample to the sample cluster center exceeds the threshold to the total amount of each cluster, and a corresponding ratio threshold can be set. If the ratio threshold is less than the preset ratio threshold, it is considered that the clustering effect is good, and the current multiple sample clusters can be output. Otherwise, the number of sample clusters is dynamically increased, and the above clustering judgment is performed again until the requirement that the ratio threshold is less than the preset ratio threshold is met, and the current multiple sample clusters are output. For example, clustering can be performed by a clustering method in the relevant technology, such as the K-means clustering algorithm (K-Means).

[0216] Secondly, according to the multiple sample clusters, the target dialogue sample data is determined from the multiple dialogue sample data.

[0217] In one implementation, the sample cluster centers corresponding to the multiple sample clusters may be determined, and the conversation sample data corresponding to the sample cluster centers are used as the target conversation sample data.

[0218] In another implementation, the sample cluster centers corresponding to the multiple sample clusters are determined. And the target distance of each sample cluster from the sample cluster center is determined. According to the target distance, the target ratio corresponding to each sample cluster is determined. Among them, the target ratio can be determined by a preset corresponding relationship, and the preset corresponding relationship includes a corresponding relationship between distance and ratio. For each sample cluster, according to the target ratio corresponding to the sample cluster, the corresponding conversation sample data is obtained from the sample cluster as the target conversation sample data. For example, according to the target ratio and the number of sample clusters, the total number of acquisitions corresponding to the sample cluster can be determined, and according to the total number of acquisitions, the conversation sample data is obtained from the sample cluster as the target conversation sample data.

[0219] In step S304, the target dialogue sample data is used as a dialogue template, and the sample intention information corresponding to the target dialogue sample data is used as template intention information.

[0220] In step S305, the preset template library is constructed according to the dialogue template and the template intention information.

[0221] In addition, after the preset template library is constructed, the dialogue templates in the preset template library can be used as training sample data for the first target model and the second target model to train, so as to enhance the accuracy of model generation as much as possible.

[0222] By adopting the above method, the first target model can be used to identify the intent of the dialogue sample data, obtain the sample intent information corresponding to each dialogue sample data, summarize the dialogue sample data under each sample intent information, and then cluster the dialogue sample data under each sample intent information through the clustering algorithm, and select the target dialogue sample data with the most representative sample intent information from the obtained multiple sample clusters, which can effectively extract complex and diverse dialogue templates in different business scenarios. The process from the annotation of all sample data to the screening of dialogue sample data, and then to the intent identification and clustering can be fully automated, which greatly reduces the cost of manual annotation and improves the quality and quantity of dialogue templates in the preset template library. At the same time, since the dialogue templates stored in the preset template library are turn pair templates, the original context information of the data is retained, which is further used as the basis for matching the sentences generated by the second target model with the template in the subsequent application process. Replacing the single match with the double match can not only avoid the model from hallucinations and errors, but also greatly reduce the cost of data analysis.

[0223] Figure 7 is a flow chart of a method for dialogue according to an exemplary embodiment. Figure 7 As shown, the method may include the following steps:

[0224] S1, obtain multiple sample data.

[0225] The sample data may be acquired multi-round historical conversation data or preset multi-round conversation data.

[0226] S2, screen and obtain candidate sample data.

[0227] In this step, considering that the sample data may contain redundant or low-quality conversations, in order to further improve the sample quality of the conversation sample data, corresponding preset screening rules can also be set, and the multiple sample data can be screened according to the preset screening rules to obtain candidate sample data.

[0228] S3, generate corresponding information slots.

[0229] In some embodiments, for each candidate sample data, a corresponding information slot is generated in the candidate sample data based on a plurality of preset user information included in a preset keyword library.

[0230] S4, iteratively extracts two consecutive rounds of dialogue samples.

[0231] Specifically, two consecutive rounds of dialogue samples can be iteratively extracted from the candidate sample data with information slots generated as a dialogue sample data. The dialogue sample data includes the first round dialogue sample and the second round dialogue sample. In order to correspond to the second round question text input by the user and the first round dialogue text in the subsequent matching, when extracting the dialogue sample data, if the first round dialogue sample of the current sample data does not start with the user, the user's default opening words, such as "Hello, hello", can be added to form a complete round of dialogue.

[0232] S5, generate sample intent information.

[0233] In this step, the sample intent information corresponding to each of the dialogue sample data can be determined. The first round of dialogue samples includes a first question sample and a first reply sample, and the second round of dialogue samples includes a second question sample and a second reply sample. In this step, the first question sample and the second question sample can be input into a pre-trained first target model to obtain the sample intent information output by the first target model. The sample intent information can include a first dialogue sample intent corresponding to the first question sample and a first sample intent parameter corresponding to the first dialogue sample intent, as well as a second dialogue sample intent corresponding to the second question sample and a second sample intent parameter corresponding to the second dialogue sample intent.

[0234] S6, classify multiple conversation sample data.

[0235] In some embodiments, multiple conversation sample data can be classified according to each sample intent information. Specifically, multiple conversation sample data can be classified according to the conversation sample intent combination corresponding to each sample intent information, and the conversation sample intent combination can be determined according to the first conversation sample intent and the second conversation sample intent in the sample intent information. For example, "first conversation sample intent#second conversation sample intent" is a conversation sample intent combination, and the conversation sample data that meets the conversation sample intent combination belongs to the same conversation sample intent combination.

[0236] S7, spliced ​​sample pairs.

[0237] The sample set may include sample customer service pairs and / or sample user pairs.

[0238] In one implementation, the customer service response samples in each conversation sample data may be extracted and concatenated to obtain sample customer service pairs, such as customer service 1# and customer service 2, to obtain a set of sample customer service pairs under each sample intent information.

[0239] In another implementation, the user question samples in each conversation sample data may be extracted and concatenated to obtain sample user pairs, such as user 1#user 2, to obtain a set of sample user pairs under each sample intent information.

[0240] S8, clustering.

[0241] For each sample intent information, the sample pairs corresponding to the sample intent information may be clustered to obtain a plurality of sample clusters.

[0242] S9, build a preset template library.

[0243] In some embodiments, the target conversation sample data can be determined from the multiple conversation sample data according to the multiple sample clusters. The target conversation sample data is used as a conversation template, and the sample intent information corresponding to the target conversation sample data is used as template intent information. The preset template library is constructed according to the conversation template and the template intent information.

[0244] The above steps S1 to S9 are the process of constructing a template library.

[0245] S10, obtaining the first round of dialogue text and the second round of question text.

[0246] The question text of the second round can be generated by the user through text input, or can be generated by the user's voice input and converted into corresponding text through voice recognition, and the user can input the question text through the terminal device. In this embodiment, the question text of the second round can be understood as the question text input by the user in the current round, and the dialogue text of the first round can be understood as the dialogue text corresponding to the user in the previous round of dialogue before the second round.

[0247] S11, performing intent recognition based on the first target model.

[0248] In this step, the user's second round conversation intention information can be determined based on the second round question text and the first round conversation text. In some embodiments, the user's corresponding conversation intention information can be obtained by performing intention recognition on the second round question text and the first round conversation text. Specifically, the second round question text and the first round conversation text can be input into a pre-trained first target model to obtain the conversation intention information output by the first target model.

[0249] S12, generating a first reply template based on the second target model.

[0250] Among them, the historical conversation text before the second round of question text can be obtained first, and the second round of question text and the historical conversation text input by the user are input into the second target model to obtain the first reply template output by the second target model.

[0251] S13, matching a preset template library.

[0252] The conversation intention information may be matched with the template intention information, and the successfully matched template intention information may be used as the target template intention information.

[0253] S14, screening the first dialogue template.

[0254] Among them, the dialogue template corresponding to the target template intention information can be used as the first dialogue template.

[0255] S15, first similarity calculation.

[0256] In some embodiments, each of the first dialogue templates includes a first round dialogue template and a second round dialogue template, and the second round dialogue template occurs after the first round dialogue template. The first round dialogue template includes a first question template and a third reply template, and the second round dialogue template includes a second question template and a fourth reply template. For each of the first dialogue templates, a first similarity between the third reply template and the first round reply text in the first round dialogue text can be determined.

[0257] S16, extracting a second reply template.

[0258] In one possible implementation, a first similarity greater than or equal to a first preset threshold can be used as a first target similarity; and a third reply template corresponding to the first target similarity can be used as a fifth reply template; and the first dialogue template to which the fifth reply template belongs can be used as the target dialogue template.

[0259] In another possible implementation, when the first similarities are arranged in descending order, the first preset number of similarities can be used as the second target similarity; and the third reply template corresponding to the second target similarity can be used as the sixth reply template; and the first dialogue template to which the sixth reply template belongs can be used as the target dialogue template.

[0260] In this embodiment, one or more target dialogue templates may be included, and the fourth reply template in the target dialogue template may be used as the second reply template.

[0261] S17, second similarity calculation.

[0262] The second similarity between the first reply template and the second reply template may be determined first.

[0263] S18, extracting the seventh reply template.

[0264] The second reply template corresponding to the largest second similarity may be used as the seventh reply template.

[0265] S19: Determine whether the second similarity corresponding to the seventh reply template is greater than or equal to a second preset threshold.

[0266] If it is determined that the second similarity corresponding to the seventh reply template is greater than or equal to the second preset threshold, step S20 is executed;

[0267] If it is determined that the second similarity corresponding to the seventh reply template is less than the second preset threshold, step S21 is executed.

[0268] S20, selecting the seventh reply template.

[0269] That is, the seventh reply template is used as the target reply template.

[0270] S21, third similarity calculation and extraction of a ninth reply template.

[0271] In this step, when the second similarity corresponding to the seventh reply template is less than the second preset threshold, it can be determined that the seventh reply template has a low similarity with the first reply template. At this time, further screening can be performed from the remaining dialogue templates of the first dialogue template except the target dialogue template, that is, the fourth reply template corresponding to each of the remaining dialogue templates is used as the eighth reply template. Afterwards, the third similarity between the first reply template and each of the eighth reply templates is determined. And the eighth reply template corresponding to the largest third similarity is used as the ninth reply template.

[0272] S22, determining whether the second similarity corresponding to the seventh reply template is greater than the third similarity corresponding to the ninth reply template.

[0273] If it is determined that the second similarity corresponding to the seventh reply template is greater than the third similarity corresponding to the ninth reply template, step S20 is executed;

[0274] If it is determined that the second similarity corresponding to the seventh reply template is less than or equal to the third similarity corresponding to the ninth reply template, step S23 is executed.

[0275] S23, determining whether the first parameter difference is the smallest.

[0276] In the case that the second similarity corresponding to the seventh reply template is less than or equal to the third similarity corresponding to the ninth reply template, the template intent parameters of the seventh reply template and the ninth reply template can be further compared for further screening. Specifically, the first intent parameter corresponding to the second round of question text can be determined. And the first template intent parameter corresponding to the seventh reply template and the second template intent parameter corresponding to the ninth reply template are obtained from the template intent parameter. Afterwards, the first parameter difference between the first template intent parameter and the first intent parameter and the second parameter difference between the second template intent parameter and the first intent parameter are determined.

[0277] If the first parameter difference is the smallest between the first parameter difference and the second parameter difference, executing step S20;

[0278] If the second parameter difference is the smallest between the first parameter difference and the second parameter difference, step S24 is executed.

[0279] S24, select the ninth reply template.

[0280] That is, the ninth reply template is used as the target reply template.

[0281] S25, the target information fills the target slot.

[0282] In this step, the target reply template is provided with a target slot related to the user information, therefore, it is also necessary to obtain the target information corresponding to the target slot according to the target reply template, and fill the target information into the target slot corresponding to the target reply template to obtain the target reply text.

[0283] S26, outputting the target reply text.

[0284] By adopting the above method, on the one hand, the second round of conversation intention information can be determined, and the second reply template corresponding to the conversation intention information can be screened from the preset template library, thereby improving the accuracy of the subsequent determination of the target reply text, and being able to more accurately reply to the second round of conversation intention. On the other hand, by combining the first reply template and the second reply template corresponding to the second round of question text, the final target reply text is obtained, which can further improve the accuracy and standardization of the reply. At the same time, the target reply text can be quickly generated with only a small amount of data analysis, which improves the efficiency of the reply.

[0285] Figure 8 is a flow chart of a method for dialogue according to an exemplary embodiment. Figure 8 As shown, first, the conversation text of the first round can be obtained, and the question text of the second round entered by the user and the scene field of the current conversation can be collected at the same time, wherein the scene field entered by the user can be identified by prompt. For example, the conversation text of the first round is "User 1: Hello. Customer Service 1: Hello, are you Ms. Yang?" and the question text of the second round is "User 2: Yes." Then, on the one hand, the intention recognition can be performed on the conversation text of the first round and the question text of the second round (for example, the intention recognition can be performed by the above-mentioned first target model) to obtain the conversation intention information. On the other hand, the first reply template can be generated by the second target model. Further, through the conversation intention information, the intention matching is performed from the preset template library to obtain the second reply template. After that, the target reply template can be obtained by matching the first reply template and the second reply template. And according to the target slot in the target reply template, the corresponding target information is obtained, and filled to obtain the target reply text, and output. The target reply text can be, for example, "Customer Service 2: Hello, I am a staff member of XXXX". Among them, user 1 and user 2 are only used to distinguish the conversations between users in different rounds. Similarly, customer service 1 and customer service 2 are only used to distinguish the conversations between customer service in different rounds.

[0286] For another example, if the text of the first round of dialogue is "User 1: What is the billing date? Customer Service 1: Let me take a look for you, please wait a moment, Mr. Ha Yang." and the text of the second round of questions is "User 2: What day in December?" On the one hand, the intent can be identified based on the first round of dialogue text and the second round of question text to obtain the current dialogue intent information including the date inquiry. On the other hand, the first reply template is generated through the second target model. Furthermore, through the dialogue intent information, the intent is matched from the preset template library to obtain the second reply template. Afterwards, by matching the first reply template and the second reply template, the target reply template is obtained as "What is the payment bill date for your next period?" <05> Number". <05> Used to indicate the target slot. According to the target slot, the corresponding target information is obtained as "eighteen", and the target information is filled into the target slot of the target reply template, and the target reply text can be obtained as "your next payment bill date is the eighteenth", and output.

[0287] Regarding the method in the above embodiment, the specific manner of performing the operation in each step has been described in detail in the embodiment of the method, and will not be elaborated here.

[0288] Fig. 9 is a block diagram of a conversation device according to an exemplary embodiment. Fig. 9 As shown, the device 400 includes:

[0289] A first acquisition module 401 is configured to acquire a first round of dialogue text and a second round of question text;

[0290] The second acquisition module 402 is configured to acquire a first reply template corresponding to the question text of the second round;

[0291] A determination module 403 is configured to determine the conversation intention information of the second round according to the question text of the second round and the conversation text of the first round;

[0292] The third acquisition module 404 is configured to acquire a second reply template corresponding to the conversation intention information from a preset template library according to the conversation intention information;

[0293] The output module 405 is configured to determine the target response text corresponding to the question text of the second round according to the first response template and the second response template.

[0294] Optionally, the preset template library includes multiple dialogue templates and multiple template intent information, each template intent information corresponds to at least one dialogue template; the third acquisition module 404 is configured to determine the first template intent information that matches the dialogue intention information; determine the first dialogue template corresponding to the first template intent information; and determine the second reply template based on the first dialogue template.

[0295] Optionally, the first dialogue template includes a first-round dialogue template and a second-round dialogue template; the first-round dialogue template includes a first question template and a third reply template, and the second-round dialogue template includes a second question template and a fourth reply template; the first-round dialogue text includes the first-round question text and the first-round reply text, and the third acquisition module 404 is configured to determine a first similarity between the third reply template and the first-round reply text; based on the first similarity, determine a target dialogue template from the first dialogue template; and use the fourth reply template in the target dialogue template as the second reply template.

[0296] Optionally, the third acquisition module 404 is configured to take a first similarity greater than or equal to a first preset threshold as a first target similarity; and take a third reply template corresponding to the first target similarity as a fifth reply template; and take a first dialogue template to which the fifth reply template belongs as the target dialogue template; or, when the first similarities are arranged in order from large to small, take the first preset number of similarities as the second target similarities; and take the third reply template corresponding to the second target similarity as a sixth reply template; and take the first dialogue template to which the sixth reply template belongs as the target dialogue template.

[0297] Optionally, the output module 405 is configured to determine a target reply template from the second reply template according to the first reply template; obtain target information according to the target reply template; and output the target reply text according to the target reply template and the target information.

[0298] Optionally, the output module 405 is configured to determine the second similarity between the first reply template and the second reply template; use the second reply template corresponding to the largest second similarity as the seventh reply template; in response to the second similarity of the seventh reply template being greater than or equal to a second preset threshold, use the seventh reply template as the target reply template.

[0299] Optionally, the output module 405 is also configured to, in response to the second similarity of the seventh reply template being less than the second preset threshold, obtain the remaining dialogue templates except the target dialogue template from the first dialogue template; use the fourth reply template corresponding to the remaining dialogue templates as the eighth reply template; and determine the target reply template based on the first reply template, the seventh reply template and the eighth reply template.

[0300] Optionally, the output module 405 is configured to determine the third similarity between the first reply template and the eighth reply template; use the eighth reply template corresponding to the largest third similarity as the ninth reply template; and use the seventh reply template as the target reply template when the second similarity corresponding to the seventh reply template is greater than the third similarity corresponding to the ninth reply template.

[0301] Optionally, the dialogue intention information includes a first dialogue intention corresponding to the second round of question text and a first intention parameter corresponding to the first dialogue intention; the first intention parameter is used to characterize the probability that the second round of question text belongs to the first dialogue intention; the template intention information includes a template intention and a template intention parameter corresponding to the dialogue template; the output module 405 is also configured to obtain, when the second similarity corresponding to the seventh reply template is less than or equal to the third similarity corresponding to the ninth reply template, the first template intention parameter corresponding to the seventh reply template and the second template intention parameter corresponding to the ninth reply template from the template intention parameter; and determine the target reply template from the seventh reply template and the ninth reply template according to the first intention parameter, the first template intention parameter and the second template intention parameter.

[0302] Optionally, the output module 405 is configured to determine a first parameter difference between the first template intention parameter and the first intention parameter, and a second parameter difference between the second template intention parameter and the first intention parameter; take the minimum value of the first parameter difference and the second parameter difference as the target parameter difference; take the reply template corresponding to the target parameter difference as the target reply template; wherein, when the target parameter difference includes the first parameter difference, the target reply template includes the seventh reply template; when the target parameter difference includes the second parameter difference, the target reply template includes the ninth reply template.

[0303] Optionally, the preset template library is pre-built in the following ways:

[0304] Acquire a plurality of dialogue sample data, each of which includes a first round dialogue sample and a second round dialogue sample;

[0305] For each of the conversation sample data, determine the sample intent information corresponding to the conversation sample data;

[0306] Determining target dialogue sample data from the plurality of dialogue sample data according to the sample intention information;

[0307] The target dialogue sample data is used as a dialogue template, and the sample intention information corresponding to the target dialogue sample data is used as the template intention information;

[0308] The preset template library is constructed according to the dialogue template and the template intention information.

[0309] Optionally, determining target dialogue sample data from the plurality of dialogue sample data according to the sample intention information includes:

[0310] For each sample intention information, clustering the multiple conversation sample data corresponding to the sample intention information to obtain multiple sample clusters; each sample cluster includes at least one conversation sample data;

[0311] The target conversation sample data is determined from the plurality of conversation sample data according to the plurality of sample clusters.

[0312] Optionally, the determining the target conversation sample data from the plurality of conversation sample data according to the plurality of sample clusters includes:

[0313] Determine the sample cluster centers corresponding to the multiple sample clusters;

[0314] The conversation sample data corresponding to the sample cluster center is used as the target conversation sample data.

[0315] Optionally, the determining the target conversation sample data from the plurality of conversation sample data according to the plurality of sample clusters includes:

[0316] Determine the sample cluster centers corresponding to the multiple sample clusters;

[0317] Determine the target distance between each sample cluster and the sample cluster center;

[0318] According to the target distance, determine the target ratio corresponding to each sample cluster;

[0319] For each of the sample clusters, according to the target ratio corresponding to the sample cluster, corresponding conversation sample data is obtained from the sample cluster as the target conversation sample data.

[0320] By adopting the above device, on the one hand, the second round of conversation intention information can be determined, and the second reply template corresponding to the conversation intention information can be screened from the preset template library, thereby improving the accuracy of the subsequent determination of the target reply text, and being able to more accurately reply to the second round of conversation intention. On the other hand, by combining the first reply template and the second reply template corresponding to the second round of question text, the final target reply text is obtained, which can further improve the accuracy and standardization of the reply. At the same time, the target reply text can be quickly generated with only a small amount of data analysis, which improves the efficiency of the reply.

[0321] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0322] Fig.10 is a block diagram of an electronic device 500 according to an exemplary embodiment. For example, the electronic device 500 may be provided as a server. Fig.10 The electronic device 500 includes a processor 522, which may be one or more, and a memory 532 for storing a computer program executable by the processor 522. The computer program stored in the memory 532 may include one or more modules, each corresponding to a set of instructions. In addition, the processor 522 may be configured to execute the computer program to perform the above-mentioned method of dialogue.

[0323] In addition, the electronic device 500 may further include a power supply component 526 and a communication component 550, wherein the power supply component 526 may be configured to perform power management of the electronic device 500, and the communication component 550 may be configured to implement communication, such as wired or wireless communication, of the electronic device 500. In addition, the electronic device 500 may further include an input / output (I / O) interface 558. The electronic device 500 may operate based on an operating system stored in the memory 532, such as Windows Server™, Mac OSX™, Unix™, Linux™, etc.

[0324] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned method of dialogue are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 532 including program instructions, and the above-mentioned program instructions can be executed by the processor 522 of the electronic device 500 to complete the above-mentioned method of dialogue.

[0325] Based on the same concept, an embodiment of the present disclosure further provides a computer-readable medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned dialogue method are implemented.

[0326] Based on the same concept, an embodiment of the present disclosure further provides a computer program product, including a computer program, which implements the steps of the above-mentioned dialogue method when executed by a processor.

[0327] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0328] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0329] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A method of dialogue, characterized in that: The method comprises: Obtain the conversation text of the first round and the question text of the second round; Obtain a first response template corresponding to the question text of the second round; Determining the conversation intention information of the second round according to the question text of the second round and the conversation text of the first round; According to the conversation intention information, obtaining a second reply template corresponding to the conversation intention information from a preset template library; A target response text corresponding to the question text of the second round is determined according to the first response template and the second response template.

2. The method according to claim 1, characterized in that The preset template library includes a plurality of dialogue templates and a plurality of template intent information, each of the template intent information corresponds to at least one dialogue template; The acquiring, according to the conversation intention information, a second reply template corresponding to the conversation intention information from a preset template library comprises: Determining first template intention information matching the conversation intention information; Determine a first dialogue template corresponding to the first template intention information; The second reply template is determined according to the first dialogue template.

3. The method according to claim 2, characterized in that The first dialogue template includes a first round dialogue template and a second round dialogue template; the first round dialogue template includes a first question template and a third reply template, and the second round dialogue template includes a second question template and a fourth reply template; The first round of dialogue text includes a first round of question text and a first round of reply text, and determining the second reply template according to the first dialogue template includes: Determining a first similarity between the third reply template and the reply text of the first round; Determining a target dialogue template from the first dialogue templates according to the first similarity; The fourth reply template in the target dialogue template is used as the second reply template.

4. The method according to claim 3, characterized in that Determining a target dialogue template from the first dialogue template according to the first similarity includes: Using a first similarity greater than or equal to a first preset threshold as a first target similarity; using a third reply template corresponding to the first target similarity as a fifth reply template; and using a first dialogue template to which the fifth reply template belongs as the target dialogue template; or When the first similarities are arranged in descending order, the first preset number of similarities are used as the second target similarities; the third reply template corresponding to the second target similarity is used as the sixth reply template; and the first dialogue template to which the sixth reply template belongs is used as the target dialogue template.

5. The method according to claim 3, characterized in that: Determining the target response text corresponding to the question text of the second round according to the first response template and the second response template includes: Determining a target reply template from the second reply template according to the first reply template; Acquiring target information according to the target response template; The target reply text is output according to the target reply template and the target information.

6. The method according to claim 5, characterized in that Determining a target reply template from the second reply template according to the first reply template includes: determining a second similarity between the first reply template and the second reply template; The second reply template corresponding to the largest second similarity is used as the seventh reply template; In response to the second similarity of the seventh reply template being greater than or equal to a second preset threshold, the seventh reply template is used as the target reply template.

7. The method according to claim 6, characterized in that The method further comprises: In response to the second similarity of the seventh reply template being less than the second preset threshold, acquiring the remaining dialogue templates except the target dialogue template from the first dialogue templates; Using the fourth reply template corresponding to the remaining dialogue templates as the eighth reply template; The target reply template is determined according to the first reply template, the seventh reply template and the eighth reply template.

8. The method according to claim 7, characterized in that The determining the target reply template according to the first reply template, the seventh reply template and the eighth reply template comprises: determining a third similarity between the first reply template and the eighth reply template; Using the eighth reply template corresponding to the largest third similarity as the ninth reply template; When the second similarity corresponding to the seventh reply template is greater than the third similarity corresponding to the ninth reply template, the seventh reply template is used as the target reply template.

9. The method according to claim 8, characterized in that The dialogue intention information includes the first dialogue intention corresponding to the question text of the second round and the first intention parameter corresponding to the first dialogue intention; the first intention parameter is used to represent the probability that the question text of the second round belongs to the first dialogue intention; The template intent information includes the template intent and template intent parameters corresponding to the dialogue template; The method further comprises: When the second similarity corresponding to the seventh reply template is less than or equal to the third similarity corresponding to the ninth reply template, obtaining the first template intention parameter corresponding to the seventh reply template and the second template intention parameter corresponding to the ninth reply template from the template intention parameter; The target reply template is determined from the seventh reply template and the ninth reply template according to the first intention parameter, the first template intention parameter and the second template intention parameter.

10. The method according to claim 9, characterized in that The determining the target reply template from the seventh reply template and the ninth reply template according to the first intention parameter, the first template intention parameter, and the second template intention parameter comprises: Determining a first parameter difference between the first template intention parameter and the first intention parameter, and a second parameter difference between the second template intention parameter and the first intention parameter; The minimum value between the first parameter difference and the second parameter difference is taken as the target parameter difference; Using the response template corresponding to the target parameter difference as the target response template; Wherein, when the target parameter difference includes the first parameter difference, the target response template includes the seventh response template; when the target parameter difference includes the second parameter difference, the target response template includes the ninth response template.

11. The method according to any one of claims 1 to 10, characterized in that The preset template library is pre-built in the following way: Acquire a plurality of dialogue sample data, each of the dialogue sample data comprising a first round dialogue sample and a second round dialogue sample; For each of the conversation sample data, determining sample intent information corresponding to the conversation sample data; Determining target dialogue sample data from the plurality of dialogue sample data according to the sample intention information; Using the target dialogue sample data as a dialogue template, and using the sample intent information corresponding to the target dialogue sample data as template intent information; The preset template library is constructed according to the dialogue template and the template intention information.

12. The method according to claim 11, characterized in that Determining target dialogue sample data from the plurality of dialogue sample data according to the sample intention information comprises: For each sample intention information, clustering the plurality of the conversation sample data corresponding to the sample intention information to obtain a plurality of sample clusters; each sample cluster includes at least one conversation sample data; The target conversation sample data is determined from the plurality of conversation sample data according to the plurality of sample clusters.

13. The method according to claim 12, characterized in that The determining the target conversation sample data from the plurality of conversation sample data according to the plurality of sample clusters comprises: Determine the sample cluster centers corresponding to the multiple sample clusters; The conversation sample data corresponding to the sample cluster center is used as the target conversation sample data.

14. The method according to claim 12, characterized in that The determining the target conversation sample data from the plurality of conversation sample data according to the plurality of sample clusters comprises: Determine the sample cluster centers corresponding to the multiple sample clusters; Determine a target distance between each of the sample clusters and the sample cluster center; According to the target distance, determining the target ratio corresponding to each sample cluster; For each of the sample clusters, corresponding conversation sample data is obtained from the sample cluster according to the target ratio corresponding to the sample cluster, as the target conversation sample data.

15. A conversation device, characterized in that: The device comprises: A first acquisition module is configured to acquire a first round of dialogue text and a second round of question text; A second acquisition module is configured to acquire a first reply template corresponding to the question text of the second round; A determination module, configured to determine the conversation intention information of the second round according to the question text of the second round and the conversation text of the first round; A third acquisition module is configured to acquire, according to the conversation intention information, a second reply template corresponding to the conversation intention information from a preset template library; The output module is configured to determine a target response text corresponding to the question text of the second round according to the first response template and the second response template.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

17. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 14.

18. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

Citation Information

Patent Citations

  • Customer service question and answer processing method and system for retrieving multiple rounds of conversations

    CN111046132A

  • Conversation generation method and device and electronic equipment

    CN111737444A

  • Multi-round dialogue retrieval method and device, storage medium and electronic equipment

    CN111966782A

  • Conversation processing method and device, electronic equipment and storage medium

    CN116303951A

  • Multi-round dialogue intention tracking method, equipment and device and computer storage medium

    CN116975383A

Cited By

  • Real-time semantic analysis and dynamic reply template matching device for advertiser consultation

    CN120654709A

  • Real-time semantic analysis and dynamic reply template matching device for advertiser consultation

    CN120654709B