A dialogue text prediction method, device, equipment and storage medium
Patent Information
- Application Number
- CN202211385443.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-07
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2042-11-07
AI Technical Summary
[0004]有鉴于此,本发明的目的在于提供一种对话文本预测方法、装置、设备、存储介质,能够训练一个对话文本预测模型,能够对长度分布不均衡整篇对话文本进行预测,使以及句子表达效果更加稳定,解决prompt-tuning的小样本方式运行速度慢的问题,实现对话阶段识别
[0032]由此可见,本申请公开了一种对话文本预测方法,包括:基于目标对话文本的目标提示标签确定目标提示标签向量;利用自身领域对话文本对原始对话文本预测模型进行训练,以得到包含句子编码器的对话文本预测模型;将待预测对话文本输入至所述对话文本预测模型,以便利用所述句子编码器生成的与所述待预测对话文本对应的句子向量与所述目标提示标签向量进行数量积运算,以得到所述待预测对话文本的预测结果。可见,通过对表征标签提示文本的目标提示标签向量进行获取,作为对话文本预测模型的一个固定标签向量参数,用于将其与对待预测对话文本的句子向量进行处理的方式获取文本的预测结果,为后续的训练和预测节省时间,能够实现以大量样本数据训练其他预训练模型的同样稳定的句子表达效果,并且提升了以小样本的方式的对话文本预测模型预测的运行速度,并且本申请的对话文本预测模型中的句子编码器能够对待预测文本进行句子级向量化表示,减少文本长度分布不均衡造成的影响,因此能够对整篇长度分布不均衡的对话文本进行准确预测。
Smart Images

Figure CN115587173B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing, and in particular to a method, apparatus, device, and storage medium for predicting dialogue text. Background Technology
[0002] Sequence labeling is a task in natural language processing. Labeling each word differently enables functional modules such as word segmentation, entity extraction, and role labeling. Labeling each sentence enables functional modules such as text content segmentation, dialogue stages, and role differentiation. Sentence-level labeling presents two typical problems: one is that excessively long texts hinder modeling and real-time production; the other is that data acquisition and labeling in real-world scenarios require significant human and material resources. Regarding the first problem of excessively long texts, there are usually two approaches: one is to directly use the entire text as input for word-level labeling to simulate sentence-level labeling, but this struggles to address the highly uneven distribution of text lengths in dialogue scenarios. The other approach is to use a general pre-trained model to vectorize individual sentences as input for the next-level sequence labeling model, but the data characteristics of each scenario cannot be well represented directly by a general pre-trained model. Regarding the second problem of difficulty in obtaining datasets, few-shot methods are commonly used, but the current mainstream concatenation-based prompt-tuning is more suitable for classification scenarios and struggles with sequence labeling.
[0003] In summary, how to train a dialogue text prediction model that can predict entire dialogue texts with uneven length distribution, make sentence expression effects more stable, solve the problem of slow operation of the prompt-tuning small sample method, and achieve dialogue stage recognition are technical problems that need to be solved in this field. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a dialogue text prediction method, apparatus, device, and storage medium, capable of training a dialogue text prediction model that can predict entire dialogue texts with uneven length distributions, resulting in more stable sentence expression effects, solving the problem of slow operation speed of the prompt-tuning method with small samples, and achieving dialogue stage recognition. The specific solution is as follows:
[0005] Firstly, this application discloses a method for predicting dialogue text, including:
[0006] Determine the target cue label vector based on the target cue labels in the target dialogue text;
[0007] The original dialogue text prediction model is trained using the dialogue text in its own domain to obtain a dialogue text prediction model containing a sentence encoder.
[0008] The dialogue text to be predicted is input into the dialogue text prediction model, so that the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder is used to perform a dot product operation with the target prompt label vector to obtain the prediction result of the dialogue text to be predicted.
[0009] Optionally, determining the target cue tag vector based on the target cue tag of the target dialogue text includes:
[0010] Determine the task category of the target dialogue text, and label the target dialogue text with sentence-level prompt tags according to the task category to obtain the prompt tags corresponding to the target dialogue text;
[0011] The prompt labels are processed by label conversion and vector generation to generate corresponding target prompt label vectors.
[0012] Optionally, the step of performing label conversion and vector generation processing on the prompt label to generate a corresponding target prompt label vector includes:
[0013] The prompt label is converted into the target prompt label using a label conversion template;
[0014] The target cue label is input into the label encoder to generate the target cue label vector.
[0015] Optionally, before converting the prompt label into the target prompt label using the label conversion template, the method further includes:
[0016] A tag conversion template is constructed based on the mapping relationship between the aforementioned prompt tags and standard prompt tags.
[0017] Optionally, before inputting the target cue label into the label encoder to generate the target cue label vector, the method further includes:
[0018] Embedding vectors are generated by performing the Shuffle algorithm and the Token CutOff algorithm on dialogue texts within the same domain, respectively, to obtain the first embedding vector and the second embedding vector.
[0019] The first embedding vector and the second embedding vector are used for comparative learning to generate a sentence encoder for the dialogue text prediction model.
[0020] Optionally, the step of generating an embedding vector from the domain-specific dialogue text using the Shuffle algorithm to obtain a first embedding vector includes:
[0021] Multiple embedding vectors corresponding to the dialogue text in its own domain are determined. The multiple embedding vectors are then filtered using the Shuffle algorithm based on a preset standard probability. The filtered embedding vector is then used as the first embedding vector.
[0022] Optionally, the process of training the original dialogue text prediction model using its own domain dialogue text to obtain a dialogue text prediction model containing a sentence encoder further includes:
[0023] The original dialogue text prediction model is trained using dialogue text with target cue label vectors after training to obtain the corresponding sentence encoder.
[0024] Secondly, this application discloses a dialogue text prediction device, comprising:
[0025] The label vector determination module is used to determine the target cue label vector based on the target cue label of the target dialogue text.
[0026] The model generation module is used to train the original dialogue text prediction model using the dialogue text in its own domain, so as to obtain a dialogue text prediction model containing a sentence encoder.
[0027] The dialogue prediction module is used to input the dialogue text to be predicted into the dialogue text prediction model, so as to perform a dot product operation between the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder and the target prompt label vector to obtain the prediction result of the dialogue text to be predicted.
[0028] Thirdly, this application discloses an electronic device, comprising:
[0029] Memory, used to store computer programs;
[0030] A processor is configured to execute the computer program to implement the steps of the aforementioned disclosed dialogue text prediction method.
[0031] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned disclosed dialogue text prediction method.
[0032] Therefore, this application discloses a dialogue text prediction method, including: determining a target cue label vector based on the target cue label of the target dialogue text; training an original dialogue text prediction model using dialogue text from its own domain to obtain a dialogue text prediction model containing a sentence encoder; inputting the dialogue text to be predicted into the dialogue text prediction model, so as to perform a dot product operation between the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder and the target cue label vector to obtain the prediction result of the dialogue text to be predicted. It is evident that by obtaining the target cue label vector representing the cue text and using it as a fixed label vector parameter of the dialogue text prediction model, and processing it with the sentence vector of the dialogue text to be predicted to obtain the prediction result, time is saved for subsequent training and prediction. This method achieves the same stable sentence expression effect as training other pre-trained models with a large amount of sample data, and improves the running speed of the dialogue text prediction model using a small sample approach. Furthermore, the sentence encoder in the dialogue text prediction model of this application can perform sentence-level vectorization representation of the text to be predicted, reducing the impact of uneven text length distribution, thus enabling accurate prediction of dialogue texts with uneven length distribution. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0034] Figure 1 This is a flowchart of a dialogue text prediction method disclosed in this application;
[0035] Figure 2 This is a schematic diagram illustrating a sentence-level prompt label disclosed in this application;
[0036] Figure 3 Here is a flowchart of a specific dialogue text prediction method disclosed in this application;
[0037] Figure 4 This is a schematic diagram illustrating the sentence-level prompt label conversion disclosed in this application;
[0038] Figure 5 This application discloses a flowchart of a dual-tower few-shot training process for dialogue text.
[0039] Figure 6 This is a schematic diagram of the structure of a dialogue text prediction device disclosed in this application;
[0040] Figure 7 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0041] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0042] Sequence labeling is a task in natural language processing. Labeling each word differently enables functional modules such as word segmentation, entity extraction, and role labeling. Labeling each sentence enables functional modules such as text content segmentation, dialogue stages, and role differentiation. Sentence-level labeling has two typical problems: one is that the length of the entire text is not conducive to modeling and real-time production; the other is that data acquisition and labeling in real-world scenarios requires a significant amount of manpower and resources. Regarding the first problem of excessively long texts, there are usually two approaches: one is to directly use the entire text as input for word-level labeling to simulate sentence-level labeling, but this struggles to address the highly uneven distribution of text length in dialogue scenarios; the other approach is to use a general pre-trained model to vectorize individual sentences as input for the next-level sequence labeling model, but the data characteristics of each scenario cannot be well represented directly by a general pre-trained model. Regarding the second problem of difficulty in obtaining datasets, the few-shot method is often used, but the currently mainstream concatenated prompt-tuning is more suitable for classification scenarios and struggles with sequence labeling.
[0043] To address this, the present invention discloses a dialogue text prediction scheme that can train a dialogue text prediction model to predict the entire dialogue text with uneven length distribution, thereby making the sentence expression effect more stable, solving the problem of slow operation speed of the prompt-tuning small sample method, and realizing dialogue stage recognition.
[0044] Reference Figure 1 As shown, this embodiment of the invention discloses a method for predicting dialogue text, including:
[0045] Step S11: Determine the target cue label vector based on the target cue label of the target dialogue text.
[0046] In this embodiment, the target prompt tag vector is determined based on the target prompt tags of the target dialogue text. Specifically, firstly, the task category of the target dialogue text is determined. Sentence-level prompt tags are then added to the target dialogue text according to the task category to obtain the prompt tags corresponding to the target dialogue text. The prompt tags are then processed through tag conversion and vector generation to generate the corresponding target prompt tag vector. It is understood that when selecting target dialogue text from the dialogue text set, it is important to note that the selected target dialogue text is unlabeled. The business scenario of the selected target dialogue text is judged, and the corresponding task category tag is assigned to the target dialogue text, i.e., sequence labeling task category. The task category tag is determined based on the business scenario of the target dialogue text. The task category tag may include, but is not limited to, dialogue stage categories such as: opening remarks, call background, product introduction, requirement mining, objection handling, next action, and others. A small amount of manual sentence-level prompt tagging is performed on the target dialogue text according to the task category. That is, each sentence in the selected target dialogue text is categorized using human experience. Figure 2 As shown, sentence 1 is labeled as "opening remarks," sentence 2 as "opening remarks," sentence 3 as "product introduction," sentence 4 as "other," and sentence 5 as "other." Following this method, the selected target dialogue text is annotated at the sentence level, and a target prompt label vector is generated based on the prompt labels of all manually annotated target dialogue text. The category labels for the business scenario dialogue stage corresponding to the manually annotated stage are determined in advance by the human team. This approach is more closely aligned with business needs.
[0047] Step S12: Train the original dialogue text prediction model using the dialogue text in its own domain to obtain a dialogue text prediction model containing a sentence encoder.
[0048] In this embodiment, the original dialogue text prediction model is trained using domain-specific dialogue text. Specifically, the original dialogue text prediction model is trained using trained dialogue text with target cue label vectors to obtain a corresponding sentence encoder. Unsupervised contrastive learning training is then performed using the user's own unlabeled data to obtain a domain-specific dialogue text prediction model. Again, the original dialogue text prediction model is trained using trained dialogue text with target cue label vectors to obtain a corresponding sentence encoder. The dialogue text training model specifically includes a sentence vector encoder and a label encoder. It's important to note that the dialogue text prediction model requires two training processes: a label encoder training process and a sentence vector encoder training process. The label encoder represents the text's labels as cue labels using vectors, and the sentence vector encoder represents the text as sentence vectors. Therefore, the label encoder process is performed first, and then the dialogue text training model, including the trained label encoder, is trained again on the sentence vector representation to obtain the sentence vector encoder training process. Finally, the dialogue text training model containing both the label encoder and the sentence vector encoder is obtained. In this way, the dialogue text prediction model obtained through contrastive learning training on domain-specific data is more closely aligned with the current business scenario.
[0049] In this embodiment, a pre-defined text vector generation algorithm is used to perform comparative learning processing on the domain-specific dialogue text containing the target dialogue text to generate a sentence encoder for the dialogue text prediction model. Specifically, the Shuffle algorithm and the Token CutOff algorithm are used to generate embedding vectors for the same domain-specific dialogue text to obtain a first embedding vector and a second embedding vector. Comparative learning processing is then performed using the first and second embedding vectors to generate the sentence encoder for the dialogue text prediction model. It is understood that because domain-specific dialogue texts have high relevance and similarity, both the Shuffle algorithm and the Token CutOff algorithm are used to obtain different embedding vector representations to increase the difficulty of comparative learning.
[0050] Commonly used Shuffle algorithms reorder each embedding vector with the same probability. However, excessive vector reordering may affect the meaning of the sentence. Therefore, in this embodiment, multiple embedding vectors corresponding to the dialogue text of the domain are determined. The Shuffle algorithm is used to filter these multiple embedding vectors based on a preset standard probability, and the filtered embedding vectors are used as the first embedding vectors. Specifically, after obtaining multiple embedding vectors of the sentence, a standard probability p of 20% is added as a secondary constraint when reordering the multiple embedding vectors. That is, each time, a vector is randomly calculated from the unprocessed embedding vectors, and then the standard probability p is used to determine whether to place it at the end of the unprocessed vectors. This process continues until all vectors have been processed. From all the embedding vectors, the embedding vector with a probability greater than the standard probability p is selected as the first embedding vector. Similarly, a standard probability p is also set for the Token CutOff algorithm. Each embedding vector is sampled using the standard probability p. If the embedding vectors can be sampled based on the set standard probability p, the value is reset to 0, and the standard probability is reset for resampling.
[0051] In this embodiment, the NT-Xent loss is used to fine-tune the dialogue text prediction model. Specifically, N texts from the same batch are used to generate corresponding original text vectors. Then, the Shuffle algorithm and Token CutOff algorithm are used to generate corresponding text vectors for each original text vector, namely, the first embedding vector and the second embedding vector. The total number of first and second embedding vectors is 2N. The NT-Xent loss formula is as follows:
[0052] ;
[0053] in, This is the first embedding vector of a specific text within the dialogue text of its own domain. The value range is from 1 to N. This is the second embedding vector for the same text. The value range is from N+1 to 2N. This refers to the text vector corresponding to the dialogue text within its own domain. With the corresponding For each pair of positive samples, the others are negative samples, and N is the number of embedding vectors in the current batch. The temperature parameter is set to 1.
[0054] Correspondingly, when using NT-Xent loss, the main purpose is to make the vectors of positive sample pairs very similar, and the vectors of positive and negative samples dissimilar, so that the loss is optimized towards the goal of -log(1)=0, so that the model can have a better representation ability for text. If during training... Setting the value too high will result in an overestimation of the confidence level of the prediction results. A smaller value leads to a lower confidence level in the prediction results; therefore, adjustments need to be made based on the actual situation. Configure it appropriately.
[0055] Step S13: Input the dialogue text to be predicted into the dialogue text prediction model, so as to perform a dot product operation between the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder and the target prompt label vector to obtain the prediction result of the dialogue text to be predicted.
[0056] In this embodiment, the dialogue text to be predicted is input into the trained and fine-tuned dialogue text prediction model. Then, a sentence encoder generates the corresponding sentence vector, and this sentence vector is multiplied by the target cue label vector stored in the model. The result of the multiplication is then normalized using the softmax function. After normalization, the prediction result corresponding to the highest probability is obtained using the argmax function, which yields the final prediction result of the dialogue text. Specifically, the dialogue text data, the previously trained cue label vector, and the fine-tuned dialogue text prediction model are loaded to perform dialogue-stage prediction, and the prediction can be generated in real time. The formula for obtaining the prediction result is as follows:
[0057] ;
[0058] y represents the prediction result of the text to be predicted, e represents the vector representation of each sentence generated by the sentence encoder after fine-tuning with NT-Xent loss, and b represents the target cue label vector.
[0059] Therefore, this application discloses a dialogue text prediction method, including: determining a target cue label vector based on the target cue label of the target dialogue text; training an original dialogue text prediction model using dialogue text from its own domain to obtain a dialogue text prediction model containing a sentence encoder; inputting the dialogue text to be predicted into the dialogue text prediction model, so as to perform a dot product operation between the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder and the target cue label vector to obtain the prediction result of the dialogue text to be predicted. It is evident that by obtaining the target cue label vector representing the cue text and using it as a fixed label vector parameter of the dialogue text prediction model, and processing it with the sentence vector of the dialogue text to be predicted to obtain the prediction result, time is saved for subsequent training and prediction. This method achieves the same stable sentence expression effect as training other pre-trained models with a large amount of sample data, and improves the running speed of the dialogue text prediction model using a small sample approach. Furthermore, the sentence encoder in the dialogue text prediction model of this application can perform sentence-level vectorization representation of the text to be predicted, reducing the impact of uneven text length distribution, thus enabling accurate prediction of dialogue texts with uneven length distribution.
[0060] Reference Figure 3 As shown, this embodiment of the invention discloses a specific method for predicting dialogue text. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically:
[0061] Step S21: Determine the task category of the target dialogue text, and label the target dialogue text with sentence-level prompt tags according to the task category to obtain the prompt tags corresponding to the target dialogue text.
[0062] Step S22: Use the label conversion template to convert the prompt label into a target prompt label; input the target prompt label into the label encoder to generate a target prompt label vector.
[0063] In this embodiment, as Figure 4As shown, according to the label conversion template, all labels except other labels are converted to [start + {label name}, process + {label name}], while other labels remain unchanged as [other]. Before automatically converting the prompt labels to target prompt labels using the label conversion template, the process further includes: constructing a label conversion template based on the mapping relationship between the prompt labels and standard prompt labels. It can be understood that the prompt labels are pre-mapped to their corresponding standard prompt labels, and a label conversion template is constructed based on this mapping relationship. In this way, standard prompt labels are obtained for subsequent training by constructing the label conversion template, and used to train the prompt label encoder in the dialogue text prediction model, so that the prompt label encoder can generate the corresponding target prompt label vector.
[0064] Step S23: Train the original dialogue text prediction model using the dialogue text in its own domain to obtain a dialogue text prediction model containing a sentence encoder.
[0065] Step S24: Input the dialogue text to be predicted into the dialogue text prediction model, so as to perform a dot product operation between the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder and the target prompt label vector to obtain the prediction result of the dialogue text to be predicted.
[0066] Reference Figure 5 As shown, the target cue label vector, generated by the cue label encoder in the contrastive learning representation model, is obtained in advance. This eliminates the need for on-site generation of cue labels and allows for direct use, reducing the time spent on repeated predictions. The cue labels can then be directly used for subsequent data training and prediction. When the dialogue text to be predicted is input into the contrastive learning representation model, the text that has passed through the dialogue stage in the contrastive learning representation model is used to perform sentence-level vectorization. The dialogue sentence encoder, after being trained with dual towers and few-shots, outputs the sentence vector of the dialogue text to be predicted. The sentence vector and the target prompt label vector are then subjected to dot product operation, normalization, and the prediction result with the highest prediction probability to obtain the final prediction result. It can be seen that compared with the sentence prediction methods based on traditional machine learning models for long text sequence labeling tasks, deep learning models for long text sequence labeling tasks, pre-trained models + fine-tuning for long text sequence labeling tasks, pre-trained models + fine-tuning for sentence-level sequence labeling tasks, and pre-trained models + cloze-prompt for sequence labeling tasks, the problems of poor prediction performance, focusing on too many data features during model training, inability to quickly predict unevenly distributed long texts, and inability to generate small sample recognition in real time are all improved.
[0067] Therefore, by using a cue label encoder to represent and store cue labels as vectors, time is saved for subsequent training and prediction. Furthermore, this model is used as a dialogue sentence encoder to perform sentence-level vectorization of the dialogue text, reducing the impact of uneven text length distribution. Then, dual-tower few-shot training is performed to reduce dependence on the amount of data, achieving better dialogue prediction results.
[0068] Reference Figure 6 As shown, this embodiment of the invention also discloses a dialogue text prediction device, comprising:
[0069] The label vector determination module 11 is used to determine the target prompt label vector based on the target prompt label of the target dialogue text;
[0070] The model generation module 12 is used to train the original dialogue text prediction model using its own domain dialogue text to obtain a dialogue text prediction model containing a sentence encoder.
[0071] The dialogue prediction module 13 is used to input the dialogue text to be predicted into the dialogue text prediction model, so as to perform a dot product operation between the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder and the target prompt label vector to obtain the prediction result of the dialogue text to be predicted.
[0072] Therefore, this application discloses a dialogue text prediction method, including: determining a target cue label vector based on the target cue label of the target dialogue text; training an original dialogue text prediction model using dialogue text from its own domain to obtain a dialogue text prediction model containing a sentence encoder; inputting the dialogue text to be predicted into the dialogue text prediction model, so as to perform a dot product operation between the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder and the target cue label vector to obtain the prediction result of the dialogue text to be predicted. It is evident that by obtaining the target cue label vector representing the cue text and using it as a fixed label vector parameter of the dialogue text prediction model, and processing it with the sentence vector of the dialogue text to be predicted to obtain the prediction result, time is saved for subsequent training and prediction. This method achieves the same stable sentence expression effect as training other pre-trained models with a large amount of sample data, and improves the running speed of the dialogue text prediction model using a small sample approach. Furthermore, the sentence encoder in the dialogue text prediction model of this application can perform sentence-level vectorization representation of the text to be predicted, reducing the impact of uneven text length distribution, thus enabling accurate prediction of dialogue texts with uneven length distribution.
[0073] Furthermore, embodiments of this application also disclose an electronic device, Figure 7This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0074] Figure 7 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the dialogue text prediction method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0075] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0076] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0077] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0078] The operating system 221 manages and controls the various hardware devices and computer programs 222 on the electronic device 20 to enable the processor 21 to perform calculations and processing on the massive amounts of data 223 in the memory 22. The operating system 221 can be Windows Server, Netware, Unix, Linux, etc. The computer program 222, in addition to including a computer program capable of performing the dialogue text prediction method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data 223 may include data received by the electronic device from external devices, as well as data collected by its own input / output interface 25.
[0079] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed dialogue text prediction method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0080] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0081] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can implement the described functions using different methods for each specific application, but such implementation should not be considered beyond the scope of this application. The steps of the methods or algorithms described in connection with the embodiments disclosed herein can be implemented directly in hardware, software modules executed by a processor, or a combination of both. Software modules can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the art.
[0082] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0083] The above provides a detailed description of the dialogue text prediction method, apparatus, device, and storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for predicting dialogue text, characterized in that, include: The target prompt label vector is determined based on the target prompt label of the target dialogue text; wherein, the target dialogue text is unlabeled dialogue text, and the target prompt label is the category label of the business scenario dialogue stage corresponding to the business scenario in which the target dialogue text is located; The determination of the target cue tag vector based on the target cue tag of the target dialogue text includes: Determine the task category of the target dialogue text, and label the target dialogue text with sentence-level prompt tags according to the task category to obtain the prompt tags corresponding to the target dialogue text; The prompt labels are pre-mapped to their corresponding standard prompt labels, and a label conversion template is constructed based on the mapping relationship; the standard prompt labels are used to train the label encoder in the dialogue text prediction model. The prompt labels are converted into corresponding target prompt labels using the label conversion template; the target prompt labels are input into the label encoder to generate the target prompt label vector; the target prompt label vector is used as a fixed label vector parameter for the dialogue text prediction model for model training and result prediction. The original dialogue text prediction model is trained using the dialogue text within its own domain to obtain a dialogue text prediction model containing a sentence encoder; wherein, the dialogue text within its own domain is the dialogue text that carries target cue label vectors after training; embedding vector generation is performed on the same dialogue text within its own domain using the Shuffle algorithm and the Token CutOff algorithm respectively to obtain a first embedding vector and a second embedding vector; the first embedding vector and the second embedding vector are used for comparative learning to generate the sentence encoder of the dialogue text prediction model; the original dialogue text prediction model is trained using the dialogue text that carries target cue label vectors after training to obtain the corresponding sentence encoder; The dialogue text to be predicted is input into the dialogue text prediction model, so that the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder is multiplied by the target prompt label vector to obtain the prediction result of the dialogue text to be predicted.
2. The dialogue text prediction method according to claim 1, characterized in that, The step of generating an embedding vector from the domain-specific dialogue text using the Shuffle algorithm to obtain the first embedding vector includes: Multiple embedding vectors corresponding to the dialogue text in its own domain are determined. The multiple embedding vectors are then filtered using the Shuffle algorithm based on a preset standard probability. The filtered embedding vector is then used as the first embedding vector.
3. A dialogue text prediction device, characterized in that, include: The label vector determination module is used to determine the target prompt label vector based on the target prompt label of the target dialogue text; wherein, the target dialogue text is unlabeled dialogue text, and the target prompt label is the category label of the business scenario dialogue stage corresponding to the business scenario in which the target dialogue text is located; The label vector determination module is specifically used to determine the task category of the target dialogue text, and to annotate the target dialogue text with sentence-level prompt labels according to the task category to obtain the prompt labels corresponding to the target dialogue text; the prompt labels are pre-mapped with corresponding standard prompt labels, and a label conversion template is constructed based on the mapping relationship; the standard prompt labels are used to train the label encoder in the dialogue text prediction model; the prompt labels are converted into corresponding target prompt labels using the label conversion template; the target prompt labels are input into the label encoder to generate the target prompt label vector; the target prompt label vector serves as a fixed label vector parameter for the dialogue text prediction model, used for model training and result prediction; The model generation module is used to train the original dialogue text prediction model using the dialogue text in its own domain to obtain a dialogue text prediction model containing a sentence encoder; wherein, the dialogue text in its own domain is the dialogue text carrying target prompt label vectors after training; embedding vector generation is performed on the same dialogue text in its own domain using the Shuffle algorithm and the Token CutOff algorithm respectively to obtain a first embedding vector and a second embedding vector; the first embedding vector and the second embedding vector are used for comparative learning to generate the sentence encoder of the dialogue text prediction model; the original dialogue text prediction model is trained using the dialogue text carrying target prompt label vectors after training to obtain the corresponding sentence encoder; The dialogue prediction module is used to input the dialogue text to be predicted into the dialogue text prediction model, so as to perform a dot product operation between the sentence vector corresponding to the dialogue text to be predicted generated by the sentence encoder and the target prompt label vector to obtain the prediction result of the dialogue text to be predicted.
4. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the dialogue text prediction method as described in any one of claims 1 or 2.
5. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein, when executed by a processor, the computer program implements the steps of the dialogue text prediction method as described in any one of claims 1 or 2.
Citation Information
Patent Citations
Zero-sample text classification method based on label extension
CN113723106A
Dialogue text enhancement method and device, equipment and storage medium
CN114970499A