Data classification method and apparatus, computer device, and storage medium
By using multi-dimensional semantic analysis and neural network models to automatically classify data, the problem of the large amount of manpower and resources required for manual annotation has been solved, and efficient and accurate data classification has been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-04-12
- Publication Date
- 2026-05-15
AI Technical Summary
In existing technologies, data classification for internet products mainly relies on manual labeling, resulting in huge consumption of human and material resources and making it difficult to efficiently process large amounts of chat logs and other data.
By employing multi-dimensional semantic analysis and neural network models, multi-dimensional semantic analysis is performed on text word vectors to extract local features. Then, a classification network is used to automatically determine the target classification label, thereby achieving accurate data classification.
While ensuring the accuracy of data classification, it significantly improves the efficiency of data classification and saves labor costs.
Smart Images

Figure CN116304838B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a data classification method, apparatus, computer device, and storage medium. Background Technology
[0002] With the increasing variety of internet products, these products generate massive amounts of data daily. To facilitate the organization, management, and risk monitoring of the internet environment, this data needs to be categorized. Taking chat tools as an example, with the widespread use of online chat tools, a large amount of chat history is generated every moment. To facilitate risk monitoring of various chat tools, different types of chat history need to be reasonably categorized.
[0003] However, most data classification currently relies on manual labeling. Since most internet products (such as chat tools) generate a large amount of data (such as chat data) at all times, manual labeling would consume a lot of manpower and resources. Summary of the Invention
[0004] Therefore, it is necessary to provide a data classification method, apparatus, computer equipment, and storage medium that can effectively improve the efficiency of data classification in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a data classification method. The method includes:
[0006] Obtain the text word vectors of the data to be classified;
[0007] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and the text semantic vectors of the data to be classified are determined based on the results of multi-dimensional semantic analysis.
[0008] The second feature extraction network of the classification model extracts local features of the data to be classified based on the text semantic vector.
[0009] The target classification label of the data to be classified is determined by the classification network of the classification model based on the local features of the data to be classified.
[0010] In one embodiment, the first feature extraction network includes a first semantic extraction network, a second semantic extraction network, and a semantic fusion network;
[0011] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified. Based on the results of the multi-dimensional semantic analysis, the text semantic vectors of the data to be classified are determined, including:
[0012] The first semantic extraction network of the classification model is used to analyze the first-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0013] The second semantic extraction network of the classification model is used to analyze the second-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0014] The semantic fusion network of the classification model determines the text semantic vector of the data to be classified based on the first-dimensional semantic features, the second-dimensional semantic features, and the text word vectors of the data to be classified.
[0015] In one embodiment, the first semantic extraction network is a multi-head attention network; the second semantic extraction network is a Hopefield network.
[0016] In one embodiment, the classification network includes a first classifier, a second classifier, and a label output network;
[0017] The classification network of the classification model determines the target classification label of the data to be classified based on the local features of the data, including:
[0018] The first classifier of the classification model determines the first probability that the data to be classified belongs to each candidate category label based on the local features of the data to be classified.
[0019] The second classifier of the classification model determines the second probability of the data to be classified belonging to each candidate classification label based on the local features of the data to be classified.
[0020] The label output network of the classification model outputs the target classification label of the data to be classified based on the first and second probabilities of the data belonging to each candidate classification label.
[0021] In one embodiment, the label output network of the classification model outputs the target classification label of the data to be classified based on the first probability and the second probability that the data to be classified belongs to each candidate classification label, including:
[0022] The label output network of the classification model determines the target classification label of the data to be classified from the candidate classification labels based on the first and second probabilities of the data to be classified belonging to each candidate classification label, as well as the weight values of the first and second classifiers, and outputs the target classification label of the data to be classified.
[0023] In one embodiment, obtaining the text word vectors of the data to be classified includes:
[0024] Perform word segmentation on the data to be classified to obtain at least one segmented word;
[0025] Based on each word segmentation word and its position in the data to be classified, the word vector of each word segmentation word is determined.
[0026] Based on the word vectors of each segmented vocabulary, determine the text word vectors of the data to be classified.
[0027] In one embodiment, the training process of the classification model includes:
[0028] Obtain the text word vectors of the sample classification data;
[0029] Clustering is performed on the text word vectors of the sample classification data to obtain the first sample classification label of the sample classification data;
[0030] The text word vectors of the sample classification data are input into the classification model to obtain the second sample classification label of the sample classification data;
[0031] The classification model is trained based on the classification labels of the first and second samples.
[0032] Secondly, this application also provides a data classification apparatus. The apparatus includes:
[0033] The acquisition module is used to acquire the text word vectors of the data to be classified;
[0034] The first determination module is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified through the first feature extraction network of the classification model, and determine the text semantic vectors of the data to be classified based on the multi-dimensional semantic analysis results.
[0035] The extraction module is used to extract local features of the data to be classified based on the text semantic vector through the second feature extraction network of the classification model.
[0036] The second determination module is used to determine the target classification label of the data to be classified based on the local features of the data to be classified through the classification network of the classification model.
[0037] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0038] Obtain the text word vectors of the data to be classified;
[0039] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and the text semantic vectors of the data to be classified are determined based on the results of multi-dimensional semantic analysis.
[0040] The second feature extraction network of the classification model extracts local features of the data to be classified based on the text semantic vector.
[0041] The target classification label of the data to be classified is determined by the classification network of the classification model based on the local features of the data to be classified.
[0042] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0043] Obtain the text word vectors of the data to be classified;
[0044] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and the text semantic vectors of the data to be classified are determined based on the results of multi-dimensional semantic analysis.
[0045] The second feature extraction network of the classification model extracts local features of the data to be classified based on the text semantic vector.
[0046] The target classification label of the data to be classified is determined by the classification network of the classification model based on the local features of the data to be classified.
[0047] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0048] Obtain the text word vectors of the data to be classified;
[0049] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and the text semantic vectors of the data to be classified are determined based on the results of multi-dimensional semantic analysis.
[0050] The second feature extraction network of the classification model extracts local features of the data to be classified based on the text semantic vector.
[0051] The target classification label of the data to be classified is determined by the classification network of the classification model based on the local features of the data to be classified.
[0052] The aforementioned data classification method, apparatus, computer equipment, and storage medium acquire text word vectors of the data to be classified. Then, based on the first feature extraction network of the classification model, multi-dimensional semantic analysis is performed on the text word vectors of the data to be classified. Based on the multi-dimensional semantic analysis results, the text semantic vectors of the data to be classified are determined. The second feature extraction network of the classification model is used to extract the text semantic vectors to determine the local features of the data to be classified. Finally, the local features of the data to be classified are input into the classification network of the classification model to determine the target classification label of the data to be classified, thereby achieving automatic and accurate classification of data (such as chat records). Compared with traditional manual classification, this application significantly improves data classification efficiency and saves labor costs while ensuring the accuracy of data classification. Attached Figure Description
[0053] Figure 1 This is a diagram illustrating the application environment of the data classification method provided in this embodiment.
[0054] Figure 2 This is a flowchart illustrating the first data classification method provided in this embodiment;
[0055] Figure 3 This is a flowchart illustrating the process of determining the text semantic vector of the data to be classified, as provided in this embodiment.
[0056] Figure 4 This is a structural block diagram of the first feature extraction network provided in this embodiment;
[0057] Figure 5 This is a flowchart illustrating the process of determining the first service business provided in this embodiment;
[0058] Figure 6 This is a schematic diagram of the process for determining the target classification label provided in this embodiment;
[0059] Figure 7 This is a flowchart illustrating the third data classification method provided in this embodiment;
[0060] Figure 8 This is a structural block diagram of the classification model provided in this embodiment;
[0061] Figure 9 This is a structural block diagram of the first data classification device provided in this embodiment;
[0062] Figure 10 This is a structural block diagram of the second data classification device provided in this embodiment;
[0063] Figure 11 This is a structural block diagram of the third data classification device provided in this embodiment;
[0064] Figure 12This is a structural block diagram of the fourth data classification device provided in this embodiment;
[0065] Figure 13 This is a structural block diagram of the fifth data classification device provided in this embodiment;
[0066] Figure 14 This is an internal structural diagram of the computer device provided in this embodiment. Detailed Implementation
[0067] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0068] The data classification method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Specifically, terminal 102 sends data to be classified to server 104. Server 104 obtains the text word vectors of the data to be classified based on the data to be classified, then performs multi-dimensional semantic analysis on the text word vectors of the data to be classified using the first feature extraction network of the classification model. Based on the multi-dimensional semantic analysis results, it determines the text semantic vectors of the data to be classified, and uses the second feature extraction network of the classification model to extract the text semantic vectors to determine the local features of the data to be classified. Finally, the local features of the data to be classified are input into the classification network of the classification model to determine the target classification label of the data to be classified. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and other smart devices. Server 104 can be implemented using a standalone server or a server cluster composed of multiple servers.
[0069] In one embodiment, a data classification method is provided, which is applied to... Figure 1 Taking the server in the example of this, such as Figure 2 As shown, it includes the following steps:
[0070] S201, Obtain the text word vectors of the data to be classified.
[0071] Among them, the data to be classified refers to text data for which no target classification label has been obtained, such as chat data; the text word vector refers to the text vector representation of the data to be classified.
[0072] One optional implementation method of this embodiment is: inputting the data to be classified into a trained neural network model, and having the neural network model output the text word vectors of the data to be classified.
[0073] Another optional implementation of this embodiment is as follows: The data to be classified is segmented to obtain at least one segmented word. Based on each segmented word and its position information in the data to be classified, the word vector of each segmented word is determined. Based on the word vectors of each segmented word, the text word vector of the data to be classified is determined. This embodiment can use, but is not limited to, online or offline segmentation tools to classify the data, such as SnowNLP, Thulac, and HanLP.
[0074] An optional implementation method for determining the text word vectors of the data to be classified based on the word vectors of each segmented word is as follows: perform layer standardization on the word vectors of each segmented word, and use the word vectors after layer standardization as the text word vectors of the data to be classified. Specifically, the following formula (1) can be used to perform layer standardization on the word vectors of each segmented word:
[0075]
[0076] In formula (1), L is the Lagrange partial derivative; D is the number of data segments, i.e., the vector dimension; scalar γ and vector δ i x is a learnable parameter; ε is a regularization constant; i The word vectors for word segmentation; It is the average of the word vectors of each segmented word; g i The text word vectors represent the data to be classified.
[0077] S202 uses the first feature extraction network of the classification model to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and determines the text semantic vectors of the data to be classified based on the results of the multi-dimensional semantic analysis.
[0078] The classification model refers to a model used to automatically classify data and assign corresponding classification labels. The first feature extraction network is a neural network that performs multi-dimensional speech analysis on the text word vectors of the data to be classified. This network obtains the text word vectors of the data to be classified based on the results of multi-dimensional speech analysis. The text semantic vector refers to the text vector obtained after semantic analysis of the text word vectors.
[0079] An optional implementation method in this embodiment is as follows: The first feature extraction network of the classification model performs two-dimensional semantic analysis on the text word vectors of the data to be classified, and determines the text semantic vector of the data to be classified based on the results of the two-dimensional semantic analysis. Specifically, the first feature extraction network of the classification model performs two-dimensional semantic analysis on each word in the text word vectors of the data to be classified, focusing on both semantics and position. Based on the results of the two-dimensional semantic analysis, the text semantic vector of the data to be classified is determined. In this embodiment, one dimension involves semantic analysis of each word in the text word vectors of the data to be classified, and the other dimension involves positional analysis of each word in the text word vectors of the data to be classified. Finally, the semantic analysis results and the positional analysis results are fused to determine the text semantic vector of the data to be classified based on both semantics and position.
[0080] S203 uses the second feature extraction network of the classification model to extract local features of the data to be classified based on the text semantic vector.
[0081] The second feature extraction network refers to a neural network that extracts local features from the text semantic vectors of the data to be classified. Local features are those that highlight the categories of the data to be classified.
[0082] Optionally, the text semantic vector is input into a second feature extraction network, which extracts local features of the data to be classified. The second feature extraction network may employ, but is not limited to, a BIGRU network.
[0083] S204, through the classification network of the classification model, the target classification label of the data to be classified is determined based on the local features of the data to be classified.
[0084] Here, the classification network refers to a neural network used to classify data based on local features; the target classification label refers to the classification label of the data to be classified, determined based on the local features and the classification network, and is used to characterize the category of the data to be classified.
[0085] Optionally, in this embodiment, the local features of the data to be classified are input into the classification network of the classification model, and the classification network outputs the target classification label of the data to be classified based on the local features of the data to be classified.
[0086] In this embodiment, text word vectors of the data to be classified are obtained, and then multi-dimensional semantic analysis is performed on the text word vectors of the data to be classified according to the first feature extraction network of the classification model. Based on the multi-dimensional semantic analysis results, the text semantic vectors of the data to be classified are determined. The text semantic vectors are extracted using the second feature extraction network of the classification model to determine the local features of the data to be classified. Finally, the local features of the data to be classified are input into the classification network of the classification model to determine the target classification label of the data to be classified, thereby achieving automatic and accurate classification of data (such as chat records). Compared with traditional manual classification, this application significantly improves the efficiency of data classification and saves labor costs while ensuring the accuracy of data classification.
[0087] In one embodiment, the first feature extraction network includes a first semantic extraction network, a second semantic extraction network, and a semantic fusion network, such as... Figure 3 , Figure 4 As shown, in one optional implementation of S202, the method includes:
[0088] S301 uses the first semantic extraction network of the classification model to analyze the first-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0089] The first semantic extraction network refers to the neural network used to extract the first-dimensional semantic features of the data to be classified, and it may employ, but is not limited to, a multi-head attention network.
[0090] Optionally, in this embodiment, the text word vectors of the data to be classified are input into the first semantic extraction network to parse the first-dimensional semantic features of the data to be classified. The first semantic extraction network can be represented by the following formula (2):
[0091]
[0092]
[0093] In formula (2), g i Represents text word vectors; g iB Represents the text word vector g i The normalized vector in query set B; g iC Represents the text word vector g i The normalized vector in the key set C. and These are the learning parameters of the first semantic extraction network; E ATT Represents the text word vector g i The first dimension of semantic features.
[0094] S302 uses the second semantic extraction network of the classification model to parse the second-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0095] The second semantic extraction network refers to the neural network that extracts the second-dimensional semantic features of the data to be classified, and it may employ, but is not limited to, the Hopefield network, i.e., the HN network.
[0096] Optionally, in this embodiment, the text word vectors of the data to be classified are input into the second semantic extraction network, which then parses and outputs the second-dimensional semantic features of the data to be classified. The second semantic extraction network can be represented by the following formula (3):
[0097]
[0098] In formula (3), ξ ui Represents the learnable weights of the second semantic extraction network; r(·) represents the activation function; g i Represents text word vectors; g iB Represents the text word vector g i Normalized vector; E HN Represents the text word vector g i The second dimension of semantic features.
[0099] S303, through the semantic fusion network of the classification model, determines the text semantic vector of the data to be classified based on the first-dimensional semantic features, the second-dimensional semantic features, and the text word vectors of the data to be classified.
[0100] Among them, semantic fusion network refers to a neural network that determines the semantic vector of text based on the first-dimensional semantic features, the second-dimensional semantic features, and the text word vectors of the data to be classified.
[0101] Optionally, in this embodiment, the target semantic features are obtained by fusing the first-dimensional semantic features and the second-dimensional semantic features; the text semantic vector of the data to be classified is determined based on the target semantic features and the text word vectors of the data to be classified.
[0102] Specifically, in this embodiment, the semantic fusion network can be characterized by the following formula (4):
[0103]
[0104] In formula (4), E HN Represents the text word vector g i The second dimension of semantic features; E ATT Represents the text word vector g i The first dimension of semantic features; A text semantic vector representing the data to be classified.
[0105] This embodiment uses the first semantic extraction network of the classification model to parse the first-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified. Then, it uses the second semantic extraction network of the classification model to parse the second-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified. Finally, it uses the semantic fusion network of the classification model to accurately determine the text semantic vector of the data to be classified based on the first-dimensional semantic features, the second-dimensional semantic features, and the text word vectors of the data to be classified.
[0106] In one embodiment, in order to accurately obtain the target classification label of the data to be classified, such as Figure 5 As shown, one possible implementation of S204 is as follows:
[0107] S501, through the first classifier of the classification model, determines the first probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified.
[0108] The first classifier refers to the classifier that determines the first probability of each candidate classification label of the data to be classified based on the local features of the data to be classified, and may be, but is not limited to, the SOFTMAX classifier.
[0109] Optionally, in this embodiment, the local features of the data to be classified are input into the first classifier, and the first classifier outputs the first probability that the data to be classified belongs to each candidate classification label.
[0110] S502, through the second classifier of the classification model, determines the second probability of the data to be classified belonging to each candidate classification label based on the local features of the data to be classified.
[0111] The second classifier refers to a classifier that determines the second probability of each candidate classification label of the data to be classified based on the local features of the data to be classified, and may employ, but is not limited to, capsule networks.
[0112] Optionally, in this embodiment, the local features of the data to be classified are input into the second classifier, and the second classifier outputs the second probability that the data to be classified belongs to each candidate classification label.
[0113] S503 outputs the target classification label of the data to be classified through the label output network of the classification model, based on the first and second probabilities of the data to be classified belonging to each candidate classification label.
[0114] The label output network refers to a neural network that determines and outputs the target classification label based on the first and second probabilities of each candidate classification label.
[0115] An optional implementation of this embodiment is as follows: The first probability and the second probability of the data to be classified belonging to each candidate category label are input into the label output network of the classification model. The label output network sorts the candidate category labels according to the first probability and the second probability, and outputs the target category label of the data to be classified based on the sorting result. For example, based on the sorting result, the candidate label ranked first is output as the target category label.
[0116] Another optional implementation of this embodiment is as follows: Using the label output network of the classification model, based on the first and second probabilities of the data to be classified belonging to each candidate category label, and the weight values of the first and second classifiers, the target category label of the data to be classified is determined from the candidate category labels, and the target category label of the data to be classified is output. Specifically, using the label output network of the classification model, based on the first probability of the data to be classified belonging to each candidate category label and the weight value of the first classifier, the first target probability of each candidate category label is determined; based on the second probability of the data to be classified belonging to each candidate category label and the weight value of the second classifier, the second target probability of each candidate category label is determined; based on the first and second target probabilities, the candidate category labels are sorted; and based on the sorting result, the target category label of the data to be classified is output. In this embodiment, the first target probability of each candidate classification label is determined based on the first probability that the data to be classified belongs to each candidate classification label and the weight value of the first classifier. The second target probability of the data to be classified belongs to each candidate classification label can be determined by multiplying the first probability of the data to be classified belonging to each candidate classification label by the weight value of the first classifier; and multiplying the second probability of the data to be classified belonging to each candidate classification label by the weight value of the second classifier.
[0117] In this embodiment, the first classifier of the classification model determines the first probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified. The second classifier of the classification model determines the second probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified. The label output network of the classification model can output the target classification label of the data to be classified more accurately based on the first and second probabilities that the data to be classified belongs to each candidate classification label.
[0118] In one embodiment, such as Figure 6 As shown, an optional implementation of a data classification method includes:
[0119] S601, Obtain the text word vectors of the sample classification data.
[0120] Among them, sample classification data refers to the sample data to be classified used to train the classification model.
[0121] Optionally, in this embodiment, the original sample data is obtained, preprocessed to obtain sample classification data, and then vectorized (e.g., input into a word vector model) to obtain the text word vectors of the sample classification data.
[0122] The methods for preprocessing the original sample data in this embodiment include, but are not limited to, standardizing the format and cleaning up invalid characters.
[0123] S602, perform clustering processing on the text word vectors of the sample classification data to obtain the first sample classification label of the sample classification data.
[0124] Clustering refers to dividing a dataset into different classes or clusters according to a specific criterion (such as distance), so that the similarity of data objects within the same cluster is as high as possible, while the difference between data objects in different clusters is also as high as possible.
[0125] Optionally, the text word vectors of the sample classification data are input into a clustering algorithm (such as the K-Means algorithm) to obtain the original sample classification labels of the sample classification data. The original sample classification labels are then corrected to obtain the first sample classification labels of the sample data.
[0126] In this embodiment, the method for correcting the original sample classification labels can be, but is not limited to, machine correction or manual correction.
[0127] S603, input the text word vectors of the sample classification data into the classification model to obtain the second sample classification label of the sample classification data.
[0128] S604, Train the classification model based on the classification labels of the first and second samples.
[0129] Optionally, in this embodiment, the classification label of the first sample is compared with the classification label of the second sample. If the classification label of the second sample is inconsistent with the classification label of the first sample, the relevant parameters (such as learning parameters, weights, etc.) in the classification model are adjusted to train the classification model.
[0130] S605, Obtain the text word vectors of the data to be classified.
[0131] S606 uses the first feature extraction network of the classification model to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and determines the text semantic vectors of the data to be classified based on the results of the multi-dimensional semantic analysis.
[0132] S607 uses the second feature extraction network of the classification model to extract local features of the data to be classified based on the text semantic vector.
[0133] S608 determines the target classification label of the data to be classified based on the local features of the data through the classification network of the classification model.
[0134] In this embodiment, text word vectors of sample classification data are obtained, and clustering processing is performed on the text word vectors of sample classification data to obtain the first sample classification label of sample classification data. The text word vectors of sample classification data are input into the classification model to obtain the second sample classification label of sample classification data. Based on the first and second sample classification labels, the classification model is trained to improve the accuracy of the target classification label of the data to be classified output by the classification model.
[0135] In one embodiment, such as Figure 7 , Figure 8 As shown, an optional implementation of a data classification method includes:
[0136] S701, Obtain the text word vectors of the sample classification data.
[0137] S702, perform clustering processing on the text word vectors of the sample classification data to obtain the first sample classification label of the sample classification data.
[0138] S703, input the text word vectors of the sample classification data into the classification model to obtain the second sample classification label of the sample classification data.
[0139] S704, The classification model is trained based on the classification labels of the first and second samples.
[0140] S705, perform word segmentation on the data to be classified to obtain at least one segmented word.
[0141] S706. Based on each word segmentation word and its position information in the data to be classified, determine the word vector of each word segmentation word.
[0142] S707, determine the text word vector of the data to be classified based on the word vector of each segmented word.
[0143] S708 uses the first semantic extraction network of the classification model to parse the first-dimensional semantic features of the data to be classified based on the text word vectors. The first semantic extraction network is a multi-head attention network.
[0144] S709 uses a second semantic extraction network of the classification model to parse the second-dimensional semantic features of the data to be classified based on the text word vectors. The second semantic extraction network is the Hopfield network.
[0145] S7010 determines the text semantic vector of the data to be classified based on the first-dimensional semantic features, the second-dimensional semantic features, and the text word vectors of the data to be classified through the semantic fusion network of the classification model.
[0146] S7011 extracts local features of the data to be classified based on the text semantic vector through the second feature extraction network of the classification model.
[0147] S7012, through the first classifier of the classification model, determines the first probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified.
[0148] S7013 uses the second classifier of the classification model to determine the second probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified.
[0149] S7014, through the label output network of the classification model, determines the target classification label of the data to be classified from each candidate classification label based on the first probability and the second probability of the data to be classified belonging to each candidate classification label, as well as the weight values of the first classifier and the second classifier, and outputs the target classification label of the data to be classified.
[0150] This embodiment obtains the text word vectors of the data to be classified, and then performs multi-dimensional semantic analysis on the text word vectors of the data to be classified according to the first feature extraction network of the classification model. Based on the multi-dimensional semantic analysis results, the text semantic vector of the data to be classified is determined. The text semantic vector is then extracted using the second feature extraction network of the classification model to determine the local features of the data to be classified. Finally, the local features of the data to be classified are input into the classification network of the classification model to determine the target classification label of the data to be classified, thereby achieving automatic and accurate classification of data (such as chat records). Compared with traditional manual classification, this application significantly improves the efficiency of data classification while ensuring the accuracy of data classification and saving labor costs.
[0151] Based on the same inventive concept, this application also provides a data classification apparatus for implementing the data classification method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, specific limitations in the following embodiment of the data classification apparatus can be found in the limitations of the data classification method described above, and will not be repeated here.
[0152] In one embodiment, such as Figure 9As shown, a data classification device 1 is provided, the device comprising:
[0153] The acquisition module 10 is used to acquire the text word vectors of the data to be classified.
[0154] The first determining module 20 is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified through the first feature extraction network of the classification model, and determine the text semantic vectors of the data to be classified based on the multi-dimensional semantic analysis results.
[0155] The extraction module 30 is used to extract local features of the data to be classified based on the text semantic vector through the second feature extraction network of the classification model.
[0156] The second determining module 40 is used to determine the target classification label of the data to be classified based on the local features of the data to be classified through the classification network of the classification model.
[0157] In one embodiment, the upper Figure 9 The first feature extraction network in the first determining module 20 includes a first semantic extraction network, a second semantic extraction network, and a semantic fusion network. Based on this, such as Figure 10 As shown, the first determining module 20 further includes:
[0158] The first parsing unit 201 is used to parse the first dimension semantic features of the data to be classified based on the text word vectors of the data to be classified through the first semantic extraction network of the classification model.
[0159] The second parsing unit 202 is used to parse the second-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified through the second semantic extraction network of the classification model.
[0160] The first determining unit 203 is used to determine the text semantic vector of the data to be classified based on the first dimension semantic features, the second dimension semantic features, and the text word vector of the data to be classified through the semantic fusion network of the classification model.
[0161] In one embodiment, the upper Figure 10 The first semantic extraction network in the first parsing unit 201 is a multi-head attention network. The second parsing unit 202 is a Hopfield network.
[0162] In one embodiment, the upper Figure 9 The classification network of the classification model in the second determination module 40 includes a first classifier, a second classifier, and a label output network. Based on this, such as Figure 11 As shown, the second determining module 40 further includes:
[0163] The second determining unit 401 is used to determine the first probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified by the first classifier of the classification model.
[0164] The third determining unit 402 is used to determine the second probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified by the second classifier of the classification model.
[0165] Output unit 403 is used to output the target classification label of the data to be classified through the label output network of the classification model, based on the first probability and the second probability that the data to be classified belongs to each candidate classification label.
[0166] In one embodiment, the upper Figure 11 The output unit 403 is specifically used to: determine the target classification label of the data to be classified from each candidate classification label through the label output network of the classification model, based on the first probability and the second probability that the data to be classified belongs to each candidate classification label, as well as the weight values of the first classifier and the second classifier, and output the target classification label of the data to be classified.
[0167] In one embodiment, on the Figure 9 On the basis of, such as Figure 12 As shown, above Figure 9 The acquisition module 10 further includes:
[0168] The word segmentation unit 101 is used to perform word segmentation processing on the data to be classified, so as to obtain at least one segmented word.
[0169] The fourth determining unit 102 is used to determine the word vector of each word segment based on each word segment and the position information of each word segment in the data to be classified.
[0170] The fifth determining unit 103 is used to determine the text word vector of the data to be classified based on the word vector of each segmented word.
[0171] In one embodiment, on the Figure 9 On the basis of, such as Figure 13 As shown, above Figure 9 The data classification device also includes:
[0172] Sample module 50 is used to obtain text word vectors of sample classification data.
[0173] The first sample label module 60 is used to perform clustering processing on the text word vectors of the sample classification data to obtain the first sample classification label of the sample classification data.
[0174] The second sample label module 70 is used to input the text word vectors of the sample classification data into the classification model to obtain the second sample classification label of the sample classification data.
[0175] Training module 80 is used to train the classification model based on the classification labels of the first sample and the classification labels of the second sample.
[0176] Each module in the aforementioned data classification device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0177] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 14 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data to be classified. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a data classification method.
[0178] Those skilled in the art will understand that Figure 14 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0179] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0180] Obtain the text word vectors of the data to be classified;
[0181] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and the text semantic vectors of the data to be classified are determined based on the results of multi-dimensional semantic analysis.
[0182] The second feature extraction network of the classification model extracts local features of the data to be classified based on the text semantic vector.
[0183] The target classification label of the data to be classified is determined by the classification network of the classification model based on the local features of the data to be classified.
[0184] In one embodiment, when the processor executes the computer program, it further implements the following steps: the first feature extraction network includes a first semantic extraction network, a second semantic extraction network, and a semantic fusion network;
[0185] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified. Based on the results of the multi-dimensional semantic analysis, the text semantic vectors of the data to be classified are determined, including:
[0186] The first semantic extraction network of the classification model is used to analyze the first-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0187] The second semantic extraction network of the classification model is used to analyze the second-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0188] The semantic fusion network of the classification model determines the text semantic vector of the data to be classified based on the first-dimensional semantic features, the second-dimensional semantic features, and the text word vectors of the data to be classified.
[0189] In one embodiment, when the processor executes the computer program, it further implements the following steps: the first semantic extraction network is a multi-head attention network; the second semantic extraction network is a Hopefield network.
[0190] In one embodiment, when the processor executes the computer program, it further implements the following steps: the classification network includes a first classifier, a second classifier, and a label output network;
[0191] The classification network of the classification model determines the target classification label of the data to be classified based on the local features of the data, including:
[0192] The first classifier of the classification model determines the first probability that the data to be classified belongs to each candidate category label based on the local features of the data to be classified.
[0193] The second classifier of the classification model determines the second probability of the data to be classified belonging to each candidate classification label based on the local features of the data to be classified.
[0194] The label output network of the classification model outputs the target classification label of the data to be classified based on the first and second probabilities of the data belonging to each candidate classification label.
[0195] In one embodiment, when the processor executes the computer program, it further performs the following steps: outputting the target classification label of the data to be classified based on a first probability and a second probability that the data to be classified belongs to each candidate classification label through the label output network of the classification model, including:
[0196] The label output network of the classification model determines the target classification label of the data to be classified from the candidate classification labels based on the first and second probabilities of the data to be classified belonging to each candidate classification label, as well as the weight values of the first and second classifiers, and outputs the target classification label of the data to be classified.
[0197] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining text word vectors of the data to be classified, including:
[0198] Perform word segmentation on the data to be classified to obtain at least one segmented word;
[0199] Based on each word segmentation word and its position in the data to be classified, the word vector of each word segmentation word is determined.
[0200] Based on the word vectors of each segmented vocabulary, determine the text word vectors of the data to be classified.
[0201] In one embodiment, the processor, when executing the computer program, also performs the following steps: the training process of the classification model includes:
[0202] Obtain the text word vectors of the sample classification data;
[0203] Clustering is performed on the text word vectors of the sample classification data to obtain the first sample classification label of the sample classification data;
[0204] The text word vectors of the sample classification data are input into the classification model to obtain the second sample classification label of the sample classification data;
[0205] The classification model is trained based on the classification labels of the first and second samples.
[0206] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0207] Obtain the text word vectors of the data to be classified;
[0208] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and the text semantic vectors of the data to be classified are determined based on the results of multi-dimensional semantic analysis.
[0209] The second feature extraction network of the classification model extracts local features of the data to be classified based on the text semantic vector.
[0210] The target classification label of the data to be classified is determined by the classification network of the classification model based on the local features of the data to be classified.
[0211] In one embodiment, when the computer program is executed by a processor, it further implements the following steps: the first feature extraction network includes a first semantic extraction network, a second semantic extraction network, and a semantic fusion network;
[0212] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified. Based on the results of the multi-dimensional semantic analysis, the text semantic vectors of the data to be classified are determined, including:
[0213] The first semantic extraction network of the classification model is used to analyze the first-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0214] The second semantic extraction network of the classification model is used to analyze the second-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0215] The semantic fusion network of the classification model determines the text semantic vector of the data to be classified based on the first-dimensional semantic features, the second-dimensional semantic features, and the text word vectors of the data to be classified.
[0216] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: the first semantic extraction network is a multi-head attention network; the second semantic extraction network is a Hopefield network.
[0217] In one embodiment, the classification network includes a first classifier, a second classifier, and a label output network;
[0218] The classification network of the classification model determines the target classification label of the data to be classified based on the local features of the data, including:
[0219] The first classifier of the classification model determines the first probability that the data to be classified belongs to each candidate category label based on the local features of the data to be classified.
[0220] The second classifier of the classification model determines the second probability of the data to be classified belonging to each candidate classification label based on the local features of the data to be classified.
[0221] The label output network of the classification model outputs the target classification label of the data to be classified based on the first and second probabilities of the data belonging to each candidate classification label.
[0222] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: outputting the target classification label of the data to be classified based on a first probability and a second probability that the data to be classified belongs to each candidate classification label through the label output network of the classification model, including:
[0223] The label output network of the classification model determines the target classification label of the data to be classified from the candidate classification labels based on the first and second probabilities of the data to be classified belonging to each candidate classification label, as well as the weight values of the first and second classifiers, and outputs the target classification label of the data to be classified.
[0224] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: obtaining text word vectors of the data to be classified, including:
[0225] Perform word segmentation on the data to be classified to obtain at least one segmented word;
[0226] Based on each word segmentation word and its position in the data to be classified, the word vector of each word segmentation word is determined.
[0227] Based on the word vectors of each segmented vocabulary, determine the text word vectors of the data to be classified.
[0228] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: The training process of the classification model includes:
[0229] Obtain the text word vectors of the sample classification data;
[0230] Clustering is performed on the text word vectors of the sample classification data to obtain the first sample classification label of the sample classification data;
[0231] The text word vectors of the sample classification data are input into the classification model to obtain the second sample classification label of the sample classification data;
[0232] The classification model is trained based on the classification labels of the first and second samples.
[0233] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0234] Obtain the text word vectors of the data to be classified;
[0235] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified, and the text semantic vectors of the data to be classified are determined based on the results of multi-dimensional semantic analysis.
[0236] The second feature extraction network of the classification model extracts local features of the data to be classified based on the text semantic vector.
[0237] The target classification label of the data to be classified is determined by the classification network of the classification model based on the local features of the data to be classified.
[0238] In one embodiment, when the computer program is executed by a processor, it further implements the following steps: the first feature extraction network includes a first semantic extraction network, a second semantic extraction network, and a semantic fusion network;
[0239] The first feature extraction network of the classification model is used to perform multi-dimensional semantic analysis on the text word vectors of the data to be classified. Based on the results of the multi-dimensional semantic analysis, the text semantic vectors of the data to be classified are determined, including:
[0240] The first semantic extraction network of the classification model is used to analyze the first-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0241] The second semantic extraction network of the classification model is used to analyze the second-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified.
[0242] The semantic fusion network of the classification model determines the text semantic vector of the data to be classified based on the first-dimensional semantic features, the second-dimensional semantic features, and the text word vectors of the data to be classified.
[0243] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: the first semantic extraction network is a multi-head attention network; the second semantic extraction network is a Hopefield network.
[0244] In one embodiment, when the computer program is executed by a processor, it further implements the following steps: the classification network includes a first classifier, a second classifier, and a label output network;
[0245] The classification network of the classification model determines the target classification label of the data to be classified based on the local features of the data, including:
[0246] The first classifier of the classification model determines the first probability that the data to be classified belongs to each candidate category label based on the local features of the data to be classified.
[0247] The second classifier of the classification model determines the second probability of the data to be classified belonging to each candidate classification label based on the local features of the data to be classified.
[0248] The label output network of the classification model outputs the target classification label of the data to be classified based on the first and second probabilities of the data belonging to each candidate classification label.
[0249] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: outputting the target classification label of the data to be classified based on a first probability and a second probability that the data to be classified belongs to each candidate classification label through the label output network of the classification model, including:
[0250] The label output network of the classification model determines the target classification label of the data to be classified from the candidate classification labels based on the first and second probabilities of the data to be classified belonging to each candidate classification label, as well as the weight values of the first and second classifiers, and outputs the target classification label of the data to be classified.
[0251] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: obtaining text word vectors of the data to be classified, including:
[0252] Perform word segmentation on the data to be classified to obtain at least one segmented word;
[0253] Based on each word segmentation word and its position in the data to be classified, the word vector of each word segmentation word is determined.
[0254] Based on the word vectors of each segmented vocabulary, determine the text word vectors of the data to be classified.
[0255] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: The training process of the classification model includes:
[0256] Obtain the text word vectors of the sample classification data;
[0257] Clustering is performed on the text word vectors of the sample classification data to obtain the first sample classification label of the sample classification data;
[0258] The text word vectors of the sample classification data are input into the classification model to obtain the second sample classification label of the sample classification data;
[0259] The classification model is trained based on the classification labels of the first and second samples.
[0260] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media 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), magnetic 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. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0261] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.
[0262] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data classification method, characterized in that, The method includes: Obtain the text word vectors of the data to be classified; The first semantic extraction network of the first feature extraction network of the classification model is used to parse the first dimension semantic features of the data to be classified based on the text word vectors of the data to be classified. The second semantic extraction network of the first feature extraction network is used to parse the second dimension semantic features of the data to be classified based on the text word vectors of the data to be classified. The semantic fusion network of the first feature extraction network determines the text semantic vector of the data to be classified based on the first dimension semantic features, the second dimension semantic features, and the text word vectors of the data to be classified. The second feature extraction network of the classification model extracts local features of the data to be classified based on the text semantic vector. The first classifier of the classification network of the classification model determines the first probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified. The second classifier of the classification network determines the second probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified. The label output network of the classification network outputs the target classification label of the data to be classified based on the first probability and the second probability that the data to be classified belongs to each candidate classification label.
2. The method according to claim 1, characterized in that, The first semantic extraction network is a multi-head attention network; the second semantic extraction network is a Hopefield network.
3. The method according to claim 1, characterized in that, The label output network of the classification model outputs the target classification label of the data to be classified based on the first probability and the second probability that the data to be classified belongs to each candidate classification label, including: The target classification label of the data to be classified is determined from the candidate classification labels by the label output network of the classification model, based on the first probability and the second probability that the data to be classified belongs to each candidate classification label, as well as the weight values of the first classifier and the second classifier, and the target classification label of the data to be classified is output.
4. The method according to claim 1, characterized in that, The process of obtaining the text word vectors of the data to be classified includes: Perform word segmentation on the data to be classified to obtain at least one segmented word; Based on each word segmentation word and its position information in the data to be classified, the word vector of each word segmentation word is determined. Based on the word vectors of each segmented vocabulary, the text word vectors of the data to be classified are determined.
5. The method according to any one of claims 1-4, characterized in that, The training process of the classification model includes: Obtain the text word vectors of the sample classification data; Clustering is performed on the text word vectors of the sample classification data to obtain the first sample classification label of the sample classification data; The text word vectors of the sample classification data are input into the classification model to obtain the second sample classification label of the sample classification data; The classification model is trained based on the first sample classification label and the second sample classification label.
6. A data classification device, characterized in that, include: The acquisition module is used to acquire the text word vectors of the data to be classified; The first determining module is used to parse the first-dimensional semantic features of the data to be classified based on the text word vectors of the data to be classified through the first semantic extraction network of the first feature extraction network of the classification model. The second semantic extraction network of the first feature extraction network is used to parse the second dimension semantic features of the data to be classified based on the text word vectors of the data to be classified. The semantic fusion network of the first feature extraction network determines the text semantic vector of the data to be classified based on the first dimension semantic features, the second dimension semantic features, and the text word vectors of the data to be classified. The extraction module is used to extract local features of the data to be classified based on the text semantic vector through the second feature extraction network of the classification model. The second determining module is used to determine the first probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified through the first classifier of the classification network of the classification model. The second classifier of the classification network determines the second probability that the data to be classified belongs to each candidate classification label based on the local features of the data to be classified. The label output network of the classification network outputs the target classification label of the data to be classified based on the first probability and the second probability that the data to be classified belongs to each candidate classification label.
7. 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, it implements the steps of the data classification method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the data classification method according to any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the data classification method according to any one of claims 1 to 5.