Dialogue text label identification model training method and dialogue text label identification method
By processing and labeling the annotated dialogue text in the target domain, annotated dialogue samples are generated. These samples are then used to train a pre-trained model, which solves the problem that LSTM time-series modeling cannot predict user-customer service dialogue content labels in parallel, thus improving the accuracy of label prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2026-03-20
AI Technical Summary
Existing LSTM-based time series modeling methods cannot predict the labels of conversations between users and customer service representatives in parallel, resulting in low accuracy of label prediction and the problem of gradient explosion.
By acquiring labeled dialogue text sets in the target domain, and after desensitization, data cleaning, and data verification, labeled dialogue samples are generated based on the various dialogue roles in the dialogue information sequence. Based on these samples, a pre-trained dialogue text label recognition model is trained and optimized to achieve parallel prediction.
It improves the accuracy of label prediction results, avoids the gradient explosion problem, and increases the accuracy of label prediction.
Smart Images

Figure CN115392230B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of computer technology, and in particular, to a dialogue text label identification model training method and a dialogue text label identification method. BACKGROUND
[0002] At present, in order to predict the label (intention) of the dialogue content between the user and the customer service, the commonly used method is to use LSTM (Long Short-Term Memory) time series modeling to obtain a prediction result through multiple iterations of LSTM, and use the last iteration result as the label prediction result.
[0003] However, the above method has the following technical problems: using LSTM time series modeling cannot predict the label of the dialogue content between the user and the customer service in parallel, and has the problem of gradient explosion, resulting in low accuracy of the label prediction result. SUMMARY
[0004] The summary of the present disclosure is used to introduce the concepts in a brief form, which will be described in detail in the specific embodiments part. The summary of the present disclosure is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.
[0005] Some embodiments of the present disclosure propose a dialogue text label identification model training method, a dialogue text label identification method, an apparatus, an electronic device and a computer readable medium to solve one or more of the technical problems mentioned in the background section.
[0006] In a first aspect, some embodiments of the present disclosure provide a dialogue text label identification model training method, which comprises: obtaining a labeled dialogue text group of a target field, wherein the labeled dialogue text in the labeled dialogue text group comprises a dialogue information sequence; for each labeled dialogue text in the labeled dialogue text group, according to each dialogue role corresponding to the dialogue information sequence included in the labeled dialogue text, performing identification processing on the dialogue information sequence included in the labeled dialogue text to generate an identified labeled dialogue text as a labeled dialogue sample; and based on each generated labeled dialogue sample, training a pre-trained dialogue text label identification model to obtain a trained pre-trained dialogue text label identification model as a dialogue text label identification model.
[0007] Optionally, the dialogue roles in each of the dialogue roles correspond to dialogue information in each of the dialogue information sequences; and for each of the dialogue roles corresponding to the dialogue information sequences included in the annotated dialogue text, the dialogue information sequences included in the annotated dialogue text are identified to generate an identified annotated dialogue text as an annotated dialogue sample, including: clustering the dialogue information sequences according to the dialogue roles to generate dialogue information group sequences; for each dialogue information group in the dialogue information group sequences, performing the following processing steps: determining a role identifier of a dialogue role corresponding to the dialogue information group, wherein the dialogue information in the dialogue information group has an arrangement order; adding the role identifier at the beginning of the dialogue information group to update the dialogue information group; adding a dialogue segmentation identifier between each two dialogue information in the updated dialogue information group; and determining the annotated dialogue text sample after the addition as an identified dialogue text sample.
[0008] Optionally, the annotated dialogue text set of the target domain is obtained by: obtaining a set of dialogue texts to be annotated in the target domain; performing desensitization processing on the set of dialogue texts to be annotated to generate a set of desensitized dialogue texts to be annotated; performing data cleaning processing on the set of desensitized dialogue texts to be annotated to generate a set of cleaned dialogue texts to be annotated; performing annotation processing on each cleaned dialogue text to be annotated in the set of cleaned dialogue texts to generate a cleaned annotated dialogue text, thereby obtaining a set of cleaned annotated dialogue texts; and performing data verification processing on the set of cleaned annotated dialogue texts to obtain a set of cleaned annotated dialogue texts after data verification as the annotated dialogue text set.
[0009] Optionally, the data verification processing on the set of cleaned annotated dialogue texts to obtain a set of cleaned annotated dialogue texts after data verification as the annotated dialogue text set includes: generating a set of sets of cleaned annotated dialogue texts according to a set of preset random number seeds and the set of cleaned annotated dialogue texts, wherein each random number seed in the set of random number seeds is different, and each random number seed in the set of random number seeds corresponds to a set of cleaned annotated dialogue texts in the set of sets of cleaned annotated dialogue texts; for each set of cleaned annotated dialogue texts in the set of sets of cleaned annotated dialogue texts, generating a prediction result corresponding to the set of cleaned annotated dialogue texts according to the set of cleaned annotated dialogue texts and an initial dialogue text prediction model; and in response to each prediction result satisfying a preset verification condition, determining the set of cleaned annotated dialogue texts as the annotated dialogue text set.
[0010] Optionally, the generating, according to the set of cleaned and labeled dialogue texts and the initial dialogue text prediction model, a prediction result corresponding to the set of cleaned and labeled dialogue texts, comprises: for each cleaned and labeled dialogue text in the set of cleaned and labeled dialogue texts, performing the following processing steps: determining the cleaned and labeled dialogue text as a test dialogue text; training the initial dialogue text prediction model based on a set of training labeled dialogue texts to obtain a trained initial dialogue text prediction model as a dialogue text prediction model, wherein the set of training labeled dialogue texts is each cleaned and labeled dialogue text in the set of cleaned and labeled dialogue texts except the cleaned and labeled dialogue text; inputting the test dialogue text into the dialogue text prediction model to obtain a test dialogue text prediction result; and combining each test dialogue text prediction result generated to obtain the prediction result.
[0011] Optionally, the generating, according to the set of cleaned and labeled dialogue texts and the set of random number seeds, a set of sets of cleaned and labeled dialogue texts, comprises: based on each random number seed in the set of random number seeds, dividing the set of cleaned and labeled dialogue texts by the random number seed to generate a set of cleaned and labeled dialogue texts; and determining each set of cleaned and labeled dialogue texts generated as a set of sets of cleaned and labeled dialogue texts.
[0012] Optionally, the training, based on each labeled dialogue sample generated, the pre-trained dialogue text label identification model to obtain a trained dialogue text label identification model as a dialogue text label identification model, comprises: selecting a labeled dialogue sample from the labeled dialogue samples, wherein the labeled dialogue sample comprises a dialogue sample and a dialogue label corresponding to the dialogue sample; adding a first identifier to a starting position of the dialogue sample and adding a second identifier to an ending position of the dialogue sample; performing position encoding processing on the dialogue sample added to generate a dialogue sample vector; inputting the dialogue sample vector into the pre-trained dialogue text label identification model to obtain a dialogue text label identification result; determining a loss value of the dialogue text label identification result and the dialogue label; and in response to the loss value being greater than a preset loss value, adjusting network parameters of the pre-trained dialogue text label identification model.
[0013] Optionally, the method further comprises: in response to the loss value being less than or equal to a preset loss value, determining the pre-trained dialogue text label identification model trained as a dialogue text label identification model.
[0014] Optionally, the pre-trained dialogue text label identification model comprises an encoding network, a first mapping model, a second mapping model, a third mapping model, and a fourth mapping model, the encoding network comprises a first encoding network, a second encoding network, a third encoding network, and a fourth encoding network, and the inputting of the dialogue sample vector into the pre-trained dialogue text label identification model to obtain a dialogue text label identification result comprises: inputting the dialogue sample vector into the first encoding network to obtain a first encoded dialogue text sample vector; inputting the first encoded dialogue text sample vector into the first mapping model to obtain a first dialogue text label identification result; inputting the first encoded dialogue text sample vector into the second encoding network to obtain a second encoded dialogue text sample vector; inputting the second encoded dialogue text sample vector into the second mapping model to obtain a second dialogue text label identification result; inputting the second encoded dialogue text sample vector into the third encoding network to obtain a third encoded dialogue text sample vector.
[0015] Optionally, the inputting of the dialogue sample vector into the pre-trained dialogue text label identification model to obtain a dialogue text label identification result further comprises: inputting the third encoded dialogue text sample vector into the third mapping model to obtain a third dialogue text label identification result; inputting the third encoded dialogue text sample vector into the fourth encoding network to obtain a fourth encoded dialogue text sample vector; inputting the fourth encoded dialogue text sample vector into the fourth mapping model to obtain a fourth dialogue text label identification result; and combining the first dialogue text label identification result, the second dialogue text label identification result, the third dialogue text label identification result, and the fourth dialogue text label identification result into a dialogue text label identification result.
[0016] Optionally, the pre-trained dialogue text label identification model is obtained by the following steps: selecting a dialogue text sample from a dialogue text sample set; adding a first identifier to a starting position of the dialogue text sample and adding a second identifier to an ending position of the dialogue text sample; performing position encoding processing on the dialogue text sample to which the first identifier and the second identifier are added to generate a dialogue text sample vector; inputting the dialogue text sample vector into an initial dialogue text label identification model to obtain a dialogue text label identification result; and adjusting network parameters of the initial dialogue text label identification model based on the dialogue text label identification result.
[0017] In a second aspect, some embodiments of the present disclosure provide a dialogue text label identification method, which comprises: obtaining target dialogue text; inputting the target dialogue text into a pre-trained dialogue text label identification model to obtain dialogue text labels, wherein the dialogue text label identification model is generated by the method described in any of the implementations of the first aspect.
[0018] In a third aspect, some embodiments of the present disclosure provide a dialogue text label identification model training apparatus, which comprises: an obtaining unit configured to obtain a set of annotated dialogue texts of a target domain, wherein each annotated dialogue text in the set of annotated dialogue texts comprises a sequence of dialogue information; an identifying unit configured to, for each annotated dialogue text in the set of annotated dialogue texts, perform identification processing on the sequence of dialogue information included in the annotated dialogue text according to respective dialogue roles corresponding to the sequence of dialogue information, to generate an identified annotated dialogue text as an annotated dialogue sample; and a training unit configured to train a pre-trained dialogue text label identification model based on the generated annotated dialogue samples to obtain a trained pre-trained dialogue text label identification model as a dialogue text label identification model.
[0019] Optionally, each dialogue role in the respective dialogue roles corresponds to dialogue information in the sequence of dialogue information.
[0020] Optionally, the identifying unit is further configured to: perform clustering processing on the sequence of dialogue information according to the respective dialogue roles to generate a sequence of dialogue information groups; and for each dialogue information group in the sequence of dialogue information groups, perform the following processing steps: determine a role identifier of a dialogue role corresponding to the dialogue information group, wherein the dialogue information in the dialogue information group has an arrangement order; add the role identifier at a starting position of the dialogue information group to update the dialogue information group; add a dialogue segmentation identifier between each two dialogue information in the updated dialogue information group; and determine the annotated dialogue text sample after the addition as the identified dialogue text sample.
[0021] Optionally, the obtaining unit is further configured to: obtain a set of to-be-annotated dialogue texts of the target domain; perform desensitization processing on the set of to-be-annotated dialogue texts to generate a set of desensitized to-be-annotated dialogue texts; perform data cleaning processing on the set of desensitized to-be-annotated dialogue texts to generate a set of cleaned to-be-annotated dialogue texts; perform annotation processing on each cleaned to-be-annotated dialogue text in the set of cleaned to-be-annotated dialogue texts to generate a cleaned annotated dialogue text, thereby obtaining a set of cleaned annotated dialogue texts; and perform data verification processing on the set of cleaned annotated dialogue texts to obtain a set of data-verified cleaned annotated dialogue texts as the set of annotated dialogue texts.
[0022] Optionally, the obtaining unit is further configured to: generate a set of sets of cleaned and labeled dialogue text groups according to the set of preset random number seeds and the set of cleaned and labeled dialogue texts, wherein each random number seed in the set of random number seeds is different, and each random number seed in the set of random number seeds corresponds to a set of cleaned and labeled dialogue texts in the set of sets of cleaned and labeled dialogue text groups; for each set of cleaned and labeled dialogue texts in the set of sets of cleaned and labeled dialogue text groups, generate a prediction result corresponding to the set of cleaned and labeled dialogue texts according to the set of cleaned and labeled dialogue texts and the initial dialogue text prediction model; and in response to each generated prediction result satisfying a preset checking condition, determine the set of cleaned and labeled dialogue texts as a set of labeled dialogue text groups.
[0023] Optionally, the obtaining unit is further configured to: for each cleaned and labeled dialogue text group in the set of cleaned and labeled dialogue text groups, perform the following processing steps: determine the cleaned and labeled dialogue text group as a test dialogue text group; train the initial dialogue text prediction model based on a set of training labeled dialogue text groups to obtain a trained initial dialogue text prediction model as a dialogue text prediction model, wherein the set of training labeled dialogue text groups is each cleaned and labeled dialogue text group in the set of cleaned and labeled dialogue text groups except the cleaned and labeled dialogue text group; input the test dialogue text group into the dialogue text prediction model to obtain a test dialogue text prediction result; and combine each generated test dialogue text prediction result into a prediction result.
[0024] Optionally, the obtaining unit is further configured to: based on each random number seed in the set of random number seeds, divide the set of cleaned and labeled dialogue texts by the random number seed to generate a set of cleaned and labeled dialogue text groups; and determine each generated set of cleaned and labeled dialogue text groups as a set of sets of cleaned and labeled dialogue text groups.
[0025] Optionally, the training unit is further configured to: select a labeled dialogue sample from each labeled dialogue sample, wherein the labeled dialogue sample includes a dialogue sample and a dialogue label corresponding to the dialogue sample; add a first identifier to a start position of the dialogue sample and a second identifier to an end position of the dialogue sample; perform position encoding processing on the added dialogue sample to generate a dialogue sample vector; input the dialogue sample vector into the pre-trained dialogue text label identification model to obtain a dialogue text label identification result; determine a loss value of the dialogue text label identification result and the dialogue label; and in response to the loss value being greater than a preset loss value, adjust network parameters of the pre-trained dialogue text label identification model.
[0026] Optionally, the apparatus further comprises a determining unit configured to determine the trained pre-trained dialogue text label recognition model as the dialogue text label recognition model in response to the loss value being less than or equal to a preset loss value.
[0027] Optionally, the pre-trained dialogue text label recognition model comprises an encoding network, a first mapping model, a second mapping model, a third mapping model, and a fourth mapping model, and the encoding network comprises a first encoding network, a second encoding network, a third encoding network, and a fourth encoding network.
[0028] Optionally, the training unit is further configured to input the dialogue sample vector into the first encoding network to obtain a first encoded dialogue text sample vector, input the first encoded dialogue text sample vector into the first mapping model to obtain a first dialogue text label recognition result, input the first encoded dialogue text sample vector into the second encoding network to obtain a second encoded dialogue text sample vector, input the second encoded dialogue text sample vector into the second mapping model to obtain a second dialogue text label recognition result, and input the second encoded dialogue text sample vector into the third encoding network to obtain a third encoded dialogue text sample vector.
[0029] Optionally, the training unit is further configured to input the third encoded dialogue text sample vector into the third mapping model to obtain a third dialogue text label recognition result, input the third encoded dialogue text sample vector into the fourth encoding network to obtain a fourth encoded dialogue text sample vector, input the fourth encoded dialogue text sample vector into the fourth mapping model to obtain a fourth dialogue text label recognition result, and combine the first dialogue text label recognition result, the second dialogue text label recognition result, the third dialogue text label recognition result, and the fourth dialogue text label recognition result as a dialogue text label recognition result.
[0030] Optionally, the pre-trained dialogue text label recognition model is trained by the following steps: selecting a dialogue text sample from a dialogue text sample set, adding a first identifier to a starting position of the dialogue text sample and adding a second identifier to an ending position of the dialogue text sample, performing position encoding processing on the dialogue text sample after the adding to generate a dialogue text sample vector, inputting the dialogue text sample vector into an initial dialogue text label recognition model to obtain a dialogue text label recognition result, and adjusting network parameters of the initial dialogue text label recognition model based on the dialogue text label recognition result.
[0031] In a fourth aspect, some embodiments of the present disclosure provide a dialogue text label identification apparatus. The apparatus comprises: a text acquisition unit configured to acquire target dialogue text; an input unit configured to input the target dialogue text into a pre-trained dialogue text label identification model to obtain dialogue text labels, wherein the dialogue text label identification model is generated by the method described in any of the implementations of the first aspect.
[0032] In a fifth aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the implementations of the first aspect or the second aspect.
[0033] In a sixth aspect, some embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program is executed by a processor to implement the method described in any of the implementations of the first aspect or the second aspect.
[0034] The above various embodiments of the present disclosure have the following beneficial effects: The dialogue text label identification model training method of some embodiments of the present disclosure improves the accuracy of label prediction results. Specifically, the reason for the low accuracy of label prediction results is that using LSTM time series modeling cannot predict the labels of the dialogue content between the user and the customer service in parallel, and there is a problem of gradient explosion, which causes the low accuracy of label prediction results. Based on this, the dialogue text label identification model training method of some embodiments of the present disclosure first acquires a set of labeled dialogue texts of a target domain. The labeled dialogue texts in the set of labeled dialogue texts comprise dialogue information sequences. Thus, the dialogue text of the target domain can be used to optimize the model. Then, for each labeled dialogue text in the set of labeled dialogue texts, according to each dialogue role corresponding to the dialogue information sequence included in the labeled dialogue text, the dialogue information sequence included in the labeled dialogue text is processed to generate a labeled dialogue sample as a labeled dialogue sample. Thus, multiple dialogue information included in the dialogue text can be constructed, so that multiple dialogue information can be predicted in parallel in the subsequent training process. Finally, based on each generated labeled dialogue sample, a pre-trained dialogue text label identification model is trained to obtain a trained pre-trained dialogue text label identification model as a dialogue text label identification model. Thus, the dialogue text label identification model can be trained using parallel dialogue information, avoiding the problem of gradient explosion and improving the accuracy of label prediction results. BRIEF DESCRIPTION OF DRAWINGS
[0035] The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings. The same or similar components have the same or similar reference labels. It should be understood that the drawings are not necessarily to scale, with emphasis instead being placed upon illustrating the principles of the embodiments of the present disclosure.
[0036] Figure 1 is an architecture diagram of an exemplary system to which some embodiments of the present disclosure can be applied;
[0037] Figure 2 is a flowchart of some embodiments of a dialogue text label recognition model training method according to the present disclosure;
[0038] Figure 3 is a schematic diagram of annotating dialogue samples in a dialogue text label recognition model training method according to the present disclosure;
[0039] Figure 4 is a flowchart of some embodiments of a dialogue text label recognition method according to the present disclosure;
[0040] Figure 5 is a scene schematic diagram of comparative text in a terminal device in a dialogue text label recognition method according to the present disclosure;
[0041] Figure 6 is a structural schematic diagram of some embodiments of a dialogue text label recognition model training apparatus according to the present disclosure;
[0042] Figure 7 is a structural schematic diagram of some embodiments of a dialogue text label recognition apparatus according to the present disclosure;
[0043] Figure 8 is a structural schematic diagram of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0044] Embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings. While several embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be construed as being limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and fully convey the scope of the present disclosure to those skilled in the art. It should be understood that the drawings and embodiments are only for illustrative purposes and are not intended to limit the scope of protection of the present disclosure.
[0045] It should also be noted that, for the sake of brevity, only the portions of the drawings that are necessary for an understanding of the present disclosure have been shown. The embodiments and features of the present disclosure can be combined with each other as long as they do not conflict with each other.
[0046] It should be noted that the terms "first", "second", and the like in the present disclosure are merely used to distinguish different devices, modules or units, and do not imply the sequence or interdependence of the functions performed by these devices, modules or units.
[0047] It should be noted that the terms "one", "multiple" in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that "one" or "multiple" should be understood as "one or more" unless the context clearly indicates otherwise.
[0048] The names of the messages or information exchanged between the plurality of devices in the embodiments of the present disclosure are merely for illustrative purposes, and are not intended to limit the scope of the messages or information.
[0049] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0050] Figure 1 An exemplary system architecture 100 of a dialogue text label identification model training method and dialogue text label identification model training device, or a dialogue text label identification method and dialogue text label identification device to which some embodiments of the present disclosure can be applied is shown.
[0051] As shown in Figure 1 , the system architecture 100 can include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is a medium for providing a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0052] A user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0053] The terminal devices 101, 102, 103 can be hardware or software. When the terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens and supporting information display, including but not limited to smartphones, tablet computers, e-book readers, laptop computers and desktop computers, etc. When the terminal devices 101, 102, 103 are software, they can be installed in the above-mentioned electronic devices. They can be implemented as, for example, multiple software or software modules for providing distributed services, or as a single software or software module. No specific limitation is made herein.
[0054] The server 105 can be a server that provides various services, such as a background server that provides support for information displayed on the terminal devices 101, 102, 103. The background server can analyze and process received request data and the like, and feed back the processing results to the terminal devices.
[0055] It should be noted that the dialogue text label identification model training method or dialogue text label identification method provided by the embodiments of the present disclosure can be executed by the terminal devices 101, 102, 103, or by the server 105. Correspondingly, the dialogue text label identification model training or dialogue text label identification apparatus can be arranged in the terminal devices 101, 102, 103, or in the server 105. No specific limitation is made herein.
[0056] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software or software modules, such as a distributed service, or as a single software or software module. No specific limitation is made herein.
[0057] It should be understood that Figure 1 The number of terminal devices, networks, and servers in may be merely illustrative. Depending on the implementation needs, there can be any number of terminal devices, networks, and servers.
[0058] With reference to Figure 2 , a flow 200 of some embodiments of the dialogue text label identification model training method according to the present disclosure is shown. The dialogue text label identification model training method includes the following steps:
[0059] In step 201, a set of annotated dialogue texts of a target domain is obtained.
[0060] In some embodiments, the execution subject of the dialogue text label identification model training method (for example Figure 1The server (as shown) can obtain a set of annotated dialogue texts of a target domain from the terminal device through a wired connection or a wireless connection. The annotated dialogue texts in the set of annotated dialogue texts include dialogue information sequences. The target domain can refer to a domain of a dialogue between a target user and a server user. The target user can refer to a user of a logistics site (store). For example, the target user can refer to a store merchant user. For example, the server user can refer to a customer service personnel. The dialogue information sequence can refer to a dialogue sequence of question consultation between the target user and the server user within a certain time period. The annotated dialogue text can be a dialogue text annotated with a dialogue label. The dialogue label can be a label representing the intention of the dialogue text. Here, the dialogue label can be composed of multiple levels of intention. For example, the multiple levels of intention can include a first level of intention, a second level of intention, and a third level of intention. The first level of intention can include multiple second levels of intention. The second level of intention can include multiple third levels of intention. The first level of intention can represent a category to which the content of the dialogue text belongs. The second level of intention can represent a question category to which the content of the dialogue text belongs. The third level of intention can represent a specific question involved in the content of the dialogue text. For example, the dialogue label can be: opening a store and joining (first level of intention)-joining application (second level of intention)-unclear operation flow of the joining application (third level of intention). The annotated dialogue text in the set of annotated dialogue texts corresponds to a dialogue channel. The dialogue channel can refer to a communication channel of the dialogue. For example, the dialogue channel can be a telephone communication channel, and can also be an online communication channel.
[0061] It can be understood that training the pre-trained dialogue text label recognition model using annotated dialogue texts of different dialogue channels helps to improve the accuracy of the trained model in recognizing dialogue text labels of dialogue texts of different dialogue channels. For example, dialogue texts of a telephone communication channel usually contain more mood auxiliaries. Therefore, training using dialogue texts of different dialogue channels can improve the robustness of the trained model, so that the trained model can maintain high recognition accuracy when recognizing dialogue texts of different dialogue channels.
[0062] In some optional implementations of some embodiments, the execution subject can obtain a set of annotated dialogue texts of a target domain by the following steps:
[0063] First, a set of to-be-labeled dialogue texts of a target domain is obtained. The to-be-labeled dialogue text can refer to a dialogue text in the target domain that has not been processed.
[0064] Second, desensitization processing is performed on the set of to-be-labeled dialogue texts to generate a set of desensitized to-be-labeled dialogue texts. Here, desensitization processing can refer to removing sensitive information from the to-be-labeled dialogue text. Here, the sensitive information can represent personal information of a user. For example, the sensitive information can include but is not limited to: a contact phone number, an address, an email address, and a username.
[0065] The third step is to perform data cleaning processing on the above desensitized to-be-labeled dialogue text set to generate a cleaned to-be-labeled dialogue text set. Here, the data cleaning processing can refer to filtering the desensitized to-be-labeled dialogue text in the above desensitized to-be-labeled dialogue text set that does not meet the preset condition. The preset condition can be that the number of dialogue information included in the dialogue information sequence in the desensitized to-be-labeled dialogue text is less than or equal to a preset number, or the corresponding dialogue roles in the above dialogue information sequence are the same. Here, the setting of the preset number is not limited. For example, the preset number can be 3.
[0066] The fourth step is to perform labeling processing on each cleaned to-be-labeled dialogue text in the above cleaned to-be-labeled dialogue text set to generate a cleaned labeled dialogue text, thereby obtaining a cleaned labeled dialogue text set. In practice, for each cleaned to-be-labeled dialogue text in the above cleaned to-be-labeled dialogue text set, a dialogue label can be added to the above cleaned to-be-labeled dialogue text to generate a cleaned labeled dialogue text.
[0067] The fifth step is to perform data verification processing on the above cleaned labeled dialogue text set to obtain a data-verified cleaned labeled dialogue text set as a labeled dialogue text group.
[0068] In practice, the above fifth step can include the following sub-steps:
[0069] The first sub-step is to generate a cleaned labeled dialogue text group set according to a preset random number seed group and the above cleaned labeled dialogue text set. Each random number seed in the above random number seed group is different, and the random number seed in the above random number seed group corresponds to a cleaned labeled dialogue text group set in the above cleaned labeled dialogue text group set.
[0070] In practice, the above first sub-step can include the following steps:
[0071] 1. Based on each random number seed in the above random number seed group, the above cleaned labeled dialogue text set is divided by the above random number seed to generate a cleaned labeled dialogue text group set. First, the above cleaned labeled dialogue text set can be shuffled by the above random number seed. Then, the shuffled cleaned labeled dialogue text set can be randomly divided into a target number of cleaned labeled dialogue text groups as a cleaned labeled dialogue text group set. Here, the setting of the target number is not limited.
[0072] 2. Each generated cleaned labeled dialogue text group set is determined as a cleaned labeled dialogue text group set group.
[0073] A second sub-step, for each of the set of cleaned and labeled dialogue text groups, generating a prediction result corresponding to the cleaned and labeled dialogue text group according to the cleaned and labeled dialogue text group and the initial dialogue text prediction model.
[0074] In practice, the second sub-step can include the following steps:
[0075] 1. For each of the set of cleaned and labeled dialogue text groups, the following processing steps are performed:
[0076] First, the cleaned and labeled dialogue text group is determined as a test dialogue text group.
[0077] Second, based on the set of training and labeled dialogue text groups, the initial dialogue text prediction model is trained to obtain a trained initial dialogue text prediction model as a dialogue text prediction model. The set of training and labeled dialogue text groups is each of the set of cleaned and labeled dialogue text groups except the cleaned and labeled dialogue text group. Here, the initial dialogue text prediction model can be a model for identifying dialogue text labels. For example, the initial dialogue text prediction model can be a Transformer model or a Bert model. In practice, first, the network structure of the initial dialogue text prediction model is determined and the network parameters of the initial dialogue text prediction model are initialized. Then, the dialogue information sequence included in the set of training and labeled dialogue text groups is taken as the input of the initial dialogue text prediction model, and the dialogue label included in the set of training and labeled dialogue text groups is taken as the expected output of the initial dialogue text prediction model, and the initial dialogue text prediction model is trained using a deep learning method. Finally, the trained initial dialogue text prediction model can be used as a dialogue text prediction model.
[0078] Third, the test dialogue text group is input into the dialogue text prediction model to obtain a test dialogue text prediction result.
[0079] 2. The generated test dialogue text prediction results are combined into a prediction result.
[0080] A third sub-step, in response to each of the generated prediction results satisfying a preset verification condition, the set of cleaned and labeled dialogue text groups is determined as a labeled dialogue text group. The preset verification condition can be that each of the generated prediction results is the same.
[0081] Thus, unstable labeled dialogue text in the set of labeled dialogue text can be detected to improve the quality of the labeled dialogue text.
[0082] In step 202, for each annotated dialogue text in the set of annotated dialogue texts, the sequence of dialogue information included in the annotated dialogue text is processed according to the respective dialogue roles corresponding to the sequence of dialogue information included in the annotated dialogue text, to generate an annotated dialogue text after identification as an annotated dialogue sample.
[0083] In some embodiments, for each annotated dialogue text in the set of annotated dialogue texts, the execution subject can process the sequence of dialogue information included in the annotated dialogue text according to the respective dialogue roles corresponding to the sequence of dialogue information included in the annotated dialogue text, to generate an annotated dialogue text after identification as an annotated dialogue sample. Here, the dialogue information in the sequence of dialogue information corresponds to a dialogue role in the respective dialogue roles. The dialogue role can refer to an output party outputting the dialogue information. Here, the output party can represent a store merchant user or a customer service personnel.
[0084] In practice, according to the respective dialogue roles corresponding to the sequence of dialogue information included in the annotated dialogue text, the execution subject can process the sequence of dialogue information included in the annotated dialogue text by the following steps to generate an annotated dialogue text after identification as an annotated dialogue sample:
[0085] First, the respective dialogue roles are processed to obtain a set of de-duplicated dialogue roles.
[0086] Second, the role identifier of each de-duplicated dialogue role in the set of de-duplicated dialogue roles is determined. For each de-duplicated dialogue role in the set of de-duplicated dialogue roles, a role identifier representing the de-duplicated dialogue role is selected from a pre-stored set of role identifiers.
[0087] Third, the role identifier corresponding to each dialogue information in the sequence of dialogue information included in the annotated dialogue text is added before the dialogue information to update the annotated dialogue text.
[0088] Fourth, for each dialogue information in the sequence of dialogue information included in the updated annotated dialogue text that is continuous and corresponds to the same role identifier, the role identifier corresponding to the dialogue information other than the first dialogue information is removed to update the updated annotated dialogue text. For example, as shown in the following table, the sequence of dialogue information included in the updated annotated dialogue text can be: “[User 99] Hello, I want to transfer to a human [User 98] Hello, human customer service**, I am glad to serve you! Hello, you said [User 99] Home furnishing materials need to be audited? How many types of trademarks are required for home furnishing materials [User 98] Oh, need”. [User 99] and [User 98] can represent different role identifiers. Figure 3
[0089] In the fifth step, the updated annotated dialogue text is determined as the annotated dialogue sample.
[0090] In some optional implementations of some embodiments, according to the respective dialogue roles corresponding to the dialogue information sequences included in the annotated dialogue text, the dialogue information sequences included in the annotated dialogue text are processed by the following steps to generate the annotated dialogue text after identification as the annotated dialogue sample:
[0091] In the first step, according to the respective dialogue roles, the dialogue information sequences are clustered to generate dialogue information group sequences. In practice, each dialogue information in the dialogue information sequences that is sequentially connected and has the same corresponding dialogue role is clustered into a category. Thus, the dialogue information group sequences are obtained.
[0092] In the second step, for each dialogue information group in the dialogue information group sequences, the following processing steps are performed:
[0093] In the first processing step, the role identification of the dialogue role corresponding to the dialogue information group is determined. The dialogue information in the dialogue information group has an arrangement order.
[0094] In the second processing step, the role identification is added at the starting position of the dialogue information group to update the dialogue information group.
[0095] In the third processing step, dialogue segmentation identification is added between each two dialogue information in the updated dialogue information group. Here, the dialogue segmentation identification can be an identifier used to segment two dialogue sentences.
[0096] In the third step, the annotated dialogue text sample after the addition is determined as the identified dialogue text sample.
[0097] Optionally, a communication mode identification can be added before the dialogue information group sequences included in the identified dialogue text sample. Here, the communication mode identification can represent the mode of dialogue communication. For example, the mode of dialogue communication can be telephone communication or online text communication.
[0098] In step 203, based on the generated respective annotated dialogue samples, the pre-trained dialogue text label identification model is trained to obtain the trained pre-trained dialogue text label identification model as the dialogue text label identification model.
[0099] In some embodiments, the aforementioned execution entity can train a pre-trained dialogue text labeling recognition model based on the generated labeled dialogue samples, obtaining the trained pre-trained dialogue text labeling recognition model as the dialogue text labeling recognition model. Here, the pre-trained dialogue text labeling recognition model can refer to a neural network model trained under self-supervised conditions using unlabeled dialogue text. For example, the neural network model can refer to a Transformer model. The Transformer model can include multiple layers of self-attention mechanisms.
[0100] In practice, based on the generated labeled dialogue samples, the aforementioned execution entity can train the pre-trained dialogue text label recognition model through the following steps to obtain the trained pre-trained dialogue text label recognition model as the dialogue text label recognition model:
[0101] The first step is to perform positional encoding on the dialogue information sequence included in each of the above-mentioned labeled dialogue samples to generate a labeled dialogue sample vector, thus obtaining a labeled dialogue sample vector group. Here, positional encoding can refer to relative positional encoding. For example, relative positional encoding can be Rotational Positional Encoding (RoPE).
[0102] The second step is to determine the network structure of the pre-trained dialogue text label recognition model and initialize its network parameters.
[0103] The third step involves using the above-mentioned annotated dialogue sample vector group as the input to the above-mentioned pre-trained dialogue text label recognition model, and using the dialogue labels included in each of the above-mentioned annotated dialogue samples as the expected output of the above-mentioned pre-trained dialogue text label recognition model, and then using deep learning methods to train the above-mentioned pre-trained dialogue text label recognition model.
[0104] The fourth step is to determine the pre-trained dialogue text label recognition model as the aforementioned dialogue text label recognition model.
[0105] In some optional implementations of certain embodiments, based on the generated labeled dialogue samples, the aforementioned execution entity may further train the pre-trained dialogue text label recognition model through the following steps to obtain the trained pre-trained dialogue text label recognition model as the dialogue text label recognition model:
[0106] In a first step, a dialogue sample is selected from the dialogue samples described above. The dialogue samples described above include dialogue samples and dialogue labels corresponding to the dialogue samples. The dialogue sample can represent a sequence of dialogue information after identification. For example, the dialogue sample can be "[User 99] Hello, I want to transfer to an artificial person [User 98] Hello, artificial customer service, I am very glad to serve you! Hello, you said [User 99] Do I need to recruit and audit for home decoration materials? How many types of trademarks are required for home decoration materials [User 98] Oh, you need it."
[0107] In a second step, a first mark is added to the beginning of the dialogue sample, and a second mark is added to the end of the dialogue sample. Here, the first mark can be used to mark the beginning of the dialogue sample. The second mark can be used to mark the end of the dialogue sample. Here, the first mark and the second mark are not limited. For example, the first mark can be [CLS], and the second mark can be [EOS].
[0108] In a third step, the dialogue sample after the addition is subjected to position encoding processing to generate a dialogue sample vector. Here, the position encoding processing can refer to relative position encoding processing. For example, the relative position encoding processing can be RoPE encoding processing (rotational position encoding).
[0109] In a fourth step, the dialogue sample vector is input into the pre-trained dialogue text label identification model to obtain a dialogue text label identification result. The pre-trained dialogue text label identification model includes an encoding network, a first mapping model, a second mapping model, a third mapping model, and a fourth mapping model. The encoding network includes a first encoding network, a second encoding network, a third encoding network, and a fourth encoding network. The first encoding network, the second encoding network, the third encoding network, and the fourth encoding network can be self-attention mechanism networks.
[0110] In practice, the fourth step can include the following sub-steps:
[0111] In a first sub-step, the dialogue sample vector is input into the first encoding network to obtain a first encoded dialogue text sample vector.
[0112] In a second sub-step, the first encoded dialogue text sample vector is input into the first mapping model to obtain a first dialogue text label identification result. Here, the first mapping model can be a multiplication formula of the first encoded dialogue text sample vector and a set linear mapping matrix. The first dialogue text label identification result can represent a first-level intent. The first-level intent can represent a category to which the content of the dialogue text belongs.
[0113] Third sub-step, input the first encoded dialogue text sample vector into the second encoding network to obtain a second encoded dialogue text sample vector.
[0114] Fourth sub-step, input the second encoded dialogue text sample vector into the second mapping model to obtain a second dialogue text label recognition result. Here, the second mapping model can be a multiplication formula of the second encoded dialogue text sample vector and a set linear mapping matrix. The second dialogue text label recognition result can represent a secondary intent. The secondary intent can represent a problem category to which the content of the dialogue text belongs.
[0115] Fifth sub-step, input the second encoded dialogue text sample vector into the third encoding network to obtain a third encoded dialogue text sample vector.
[0116] Sixth sub-step, input the third encoded dialogue text sample vector into the third mapping model to obtain a third dialogue text label recognition result. Here, the third mapping model can be a multiplication formula of the third encoded dialogue text sample vector and a set linear mapping matrix. The third dialogue text label recognition result can represent a tertiary intent. The tertiary intent can represent a specific problem involved in the content of the dialogue text.
[0117] Seventh sub-step, input the third encoded dialogue text sample vector into the fourth encoding network to obtain a fourth encoded dialogue text sample vector.
[0118] Eighth sub-step, input the fourth encoded dialogue text sample vector into the fourth mapping model to obtain a fourth dialogue text label recognition result. Here, the fourth mapping model can be a multiplication formula of the fourth encoded dialogue text sample vector and a set linear mapping matrix. The fourth dialogue text label recognition result can represent: a primary intent, a secondary intent, and a tertiary intent.
[0119] Ninth sub-step, combine the first dialogue text label recognition result, the second dialogue text label recognition result, the third dialogue text label recognition result, and the fourth dialogue text label recognition result into a dialogue text label recognition result
[0120] Fifth step, determine the loss value of the dialogue text label recognition result and the dialogue label. In practice, the loss value of the fourth dialogue text label recognition result included in the dialogue text label recognition result and the dialogue label can be determined by a pre-trained loss function. The loss function can include but is not limited to: mean square error loss function (MSE), hinge loss function (SVM), cross-entropy loss function (CrossEntropy), etc.
[0121] In the sixth step, in response to the loss value being greater than the preset loss value, the network parameters of the pre-trained dialogue text label recognition model are adjusted. Here, the determination of the preset loss value is not limited. For example, the loss value and the preset loss value can be subtracted to obtain a loss difference value. On this basis, the loss difference value is propagated from the last layer of the model to the front layer by using the back propagation, stochastic gradient descent and the like, so as to adjust the parameters of each layer. Of course, according to the needs, the network freezing (dropout) method can also be used to keep the network parameters of some layers unchanged and not adjusted, and no limitation is made to this.
[0122] Optionally, in response to the loss value being less than or equal to the preset loss value, the pre-trained dialogue text label recognition model after training is determined as the dialogue text label recognition model.
[0123] Optionally, the pre-trained dialogue text label recognition model is trained by the following steps:
[0124] In the first step, a dialogue text sample is selected from a dialogue text sample set. Here, the dialogue text sample can be a dialogue information sequence after data cleaning processing, desensitization processing and mask processing. Here, the mask processing can be dynamic mask processing.
[0125] In the second step, a first identifier is added to the starting position of the dialogue text sample, and a second identifier is added to the end position of the dialogue text sample. Here, the first identifier can be used to mark the starting position of the dialogue text. The second identifier can be used to mark the end position of the dialogue text. Here, the first identifier and the second identifier are not limited. For example, the first identifier can be [CLS], and the second identifier can be [EOS].
[0126] In the third step, the dialogue text sample after the addition is subjected to position encoding processing to generate a dialogue text sample vector. Here, the position encoding processing can be relative position encoding processing. For example, the position encoding processing can be RoPE encoding processing (rotational position encoding).
[0127] In the fourth step, the dialogue text sample vector is input into an initial dialogue text label recognition model to obtain a dialogue text label recognition result. Here, the initial dialogue text label recognition model can be a Transformer model containing a multi-layer self-attention mechanism network.
[0128] In the fifth step, based on the dialogue text label recognition result, the network parameters of the initial dialogue text label recognition model are adjusted. In practice, first, the loss value between the dialogue text label recognition result and the mask label corresponding to the dialogue text sample vector can be determined. For example, the loss value can be determined by a log likelihood function. Then, in response to the loss value being greater than or equal to a preset threshold, the difference between the loss value and the preset threshold is obtained to obtain a loss difference value. On this basis, the loss difference value is propagated from the last layer of the model to the front layer by using a back propagation method, a stochastic gradient descent method, or the like, to adjust the parameters of each layer. Of course, according to needs, the network dropout method can also be used to keep the network parameters of some layers unchanged and not adjusted, and no limitation is made in this regard.
[0129] Optionally, in response to the loss value corresponding to the dialogue text label recognition result being less than the preset threshold, the initial dialogue text label recognition model is determined as the pre-trained dialogue text label recognition model.
[0130] It should be noted that the execution subject for training the pre-trained dialogue text label recognition model can be a server as shown in FIG. 8, or other computing devices, which are not limited herein. Figure 1
[0131] The above various embodiments of the present disclosure have the following beneficial effects: The dialogue text label recognition model training method of some embodiments of the present disclosure improves the accuracy of the label prediction result. Specifically, the reason for the low accuracy of the label prediction result is that the LSTM time series modeling cannot predict the labels of the dialogue content between the user and the customer service in parallel, and there is a problem of gradient explosion, which causes the low accuracy of the label prediction result. Based on this, the dialogue text label recognition model training method of some embodiments of the present disclosure first acquires a set of annotated dialogue texts of a target domain. The annotated dialogue texts in the set of annotated dialogue texts include dialogue information sequences. Thus, the model can be optimized by using the dialogue texts of the target domain. Then, for each annotated dialogue text in the set of annotated dialogue texts, the dialogue information sequence included in the annotated dialogue text is identified according to each dialogue role corresponding to the dialogue information sequence, to generate an identified annotated dialogue text as an annotated dialogue sample. Thus, multiple dialogue information included in the dialogue text can be constructed, so that multiple dialogue information can be predicted in parallel in the subsequent training process. Finally, based on the generated annotated dialogue samples, a pre-trained dialogue text label recognition model is trained to obtain a trained pre-trained dialogue text label recognition model as a dialogue text label recognition model. Thus, the dialogue text label recognition model can be trained by using parallel dialogue information, avoiding the problem of gradient explosion, and improving the accuracy of the label prediction result.
[0132] Further referring to Figure 4 , some embodiments of a dialogue text label identification method according to the present disclosure are shown. The dialogue text label identification method includes the following steps:
[0133] Step 401, obtaining target dialogue text.
[0134] In some embodiments, the execution subject (for example Figure 1 the server shown) of the dialogue text label identification method can obtain the target dialogue text from the terminal device through wired connection or wireless connection. Wherein, the target dialogue text can refer to the dialogue text of the target field. For example, please refer to Figure 5 , the above execution subject can obtain the target dialogue text "A: Hello, are you there? 001: Hello, I'm here. Employee 001 is serving you. A: What procedures are needed for opening a store?" from the mobile terminal. Here, A can represent the dialogue role as a user, and 001 can represent the dialogue role as a customer service personnel.
[0135] Step 402, inputting the above target dialogue text into a pre-trained dialogue text label identification model to obtain dialogue text label.
[0136] In some embodiments, the above execution subject can input the above target dialogue text into a pre-trained dialogue text label identification model to obtain dialogue text label. Wherein, the pre-trained dialogue text label identification model can be generated by the dialogue text label identification model training method of some embodiments of the present disclosure.
[0137] As can be seen from Figure 4 , Figure 4 the process 400 in some corresponding embodiments can accurately identify the text label of the dialogue text, which is convenient for pushing information to the user according to the text label.
[0138] Further referring to Figure 6 , as an implementation of the method shown in the above figures, the present disclosure provides some embodiments of a dialogue text label identification model training device, which corresponds to the method embodiments shown in Figure 2 , and the device can be specifically applied in various electronic devices.
[0139] As Figure 6As shown, the dialogue text label identification model training apparatus 600 of some embodiments includes an acquisition unit 601, an identification unit 602, and a training unit 603. The acquisition unit 601 is configured to acquire a set of annotated dialogue texts of a target domain, wherein each annotated dialogue text in the set of annotated dialogue texts comprises a sequence of dialogue information. The identification unit 602 is configured to, for each annotated dialogue text in the set of annotated dialogue texts, perform identification processing on the sequence of dialogue information included in the annotated dialogue text according to respective dialogue roles corresponding to the sequence of dialogue information included in the annotated dialogue text, to generate an identified annotated dialogue text as an annotated dialogue sample. The training unit 603 is configured to train a pre-trained dialogue text label identification model based on the respective annotated dialogue samples generated, to obtain a trained pre-trained dialogue text label identification model as a dialogue text label identification model.
[0140] Optionally, each dialogue role in the respective dialogue roles corresponds to dialogue information in the sequence of dialogue information.
[0141] Optionally, the identification unit 602 is further configured to: perform clustering processing on the sequence of dialogue information according to the respective dialogue roles, to generate a sequence of dialogue information groups; and perform the following processing steps for each dialogue information group in the sequence of dialogue information groups: determine a role identifier of a dialogue role corresponding to the dialogue information group, wherein the dialogue information in the dialogue information group has an arrangement order; add the role identifier at a starting position of the dialogue information group to update the dialogue information group; add a dialogue segmentation identifier between each two dialogue information in the updated dialogue information group; and determine the annotated dialogue text sample after the addition as the identified dialogue text sample.
[0142] Optionally, the acquisition unit 601 is further configured to: acquire a set of to-be-annotated dialogue texts of the target domain; perform desensitization processing on the set of to-be-annotated dialogue texts, to generate a set of desensitized to-be-annotated dialogue texts; perform data cleaning processing on the set of desensitized to-be-annotated dialogue texts, to generate a set of cleaned to-be-annotated dialogue texts; perform annotation processing on each cleaned to-be-annotated dialogue text in the set of cleaned to-be-annotated dialogue texts, to generate a cleaned annotated dialogue text, to obtain a set of cleaned annotated dialogue texts; and perform data verification processing on the set of cleaned annotated dialogue texts, to obtain a set of data-verified cleaned annotated dialogue texts as the set of annotated dialogue texts.
[0143] Optionally, the obtaining unit 601 is further configured to: generate a set of sets of cleaned and labeled dialogue text groups according to a preset set of random number seeds and the set of cleaned and labeled dialogue texts, wherein each random number seed in the set of random number seeds is different, and each random number seed in the set of random number seeds corresponds to a set of cleaned and labeled dialogue texts in the set of sets of cleaned and labeled dialogue text groups; for each set of cleaned and labeled dialogue texts in the set of sets of cleaned and labeled dialogue text groups, generate a prediction result corresponding to the set of cleaned and labeled dialogue texts according to the set of cleaned and labeled dialogue texts and the initial dialogue text prediction model; and in response to each generated prediction result satisfying a preset checking condition, determine the set of cleaned and labeled dialogue texts as a set of labeled dialogue text groups.
[0144] Optionally, the obtaining unit 601 is further configured to: for each cleaned and labeled dialogue text group in the set of cleaned and labeled dialogue text groups, perform the following processing steps: determine the cleaned and labeled dialogue text group as a test dialogue text group; train the initial dialogue text prediction model based on a set of training labeled dialogue text groups to obtain a trained initial dialogue text prediction model as a dialogue text prediction model, wherein the set of training labeled dialogue text groups is each cleaned and labeled dialogue text group in the set of cleaned and labeled dialogue text groups except the cleaned and labeled dialogue text group; input the test dialogue text group into the dialogue text prediction model to obtain a test dialogue text prediction result; and combine each generated test dialogue text prediction result into a prediction result.
[0145] Optionally, the obtaining unit 601 is further configured to: based on each random number seed in the set of random number seeds, divide the set of cleaned and labeled dialogue texts by the random number seed to generate a set of cleaned and labeled dialogue text groups; and determine each generated set of cleaned and labeled dialogue text groups as a set of sets of cleaned and labeled dialogue text groups.
[0146] Optionally, the training unit 603 is further configured to: select a labeled dialogue sample from each labeled dialogue sample, wherein the labeled dialogue sample includes a dialogue sample and a dialogue label corresponding to the dialogue sample; add a first identifier to a start position of the dialogue sample and a second identifier to an end position of the dialogue sample; perform position encoding processing on the added dialogue sample to generate a dialogue sample vector; input the dialogue sample vector into the pre-trained dialogue text label identification model to obtain a dialogue text label identification result; determine a loss value of the dialogue text label identification result and the dialogue label; and in response to the loss value being greater than a preset loss value, adjust network parameters of the pre-trained dialogue text label identification model.
[0147] Optionally, the apparatus 600 further comprises a determining unit configured to determine the trained pre-training dialogue text label recognition model as the dialogue text label recognition model in response to the loss value being less than or equal to a preset loss value.
[0148] Optionally, the pre-training dialogue text label recognition model comprises an encoding network, a first mapping model, a second mapping model, a third mapping model and a fourth mapping model, and the encoding network comprises a first encoding network, a second encoding network, a third encoding network and a fourth encoding network.
[0149] Optionally, the training unit 603 is further configured to input the dialogue sample vector into the first encoding network to obtain a first encoded dialogue text sample vector; input the first encoded dialogue text sample vector into the first mapping model to obtain a first dialogue text label recognition result; input the first encoded dialogue text sample vector into the second encoding network to obtain a second encoded dialogue text sample vector; input the second encoded dialogue text sample vector into the second mapping model to obtain a second dialogue text label recognition result; and input the second encoded dialogue text sample vector into the third encoding network to obtain a third encoded dialogue text sample vector.
[0150] Optionally, the training unit 603 is further configured to input the third encoded dialogue text sample vector into the third mapping model to obtain a third dialogue text label recognition result; input the third encoded dialogue text sample vector into the fourth encoding network to obtain a fourth encoded dialogue text sample vector; input the fourth encoded dialogue text sample vector into the fourth mapping model to obtain a fourth dialogue text label recognition result; and combine the first dialogue text label recognition result, the second dialogue text label recognition result, the third dialogue text label recognition result and the fourth dialogue text label recognition result as the dialogue text label recognition result.
[0151] Optionally, the pre-training dialogue text label recognition model is trained by the following steps: selecting a dialogue text sample from a dialogue text sample set; adding a first identifier to a starting position of the dialogue text sample and adding a second identifier to an ending position of the dialogue text sample; performing position encoding processing on the dialogue text sample after the adding to generate a dialogue text sample vector; inputting the dialogue text sample vector into an initial dialogue text label recognition model to obtain a dialogue text label recognition result; and adjusting network parameters of the initial dialogue text label recognition model based on the dialogue text label recognition result.
[0152] It can be understood that the units described in the apparatus 600 and the reference Figure 2The various steps in the described method correspond. Thus, the operations, features, and advantages described above for the method also apply to the apparatus 600 and the units contained therein, which will not be described again here.
[0153] Further referring to Figure 7 , as an implementation of the method shown in the above figures, the present disclosure provides some embodiments of a dialogue text label recognition device, which device embodiments correspond to those method embodiments shown in Figure 4 , and the device can be specifically applied to various electronic devices.
[0154] As shown in Figure 7 , the dialogue text label recognition device 700 of some embodiments includes a text acquisition unit 701 and an input unit 702. The text acquisition unit 701 is configured to acquire target dialogue text. The input unit 702 is configured to input the target dialogue text into a pre-trained dialogue text label recognition model to obtain a dialogue text label, wherein the dialogue text label recognition model is generated by the dialogue text label recognition model training method of some embodiments of the present disclosure.
[0155] It can be understood that the units described in the device 700 correspond to the various steps in the method described with reference to Figure 4 . Thus, the operations, features, and advantages described above for the method also apply to the apparatus 700 and the units contained therein, which will not be described again here.
[0156] Reference is made below to Figure 8 , which shows a structural schematic diagram of an electronic device (such as a server in Figure 1 ) suitable for implementing some embodiments of the present disclosure. The electronic device in some embodiments of the present disclosure can include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), and the like, as well as fixed terminals such as digital TVs, desktop computers, and the like. Figure 8 The electronic device shown is only an example and should not impose any limitations on the functions and use range of the embodiments of the present disclosure.
[0157] As shown in Figure 8As shown, the electronic device 800 can include a processing device (e.g., a central processor, a graphics processor, etc.) 801 that can perform various suitable actions and processes in accordance with programs stored in a read-only memory (ROM) 802 or loaded into a random access memory (RAM) 803 from a storage device 808. Various programs and data needed in the operation of the electronic device 800 are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0158] Generally, the following devices can be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication devices 809 can allow the electronic device 800 to exchange data with other devices wirelessly or wiredly. Although Figure 8 The electronic device 800 is shown with various devices, but it is understood that all of the shown devices are not required to be implemented or present. More or fewer devices can alternatively be implemented or present. Figure 8 Each block shown in the flowcharts can represent a device or multiple devices as needed.
[0159] In particular, processes described above with reference to the flowcharts can be implemented as a computer software program according to some embodiments of the present disclosure. For example, some embodiments of the present disclosure include a computer program product including a computer program carried on a computer readable medium, the computer program containing program codes for performing the methods shown in the flowcharts. In some such embodiments, the computer program can be downloaded and installed from a network through the communication devices 809, or installed from the storage devices 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-described functions defined in the methods of some embodiments of the present disclosure are performed.
[0160] Note that the computer readable medium in some embodiments of the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination thereof. The computer readable storage medium can be, for example but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the foregoing. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program used by an instruction execution system, apparatus or device, or that can be used by or in connection with an instruction execution system, apparatus or device. In some embodiments of the present disclosure, the computer readable signal medium can include a computer readable program code propagated in or on a carrier medium, in which the computer readable program code is embodied. Such propagated computer readable program code can take many forms, including but not limited to, an electromagnetic signal, an optical signal or any suitable combination of the foregoing. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device. Program code embodied on a computer readable medium can be transmitted using any suitable medium, including but not limited to, wire, cable, wireless, RF, infrared or any suitable combination of the foregoing.
[0161] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.
[0162] The computer readable medium can be included in the electronic device, or can exist separately from the electronic device. The computer readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: obtain a set of annotated dialogue texts of a target field, wherein each annotated dialogue text in the set of annotated dialogue texts comprises a sequence of dialogue information; for each annotated dialogue text in the set of annotated dialogue texts, perform identification processing on the sequence of dialogue information included in the annotated dialogue text according to respective dialogue roles corresponding to the sequence of dialogue information, to generate an identified annotated dialogue text as a dialogue sample; and train a pre-trained dialogue text label identification model based on the generated dialogue samples, to obtain a trained dialogue text label identification model as a dialogue text label identification model.
[0163] or cause the electronic device to: obtain a target dialogue text; and input the target dialogue text into a pre-trained dialogue text label identification model to obtain a dialogue text label, wherein the dialogue text label identification model is generated by the dialogue text label identification model training method of some embodiments of the present disclosure.
[0164] Computer program code for carrying out operations of some embodiments of the present disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0165] The flow and block diagrams in the drawings represent possible architectural, functional, and operational architectures of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block can represent a module, a segment, or a portion of code that comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or combinations of hardware and software.
[0166] The units described in some embodiments of the present disclosure can be implemented by software or by hardware. The described units can also be arranged in a processor, for example, a processor can be described as including an acquisition unit, an identification unit, and a training unit. Among them, the names of these units do not constitute a limitation to the units themselves in some cases, for example, the training unit can also be described as "a unit that generates a pre-trained dialogue text label recognition model based on each labeled dialogue sample, and trains the pre-trained dialogue text label recognition model to obtain a trained pre-trained dialogue text label recognition model as a dialogue text label recognition model".
[0167] The functions described above in the present document can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, example types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
[0168] The above description is merely some of the preferred embodiments of the present disclosure and a description of the principles of the technology used. Those skilled in the art should understand that the scope of the application involved in the embodiments of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combinations of the above technical features or equivalent features without departing from the above inventive concept. For example, the above features are replaced with the technical features disclosed in the embodiments of the present disclosure (but not limited to) having similar functions to form technical solutions.
Claims
1. A method for training a dialogue text tag recognition model, comprising: Obtain a group of annotated dialogue texts in the target domain, wherein the annotated dialogue texts in the group of annotated dialogue texts include a sequence of dialogue information; For each labeled dialogue text in the labeled dialogue text group, the dialogue information sequence included in the labeled dialogue text is marked according to each dialogue role corresponding to the dialogue information sequence included in the labeled dialogue text, so as to generate a marked labeled dialogue text as a labeled dialogue sample. The labeled dialogue sample includes a dialogue sample and a dialogue tag corresponding to the dialogue sample. The dialogue tag is a tag that represents the intent of the dialogue text. Based on the generated labeled dialogue samples, a pre-trained dialogue text label recognition model is trained to obtain the trained pre-trained dialogue text label recognition model as the dialogue text label recognition model. The pre-trained dialogue text label recognition model refers to a neural network model trained under self-supervised conditions using unlabeled dialogue text. The pre-trained dialogue text label recognition model includes: an encoding network, a first mapping model, a second mapping model, a third mapping model, and a fourth mapping model. The encoding network includes: a first encoding network, a second encoding network, a third encoding network, and a fourth encoding network. Select an annotated dialogue sample from each of the annotated dialogue samples, wherein the annotated dialogue sample includes a dialogue sample and a dialogue tag corresponding to the dialogue sample; Add the first identifier to the beginning of the dialogue sample and add the second identifier to the end of the dialogue sample; The added dialogue samples are then subjected to position encoding to generate dialogue sample vectors. The dialogue sample vector is input into the pre-trained dialogue text label recognition model to obtain the dialogue text label recognition result, including: The dialogue sample vector is input into the first encoding network to obtain the first encoded dialogue text sample vector; The first encoded dialogue text sample vector is input into the first mapping model to obtain the first dialogue text label recognition result, wherein the first dialogue text label recognition result represents the first-level intent; The first encoded dialogue text sample vector is input into the second encoding network to obtain the second encoded dialogue text sample vector; The second encoded dialogue text sample vector is input into the second mapping model to obtain the second dialogue text label recognition result, wherein the second dialogue text label recognition result represents the secondary intent; The second encoded dialogue text sample vector is input into the third encoding network to obtain the third encoded dialogue text sample vector; The third encoded dialogue text sample vector is input into the third mapping model to obtain the third dialogue text label recognition result, wherein the third dialogue text label recognition result represents the third level of intent; The third encoded dialogue text sample vector is input into the fourth encoding network to obtain the fourth encoded dialogue text sample vector; The fourth encoded dialogue text sample vector is input into the fourth mapping model to obtain the fourth dialogue text label recognition result, wherein the fourth dialogue text label recognition result represents: first-level intent, second-level intent, and third-level intent; The first dialogue text tag recognition result, the second dialogue text tag recognition result, the third dialogue text tag recognition result, and the fourth dialogue text tag recognition result are combined to form the dialogue text tag recognition result.
2. The method according to claim 1, wherein, The dialogue roles in each dialogue role correspond to the dialogue information in the dialogue information sequence; and The step of identifying the dialogue information sequence in the identified dialogue text according to each dialogue role corresponding to the dialogue information sequence in the identified dialogue text, and generating identified identified dialogue text as an identified dialogue sample, includes: Based on each dialogue role, the dialogue information sequence is clustered to generate a dialogue information group sequence; For each dialogue information group in the sequence of dialogue information groups, the following processing steps are performed: Determine the role identifier of the dialogue character corresponding to the dialogue information group, wherein the dialogue information in the dialogue information group has an order; Add the role identifier at the beginning of the dialogue information group to update the dialogue information group; Add a dialogue separation marker between every two dialogue messages in the updated dialogue message group; The completed annotated dialogue text sample is designated as the identifier dialogue text sample.
3. The method according to claim 1, wherein, The acquisition of labeled dialogue text sets in the target domain includes: Obtain the set of unannotated dialogue texts in the target domain; The text set of dialogues to be labeled is de-identified to generate a de-identified text set of dialogues to be labeled. The desensitized and unannotated dialogue text set is subjected to data cleaning processing to generate a cleaned and unannotated dialogue text set. Each dialogue text to be cleaned and labeled in the set of dialogue texts to be cleaned and labeled is labeled to generate cleaned and labeled dialogue texts, thus obtaining a set of cleaned and labeled dialogue texts. The cleaning and annotation dialogue text set is subjected to data verification processing to obtain the cleaned and annotation dialogue text set after data verification as the annotation dialogue text group.
4. The method according to claim 3, wherein, The step of performing data validation on the cleaned and annotated dialogue text set to obtain the data-validated cleaned and annotated dialogue text set as an annotated dialogue text group includes: Based on the preset random number seed group and the cleaning and annotation dialogue text set, a cleaning and annotation dialogue text set is generated, wherein each random number seed in the random number seed group is different, and the random number seed in the random number seed group corresponds to the cleaning and annotation dialogue text set in the cleaning and annotation dialogue text set. For each cleaned and labeled dialogue text set in the cleaned and labeled dialogue text set group, a prediction result corresponding to the cleaned and labeled dialogue text set is generated based on the cleaned and labeled dialogue text set and the initial dialogue text prediction model. In response to the generated prediction results satisfying the preset verification conditions, the set of cleaned and annotated dialogue texts is determined as an annotated dialogue text group.
5. The method according to claim 4, wherein, The step of generating prediction results corresponding to the cleaned and annotated dialogue text set based on the cleaned and annotated dialogue text set and the initial dialogue text prediction model includes: For each cleaning and annotation dialogue text group in the set of cleaning and annotation dialogue text groups, the following processing steps are performed: The cleaned and labeled dialogue text group is identified as the test dialogue text group; Based on the training labeled dialogue text set, the initial dialogue text prediction model is trained to obtain the trained initial dialogue text prediction model as the dialogue text prediction model. The training labeled dialogue text set is: each clean labeled dialogue text set other than the clean labeled dialogue text set in the clean labeled dialogue text set. The test dialogue text group is input into the dialogue text prediction model to obtain the test dialogue text prediction result; The prediction results of the generated test dialogue texts are combined into a single prediction result.
6. The method according to claim 4, wherein, The step of generating a set of cleaned and labeled dialogue texts based on a preset random number seed set and the cleaned and labeled dialogue text set includes: Based on each random number seed in the random number seed group, the cleaning and annotation dialogue text set is divided by the random number seed to generate a cleaning and annotation dialogue text set. Each generated set of cleaning and annotation dialogue texts is identified as a cleaning and annotation dialogue text set group.
7. The method according to claim 1, wherein, The step of training the pre-trained dialogue text label recognition model based on the generated labeled dialogue samples to obtain the trained pre-trained dialogue text label recognition model as the dialogue text label recognition model also includes: Determine the loss value between the dialogue text tag recognition result and the dialogue tag; In response to the loss value being greater than a preset loss value, the network parameters of the pre-trained dialogue text label recognition model are adjusted.
8. The method according to claim 7, wherein, The method further includes: In response to the loss value being less than or equal to a preset loss value, the pre-trained dialogue text label recognition model is determined as the dialogue text label recognition model.
9. The method according to claim 1, wherein, The pre-trained dialogue text tag recognition model is trained through the following steps: Select dialogue text samples from the dialogue text sample set; Add the first identifier to the beginning of the dialogue text sample and add the second identifier to the end of the dialogue text sample; The added dialogue text samples are subjected to positional encoding to generate dialogue text sample vectors; The dialogue text sample vector is input into the initial dialogue text label recognition model to obtain the dialogue text label recognition result; Based on the dialogue text tag recognition results, the network parameters of the initial dialogue text tag recognition model are adjusted.
10. A method for recognizing dialogue text tags, comprising: Obtain the target dialogue text; The target dialogue text is input into a pre-trained dialogue text label recognition model to obtain dialogue text labels, wherein the dialogue text label recognition model is generated by the method described in any one of claims 1-9.
11. A training device for a dialogue text tag recognition model, comprising: The acquisition unit is configured to acquire a group of labeled dialogue texts in a target domain, wherein the labeled dialogue texts in the group of labeled dialogue texts include a sequence of dialogue information. The identification unit is configured to, for each identified dialogue text in the identified dialogue text group, identify the dialogue information sequence included in the identified dialogue text according to each dialogue role corresponding to the dialogue information sequence included in the identified dialogue text, so as to generate an identified identified dialogue text as an identified dialogue sample, wherein the identified dialogue sample includes a dialogue sample and a dialogue tag corresponding to the dialogue sample, wherein the dialogue tag is a tag that characterizes the intent of the dialogue text. The training unit is configured to train a pre-trained dialogue text labeling recognition model based on the generated labeled dialogue samples, obtaining the trained pre-trained dialogue text labeling recognition model as the dialogue text labeling recognition model. The pre-trained dialogue text labeling recognition model refers to a neural network model trained under self-supervised conditions using unlabeled dialogue text. The pre-trained dialogue text labeling recognition model includes: an encoding network, a first mapping model, a second mapping model, a third mapping model, and a fourth mapping model. The encoding network includes: a first encoding network, a second encoding network, a third encoding network, and a fourth encoding network, and includes: extracting data from the labeled dialogue samples... Select labeled dialogue samples, wherein the labeled dialogue samples include dialogue samples and corresponding dialogue tags; add a first identifier to the beginning position of the dialogue sample and add a second identifier to the end position of the dialogue sample; perform position encoding processing on the added dialogue samples to generate dialogue sample vectors; input the dialogue sample vectors into the pre-trained dialogue text tag recognition model to obtain dialogue text tag recognition results, including: inputting the dialogue sample vectors into the first encoding network to obtain a first encoded dialogue text sample vector; inputting the first encoded dialogue text sample vectors into the first mapping model to obtain a first encoded dialogue text sample vector. A dialogue text label recognition result is generated, wherein the first dialogue text label recognition result represents a first-level intent; the first encoded dialogue text sample vector is input into the second encoding network to obtain a second encoded dialogue text sample vector; the second encoded dialogue text sample vector is input into the second mapping model to obtain a second dialogue text label recognition result, wherein the second dialogue text label recognition result represents a second-level intent; the second encoded dialogue text sample vector is input into the third encoding network to obtain a third encoded dialogue text sample vector; the third encoded dialogue text sample vector is input into the third mapping model to obtain a third dialogue text label recognition result, wherein the third dialogue text label recognition result represents a third-level intent; the third encoded dialogue text sample vector is input into the fourth encoding network to obtain a fourth encoded dialogue text sample vector; the fourth encoded dialogue text sample vector is input into the fourth mapping model to obtain a fourth dialogue text label recognition result, wherein the fourth dialogue text label recognition result represents: first-level intent, second-level intent, and third-level intent; the first dialogue text label recognition result, the second dialogue text label recognition result, the third dialogue text label recognition result, and the fourth dialogue text label recognition result are combined to form a dialogue text label recognition result.
12. A dialogue text tag recognition device, comprising: The text acquisition unit is configured to acquire the target dialogue text; An input unit is configured to input the target dialogue text into a pre-trained dialogue text label recognition model to obtain dialogue text labels, wherein the dialogue text label recognition model is generated by the method described in any one of claims 1-9.
13. An electronic device, comprising: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-9 or 10.
14. A computer-readable medium having a computer program stored thereon, wherein, When the program is executed by the processor, it implements the method as described in any one of claims 1-9 or 10.
Citation Information
Patent Citations
User intention determination method and device
CN110580335A
Dialogue understanding and answer configuration method and system based on unsupervised dialogue pre-training
CN113032545A