Text classification method, apparatus, device, medium, and product

By encoding, segmenting, and weighting short texts, and combining multiple text classification networks, the problem of inaccurate short text classification is solved, achieving higher-precision text classification.

CN116610798BActive Publication Date: 2026-04-28CHINA MOBILE GROUP ANHUI +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA MOBILE GROUP ANHUI
Filing Date
2022-02-09
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In existing technologies, the classification results for short texts such as complaint SMS messages are not accurate enough.

Method used

By encoding the words in the text to be classified, counting the number of parts of speech, inserting preset insertion items for segmentation, and weighting the results according to the weight value of the number of parts of speech, the results are input into different text classification networks to determine the quasi-classification result with the highest probability value.

Benefits of technology

It improves the accuracy of short text classification and enhances the precision of text classification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116610798B_ABST
    Figure CN116610798B_ABST
Patent Text Reader

Abstract

The application discloses a text classification method, device, equipment, medium and product. The method comprises the following steps: obtaining a text to be classified; encoding each word in at least one word to obtain a first encoding sequence of the text to be classified; counting the number of words with different parts of speech in the text to be classified to obtain a first part-of-speech number value sequence of the text to be classified; segmenting the first encoding sequence by inserting a preset at least one insertion item into the first encoding sequence to obtain a second encoding sequence; weighting the first part-of-speech number value sequence to obtain a second part-of-speech number value sequence; inputting the first encoding sequence, the second encoding sequence and the second part-of-speech number value sequence into different text classification networks respectively to obtain a corresponding quasi-classification result of the text to be classified and a probability value of each quasi-classification result; and determining that the quasi-classification result with the highest probability value is the classification result corresponding to the text to be classified, so that the result of text classification is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data processing technology, and in particular relates to a text classification method, apparatus, device, medium and product. Background Technology

[0002] With the development of electronic information technology, more and more fields need to classify text. For example, in back-end operation and maintenance work, it is necessary to classify and process user complaint text messages.

[0003] Currently, text content recognition and classification are mainly achieved by training text classification models. However, existing text classification methods are more suitable for classifying long texts, and the classification results are not accurate enough when classifying shorter texts such as complaint messages. Summary of the Invention

[0004] This application provides a text classification method, apparatus, device, medium, and product, which can at least solve the problem in the prior art that the classification results are not accurate enough when classifying short texts such as complaint text messages.

[0005] In a first aspect, embodiments of this application provide a text classification method, the method comprising:

[0006] Obtain the text to be classified, which includes at least one word;

[0007] Encode each word in at least one word to obtain the first encoded sequence of the text to be classified;

[0008] Count the number of words with different parts of speech in the text to be classified to obtain the first part-of-speech count sequence of the text to be classified.

[0009] The first encoded sequence is segmented by inserting at least one preset insertion item into the first encoded sequence to obtain the second encoded sequence;

[0010] The first part-of-speech count sequence is weighted according to the weight value of each part-of-speech count to obtain the second part-of-speech count sequence. The weight values ​​are generated based on the frequency of the word corresponding to each part-of-speech count in the preset language library and the preset weight value corresponding to each part-of-speech count.

[0011] The first coding sequence, the second coding sequence, and the second part-of-speech tag count sequence are respectively input into different text classification networks to obtain the quasi-classification results of the text to be classified and the probability values ​​of each quasi-classification result.

[0012] The quasi-classification result with the highest probability value is determined as the classification result corresponding to the text to be classified.

[0013] Secondly, embodiments of this application provide a text classification device, the device comprising:

[0014] The first acquisition module is used to acquire the text to be classified, which includes at least one word.

[0015] The first encoding module is used to encode each word in at least one word to obtain the first encoding sequence of the text to be classified;

[0016] The first statistical module is used to count the number of words with different parts of speech in the text to be classified, and to obtain the first part of speech count value sequence of the text to be classified.

[0017] The first insertion module is used to segment the first encoding sequence by inserting at least one preset insertion item into the first encoding sequence to obtain a second encoding sequence;

[0018] The first weighting module is used to weight the first part-of-speech quantity value sequence according to the weight value of each part-of-speech quantity value to obtain the second part-of-speech quantity value sequence. The weight value is generated according to the frequency of the word corresponding to each part-of-speech quantity value in the preset language library and the preset weight value corresponding to each part-of-speech quantity value.

[0019] The first input module is used to input the first encoding sequence, the second encoding sequence, and the second part-of-speech tag count sequence into different text classification networks respectively, and obtain the corresponding quasi-classification results of the text to be classified.

[0020] The fusion module is used to merge the results of each quasi-classification to obtain the classification result corresponding to the text to be classified.

[0021] Thirdly, embodiments of this application provide an electronic device, the device comprising: a processor and a memory storing computer program instructions;

[0022] When the processor executes the computer program instructions, it implements the text classification method as shown in any embodiment of the first aspect.

[0023] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the text classification method shown in any embodiment of the first aspect.

[0024] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the text classification method shown in any embodiment of the first aspect.

[0025] The text classification method, apparatus, device, medium, and product of this application can acquire text to be classified, encode each word in at least one word in the text to obtain a first encoding sequence of the text to be classified, count the number of words with different parts of speech in the text to obtain a first part-of-speech count sequence of the text to be classified, then segment the first encoding sequence by inserting at least one preset insertion item into the first encoding sequence to obtain a second encoding sequence, and weight the first part-of-speech count sequence according to the weight value of each part-of-speech count to obtain a second part-of-speech count sequence. Then, the first encoding sequence, the second encoding sequence, and the second part-of-speech count sequence are respectively input into different text classification networks to obtain the corresponding quasi-classification results and probability values ​​of each quasi-classification result for the text to be classified, and the quasi-classification result with the highest probability value is determined as the classification result corresponding to the text to be classified. Thus, by adding the second part-of-speech count sequence as model input, the text classification results can be made more accurate. Attached Figure Description

[0026] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 This is a flowchart of a text classification method provided in one embodiment of this application;

[0028] Figure 2 This is a schematic diagram of the structure of a first preset network provided in one embodiment of this application;

[0029] Figure 3 This is a flowchart of another text classification method provided in one embodiment of this application;

[0030] Figure 4 This is a schematic diagram of the structure of a text classification device provided in one embodiment of this application;

[0031] Figure 5 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application. Detailed Implementation

[0032] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0033] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0034] Figure 1 The diagram shows a flowchart of a text classification method provided in one embodiment of this application. It should be noted that the specific method may be the training method of the text classification network used in the text classification method provided in one embodiment of this application.

[0035] like Figure 1 As shown, the training method of the text classification network used in the text classification method provided in this application embodiment may include S110-S170:

[0036] S110, obtain multiple historical classification samples;

[0037] S120, Encode each word in at least one word included in each historical classification sample to obtain the third encoding sequence for each historical classification sample;

[0038] S130, count the number of words with different parts of speech in each historical classification sample to obtain the sequence of third part of speech count values ​​for each historical classification sample;

[0039] S140, by inserting at least one preset insertion item into each third coding sequence, each third coding sequence is segmented to obtain multiple fourth coding sequences;

[0040] S150, based on the historical weight value of each historical part-of-speech quantity value, weight each third part-of-speech quantity value sequence to obtain multiple fourth part-of-speech quantity value sequences;

[0041] S160, construct a first training sample based on each third coding sequence and the first historical classification result corresponding to each third coding sequence, construct a second training sample based on each fourth coding sequence and the second historical classification result corresponding to each fourth coding sequence, and construct a third training sample based on each third part-of-speech count sequence and the third historical classification result corresponding to each third part-of-speech count sequence.

[0042] S170, different networks are trained based on the first training sample, the second training sample, and the third training sample, respectively, resulting in different text classification networks.

[0043] Therefore, by acquiring multiple historical classification samples, each word in at least one word included in each historical classification sample is encoded to obtain a third encoding sequence for each historical classification sample; then, the number of words with different parts of speech in each historical classification sample is counted to obtain a third part of speech quantity value sequence for each historical classification sample; and by inserting at least one preset insertion item into each third encoding sequence, each third encoding sequence is segmented to obtain multiple fourth encoding sequences; then, based on the historical weight value of each historical part of speech quantity value, each third part of speech quantity value sequence is weighted to obtain multiple fourth part of speech quantity value sequences, and then each third encoding sequence and... For each third coding sequence, a first training sample is constructed based on the first historical classification result. A second training sample is constructed based on each fourth coding sequence and the second historical classification result corresponding to each fourth coding sequence. A third training sample is constructed based on each third part-of-speech tag value sequence and the third historical classification result corresponding to each third part-of-speech tag value sequence. Different networks are then trained based on the first, second, and third training samples to obtain different text classification networks. By training different networks, different text classification networks can be obtained, allowing for the processing of the text and the acquisition of more accurate classification results.

[0044] Regarding S110, each historical classification sample can be a text, such as a complaint text message. Multiple historical classification samples can be retrieved from the historical database, and the historical classification results corresponding to each historical classification sample can also be obtained from the historical database.

[0045] Regarding S120, since the historical classification samples can be complaint text messages, which are generally short, the neural network has relatively little information to refer to. If the neural network is trained directly based on the above-mentioned historical classification samples and their corresponding historical classification results, the training accuracy will be difficult to achieve the expected accuracy. Therefore, it is necessary to preprocess the above-mentioned historical classification samples first.

[0046] Here, each historical classification sample may include at least one word. Each historical classification sample can be converted into a third encoding sequence by encoding each word among the at least one word included in each historical classification sample. In addition, the historical classification result corresponding to each historical classification sample can also be encoded.

[0047] In step S130, the number of words with different parts of speech in each historical classification sample is counted, resulting in a sequence of third part-of-speech counts for each historical classification sample. Each sequence of third part-of-speech counts can include at least one historical part-of-speech count, and each historical part-of-speech count can be the number of words with one part of speech. Here, the order of different parts of speech can be preset, and the number of words with different parts of speech, i.e., the number of each historical part-of-speech count, is arranged based on the preset order to obtain the sequence of third part-of-speech counts.

[0048] In some examples, the historical classification sample is the complaint text message "the customer service attitude is poor". This complaint text message includes two adjectives "customer service" and "poor" and also includes a noun "attitude". If the noun comes first and the adjective comes last in the preset order, then the third part of speech value sequence of this historical classification sample is "12".

[0049] Regarding S140, in the prior art, most neural networks are trained directly using training samples without considering whether the training samples themselves need correction. This results in low recognition accuracy for the neural network. This embodiment of the application addresses this issue by dynamically adjusting the training samples when testing the trained text classification network, thereby improving the classification accuracy of the text classification network.

[0050] To dynamically adjust the training samples when testing the trained text classification network, the third encoding sequence can be pre-processed. Specifically, an insertion set can be pre-defined, for example, C = {C1, C2, ..., C...}. g}, where C1, C2, ..., C gEach insertion item can be a separate item. Multiple insertion items from this set are randomly inserted into each third-coded sequence, thus splitting each third-coded sequence to obtain a fourth-coded sequence. Here, one insertion item set corresponds to one third-coded sequence. That is, inserting at least one insertion item from an insertion item set into a third-coded sequence yields a fourth-coded sequence. Specifically, all insertion items from an insertion item set can be inserted into a third-coded sequence, or only some insertion items from an insertion item set can be inserted into a third-coded sequence; this is not limited here.

[0051] Regarding S150, in order to dynamically adjust the training samples when testing the trained text classification network, the third part-of-speech (POS) value sequence can be pre-processed. Specifically, this can be achieved by weighting each historical POS value included in the third POS value sequence, thereby obtaining multiple fourth POS value sequences.

[0052] Before weighting each historical part-of-speech count, it is necessary to determine the historical weight value corresponding to each historical part-of-speech count. This historical weight value can be generated based on the frequency of the word corresponding to each historical part-of-speech count in the preset language database and the preset weight value corresponding to each historical part-of-speech count. Specifically, the historical weight value can be calculated using the following formula:

[0053] x i =t i / w i

[0054]

[0055] Where, x i w can be the historical weight value of the i-th historical part-of-speech count. i t can be the frequency of the word corresponding to the i-th historical part-of-speech value in the preset language database. i I can be the preset weight value of the i-th historical part-of-speech count, and I can be the number of historical part-of-speech counts included in a single third part-of-speech count sequence.

[0056] Regarding S160, in order to train different networks and obtain different text classification networks, different training samples can be constructed. Here, three types of training samples can be constructed, namely, multiple first training samples, multiple second training samples, and multiple third training samples. Specifically, the first training sample may include a third encoding sequence and the corresponding first historical classification result; the second training sample may include a fourth encoding sequence and the corresponding second historical classification result; and the third training sample may include a third part-of-speech tag (POT) value sequence and the corresponding third historical classification result.

[0057] Regarding S170, based on the three types of training samples mentioned above, three different networks can be trained to obtain three different text classification networks.

[0058] In some implementations, in order to train different networks with different training samples to obtain different text classification networks, thereby making the text classification results more accurate, S170 may specifically include:

[0059] A first preset network is trained based on the first training samples to obtain a first text classification network;

[0060] The second preset network is trained based on the second training samples to obtain the second text classification network;

[0061] The third preset network is trained based on the third training samples to obtain the third text classification network.

[0062] Here, the second preset network can be a Gated Recurrent Unit (GRU) model. Since the GRU model uses an update gate instead of a forget gate and an output gate, it reduces one threshold compared to the Long Short-Term Memory network. Therefore, using the GRU model for recognition and classification results in fewer training parameters and higher training efficiency.

[0063] Furthermore, the third preset network can be a Back Propagation (BP) neural network. A BP neural network is a multi-layer feedforward network trained by backpropagation of errors. Its basic idea is gradient descent, which uses gradient search to minimize the mean squared error between the network's actual output value and its expected output value. The most significant characteristic of this BP neural network is that the number of neurons in the intermediate layers and each layer can be arbitrarily set. With a smaller number of neurons, the number of training iterations is relatively small, resulting in a faster convergence speed compared to other neural networks. Regarding the aforementioned third training sample, since the third part-of-speech (POS) value sequences included in the third training sample can be obtained by processing complaint SMS text, and complaint SMS text is short text containing relatively few words with different parts of speech, the length of each third POS value sequence will also be relatively short. The BP neural network can adapt well to the characteristics of this third training sample.

[0064] In some implementations, since the data included in the second and third training samples are obtained by processing the original data, in order to avoid the classification results of the second and third text classification networks trained based on the second and third training samples being inaccurate due to excessive deviation between the processed second and third training samples and the original data, respectively, a first preset network is trained based on the first training samples to obtain a first text classification network, which may include:

[0065] For each of the first training samples, perform the following steps:

[0066] The third encoded sequence from the first training sample is input into the first preset network;

[0067] The third encoded sequence is processed through the first sub-network of the first preset network to obtain the first feature vector, and the third encoded sequence is processed through the second sub-network of the first preset network to obtain the second feature vector.

[0068] The first feature vector and the second feature vector are fused through the feature vector fusion layer in the first preset network to obtain the third feature vector;

[0069] The first historical prediction classification result is determined by judging the third feature vector through the extreme value region ER classifier;

[0070] Based on the first historical prediction classification result and the first historical classification result of the first training sample, determine the loss function value of the first preset network;

[0071] If the loss function value does not meet the training stopping condition, the network parameters of the first preset network are adjusted, and the first preset network with adjusted parameters is trained using the first training samples until the training stopping condition is met, thus obtaining the first text classification network.

[0072] Here, the first sub-network can be a Bit Topic Model (BTM), the second sub-network can be a Doc2vec model, and the Extremal Region (ER) classifier can use the Bayesian algorithm, or other algorithms, which are not limited here.

[0073] like Figure 2 As shown, the first preset network may include an input layer 201, a BTM model 202, a Doc2vec model 203, a feature vector fusion layer 204, and an ER classifier 205. The input layer 201 can be used to receive first training samples; the BTM model 202 can be used to process the third encoding sequence included in the first training samples into a first feature vector; the Doc2vec model 203 can be used to process the third encoding sequence included in the first training samples into a second feature vector; the feature vector fusion layer 204 can be used to perform a weighted summation of the first feature vector and the second feature vector according to preset weight values, thereby concatenating the first feature vector and the second feature vector into a third feature vector; and the ER classifier 205 can be used to judge the third feature vector, thereby determining the first historical predicted classification result corresponding to the third encoding sequence. After obtaining the first historical prediction classification result, the loss function value of the first preset network can be determined based on the first historical prediction classification result and the first historical classification result of the same first training sample. If the loss function value does not meet the training stopping condition, the network parameters of the first preset network are adjusted. Then, the first preset network with adjusted parameters is trained using the first training sample until the training stopping condition is met, thus obtaining the first text classification network.

[0074] Thus, since the first training sample is a training sample constructed based on the original data, the first text classification network trained based on the first training sample can make up for the inaccurate classification problems of the second and third text classification networks.

[0075] In some implementations, to make the classification results of the first text classification network, the second text classification network, and the third text classification network more accurate, the method may further include, after S170:

[0076] Get the preset test set;

[0077] For each first text, perform the following steps:

[0078] The first text is input into the first text classification network, the second text classification network and the third text classification network respectively, and the first predicted classification result and its corresponding first probability value, the second predicted classification result and its corresponding second probability value, and the third predicted classification result and its corresponding third probability value are obtained respectively.

[0079] The first probability value, the second probability value, and the third probability value are weighted and summed to obtain the first evaluation value of the classification result corresponding to the first text.

[0080] Based on the mapping relationship between the evaluation value and the classification accuracy, the classification accuracy corresponding to the first evaluation value is determined as the comprehensive classification accuracy of different text classification networks;

[0081] If the difference between the overall classification accuracy and the overall classification accuracy obtained in the previous test is not less than the preset accuracy difference, the fourth coding sequence and the fourth part-of-speech tag value sequence are updated. Based on the updated fourth coding sequence and the updated fourth part-of-speech tag value sequence, the following steps are taken: constructing the first training sample based on each third coding sequence and the first historical classification result corresponding to each third coding sequence; constructing the second training sample based on each fourth coding sequence and the second historical classification result corresponding to each fourth coding sequence; and constructing the third training sample based on each third part-of-speech tag value sequence and the third historical classification result corresponding to each third part-of-speech tag value sequence. This process continues until the accuracy difference is less than the preset accuracy difference, resulting in different text classification networks that have passed the test.

[0082] Here, after training the first text classification network, the second text classification network, and the third text classification network using the three types of training samples mentioned above, since a high-precision text classification network is ultimately required, it is necessary to use the same preset test set to test the recognition accuracy of the three text classification networks. Based on the tested recognition accuracy, the second and third training samples are adjusted to unify the recognition accuracy of each text classification network and ultimately achieve high-precision recognition.

[0083] Specifically, the preset test set may include multiple first texts. For each first text, the first text is input into a first text classification network, a second text classification network, and a third text classification network, respectively. This yields a first predicted classification result and its corresponding first probability value, a second predicted classification result and its corresponding second probability value, and a third predicted classification result and its corresponding third probability value. The first predicted classification result can be the one with the highest probability value among the various predicted classification results output by the first text classification network; the second predicted classification result can be the one with the highest probability value among the various predicted classification results output by the second text classification network; and the third predicted classification result can be the one with the highest probability value among the various predicted classification results output by the third text classification network.

[0084] By weighted summing the first, second, and third probability values, a first evaluation value for the classification result corresponding to the first text can be obtained. This first evaluation value can be used to determine the overall classification accuracy of the first, second, and third text classification networks. Specifically, a mapping relationship between the evaluation value and the classification accuracy can be preset. Therefore, after determining the first evaluation value, the overall classification accuracy can be determined according to this mapping relationship.

[0085] During testing, multiple tests are conducted based on multiple first texts included in the preset test set. If the difference between the comprehensive classification accuracy obtained in this round and the comprehensive classification accuracy obtained in the previous round is not less than the preset accuracy difference, the fourth encoding sequence and the fourth part-of-speech tag value sequence can be updated. Based on the updated fourth encoding sequence and the updated fourth part-of-speech tag value sequence, the process returns to S160 above to reconstruct each training sample, retrain, and test again until the accuracy difference is less than the preset accuracy difference, thus obtaining different text classification networks that have passed the tests.

[0086] Thus, through the above process, the final first, second, and third text classification networks can achieve higher classification accuracy and more precise classification results. Furthermore, since the fourth encoding sequence and the fourth part-of-speech tag count sequence are updated based on the comprehensive classification accuracy, thereby dynamically correcting the second and third training samples, the convergence speed in each iteration is greatly increased.

[0087] In some implementations, to determine the first evaluation value of the classification result corresponding to the first text, the above-mentioned weighted summation of the first probability value, the second probability value, and the third probability value to obtain the first evaluation value of the classification result corresponding to the first text may include:

[0088] The first evaluation value is calculated using the following formula:

[0089] T = k1a + k2b + k3c

[0090]

[0091]

[0092]

[0093] Where T is the first evaluation value, k1 is the first probability value, k2 is the second probability value, k3 is the third probability value, a is the weight value corresponding to the first probability value, b is the weight value corresponding to the second probability value, c is the weight value corresponding to the third probability value, μ1 is the classification accuracy of the first text classification network, μ2 is the classification accuracy of the second text classification network, and μ3 is the classification accuracy of the third text classification network.

[0094] Specifically, μ1 represents the classification accuracy of the first text classification network after the last training session before this round of testing, μ2 represents the classification accuracy of the second text classification network after the last training session before this round of testing, and μ3 represents the classification accuracy of the third text classification network after the last training session before this round of testing.

[0095] Thus, using the above formula, the first evaluation value of the classification result corresponding to the first text can be calculated, so as to determine the comprehensive classification accuracy of the first text classification network, the second text classification network, and the third text classification network.

[0096] In some implementations, in order to dynamically adjust the second and third training samples, the above-mentioned updating of the fourth encoding sequence and the fourth part-of-speech tag count sequence may include:

[0097] Shift each inserted item in the fourth encoding sequence forward or backward by one position to obtain the updated fourth encoding sequence;

[0098] The updated fourth part-of-speech quantity sequence is determined by updating the historical weight value of each historical part-of-speech quantity value in the fourth part-of-speech quantity sequence.

[0099] Here, the fourth coding sequence can be updated by shifting each inserted item one position forward or backward. Since the fourth coding sequence can be a feature vector, each position can be the position of a feature vector. It's important to note that if an inserted item existed at the beginning of the fourth coding sequence before the update, it is deleted after shifting forward. Similarly, if an inserted item existed at the end of the fourth coding sequence before the update, it is deleted after shifting backward. In both cases, after deleting the inserted item, a pre-defined set of inserted items that has not yet been inserted into the fourth coding sequence can be randomly selected and inserted into the fourth coding sequence.

[0100] Alternatively, the fourth part-of-speech quantity sequence can be updated by redetermining the historical weight value of each historical part-of-speech quantity value in the fourth part-of-speech quantity sequence.

[0101] In this way, the second and third training samples can be dynamically adjusted through the above process.

[0102] In some implementations, to re-determine the historical weight value of each historical part-of-speech quantity value in the fourth part-of-speech quantity value sequence, thereby updating the fourth part-of-speech quantity value sequence, the above-mentioned determination of the updated fourth part-of-speech quantity value sequence by updating the historical weight value of each historical part-of-speech quantity value in the fourth part-of-speech quantity value sequence may include:

[0103] The historical weight value of each historical part-of-speech count in the fourth part-of-speech count sequence is updated using the following formula:

[0104] x i ′=μ3*x i *Δ + +μ3*(1-x i )*Δ -

[0105] Where, x i ' represents the updated historical weight value of the i-th historical part-of-speech count in the fourth part-of-speech count sequence, x i Let μ3 be the historical weight value before the update of the i-th historical part-of-speech count value in the fourth part-of-speech count value sequence, and Δ be the classification accuracy of the third text classification network. + Δ - All are randomly varying values ​​of 0 or 1, and Δ + Δ - The values ​​are not equal.

[0106] Thus, using the above formula, the historical weight value of each historical part-of-speech value in the fourth part-of-speech value sequence can be calculated, and the historical weight value calculated each time is different, so dynamic adjustment of the third training sample can be achieved.

[0107] The following is combined with Figure 3 The text classification method provided in the embodiments of this application will be described in detail.

[0108] Figure 3 This document illustrates a flowchart of a text processing method provided in an embodiment of this application. Figure 3 As shown, the text classification method provided in this application embodiment may include S310-S370:

[0109] S310, Obtain the text to be classified;

[0110] S320, Encode each word in at least one word to obtain the first encoded sequence of the text to be classified;

[0111] S330, count the number of words with different parts of speech in the text to be classified, and obtain the first part of speech count value sequence of the text to be classified;

[0112] S340, the first encoding sequence is segmented by inserting at least one preset insertion item into the first encoding sequence to obtain the second encoding sequence;

[0113] S350, the first part-of-speech quantity sequence is weighted according to the weight value of each part-of-speech quantity value to obtain the second part-of-speech quantity value sequence;

[0114] S360, the first coding sequence, the second coding sequence, and the second part-of-speech tag count sequence are respectively input into different text classification networks to obtain the quasi-classification results corresponding to the text to be classified and the probability values ​​of each quasi-classification result;

[0115] S370, determine the quasi-classification result with the highest probability value as the classification result corresponding to the text to be classified.

[0116] Therefore, the text to be classified can be obtained, and each word in at least one word in the text can be encoded to obtain the first encoding sequence of the text to be classified. The number of words with different parts of speech in the text is then counted to obtain the first part-of-speech (POS) count sequence. Next, by inserting at least one preset insertion point into the first encoding sequence, the first encoding sequence is segmented to obtain the second encoding sequence. The first POS count sequence is then weighted according to the weight value of each POS count to obtain the second POS count sequence. The first encoding sequence, the second encoding sequence, and the second POS count sequence are then input into different text classification networks to obtain the corresponding quasi-classification results and probability values ​​of each quasi-classification result. The quasi-classification result with the highest probability value is determined as the classification result for the text to be classified. Thus, adding the second POS count sequence as model input can make the text classification results more accurate.

[0117] Regarding S310, the text to be classified may include at least one word. The meaning of the text to be classified is the same as that of the historical classification samples, except that the historical classification samples are historical classification texts, while the text to be classified is the text to be classified now, which will not be elaborated further here.

[0118] Regarding S320, the meaning of at least one word included in the text to be classified is the same as the meaning of at least one word included in the historical classification samples, and the meaning of the first coding sequence of the text to be classified is the same as the meaning of the third coding sequence of the historical classification samples, which will not be elaborated here.

[0119] The process of encoding each word in at least one word to obtain the first encoding sequence of the text to be classified is the same as the process of encoding each word in at least one word included in each historical classification sample to obtain the third encoding sequence of each historical classification sample, and will not be described again here.

[0120] Regarding S330, the meaning of the first part-of-speech tag value sequence of the text to be classified is the same as the meaning of the third part-of-speech tag value sequence of the historical classification samples, and will not be repeated here.

[0121] The process of counting the number of words with different parts of speech in the text to be classified to obtain the first part-of-speech count sequence is the same as the process of counting the number of words with different parts of speech in each historical classification sample to obtain the third part-of-speech count sequence for each historical classification sample, and will not be repeated here.

[0122] Regarding S340, the process of segmenting the first coding sequence by inserting at least one preset insertion item into the first coding sequence to obtain the second coding sequence is the same as the process of segmenting each third coding sequence by inserting at least one preset insertion item into each third coding sequence to obtain multiple fourth coding sequences, and will not be described again here.

[0123] Regarding S350, the weight values ​​can be generated based on the frequency of the word corresponding to each part-of-speech count in a preset language database and the preset weight value corresponding to each part-of-speech count. The process of weighting the first part-of-speech count sequence according to the weight value of each part-of-speech count to obtain the second part-of-speech count sequence is the same as the process of weighting each third part-of-speech count sequence according to the historical weight value of each historical part-of-speech count to obtain multiple fourth part-of-speech count sequences, and will not be described again here.

[0124] Regarding S360, different text classification networks can be the final first text classification network, second text classification network, and third text classification network obtained through multiple training and testing. Inputting the first encoding sequence into the first text classification network yields the first quasi-classification result and its corresponding probability value for the text to be classified; inputting the second encoding sequence into the second text classification network yields the second quasi-classification result and its corresponding probability value for the text to be classified; inputting the second part-of-speech tag count sequence into the third text classification network yields the third quasi-classification result and its corresponding probability value for the text to be classified.

[0125] In S370, the probability values ​​of the first, second, and third quasi-classification results are compared, and the quasi-classification result with the highest probability value is determined as the classification result corresponding to the text to be classified.

[0126] Based on the same inventive concept, embodiments of this application also provide a text classification device. The following, in conjunction with… Figure 4 The text classification device provided in the embodiments of this application will be described in detail.

[0127] Figure 4A schematic diagram of the structure of a text classification device provided in one embodiment of this application is shown.

[0128] like Figure 4 As shown, the text classification device may include:

[0129] The first acquisition module 401 is used to acquire the text to be classified, which includes at least one word.

[0130] The first encoding module 402 is used to encode each word in at least one word to obtain the first encoding sequence of the text to be classified;

[0131] The first statistical module 403 is used to count the number of words with different parts of speech in the text to be classified, and to obtain the first part of speech count value sequence of the text to be classified.

[0132] The first insertion module 404 is used to segment the first encoding sequence by inserting at least one preset insertion item into the first encoding sequence to obtain a second encoding sequence;

[0133] The first weighting module 405 is used to weight the first part-of-speech quantity value sequence according to the weight value of each part-of-speech quantity value to obtain the second part-of-speech quantity value sequence. The weight value is generated according to the frequency of the word corresponding to each part-of-speech quantity value in the preset language library and the preset weight value corresponding to each part-of-speech quantity value.

[0134] The first input module 406 is used to input the first encoding sequence, the second encoding sequence, and the second part-of-speech tag count sequence into different text classification networks respectively, so as to obtain the quasi-classification results corresponding to the text to be classified and the probability values ​​of each quasi-classification result;

[0135] The fusion module 407 is used to determine the quasi-classification result with the highest probability value as the classification result corresponding to the text to be classified.

[0136] Therefore, the text to be classified can be obtained, and each word in at least one word in the text can be encoded to obtain the first encoding sequence of the text to be classified. The number of words with different parts of speech in the text is then counted to obtain the first part-of-speech (POS) count sequence. Next, by inserting at least one preset insertion point into the first encoding sequence, the first encoding sequence is segmented to obtain the second encoding sequence. The first POS count sequence is then weighted according to the weight value of each POS count to obtain the second POS count sequence. The first encoding sequence, the second encoding sequence, and the second POS count sequence are then input into different text classification networks to obtain the corresponding quasi-classification results and probability values ​​of each quasi-classification result. The quasi-classification result with the highest probability value is determined as the classification result for the text to be classified. Thus, adding the second POS count sequence as model input can make the text classification results more accurate.

[0137] In some embodiments, in order to train different networks to obtain different trained text classification networks, the text classification device may further include:

[0138] The second acquisition module is used to acquire multiple historical classification samples before acquiring the text to be classified;

[0139] The second encoding module is used to encode each word in at least one word included in each historical classification sample to obtain the third encoding sequence of each historical classification sample;

[0140] The second statistical module is used to count the number of words with different parts of speech in each historical classification sample, and to obtain the third part of speech count value sequence for each historical classification sample;

[0141] The second insertion module is used to segment each third encoding sequence by inserting at least one preset insertion item into each third encoding sequence to obtain multiple fourth encoding sequences;

[0142] The second weighting module is used to weight each third part-of-speech quantity sequence according to the historical weight value of each historical part-of-speech quantity value to obtain multiple fourth part-of-speech quantity value sequences. The historical weight value is generated according to the frequency of the word corresponding to each historical part-of-speech quantity value in the preset language library and the preset weight value corresponding to each historical part-of-speech quantity value.

[0143] The module is used to construct a first training sample based on each third coding sequence and the first historical classification result corresponding to each third coding sequence, construct a second training sample based on each fourth coding sequence and the second historical classification result corresponding to each fourth coding sequence, and construct a third training sample based on each third part-of-speech count sequence and the third historical classification result corresponding to each third part-of-speech count sequence.

[0144] The training module is used to train different networks based on the first training sample, the second training sample, and the third training sample, respectively, to obtain different text classification networks.

[0145] In some embodiments, to make the classification results of the first text classification network, the second text classification network, and the third text classification network more accurate, the text classification device may further include:

[0146] The third acquisition module is used to acquire a preset test set after training different networks according to the first training sample, the second training sample and the third training sample respectively, and obtaining different text classification networks accordingly. The preset test set includes multiple first texts.

[0147] The second input module is used to perform the following for each first text: inputting the first text into the first text classification network, the second text classification network and the third text classification network respectively, and obtaining the first predicted classification result and its corresponding first probability value, the second predicted classification result and its corresponding second probability value, and the third predicted classification result and its corresponding third probability value.

[0148] The calculation module is used to perform the following for each first text: weighted summation of the first probability value, the second probability value and the third probability value to obtain the first evaluation value of the classification result corresponding to the first text;

[0149] The determination module is used to perform the following for each first text: based on the mapping relationship between the evaluation value and the classification accuracy, determine the classification accuracy corresponding to the first evaluation value as the comprehensive classification accuracy of different text classification networks;

[0150] The update module is used to perform the following for each first text: if the difference between the overall classification accuracy and the overall classification accuracy obtained in the previous test is not less than the preset accuracy difference, update the fourth encoding sequence and the fourth part-of-speech tag value sequence. Based on the updated fourth encoding sequence and the updated fourth part-of-speech tag value sequence, return to execute the following: construct the first training sample according to each third encoding sequence and the first historical classification result corresponding to each third encoding sequence; construct the second training sample according to each fourth encoding sequence and the second historical classification result corresponding to each fourth encoding sequence; and construct the third training sample according to each third part-of-speech tag value sequence and the third historical classification result corresponding to each third part-of-speech tag value sequence, until the accuracy difference is less than the preset accuracy difference, thus obtaining different text classification networks that have been tested.

[0151] In some implementations, to determine a first evaluation value for the classification result corresponding to the first text, the calculation module may include:

[0152] The first calculation submodule is used to calculate the first evaluation value using the following formula:

[0153] T = k1a + k2b + k3c

[0154]

[0155]

[0156]

[0157] Where T is the first evaluation value, k1 is the first probability value, k2 is the second probability value, k3 is the third probability value, a is the weight value corresponding to the first probability value, b is the weight value corresponding to the second probability value, c is the weight value corresponding to the third probability value, μ1 is the classification accuracy of the first text classification network, μ2 is the classification accuracy of the second text classification network, and μ3 is the classification accuracy of the third text classification network.

[0158] In some implementations, the update module may include, in order to dynamically adjust the second and third training samples, the following:

[0159] The first update submodule is used to move each inserted item in the fourth encoding sequence forward or backward by one position to obtain the updated fourth encoding sequence;

[0160] The second update submodule is used to determine the updated fourth part-of-speech quantity value sequence by updating the historical weight value of each historical part-of-speech quantity value in the fourth part-of-speech quantity value sequence.

[0161] In some implementations, in order to redetermine the historical weight value of each historical part-of-speech quantity value in the fourth part-of-speech quantity value sequence, thereby updating the fourth part-of-speech quantity value sequence, the second update submodule may include:

[0162] The update unit is used to update the historical weight value of each historical part-of-speech count in the fourth part-of-speech count sequence using the following formula:

[0163] x i ′=μ3*x i *Δ + +μ3*(1-x i )*Δ -

[0164] Where, x i ' represents the updated historical weight value of the i-th historical part-of-speech count in the fourth part-of-speech count sequence, x i Let μ3 be the historical weight value before the update of the i-th historical part-of-speech count value in the fourth part-of-speech count value sequence, and Δ be the classification accuracy of the third text classification network. + Δ- All are randomly varying values ​​of 0 or 1, and Δ + Δ - The values ​​are not equal.

[0165] In some implementations, since the data included in the second and third training samples are obtained by processing the original data, in order to avoid the classification results of the second and third text classification networks trained based on the processed second and third training samples being inaccurate due to excessive deviation from the original data, the training module may include:

[0166] The input submodule is used to perform the following for each first training sample: inputting the third encoding sequence in the first training sample into the first preset network;

[0167] The processing submodule is used to perform the following operations on each first training sample: process the third encoding sequence through the first sub-network of the first preset network to obtain the first feature vector, and process the third encoding sequence through the second sub-network of the first preset network to obtain the second feature vector;

[0168] The fusion submodule is used to perform the following for each first training sample: fuse the first feature vector and the second feature vector through the feature vector fusion layer in the first preset network to obtain the third feature vector;

[0169] The judgment submodule is used to perform the following for each first training sample: judge the third feature vector through the extreme value region ER classifier to determine the first historical prediction classification result;

[0170] The determination submodule is used to perform the following for each first training sample: determine the loss function value of the first preset network based on the first historical prediction classification result and the first historical classification result of the first training sample;

[0171] The adjustment submodule is used to perform the following for each first training sample: if the loss function value does not meet the training stopping condition, adjust the network parameters of the first preset network, train the first preset network with adjusted parameters using the first training sample, until the training stopping condition is met, and obtain the first text classification network.

[0172] Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of this application is shown.

[0173] like Figure 5As shown, the electronic device 5 is a structural diagram of an exemplary hardware architecture of an electronic device capable of implementing the text classification method and text classification apparatus according to the embodiments of this application. This electronic device may refer to the electronic device in the embodiments of this application.

[0174] The electronic device 5 may include a processor 501 and a memory 502 storing computer program instructions.

[0175] Specifically, the processor 501 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0176] Memory 502 may include mass storage for data or instructions. For example, and not limitingly, memory 502 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 502 may include removable or non-removable (or fixed) media. Where appropriate, memory 502 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 502 is non-volatile solid-state memory. In a particular embodiment, memory 502 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Thus, generally, memory 502 includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this application.

[0177] The processor 501 implements any of the text classification methods described in the above embodiments by reading and executing computer program instructions stored in the memory 502.

[0178] In one example, the electronic device may also include a communication interface 503 and a bus 504. Wherein, as... Figure 5 As shown, the processor 501, memory 502, and communication interface 503 are connected through bus 504 and complete communication with each other.

[0179] The communication interface 503 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0180] Bus 504 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 504 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.

[0181] The electronic device can execute the text classification method in the embodiments of this application, thereby achieving a combination Figures 1 to 4 The text classification method and apparatus described.

[0182] Furthermore, in conjunction with the text classification methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the text classification methods in the above embodiments.

[0183] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0184] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0185] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0186] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0187] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A text classification method, characterized in that, include: Obtain the text to be classified, wherein the text to be classified includes at least one word; Encode each word in the at least one word to obtain the first encoded sequence of the text to be classified; The number of words with different parts of speech in the text to be classified is counted to obtain the first part-of-speech count sequence of the text to be classified. By inserting at least one preset insertion item into the first encoded sequence, the first encoded sequence is segmented to obtain a second encoded sequence; The first part-of-speech count sequence is weighted according to the weight value of each part-of-speech count to obtain the second part-of-speech count sequence. The weight values ​​are generated based on the frequency of the word corresponding to each part-of-speech count in the preset language library and the preset weight value corresponding to each part-of-speech count. The first encoding sequence, the second encoding sequence, and the second part-of-speech tag count sequence are respectively input into different text classification networks to obtain the quasi-classification results corresponding to the text to be classified and the probability values ​​of each quasi-classification result. The quasi-classification result with the highest probability value is determined as the classification result corresponding to the text to be classified. Prior to obtaining the text to be classified, the method further includes: Obtain multiple historical classification samples; Encode each word in at least one word included in each of the historical classification samples to obtain a third encoding sequence for each of the historical classification samples; The number of words with different parts of speech in each historical classification sample is counted to obtain the third part of speech count sequence for each historical classification sample; By inserting at least one preset insertion item into each of the third coding sequences, each third coding sequence is segmented to obtain multiple fourth coding sequences; Based on the historical weight value of each historical part-of-speech quantity value, each third part-of-speech quantity value sequence is weighted to obtain multiple fourth part-of-speech quantity value sequences. The historical weight value is generated based on the frequency of the word corresponding to each historical part-of-speech quantity value in the preset language library and the preset weight value corresponding to each historical part-of-speech quantity value. A first training sample is constructed based on each third coding sequence and the first historical classification result corresponding to each third coding sequence; a second training sample is constructed based on each fourth coding sequence and the second historical classification result corresponding to each fourth coding sequence; and a third training sample is constructed based on each third part-of-speech count sequence and the third historical classification result corresponding to each third part-of-speech count sequence. Different networks are trained based on the first training sample, the second training sample, and the third training sample, resulting in different text classification networks.

2. The method according to claim 1, characterized in that, After training different networks based on the first training sample, the second training sample, and the third training sample to obtain different text classification networks, the method further includes: Obtain a preset test set, which includes multiple first texts; For each of the first texts, perform the following steps: The first text is input into the first text classification network, the second text classification network and the third text classification network respectively, and the first predicted classification result and its corresponding first probability value, the second predicted classification result and its corresponding second probability value, and the third predicted classification result and its corresponding third probability value are obtained respectively. The first probability value, the second probability value, and the third probability value are weighted and summed to obtain the first evaluation value of the classification result corresponding to the first text. Based on the mapping relationship between the evaluation value and the classification accuracy, the classification accuracy corresponding to the first evaluation value is determined as the comprehensive classification accuracy of the different text classification networks; If the difference between the overall classification accuracy and the overall classification accuracy obtained in the previous test is not less than a preset accuracy difference, the fourth encoding sequence and the fourth part-of-speech tag number sequence are updated. Based on the updated fourth encoding sequence and the updated fourth part-of-speech tag number sequence, the process of constructing a first training sample based on each third encoding sequence and the first historical classification result corresponding to each third encoding sequence, constructing a second training sample based on each fourth encoding sequence and the second historical classification result corresponding to each fourth encoding sequence, and constructing a third training sample based on each third part-of-speech tag number sequence and the third historical classification result corresponding to each third part-of-speech tag number sequence is repeated until the accuracy difference is less than the preset accuracy difference, thus obtaining different text classification networks that have been tested.

3. The method according to claim 2, characterized in that, The step of weighted summing of the first probability value, the second probability value, and the third probability value to obtain the first evaluation value of the classification result corresponding to the first text includes: The first evaluation value is calculated using the following formula: ; ; ; , Where T is the first evaluation value. The first probability value, This is the second probability value. Let be the third probability value, 'a' be the weight value corresponding to the first probability value, 'b' be the weight value corresponding to the second probability value, and 'c' be the weight value corresponding to the third probability value. The classification accuracy of the first text classification network, To improve the classification accuracy of the second text classification network, The classification accuracy of the third text classification network.

4. The method according to claim 2, characterized in that, The update of the fourth encoding sequence and the fourth part-of-speech tag count sequence includes: Each inserted item in the fourth encoding sequence is moved forward or backward by one position to obtain the updated fourth encoding sequence; The updated fourth part-of-speech quantity value sequence is determined by updating the historical weight value of each historical part-of-speech quantity value in the fourth part-of-speech quantity value sequence.

5. The method according to claim 4, characterized in that, The step of determining the updated fourth part-of-speech quantity sequence by updating the historical weight value of each historical part-of-speech quantity value in the fourth part-of-speech quantity sequence includes: The historical weight value of each historical part-of-speech count value in the fourth part-of-speech count value sequence is updated using the following formula: , in, This represents the updated historical weight value of the i-th historical part-of-speech count in the fourth part-of-speech count sequence. This represents the historical weight value before the update of the i-th historical part-of-speech count value in the fourth part-of-speech count value sequence. To improve the classification accuracy of the third text classification network, , All are randomly varying 0s or 1s, and , The values ​​are not equal.

6. The method according to claim 1, characterized in that, A first preset network is trained based on the first training samples to obtain a first text classification network, including: For each of the first training samples, perform the following steps: The third encoded sequence from the first training sample is input into the first preset network; The third encoded sequence is processed through the first sub-network of the first preset network to obtain a first feature vector, and the third encoded sequence is processed through the second sub-network of the first preset network to obtain a second feature vector. The first feature vector and the second feature vector are fused through the feature vector fusion layer in the first preset network to obtain the third feature vector; The third feature vector is judged by the extreme value region ER classifier to determine the first historical prediction classification result; Based on the first historical prediction classification result and the first historical classification result of the first training sample, the loss function value of the first preset network is determined; If the loss function value does not meet the training stopping condition, the network parameters of the first preset network are adjusted, and the first preset network with adjusted parameters is trained using the first training samples until the training stopping condition is met, thus obtaining the first text classification network.

7. A text classification device, characterized in that, The device includes: The first acquisition module is used to acquire the text to be classified, wherein the text to be classified includes at least one word; The first encoding module is used to encode each word in the at least one word to obtain a first encoding sequence of the text to be classified; The first statistical module is used to count the number of words with different parts of speech in the text to be classified, and to obtain the first part of speech count value sequence of the text to be classified. The first insertion module is used to segment the first encoding sequence by inserting at least one preset insertion item into the first encoding sequence to obtain a second encoding sequence; The first weighting module is used to weight the first part-of-speech quantity value sequence according to the weight value of each part-of-speech quantity value to obtain the second part-of-speech quantity value sequence. The weight value is generated according to the frequency of the word corresponding to each part-of-speech quantity value in the preset language library and the preset weight value corresponding to each part-of-speech quantity value. The first input module is used to input the first encoding sequence, the second encoding sequence, and the second part-of-speech tag count sequence into different text classification networks respectively, so as to obtain the quasi-classification results corresponding to the text to be classified and the probability values ​​of each quasi-classification result; The fusion module is used to determine the quasi-classification result with the highest probability value as the classification result corresponding to the text to be classified; The device further includes: The second acquisition module is used to acquire multiple historical classification samples before acquiring the text to be classified; The second encoding module is used to encode each word in at least one word included in each historical classification sample to obtain the third encoding sequence of each historical classification sample; The second statistical module is used to count the number of words with different parts of speech in each historical classification sample, and to obtain the third part of speech count sequence for each historical classification sample; The second insertion module is used to segment each third encoding sequence by inserting at least one preset insertion item into each third encoding sequence to obtain multiple fourth encoding sequences; The second weighting module is used to weight each third part-of-speech quantity sequence according to the historical weight value of each historical part-of-speech quantity value to obtain multiple fourth part-of-speech quantity value sequences. The historical weight value is generated based on the frequency of the word corresponding to each historical part-of-speech quantity value in the preset language library and the preset weight value corresponding to each historical part-of-speech quantity value. The module is used to construct a first training sample based on each third coding sequence and the first historical classification result corresponding to each third coding sequence, construct a second training sample based on each fourth coding sequence and the second historical classification result corresponding to each fourth coding sequence, and construct a third training sample based on each third part-of-speech count sequence and the third historical classification result corresponding to each third part-of-speech count sequence. The training module is used to train different networks based on the first training sample, the second training sample, and the third training sample, respectively, to obtain different text classification networks.

8. An electronic device, characterized in that, The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the text classification method as described in any one of claims 1-6.

9. A computer storage medium, characterized in that, The computer storage medium stores computer program instructions, which, when executed by a processor, implement the text classification method as described in any one of claims 1-6.

10. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the text classification method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Text classification method, device, equipment and storage medium

    CN108875072A

  • Text classification method and device based on artificial intelligence, equipment and medium

    CN111159409A