Model generation methods, text classification methods, devices, electronic devices and media
By perturbing the features of the pre-trained language sub-model and conducting adversarial training, the parameters of the classification model are adjusted, which solves the accuracy problem of the text classification model under conditions of insufficient or imbalanced sample size, and improves the training effect and robustness of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2026-03-13
AI Technical Summary
In existing technologies, text classification models have low accuracy in categories with small sample sizes, leading to data imbalance and affecting model training performance.
By perturbing the features of the pre-trained language sub-model and combining it with adversarial training methods, the parameters of the classification model are adjusted to generate rich text features, thereby improving the training effect of the model.
It improves the training accuracy of text classification models under conditions of insufficient or imbalanced sample size, and enhances the robustness and classification ability of the models.
Smart Images

Figure CN117251776B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine learning, and in particular relates to a model generation method, a text classification method, an apparatus, an electronic device, and a readable storage medium. Background Technology
[0002] Text classification is an important task in the field of natural language processing. It determines the category of text based on its content, such as sentiment analysis, topic classification, and intent recognition. Text classification has a wide range of applications, including intelligent customer service, public opinion analysis, and product recommendation.
[0003] In related technologies, most text classification models are based on traditional machine learning methods, typically employing Naive Bayes, Support Vector Machines (SVM), and other machine learning methods as classification models. These models are trained using massive amounts of sample data to obtain a text classification model capable of classifying text. In practice, the text to be classified is input into the text classification model, and the model outputs the text category.
[0004] However, in some text classification tasks, the number of samples for each category label may be small, resulting in low accuracy of the text classification model trained based on the sample data. Summary of the Invention
[0005] This invention provides a model generation method, a text classification method, an apparatus, an electronic device, and a readable storage medium to solve the technical problem of low accuracy in existing text classification models.
[0006] In a first aspect, the present invention provides a model generation method, the method comprising:
[0007] Obtain the sample text and the corresponding sample reference category;
[0008] The sample text is input into the pre-trained language sub-model of the first classification model to obtain the first feature output by the pre-trained language sub-model.
[0009] The first feature is perturbed to obtain the second feature;
[0010] The second feature is input into the first category sub-model of the first classification model to obtain the first sample classification result output by the first category output sub-model.
[0011] A first loss is determined based on the first sample classification result and the sample reference category. The model parameters of the first classification model are adjusted based on the first loss to obtain a second classification model. The second classification model includes a semantic feature sub-model obtained by adjusting the parameters of the pre-trained language sub-model, and a second category sub-model obtained by adjusting the parameters of the first category sub-model.
[0012] Secondly, the present invention provides a text classification method, the method comprising:
[0013] The first text is input into the semantic feature sub-model of the second classification model to obtain the first text features output by the semantic feature sub-model.
[0014] The first text feature is input into the second category sub-model of the second classification model to obtain the first classification result output by the second category sub-model.
[0015] The text category of the first text is determined based on the first classification result.
[0016] Thirdly, the present invention provides a model classification device, the device comprising:
[0017] The acquisition module is used to acquire the sample text and the sample reference category corresponding to the sample text;
[0018] The first input module is used to input the sample text into the pre-trained language sub-model of the first classification model to obtain the first feature output by the pre-trained language sub-model.
[0019] A perturbation module is used to perturb the first feature to obtain the second feature;
[0020] The second input module is used to input the second feature into the first category sub-model of the first classification model to obtain the first sample classification result output by the first category output sub-model.
[0021] The training module is used to determine a first loss based on the classification result of the first sample and the reference category of the sample, and to adjust the model parameters of the first classification model based on the first loss to obtain a second classification model; wherein, the second classification model includes a semantic feature sub-model obtained by adjusting the parameters of the pre-trained language sub-model, and a second category sub-model obtained by adjusting the parameters of the first category sub-model.
[0022] Fourthly, the present invention provides a text classification device, the device comprising:
[0023] The first text feature module is used to input the first text into the semantic feature sub-model of the second classification model to obtain the first text features output by the semantic feature sub-model.
[0024] The first classification result module is used to input the first text features into the second category sub-model of the second classification model to obtain the first classification result output by the second category sub-model.
[0025] The text category module is used to determine the text category of the first text based on the first classification result.
[0026] Fifthly, the present invention provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the above-described model generation method or text classification method when executing the program.
[0027] In a sixth aspect, the present invention provides a readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the above-described model generation method or text classification method.
[0028] In this embodiment of the invention, the method includes: obtaining sample text and the corresponding sample reference category; inputting the sample text into a pre-trained language sub-model of a first classification model to obtain a first feature output by the pre-trained language sub-model; perturbing the first feature to obtain a second feature; inputting the second feature into a first category sub-model of the first classification model to obtain a first sample classification result output by the first category output sub-model; determining a first loss based on the first sample classification result and the sample reference category; and adjusting the model parameters of the first classification model based on the first loss to obtain a second classification model. During the training process of the classification model, the first feature generated internally based on the sample text can be perturbed to generate a second feature, enriching the text features that can be used during the training process. This allows the classification model to complete training based on more text features, helping to improve the training effect of the classification model under conditions of insufficient sample size or imbalanced samples, thereby improving the accuracy of the trained classification model. Attached Figure Description
[0029] 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 some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is a flowchart of the steps of a model generation method provided in an embodiment of the present invention;
[0031] Figure 2This is a schematic diagram of a first classification model training provided in an embodiment of the present invention;
[0032] Figure 3 This is a flowchart of another model generation method provided in an embodiment of the present invention;
[0033] Figure 4 This is a schematic diagram of a first similarity sub-model provided in an embodiment of the present invention;
[0034] Figure 5 This is a flowchart of a second loss determination provided by an embodiment of the present invention;
[0035] Figure 6 This is a flowchart of the steps of a text classification method provided in an embodiment of the present invention;
[0036] Figure 7 This is a structural diagram of a model generation device provided in an embodiment of the present invention;
[0037] Figure 8 This is a structural diagram of a text classification device provided in an embodiment of the present invention;
[0038] Figure 9 This is a structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] Reference Figure 1 , Figure 1 This is a flowchart illustrating the steps of a model generation method provided in an embodiment of the present invention. Figure 1 As shown, the method may include:
[0041] Step 101: Obtain the sample text and the sample reference category corresponding to the sample text.
[0042] Text classification is a crucial task in Natural Language Processing (NLP). It determines the category of text based on its content, including tasks such as sentiment analysis, topic classification, and intent recognition. Text classification has wide-ranging applications, including intelligent customer service, public opinion analysis, and product recommendation. To train a classification model for text classification, a subset of labeled data from historical text can be selected as training or testing data. Labeled data refers to text data with pre-defined category labels. For example, conversations between users and customer service representatives can be collected from an intelligent customer service system, along with the conversation's category labels, such as query, fault, processing, consultation, complaint, or others. This conversation content and category labels constitute the sample text and the sample reference category.
[0043] Here, sample text refers to text data that can be used to train or test classification models, such as conversations between users and customer service representatives, or user reviews of a product or service. The sample reference category represents the true label of the sample text, that is, the category to which the sample text belongs, such as query, fault, processing, consultation, complaint, etc.
[0044] Optionally, in text classification tasks, some categories have a large number of samples while others have a small number. This can cause the classification model to favor the categories with more samples and ignore those with fewer samples, resulting in a data imbalance problem. In this embodiment of the invention, to address the data imbalance problem in the training samples and mitigate the risk of model overfitting, data augmentation can be performed on small samples from real historical sample data to obtain the aforementioned sample texts and corresponding sample reference categories.
[0045] Historical sample data includes historical sample text and the corresponding sample reference categories; small sample data refers to categories with fewer samples in the historical text data, such as complaints and others. Data augmentation refers to generating new data by making changes to historical sample data, thereby increasing the diversity and richness of the training samples.
[0046] In this embodiment of the invention, historical samples can be augmented based on the principle of EDA (Easy Data Augmentation), thereby merging the augmented new samples with the historical samples to obtain the sample text set used for training the model. EDA transforms the text through various methods, including but not limited to synonym replacement, random insertion, random swapping, and random deletion. It should be noted that the reference category of the sample text obtained after sample augmentation can be the same as the reference category of the historical text that generated it.
[0047] For example, synonym replacement can randomly select a word in the text and replace it with a synonym. For instance, based on the historical text "What is my current balance?", the sample text "How much money do I have now?" can be expanded. Random insertion can randomly select a word in the text and randomly insert a synonym or related word into the text. For instance, based on the historical text "What is my current balance?", the sample text "What is my current account balance?" can be expanded.
[0048] Step 102: Input the sample text into the pre-trained language sub-model of the first classification model to obtain the first feature output by the pre-trained language sub-model.
[0049] In this embodiment of the invention, a first classification model can be pre-constructed. The first classification model is a model used for text classification tasks. The first classification model can consist of two sub-models: a pre-trained language sub-model and a first category sub-model.
[0050] The pre-trained language sub-model can be built based on a pre-trained language model (PLM) and can be used to extract text features. Pre-trained language sub-models can include, but are not limited to, BERT (Bidirectional Encoder Representations from Transformers), RoBERTa (Robustly optimized BERT approach), ALBERT (A Lite BERT for Self-supervised Learning of Language Representation), ELECTRA (Efficiently Learning an Encoder that Classifies Token Replacements Accurately), and ERNIE (Enhanced Representation through kNowledge IntEgration). The first feature can represent the feature vector extracted by the pre-trained language sub-model based on the sample text.
[0051] In this embodiment of the invention, sample text can be input into the pre-trained language sub-model of the first classification model to obtain the first feature output by the pre-trained language sub-model.
[0052] For example, the pre-trained language sub-model can be a RoBERTa model. A sample text "How much is my current balance?" can be input into the RoBERTa model to obtain a 768-dimensional vector: [0.123, -0.456, 0.789, ..., -0.321]. This vector is the first feature of the sample text.
[0053] Step 103: Perturb the first feature to obtain the second feature.
[0054] A perturbation is a small, added change intended to alter the output of a neural network. By training the neural network to adapt to the perturbation, its ability to classify adversarial examples is improved. In this embodiment of the invention, adversarial training can be used to train the first classification model, where adversarial training is a method that utilizes perturbations to enhance the robustness of the neural network.
[0055] In this embodiment of the invention, the optimal perturbation can be determined using the PGD (Projected Gradient Descent) method and added to the first feature to obtain the second feature. Alternatively, methods such as the FGSM (Fast Gradient Sign Method) and CW (Carlini and Wagner) can be used to add perturbations to the first feature; this embodiment of the invention does not impose specific limitations.
[0056] Among them, PGD is a gradient-based adversarial attack method. PGD can generate adversarial data that can deceive neural networks. Adversarial data refers to data with artificially added small perturbations, causing the neural network's output to become erroneous or uncertain. In this embodiment of the invention, it can represent a second feature. Its basic idea is to start from an original data point x (e.g., the first feature) and continuously add perturbations along the gradient direction of the loss function until the loss function reaches its maximum value. Simultaneously, after each perturbation, the data point is projected into a specified range to ensure that the perturbation size does not exceed a threshold. In this way, adversarial data (e.g., the second feature) similar to the original data point can be obtained. Similarly, FGSM is a single-step adversarial attack method that calculates the gradient sign of the loss function and then adds perturbations along the sign direction. CW is an optimization-based adversarial attack method that finds the minimum perturbation by minimizing a specific objective function.
[0057] Optionally, in this embodiment of the invention, the second feature can be perturbed using the following sub-steps 1031 to 1033.
[0058] Sub-step 1031: Determine the gradient value and loss value corresponding to the first feature.
[0059] In this embodiment of the invention, the first classification model can first perform subsequent processing using the first feature, and determine the loss value and gradient value corresponding to the first feature. The gradient value can represent the rate of change caused by the first feature on the loss function, reflecting the degree of influence of the first feature on the final classification result output by the first classification model. The loss value can represent the loss value corresponding to the inference result output by the first classification model based on the first feature. The specific determination process of the loss value will be explained in detail in subsequent step 104. (Refer to...) Figure 2 , Figure 2 This diagram illustrates a training schematic of a first classification model provided by an embodiment of the present invention, as shown below. Figure 2 As shown, historical text can be augmented using EDA to augment the sample text. The sample text is then processed by the ROBERT model (i.e., the pre-trained language sub-model) to obtain the first feature. Then, it enters the adversarial training part. In step S1, the loss value corresponding to the first feature is calculated forward, and the gradient value corresponding to the first feature is calculated backward.
[0060] Sub-step 1032: Determine the target perturbation value based on the gradient value and the loss value.
[0061] In embodiments of the present invention, such as Figure 2 As shown, the specific process of determining the perturbation value based on the gradient value and loss value can be as follows: First, set the perturbation accumulation steps to K. Enter the loop, and through step S2, calculate the first perturbation according to the adversarial training formula and the gradient value of the first feature. Then, accumulate the first perturbation to the first feature to perform the first perturbation. In the loop, through step S3, use the first feature after the perturbation in the previous loop to redetermine the corresponding perturbation loss value and perturbation gradient value. Based on the perturbation loss value and perturbation gradient value, redetermine the perturbation value to perturb the first feature. Finally, the perturbation value determined in the last step of the loop is the desired target perturbation value. Finally, through step S4, add the target perturbation value to the first feature to obtain the second feature.
[0062] The adversarial training formula can take different forms depending on the adversarial training method used. For example, when using the PGD method, the adversarial training formula can be shown in Formula 1 below:
[0063] (Formula 1)
[0064] in, This represents the parameters of the neural network. This indicates the sample text and its corresponding sample reference category. This represents the disturbance value. This represents the loss function, used to measure the performance of a neural network when employing... At that time, the output matches the actual label. To determine the difference, the loss function can be cross-entropy, mean squared error, etc. This indicates that given neural network parameters and raw data In this case, find an optimal perturbation value. This causes the loss function to reach its maximum value.
[0065] Sub-step 1033: Perturb the first feature based on the target perturbation value to obtain the second feature.
[0066] In this embodiment of the invention, after obtaining the perturbation, the first feature can be perturbed by the perturbation value to obtain the second feature.
[0067] It should be noted that the target perturbation value can include not only the perturbation value determined in the last step of the loop in sub-step 1032 above, but also the perturbation value determined in any step during the loop. That is, multiple target perturbation values can be determined by the first feature, and multiple second features corresponding to the first feature can be determined based on the multiple target perturbation values. Each second feature can participate in the training process of the first category model.
[0068] By determining the gradient and loss values corresponding to the first feature, determining the target perturbation value based on the gradient and loss values, and perturbing the first feature based on the target perturbation value, a second feature is obtained. This increases the number of features used to train the first classification model, which helps improve the model training effect, solves the problem of insufficient sample size to some extent, and enables the use of adversarial training methods during the training of the first classification model, further improving the training effect of the first classification model.
[0069] Step 104: Input the second feature into the first category sub-model of the first classification model to obtain the first sample classification result output by the first category output sub-model.
[0070] In this embodiment of the invention, the first category sub-model represents a sub-model used for text classification tasks, which can determine which preset category the text belongs to based on the text's feature vector, such as query, fault, processing, etc.
[0071] It should be noted that, in this embodiment of the invention, the first sample classification result can be composed of the probability of the sample text belonging to each text category. For example, a possible representation of the first sample classification result can be ["Query", 0.6536, "Fault", 0.0751, "Processing", 0.0412, "Consultation", 0.1207, "Complaint", 0.0367, "Other", 0.0727].
[0072] Optionally, in this embodiment of the invention, the first category sub-model may consist of a fully connected layer, a dropout layer, and a softmax activation function layer connected in sequence. This allows for linear transformation, regularization, and normalization of the first feature output by the pre-trained language sub-model to output the probability distribution of sample text belonging to different categories. The function of the first category sub-model is to convert the input feature vector into a probability vector.
[0073] like Figure 2 As shown, the first category sub-model can consist of a fully connected layer, a dropout layer, and a softmax activation function layer.
[0074] Step 105: Determine a first loss based on the first sample classification result and the sample reference category; adjust the model parameters of the first classification model based on the first loss to obtain a second classification model; wherein, the second classification model includes a semantic feature sub-model obtained by adjusting the parameters of the pre-trained language sub-model, and a second category sub-model obtained by adjusting the parameters of the first category sub-model.
[0075] In this embodiment of the invention, a first loss can be determined based on the first sample classification result and the sample reference category. The model parameters of the first classification model are then adjusted based on the first loss to obtain a second classification model. For example, the first sample classification result is ["Query", 0.6536, "Fault", 0.0751, "Processing", 0.0412, "Consultation", 0.1207, "Complaint", 0.0367, "Other", 0.0727]. The first sample classification result indicates that the probability of the sample text being classified as "Query" is the highest. If the sample reference category corresponding to the sample text is "Query", then the sample labels corresponding to each text category can be determined as ["Query", 1, "Fault", 0, "Processing", 0, "Consultation", 0, "Complaint", 0, "Other", 0]. In this embodiment of the invention, the first loss can be calculated using the probability value and label value of the same text category in the first sample classification result and the sample labels.
[0076] In the process of calculating the first loss, the first loss can be determined based on the label value of the correct text category (e.g., 1) and the probability value corresponding to the correctly determined text category in the first classification result, or it can be determined based on the label values of multiple text categories and the probability values corresponding to multiple text categories in the first classification result. In this embodiment of the invention, no specific limitation is made.
[0077] The loss functions used to calculate the first loss include, but are not limited to, the cross-entropy loss function, the mean squared error loss function (MSE), and the mean absolute error loss function (MAE), etc., and the embodiments of the present invention do not impose specific limitations.
[0078] In this embodiment of the invention, gradient descent can be used to adjust the model parameters of the first classification model. While adjusting the parameters of the first classification model, the parameters of the pre-trained language sub-model and the first category sub-model within the first classification model can be adjusted simultaneously until the first loss converges, resulting in a semantic feature sub-model corresponding to the pre-trained language sub-model and a second category sub-model corresponding to the first category sub-model. The semantic feature sub-model and the second category sub-model constitute the second classification model. This second classification model can receive input text, classify the input text, and output the classification result corresponding to the text.
[0079] Optionally, in this embodiment of the invention, in order to mitigate the impact of sample imbalance on model training, the first loss can be determined by the following sub-steps 1051 to 1052.
[0080] Sub-step 1051: Based on the first sample classification result and the sample reference category, determine the correct category probability value and the incorrect category probability value from the first sample classification result.
[0081] In this embodiment of the invention, the first sample classification result includes the probability value corresponding to each text category. The probability value corresponding to the reference category of the sample in the first sample classification result can be determined as the correct category probability value, and the probability values corresponding to the other text categories in the first classification result can be determined as the incorrect category probability values.
[0082] For example, if the classification result of the first sample is ["Query", 0.6536, "Fault", 0.0751, "Processing", 0.0412, "Consultation", 0.1207, "Complaint", 0.0367, "Other", 0.0727], and the sample reference category determines the sample labels corresponding to each text category as ["Query", 1, "Fault", 0, "Processing", 0, "Consultation", 0, "Complaint", 0, "Other", 0], then the probability value of 0.6536 corresponding to the text category "Query" can be determined as the correct category probability value, and the other probability values in the classification result of the first sample can be determined as incorrect category probability values.
[0083] Sub-step 1052: Determine the correct class loss corresponding to the correct class probability value based on the first loss function, and determine the incorrect class loss corresponding to the incorrect class probability value based on the second loss function.
[0084] In this embodiment of the invention, a first loss function can be used to determine the corresponding correct class loss for the correct class probability value. For example, the correct class loss can be calculated using the first focus loss function shown in Formula 2 below. The incorrect category loss can be calculated using the second focus loss function described in Formula 3. .
[0085] (Formula 2)
[0086] (Formula 3)
[0087] in, , representing the label value of each text category corresponding to the sample text. Indicates the number of text categories, This refers to the text category with a label value of 1, which is the correct text category of the sample text. For adjustable focus parameters, such as It can be 2, The sample text in the first sample classification result belongs to the first... The probability values of each category. In Formula 2 above, i indicates the correct category, and in Formula 3 above, i indicates the incorrect category.
[0088] It should be noted that technicians can select an appropriate loss function to determine the above based on actual needs. and The embodiments of the present invention are not specifically limited.
[0089] Sub-step 1053: Determine the first loss based on the correct category loss and the incorrect category loss.
[0090] In this embodiment of the invention, the correct category loss and the incorrect category loss can be added together to obtain the first loss. Alternatively, different weights can be set for the correct category loss and the incorrect category loss, and the correct category loss and the incorrect category loss can be weighted to obtain the first loss. This embodiment of the invention does not impose any specific limitations.
[0091] By combining the classification results of the first sample with the reference class, the correct class probability value and the incorrect class probability value are determined from the first sample classification result. The correct class loss corresponding to the correct class probability value is determined based on the first loss function, and the incorrect class loss corresponding to the incorrect class probability value is determined based on the second loss function. The first loss is then determined based on the correct class loss and the incorrect class loss. This approach not only considers the probability value of the correct class when calculating the first loss but also considers the probability value of the incorrect class, fully taking into account the output results of the first classification model in a single iteration. This helps improve the training effect of the first classification model and, to some extent, solves the problem of poor training performance due to insufficient sample size.
[0092] In summary, the model generation method provided in this embodiment of the invention includes: obtaining sample text and the corresponding sample reference category; inputting the sample text into a pre-trained language sub-model of a first classification model to obtain a first feature output by the pre-trained language sub-model; perturbing the first feature to obtain a second feature; inputting the second feature into a first category sub-model of the first classification model to obtain a first sample classification result output by the first category output sub-model; determining a first loss based on the first sample classification result and the sample reference category; and adjusting the model parameters of the first classification model based on the first loss to obtain a second classification model. During the training process of the classification model, the first feature generated internally based on the sample text can be perturbed to generate a second feature, enriching the text features that can be used during the training process. This allows the classification model to complete training based on more text features, helping to improve the training effect of the classification model under conditions of insufficient sample size or imbalanced samples, thereby improving the accuracy of the trained classification model.
[0093] Reference Figure 3 , Figure 3 This is a flowchart illustrating the steps of another model generation method provided in an embodiment of the present invention. Figure 3 As shown, it may include steps 201 to 209.
[0094] Step 201: Obtain the sample text and the sample reference category corresponding to the sample text.
[0095] Step 202: Input the sample text into the pre-trained language sub-model of the first classification model to obtain the first feature output by the pre-trained language sub-model.
[0096] Step 203: Perturb the first feature to obtain the second feature.
[0097] Step 204: Input the second feature into the first category sub-model of the first classification model to obtain the first sample classification result output by the first category output sub-model.
[0098] Step 205: Determine a first loss based on the first sample classification result and the sample reference category; adjust the model parameters of the first classification model based on the first loss to obtain a second classification model; wherein, the second classification model includes a semantic feature sub-model obtained by adjusting the parameters of the pre-trained language sub-model, and a second category sub-model obtained by adjusting the parameters of the first category sub-model.
[0099] Step 206: Determine the second sample classification result of the sample text.
[0100] In this embodiment of the invention, the second classification model may further include a target similarity sub-model. Based on the semantic feature sub-model and the second category sub-model in the second classification model, the text category of the input text can be determined. Then, the similarity between the text and each text sub-category within that text category can be determined through the target similarity sub-model, thereby further determining the text sub-category corresponding to the text. This achieves further classification of the text.
[0101] Specifically, the second sample classification result corresponding to the sample text can be determined first through the semantic feature sub-model and the second category sub-model in the second classification model.
[0102] Step 207: Based on the classification result of the second sample, determine the text category corresponding to the sample text, and obtain the standard text corresponding to each text subcategory of the text category.
[0103] In this embodiment of the invention, the category with the highest probability value in the second sample classification result can be determined as the text category corresponding to the sample text, and then the standard text corresponding to each text subcategory of the text category can be obtained.
[0104] Table 1 below illustrates a standard text library:
[0105]
[0106] Table 1
[0107] For example, if the classification result of the second sample is ["Query", 0.6536, "Fault", 0.0751, "Processing", 0.0412, "Consultation", 0.1207, "Complaint", 0.0367, "Other", 0.0727], since the probability value corresponding to the text category "Query" is the highest, the three standard texts corresponding to the text category "Query" can be obtained from the standard text library shown in Table 1 above: "Can you check my current balance?", "Is my phone bill overdue?", and "Can you check how much data I have left?".
[0108] Step 208: Input the sample text and the standard text into the first similarity sub-model to obtain the sample similarity between the sample text and each of the standard texts, respectively, output by the first similarity sub-model.
[0109] In this embodiment of the invention, a first similarity sub-model can be constructed, which can be used to determine the similarity between texts. Sample text and standard text can be input into the first similarity sub-model, and the first similarity sub-model outputs the sample similarity between the sample text and the standard text.
[0110] Specifically, sample text and standard text can be connected using a connector (e.g., []) and then input into the first similarity sub-model. It should be noted that the sample text can be connected to a single standard text before being input into the first similarity sub-model to obtain the sample similarity between the sample text and the standard text. Alternatively, the sample text can be connected to multiple standard texts before being input into the first similarity sub-model, which will output the sample similarity between the sample text and each of the multiple standard texts. This embodiment of the invention does not impose specific limitations. Furthermore, a text identifier can be added before the sample text to indicate the sample text portion input into the model. For example, the connector can be "[SEP]", and the text identifier can be "[CLS]".
[0111] Optionally, in this embodiment of the invention, the first similarity sub-model may include an ALBERT model, a fully connected layer, a dropout layer, and a sigmoid activation function layer. (See also...) Figure 4 , Figure 4 This diagram illustrates a first similarity sub-model provided by an embodiment of the present invention, as shown below. Figure 4 As shown, the first similarity sub-model can consist of an ALBERT model, a fully connected layer connected to the ALBERT model, a dropout layer connected to the fully connected layer, another fully connected layer connected to the dropout layer, and a sigmoid activation function layer connected to the second fully connected layer.
[0112] Step 209: Determine the second loss based on the sample similarity, and adjust the model parameters of the first similarity sub-model based on the second loss to obtain the target similarity sub-model.
[0113] After obtaining the sample similarity, a second loss can be determined based on the sample similarity, and the model parameters of the first similarity sub-model can be adjusted based on the second loss to obtain the target similarity sub-model.
[0114] Furthermore, in this embodiment of the invention, a second loss can be determined based on sample similarity, and the model parameters of each sub-model in the second classification model can be adjusted based on the second loss, so as to train the second classification model as a whole using the second loss, thereby further improving the training effect of the model.
[0115] Optionally, in order to further improve the model training effect in the case of few samples, in this embodiment of the invention, the sample text can be obtained by data augmentation. In the data augmentation process, data augmentation can be performed not only based on the EDA principle, but also based on the UAD (Unsupervised Data Augmentation) principle. Among the training samples augmented by UAD, there may be some samples that do not have corresponding sample labels. That is, in this embodiment of the invention, the sample text may not have corresponding reference text sub-category labels. Therefore, for sample texts that have corresponding reference text sub-category labels and sample texts that do not have corresponding reference text sub-category labels, different methods can be used to determine the second loss. For details, please refer to the following sub-steps 2081 to 2082.
[0116] Sub-step 2091: If the sample text has a corresponding reference text sub-category label, determine the second loss based on the similarity between the reference text sub-category label and the sample.
[0117] In this embodiment of the invention, for sample text with reference text sub-category labels, a second loss can be determined based on the sample similarity of the reference text and the reference text sub-category. In this case, the determined second loss is the supervised cross-entropy loss. The method for determining the second loss can refer to the method for determining the first loss described above, and will not be repeated in this embodiment of the invention.
[0118] Sub-step 2092: In the case that the sample text does not have a corresponding reference text sub-category label, the second loss is determined based on the enhanced sample similarity corresponding to the enhanced sample text generated from the sample text and the sample similarity corresponding to the sample text.
[0119] In this embodiment of the invention, for sample texts that do not have corresponding reference text subcategory labels, the enhanced sample similarity of the enhanced sample text corresponding to the sample text can be obtained, and a second loss can be determined based on the difference between the enhanced sample similarity and the sample similarity corresponding to the sample text. In this case, the determined second loss is the unsupervised consistency loss.
[0120] Specifically, refer to Figure 5 , Figure 5 A flowchart illustrating a second loss determination process provided by an embodiment of the present invention is shown, as follows: Figure 5 As shown, for labeled sample text, the second loss can be determined directly based on the sample text and its corresponding labeled data. For unlabeled sample text, the second loss can be determined based on the difference between the sample similarity corresponding to the unlabeled sample text and the sample similarity of the augmented sample text corresponding to the unlabeled sample text. The augmented sample text corresponding to the unlabeled sample text can be obtained by augmentation using the UAD principle.
[0121] When a sample text has a corresponding reference text sub-category label, the second loss is determined based on the similarity between the reference text sub-category label and the sample. When a sample text does not have a corresponding reference text sub-category label, the second loss is determined based on the similarity between the augmented sample text generated from the sample text and the sample text itself. Different loss function methods can be used to determine the loss for labeled and unlabeled samples, thus achieving supervised and unsupervised learning. This transforms the classification problem of fuzzy sub-category labels under a broad category label into a semantic similarity calculation problem, solving the classification problem of few labeled samples for each label under sub-category labels and fuzzy features between different category labels. It can obtain a large number of samples for model training through augmentation with a small amount of real data, which helps improve the model's training effect and, to some extent, solves the problem of imbalanced samples.
[0122] In summary, another model generation method provided by this invention includes: obtaining sample text and the corresponding sample reference category; inputting the sample text into a pre-trained language sub-model of a first classification model to obtain a first feature output by the pre-trained language sub-model; perturbing the first feature to obtain a second feature; inputting the second feature into a first category sub-model of the first classification model to obtain a first sample classification result output by the first category output sub-model; determining a first loss based on the first sample classification result and the sample reference category; and adjusting the model parameters of the first classification model based on the first loss to obtain a second classification model. During the training process of the classification model, the first feature generated internally based on the sample text can be perturbed to generate a second feature, enriching the text features that can be used during the training process. This allows the classification model to complete training based on more text features, helping to improve the training effect of the classification model under conditions of insufficient sample size or imbalanced samples, thereby improving the accuracy of the trained classification model.
[0123] Reference Figure 6 , Figure 6 This is a flowchart illustrating the steps of a text classification method provided in an embodiment of the present invention. Figure 6 As shown, it may include steps 301 to 307.
[0124] Step 301: Input the first text into the semantic feature sub-model of the second classification model to obtain the first text features output by the semantic feature sub-model.
[0125] In this embodiment of the invention, a second classification model can be trained using the model generation method described above, and the first text can be classified using the second classification model. The first text can be a user's question, chat content with customer service, etc., and this embodiment of the invention does not impose specific limitations.
[0126] Specifically, the first text can be input into the semantic feature sub-model of the second classification model to obtain the first text features output by the semantic feature sub-model.
[0127] Step 302: Input the first text feature into the second category sub-model of the second classification model to obtain the first classification result output by the second category sub-model.
[0128] After obtaining the first text feature, the first text feature can be input into the second category sub-model of the second classification model to obtain the first classification result output by the second category sub-model.
[0129] Step 303: Determine the text category of the first text based on the first classification result.
[0130] In this embodiment of the invention, the text category with the highest probability value in the first classification result can be determined as the text category of the first text.
[0131] It should be noted that the second classification result output by the second category sub-model can also be directly the text category of the first text. The process of determining the text category of the first text based on each text category can be performed within the second classification result. Those skilled in the art can flexibly adjust this according to actual needs; this embodiment of the invention does not impose specific limitations.
[0132] Optionally, in this embodiment of the invention, the second classification model can be used to determine the text category of the first text. The second classification model may also include a target similarity sub-model. The target similarity sub-model can further determine the text sub-category to which the first text belongs, thereby improving the accuracy of determining the category of the first text. For details, please refer to steps 304 to 307 below.
[0133] Step 304: If the text category matches the first text category, obtain the standard text of each text subcategory corresponding to the text category.
[0134] In this embodiment of the invention, the text category may include two types: a first text category with a corresponding text subcategory, and a second text category without a corresponding text subcategory, such as "other".
[0135] If the text category of the first text matches the first text category, it means that the text category of the first text has a corresponding text subcategory. At this time, the standard text of each text subcategory corresponding to the text category of the first text can be obtained, and then step 305 can be performed.
[0136] If the text category of the first text matches the text category of the second text, it means that the text category of the first text does not have a corresponding text subcategory, and there is no need to further determine its corresponding text subcategory. At this time, we can directly proceed to step 307.
[0137] Step 305: Input the first text and the standard text into the target similarity sub-model of the second classification model to obtain the text similarity between the first text and each of the standard texts output by the target similarity sub-model.
[0138] After obtaining the standard texts of each text sub-category corresponding to the text category of the first text, the first text and the standard texts can be input into the target similarity sub-model of the second classification model to obtain the text similarity between the first text and each standard text output by the target similarity sub-model.
[0139] Step 306: Determine the text sub-category corresponding to the first text based on the text similarity.
[0140] In this embodiment of the invention, the text subclass with the highest text similarity to the first text can be determined as the text subclass of the first text.
[0141] It should be noted that the target similarity sub-model can also be set to directly output the text sub-category of the first text. The process of determining the text sub-category corresponding to the first text based on text similarity can be performed within the target similarity sub-model or outside the target similarity sub-model. Technicians can flexibly adjust it according to actual needs, and the embodiments of the present invention do not impose specific limitations.
[0142] Step 307: If the text category matches the second text category, output the text category.
[0143] In summary, the text classification method provided by this invention includes: inputting a first text into a semantic feature sub-model of a second classification model to obtain a first text feature output by the semantic feature sub-model; inputting the first text feature into a second category sub-model of the second classification model to obtain a first classification result output by the second category sub-model; and determining the text category of the first text based on the first classification result. During the training process of the classification model, the first feature generated internally based on sample text can be perturbed to generate a second feature, enriching the text features that can be used during the training process. This allows the classification model to complete training based on more text features, helping to improve the training effect of the classification model under conditions of insufficient sample size or imbalanced samples, thereby improving the accuracy of the trained classification model.
[0144] Figure 7 This is a structural diagram of a model generation device provided in an embodiment of the present invention. The model generation device may include:
[0145] The acquisition module 701 is used to acquire the sample text and the sample reference category corresponding to the sample text;
[0146] The first input module 702 is used to input the sample text into the pre-trained language sub-model of the first classification model to obtain the first feature output by the pre-trained language sub-model.
[0147] The perturbation module 703 is used to perturb the first feature to obtain the second feature;
[0148] The second input module 704 is used to input the second feature into the first category sub-model of the first classification model to obtain the first sample classification result output by the first category output sub-model.
[0149] Training module 705 is used to determine a first loss based on the first sample classification result and the sample reference category, and adjust the model parameters of the first classification model based on the first loss to obtain a second classification model; wherein, the second classification model includes a semantic feature sub-model obtained by adjusting the parameters of the pre-trained language sub-model, and a second category sub-model obtained by adjusting the parameters of the first category sub-model.
[0150] Optionally, the disturbance module includes:
[0151] The numerical submodule is used to determine the gradient value and loss value corresponding to the first feature;
[0152] The perturbation value submodule is used to determine the target perturbation value based on the gradient value and the loss value;
[0153] The second feature submodule is used to perturb the first feature based on the target perturbation value to obtain the second feature.
[0154] Optionally, the training module includes:
[0155] The probability value submodule is used to determine the correct category probability value and the incorrect category probability value from the first sample classification result based on the first sample classification result and the sample reference category;
[0156] The category loss submodule is used to determine the correct category loss corresponding to the correct category probability value based on a first loss function, and to determine the incorrect category loss corresponding to the incorrect category probability value based on a second loss function.
[0157] The first loss submodule is used to determine the first loss based on the correct category loss and the incorrect category loss.
[0158] Optionally, the second classification model further includes a target similarity sub-model, and the apparatus further includes:
[0159] The classification result module is used to determine the second sample classification result of the sample text;
[0160] The standard text module is used to determine the text category corresponding to the sample text based on the second sample classification result, and to obtain the standard text corresponding to each text subcategory of the text category;
[0161] The sample similarity module is used to input the sample text and the standard text into the first similarity sub-model to obtain the sample similarity between the sample text and each of the standard texts, respectively, output by the first similarity sub-model.
[0162] The similarity sub-model training module is used to determine a second loss based on the sample similarity and adjust the model parameters of the first similarity sub-model based on the second loss to obtain the target similarity sub-model.
[0163] Optionally, the similarity sub-model training module includes:
[0164] A label loss submodule is provided, which is used to determine the second loss based on the similarity between the reference text subclass label and the sample when the sample text has a corresponding reference text subclass label;
[0165] The unlabeled loss submodule is used to determine the second loss based on the similarity between the enhanced sample text generated from the sample text and the sample text corresponding to the sample text, when the sample text does not have a corresponding reference text subcategory label.
[0166] Optionally, the first category of sub-models includes a fully connected layer, a dropout layer, and a softmax activation function layer.
[0167] Optionally, the first similarity sub-model includes an ALBERT model, a fully connected layer, a dropout layer, and a sigmoid activation function layer.
[0168] In summary, the model generation apparatus provided in this embodiment of the invention includes: acquiring sample text and the corresponding sample reference category; inputting the sample text into a pre-trained language sub-model of a first classification model to obtain a first feature output by the pre-trained language sub-model; perturbing the first feature to obtain a second feature; inputting the second feature into a first category sub-model of the first classification model to obtain a first sample classification result output by the first category output sub-model; determining a first loss based on the first sample classification result and the sample reference category; and adjusting the model parameters of the first classification model based on the first loss to obtain a second classification model. During the training process of the classification model, the first feature generated internally based on the sample text can be perturbed to generate a second feature, enriching the text features that can be used during the training process. This allows the classification model to complete training based on more text features, helping to improve the training effect of the classification model under conditions of insufficient sample size or imbalanced samples, thereby improving the accuracy of the trained classification model.
[0169] Figure 8 This is a structural diagram of a text classification device provided in an embodiment of the present invention. The text classification device may include:
[0170] The first text feature module 801 is used to input the first text into the semantic feature sub-model of the second classification model to obtain the first text features output by the semantic feature sub-model.
[0171] The first classification result module 802 is used to input the first text features into the second category sub-model of the second classification model to obtain the first classification result output by the second category sub-model.
[0172] The text category module 803 is used to determine the text category of the first text based on the first classification result.
[0173] Optionally, the device further includes:
[0174] The standard text acquisition module is used to acquire the standard text of each text subcategory corresponding to the text category when the text category matches the first text category;
[0175] The text similarity module is used to input the first text and the standard text into the target similarity sub-model of the second classification model to obtain the text similarity between the first text and each of the standard texts output by the target similarity sub-model.
[0176] The text sub-category module is used to determine the text sub-category corresponding to the first text based on the text similarity.
[0177] In summary, the text classification apparatus provided in this embodiment of the invention includes: inputting a first text into a semantic feature sub-model of a second classification model to obtain a first text feature output by the semantic feature sub-model; inputting the first text feature into a second category sub-model of the second classification model to obtain a first classification result output by the second category sub-model; and determining the text category of the first text based on the first classification result. During the training process of the classification model, the first feature generated internally based on sample text can be perturbed to generate a second feature, enriching the text features that can be used during the training process. This allows the classification model to complete training based on more text features, helping to improve the training effect of the classification model under conditions of insufficient sample size or imbalanced samples, thereby improving the accuracy of the trained classification model.
[0178] The present invention also provides a structural diagram of an electronic device, see below. Figure 9 It includes: a processor 1101, a memory 1102, and a computer program 11021 stored in the memory and executable on the processor. When the processor executes the program, it implements the model generation method or text classification method of the foregoing embodiments.
[0179] The present invention also provides a readable storage medium, wherein when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is able to perform the model generation method or text classification method of the foregoing embodiments.
[0180] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0181] It should be noted that all information and data obtained in the embodiments of the present invention were obtained with the authorization of the information / data holder.
[0182] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the invention.
[0183] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0184] Similarly, it should be understood that, in order to simplify the invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into this detailed description, wherein each claim itself is a separate embodiment of the invention.
[0185] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0186] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present invention. The present invention can also be implemented as a device or apparatus program for performing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0187] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0188] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0189] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0190] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A model generation method characterized by comprising: The method comprises: obtaining sample text and a sample reference category corresponding to the sample text; inputting the sample text into a pre-training language sub-model of a first classification model to obtain first features output by the pre-training language sub-model; perturbing the first features to obtain second features; inputting the second features into a first category sub-model of the first classification model to obtain a first sample classification result output by the first category output sub-model; determining a first loss based on the first sample classification result and the sample reference category, adjusting model parameters of the first classification model based on the first loss to obtain a second classification model; wherein the second classification model comprises a semantic feature sub-model obtained by adjusting parameters of the pre-training language sub-model, and a second category sub-model obtained by adjusting parameters of the first category sub-model; The second classification model further comprises a target similarity sub-model, and the method further comprises: determining a second sample classification result of the sample text; based on the second sample classification result, determining a text category corresponding to the sample text, and obtaining standard texts corresponding to each text sub-category of the text category; inputting the sample text and the standard texts into a first similarity sub-model to obtain sample similarities respectively corresponding to the sample text and each of the standard texts output by the first similarity sub-model; determining a second loss based on the sample similarities, and adjusting model parameters of the first similarity sub-model based on the second loss to obtain the target similarity sub-model.
2. The method of claim 1, wherein, The perturbing the first features to obtain second features comprises: determining gradient values and loss values corresponding to the first features; determining a target perturbation value based on the gradient values and the loss values; perturbing the first features based on the target perturbation value to obtain the second features.
3. The method of claim 1, wherein, The determining a first loss based on the first sample classification result and the sample reference category comprises: based on the first sample classification result and the sample reference category, determining correct category probability values and incorrect category probability values from the first sample classification result; determining a correct category loss corresponding to the correct category probability values based on a first loss function, and determining an incorrect category loss corresponding to the incorrect category probability values based on a second loss function; determining the first loss based on the correct category loss and the incorrect category loss.
4. The method of claim 1, wherein, The determining a second loss based on the sample similarities comprises: in the case that the sample text has a corresponding reference text sub-category label, determining the second loss based on the reference text sub-category label and the sample similarities; in the case that the sample text does not have a corresponding reference text sub-category label, determining the second loss based on an enhanced sample similarity corresponding to an enhanced sample text generated from the sample text and the sample similarity corresponding to the sample text.
5. The method of claim 1, wherein, The first category sub-model comprises a fully connected layer, a dropout layer and a softmax activation function layer.
6. The method of claim 1, wherein, The first similarity sub-model comprises an ALBERT model, a full connection layer, a dropout layer and a sigmoid activation function layer.
7. A method of text classification characterized by, The method comprises: inputting the first text into a semantic feature sub-model of a second classification model to obtain first text features output by the semantic feature sub-model; inputting the first text features into a second category sub-model of the second classification model to obtain first classification results output by the second category sub-model; determining a text category of the first text based on the first classification results; The second classification model is generated by the model generation method according to any one of claims 1 to 6.
8. The method of claim 7, wherein, The method further comprises: in a case where the text category matches a first text category, obtaining standard texts of respective text sub-categories corresponding to the text category; inputting the first text and the standard texts into a target similarity sub-model of the second classification model to obtain text similarities respectively corresponding to the first text and the standard texts output by the target similarity sub-model; determining a text sub-category corresponding to the first text based on the text similarities.
9. A model generation apparatus characterized by comprising: The device comprises: a obtaining module configured to obtain sample texts and sample reference categories corresponding to the sample texts; a first input module configured to input the sample texts into a pre-training language sub-model of a first classification model to obtain first features output by the pre-training language sub-model; a perturbation module configured to perturb the first features to obtain second features; a second input module configured to input the second features into a first category sub-model of the first classification model to obtain first sample classification results output by the first category sub-model; a training module configured to determine a first loss based on the first sample classification results and the sample reference categories, adjust model parameters of the first classification model based on the first loss to obtain a second classification model, wherein the second classification model comprises a semantic feature sub-model obtained by adjusting parameters of the pre-training language sub-model, and a second category sub-model obtained by adjusting parameters of the first category sub-model; The second classification model further comprises a target similarity sub-model, and the device further comprises: a classification result module configured to determine second sample classification results of the sample texts; a standard text module configured to determine a text category corresponding to the sample texts based on the second sample classification results, and obtain standard texts corresponding to respective text sub-categories of the text category; a sample similarity module configured to input the sample texts and the standard texts into a first similarity sub-model to obtain sample similarities respectively corresponding to the sample texts and the standard texts output by the first similarity sub-model; a similarity sub-model training module configured to determine a second loss based on the sample similarities, and adjust model parameters of the first similarity sub-model based on the second loss to obtain the target similarity sub-model.
10. A text classification apparatus characterized by comprising: The device comprises: a first text feature module configured to input a first text into a semantic feature sub-model of a second classification model to obtain first text features output by the semantic feature sub-model; The first classification result module is configured to input the first text feature into a second category sub-model of the second classification model to obtain a first classification result output by the second category sub-model. The text category module is configured to determine a text category of the first text based on the first classification result. The second classification model is generated by the model generation method according to any one of claims 1 to 6.
11. An electronic device, comprising: The computer program is stored in the memory and executable on the processor, and the processor implements the method according to any one of claims 1 to 8 when executing the program. When the instructions in the readable storage medium are executed by the processor of the electronic device, the electronic device can execute the method according to any one of claims 1 to 8.
12. A readable storage medium, characterized by,
Citation Information
Patent Citations
Text processing method and device, electronic equipment and readable storage medium
CN113761868A
Text statement classification method and device, electronic equipment and storage medium
CN115510232A