Model training method, text processing method and related products
By automatically splitting and merging multi-intention texts, the problem of insufficient text expression ability in the existing technology is solved, and dialogue expression that is closer to reality is achieved, and model training costs are reduced.
Patent Information
- Application Number
- CN202410925086.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-12-17
AI Technical Summary
In the existing human-computer dialogue technology, the text has poor expression ability and it is difficult to effectively deal with multi-intention text, resulting in the dialogue not being close to reality enough.
By obtaining multi-intention text and segmenting it, using the single-intention recognition model to filter out the target single-intention set, and training the target text merging model to obtain the target text merging model, realizing automatic segmentation and merging of multi-intention texts, enhancing text expression capabilities.
Without manual annotation of data, the model training cost is reduced, the text expression ability is improved, and multiple single-intention texts can be combined into multi-intention texts, enhancing the closeness of the conversation and effectiveness.
Smart Images

Figure CN119150803A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and specifically to a model training method, a text processing method, a model training device, a text processing device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the continuous development of artificial intelligence technology, human-computer dialogue technology based on natural language processing is widely used in various industries. For example, intelligent customer systems and human-computer question-answering systems are all human-computer dialogue technologies that realize dialogue between machines and people. Intelligent customer service systems can guide users to handle business and answer business questions, and human-computer question-answering systems can answer users' questions in professional fields.
[0003] However, in the related art, the text involved in the current human-computer dialogue has poor expressive power. Summary of the invention
[0004] The embodiments of the present application provide a model training method, a text processing method, a model training device, a text processing device, an electronic device, a computer-readable storage medium and a computer product, which can improve the expressiveness of the text.
[0005] In the first aspect, the model training method provided by the present application includes:
[0006] Acquire a multi-intent text, and segment the multi-intent text to obtain a first sub-text group of the multi-intent text;
[0007] Obtaining a first candidate single intent set for the multi-intent text through a first single intent recognition model;
[0008] Obtaining a second candidate single intent set for each subtext in the first subtext group by using the first single intent recognition model;
[0009] Determine a first target single intent set of the first subtext group according to the second candidate single intent set, wherein the first target single intent set includes a first target single intent corresponding to each subtext in the first subtext group;
[0010] An initial text merging model is obtained, and a first sub-text group corresponding to a first target single intent set matching the first candidate single intent set is used as a first training sample, and the multi-intent text is used as a first label corresponding to the first training sample. The initial text merging model is trained according to the first training sample and the first label to obtain a target text merging model.
[0011] In a second aspect, the text processing method provided by the present application includes:
[0012] Obtaining a conversation intention set, and obtaining a response intention set corresponding to the conversation intention set;
[0013] Obtain the single-intent response speech text corresponding to each response intent in the response intent set;
[0014] Through the text merging model, the single-intent answering speech text corresponding to the answering intention set is text-merged to obtain the multi-intent answering speech text corresponding to the answering intention set;
[0015] The multi-intention response speech text is associated with the response intention set and stored in the speech library;
[0016] Wherein, the text merging model is trained using the model training method provided in this application.
[0017] In a third aspect, the model training device provided by the present application includes:
[0018] A text acquisition module, used for acquiring a multi-intent text and segmenting the multi-intent text to obtain a first sub-text group of the multi-intent text;
[0019] A first single intent recognition module, used for obtaining a first candidate single intent set of the multi-intent text through a first single intent recognition model;
[0020] A second single intent recognition module, configured to obtain a second candidate single intent set for each subtext in the first subtext group by using the first single intent recognition model;
[0021] a target intent recognition module, configured to determine a first target single intent set of the first subtext group according to the second candidate single intent set, wherein the first target single intent set includes a first target single intent corresponding to each subtext in the first subtext group;
[0022] A model training module is used to obtain an initial text merging model, and use the first sub-text group corresponding to the first target single intent set matching the first candidate single intent set as the first training sample, and use the multi-intent text as the first label corresponding to the first training sample, and train the initial text merging model according to the first training sample and the first label to obtain a target text merging model.
[0023] Optionally, in one embodiment, the model training module is used to obtain target punctuation marks of the multi-intent text; and use the multi-intent text with the target punctuation marks added as the first label corresponding to the first training sample.
[0024] Optionally, in one embodiment, the model training module is used to obtain a second single intent recognition model and a pre-trained language model; and to construct an initial text merging model based on the second single intent recognition model and the pre-trained language model.
[0025] Optionally, in one embodiment, the model training module is used to obtain a third candidate single intent set for each sub-text in the first training sample through a second single intent recognition model; determine the second target single intent of each sub-text in the first training sample based on the third candidate single intent set, and obtain the second target single intent set of the first training sample, and the second target single intent set includes each second target single intent; split the first label into a second sub-text group based on the target punctuation mark; obtain a first text index representing a non-end sub-text in the first training sample, and obtain a second text index representing a sub-text in the second sub-text group; use the first text index and the second target single intent set as the second training sample, use the second text index and the target punctuation mark as the second label corresponding to the second training sample, and train the pre-trained language model based on the second training sample and the second label; and obtain a target text merging model based on the trained pre-trained language model and the second single intent recognition model.
[0026] Optionally, in one embodiment, the model training module is used to deduplicate the second target single-intent set through a pre-trained language model to obtain a second target single-intent sequence; obtain a third text index through a pre-trained language model based on the second target single-intent sequence and the first text index, the third text index representing the sub-text in the predicted merged text obtained by merging the sub-text in the first training sample; obtain predicted punctuation corresponding to the third text index through a pre-trained language model based on the second target single-intent sequence; obtain a first loss based on the difference between the predicted punctuation and the target punctuation, and obtain a second loss based on the difference between the third text index and the second text index; and update the model parameters of the pre-trained language model based on the first loss and the second loss.
[0027] Optionally, in one embodiment, the model training module is used to obtain the intent priority of each second target single intent in the second target single intent sequence; obtain the vector distance between adjacent second target single intents in the second target single intent sequence; and obtain the predicted punctuation corresponding to the third text index through a pre-trained language model based on the intent priority and the vector distance.
[0028] Optionally, in one embodiment, the model training module is also used to obtain single-intent text, and obtain a fourth candidate single-intent set of the single-intent text through the first single-intent recognition model; determine the third target single intent of the single-intent text based on the fourth candidate single-intent set of the single-intent text; merge multiple single-intent texts through the target text merging model to obtain multi-intent merged text; and obtain an initial multi-intent recognition model, and use the multi-intent merged text as the third training sample, and use the third target single intent of the multiple single-intent texts from which the multi-intent merged text comes as the third label, and train the initial multi-intent recognition model according to the third training sample and the third label to obtain a target multi-intent recognition model.
[0029] In a fourth aspect, the text processing device provided by the present application includes:
[0030] An intention acquisition module is used to acquire a conversation intention set and a response intention set corresponding to the conversation intention set;
[0031] A speech acquisition module is used to obtain the single-intent response speech text corresponding to each response intent in the response intent set;
[0032] A text merging module is used to merge the single-intent answering speech text corresponding to the answering intent set through a text merging model to obtain the multi-intent answering speech text corresponding to the answering intent set;
[0033] The speech maintenance module is used to associate the multi-intent response speech text with the response intention set and store it in the speech library;
[0034] Among them, the target text merging model is trained using the model training method provided in this application.
[0035] Optionally, in one embodiment, the text processing device provided by the present application also includes a dialogue response module, which is used to obtain a current dialogue text that needs to be responded to from a terminal device; perform multi-intent recognition on the current dialogue text through a target multi-intention recognition model to obtain a target dialogue intention set for the current dialogue text; obtain a target response intention set corresponding to the target dialogue intention set; determine a first target multi-intention response speech text associated with the target response intention set from a speech library; and respond to the current dialogue text to the terminal device based on the first target multi-intention response speech text.
[0036] Optionally, in one embodiment, the conversation answering module is used to receive the current conversation audio from the terminal device, and perform text translation on the current conversation audio to obtain the current conversation text that needs to be answered.
[0037] Optionally, in one embodiment, the dialogue response module is used to generate speech based on the first target multi-intent response speech text, obtain the target multi-intent response speech audio corresponding to the first target multi-intent response speech text; and return the target multi-intent response speech audio to the terminal device, and the target multi-intent response speech audio is used for playback on the terminal device.
[0038] Optionally, in one embodiment, if the target dialogue intention set includes only a single target dialogue intention, the dialogue response module is used to obtain a single target response intention corresponding to the single target dialogue intention; determine from the speech library the second target multi-intent response speech text associated with the response intention set including the single target response intention; and respond to the current dialogue text to the terminal device based on the second target multi-intent response speech text.
[0039] In the fifth aspect, the electronic device provided in the present application includes a memory and a processor, the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the steps in the model training method provided in the present application, or to implement the steps in the text processing method provided in the present application.
[0040] In a sixth aspect, the computer-readable storage medium provided in the present application stores a computer program, which is suitable for a processor to run to implement the steps in the model training method provided in the present application, or to implement the steps in the text processing method provided in the present application.
[0041] In the seventh aspect, the computer program product provided in the present application includes a computer program, which is suitable for running on a processor to implement the steps in the model training method provided in the present application, or to implement the steps in the text processing method provided in the present application.
[0042] The present application provides a model training scheme based on artificial intelligence, especially based on natural language processing, wherein a multi-intent text is obtained and segmented to obtain a first sub-text group of the multi-intent text; a first candidate single intent set of the multi-intent text is obtained through a first single intent recognition model; a second candidate single intent set of each sub-text in the first sub-text group is obtained through the first single intent recognition model; a first target single intent set of the first sub-text group is determined according to the second candidate single intent set, and the first target single intent set includes the first target single intent corresponding to each sub-text in the first sub-text group; an initial text merging model is obtained, and the first sub-text group corresponding to the first target single intent set matching the first candidate single intent set is used as a first training sample, and the multi-intent text is used as a first label corresponding to the first training sample, and the initial text merging model is trained according to the first training sample and the first label to obtain a target text merging model. In this way, by automatically dividing the multi-intent text into the first sub-text group, combining the first single-intent recognition model to screen out the first sub-text group with reasonable segmentation (the first target single-intent set of the first sub-text group matches the first candidate single-intent set of the multi-intent text) as the first training sample, and using the multi-intent text as the first label of the first training sample for the training of the initial text merging model, the target text merging model can be trained without manually annotating data, thereby reducing the model training cost. When the target text merging model trained by the present application is used in human-computer dialogue, multiple single-intent texts can be merged into a multi-intent text, thereby obtaining a text expression that is closer to the real expression, thereby achieving the purpose of enhancing the text expression ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0044] Figure 1a It is a schematic diagram of the application environment of the model training method provided in the embodiment of the present application;
[0045] Figure 1b It is a flow chart of the model training method provided in the embodiment of the present application;
[0046] Figure 2a It is a flowchart of a text processing method provided by an embodiment of the present application;
[0047] Figure 2b This is a schematic diagram of an application scenario in which the text processing method provided by the present application is applied to an intelligent customer service system;
[0048] Figure 2c is a schematic diagram of another application scenario in which the text processing method provided by the present application is applied to an intelligent customer service system;
[0049] Figure 3 It is a structural schematic diagram of a model training device provided in an embodiment of the present application;
[0050] Figure 4 is a structural schematic diagram of a text processing device provided in an embodiment of the present application;
[0051] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] It should be noted that the principles of the present application are illustrated by implementing them in an appropriate computing environment. The following description is based on the illustrated specific embodiments of the present application and should not be considered as limiting other specific embodiments of the present application that are not described in detail herein.
[0053] In the following description of the present application, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0054] In the following description of the present application, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0056] It should be noted that artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0057] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction systems, mechatronics and other technologies. Among them, pre-trained models are also called large models and basic models. After fine-tuning, they can be widely used in downstream tasks in various major directions of artificial intelligence. Artificial intelligence software technology mainly includes machine learning (ML) technology, among which deep learning (DL) is a new research direction in machine learning. It is introduced into machine learning to make it closer to the original goal, namely artificial intelligence. At present, deep learning is mainly used in machine vision, natural language processing and other fields. Deep learning is the inherent laws and representation levels of learning sample data. The information obtained in these learning processes is of great help to the interpretation of data such as text, images and sound. Using deep learning technology and corresponding training sets, network models that implement different functions can be trained. For example, based on text samples with known intent, the pre-trained language model can be trained to obtain an intent recognition model that can recognize the intent contained in the text.
[0058] Natural language processing (NLP) is an important field in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing involves natural language, which is the language people use in daily life. It is closely related to linguistics research; it also involves computer science and mathematics. The pre-trained language model, an important technology for model training in the field of artificial intelligence, is developed from the large language model in the field of natural language processing. After fine-tuning, the pre-trained language model can be widely used in downstream tasks, such as intent recognition, machine translation, human-computer dialogue, etc.
[0059] It is understandable that in real-world expressions, it is often not the case that one intention is expressed in one sentence. In most cases, two or more intentions are expressed in one sentence. For example, “What’s the weather like tomorrow? I want to book a plane ticket.” This sentence expresses two intentions, namely, the intention of “checking the weather” and the intention of “booking a train ticket.”
[0060] The present application mainly relates to the field of natural language processing technology of artificial intelligence technology, and provides a model training method, a text processing method, a model training device, a text processing device, an electronic device, a computer-readable storage medium, and a computer program product. In the model training scheme provided in the present application, a multi-intent text is first obtained, and the multi-intent text is segmented to obtain a first sub-text group of the multi-intent text, then, a first candidate single intent set of the multi-intent text is obtained through a first single intent recognition model, and a second candidate single intent set of each sub-text in the first sub-text group is obtained through the first single intent recognition model, and then according to the second candidate single intent set, a first target single intent set of the first sub-text group is determined, and the first target single intent set includes the first target single intent corresponding to each sub-text in the first sub-text group, and finally, an initial text merging model is obtained, and the first sub-text group corresponding to the first target single intent set matching the first candidate single intent set is used as a first training sample, and the multi-intent text is used as a first label corresponding to the first training sample, and the initial text merging model is trained according to the first training sample and the first label to obtain a target text merging model. In this way, by automatically dividing the multi-intent text into the first sub-text group, combining the first single-intent recognition model to screen out the first sub-text group with reasonable segmentation (the first target single-intent set of the first sub-text group matches the first candidate single-intent set of the multi-intent text) as the first training sample, and using the multi-intent text as the first label of the first training sample for the training of the initial text merging model, the target text merging model can be trained without manually annotating data, thereby reducing the model training cost. When the target text merging model trained by the present application is used in human-computer dialogue, multiple single-intent texts can be merged into a multi-intent text, thereby obtaining a text expression that is closer to the real expression, thereby achieving the purpose of enhancing the text expression ability.
[0061] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described below are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0062] Please refer to Figure 1a , Figure 1a A schematic diagram of an application environment of the model training method provided in an embodiment of the present application is shown. As an implementation mode, the model training method provided in an embodiment of the present application can be applied to an electronic device, which can be Figure 1aThe server 110 shown in the figure can be connected to the terminal device 120 through a network. The network is used to provide a medium for a communication link between the server 110 and the terminal device 120. The network can include various connection types, such as a wired communication link, a wireless communication link, etc., which is not limited in the embodiment of the present application.
[0063] It should be understood that Figure 1a The server 110, network and terminal device 120 are merely illustrative. Depending on the implementation requirements, there may be any number of servers, networks and terminal devices. For example, the server 110 may be a physical server or a server cluster composed of multiple servers, and the terminal device 120 may be a mobile phone, a tablet, a desktop computer, a laptop computer and the like. It is understood that the embodiments of the present application may also allow multiple terminal devices 120 to access the server 110 at the same time.
[0064] In some embodiments, the terminal device 120 may receive input multi-intent text. Further, the terminal device 120 sends the multi-intent text to the server 110 via the network. After the server 110 receives the multi-intent text from the terminal device 120, a target text merging model capable of merging single-intent text into multi-intent text may be obtained by training using the model training method provided in this application.
[0065] Please refer to Figure 1b , Figure 1b is a flow chart of the model training method provided in this embodiment. Figure 1b As shown, the process of the text processing method can be as follows:
[0066] In 110 , a multi-intent text is obtained and segmented to obtain a first sub-text group of the multi-intent text.
[0067] Single-intent text refers to text that contains only one intent, and correspondingly, multi-intent text refers to text that contains more than two intents.
[0068] For example, the text "I want to buy a movie ticket" contains only one intent "buy movie ticket", and the text "How is the weather this afternoon" contains only one intent "check the weather", so the above two texts are single-intent texts. For another example, the text "How is the weather tomorrow? I want to book a football match ticket" contains two intents "check the weather" and "book a football match ticket", so the text is multi-intent text.
[0069] As an optional implementation, multi-intent texts may be screened from historical dialogue texts of the human-computer dialogue system.
[0070] Among them, firstly, the historical dialogue text generated by the human-computer dialogue system in the historical time period before the current time is obtained. The source of the historical dialogue text can be the dialogue text originally input by the user, or the dialogue text obtained by text translation of the dialogue voice input by the user. There is no restriction on the setting of the historical time period here, and it can be set by technical personnel in this field according to actual needs. As an example, the historical time period can be set to (t-7, t), where t represents the current time and the time unit is natural day. For example, for a human-computer dialogue system applied to job search business, a historical dialogue text obtained is "I am not Mr. XX, don't keep calling me, I am not looking for a job anymore", a historical dialogue text is "I am Mr. XX, I am still looking for a job but I want to change jobs", and so on.
[0071] Intent recognition is also called intent classification. The essence of single intent recognition is a text classification task. Corresponding to an input text, the output of the single intent recognition model is a preset number of candidate single intents before the confidence of the input text (wherein, the preset number of candidate intents output by the single intent recognition model when performing single intent recognition can be configured by technicians in this field according to actual needs, and no specific restrictions are made here). For a candidate single intent, its corresponding confidence represents the probability that the intent of the input text is the candidate single intent. It should be noted that the result of single intent recognition is the candidate single intent with the highest confidence in the input text as the target single intent of the input text. In other words, no matter how many intents the input text actually contains, the final result of single intent recognition is only one target single intent, that is, only one intent contained in the input text can be identified.
[0072] It should be noted that the model architecture and training method of the single intent recognition model in the embodiment of the present application are not limited, and can be selected by those skilled in the art according to actual needs. As an example, a pre-trained language model (a pre-trained language model can be selected by those skilled in the art according to actual needs, such as the original BERT, Roberta, etc., improved variants of BERT, Roberta, etc.) can be used as a basic model, and the task is designated as a classification task. In addition, a text containing at least one intent is obtained as a training sample, and a single intent of the annotated text is obtained as a classification label of the training sample. For example, the obtained training sample is "I want to find a part-time job with a higher salary", and the corresponding classification label is "find a part-time job", which indicates the intent of "find a part-time job" contained in the training sample; then, the pre-trained language model is trained according to the obtained training sample and the corresponding classification label to obtain a single intent recognition model with a single intent recognition function, wherein the training sample is used as the input of the pre-trained language model, and the classification label corresponding to the training sample is used as the expected output of the pre-trained language model.
[0073] As described above, after obtaining the historical conversation text, the single intent recognition model is further used to perform single intent recognition on the obtained historical conversation text to obtain a candidate single intent set of the historical conversation text, and the candidate single intent set includes a preset number of candidate intents of the historical conversation text. For example, assuming that the preset number is 3, for a historical conversation text "I am not Mr. XX, please don't keep calling me, I'm not looking for a job", the single intent recognition model is used to perform single intent recognition on the historical conversation text, and the single intent recognition model will output a candidate single intent set including 3 candidate intents [not myself, dislike calling, not looking for a job].
[0074] Furthermore, the confidence of each candidate single intent in the candidate single intent set of the historical conversation text is used as a reference for screening multi-intent texts, and the historical object text containing more than two intents is screened out as multi-intent text accordingly. For example, for a historical conversation text, the standard deviation of the confidence of all candidate single intents in its corresponding candidate single intent set can be calculated. If the calculated standard deviation is less than or equal to the standard deviation threshold, the historical conversation text is regarded as a multi-intent text; for another example, for a historical conversation text, it can be identified whether there is no candidate single intent in its corresponding candidate single intent set with a confidence greater than or equal to a first confidence threshold (such as set to 0.5). If so, the historical conversation text is regarded as a multi-intent text.
[0075] In other embodiments, the multi-intent text may also be obtained through other channels, which are not specifically limited here.
[0076] As described above, after obtaining the multi-intent text, at least one segmentation position is randomly determined for the obtained multi-intent text, and the multi-intent text is segmented according to the randomly determined segmentation position, thereby realizing random segmentation of the multi-intent text. For a multi-intent text, multiple segmentations are performed according to the above random segmentation method, and the sub-text group obtained by segmentation is recorded as the first sub-text group.
[0077] For example, for a multi-intent text "I am not Mr. XX. Don't keep calling me. I'm not looking for a job anymore", it is randomly segmented four times, and the following symbol "|" indicates the segmentation position:
[0078] The first sub-text group obtained by the first random segmentation is "I am not Mr. XX, please don't keep calling me | I am not looking for a job anymore", which includes two sub-texts, namely "I am not Mr. XX, please don't keep calling me" and "I am not looking for a job anymore";
[0079] The first sub-text group obtained by the second random segmentation is “I am not Mr. XX | Don’t keep calling me. I am not looking for a job anymore”. This sub-text group includes two sub-texts, namely “I am not Mr. XX” and “Don’t keep calling me. I am not looking for a job anymore”.
[0080] The first sub-text group obtained by the third random segmentation is “I am not Mr. XX | Don’t keep calling me | I am not looking for a job anymore”. This sub-text group includes three sub-texts, namely “I am not Mr. XX”, “Don’t keep calling me” and “I am not looking for a job anymore”.
[0081] The first sub-text group obtained by the fourth random segmentation is “I am not | Mr. XX, please don’t keep calling me | I am not looking for a job anymore”. This sub-text group includes three sub-texts, namely “I am not”, “Mr. XX, please don’t keep calling me” and “I am not looking for a job anymore”.
[0082] In 120, a first candidate single intent set of the multi-intent text is obtained through a first single intent recognition model.
[0083] In an embodiment of the present application, in addition to segmenting the acquired multi-intent text to obtain the first sub-text group, the acquired multi-intent text is also input into a first single-intent recognition model, and single-intent recognition is performed on the multi-intent text through the first single-intent recognition model to obtain a candidate single-intent set of the multi-intent text, which is recorded as the first candidate single-intent set.
[0084] In 130 , a second candidate single intent set of each subtext in the first subtext group is obtained by using the first single intent recognition model.
[0085] In addition, each sub-text in each first sub-text group obtained by segmentation is input into the first single-intent recognition model, and single-intent recognition is performed on each sub-text in each first sub-text group through the first single-intent recognition model to obtain a candidate single-intent set for each sub-text in each first sub-text group, which is recorded as the second candidate single-intent set.
[0086] In 140 , a first target single intent set of the first subtext group is determined according to the second candidate single intent set, where the first target single intent set includes a first target single intent corresponding to each subtext in the first subtext group.
[0087] For each subtext in each first subtext group, the second candidate single intent with the highest confidence in the second candidate single intent set of the subtext is determined as the target single intent of the subtext, and is recorded as the first target single intent. For example, for the subtext "I am not Mr. XX, please don't keep calling me" in the first subtext group obtained by the first random segmentation in the above example, the single intent is identified by the first single intent recognition model, and the second candidate single intent set obtained is [not myself, dislike calling, negation], and the confidence corresponding to each second candidate single intent in the second candidate single intent set is 0.5, 0.3 and 0.1 respectively. It can be seen that the second candidate single intent "not myself" has the highest confidence of 0.5, and the second candidate single intent "not myself" is correspondingly taken as the first target single intent of the subtext "I am not Mr. XX, please don't keep calling me" in the first subtext group obtained by the first random segmentation in the above example.
[0088] In this way, the first target single intent of each subtext in each first subtext group can be determined. For each first subtext group, the first target single intent of all subtexts in the first subtext group constitutes the first target single intent set of the first subtext group.
[0089] In 150, an initial text merging model is obtained, and the first sub-text group corresponding to the first target single intent set matching the first candidate single intent set is used as the first training sample, and the multi-intent text is used as the first label corresponding to the first training sample. The initial text merging model is trained according to the first training sample and the first label to obtain a target text merging model.
[0090] Among them, the matching of the first target single intent set and the first candidate single intent set can be understood as: each first target single intent in the first target single intent set is among the k first candidate single intents with the highest confidence in the first candidate single intent set. Among them, k is a positive integer greater than or equal to 2, which can be configured by those skilled in the art according to actual needs. In other embodiments, the maximum number of candidate single intents output by the first single intent recognition model can be directly configured to k, so that the candidate single intents output by the first single intent recognition model are the k candidate single intents with the highest confidence.
[0091] For example, assuming that k is configured as 3, and continuing to take the four first sub-text groups obtained by the above four random segmentations as an example, the first target single intent set of each first sub-text group is as follows:
[0092] The first target single intention set of the first sub-text group obtained by the first random segmentation is [not myself|not looking for a job];
[0093] The first target single intention set of the first sub-text group obtained by the second random segmentation is [not myself|not looking for a job];
[0094] The first target single intention set of the first sub-text group obtained by the third random segmentation is [not myself|dislike calling|not looking for a job];
[0095] The first target single intention set of the first sub-text group obtained by the fourth random segmentation is [negative | dislike calling | not looking for a job];
[0096] The first candidate single intent of the top 3 confidence levels of the first candidate single intent set of the multi-intent text "I am not Mr. XX, don't keep calling me, I'm not looking for a job" corresponding to the above four first sub-text groups is [not myself, dislike calling, not looking for a job]. By comparison, it can be seen that the first target single intent set of the first sub-text group obtained by the first random segmentation matches the first candidate single intent set of the aforementioned multi-intent text, the first target single intent set of the first sub-text group obtained by the second random segmentation matches the first candidate single intent set of the aforementioned multi-intent text, and the first target single intent set of the first sub-text group obtained by the third random segmentation matches the first candidate single intent set of the aforementioned multi-intent text. However, the first target single intent "negation" of a sub-text in the first sub-text group obtained by the fourth random segmentation is not among the first candidate single intents in the top 3 confidence levels of the first candidate single intent set of the aforementioned multi-intent text, that is, the first target single intent set of the first sub-text group obtained by the fourth random segmentation does not match the first candidate single intent set of the aforementioned multi-intent text. Accordingly, the first sub-text groups obtained by the first, second and third random segmentations are used as the first training samples.
[0097] As mentioned above, multiple first training samples can be obtained. In addition, for each first training sample, the multi-intent text from which the first training sample comes is used as its first label, and the first training sample and its corresponding first label are used as a set of training data to train the initial text merging model. The initial text merging model after training is recorded as the target text merging model.
[0098] For example, a set of training data obtained is as follows:
[0099] The first training sample: "I am not Mr. XX. Don't keep calling me. I am not looking for a job anymore [SEP] I am not Mr. XX. Don't keep calling me. I am not looking for a job anymore [SEP] I am not Mr. XX. Don't keep calling me. I am not looking for a job anymore";
[0100] The first label: "I am not Mr. XX. Please don't keep calling me. I am not looking for a job anymore."
[0101] It should be noted that the target text merging model trained by the model training method provided in this application can be applied to any human-computer dialogue scenario, and the target text merging model can be applied to products in these scenarios, such as human-computer question and answer systems, intelligent customer service systems, etc.
[0102] The human-computer question-answering system is used to automatically answer questions raised by users and provide users with accurate and efficient ways to obtain information. It is widely used in various fields. In the field of education, the human-computer question-answering system can provide students with personalized learning assistance, answer questions they encounter in the learning process, provide relevant information and learning suggestions, and improve learning results. In the medical field, the human-computer question-answering system can assist doctors in diagnosing diseases and giving treatment suggestions, reducing the workload of doctors and improving medical standards. In the financial field, the human-computer question-answering system can provide customers with financial investment consulting services, answer their questions about investment products, market trends, etc., and provide personalized investment advice.
[0103] For example, when a user wants to know how to express the single intention of multiple sentences in one sentence through the human-computer question-answering system, the text of each sentence that the user wants to express in a combined manner can be input into the target text merging model, and the combined text is obtained through the target text merging model. The combined text contains the intention of each sentence that the user wants to express in a combined manner.
[0104] The intelligent customer service system is an online customer service system based on a conversational robot, with the primary purpose of solving most of the user's consultation demands and guiding the user to complete the function processing. Among them, the main capabilities of the conversational robot include: it can support question-and-answer dialogues, task-based dialogues, chat-based dialogues, and graph-based dialogues with users.
[0105] For example, during a conversation with a user, when it is necessary to respond to the input conversation text, if the determined response text is multiple single-intent response texts, the determined multiple single-intent response texts can be input into the target text merging model, and the multiple single-intent response texts can be merged into one multi-intent response text through the target text merging model.
[0106] It is understandable that, in other embodiments, the trained target text merging model can also be applied to other scenarios where single-intent texts need to be merged into multi-intent texts.
[0107] Optionally, in one embodiment, taking the multi-intent text as the first label corresponding to the first training sample includes:
[0108] Get the target punctuation of multi-intent text;
[0109] The multi-intent text with the target punctuation added is used as the first label corresponding to the first training sample.
[0110] In the embodiment of the present application, the obtained multi-intent text is a multi-intent text without punctuation marks. In order to further enhance the text expression ability, the target punctuation marks of the annotated multi-intent text are also obtained, and the target punctuation marks are added to the multi-intent text. The multi-intent text with the added target punctuation marks is used as the first label corresponding to the first training sample, so that the target text merging model has the ability to add punctuation marks in addition to the text merging ability. For example, for a multi-intent text "I am not Mr. XX, don't keep calling me, I'm not looking for a job", after adding the target punctuation marks, it becomes "I am not Mr. XX, don't keep calling me, I'm not looking for a job.".
[0111] Optionally, in one embodiment, obtaining an initial text merging model includes:
[0112] Obtain the second intent recognition model and pre-trained language model;
[0113] According to the second single intent recognition model and the pre-trained language model, an initial text merging model is constructed.
[0114] In the embodiment of the present application, the initial text merging model is composed of two sub-models, one of which is configured to perform single-intent recognition on the sub-text in the input first training sample to obtain the second target single intent, and the other sub-model is configured to predict the multi-intent merged text and punctuation marks of the input first training sample based on the second target single intent obtained by performing single-intent recognition on the previous sub-model. Based on this, the training process of the text merging model is further explained below.
[0115] Among them, the second single intent recognition model that has been trained for single intent recognition is obtained as the first sub-model for constructing the initial text merging model. For example, the first single intent recognition model that has been trained in the above embodiment can be directly reused as the first sub-model, or a single intent recognition model that is different from the first single intent recognition model can be obtained as the first sub-model. No specific restrictions are made here. In addition, according to the above expected functions, a pre-trained language model is obtained (the pre-trained language model can be selected by technicians in this field according to actual needs, such as the original BERT, Roberta, etc., improved variants of BERT, Roberta, etc.) as the second sub-model for constructing the initial text merging model. At this point, the initial text merging model can be constructed based on the obtained first sub-model (second single intent recognition model) and the second sub-model (pre-trained language model).
[0116] In the embodiment of the present application, the initial text merging model is trained according to the first training sample and the first label to obtain a target text merging model, including:
[0117] Obtaining a third candidate single intent set for each subtext in the first training sample through the second single intent recognition model;
[0118] Determine the second target single intent of each subtext in the first training sample according to the third candidate single intent set, and obtain the second target single intent set of the first training sample, wherein the second target single intent set includes each second target single intent;
[0119] Splitting the first tag into second subtext groups according to the target punctuation mark;
[0120] Obtaining a first character index representing a non-last subtext in the first training sample, and obtaining a second character index representing a subtext in the second subtext group;
[0121] Taking the first text index and the second target single intent set as the second training sample, taking the second text index and the target punctuation mark as the second label corresponding to the second training sample, and training the pre-trained language model according to the second training sample and the second label;
[0122] According to the trained pre-trained language model and the second single intent recognition model, a target text merging model is obtained.
[0123] For a first training sample, single intent recognition is performed on each subtext in the first training sample through the first submodel, and a candidate single intent set for each subtext in the first training sample is obtained accordingly, which is recorded as the third candidate single intent set. For each subtext in the first training sample, the candidate single intent with the highest confidence in the third candidate single intent set of the subtext is used to determine the target single intent of the subtext, which is recorded as the second target single intent. In this way, the second target single intent set of the first training sample can be obtained, and the second target single intent set includes the second target single intent of each subtext in the first training sample.
[0124] In addition, the text index of the non-last sub-text in the first training sample is obtained and recorded as the first text index. The text of the corresponding sub-text is represented by the first text index. There is no restriction on the text indexing method here, and the technical personnel in this field can select a suitable text indexing method according to actual needs.
[0125] For example, “I am not Mr. XX, don’t keep calling me | I am not looking for a job anymore [SEP] I am not Mr. XX | Don’t keep calling me | I am not looking for a job anymore [SEP] I am not Mr. XX | Don’t keep calling me | I am not looking for a job anymore” has three first training samples, among which the first first training sample “I am not Mr. XX | Don’t keep calling me | I am not looking for a job anymore” corresponds to the first text index (15), the second first training sample “I am not Mr. XX | Don’t keep calling me | I am not looking for a job anymore” corresponds to the first text index (6), and the third first training sample “I am not Mr. XX | Don’t keep calling me | I am not looking for a job anymore” corresponds to the first text index (6, 15).
[0126] For the first label, the first label is further divided into sub-text groups according to the added target punctuation marks, which are recorded as the second sub-text groups. In addition, the second text index of the sub-text in the second sub-text group is obtained according to the same text indexing method as above. For example, a first label is "I am not Mr. XX, don't keep calling me, I am not looking for a job anymore." The corresponding second sub-text group obtained by segmentation is "I am not Mr. XX | Don't keep calling me | I am not looking for a job anymore", and the second text index of the sub-text in the second sub-text group is (6, 15, 21).
[0127] As described above, after obtaining the second target single intention set of the first training sample, the first text index of the non-end subtext, and the second text index of the subtext in the second subtext group, the second target single intention set and the first text index corresponding to the first training sample are used as the second training sample, and the second text index and the target punctuation mark corresponding to the second subtext group are used as the second label, and the second training sample and the second label are combined into a set of training data. In this way, multiple sets of training data can be obtained. It can be understood that the first submodel has completed training and does not need to be trained again. The second submodel is trained according to the obtained training data, and the text merging model is obtained according to the first submodel and the trained second submodel.
[0128] For example, for the second sub-model, a set of training data is obtained as follows:
[0129] Second training sample: [((15), (not the person | not looking for a job)), ((6), (not the person | not looking for a job)), ((6, 15), (not the person | dislikes phone calls | not looking for a job))];
[0130] Second label: [(6, ', '), (15, ', '), (21, '.')].
[0131] Optionally, in one embodiment, training the pre-trained language model according to the second training sample and the second label includes:
[0132] Through the pre-trained language model, the second target single intent set is deduplicated to obtain the second target single intent sequence;
[0133] According to the second target single-intent sequence and the first text index, a third text index is obtained through a pre-trained language model, where the third text index represents a sub-text in a predicted merged text obtained by merging the sub-texts in the first training sample;
[0134] According to the second target single intent sequence, obtaining predicted punctuation marks corresponding to the third text index through a pre-trained language model;
[0135] Obtaining a first loss according to a difference between the predicted punctuation mark and the target punctuation mark, and obtaining a second loss according to a difference between the third character index and the second character index;
[0136] Update the model parameters of the pre-trained language model according to the first loss and the second loss.
[0137] The pre-trained language model is the second sub-model of the initial text merging model. Its training process can be as follows:
[0138] For the second target single intent set, duplicate elimination is performed through the second sub-model, and the second target single intents after duplicate elimination are arranged from front to back to obtain a second target single intent sequence.
[0139] According to the above second target single-intent sequence and the first text index, the third text index of the sub-text in the predicted merged text obtained by representing the sub-text in the first training sample is obtained through the second sub-model. That is to say, the second sub-model does not output the predicted merged text, but outputs the text index representing the sub-text in the predicted merged text.
[0140] In addition, based on the above second target single-intent sequence, the predicted punctuation mark corresponding to the third text index is obtained through the second sub-model.
[0141] Furthermore, a first loss is obtained based on the difference between the predicted punctuation and the target punctuation, and a second loss is obtained based on the difference between the third text index and the second text index, and the model parameters of the second sub-model are updated accordingly according to the first loss and the second loss until a preset update stop condition is met.
[0142] Among them, technical personnel in this field can select a suitable loss function to measure the difference between the predicted punctuation and the target punctuation, and the difference between the third text index and the second text index according to actual needs, and there is no limitation here.
[0143] As an example, a cross entropy loss function is used in an embodiment of the present application to measure the difference between the predicted punctuation and the target punctuation, and the difference between the third text index and the second text index. Correspondingly, a first cross entropy loss is obtained according to the difference between the predicted punctuation and the target punctuation, a second cross entropy loss is obtained according to the difference between the third text index and the second text index, and the first cross entropy loss and the second cross entropy loss are fused to obtain the target loss. According to the target loss, the model parameters of the second sub-model are updated in the direction of gradient descent until the preset update stop condition is met. There is no restriction on the configuration of the preset update stop condition here, and it can be configured by those skilled in the art according to actual needs. For example, it can be configured so that the number of updates to the model parameters of the second sub-model reaches a preset number, and it can also be configured so that the second sub-model converges, and so on.
[0144] It should be noted that for the target text merging model trained in the embodiment of the present application, the texts to be merged can be input into the target text merging model in the following form (at least two texts to be merged need to be input):
[0145] Text to be merged|……|Text to be merged;
[0146] The output of the target text merging model is represented as:
[0147] [(a1,'m1'),……,(a i ,'m i ')];
[0148] Where i represents the number of sub-texts in the multi-intention merged text obtained by merging the input text to be merged by the target text merging model, and a i is the text index representing the i-th subtext in the multi-intent merged text, m i Indicates the punctuation mark corresponding to the i-th sub-text in the multi-intent merged text. Based on the aforementioned text index, the text constituting the sub-text in the multi-intent merged text can be obtained from the input text to be merged, and then combined with the punctuation marks to finally constitute the multi-intent merged text.
[0149] Optionally, in one embodiment, obtaining a predicted punctuation mark corresponding to the third character index through a pre-trained language model according to the second target single-intent sequence includes:
[0150] Obtaining the intent priority of each second target single intent in the second target single intent sequence;
[0151] Obtaining vector distances between adjacent second target single intentions in a second target single intention sequence;
[0152] According to the intent priority and the vector distance, the predicted punctuation mark corresponding to the third text index is obtained through the pre-trained language model.
[0153] Among them, for a second target single intent, its intent priority is used to characterize the importance of the second target single intent to the target business to which the target text merging model is to be applied. For example, a second target single intent is "order football match tickets", and another second target single intent is "stop looking for a job". Assuming that the target text merging model is applied to the job-seeking related human-computer dialogue business, the corresponding second target single intent "stop looking for a job" which is more relevant to the job-seeking business has a higher intent priority. Assuming that the target text merging model is applied to the ticketing related human-computer dialogue business, the corresponding second target single intent "order football match tickets" which is more relevant to the ticketing business has a higher intent priority.
[0154] In other embodiments, for a category of business, a priority assessment model for evaluating the intent priority of the category of business can be trained. No specific restrictions are imposed on the model architecture and training method of the priority assessment model, which can be selected by technical personnel in this field according to actual needs. In one embodiment, the intent priority of each second target single intent in a second target single intent sequence is obtained, including: determining a target business, and obtaining the intent priority of each second target single intent in a second target single intent sequence by matching the priority assessment model of the target business.
[0155] In addition, in an embodiment of the present application, the vector distance between adjacent second target single intents in the second target single intent sequence is also obtained, wherein the embedding vector of each second target single intent in the second target single intent sequence can be obtained by the intent embedding model obtained through training for intent embedding. No specific restrictions are made on the model architecture and training method of the intent embedding model here, and it can be selected by technical personnel in this field according to actual needs. For example, the pre-trained language model BERT can be used as the basic model to train the intent embedding model. In one embodiment, the vector distance between adjacent second target single intents in the second target single intent sequence is obtained, including: obtaining the embedding vector of each second target single intent in the second target single intent sequence through the intent embedding model; according to the embedding vectors of adjacent second target single intents in the second target single intent sequence, the vector distance between adjacent second target single intents in the second target single intent sequence is calculated.
[0156] In other embodiments, the vector distances between different intents can be calculated in advance and maintained in the form of a knowledge graph, wherein the intents are represented by the nodes of the knowledge graph, and the relationships between the nodes are represented by the edges between the nodes, that is, the vector distances between the intents. Correspondingly, when obtaining the vector distances between adjacent second target single intents in the second target single intent sequence, it can be directly queried from the knowledge graph. In addition, the relationship between intents and named entities can also be maintained in the knowledge graph, and in the process of intent recognition, intent recognition can be performed in combination with named entities.
[0157] As mentioned above, after obtaining the intent priority of each second target single intent in the second target single intent sequence and the vector distance between adjacent second target single intents in the second target single intent sequence, the predicted punctuation mark corresponding to the third text index is obtained through the second sub-model based on the acquired intent priority and vector distance.
[0158] Optionally, in one embodiment, after the initial text merging model is trained according to the first training sample and the first label to obtain the target text merging model, the method further includes:
[0159] Obtain the single-intent text, and obtain a fourth candidate single-intent set of the single-intent text through the first single-intent recognition model;
[0160] Determine a third target single intent of the single intent text according to a fourth candidate single intent set of the single intent text;
[0161] Through the target text merging model, multiple single-intent texts are merged to obtain multi-intent merged text;
[0162] Obtain an initial multi-intent recognition model, and use the multi-intent merged text as the third training sample, and use the third target single intent of the multiple single-intent texts from which the multi-intent merged text comes as the third label. Train the initial multi-intent recognition model according to the third training sample and the third label to obtain a target multi-intent recognition model.
[0163] In an embodiment of the present application, after the target text merging model is obtained through training, the target text merging model is also used to train a multi-intent recognition model.
[0164] For example, when the multi-intent text source and the historical conversation text in the above embodiment are combined, the single-intent text can also be screened out from the historical conversation text for the training of the multi-intent recognition model. Among them, the candidate single intent and the corresponding confidence information of the historical conversation text obtained during the training of the text merging model can be reused, and the historical conversation text with the candidate single intent whose confidence reaches the second confidence threshold is determined as a single-intent text containing only a single intent.
[0165] For the acquired single-intent text, on the one hand, the candidate single-intent set of each single-intent text is obtained through the first single-intent recognition model, which is recorded as the fourth candidate single-intent set; for each single-intent text, the candidate single intent with the highest confidence in the fourth candidate single intent set is determined as the target single intent of the single-intent text, which is recorded as the third target single intent.
[0166] On the other hand, the target text merging model is used to perform a text merging operation on the acquired single-intent text, wherein in one text merging operation, the target text merging model is used to merge multiple (at least two) single-intent texts into one multi-intent merged text. In this way, multiple multi-intent merged texts can be merged.
[0167] Furthermore, a multi-intent merged text is used as a third training sample, and the third target single intent of multiple single intent texts from which the multi-intent merged text comes is used as a third label, and the third training sample and the third label are correspondingly combined into a set of training data. Among them, for a set of training data, the third training sample is used as the input of the initial multi-intent recognition model, and the third label is used as the expected output of the initial multi-intent recognition model. In this way, the initial multi-intent recognition model is trained using the multiple sets of training data obtained to obtain a target multi-intent recognition model for multi-intent recognition.
[0168] It should be noted that multi-intent recognition is essentially a multi-label task. As an example, a pre-trained language model (the pre-trained language model can be selected by technical personnel in this field according to actual needs, such as the original BERT, Roberta, etc., improved variants of BERT, Roberta, etc.) can be used as the initial multi-intent recognition model, and the task is designated as a multi-label task. Different from the single-intent recognition model, the multi-intent recognition model can identify multiple intents contained in the input text when performing multi-intent recognition. In this way, the training data for training the multi-intent recognition model can be automatically acquired without manual labeling, which improves the training efficiency of the multi-intent recognition model.
[0169] Please refer to Figure 2a , the present application also provides a text processing method, such as Figure 2a As shown, the process of the text processing method can be as follows:
[0170] In 210, a conversation intention set is obtained, and a response intention set corresponding to the conversation intention set is obtained.
[0171] Among them, the historical dialogue text generated by the human-computer dialogue system (such as a human-computer question-and-answer system, an intelligent customer service system, etc.) in the historical time period before the current time can be obtained. The source of the historical dialogue text can be the dialogue text originally input by the user, or the dialogue text obtained by text translation of the dialogue voice input by the user. There is no restriction on the setting of the historical time period here, and it can be set by those skilled in the art according to actual needs. As an example, the historical time period can be set to (t-7, t), where t represents the current time and the time unit is natural day.
[0172] Then, multi-intent historical conversation texts are screened out from the historical conversation texts. For details, please refer to the relevant descriptions about screening multi-intent texts in the above embodiments, which will not be repeated here. For a multi-intent historical conversation text, multi-intent recognition is performed on the multi-intent historical conversation text through the target multi-intent recognition model to obtain a conversation intention set of the multi-intent historical conversation text, which includes multiple conversation intentions contained in the multi-intent historical conversation text. For example, a multi-intent historical conversation text is "I am not Mr. XX. Don't keep calling me. I'm not looking for a job anymore." The multi-intent recognition model is used to perform multi-intent recognition on the multi-intent historical conversation text, and the conversation intention set obtained is (not myself, disgusted with phone calls, not looking for a job).
[0173] Among them, the target multi-intent recognition model is trained using the model training method provided in the above embodiments of the present application.
[0174] For each dialogue intention set, the corresponding response intention set is obtained, and the response intention in the intention set should correspond to the dialogue intention in the dialogue intention set one by one. There is no specific restriction on the method of obtaining the response intention set here, and it can be selected by technical personnel in this field according to actual needs. As an example, the dialogue intention set can be intent-matched by a trained intention matching model to obtain the response intention set corresponding to the dialogue intention set. There is no specific restriction on the model architecture and training method of the intention matching model here, and it can be selected by technical personnel in this field according to actual needs. For example, a suitable pre-trained language model can be selected as the basic model, dialogue intention set samples can be obtained, and response intention set labels of the annotated dialogue intention set samples can be obtained. The basic model is trained according to the dialogue intention set sample samples and the response intention set labels to obtain the intent matching model.
[0175] In 220, the single-intent response speech text corresponding to each response intent in the response intention set is obtained.
[0176] For each response intent in each response intent set obtained, the text containing the response intent can be further obtained based on expert knowledge, which is recorded as a single-intent response text. For example, if a response intent set is obtained as (not me, sorry, contact me later), for the response intent "not me", the single-intent response text obtained is "You are not me, OK", for the response intent "sorry", the single-intent response text obtained is "Sorry to trouble you by calling you frequently", and for the response intent "contact me later", the single-intent response text obtained is "You are not looking for a job for the time being. If you need to find a job later, you can contact us at any time."
[0177] In 230, the single-intent response speech text corresponding to the response intention set is text-merged through the target text merging model to obtain the multi-intent response speech text corresponding to the response intention set.
[0178] For the single-intent response script text corresponding to a response intent set, the target text merging model is used to merge the text to obtain the multi-intent response script text corresponding to the response intent set. For example, continuing with the above-obtained response intent set (not me, sorry, contact me later) as an example, the target text merging model is used to merge the single-intent response script text corresponding to the response intent set, and the obtained multi-intent response script text is "You are not me, sorry to trouble you, contact me later when you find a job."
[0179] Among them, the target text merging model is trained using the model training method provided in the above embodiments of the present application.
[0180] In 240, the multi-intent response speech text is associated with the response intention set and stored in the speech library.
[0181] As above, for each acquired response intention set, the corresponding multi-intent response speech text can be acquired, and each acquired response intention set and the corresponding multi-intent response speech text are associated and stored in the speech library. It can be understood that, with the response intention set as the index, the corresponding multi-intent response speech text can be obtained from the speech library to realize the response to the multi-intent dialogue text.
[0182] Optionally, in one embodiment, after associating the multi-intent answering speech text with the answering intention set and storing them in the speech library, the method further includes:
[0183] Get the current conversation text that needs to be answered from the terminal device;
[0184] Perform multi-intent recognition on the current conversation text through the target multi-intent recognition model to obtain the target conversation intent set of the current conversation text;
[0185] Get the target response intent set corresponding to the target conversation intent set;
[0186] Determine the first target multi-intent response speech text associated with the target response intent set from the speech library;
[0187] According to the first target multi-intention response speech text, respond to the current conversation text to the terminal device.
[0188] Please refer to Figure 2b , the embodiment of the present application describes the application of the speech library created above in the intelligent customer service system.
[0189] The server 110 obtains the current conversation text that needs to be responded from the terminal device 120, and there is no restriction on the method of obtaining the current conversation text. For example, if the conversation between the server 110 and the terminal device 120 is a text conversation, the current conversation text that needs to be responded from the terminal device 120 can be directly received; if the conversation between the server 110 and the terminal device 120 is a voice conversation, the conversation audio from the terminal device 120 can be translated into text to obtain the current conversation text that needs to be responded.
[0190] For the acquired current dialogue text, the server 110 performs multi-intent recognition through the multi-intent recognition model trained in the above embodiment to obtain a target dialogue intention set of the current dialogue text, and the target dialogue intention set includes each target dialogue intention contained in the current dialogue text. It can be understood that in actual applications, the dialogue text from the terminal device 120 may be a single-intent text or a multi-intent text, and therefore, the target dialogue intention set may include a single target dialogue intention or multiple target dialogue intentions.
[0191] In the embodiment of the present application, the obtained target dialogue intention set includes multiple target dialogue intentions as an example, that is, the embodiment of the present application is explained by taking the current dialogue text as a multi-intent text as an example.
[0192] For the target conversation intention set of the current conversation text, the server 110 performs intent matching on the target conversation intention set through the trained intent matching model, and obtains the response intention set corresponding to the target conversation intention set, which is recorded as the target response intention set. Afterwards, the server 110 determines the multi-intent response speech text associated with the target response intention set from the speech library, which is recorded as the first target multi-intent response speech text. For example, the current conversation text is "I am not Mr. XX. Don't keep calling me. I'm not looking for a job anymore." The corresponding first target multi-intent response speech text is "You are not me. I'm sorry to trouble you. I'll contact you when I find a job later."
[0193] As described above, in response to obtaining the current dialogue text that needs to be responded to from the terminal device, after determining the first target multi-intention response dialogue text from the dialogue library, the server 110 responds to the current dialogue text to the terminal device according to the determined first target multi-intention response dialogue text. There is no restriction on the response method here, and it can be configured by those skilled in the art according to actual needs. For example, it can be configured by default to respond in text mode, or it can be configured by default to respond in voice mode. As an example, in an embodiment of the present application, the dialogue type of the current dialogue between the server 110 and the terminal device 120 is determined, and the response method for the current dialogue text is determined according to the correspondence between the configured dialogue type and the response method.
[0194] The embodiment of the present application applies the trained multi-intent recognition model to the intelligent customer service system, which can preserve the intent contained in the dialogue text as much as possible. By using multi-intent response text to respond to the multi-intent dialogue text, the quality and information density of the dialogue can be guaranteed. For the user experience, what is felt is that the intelligent customer service system can answer multiple questions in a targeted manner, rather than mechanically answering one question, without the need for rounds of interaction.
[0195] Optionally, in one embodiment, obtaining the current conversation text that needs to be responded to from the terminal device includes:
[0196] Receive the current conversation audio from the terminal device, and perform text translation on the current conversation audio to obtain the current conversation text that needs to be responded to.
[0197] Please refer to Figure 2c , the following description is made by taking the current conversation between the server 110 and the terminal device as a voice conversation as an example.
[0198] In an embodiment of the present application, during the conversation between the server 110 and the terminal device 120, the server 110, in response to receiving the current conversation audio from the terminal device, performs text translation on the current conversation audio to obtain the current conversation text that needs to be answered. Among them, the text translation operation can be performed by the server 110 that executes the text processing method provided by the present application, or by a third-party server. For example, the server 110 that executes the text processing method provided by the present application has a text translation function, and can perform text translation on the received current conversation audio locally to obtain the current conversation text that needs to be answered; for another example, the server 110 that executes the text processing method provided by the present application does not have a text translation function, and can send the received current conversation audio to a third-party server that provides a text translation service, instructing the third-party server to perform text translation on the current conversation audio and return the translated text, and correspondingly use the translated text returned by the third-party server as the current conversation text that needs to be answered.
[0199] Accordingly, in the embodiment of the present application, according to the first target multi-intent response speech text, responding to the current conversation text to the terminal device includes:
[0200] Generate speech according to the first target multi-intent response speech text to obtain the target multi-intent response speech audio corresponding to the first target multi-intent response speech text;
[0201] The target multi-intent response speech audio is returned to the terminal device, and the target multi-intent response speech audio is used for playback on the terminal device.
[0202] Among them, after the current conversation text is translated from the current conversation audio from the terminal device and the first target multi-intention response speech text is obtained, the server 110 further generates speech according to the first target multi-intention response speech text to obtain the target multi-intention response speech audio corresponding to the first target multi-intention response speech text. Among them, the speech generation operation can be performed by the server 110 that executes the text processing method provided by this application, or by a third-party server. For example, if the server 110 that executes the text processing method provided by this application has a speech generation function, it can generate speech locally according to the first target multi-intention response speech text to obtain the target multi-intention response speech audio corresponding to the first target multi-intention response speech text; for another example, if the server 110 that executes the text processing method provided by this application does not have a speech generation function, the server 110 can send the first target multi-intention response speech text to a third-party server that provides speech generation services, instructing the third-party server to generate speech according to the first target multi-intention response speech text, and return the audio obtained by speech generation, and the audio returned by the third-party server is used as the target multi-intention response speech audio.
[0203] As described above, after obtaining the target multi-intention response speech audio corresponding to the first target multi-intention response speech text, the target multi-intention response speech audio is returned to the terminal device 120, and the target multi-intention response speech audio is used for the terminal device 120 to play, thereby realizing the response to the current conversation audio. In this way, the text processing method provided in the embodiment of the present application is applied to the intelligent customer service system, which can enable the intelligent customer system to have voice-to-voice multi-intention conversation capabilities.
[0204] Optionally, in one embodiment, after performing multi-intent recognition on the current dialogue text through the target multi-intent recognition model to obtain the target dialogue intent set of the current dialogue text, the method further includes:
[0205] If the target dialogue intention set includes only a single target dialogue intention, then obtaining a single target response intention corresponding to the single target dialogue intention in the target dialogue intention set;
[0206] Determine from the speech library a second target multi-intent response speech text associated with a response intention set including a single target response intention;
[0207] According to the second target multi-intention response speech text, respond to the current conversation text to the terminal device.
[0208] According to the relevant description in the above embodiments, it can be understood that in the actual execution process, the number of target dialogue intents included in the target dialogue intent set identified for the current dialogue text may be single or multiple. If the current dialogue text is a single-intent text, the current dialogue text is correspondingly subjected to multi-intent recognition through a multi-intent recognition model, and the obtained target dialogue intent set includes only a single target dialogue intent.
[0209] For the single target dialogue intention included in the target dialogue intention set, intent matching is performed through the trained intent matching model to obtain the single target response intention corresponding to the single target dialogue intention, and the second target multi-intent response speech text associated with the response intention set including the single target response intention is determined from the speech library, and the current dialogue text is responded to the terminal device according to the second target multi-intent response speech text. How to respond to the current dialogue text to the terminal device according to the second target multi-intent response speech text is not described here in detail, and can be implemented accordingly with reference to the method of responding to the current dialogue text to the terminal device according to the second target multi-intent response speech text in the above embodiment.
[0210] The embodiment of the present application uses a multi-intent response speech text to respond to a single-intent conversation text, thereby being able to answer in advance the content that the user may want to know.
[0211] As can be seen from the above, the present application provides a text processing solution based on artificial intelligence, especially based on natural language processing, wherein the text to be merged that needs to be merged is first determined, and the text to be merged is a single-intent text, that is, a text containing only one intent, and then, the text to be merged is merged through the trained text merging model, and multiple texts to be merged are merged into a multi-intent merged text, recorded as a multi-intent merged text, wherein the text merging model uses a multi-intent text sample as the expected output, and a sub-text group obtained by randomly segmenting the multi-intent text sample as the input sample for model training, and the single-intent label of the sub-text in the sub-text group matches the candidate intent label of the multi-intent text sample. In this way, through the text processing solution provided by the present application, multiple single-intent texts can be merged into a multi-intent text, thereby obtaining a text expression that is closer to the real expression, and achieving the purpose of enhancing the text expression ability. Furthermore, when training, the text merging model provided by the present application automatically divides multi-intent text samples into sub-text groups consisting of single-intent sub-texts through a random text segmentation method combined with an existing single-intent recognition model in the relevant technology. The multi-intent text samples are used as the expected output, and the sub-text groups are used as input samples for model training, thereby obtaining a text merging model that can merge multiple single-intent texts into one multi-intent text. Since the text merging model does not require manual annotation of data during the training process, the required training cost is correspondingly low.
[0212] In order to better implement the above model training method, the present application embodiment also provides a corresponding model training device. The meanings of the terms are the same as those in the above model training method. For specific implementation details, please refer to the description in the above method embodiment.
[0213] Please refer to Figure 3 , Figure 3 A schematic diagram of the structure of a model training device provided in an embodiment of the present application, wherein the model training device may include a text acquisition module 310, a first single intent recognition module 320, a second single intent recognition module 330, a target intent recognition module 340 and a model training module 350, wherein:
[0214] A text acquisition module 310 is used to acquire a multi-intent text and segment the multi-intent text to obtain a first sub-text group of the multi-intent text;
[0215] A first single intent recognition module 320, configured to obtain a first candidate single intent set of the multi-intent text through a first single intent recognition model;
[0216] A second single intent recognition module 330 is used to obtain a second candidate single intent set for each subtext in the first subtext group by using the first single intent recognition model;
[0217] A target intent identification module 340 is used to determine a first target single intent set for the first subtext group according to the second candidate single intent set, where the first target single intent set includes a first target single intent corresponding to each subtext in the first subtext group;
[0218] The model training module 350 is used to obtain an initial text merging model, and use the first sub-text group corresponding to the first target single intent set matching the first candidate single intent set as the first training sample, and use the multi-intent text as the first label corresponding to the first training sample, and train the initial text merging model according to the first training sample and the first label to obtain the target text merging model.
[0219] Optionally, in one embodiment, the model training module 350 is used to obtain target punctuation marks of the multi-intent text; and use the multi-intent text with the target punctuation marks added as the first label corresponding to the first training sample.
[0220] Optionally, in one embodiment, the model training module 350 is used to obtain a second single intent recognition model and a pre-trained language model; and to construct an initial text merging model based on the second single intent recognition model and the pre-trained language model.
[0221] Optionally, in one embodiment, the model training module 350 is used to obtain a third candidate single intent set for each sub-text in the first training sample through a second single intent recognition model; determine the second target single intent for each sub-text in the first training sample based on the third candidate single intent set, and obtain the second target single intent set of the first training sample, wherein the second target single intent set includes each second target single intent; split the first label into a second sub-text group based on the target punctuation mark; obtain a first text index representing a non-end sub-text in the first training sample, and obtain a second text index representing a sub-text in the second sub-text group; use the first text index and the second target single intent set as the second training sample, use the second text index and the target punctuation mark as the second label corresponding to the second training sample, and train the pre-trained language model based on the second training sample and the second label; and obtain a target text merging model based on the trained pre-trained language model and the second single intent recognition model.
[0222] Optionally, in one embodiment, the model training module 350 is used to deduplicate the second target single-intent set through a pre-trained language model to obtain a second target single-intent sequence; obtain a third text index through a pre-trained language model based on the second target single-intent sequence and the first text index, the third text index representing the sub-text in the predicted merged text obtained by merging the sub-text in the first training sample; obtain predicted punctuation corresponding to the third text index through a pre-trained language model based on the second target single-intent sequence; obtain a first loss based on the difference between the predicted punctuation and the target punctuation, and obtain a second loss based on the difference between the third text index and the second text index; and update the model parameters of the pre-trained language model based on the first loss and the second loss.
[0223] Optionally, in one embodiment, the model training module 350 is used to obtain the intent priority of each second target single intent in the second target single intent sequence; obtain the vector distance between adjacent second target single intents in the second target single intent sequence; and obtain the predicted punctuation corresponding to the third text index through a pre-trained language model based on the intent priority and the vector distance.
[0224] Optionally, in one embodiment, the model training module 350 is also used to obtain single-intent text, and obtain a fourth candidate single-intent set of the single-intent text through the first single-intent recognition model; determine the third target single intent of the single-intent text based on the fourth candidate single-intent set of the single-intent text; merge multiple single-intent texts through the target text merging model to obtain multi-intent merged text; and obtain an initial multi-intent recognition model, and use the multi-intent merged text as the third training sample, and use the third target single intent of the multiple single-intent texts from which the multi-intent merged text comes as the third label, and train the initial multi-intent recognition model according to the third training sample and the third label to obtain a target multi-intent recognition model.
[0225] In order to facilitate better implementation of the above text processing method, the present application embodiment also provides a corresponding text processing device, wherein the meanings of the nouns are the same as those in the above text processing method, and the specific implementation details can be found in the description of the above method embodiment.
[0226] Please refer to Figure 4 , Figure 4 The text processing device provided in the embodiment of the present application is a schematic diagram of the structure of the text processing device, which may include an intention acquisition module 410, a speech acquisition module 420, a text merging module 430 and a speech maintenance module 440, wherein:
[0227] The intention acquisition module 410 is used to acquire a conversation intention set and a response intention set corresponding to the conversation intention set;
[0228] The speech acquisition module 420 is used to obtain the single-intent response speech text corresponding to each response intent in the response intent set;
[0229] The text merging module 430 is used to merge the single-intent answering speech text corresponding to the answering intention set through the target text merging model to obtain the multi-intent answering speech text corresponding to the answering intention set;
[0230] A speech maintenance module 440 is used to associate the multi-intention response speech text with the response intention set and store it in the speech library;
[0231] Among them, the target text merging model is trained using the model training method provided in this application.
[0232] Optionally, in one embodiment, the text processing device provided by the present application also includes a dialogue response module, which is used to obtain a current dialogue text that needs to be responded to from a terminal device; perform multi-intent recognition on the current dialogue text through a target multi-intention recognition model to obtain a target dialogue intention set for the current dialogue text; obtain a target response intention set corresponding to the target dialogue intention set; determine a first target multi-intention response speech text associated with the target response intention set from a speech library; and respond to the current dialogue text to the terminal device based on the first target multi-intention response speech text.
[0233] Optionally, in one embodiment, the conversation answering module is used to receive the current conversation audio from the terminal device, and perform text translation on the current conversation audio to obtain the current conversation text that needs to be answered.
[0234] Optionally, in one embodiment, the dialogue response module is used to generate speech based on the first target multi-intent response speech text, obtain the target multi-intent response speech audio corresponding to the first target multi-intent response speech text; and return the target multi-intent response speech audio to the terminal device, and the target multi-intent response speech audio is used for playback on the terminal device.
[0235] Optionally, in one embodiment, if the target dialogue intention set only includes a single target dialogue intention, the dialogue response module is used to obtain a single target response intention corresponding to the single target dialogue intention; determine from the speech library the second target multi-intent response speech text associated with the response intention set including the single target response intention; and respond to the current dialogue text to the terminal device based on the second target multi-intent response speech text.
[0236] The specific implementation of each of the above modules can be found in the previous embodiments and will not be described in detail here.
[0237] An embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the processor is used to execute the steps in the model training method provided in the above embodiment, or execute the steps in the text processing method provided in the above embodiment by calling a computer program stored in the memory.
[0238] Please refer to Figure 5 , Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0239] The electronic device may include components such as a processor 101 with one or more processing cores, a memory 102 with one or more computer-readable storage media, a power supply 103, and an input unit 104. Those skilled in the art will appreciate that Figure 5The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0240] The processor 101 is the control center of the electronic device, which uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 102, and calling data stored in the memory 102. Optionally, the processor 101 may include one or more processing cores; optionally, the processor 101 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 101.
[0241] The memory 102 can be used to store software programs and modules. The processor 101 executes various functional applications and data processing by running the software programs and modules stored in the memory 102. The memory 102 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 102 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 102 may also include a memory controller to provide the processor 101 with access to the memory 102.
[0242] Specifically in this embodiment, the processor 101 loads the executable code corresponding to one or more computer programs into the memory 102, and the processor 101 executes the steps in the model training method provided in this application, such as:
[0243] Acquire a multi-intent text, and segment the multi-intent text to obtain a first sub-text group of the multi-intent text;
[0244] Obtain a first candidate single intent set of the multi-intent text through the first single intent recognition model;
[0245] Obtaining a second candidate single intent set for each subtext in the first subtext group through the first single intent recognition model;
[0246] Determine a first target single intent set for the first subtext group according to the second candidate single intent set, where the first target single intent set includes a first target single intent corresponding to each subtext in the first subtext group;
[0247] An initial text merging model is obtained, and the first sub-text group corresponding to the first target single intent set matching the first candidate single intent set is used as the first training sample, and the multi-intent text is used as the first label corresponding to the first training sample. The initial text merging model is trained according to the first training sample and the first label to obtain the target text merging model.
[0248] Alternatively, the processor 101 loads executable codes corresponding to one or more computer programs into the memory 102, and the processor 101 executes the steps in the text processing method provided in the present application, such as:
[0249] Obtain a conversation intention set and obtain a response intention set corresponding to the conversation intention set;
[0250] Get the single-intent response text corresponding to each response intent in the response intent set;
[0251] Through the text merging model, the single-intent answering speech text corresponding to the answering intent set is merged to obtain the multi-intent answering speech text corresponding to the answering intent set;
[0252] The multi-intent response script text is associated with the response intent set and stored in the script library;
[0253] Among them, the text merging model is trained using the model training method provided in this application.
[0254] It should be noted that the electronic device provided in the embodiment of the present application belongs to the same concept as the model training method and text processing method in the above embodiments. The specific implementation process is detailed in the above related embodiments and will not be repeated here.
[0255] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program stored therein is executed on the processor of the electronic device provided in the embodiment of the present application, the processor of the electronic device implements the steps in the model training method provided in the present application, or the processor of the electronic device implements the steps in the text processing method provided in the present application. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0256] The present application also provides a computer program product, which includes a computer program. When the computer program is executed on the processor of the electronic device provided in the embodiment of the present application, the processor of the electronic device implements the steps in the model training method provided in the present application, or enables the processor of the electronic device to implement the steps in the text processing method provided in the present application.
[0257] The model training method, text processing method, model training device, text processing device, electronic device, computer-readable storage medium and computer program product provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A model training method, characterized in that: include: Acquire a multi-intent text, and segment the multi-intent text to obtain a first sub-text group of the multi-intent text; Obtaining a first candidate single intent set for the multi-intent text through a first single intent recognition model; Obtaining a second candidate single intent set for each subtext in the first subtext group by using the first single intent recognition model; Determine a first target single intent set of the first subtext group according to the second candidate single intent set, wherein the first target single intent set includes a first target single intent corresponding to each subtext in the first subtext group; An initial text merging model is obtained, and a first sub-text group corresponding to a first target single intent set matching the first candidate single intent set is used as a first training sample, and the multi-intent text is used as a first label corresponding to the first training sample. The initial text merging model is trained according to the first training sample and the first label to obtain a target text merging model.
2. The model training method according to claim 1, characterized in that: The taking the multi-intent text as the first label corresponding to the first training sample includes: Obtaining target punctuation marks of the multi-intent text; The multi-intent text with the target punctuation mark added is used as the first label corresponding to the first training sample.
3. The model training method according to claim 2, characterized in that: The obtaining of the initial text merging model comprises: Obtain the second intent recognition model and pre-trained language model; The initial text merging model is constructed based on the second single intent recognition model and the pre-trained language model.
4. The model training method according to claim 3, characterized in that: The step of training the initial text merging model according to the first training sample and the first label to obtain a target text merging model includes: Obtaining a third candidate single intent set for each subtext in the first training sample by using the second single intent recognition model; Determine, according to the third candidate single intent set, a second target single intent for each subtext in the first training sample, and obtain a second target single intent set of the first training sample, wherein the second target single intent set includes each of the second target single intents; Splitting the first tag into second sub-text groups according to the target punctuation mark; Obtaining a first character index representing a non-last subtext in the first training sample, and obtaining a second character index representing a subtext in the second subtext group; Taking the first character index and the second target single intent set as second training samples, taking the second character index and the target punctuation mark as second labels corresponding to the second training samples, and training the pre-trained language model according to the second training samples and the second labels; The target text merging model is obtained according to the trained pre-trained language model and the second single intent recognition model.
5. The model training method according to claim 4, characterized in that: The training of the pre-trained language model according to the second training sample and the second label includes: Deduplication processing is performed on the second target single intent set by using the pre-trained language model to obtain a second target single intent sequence; According to the second target single-intent sequence and the first character index, a third character index is obtained through the pre-trained language model, wherein the third character index represents a subtext in a predicted merged text obtained by merging subtexts in the first training sample; According to the second target single-intent sequence, obtaining predicted punctuation marks corresponding to the third text index through the pre-trained language model; Obtaining a first loss according to a difference between the predicted punctuation mark and the target punctuation mark, and obtaining a second loss according to a difference between the third character index and the second character index; According to the first loss and the second loss, a model parameter of the pre-trained language model is updated.
6. The model training method according to claim 5, characterized in that: The acquiring, according to the second target single-intent sequence, the predicted punctuation mark corresponding to the third character index through the pre-trained language model includes: Obtaining the intent priority of each second target single intent in the second target single intent sequence; Obtaining vector distances between adjacent second target single intentions in the second target single intention sequence; According to the intention priority and the vector distance, the predicted punctuation mark corresponding to the third text index is obtained through the pre-trained language model.
7. The model training method according to any one of claims 1 to 6, characterized in that: After the initial text merging model is trained according to the first training sample and the first label to obtain the target text merging model, the method further includes: Acquire a single-intent text, and acquire a fourth candidate single-intent set of the single-intent text through the first single-intent recognition model; Determining a third target single intent of the single intent text according to a fourth candidate single intent set of the single intent text; Merging the multiple single-intent texts through the target text merging model to obtain a multi-intent merged text; Obtain an initial multi-intent recognition model, and use the multi-intent merged text as a third training sample, and use the third target single intent of the multiple single intent texts from which the multi-intent merged text comes as a third label, and train the initial multi-intent recognition model according to the third training sample and the third label to obtain a target multi-intent recognition model.
8. A text processing method, characterized in that: include: Obtaining a conversation intention set, and obtaining a response intention set corresponding to the conversation intention set; Obtain the single-intent response speech text corresponding to each response intent in the response intent set; Through the target text merging model, the single-intent answering speech text corresponding to the answering intention set is text-merged to obtain the multi-intent answering speech text corresponding to the answering intention set; The multi-intention response speech text is associated with the response intention set and stored in the speech library; Wherein, the target text merging model is trained by using the model training method described in any one of claims 1-7.
9. The text processing method according to claim 8, characterized in that: After associating the multi-intention response speech text with the response intention set and storing them in the speech library, the method further includes: Get the current conversation text that needs to be answered from the terminal device; Performing multi-intention recognition on the current dialogue text through a target multi-intention recognition model to obtain a target dialogue intention set of the current dialogue text; Obtaining a target response intention set corresponding to the target conversation intention set; Determine the first target multi-intent response speech text associated with the target response intention set from the speech library; Respond to the current conversation text to the terminal device according to the first target multi-intent response speech text; Wherein, the target multi-intent recognition model is trained using the model training method described in claim 7.
10. The text processing method according to claim 9, characterized in that: The step of obtaining the current conversation text that needs to be answered from the terminal device includes: The current conversation audio is received from the terminal device, and the current conversation audio is translated into text to obtain the current conversation text that needs to be responded.
11. The text processing method according to claim 10, characterized in that: The step of responding to the current conversation text to the terminal device according to the first target multi-intent response speech text includes: Perform speech generation according to the first target multi-intent response speech text to obtain a target multi-intent response speech audio corresponding to the first target multi-intent response speech text; The target multi-intent response speech audio is returned to the terminal device, and the target multi-intent response speech audio is used for playing on the terminal device.
12. The text processing method according to claim 9, characterized in that: After performing multi-intent recognition on the current dialogue text through the target multi-intent recognition model to obtain the target dialogue intent set of the current dialogue text, the method further includes: If the target dialogue intention set includes only a single target dialogue intention, obtaining a single target response intention corresponding to the single target dialogue intention; Determine from the speech library a second target multi-intent response speech text associated with the response intention set including the single target response intention; According to the second target multi-intention response speech text, the current conversation text is responded to the terminal device.
13. A model training device, characterized in that: include: A text acquisition module, used for acquiring a multi-intent text and segmenting the multi-intent text to obtain a first sub-text group of the multi-intent text; A first single intent recognition module, used for obtaining a first candidate single intent set of the multi-intent text through a first single intent recognition model; A second single intent recognition module, configured to obtain a second candidate single intent set for each subtext in the first subtext group by using the first single intent recognition model; a target intent recognition module, configured to determine a first target single intent set of the first subtext group according to the second candidate single intent set, wherein the first target single intent set includes a first target single intent corresponding to each subtext in the first subtext group; A model training module is used to obtain an initial text merging model, and use the first sub-text group corresponding to the first target single intent set matching the first candidate single intent set as the first training sample, and use the multi-intent text as the first label corresponding to the first training sample, and train the initial text merging model according to the first training sample and the first label to obtain a target text merging model.
14. A text processing device, characterized in that: include: An intention acquisition module, used to acquire a conversation intention set and a response intention set corresponding to the conversation intention set; A speech acquisition module, used to obtain the single-intent response speech text corresponding to each response intent in the response intent set; A text merging module, used to merge the single-intent answering speech text corresponding to the answering intention set through a target text merging model, so as to obtain the multi-intent answering speech text corresponding to the answering intention set; A speech maintenance module, used for associating the multi-intention response speech text with the response intention set and storing them in a speech library; Wherein, the text merging model is trained using the model training method described in any one of claims 1-7.
15. An electronic device, characterized in that: It includes a memory and a processor, the memory stores a computer program, and the processor executes the computer program in the memory to implement the steps in the model training method described in any one of claims 1 to 7, or implement the steps in the text processing method described in any one of claims 8 to 12.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is suitable for execution by a processor to implement the steps in the model training method described in any one of claims 1 to 7, or to implement the steps in the text processing method described in any one of claims 8 to 12.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, it implements the steps of the model training method described in any one of claims 1 to 7, or implements the steps of the text processing method described in any one of claims 8 to 12.
Citation Information
Cited By
Training data generation method, equipment and program product
CN120849580A
Training data generation method, device, and program product
CN120849580B
