Text multi-feature classification method and device based on Bert-LSTM

By combining the BERT model and the LSTM network to extract multi-dimensional text features, it solves the problem of the deep learning model's neglect of contextual semantic information and polysemy representation, and achieves more accurate text classification.

CN114547303BActive Publication Date: 2024-10-29HARBIN ENG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210165299.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-18
Publication Date
2024-10-29
Estimated Expiration
2042-02-18

AI Technical Summary

Technical Problem

Existing deep learning models fail to effectively capture the contextual semantic information of text and ignore knowledge entity processing. Traditional language models cannot fully represent polysemy and long-distance semantic information, resulting in limited text classification effects.

Method used

A text multi-feature classification method based on Bert-LSTM is adopted. The BERT model is combined with Tree-LSTM and Bi-LSTM networks to extract multi-dimensional text features, incorporate context dependence and potential part-of-speech information, and use PCA dimensionality reduction and RCNN for classification.

Benefits of technology

It improves the accuracy and efficiency of text classification, can more accurately capture various feature information of text, and improves the accuracy of classification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114547303B_ABST
    Figure CN114547303B_ABST
Patent Text Reader

Abstract

The invention discloses a text multi-feature classification method and device based on Bert-LSTM, belonging to the technical field of text classification, wherein the method comprises: determining a text data set to be classified, and dividing it into a training set and a test set; constructing a text multi-feature classification model based on Bert-LSTM; training the text multi-feature classification model using the training set to obtain an optimal text multi-feature classification model; inputting the text data to be classified into the optimal text multi-feature classification model, calculating the score of the text data to be classified, and dividing it into preset corresponding categories according to the score. The method uses BERT and a bidirectional long short-term memory network to construct a text multi-feature classification model based on Bert-LSTM, utilizes the word feature information and word meaning potential semantic representation feature information of mining multiple aspects of the text, and integrates the text vector, the model makes full use of the multi-feature information during the training process, and improves the performance of text classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of text classification, and in particular to a text multi-feature classification method and device based on Bert-LSTM. Background Art

[0002] With the development of modern network technology and the emergence of technologies such as big data, network information data is huge and mixed. Text and vocabulary are updated quickly and diversified. The Internet contains a large amount of various information, among which text data occupies less resources than other (such as image data, etc.), which makes most of the information on the Internet presented in the form of text. Text classification is a basic work in the field of natural language processing. The purpose is to organize and classify text information, so as to facilitate the discovery of valuable information from these massive information, such as classifying news topics; in addition, there is sentiment analysis: including two-category sentiment classification and three-category sentiment classification, and the processing methods of different types of classification will be different. The application is generally more extensive in film and television reviews, online shopping item evaluation, and service industries. Others include public opinion analysis: similar to language expression polarity analysis, which is more commonly used by news organizations. Other areas include email filtering: Nowadays, the problem of personal information leakage is serious. Users often receive various email messages, but they contain a large number of junk advertisements and malicious harassment emails. The application of text classification can filter and intercept the above information, which greatly reduces the spread of these spam emails. In addition to these, there are also related applications in the question-answering field, such as topic or answer analysis of questions, etc.

[0003] For traditional text classification, the work is mainly done manually, which is not only time-consuming but also laborious. How to reduce the cost of text classification and improve the efficiency of text classification has become a research hotspot in the field of natural language processing (NLP). The machine learning-based text classification method can automatically classify the text into categories according to the content of the text through the relevant network model under the established classifier model, so as to better help people discover text information, and therefore has received increasing attention from researchers.

[0004] Human language is complex in expressing emotions. We cannot simply extract words as features for classification. We need to combine language knowledge, use the contextual semantic part-of-speech information in the text and the language features of related fields to perform relevant processing and analysis on the text, and then classify it into categories. For text feature extraction, the bag-of-words method is generally used to represent the feature information of the text. However, due to the complex semantic expression of human emotions in natural language, such as metaphors or irony, its potential information is not easy to discover. For more complex language forms, the bag-of-words method is used to extract relevant features for vector representation, and then classify the text. Due to the lack of features, the effect is very limited. Based on the above problems, text classification has brought huge challenges.

[0005] Therefore, a text multi-feature classification method is urgently needed to solve the existing problem of text dependence on the overall information, including the word semantic expression, potential meaning, language polarity, etc. of words, which need to be expressed according to the contextual information features. Word vectors such as Word2Vec cannot capture the overall information of the text and lack complete feature dependencies. Summary of the invention

[0006] The present invention provides a text multi-feature classification method based on Bert-LSTM, which is used to solve the problem that most deep learning models do not pay attention to the semantic information of the context and ignore the processing of knowledge entities, the problem that the word vector representation of the traditional language model cannot solve the problem of polysemous word representation, and the problem that the existing model cannot fully capture long-distance semantic information.

[0007] An embodiment of the present invention provides a text multi-feature classification method based on Bert-LSTM, comprising the following steps:

[0008] Step S1, obtaining text data information to determine a text data set to be classified, and dividing it into a training set and a test set;

[0009] Step S2, constructing a text multi-feature classification model based on Bert-LSTM;

[0010] Step S3, using the training set to train the Bert-LSTM-based text multi-feature classification model to obtain an optimal text multi-feature classification model;

[0011] Step S4, inputting the text data to be classified into the optimal text multi-feature classification model, calculating the score of the text data to be classified, and classifying it into preset corresponding categories according to the score.

[0012] Another aspect of the present invention provides a text multi-feature classification device based on Bert-LSTM, comprising:

[0013] An acquisition module is used to acquire text data information to determine the text data set to be classified, and divide it into a training set and a test set;

[0014] Construction module, used to build a text multi-feature classification model based on Bert-LSTM;

[0015] A training module, used to train the Bert-LSTM-based text multi-feature classification model using the training set to obtain an optimal text multi-feature classification model;

[0016] The classification module is used to input the text data to be classified into the optimal text multi-feature classification model, calculate the score of the text data to be classified, and classify it into preset corresponding categories according to the score.

[0017] In another aspect, an embodiment of the present invention provides a text multi-feature classification device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the text multi-feature classification method based on Bert-LSTM as described in the above embodiment is implemented.

[0018] In another aspect, an embodiment of the present invention provides a non-temporary computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the Bert-LSTM-based text multi-feature classification method as described in the above embodiment is implemented.

[0019] The technical solution of the present invention achieves at least the following beneficial technical effects: during the text classification process, the text input can be better preprocessed in the Bert model, different text features can be captured in multiple dimensions by Tree-LSTM and Bi-LSTM and integrated into the text vector, and multiple feature information of the text is captured and assigned to the vector for accurate classification, and while ensuring the classification of text problems, more accurate classification problem results can be obtained.

[0020] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0022] Figure 1 A flowchart of a text multi-feature classification method based on Bert-LSTM provided in an embodiment of the present invention;

[0023] Figure 2A schematic diagram of an execution of a text multi-feature classification method based on Bert-LSTM provided in an embodiment of the present invention;

[0024] Figure 3 A diagram of a text multi-feature classification model based on Bert-LSTM constructed in an embodiment of the present invention;

[0025] Figure 4 A Bi-LSTM extraction context-dependent feature model diagram constructed for an embodiment of the present invention;

[0026] Figure 5 A diagram of a multi-feature vector extraction structure constructed according to an embodiment of the present invention;

[0027] Figure 6 A schematic diagram of the structure of a text multi-feature classification device based on Bert-LSTM provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0028] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0029] The following describes a Bert-LSTM-based text multi-feature classification method and device according to an embodiment of the present invention with reference to the accompanying drawings. First, the Bert-LSTM-based text multi-feature classification method proposed in an embodiment of the present invention will be described with reference to the accompanying drawings.

[0030] Figure 1 A flowchart of a text multi-feature classification method based on Bert-LSTM provided in an embodiment of the present invention.

[0031] like Figure 1 As shown, the text multi-feature classification method based on Bert-LSTM includes the following steps:

[0032] In step S1, text data information is obtained to determine a text data set to be classified, and the data set is divided into a training set and a test set.

[0033] Furthermore, in one embodiment of the present invention, step S1 specifically includes:

[0034] Step S101, obtaining text data information and extracting the text data set to be classified;

[0035] Step S102, preprocessing the text data set to be classified, and dividing the preprocessed text data set to be classified into a training set and a test set.

[0036] For example, text data information is obtained, and a text data set to be classified is extracted from the text data information and preprocessed, and the preprocessed data set is divided into 80% training set and 20% test set.

[0037] In step S2, a text multi-feature classification model based on Bert-LSTM is constructed.

[0038] Furthermore, in one embodiment of the present invention, the specific construction process of step S2 is:

[0039] Step S201, using the full-word masking WWM-EXT model of the BERT model, introducing the Attention mechanism, extracting some features of the text data information from different dimensions to generate a text sentence vector, and integrating some context information to obtain a high-dimensional vector matrix;

[0040] Step S202, reducing the dimension of the high-dimensional vector matrix by PCA principal component analysis technology to obtain a low-dimensional vector matrix;

[0041] Step S203, constructing a Bi-LSTM network to capture text context dependency feature information and integrate it into the text vector to obtain a text sentence vector with context dependency;

[0042] Step S204, constructing a Tree-LSTM network, taking the low-dimensional vector matrix as input to capture the text potential part-of-speech information, and integrating it into the text vector to obtain a text sentence vector with the text potential part-of-speech information;

[0043] Step S205, concatenating the text sentence vector with context dependency and the text sentence vector with text potential part-of-speech information to obtain a multi-feature text vector representation;

[0044] Step S206, input the multi-feature text vector representation into the RCNN convolutional neural network to obtain the final text vector representation, thereby completing the construction of the Bert-LSTM-based text multi-feature classification model.

[0045] Specifically, Figure 2 and 3 As shown in the figure, the full-word masking WWM-EXT model of the BERT model is used, and the Attention mechanism is introduced to enrich the text features.

[0046] Then, after BERT processing and the vectors extracted from the Attention feature, a high-dimensional vector matrix is ​​obtained through Concat splicing. However, the high-dimensional vector overhead is too large and the solution space is unstable, which leads to the deterioration of the generalization ability of the model. In addition, the data is sparse and it is difficult to accurately locate the data features. PCA is used to reduce the dimensionality of the vector matrix.

[0047] Feature extraction is performed on the sentence vector of the input layer, including the overall and local features of the text. Two LSTMs with opposite time sequences are combined. The LSTM mechanism enables the internal sequence information and logical relationship information of the text to be well captured. The first layer of the bidirectional LSTM can integrate features internally, and the second layer further integrates the context dependency. The text sentence vectors that pass through the Bi-LSTM all have their context dependencies.

[0048] The bottom-dimensional vector after PCA processing is input into the Tree-LSTM layer for deeper feature extraction. Tree-LSTM extracts its potential part-of-speech information features and enriches its semantic features. Similar to the standard LSTM structure, each cell in Tree-LSTM includes similar input gate it, output gate ot, ct and hidden layer output ht. The difference from the standard LSTM is that the update of Tree-LSTM is related to the state of the sub-unit. The multiple sub-unit mechanism of Tree-LSTM enables it to capture richer and more complete feature information in capturing the semantics of the sentence.

[0049] The multi-feature text vector obtained in the first two steps is input into RCNN for scoring through Softmax, and the text is classified according to the score. After the above steps, the text vector is obtained as the input of the next layer of RCNN. RCNN further distinguishes the vector to obtain the final feature vector F, which is input into the Softmax layer for scoring, and the category of the text is determined according to the score.

[0050] In step S3, the training set is used to train the Bert-LSTM-based text multi-feature classification model to obtain an optimal text multi-feature classification model.

[0051] Furthermore, in one embodiment of the present invention, the training process of step S3 is specifically as follows:

[0052] Step S301, inputting the training set into the Bert-LSTM-based text multi-feature classification model to obtain a final text vector representation;

[0053] Step S302, inputting the final text vector representation into a preset prediction module to obtain a prediction score;

[0054] Step S303, continuously updating the input of the Bert-LSTM-based text multi-feature classification model to obtain multiple prediction scores;

[0055] Step S304, optimizing the Bert-LSTM-based text multi-feature classification model through the error between the predicted score and the true score, and training to obtain the optimal text multi-feature classification model.

[0056] Specifically, firstly, the data in the training set is input into the text multi-feature classification model based on Bert-LSTM constructed in step S2 to obtain the final vector representation of the text:

[0057] (1) The text data in the training set is input into the text multi-feature classification model based on Bert-LSTM. BERT-WWM-EXT and attention mechanism are used to simultaneously receive text input, and certain features are extracted from the text from different dimensions. The input text is Q = (W1, W2, ..., W n )After segmenting Q, (E1, E2, ..., E n ) shows the sentence after word segmentation, BERT vectorizes it, and obtains the vector representation [T1, T2, ..., T n ]

[0058] (2) Input sentence X into the attention mechanism to enhance the model’s information extraction coverage. Two identical Attention modules are connected unidirectionally, allowing the model to focus on some features with larger weights when capturing information.

[0059] (3) After word segmentation, the expression obtained is X = (x 1 , x 2 , ..., x N ) T The corresponding embedding matrix is ​​A = (a 1 , a 2 , ..., a N ) T The two modules extract features f1 and f2 described in different dimensions respectively;

[0060] (4) Concat the two features to obtain a high-dimensional feature vector matrix F = [f1, f2], combined with the semantic context vector s i And the obtained eigenvector f i-1 .

[0061] The PCA is used to reduce the dimension of the vector matrix. The specific steps are as follows:

[0062] (1) Input n-dimensional data set D = (x(1), x(2), ... x(m))

[0063] (2) Perform decentralized operations:

[0064] (3) For the matrix XX T Perform eigenvalue decomposition;

[0065] (4) Take out the eigenvectors (w1, w2, ..., w n′ ) After standardizing all eigenvectors, they form an eigenvector matrix w;

[0066] (5) For each sample x(i) in the sample set, transform it into a new sample z (i) =W T x (i) ;

[0067] (6) The output D′=(z (1) , z (2) , ..., z (m) )

[0068] like Figure 4 As shown, the first layer of the bidirectional LSTM is then able to perform feature integration internally:

[0069] (1)H t The output text feature vector of Bi-LSTM is forward and backward to obtain the respective hidden layers x1 and The two different hidden layer vectors are obtained by Concat to obtain the vector That is, [h1, h2, ..., h m ]

[0070] (2) The attention mechanism assigns weights to the text vector. The sentence is output by LSTM as the input of Attention. n is the output of Attention, the number of input sequences is represented by N, the weight matrix is ​​U, F is the sum of the hidden layer values, and the input w at a certain moment is n And the hidden state h at the previous moment n-1 , U and V represent weight matrices, and the specific formula is as follows:

[0071]

[0072] h′ n =h n′ T UF

[0073] like Figure 5As shown in the figure, Tree-LSTM is used to extract its potential part-of-speech information features, and the Tree-STM calculation formula is as follows:

[0074]

[0075]

[0076] f jk =σ(W (f) x j +U (F) h k +b (f) )

[0077]

[0078]

[0079]

[0080] h j =o j ⊙tanh(c j )

[0081] According to the above formula, the sum of h2 and h3 is calculated and then added to x1:

[0082]

[0083] Get u1;

[0084] c2, f2 and c3, f3 are bitwise multiplied and summed, and then u1, i1 are bitwise multiplied. Finally, the two sums are added to get c1, and finally the formula is:

[0085] h j =o j e tanh(c j )

[0086] Get the hidden layer h1.

[0087] The hidden layer y is processed by the linear layer, and the processed results are mapped to the categories to calculate the loss:

[0088]

[0089]

[0090] The final loss function can be obtained from the above formula:

[0091]

[0092] The final vector representation of the text is solved according to this formula.

[0093] The final representation of the text vector is input into the prediction module to obtain the score of the text. The probability calculation formula is as follows:

[0094]

[0095] F′=V·F

[0096] T is the total amount of all categories, F i is the i-th component of the vector, the weight matrix is ​​V, and the result is input into the Softmax layer for classification and scoring. According to the score, the distribution y with the sum of 1 is obtained, and the cross entropy loss is calculated with the true distribution Y:

[0097] E(Y,y)=-Ylog(y)

[0098] For the input m samples, [x1, x2, x m ], each sample has n attributes, namely x i =[a1, a2, ..., a n ] is divided into k categories, the i-th position is 1, and the rest are 0. The probability of each category is p k =P(y(k)=1), and ∑p=1.

[0099] Then update according to the input of the Bert-LSTM-based text multi-feature classification obtained in step S2;

[0100] Finally, the model is optimized by the error between the predicted score and the true score, and the optimal text multi-feature classification model based on Bert-LSTM is trained, that is, the optimal text multi-feature classification model.

[0101] In step S4, the text data to be classified is input into the optimal text multi-feature classification model, the score of the text data to be classified is calculated, and it is classified into preset corresponding categories according to the score.

[0102] According to the Bert-LSTM-based text multi-feature classification method proposed in an embodiment of the present invention, an algorithm that integrates semantic part-of-speech information into the dictionary matching potential words combined with the tree-structured long short-term memory network Tree-LSTM is used to process word features and part-of-speech issues, and a bidirectional long short-term memory network Bi-LSTM is introduced to fully obtain text context-dependent feature information, achieve accurate expression of text features, improve the ability to extract multi-feature information of keywords, enrich text features, enhance model performance, and improve classification accuracy.

[0103] In order to implement the above embodiment, the present invention also proposes a text multi-feature classification device based on Bert-LSTM.

[0104] Figure 6 It is a structural diagram of a text multi-feature classification device based on Bert-LSTM according to an embodiment of the present invention.

[0105] like Figure 6 As shown, the Bert-LSTM-based text multi-feature classification device 10 includes: an acquisition module 100, a construction module 200, a training module 300 and a classification module 400.

[0106] The acquisition module 100 is used to acquire text data information to determine a text data set to be classified, and divide it into a training set and a test set.

[0107] The construction module 200 is used to construct a text multi-feature classification model based on Bert-LSTM.

[0108] The training module 300 is used to train the Bert-LSTM-based text multi-feature classification model using the training set to obtain an optimal text multi-feature classification model.

[0109] The classification module 400 is used to input the text data to be classified into the optimal text multi-feature classification model, calculate the score of the text data to be classified, and classify it into preset corresponding categories according to the score.

[0110] Furthermore, in one embodiment of the present invention, the acquisition module 100 specifically includes:

[0111] An extraction unit, used to obtain text data information and extract the text data set to be classified;

[0112] The preprocessing and division unit is used to preprocess the text data set to be classified, and divide the preprocessed text data set to be classified into a training set and a test set.

[0113] Furthermore, in one embodiment of the present invention, the construction module 200 specifically includes:

[0114] The extraction and fusion unit is used to use the full-word masking WWM-EXT model of the BERT model, introduce the Attention mechanism, extract some features of the text data information from different dimensions to generate a text sentence vector, and integrate some context information to obtain a high-dimensional vector matrix;

[0115] A dimensionality reduction unit, used to reduce the dimension of the high-dimensional vector matrix by using PCA principal component analysis technology to obtain a low-dimensional vector matrix;

[0116] The first capture and fusion unit is used to build a Bi-LSTM network, capture text context-dependent feature information, and integrate it into the text vector to obtain a text sentence vector with context dependency;

[0117] The second capture and fusion unit is used to construct a Tree-LSTM network, which captures the text potential part-of-speech information with the low-dimensional vector matrix as input, and integrates it into the text vector to obtain a text sentence vector with the text potential part-of-speech information;

[0118] A concatenation unit, used for concatenating the text sentence vector with context dependency and the text sentence vector with text potential part-of-speech information to obtain a multi-feature text vector representation;

[0119] A construction unit is used to input the multi-feature text vector representation into the RCNN convolutional neural network to obtain the final text vector representation, thereby completing the construction of the text multi-feature classification model based on Bert-LSTM

[0120] Furthermore, in one embodiment of the present invention, the training module 300 is specifically:

[0121] A processing unit, used for inputting the training set into the text multi-feature classification model based on Bert-LSTM to obtain a final text vector representation;

[0122] A prediction unit, used for inputting the final text vector representation into a preset prediction module to obtain a prediction score;

[0123] An updating unit, used for continuously updating the input of the Bert-LSTM-based text multi-feature classification model to obtain multiple prediction scores;

[0124] The optimization unit is used to optimize the Bert-LSTM-based text multi-feature classification model through the error between the predicted score and the true score, and train to obtain the optimal text multi-feature classification model.

[0125] It should be noted that the aforementioned explanation of the embodiment of the text multi-feature classification method based on Bert-LSTM is also applicable to the text multi-feature classification device based on Bert-LSTM in this embodiment, and will not be repeated here.

[0126] In summary, the text multi-feature classification device based on Bert-LSTM in the embodiment of the present invention processes word features and part-of-speech problems by combining the algorithm of semantic part-of-speech information with the tree structure long short-term memory network Tree-LSTM in dictionary matching potential words, and introduces the bidirectional long short-term memory network Bi-LSTM to fully obtain the text context-dependent feature information, realize the precise expression of text features, improve the ability to extract multi-feature information of keywords, enrich text features, improve the performance of the model, and improve the accuracy of classification.

[0127] In order to implement the above embodiments, the present invention also proposes a text multi-feature classification device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the Bert-LSTM-based text multi-feature classification method as described in the above embodiments is implemented.

[0128] In order to implement the above embodiments, the present invention also proposes a non-temporary computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the text multi-feature classification method based on Bert-LSTM as described in the above embodiments is implemented.

[0129] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0130] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "N" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0131] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present invention belong.

[0132] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0133] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0134] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0135] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0136] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A text multi-feature classification method based on Bert-LSTM, characterized in that: The following steps are involved: Step S1, obtaining text data information to determine a text data set to be classified, and dividing it into a training set and a test set; Step S2, constructing a text multi-feature classification model based on Bert-LSTM; Step S3, using the training set to train the Bert-LSTM-based text multi-feature classification model to obtain an optimal text multi-feature classification model; Step S4, inputting the text data to be classified into the optimal text multi-feature classification model, calculating the score of the text data to be classified, and classifying it into preset corresponding categories according to the score; The specific construction process of step S2 is: Step S201, using the full-word masking WWM-EXT model of the BERT model, introducing the Attention mechanism, extracting some features of the text data information from different dimensions to generate a text sentence vector, and integrating some context information to obtain a high-dimensional vector matrix; Step S202, reducing the dimension of the high-dimensional vector matrix by PCA principal component analysis technology to obtain a low-dimensional vector matrix; Step S203, constructing a Bi-LSTM network to capture text context dependency feature information and integrate it into the text vector to obtain a text sentence vector with context dependency; Step S204, constructing a Tree-LSTM network, taking the low-dimensional vector matrix as input to capture the text potential part-of-speech information, and integrating it into the text vector to obtain a text sentence vector with the text potential part-of-speech information; Step S205, concatenating the text sentence vector with context dependency and the text sentence vector with text potential part-of-speech information to obtain a multi-feature text vector representation; Step S206, input the multi-feature text vector representation into the RCNN convolutional neural network to obtain the final text vector representation, thereby completing the construction of the Bert-LSTM-based text multi-feature classification model.

2. The text multi-feature classification method based on Bert-LSTM according to claim 1, characterized in that: The step S1 specifically includes: Step S101, obtaining text data information and extracting the text data set to be classified; Step S102, preprocessing the text data set to be classified, and dividing the preprocessed text data set to be classified into a training set and a test set.

3. The text multi-feature classification method based on Bert-LSTM according to claim 1, characterized in that: The training process of step S3 is specifically as follows: Step S301, inputting the training set into the Bert-LSTM-based text multi-feature classification model to obtain a final text vector representation; Step S302, inputting the final text vector representation into a preset prediction module to obtain a prediction score; Step S303, continuously updating the input of the Bert-LSTM-based text multi-feature classification model to obtain multiple prediction scores; Step S304, optimizing the Bert-LSTM-based text multi-feature classification model through the error between the predicted score and the true score, and training to obtain the optimal text multi-feature classification model.

4. A text multi-feature classification device based on Bert-LSTM, characterized in that: include: An acquisition module is used to acquire text data information to determine the text data set to be classified, and divide it into a training set and a test set; Construction module, used to build a text multi-feature classification model based on Bert-LSTM; A training module, used to train the Bert-LSTM-based text multi-feature classification model using the training set to obtain an optimal text multi-feature classification model; A classification module, used for inputting the text data to be classified into the optimal text multi-feature classification model, calculating the score of the text data to be classified, and classifying it into preset corresponding categories according to the score; The building blocks specifically include: The extraction and fusion unit is used to use the full-word masking WWM-EXT model of the BERT model, introduce the Attention mechanism, extract some features of the text data information from different dimensions to generate a text sentence vector, and integrate some context information to obtain a high-dimensional vector matrix; A dimensionality reduction unit, used to reduce the dimension of the high-dimensional vector matrix by using PCA principal component analysis technology to obtain a low-dimensional vector matrix; The first capture and fusion unit is used to build a Bi-LSTM network, capture text context-dependent feature information, and integrate it into the text vector to obtain a text sentence vector with context dependency; The second capture and fusion unit is used to construct a Tree-LSTM network, which captures the text potential part-of-speech information with the low-dimensional vector matrix as input, and integrates it into the text vector to obtain a text sentence vector with the text potential part-of-speech information; A concatenation unit, used for concatenating the text sentence vector with context dependency and the text sentence vector with text potential part-of-speech information to obtain a multi-feature text vector representation; The construction unit is used to input the multi-feature text vector representation into the RCNN convolutional neural network to obtain the final text vector representation, thereby completing the construction of the Bert-LSTM-based text multi-feature classification model.

5. The text multi-feature classification device based on Bert-LSTM according to claim 4, characterized in that: The acquisition module specifically includes: An extraction unit, used to obtain text data information and extract the text data set to be classified; The preprocessing and division unit is used to preprocess the text data set to be classified, and divide the preprocessed text data set to be classified into a training set and a test set.

6. The text multi-feature classification device based on Bert-LSTM according to claim 4, characterized in that: The training modules are specifically: A processing unit, used for inputting the training set into the text multi-feature classification model based on Bert-LSTM to obtain a final text vector representation; A prediction unit, used for inputting the final text vector representation into a preset prediction module to obtain a prediction score; An updating unit, used for continuously updating the input of the Bert-LSTM-based text multi-feature classification model to obtain multiple prediction scores; The optimization unit is used to optimize the Bert-LSTM-based text multi-feature classification model through the error between the predicted score and the true score, and train to obtain the optimal text multi-feature classification model.

7. A text multi-feature classification device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the text multi-feature classification method based on Bert-LSTM as described in any one of claims 1 to 3 is implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the Bert-LSTM-based text multi-feature classification method as described in any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Comment text emotion classification model training and emotion classification method and device and equipment

    CN108363753A

  • Online public opinion text information sentiment polarity classification processing system and method

    CN111209401A