Semantic feature extraction model training method and device, equipment and storage medium
By obtaining and adjusting negative sample text and enhanced text in the training text, and calculating semantic similarity, it solves the problems of low accuracy and semantic collapse in traditional semantic feature extraction model training, and achieves higher model accuracy and label accuracy. .
Patent Information
- Application Number
- CN202410082335.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-19
- Publication Date
- 2024-09-17
AI Technical Summary
In traditional semantic feature extraction model training methods, the time cost of manual annotation is high, resulting in a small number of training texts, low model accuracy, and semantic collapse problems.
By obtaining the training text set and the enhanced text set, the negative sample text is determined, the error loss is calculated based on semantic similarity, the semantic feature extraction model parameters are adjusted, and the target semantic feature extraction model is used for clustering and label determination to improve model accuracy.
It improves the accuracy of the semantic feature extraction model, reduces the problem of semantic collapse, and enhances the diversity of training data and the accuracy of labels.
Smart Images

Figure CN118657151A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a semantic feature extraction model training method, device, equipment and storage medium. Background Art
[0002] With the development of computer technology, semantic feature extraction models have emerged. The semantic feature extraction model is a neural network model that is used to convert text information into semantic feature vectors. In order to improve the accuracy of the semantic feature extraction model, it is necessary to train the semantic feature extraction model and adjust the parameters of the semantic feature extraction model to improve its accuracy.
[0003] In the traditional method, the training text is manually annotated to obtain the corresponding labels of the training text, and then the labeled training text is used to train the semantic feature extraction model. Since manual annotation takes a lot of time, the number of training texts used to train the semantic feature extraction model is small, resulting in low accuracy of the semantic feature extraction model. Summary of the invention
[0004] Based on this, it is necessary to provide a semantic feature extraction model training method, device, equipment, computer-readable storage medium and computer program product that can improve the accuracy of the semantic feature extraction model in response to the above technical problems.
[0005] In a first aspect, the present application provides a semantic feature extraction model training method. The method comprises:
[0006] Acquire a training text set and an enhanced text set corresponding to the training text set, wherein the training text set includes a first training text, and the enhanced text set includes a first enhanced text corresponding to the first training text;
[0007] Determine a first negative sample text corresponding to the first training text from the enhanced text set, and determine a second negative sample text corresponding to the first training text from the training text set;
[0008] determining an error loss corresponding to the first training text based on a training semantic similarity between the first training text and the first enhanced text, a first semantic similarity between the first training text and the first negative sample text, and a second semantic similarity between the first training text and the second negative sample text, and
[0009] The semantic feature extraction model is adjusted based on the error loss.
[0010] The present application provides a text label determination method. The method comprises:
[0011] Get multiple texts to be determined;
[0012] Inputting the to-be-determined text into a target semantic feature extraction model to obtain a target semantic feature vector corresponding to the to-be-determined text; the target semantic feature extraction model is trained using a semantic feature extraction model training method;
[0013] Clustering the multiple texts to be determined based on the target semantic feature vectors corresponding to the texts to be determined to obtain multiple target cluster sets;
[0014] For each of the target cluster sets, based on the target semantic feature vector corresponding to the text to be determined in the target cluster set and the candidate semantic feature vector corresponding to the candidate tag, determine the tag semantic similarity between the target cluster set and the candidate tag;
[0015] Based on the semantic similarity between each of the candidate tags and the target cluster set, a target tag corresponding to the target cluster set is determined.
[0016] In a second aspect, the present application also provides a semantic feature extraction model training device. The device comprises:
[0017] A training text acquisition module, used to acquire a training text set and an enhanced text set corresponding to the training text set, wherein the training text set includes a first training text, and the enhanced text set includes a first enhanced text corresponding to the first training text;
[0018] A screening module, used to determine a first negative sample text corresponding to the first training text from the enhanced text set, and to determine a second negative sample text corresponding to the first training text from the training text set;
[0019] a loss determination module, configured to determine an error loss corresponding to the first training text based on a training semantic similarity between the first training text and the first enhanced text, a first semantic similarity between the first training text and the first negative sample text, and a second semantic similarity between the first training text and the second negative sample text;
[0020] An adjustment module is used to adjust the semantic feature extraction model based on the error loss.
[0021] The present application also provides a text label determination device. The device comprises:
[0022] A module for obtaining texts to be determined, used for obtaining multiple texts to be determined;
[0023] An input module, used for inputting the text to be determined into a target semantic feature extraction model to obtain a target semantic feature vector corresponding to the text to be determined; the target semantic feature extraction model is trained by a semantic feature extraction model training device;
[0024] A clustering module, used for clustering the plurality of to-be-determined texts based on the target semantic feature vectors corresponding to the to-be-determined texts to obtain a plurality of target clustering sets;
[0025] A similarity determination module is used to determine, for each of the target cluster sets, the tag semantic similarity between the target cluster set and the candidate tag based on the target semantic feature vector corresponding to the text to be determined in the target cluster set and the candidate semantic feature vector corresponding to the candidate tag;
[0026] The tag determination module is used to determine the target tag corresponding to the target cluster set based on the tag semantic similarity between each of the candidate tags and the target cluster set.
[0027] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.
[0028] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any one of the methods described in the first aspect.
[0029] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of any one of the methods described in the first aspect.
[0030] The semantic feature extraction model training method, apparatus, device and storage medium in the embodiments of the present application obtain a training text set and an enhanced text set corresponding to the training text set, wherein the training text set includes a first training text, and the enhanced text set includes a first enhanced text corresponding to the first training text; determine a first negative sample text corresponding to the first training text from the enhanced text set, and determine a second negative sample text corresponding to the first training text from the training text set; determine an error loss corresponding to the first training text based on the training semantic similarity between the first training text and the first enhanced text, the first semantic similarity between the first training text and the first negative sample text, and the second semantic similarity between the first training text and the second negative sample text; and adjust the semantic feature extraction model based on the error loss. By determining the first negative sample text and the second negative sample text from the enhanced text set and the training text set respectively, a plurality of negative sample texts of the first training text are obtained, the first negative sample text and the second negative sample text are used to construct a negative sample pair with the first training text, and the first enhanced text and the first training text are used to construct a positive sample pair, and based on the semantic similarity between the positive sample pairs and the semantic similarity between the negative sample pairs, an error loss is obtained, and the error loss is used to adjust the parameters of the semantic feature extraction model so that the semantic similarity between the positive sample pairs is as high as possible and the semantic similarity between the negative sample pairs is as low as possible, thereby reducing the semantic collapse problem and improving the accuracy of the semantic feature extraction model.
[0031] The text label determination method, apparatus, device and storage medium in the embodiments of the present application use a trained target semantic feature extraction model to determine a target semantic feature vector corresponding to the text to be determined, thereby improving the accuracy of the target semantic feature vector, clustering multiple texts to be determined according to the target semantic feature vector corresponding to the text to be determined to obtain multiple target cluster sets, and then determining the target label corresponding to the target cluster set according to the label semantic similarity between each candidate label and the target cluster set, that is, selecting a candidate label with high semantic similarity to the label of the target cluster set as the target label, determining the target label of the target cluster set in a quantitative form, thereby improving the accuracy of the target label corresponding to the target cluster set, and finally determining the target label as the label corresponding to the text to be determined in the target cluster set, thereby improving the accuracy of the label determination of the text to be determined. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 An application environment diagram of a semantic feature extraction model training method in one embodiment;
[0034] Figure 2 A flowchart of a semantic feature extraction model training method in one embodiment;
[0035] Figure 3 A schematic diagram of a flow chart of a step of determining an enhanced semantic feature vector in one embodiment;
[0036] Figure 4 A schematic diagram of a flow chart of a first negative sample text determination step in an embodiment;
[0037] Figure 5 A schematic flow chart of an error loss determination step in one embodiment;
[0038] Figure 6 A schematic diagram of a flow chart of steps for determining a training text set and an enhanced text set in one embodiment;
[0039] Figure 7 A schematic diagram of a flow chart of a label determination method in one embodiment;
[0040] Figure 8 is a schematic diagram of a positive sample pair and a negative sample pair in one embodiment;
[0041] Fig. 9 A flowchart of a semantic feature extraction model training step in one embodiment;
[0042] Fig.10 A schematic diagram of a flow chart of a tag determination step in one embodiment;
[0043] Fig.11 It is a structural block diagram of a semantic feature extraction model training device in one embodiment;
[0044] Fig.12 is a structural block diagram of a label determination device in one embodiment;
[0045] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0047] In the related art, when using contrastive learning to train a semantic feature extraction model, a negative sample corresponding to the current training text is determined from an enhanced text set. Since the semantic similarity between the negative sample and the current training text is quite different, the target semantic feature extraction model obtained by using the negative sample to train the semantic feature extraction model suffers from the problem of semantic collapse.
[0048] In order to improve the accuracy of the semantic feature extraction model, the embodiment of the present application provides a semantic feature extraction model training method and a text label determination method. The method obtains a training text set and an enhanced text set corresponding to the training text set, the training text set includes a first training text, the first training text is the current training text, the enhanced text set includes a first enhanced text corresponding to the first training text, the first negative sample text corresponding to the first training text is determined from the enhanced text set, the second negative sample text corresponding to the first training text is determined from the training text set, based on the training semantic similarity between the first training text and the first enhanced text, the first semantic similarity between the first training text and the first negative sample text, and the second semantic similarity between the first training text and the second negative sample text, the error loss corresponding to the first training text is determined; the semantic feature extraction model is adjusted based on the error loss. Then, the target semantic feature extraction model is used to determine the target semantic feature vector corresponding to the text to be determined. Based on the target semantic feature vector corresponding to the text to be determined, multiple texts to be determined are clustered to obtain multiple target cluster sets. For each target cluster set, the label semantic similarity between the target cluster set and the candidate label is determined based on the target semantic feature vector corresponding to the text to be determined in the target cluster set and the candidate semantic feature vector corresponding to the candidate label. Based on the label semantic similarity between each candidate label and the target cluster set, the target label corresponding to the target cluster set is determined.
[0049] The semantic feature extraction model training method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Both the terminal and the server can be used alone to execute the semantic feature extraction model training method provided in the embodiment of the present application. The terminal and the server can also be used together to execute the semantic feature extraction model training method provided in the embodiment of the present application. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0050] In one embodiment, Figure 2 As shown, a semantic feature extraction model training method is provided. This embodiment takes the application of the method to a computer device as an example to illustrate, including steps 202 to 208.
[0051] Step 202: Acquire a training text set and an enhanced text set corresponding to the training text set, wherein the training text set includes a first training text, and the enhanced text set includes a first enhanced text corresponding to the first training text.
[0052] Among them, the training text set refers to a set composed of multiple training texts, and the training text refers to the text used to train the semantic feature extraction model. The training text can be the conversation information of the service object. The enhanced text set refers to a set composed of multiple enhanced texts, and the enhanced text refers to the text obtained by enhancing the training text in the training text set. The number of training texts in the training text set can be the same as the number of enhanced texts in the enhanced text set, that is, each training text in the training text set is enhanced once to obtain an enhanced text corresponding to the training text; the number of training texts in the training text set can also be different from the number of enhanced texts in the enhanced text set, that is, each training text in the training text set is enhanced at least once to obtain at least one enhanced text corresponding to the training text. The first training text refers to the training text in the training text set, the first negative sample text and the second negative sample text to be determined at present, which can be understood as the training text used for training the semantic feature extraction model this time, and the first training text can be any training text in the training text set. The first enhanced text refers to the text obtained after the first training text is enhanced.
[0053] Exemplarily, a computer device obtains a training text set for training a semantic feature extraction model and an enhanced text set corresponding to the training text set, obtains a first training text from the training text set, and obtains a first enhanced text corresponding to the first training text from the enhanced text set.
[0054] Step 204: determine a first negative sample text corresponding to the first training text from the enhanced text set, and determine a second negative sample text corresponding to the first training text from the training text set.
[0055] The first negative sample text refers to an enhanced text selected from the enhanced text set and used to form a negative sample pair with the first training text. The second negative sample text refers to a training text selected from the training text set and used to form a negative sample pair with the first training text. The number of the first negative sample texts may be the same as the number of the second negative sample texts, or the number of the first negative sample texts may be different from the number of the second negative sample texts.
[0056] Exemplarily, the computer device determines a first negative sample text corresponding to the first training text from the enhanced text set based on the enhanced semantic similarity between the first training text and the enhanced text; and determines a second negative sample text corresponding to the first training text from the training text set based on the training semantic similarity between the first training text and the training text.
[0057] In one embodiment, the computer device determines the enhanced semantic similarity between the first training text and the enhanced text for each enhanced text in the augmented text set, and determines the first negative sample text corresponding to the first training text from the enhanced text whose enhanced semantic similarity is greater than the enhanced semantic threshold; and determines the training semantic similarity between the first training text and the training text for each training text in the training text set, and determines the second negative sample text corresponding to the first training text from the training text whose training semantic similarity is less than the training semantic threshold, wherein the enhanced semantic threshold is greater than the training semantic threshold. That is, negative samples with higher similarity to the first training text are selected from the enhanced text set, and negative samples with lower similarity to the first training text are selected from the training text set.
[0058] In one embodiment, the computer device determines, from the enhanced text set, a first negative sample text corresponding to the first training text in the training text set, and determines the training text in the training text set corresponding to the first negative sample text as the second negative sample text corresponding to the first training text.
[0059] Step 206, based on the training semantic similarity between the first training text and the first enhanced text, the first semantic similarity between the first training text and the first negative sample text, and the second semantic similarity between the first training text and the second negative sample text, determine the error loss corresponding to the first training text.
[0060] Among them, semantic similarity refers to a numerical value that represents the degree of semantic similarity between two texts. The semantic similarity can be obtained by calculating the similarity between the semantic feature vectors corresponding to the two texts. The semantic similarity can be semantic cosine similarity and semantic distance similarity, etc., which are not limited here.
[0061] Exemplarily, the computer device inputs the first training text and the first enhanced text into the semantic feature extraction model respectively, obtains the current semantic feature vector corresponding to the first training text and the current enhanced semantic feature vector corresponding to the first enhanced text, calculates the similarity between the current semantic feature vector and the current enhanced semantic feature vector, and obtains the training semantic similarity; inputs the first negative sample text and the second negative sample text into the semantic feature extraction model respectively, obtains the first semantic feature vector corresponding to the first negative sample text and the second semantic feature vector corresponding to the second negative sample text, calculates the similarity between the current semantic feature vector and the first semantic feature vector, and obtains the first semantic similarity; calculates the similarity between the current semantic feature vector and the second semantic feature vector, and obtains the second semantic similarity; determines the error loss corresponding to the first training text based on the training semantic similarity, the first semantic similarity, and the second semantic similarity.
[0062] Step 208: Adjust the semantic feature extraction model based on the error loss.
[0063] The training stop condition refers to the pre-set training stop condition, which can be that the error loss is less than the loss threshold, the number of training times is equal to the training threshold, or the error loss converges, etc. The training stop condition can be set according to actual needs and is not limited here. The semantic feature extraction model refers to a neural network model that extracts text semantics. The input of the semantic feature extraction model is text, and the output is the initial semantic feature vector and weight matrix. The semantic feature extraction model can be a BERT (Bidirectional Encoder Representations from Transformers, a pre-trained natural language processing model) model, where the BERT model consists of a 12-layer transformer encoder network structure.
[0064] Exemplarily, the computer device adjusts the model parameters in the semantic feature extraction model according to the error loss to obtain the adjusted semantic feature extraction model and the target semantic feature extraction model.
[0065] In one embodiment, the computer device adjusts the model parameters in the semantic feature extraction model according to the error loss to obtain the adjusted semantic feature extraction model, and repeats steps 204 to 208 until the training stop condition is reached to obtain the target semantic feature extraction model.
[0066] The above-mentioned semantic feature extraction model training method obtains multiple negative sample texts of the first training text by respectively determining the first negative sample text and the second negative sample text from the enhanced text set and the training text set, and uses the first negative sample text and the second negative sample text and the first training text to construct a negative sample pair, and uses the first enhanced text and the first training text to construct a positive sample pair, and obtains an error loss based on the semantic similarity between the positive sample pairs and the semantic similarity between the negative sample pairs. The error loss is used to adjust the parameters of the semantic feature extraction model so that the semantic similarity between the positive sample pairs is as high as possible, and the semantic similarity between the negative sample pairs is as low as possible, thereby reducing the semantic collapse problem and improving the accuracy of the semantic feature extraction model.
[0067] In one embodiment, Figure 3 As shown, before determining the first negative sample text corresponding to the first training text from the enhanced text set and determining the second negative sample text corresponding to the first training text from the training text set, it also includes:
[0068] Step 302: input the enhanced text in the enhanced text set into a semantic feature extraction model to obtain an initial semantic feature vector and a weight matrix corresponding to the enhanced text.
[0069] The initial semantic feature vector refers to the vector that represents the semantics of the text. The weight matrix refers to the matrix that represents the importance of each word in the text. The weight matrix can be an attention head matrix. For example, if the text contains 4 words, the output weight matrix is
[0070] , each element in the weight matrix represents the importance of a word relative to another word, and the elements on the diagonal represent the word’s own attention weight, and its numerical value represents the importance of the word in the text.
[0071] Exemplarily, a computer device inputs enhanced text in an enhanced text set into a semantic feature extraction model, and the semantic feature extraction model outputs an initial semantic feature vector and a weight matrix corresponding to the enhanced text, and the computer device obtains the initial semantic feature vector and a weight matrix corresponding to the enhanced text.
[0072] Step 304: Based on the weight matrix corresponding to the enhanced text, a weight vector corresponding to the enhanced text is obtained.
[0073] The weight vector refers to a vector composed of the weights of each word in the enhanced text. The weight vector is composed of the diagonal elements in the weight matrix. For example, the weight vector is (A11, A22, A33, A44).
[0074] Exemplarily, the computer device obtains diagonal elements from the weight matrix corresponding to the enhanced text, and composes the diagonal elements into a weight vector corresponding to the enhanced text.
[0075] Step 306: Obtain an enhanced semantic feature vector corresponding to the enhanced text based on the initial semantic feature vector and the weight vector corresponding to the enhanced text.
[0076] Exemplarily, the computer device multiplies the initial semantic feature vector corresponding to the enhanced text by the weight matrix corresponding to the enhanced text to obtain the enhanced semantic feature vector corresponding to the enhanced text.
[0077] In this embodiment, the enhanced semantic feature vector corresponding to the enhanced text is obtained by multiplying the initial semantic feature vector corresponding to the enhanced text by the weight matrix corresponding to the enhanced text, which fully considers the importance of each word in the enhanced text to the enhanced text, thereby improving the accuracy of the enhanced semantic feature vector.
[0078] In one embodiment, Figure 4 As shown, determining a first negative sample text corresponding to a first training text from an enhanced text set includes:
[0079] Step 402: clustering the enhanced texts in the enhanced text set based on the enhanced semantic feature vectors corresponding to the enhanced texts in the enhanced text set to obtain a plurality of cluster sets.
[0080] Clustering refers to the process of dividing objects with the same or similar features into a set. K-means (a clustering algorithm used to divide data points in a data set into multiple different groups or clusters) can be used for clustering. A cluster set refers to a set obtained by clustering, and the cluster set includes at least one enhanced text.
[0081] Exemplarily, the computer device clusters the enhanced texts in the enhanced text set based on the enhanced semantic feature vectors corresponding to the enhanced texts in the enhanced text set to obtain a plurality of cluster sets.
[0082] Step 404 : Determine the set semantic similarity between the first training text and the cluster set based on the current semantic feature vector corresponding to the first training text and the enhanced semantic feature vector corresponding to the enhanced text in the cluster set.
[0083] Exemplarily, for each cluster set, the computer device determines the central semantic feature vector corresponding to the cluster set based on the enhanced semantic feature vector corresponding to the enhanced text in the cluster set, calculates the similarity between the current semantic feature vector corresponding to the first training text and the central semantic feature vector, and obtains the set semantic similarity between the first training text and the cluster set. The central semantic feature vector may be the average vector or median vector of the enhanced semantic feature vectors corresponding to the enhanced text in the cluster set.
[0084] Step 406: Determine a target cluster set based on the set semantic similarities corresponding to each cluster set.
[0085] Exemplarily, the computer device compares the set semantic similarities corresponding to each cluster set to obtain a cluster set sequence, and determines the target cluster set based on the cluster set sequence.
[0086] Step 408: Determine the enhanced text in the target cluster set as the first negative sample text corresponding to the first training text.
[0087] Exemplarily, the computer device determines the enhanced text in the target cluster set as the first negative sample text corresponding to the first training text.
[0088] In this embodiment, based on the current semantic feature vector corresponding to the first training text and the enhanced semantic feature vector corresponding to the enhanced text in the cluster set, the set semantic similarity between the first training text and the cluster set is determined, the set semantic similarity represents the degree of similarity between the first training text and the enhanced text in the cluster set, the target cluster set is determined according to the set semantic similarities corresponding to each cluster set, the enhanced text in the target cluster set is determined as the first negative sample text corresponding to the first training text, that is, the first negative sample text with a higher similarity to the first training text can be selected.
[0089] In one embodiment, determining a target cluster set based on the set semantic similarity corresponding to each cluster set includes:
[0090] Based on the preset sorting rule and the set semantic similarity corresponding to each cluster set, multiple cluster sets are sorted to obtain the arrangement sequence number of each cluster set; the cluster set corresponding to the arrangement sequence number same as the preset sequence number is determined as the target cluster set.
[0091] The preset sorting rule refers to a preset sorting rule, and the preset sorting rule may be sorting from small to large, or from large to small. The arrangement sequence number refers to an identifier representing the arrangement order, and the arrangement sequence number may be a number or a character, etc. The preset sequence number refers to a preset sequence number, for example, the preset sequence number is 2.
[0092] Exemplarily, the computer device sorts multiple cluster sets according to preset sorting rules based on the set semantic similarity corresponding to each cluster set, obtains the arrangement sequence number of each cluster set, and determines the cluster set corresponding to the arrangement sequence number same as the preset sequence number as the target cluster set.
[0093] In this embodiment, by determining the cluster set corresponding to the arrangement sequence number that is the same as the preset sequence number as the target cluster set, the first negative sample text whose semantic similarity with the first training text meets the requirements can be selected.
[0094] In one embodiment, Figure 5 As shown, based on the training semantic similarity between the first training text and the first enhanced text, the first semantic similarity between the first training text and the first negative sample text, and the second semantic similarity between the first training text and the second negative sample text, the error loss corresponding to the first training text is determined, including:
[0095] Step 502: obtaining a positive sample pair coefficient based on the training semantic similarity between the first training text and the first enhanced text.
[0096] The positive sample pair coefficient refers to a value representing the similarity between the first training text and the current enhanced text in the positive sample.
[0097] Exemplarily, the computer device determines the first training text and the first enhanced text as a positive sample pair, calculates the training semantic similarity between the first training text and the first enhanced text corresponding to the first training text, and obtains a positive sample pair coefficient.
[0098] In one embodiment, the positive sample pair coefficient is T:
[0099] Formula (1)
[0100] Among them, sim(x i ,x i + ) is the training semantic similarity, x i is the current semantic feature vector corresponding to the first training text, x i + is the current enhanced semantic feature vector corresponding to the first enhanced text, and τ is the temperature hyperparameter.
[0101] Step 504: Obtain a first negative sample pair coefficient based on a first semantic similarity between the first training text and the first negative sample text.
[0102] The first negative sample pair coefficient refers to a value representing the similarity between the first training text and the first negative sample text in the first negative sample pair.
[0103] Exemplarily, for each first negative sample text, the computer device combines the first training text and the first negative sample text into a first negative sample pair, calculates the first semantic similarity between the first training text and the first negative sample text, and obtains a first negative sample pair coefficient.
[0104] Step 506: Obtain a second negative sample pair coefficient based on the second semantic similarity between the first training text and the second negative sample text.
[0105] The second negative sample pair coefficient refers to a value representing the similarity between the first training text and the second negative sample text in the second negative sample pair.
[0106] Exemplarily, for each second negative sample text, the computer device combines the first training text and the second negative sample text into a second negative sample pair, calculates the second semantic similarity between the first training text and the second negative sample text, and obtains a second negative sample pair coefficient.
[0107] Step 508 , performing weighted statistics on the multiple first negative sample pair coefficients and the multiple second negative sample pair coefficients to obtain negative sample pair coefficients.
[0108] Exemplarily, the computer device performs statistics on the coefficients of multiple first negative samples to obtain a first statistical value, performs statistics on the coefficients of multiple second negative samples to obtain a second statistical value, and performs a weighted operation on the first statistical value and the second statistical value to obtain the negative sample pair coefficients.
[0109] Step 510: Obtain the error loss corresponding to the first training text based on the ratio between the positive sample pair coefficient and the negative sample pair coefficient.
[0110] Exemplarily, the computer device determines a ratio between the positive sample pair coefficients and the negative sample pair coefficients, and obtains an error loss corresponding to the first training text based on the ratio.
[0111] In one embodiment, the error loss is L:
[0112] Formula (2)
[0113] Among them, sim(x i ,x j + ) is the second semantic similarity, x i is the current semantic feature vector corresponding to the first training text, x j + is the second semantic feature vector corresponding to the second negative sample text; sim(xi ,x j - ) is the first semantic similarity, x j - is the first semantic feature vector corresponding to the first negative sample text; u is the weight; τ is the temperature hyperparameter; N is the number of positive or negative sample pairs.
[0114] In this embodiment, the error loss corresponding to the first training text is determined to provide basic data for adjusting the parameters of the semantic feature extraction model.
[0115] In one embodiment, Figure 6 As shown, obtaining a training text set and an enhanced text set corresponding to the training text set includes:
[0116] Step 602, obtaining multiple conversation texts.
[0117] The conversation text refers to the text recording the conversation information, and the conversation text may be a customer service conversation text, including the conversation information of the service object and the conversation information of the service personnel.
[0118] Exemplarily, the computer device obtains a plurality of conversation texts.
[0119] In one embodiment, the computer device obtains multiple conversation voice information and converts each conversation voice information into a dialogue text.
[0120] Step 604: for each dialogue text, determine the dialogue information corresponding to the service object as a training text.
[0121] The service object refers to the object being served, and the service object can be a customer.
[0122] Exemplarily, for each dialogue text, the computer device obtains dialogue information corresponding to the service object from the dialogue text, and determines the dialogue information corresponding to the service object as the training text.
[0123] Step 606: Perform enhancement processing on the training text to obtain enhanced text corresponding to the training text.
[0124] Among them, enhancement processing refers to the process of performing a series of transformations or modifications on the training text to generate new samples that are related to the training text but slightly different. Enhancement processing includes but is not limited to synonym replacement, random insertion or deletion of words, text rearrangement and text reversal.
[0125] Exemplarily, the computer device performs enhancement processing on the training texts respectively to obtain enhanced texts corresponding to the training texts.
[0126] Step 608: obtaining a training text set based on the plurality of training texts, and obtaining an enhanced text set corresponding to the training text set based on the plurality of enhanced texts.
[0127] Exemplarily, the computer device groups a plurality of training texts into a training text set, and groups a plurality of enhanced texts into an enhanced text set corresponding to the training text set.
[0128] In this embodiment, multiple training texts are grouped into a training text set, and multiple enhanced texts are grouped into an enhanced text set corresponding to the training text set, so as to provide more training data for the subsequent semantic feature extraction model.
[0129] In one embodiment, Figure 7 As shown, a text label determination method includes:
[0130] Step 702, obtaining a plurality of texts to be determined.
[0131] The text to be determined refers to the text whose label needs to be determined, and the text to be determined includes the dialogue information of the service object.
[0132] Exemplarily, after obtaining the target semantic feature extraction model, the computer device obtains a plurality of texts to be determined.
[0133] Step 704, input the text to be determined into the target semantic feature extraction model to obtain a target semantic feature vector corresponding to the text to be determined; the target semantic feature extraction model is trained by a semantic feature extraction model training method.
[0134] Exemplarily, the computer device inputs the text to be determined into the target semantic feature extraction model to obtain the target semantic feature vector corresponding to the text to be determined.
[0135] Step 706 , clustering the multiple texts to be determined based on the target semantic feature vectors corresponding to the texts to be determined to obtain multiple target cluster sets.
[0136] Exemplarily, the computer device clusters a plurality of texts to be determined based on target semantic feature vectors corresponding to the texts to be determined to obtain a plurality of target cluster sets.
[0137] Step 708 : for each target cluster set, based on the target semantic feature vector corresponding to the text to be determined in the target cluster set and the candidate semantic feature vector corresponding to the candidate tag, determine the tag semantic similarity between the target cluster set and the candidate tag.
[0138] The candidate tag refers to a pre-set tag, which may be a business tag. The candidate semantic feature vector refers to a vector that represents the semantics of the candidate tag.
[0139] Exemplarily, for each target cluster set, the computer device determines the target central feature vector corresponding to the target cluster set based on the target semantic feature vector corresponding to the text to be determined in the target cluster set, calculates the similarity between the target central feature vector and the candidate semantic feature vector corresponding to each candidate tag, and obtains the label semantic similarity between the target cluster set and each candidate tag.
[0140] Step 710: Determine a target tag corresponding to the target cluster set based on the tag semantic similarity between each candidate tag and the target cluster set.
[0141] Exemplarily, the computer device compares the semantic similarity between each candidate tag and the tag of the target cluster set with a preset threshold, and determines the candidate tag corresponding to the tag semantic similarity greater than the preset threshold as the target tag corresponding to the target cluster set, that is, the target tag is determined as the tag corresponding to each text to be determined in the target cluster set. In this embodiment, the target semantic feature extraction model that has been trained is used to determine the target semantic feature vector corresponding to the text to be determined, thereby improving the accuracy of the target semantic feature vector, clustering multiple texts to be determined according to the target semantic feature vector corresponding to the text to be determined, and obtaining multiple target cluster sets, and then determining the target tag corresponding to the target cluster set according to the semantic similarity between each candidate tag and the tag of the target cluster set, that is, selecting the candidate tag with high semantic similarity to the tag of the target cluster set as the target tag, and determining the target tag of the target cluster set in a quantitative form, thereby improving the accuracy of the target tag corresponding to the target cluster set, and finally determining the target tag as the tag corresponding to the text to be determined in the target cluster set, thereby improving the accuracy of the determination of the tag of the text to be determined.
[0142] In an exemplary embodiment, Figure 8 As shown in A, in the process of using contrastive learning to train the semantic feature extraction model, the positive sample and the negative sample corresponding to the first training text are determined from the enhanced text set. Figure 8 In A, the solid lines connect the positive sample pairs, and the dotted lines connect the negative sample pairs. Figure 8 The semantic feature extraction model is trained by using positive and negative sample pairs established by A. The target semantic feature extraction model has the problem of semantic collapse. In order to improve the accuracy of the semantic feature extraction model, Figure 8 The method shown in B establishes positive sample pairs and negative samples, and the semantic feature extraction model training method is as follows Fig. 9 As shown, including:
[0143] The computer device obtains multiple dialogue texts. For each dialogue text, the computer device obtains dialogue information corresponding to the service object from the dialogue text, determines the dialogue information corresponding to the service object as a training text, and performs enhancement processing on the training text to obtain an enhanced text corresponding to the training text; the multiple training texts are grouped into a training text set, and the multiple enhanced texts are grouped into an enhanced text set corresponding to the training text set.
[0144] The computer device inputs the enhanced text in the enhanced text set into the semantic feature extraction model, and the semantic feature extraction model outputs the initial semantic feature vector and weight matrix corresponding to the enhanced text, and the computer device obtains the initial semantic feature vector and weight matrix corresponding to the enhanced text; obtains the diagonal elements from the weight matrix corresponding to the enhanced text, and composes the weight vector corresponding to the enhanced text with the diagonal elements; multiplies the initial semantic feature vector corresponding to the enhanced text by the weight matrix corresponding to the enhanced text, and obtains the enhanced semantic feature vector corresponding to the enhanced text. Using the above method, the training semantic feature vector corresponding to the training text in the training text set is determined.
[0145] The computer device clusters the enhanced texts in the enhanced text set based on the enhanced semantic feature vectors corresponding to the enhanced texts in the enhanced text set to obtain multiple cluster sets; for each cluster set, based on the enhanced semantic feature vectors corresponding to the enhanced texts in the cluster set, the central semantic feature vector corresponding to the cluster set is determined, and the similarity between the current semantic feature vector corresponding to the first training text and the central semantic feature vector is calculated to obtain the set semantic similarity between the first training text and the cluster set; according to the preset sorting rule, based on the set semantic similarity corresponding to each cluster set, the multiple cluster sets are sorted to obtain the arrangement sequence number of each cluster set, and the cluster set corresponding to the arrangement sequence number that is the same as the preset sequence number is determined as the target cluster set; the enhanced text in the target cluster set is determined as the first negative sample text corresponding to the first training text. The training text corresponding to the first negative sample text in the training text set is determined as the second negative sample text corresponding to the first training text.
[0146] The computer device determines the first training text and the first enhanced text corresponding to the first training text as a positive sample pair, calculates the training semantic similarity between the first training text and the first enhanced text corresponding to the first training text, and obtains the positive sample pair coefficient; for each first negative sample text, the first training text and the first negative sample text form a first negative sample pair, and calculates the first semantic similarity between the first training text and the first negative sample text to obtain the first negative sample pair coefficient; for each second negative sample text, the first training text and the second negative sample text form a second negative sample pair, and calculates the second semantic similarity between the first training text and the second negative sample text to obtain the second negative sample pair coefficient; statistics are performed on multiple first negative sample pair coefficients to obtain a first statistical value, statistics are performed on multiple second negative sample pair coefficients to obtain a second statistical value, and weighted operations are performed on the first statistical value and the second statistical value to obtain the negative sample pair coefficient; the ratio between the positive sample pair coefficient and the negative sample pair coefficient is determined, and the error loss corresponding to the first training text is obtained based on the ratio.
[0147] The computer device adjusts the model parameters in the semantic feature extraction model according to the error loss to obtain the adjusted semantic feature extraction model, and repeats the above steps until the error loss converges to obtain the target semantic feature extraction model.
[0148] After obtaining the target semantic feature extraction model, the label determination method is as follows Fig.10 As shown, it includes: a computer device obtains multiple texts to be determined; inputs the texts to be determined into a target semantic feature extraction model to obtain target semantic feature vectors corresponding to the texts to be determined; based on the target semantic feature vectors corresponding to the texts to be determined, the multiple texts to be determined are clustered to obtain multiple target cluster sets; for each target cluster set, based on the target semantic feature vectors corresponding to the texts to be determined in the target cluster set, a target central feature vector corresponding to the target cluster set is determined, and the similarity between the target central feature vector and the candidate semantic feature vector corresponding to each candidate label is calculated to obtain the label semantic similarity between the target cluster set and each candidate label; the label semantic similarity between each candidate label and the target cluster set is compared with a preset threshold, and the candidate label corresponding to the label semantic similarity greater than the preset threshold is determined as the target label corresponding to the target cluster set, that is, the target label is determined as the label corresponding to each text to be determined in the target cluster set.
[0149] The above-mentioned semantic feature extraction model training method obtains multiple negative sample texts of the first training text by respectively determining the first negative sample text and the second negative sample text from the enhanced text set and the training text set, and uses the first negative sample text and the second negative sample text and the first training text to construct a negative sample pair, and uses the first enhanced text and the first training text to construct a positive sample pair, and obtains an error loss based on the semantic similarity between the positive sample pairs and the semantic similarity between the negative sample pairs. The error loss is used to adjust the parameters of the semantic feature extraction model so that the semantic similarity between the positive sample pairs is as high as possible, and the semantic similarity between the negative sample pairs is as low as possible, thereby reducing the semantic collapse problem and improving the accuracy of the semantic feature extraction model. The target semantic feature extraction model that has been trained is used to determine the target semantic feature vector corresponding to the text to be determined, thereby improving the accuracy of the target semantic feature vector. Multiple texts to be determined are clustered according to the target semantic feature vector corresponding to the text to be determined to obtain multiple target cluster sets. Then, the target label corresponding to the target cluster set is determined according to the label semantic similarity between each candidate label and the target cluster set, that is, the candidate label with high semantic similarity with the label of the target cluster set is selected as the target label, and the target label of the target cluster set is determined in a quantitative form, thereby improving the accuracy of the target label corresponding to the target cluster set. Finally, the target label is determined as the label corresponding to the text to be determined in the target cluster set, thereby improving the accuracy of the label determination of the text to be determined.
[0150] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0151] Based on the same inventive concept, the embodiment of the present application also provides a semantic feature extraction model training device for implementing the semantic feature extraction model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more semantic feature extraction model training device embodiments provided below can refer to the limitations of the semantic feature extraction model training method above, and will not be repeated here.
[0152] In one embodiment, Fig.11 As shown, a semantic feature extraction model training device is provided, including: a training text acquisition module 1102, a screening module 1104, a loss determination module 1106 and an adjustment module 1108, wherein:
[0153] A training text acquisition module 1102 is used to acquire a training text set and an enhanced text set corresponding to the training text set, wherein the training text set includes a first training text, and the enhanced text set includes a first enhanced text corresponding to the first training text;
[0154] A screening module 1104 is used to determine a first negative sample text corresponding to the first training text from the enhanced text set, and to determine a second negative sample text corresponding to the first training text from the training text set;
[0155] A loss determination module 1106, configured to determine an error loss corresponding to the first training text based on a training semantic similarity between the first training text and the first enhanced text, a first semantic similarity between the first training text and the first negative sample text, and a second semantic similarity between the first training text and the second negative sample text;
[0156] The adjustment module 1108 is used to adjust the semantic feature extraction model based on the error loss.
[0157] In one embodiment, the screening module 1104 is also used to: input the enhanced text in the enhanced text set into the semantic feature extraction model to obtain the initial semantic feature vector and weight matrix corresponding to the enhanced text; based on the weight matrix corresponding to the enhanced text, obtain the weight vector corresponding to the enhanced text; based on the initial semantic feature vector and weight vector corresponding to the enhanced text, obtain the enhanced semantic feature vector corresponding to the enhanced text.
[0158] In one embodiment, the screening module 1104 is also used to: cluster the enhanced texts in the enhanced text set based on the enhanced semantic feature vectors corresponding to the enhanced texts in the enhanced text set to obtain multiple cluster sets; determine the set semantic similarity between the first training text and the cluster set based on the current semantic feature vector corresponding to the first training text and the enhanced semantic feature vector corresponding to the enhanced text in the cluster set; determine the target cluster set based on the set semantic similarities corresponding to each cluster set; and determine the enhanced text in the target cluster set as the first negative sample text corresponding to the first training text.
[0159] In one embodiment, the screening module 1104 is further used to: sort multiple cluster sets based on preset sorting rules and the set semantic similarity corresponding to each cluster set to obtain the arrangement sequence number of each cluster set; and determine the cluster set corresponding to the arrangement sequence number that is the same as the preset sequence number as the target cluster set.
[0160] In one embodiment, the loss determination module 1106 is also used to: obtain a positive sample pair coefficient based on the training semantic similarity between the first training text and the first enhanced text; obtain a first negative sample pair coefficient based on the first semantic similarity between the first training text and the first negative sample text; obtain a second negative sample pair coefficient based on the second semantic similarity between the first training text and the second negative sample text; perform weighted statistics on multiple first negative sample pair coefficients and multiple second negative sample pair coefficients to obtain negative sample pair coefficients; and obtain the error loss corresponding to the first training text based on the ratio between the positive sample pair coefficient and the negative sample pair coefficient.
[0161] In one embodiment, the training text acquisition module 1102 is also used to: acquire multiple dialogue texts; for each dialogue text, determine the dialogue information corresponding to the service object as the training text; enhance the training text to obtain an enhanced text corresponding to the training text; obtain a training text set based on the multiple training texts, and obtain an enhanced text set corresponding to the training text set based on the multiple enhanced texts.
[0162] In one embodiment, Fig.12 As shown, a text label determination device is provided, comprising: a text acquisition module 1202 to be determined, an input module 1204, a clustering module 1206, a similarity determination module 1208 and a label determination module 1210, wherein:
[0163] A to-be-determined text acquisition module 1202 is used to acquire a plurality of to-be-determined texts;
[0164] An input module 1204 is used to input the text to be determined into a target semantic feature extraction model to obtain a target semantic feature vector corresponding to the text to be determined; the target semantic feature extraction model is trained by a semantic feature extraction model training device;
[0165] A clustering module 1206 is used to cluster the multiple to-be-determined texts based on the target semantic feature vectors corresponding to the to-be-determined texts to obtain multiple target cluster sets;
[0166] A similarity determination module 1208 is used to determine, for each target cluster set, the tag semantic similarity between the target cluster set and the candidate tag based on the target semantic feature vector corresponding to the text to be determined in the target cluster set and the candidate semantic feature vector corresponding to the candidate tag;
[0167] The tag determination module 1210 is used to determine the target tag corresponding to the target cluster set based on the tag semantic similarity between each candidate tag and the target cluster set.
[0168] Each module in the semantic feature extraction model training device and the text label determination device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0169] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a semantic feature extraction model training method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0170] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0171] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0172] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0173] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0174] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0175] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0176] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0177] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A semantic feature extraction model training method, characterized in that: The method comprises: Acquire a training text set and an enhanced text set corresponding to the training text set, wherein the training text set includes a first training text, and the enhanced text set includes a first enhanced text corresponding to the first training text; Determine a first negative sample text corresponding to the first training text from the enhanced text set, and determine a second negative sample text corresponding to the first training text from the training text set; determining an error loss corresponding to the first training text based on a training semantic similarity between the first training text and the first enhanced text, a first semantic similarity between the first training text and the first negative sample text, and a second semantic similarity between the first training text and the second negative sample text, and The semantic feature extraction model is adjusted based on the error loss.
2. The method according to claim 1, characterized in that: Before determining the first negative sample text corresponding to the first training text from the enhanced text set and determining the second negative sample text corresponding to the first training text from the training text set, the method further includes: Inputting the enhanced text in the enhanced text set into the semantic feature extraction model to obtain an initial semantic feature vector and a weight matrix corresponding to the enhanced text; Based on the weight matrix corresponding to the enhanced text, obtaining a weight vector corresponding to the enhanced text; Based on the initial semantic feature vector and the weight vector corresponding to the enhanced text, an enhanced semantic feature vector corresponding to the enhanced text is obtained.
3. The method according to claim 2, characterized in that The determining, from the enhanced text set, a first negative sample text corresponding to the first training text comprises: Based on the enhanced semantic feature vectors corresponding to the enhanced texts in the enhanced text set, clustering the enhanced texts in the enhanced text set to obtain a plurality of cluster sets; Determining the set semantic similarity between the first training text and the cluster set based on the current semantic feature vector corresponding to the first training text and the enhanced semantic feature vector corresponding to the enhanced text in the cluster set; Determining a target cluster set based on the set semantic similarity corresponding to each of the cluster sets; The enhanced text in the target cluster set is determined as the first negative sample text corresponding to the first training text.
4. The method according to claim 3, characterized in that The determining of the target cluster set based on the set semantic similarity corresponding to each of the cluster sets includes: Sorting the plurality of cluster sets based on a preset sorting rule and a set semantic similarity corresponding to each cluster set to obtain an arrangement sequence number of each cluster set; The cluster set corresponding to the arrangement sequence number that is the same as the preset sequence number is determined as the target cluster set.
5. The method according to claim 1, characterized in that The determining the error loss corresponding to the first training text based on the training semantic similarity between the first training text and the first enhanced text, the first semantic similarity between the first training text and the first negative sample text, and the second semantic similarity between the first training text and the second negative sample text includes: Obtaining a positive sample pair coefficient based on the training semantic similarity between the first training text and the first enhanced text; Obtaining a first negative sample pair coefficient based on a first semantic similarity between the first training text and the first negative sample text; Obtaining a second negative sample pair coefficient based on a second semantic similarity between the first training text and the second negative sample text; Performing weighted statistics on a plurality of first negative sample pair coefficients and a plurality of second negative sample pair coefficients to obtain negative sample pair coefficients; Based on the ratio between the positive sample pair coefficient and the negative sample pair coefficient, an error loss corresponding to the first training text is obtained.
6. The method according to claim 1, characterized in that The step of acquiring a training text set and an enhanced text set corresponding to the training text set includes: Get multiple conversation texts; For each dialogue text, the dialogue information corresponding to the service object is determined as the training text; Performing enhancement processing on the training text to obtain enhanced text corresponding to the training text; A training text set is obtained based on the plurality of training texts, and an enhanced text set corresponding to the training text set is obtained based on the plurality of enhanced texts.
7. A method for determining a text label, characterized in that: The method comprises: Get multiple texts to be determined; Inputting the to-be-determined text into a target semantic feature extraction model to obtain a target semantic feature vector corresponding to the to-be-determined text; the target semantic feature extraction model is trained by any semantic feature extraction model training method according to any one of claims 1 to 6; Clustering the multiple texts to be determined based on the target semantic feature vectors corresponding to the texts to be determined to obtain multiple target cluster sets; For each of the target cluster sets, based on the target semantic feature vector corresponding to the text to be determined in the target cluster set and the candidate semantic feature vector corresponding to the candidate tag, determine the tag semantic similarity between the target cluster set and the candidate tag; Based on the semantic similarity between each of the candidate tags and the target cluster set, a target tag corresponding to the target cluster set is determined.
8. A semantic feature extraction model training device, characterized in that: The device comprises: A training text acquisition module, used to acquire a training text set and an enhanced text set corresponding to the training text set, wherein the training text set includes a first training text, and the enhanced text set includes a first enhanced text corresponding to the first training text; A screening module, used to determine a first negative sample text corresponding to the first training text from the enhanced text set, and to determine a second negative sample text corresponding to the first training text from the training text set; a loss determination module, configured to determine an error loss corresponding to the first training text based on a training semantic similarity between the first training text and the first enhanced text, a first semantic similarity between the first training text and the first negative sample text, and a second semantic similarity between the first training text and the second negative sample text; An adjustment module is used to adjust the semantic feature extraction model based on the error loss.
9. A text label determination device, characterized in that: The device comprises: A module for obtaining texts to be determined, used for obtaining multiple texts to be determined; An input module, used for inputting the text to be determined into a target semantic feature extraction model to obtain a target semantic feature vector corresponding to the text to be determined; the target semantic feature extraction model is trained by any semantic feature extraction model training method in any one of claims 1 to 6; A clustering module, used for clustering the plurality of to-be-determined texts based on the target semantic feature vectors corresponding to the to-be-determined texts to obtain a plurality of target clustering sets; A similarity determination module is used to determine, for each of the target cluster sets, the tag semantic similarity between the target cluster set and the candidate tag based on the target semantic feature vector corresponding to the text to be determined in the target cluster set and the candidate semantic feature vector corresponding to the candidate tag; The tag determination module is used to determine the target tag corresponding to the target cluster set based on the tag semantic similarity between each of the candidate tags and the target cluster set.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Training method of song representation output model and song processing method
CN119479625A
